fix: restrict blind direction reversal to 3D appearance

This commit is contained in:
jhartworks committed 2026-11-10 10:31:41 +01:00
1 parent b9a095bc6e
commit 7a9b2c0a38
19 files changed
+721 -629

No files matched your search

@@ -1,13 +1,13 @@
/*! NextFloor, MIT licence. Includes three.js (MIT) and Lit (BSD-3-Clause); see LICENSE and THIRD_PARTY_NOTICES.md */
var $={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 $n=globalThis,Mn=$n.ShadowRoot&&($n.ShadyCSS===void 0||$n.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,Wr=Symbol(),ki=new WeakMap,Nt=class{constructor(e,t,n){if(this._$cssResult$=!0,n!==Wr)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(Mn&&e===void 0){let n=t!==void 0&&t.length===1;n&&(e=ki.get(t)),e===void 0&&((this.o=e=new CSSStyleSheet).replaceSync(this.cssText),n&&ki.set(t,e))}return e}toString(){return this.cssText}},Si=r=>new Nt(typeof r=="string"?r:r+"",void 0,Wr),ne=(r,...e)=>{let t=r.length===1?r[0]:e.reduce((n,o,i)=>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.")})(o)+r[i+1],r[0]);return new Nt(t,r,Wr)},$i=(r,e)=>{if(Mn)r.adoptedStyleSheets=e.map(t=>t instanceof CSSStyleSheet?t:t.styleSheet);else for(let t of e){let n=document.createElement("style"),o=$n.litNonce;o!==void 0&&n.setAttribute("nonce",o),n.textContent=t.cssText,r.appendChild(n)}},Or=Mn?r=>r:r=>r instanceof CSSStyleSheet?(e=>{let t="";for(let n of e.cssRules)t+=n.cssText;return Si(t)})(r):r;var{is:iu,defineProperty:su,getOwnPropertyDescriptor:au,getOwnPropertyNames:lu,getOwnPropertySymbols:cu,getPrototypeOf:uu}=Object,An=globalThis,Mi=An.trustedTypes,du=Mi?Mi.emptyScript:"",hu=An.reactiveElementPolyfillSupport,Wt=(r,e)=>r,Lr={toAttribute(r,e){switch(e){case Boolean:r=r?du: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}},Ei=(r,e)=>!iu(r,e),Ai={attribute:!0,type:String,converter:Lr,reflect:!1,useDefault:!1,hasChanged:Ei};Symbol.metadata??=Symbol("metadata"),An.litPropertyMetadata??=new WeakMap;var Ae=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=Ai){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(),o=this.getPropertyDescriptor(e,n,t);o!==void 0&&su(this.prototype,e,o)}}static getPropertyDescriptor(e,t,n){let{get:o,set:i}=au(this.prototype,e)??{get(){return this[t]},set(s){this[t]=s}};return{get:o,set(s){let a=o?.call(this);i?.call(this,s),this.requestUpdate(e,a,n)},configurable:!0,enumerable:!0}}static getPropertyOptions(e){return this.elementProperties.get(e)??Ai}static _$Ei(){if(this.hasOwnProperty(Wt("elementProperties")))return;let e=uu(this);e.finalize(),e.l!==void 0&&(this.l=[...e.l]),this.elementProperties=new Map(e.elementProperties)}static finalize(){if(this.hasOwnProperty(Wt("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(Wt("properties"))){let t=this.properties,n=[...lu(t),...cu(t)];for(let o of n)this.createProperty(o,t[o])}let e=this[Symbol.metadata];if(e!==null){let t=litPropertyMetadata.get(e);if(t!==void 0)for(let[n,o]of t)this.elementProperties.set(n,o)}this._$Eh=new Map;for(let[t,n]of this.elementProperties){let o=this._$Eu(t,n);o!==void 0&&this._$Eh.set(o,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 o of n)t.unshift(Or(o))}else e!==void 0&&t.push(Or(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.shaLine truncated
\f\r]`,Ot=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,Ti=/-->/g,Fi=/>/g,Je=RegExp(`>|${Br}(?:([^\\s"'>=/]+)(${Br}*=${Br}*(?:[^
\f\r"'\`<>=]|("|')|))|$)`,"g"),Di=/'/g,Pi=/"/g,Ni=/^(?:script|style|textarea|title)$/i,Yr=r=>(e,...t)=>({_$litType$:r,strings:e,values:t}),m=Yr(1),J=Yr(2),Um=Yr(3),et=Symbol.for("lit-noChange"),f=Symbol.for("lit-nothing"),Hi=new WeakMap,Qe=Xe.createTreeWalker(Xe,129);function Wi(r,e){if(!Zr(r)||!r.hasOwnProperty("raw"))throw Error("invalid template strings array");return zi!==void 0?zi.createHTML(e):e}var fu=(r,e)=>{let t=r.length-1,n=[],o,i=e===2?"<svg>":e===3?"<math>":"",s=Ot;for(let a=0;a<t;a++){let l=r[a],c,u,h=-1,p=0;for(;p<l.length&&(s.lastIndex=p,u=s.exec(l),u!==null);)p=s.lastIndex,s===Ot?u[1]==="!--"?s=Ti:u[1]!==void 0?s=Fi:u[2]!==void 0?(Ni.test(u[2])&&(o=RegExp("</"+u[2],"g")),s=Je):u[3]!==void 0&&(s=Je):s===Je?u[0]===">"?(s=o??Ot,h=-1):u[1]===void 0?h=-2:(h=s.lastIndex-u[2].length,c=u[1],s=u[3]===void 0?Je:u[3]==='"'?Pi:Di):s===Pi||s===Di?s=Je:s===Ti||s===Fi?s=Ot:(s=Je,o=void 0);let d=s===Je&&r[a+1].startsWith("/>")?" ":"";i+=s===Ot?l+pu:h>=0?(n.push(c),l.slice(0,h)+Ii+l.slice(h)+Le+d):l+Le+(h===-2?a:d)}return[Wi(r,i+(r[t]||"<?>")+(e===2?"</svg>":e===3?"</math>":"")),n]},Vt=class r{constructor({strings:e,_$litType$:t},n){let o;this.parts=[];let i=0,s=0,a=e.length-1,l=this.parts,[c,u]=fu(e,t);if(this.el=r.createElement(c,n),Qe.currentNode=this.el.content,t===2||t===3){let h=this.el.content.firstChild;h.replaceWith(...h.childNodes)}for(;(o=Qe.nextNode())!==null&&l.length<a;){if(o.nodeType===1){if(o.hasAttributes())for(let h of o.getAttributeNames())if(h.endsWith(Ii)){let p=u[s++],d=o.getAttribute(h).split(Le),_=/([.?@])?(.*)/.exec(p);l.push({type:1,index:i,name:_[2],strings:d,ctor:_[1]==="."?Kr:_[1]==="?"?Gr:_[1]==="@"?Ur:mt}),o.removeAttribute(h)}else h.startsWith(Le)&&(l.push({type:6,index:i}),o.removeAttribute(h));if(Ni.test(o.tagName)){let h=o.textContent.split(Le),p=h.length-1;if(p>0){o.textContent=En?En.emptyScript:"";for(let d=0;d<p;d++)o.append(h[d],Lt()),Qe.nextNode(),l.push({type:2,index:++i});o.append(h[p],Lt())}}}else if(o.nodeType===8)if(o.data===Ci)l.push({type:2,index:i});else{let h=-1;for(;(h=o.data.indexOf(Le,h+1))!==-1;)l.push({type:7,index:i}),h+=Le.length-1}i++}}static createElement(e,t){let n=Xe.createElement("template");return n.innerHTML=e,n}};function pt(r,e,t=r,n){if(e===et)return e;let o=n!==void 0?t._$Co?.[n]:t._$Cl,i=Bt(e)?void 0:e._$litDirective$;return o?.constructor!==i&&(o?._$AO?.(!1),i===void 0?o=void 0:(o=new i(r),o._$AT(r,t,n)),n!==void 0?(t._$Co??=[])[n]=o:t._$Cl=o),o!==void 0&&(e=pt(r,o._$AS(r,e.values),o,n)),e}var Vr=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,o=(e?.creationScope??Xe).importNode(t,!0);Qe.currentNode=o;let i=Qe.nextNode(),s=0,a=0,l=n[0];for(;l!==void 0;){if(s===l.index){let c;l.type===2?c=new Kt(i,i.nextSibling,this,e):l.type===1?c=new l.ctor(i,l.name,l.strings,this,e):l.type===6&&(c=new jr(i,this,e)),this._$AV.push(c),l=n[++a]}s!==l?.index&&(i=Qe.nextNode(),s++)}return Qe.currentNode=Xe,o}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++}},Kt=class r{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(e,t,n,o){this.type=2,this._$AH=f,this._$AN=void 0,this._$AA=e,this._$AB=t,this._$AM=n,this.options=o,this._$Cv=o?.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=pt(this,e,t),Bt(e)?e===f||e==null||e===""?(this._$AH!==f&&this._$AR(),this._$AH=f):e!==this._$AH&&e!==et&&this._(e):e._$litType$!==void 0?this.$(e):e.nodeType!==void 0?this.T(e):mu(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&&Bt(this._$AH)?this._$AA.nextSibling.data=e:this.T(Xe.createTextNode(e)),this._$AH=e}$(e){let{values:t,_$litType$:n}=e,o=typeof n=="number"?this._$AC(e):(n.el===void 0&&(n.el=Vt.createElement(Wi(n.h,n.h[0]),this.options)),n);if(this._$AH?._$AD===o)this._$AH.p(t);else{let i=new Vr(o,this),s=i.u(this.options);i.p(t),this.T(s),this._$AH=i}}_$AC(e){let t=Hi.get(e.strings);return t===void 0&&Hi.set(e.strings,t=new Vt(e)),t}k(e){Zr(this._$AH)||(this._$AH=[],this._$AR());let t=this._$AH,n,o=0;for(let i of e)o===t.length?t.push(n=new r(this.O(Lt()),this.O(Lt()),this,this.options)):n=t[o],n._$AI(i),o++;o<t.length&&(this._$AR(n&&n._$AB.nextSibling,o),t.length=o)}_$AR(e=this._$AA.nextSibling,t){for(this._$AP?.(!1,!0,t);e!==this._$AB;){let n=Ri(e).nextSibling;Ri(e).remove(),e=n}}setConnected(e){this._$AM===void 0&&(this._$Cv=e,this._$AP?.(e))}},mt=class{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(e,t,n,o,i){this.type=1,this._$AH=f,this._$AN=void 0,this.element=e,this.name=t,this._$AM=o,this.options=i,n.length>2||n[0]!==""||n[1]!==""?(this._Line truncated
var $={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 $n=globalThis,Mn=$n.ShadowRoot&&($n.ShadyCSS===void 0||$n.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,Wr=Symbol(),xi=new WeakMap,Nt=class{constructor(e,t,n){if(this._$cssResult$=!0,n!==Wr)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(Mn&&e===void 0){let n=t!==void 0&&t.length===1;n&&(e=xi.get(t)),e===void 0&&((this.o=e=new CSSStyleSheet).replaceSync(this.cssText),n&&xi.set(t,e))}return e}toString(){return this.cssText}},ki=r=>new Nt(typeof r=="string"?r:r+"",void 0,Wr),ne=(r,...e)=>{let t=r.length===1?r[0]:e.reduce((n,o,i)=>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.")})(o)+r[i+1],r[0]);return new Nt(t,r,Wr)},Si=(r,e)=>{if(Mn)r.adoptedStyleSheets=e.map(t=>t instanceof CSSStyleSheet?t:t.styleSheet);else for(let t of e){let n=document.createElement("style"),o=$n.litNonce;o!==void 0&&n.setAttribute("nonce",o),n.textContent=t.cssText,r.appendChild(n)}},Or=Mn?r=>r:r=>r instanceof CSSStyleSheet?(e=>{let t="";for(let n of e.cssRules)t+=n.cssText;return ki(t)})(r):r;var{is:iu,defineProperty:su,getOwnPropertyDescriptor:au,getOwnPropertyNames:lu,getOwnPropertySymbols:cu,getPrototypeOf:uu}=Object,An=globalThis,$i=An.trustedTypes,du=$i?$i.emptyScript:"",hu=An.reactiveElementPolyfillSupport,Wt=(r,e)=>r,Lr={toAttribute(r,e){switch(e){case Boolean:r=r?du: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}},Ai=(r,e)=>!iu(r,e),Mi={attribute:!0,type:String,converter:Lr,reflect:!1,useDefault:!1,hasChanged:Ai};Symbol.metadata??=Symbol("metadata"),An.litPropertyMetadata??=new WeakMap;var Ae=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=Mi){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(),o=this.getPropertyDescriptor(e,n,t);o!==void 0&&su(this.prototype,e,o)}}static getPropertyDescriptor(e,t,n){let{get:o,set:i}=au(this.prototype,e)??{get(){return this[t]},set(s){this[t]=s}};return{get:o,set(s){let a=o?.call(this);i?.call(this,s),this.requestUpdate(e,a,n)},configurable:!0,enumerable:!0}}static getPropertyOptions(e){return this.elementProperties.get(e)??Mi}static _$Ei(){if(this.hasOwnProperty(Wt("elementProperties")))return;let e=uu(this);e.finalize(),e.l!==void 0&&(this.l=[...e.l]),this.elementProperties=new Map(e.elementProperties)}static finalize(){if(this.hasOwnProperty(Wt("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(Wt("properties"))){let t=this.properties,n=[...lu(t),...cu(t)];for(let o of n)this.createProperty(o,t[o])}let e=this[Symbol.metadata];if(e!==null){let t=litPropertyMetadata.get(e);if(t!==void 0)for(let[n,o]of t)this.elementProperties.set(n,o)}this._$Eh=new Map;for(let[t,n]of this.elementProperties){let o=this._$Eu(t,n);o!==void 0&&this._$Eh.set(o,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 o of n)t.unshift(Or(o))}else e!==void 0&&t.push(Or(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.shaLine truncated
\f\r]`,Ot=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,zi=/-->/g,Ti=/>/g,Je=RegExp(`>|${Br}(?:([^\\s"'>=/]+)(${Br}*=${Br}*(?:[^
\f\r"'\`<>=]|("|')|))|$)`,"g"),Di=/'/g,Fi=/"/g,Ci=/^(?:script|style|textarea|title)$/i,Yr=r=>(e,...t)=>({_$litType$:r,strings:e,values:t}),m=Yr(1),Q=Yr(2),Gm=Yr(3),et=Symbol.for("lit-noChange"),f=Symbol.for("lit-nothing"),Pi=new WeakMap,Qe=Xe.createTreeWalker(Xe,129);function Ni(r,e){if(!Zr(r)||!r.hasOwnProperty("raw"))throw Error("invalid template strings array");return Ri!==void 0?Ri.createHTML(e):e}var fu=(r,e)=>{let t=r.length-1,n=[],o,i=e===2?"<svg>":e===3?"<math>":"",s=Ot;for(let a=0;a<t;a++){let l=r[a],c,u,h=-1,p=0;for(;p<l.length&&(s.lastIndex=p,u=s.exec(l),u!==null);)p=s.lastIndex,s===Ot?u[1]==="!--"?s=zi:u[1]!==void 0?s=Ti:u[2]!==void 0?(Ci.test(u[2])&&(o=RegExp("</"+u[2],"g")),s=Je):u[3]!==void 0&&(s=Je):s===Je?u[0]===">"?(s=o??Ot,h=-1):u[1]===void 0?h=-2:(h=s.lastIndex-u[2].length,c=u[1],s=u[3]===void 0?Je:u[3]==='"'?Fi:Di):s===Fi||s===Di?s=Je:s===zi||s===Ti?s=Ot:(s=Je,o=void 0);let d=s===Je&&r[a+1].startsWith("/>")?" ":"";i+=s===Ot?l+pu:h>=0?(n.push(c),l.slice(0,h)+Hi+l.slice(h)+Le+d):l+Le+(h===-2?a:d)}return[Ni(r,i+(r[t]||"<?>")+(e===2?"</svg>":e===3?"</math>":"")),n]},Vt=class r{constructor({strings:e,_$litType$:t},n){let o;this.parts=[];let i=0,s=0,a=e.length-1,l=this.parts,[c,u]=fu(e,t);if(this.el=r.createElement(c,n),Qe.currentNode=this.el.content,t===2||t===3){let h=this.el.content.firstChild;h.replaceWith(...h.childNodes)}for(;(o=Qe.nextNode())!==null&&l.length<a;){if(o.nodeType===1){if(o.hasAttributes())for(let h of o.getAttributeNames())if(h.endsWith(Hi)){let p=u[s++],d=o.getAttribute(h).split(Le),_=/([.?@])?(.*)/.exec(p);l.push({type:1,index:i,name:_[2],strings:d,ctor:_[1]==="."?Kr:_[1]==="?"?Gr:_[1]==="@"?Ur:mt}),o.removeAttribute(h)}else h.startsWith(Le)&&(l.push({type:6,index:i}),o.removeAttribute(h));if(Ci.test(o.tagName)){let h=o.textContent.split(Le),p=h.length-1;if(p>0){o.textContent=En?En.emptyScript:"";for(let d=0;d<p;d++)o.append(h[d],Lt()),Qe.nextNode(),l.push({type:2,index:++i});o.append(h[p],Lt())}}}else if(o.nodeType===8)if(o.data===Ii)l.push({type:2,index:i});else{let h=-1;for(;(h=o.data.indexOf(Le,h+1))!==-1;)l.push({type:7,index:i}),h+=Le.length-1}i++}}static createElement(e,t){let n=Xe.createElement("template");return n.innerHTML=e,n}};function pt(r,e,t=r,n){if(e===et)return e;let o=n!==void 0?t._$Co?.[n]:t._$Cl,i=Bt(e)?void 0:e._$litDirective$;return o?.constructor!==i&&(o?._$AO?.(!1),i===void 0?o=void 0:(o=new i(r),o._$AT(r,t,n)),n!==void 0?(t._$Co??=[])[n]=o:t._$Cl=o),o!==void 0&&(e=pt(r,o._$AS(r,e.values),o,n)),e}var Vr=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,o=(e?.creationScope??Xe).importNode(t,!0);Qe.currentNode=o;let i=Qe.nextNode(),s=0,a=0,l=n[0];for(;l!==void 0;){if(s===l.index){let c;l.type===2?c=new Kt(i,i.nextSibling,this,e):l.type===1?c=new l.ctor(i,l.name,l.strings,this,e):l.type===6&&(c=new jr(i,this,e)),this._$AV.push(c),l=n[++a]}s!==l?.index&&(i=Qe.nextNode(),s++)}return Qe.currentNode=Xe,o}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++}},Kt=class r{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(e,t,n,o){this.type=2,this._$AH=f,this._$AN=void 0,this._$AA=e,this._$AB=t,this._$AM=n,this.options=o,this._$Cv=o?.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=pt(this,e,t),Bt(e)?e===f||e==null||e===""?(this._$AH!==f&&this._$AR(),this._$AH=f):e!==this._$AH&&e!==et&&this._(e):e._$litType$!==void 0?this.$(e):e.nodeType!==void 0?this.T(e):mu(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&&Bt(this._$AH)?this._$AA.nextSibling.data=e:this.T(Xe.createTextNode(e)),this._$AH=e}$(e){let{values:t,_$litType$:n}=e,o=typeof n=="number"?this._$AC(e):(n.el===void 0&&(n.el=Vt.createElement(Ni(n.h,n.h[0]),this.options)),n);if(this._$AH?._$AD===o)this._$AH.p(t);else{let i=new Vr(o,this),s=i.u(this.options);i.p(t),this.T(s),this._$AH=i}}_$AC(e){let t=Pi.get(e.strings);return t===void 0&&Pi.set(e.strings,t=new Vt(e)),t}k(e){Zr(this._$AH)||(this._$AH=[],this._$AR());let t=this._$AH,n,o=0;for(let i of e)o===t.length?t.push(n=new r(this.O(Lt()),this.O(Lt()),this,this.options)):n=t[o],n._$AI(i),o++;o<t.length&&(this._$AR(n&&n._$AB.nextSibling,o),t.length=o)}_$AR(e=this._$AA.nextSibling,t){for(this._$AP?.(!1,!0,t);e!==this._$AB;){let n=Ei(e).nextSibling;Ei(e).remove(),e=n}}setConnected(e){this._$AM===void 0&&(this._$Cv=e,this._$AP?.(e))}},mt=class{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(e,t,n,o,i){this.type=1,this._$AH=f,this._$AN=void 0,this.element=e,this.name=t,this._$AM=o,this.options=i,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:
{url}`,manual:"Anleitung",manual_more:"Mehr erfahren",feature_text_energy:"Energieteilchen fliegen in B\xF6gen von den Solarfeldern zum Wechselrichter, zwischen Haus, Akku, Netz und Verbrauchern \u2013 schneller und dichter, je mehr Strom flie\xDFt. Die Module funkeln mit ihrer Produktion, eine Glaskarte \xFCber dem Dach zeigt die Bilanz und wie autark das Haus gerade ist.",live_autarky:"autark",live_fold:"Karte verkleinern",live_unfold:"Karte aufklappen",live_day_hint:"Die letzten 24 Stunden: Solar (Fl\xE4che) und Verbrauch (Linie)",live_week_hint:"Die letzten 7 Tage: Sonne {solar} kWh, Verbrauch {use} kWh (gelb: Sonne, hell: Verbrauch)",live_days:"Tage",live_car_away:"Unterwegs",live_car_charging:"L\xE4dt",live_car_plugged:"Eingesteckt",live_car_lock:"Verriegeln",live_car_unlock:"Entriegeln",live_car_unlock_confirm:"{name} wirklich entriegeln?",live_car_climate:"Klimatisierung",live_car_charge:"Laden starten/stoppen",live_media_prev:"Zur\xFCck",live_media_playpause:"Abspielen/Pause",live_media_next:"Weiter",live_media_volume:"Lautst\xE4rke",live_car_device:"Auto (eine Entit\xE4t des Autos)",live_car_device_hint:"Ladestand, Reichweite, Laden, Stecker, Schloss und Klima findet NextFloor selbst am Ger\xE4t des Autos. Ohne Angabe nimmt es den Anwesenheitssensor des Stellplatzes.",live_car_departure_entity:"Abfahrtszeit (optional)",live_car_departure:"Abfahrt {time}",live_car_open:"Offen: {parts}",printer_printing:"druckt",printer_done:"fertig",printer_paused:"pausiert",printer_error:"Fehler",printer_idle:"bereit",printer_done_at:"fertig um {time}",printer_layer:"Schicht",printer_nozzle:"D\xFCse",printer_bed:"Bett",heatpump_heating:"heizt",heatpump_water:"macht Warmwasser",heatpump_cooling:"k\xFChlt",heatpump_defrost:"taut ab",heatpump_idle:"in Ruhe",heatpump_flow_return:"Vor- \u2192 R\xFCcklauf",heatpump_heat:"W\xE4rme",heatpump_power:"Strom",heatpump_outside:"au\xDFen",pack_missing_item:"M\xF6bel aus entferntem Pack",back_to_room:"Zur\xFCck zu {room}",back_to_floor:"Zur\xFCck zur Etage",hint_furniture:"Raum antippen, dann rechts ein M\xF6belst\xFCck w\xE4hlen \xB7 M\xF6bel ziehen, an den Ecken die Gr\xF6\xDFe \xE4ndern",furniture_into:"Neue M\xF6bel kommen in die Mitte von \u201E{room}\u201C.",furniture_pick_room:"Tipp: Erst einen Raum antippen \u2013 dann landen neue M\xF6bel in seiner Mitte.",flows:"Stromfluss",flows_hint:"Energieb\xF6gen zwischen Solarfeldern, Wechselrichter, Akku, Netz und Verbrauchern ein- oder ausblenden",chk_title:"Einrichtung",chk_hint:"Was der Energiefluss braucht. Antippen springt an die Stelle.",chk_solar:"Solarfeld angelegt",chk_solar_add:"Ein Solarfeld aufs Dach legen",chk_meter:"Stromz\xE4hler mit Netzsensor",chk_meter_sensor:"Stromz\xE4hler: Netzsensor (W) fehlt",chk_meter_add:"Stromz\xE4hler anlegen",chk_inverter:"Wechselrichter mit Leistungssensor",chk_inverter_sensor:"Wechselrichter: Leistungssensor fehlt",chk_inverter_add:"Wechselrichter anlegen",chk_battery:"Stromspeicher mit Leistung und Ladestand",chk_battery_sensor:"Stromspeicher: Leistung oder Ladestand fehlt",chk_battery_opt:"Stromspeicher (optional)",chk_grid:"Netzanschluss gesetzt",chk_grid_opt:"Netzanschluss (optional, sonst automatisch)",energy_sign_grid:"Das Haus zeigt Einspeisung, obwohl die Sonne nichts liefert. Der Netzsensor hat wahrscheinlich das umgekehrte Vorzeichen.",energy_sign_battery:"Der Speicher l\xE4dt ohne Sonne und ohne Netzbezug. Sein Sensor hat wahrscheinlich das umgekehrte Vorzeichen.",energy_sign_flip:"Vorzeichen umkehren",help_title:"Hilfe und R\xFCckmeldung",help_hint:"Fehler bitte als Issue auf GitHub, W\xFCnsche als Diskussion \u2013 so geht nichts verloren, und alle sehen den Stand.",help_issue:"Problem melden",help_idea:"Idee vorschlagen",furn_name:"Name (optional)",furn_mirror:"Spiegeln",furn_mirror_hint:"Links und rechts vertauschen \u2013 das L-Sofa andersherum, der Schrank mit der T\xFCr auf der anderen Seite, die K\xFCchenzeile gespiegelt.",hint_opening:"Auf eine Wand tippen, um eine T\xFCr oder ein Fenster einzusetzen \u2013 die Art w\xE4hlst du danach rechts",preset_door:"T\xFCr",preset_door_double:"Doppelt\xFCr",preset_window:"Fenster",preset_window_double:"Fenster 2-fl\xFCgelig",preset_terrace:"Terrassent\xFCr",preset_terrace_double:"Terrassent\xFCr 2-fl\xFCgelig",preset_lift_slide:"Hebe-Schiebet\xFCr",preset_garage:"Garagentor",preset_front:"Haust\xFCr",opening_style:"Stil",sidelight_auto:"automatisch",sidelight_hinge:"Seitenteil an der Anschlagseite",sidelight_hinge_hint:"Das Seitenteil sitzt sonst gegen\xFCber dem Anschlag; mit Haken neben den B\xE4ndern.",sidelight_width:"Breite Seitenteil (m)",sidelight_width_left:"Seitenteil links (m)",sidelight_width_right:"Seitenteil rechts (m)",style_auto:"Automatisch ({style})",style_interior:"Zimmert\xFCr",style_front:"Haust\xFCr",style_front_glass:"Haust\xFCr mit Glasausschnitt",style_sidelight:"Haust\xFCr mit Seitenteil",style_sidelights:"Haust\xFCr mit 2 Seitenteilen",style_glass:"Glast\xFCr",style_sliding:"Schiebet\xFCr",style_p Line truncated
{url}`,manual:"Anleitung",manual_more:"Mehr erfahren",feature_text_energy:"Energieteilchen fliegen in B\xF6gen von den Solarfeldern zum Wechselrichter, zwischen Haus, Akku, Netz und Verbrauchern \u2013 schneller und dichter, je mehr Strom flie\xDFt. Die Module funkeln mit ihrer Produktion, eine Glaskarte \xFCber dem Dach zeigt die Bilanz und wie autark das Haus gerade ist.",live_autarky:"autark",live_fold:"Karte verkleinern",live_unfold:"Karte aufklappen",live_day_hint:"Die letzten 24 Stunden: Solar (Fl\xE4che) und Verbrauch (Linie)",live_week_hint:"Die letzten 7 Tage: Sonne {solar} kWh, Verbrauch {use} kWh (gelb: Sonne, hell: Verbrauch)",live_days:"Tage",live_car_away:"Unterwegs",live_car_charging:"L\xE4dt",live_car_plugged:"Eingesteckt",live_car_lock:"Verriegeln",live_car_unlock:"Entriegeln",live_car_unlock_confirm:"{name} wirklich entriegeln?",live_car_climate:"Klimatisierung",live_car_charge:"Laden starten/stoppen",live_media_prev:"Zur\xFCck",live_media_playpause:"Abspielen/Pause",live_media_next:"Weiter",live_media_volume:"Lautst\xE4rke",live_car_device:"Auto (eine Entit\xE4t des Autos)",live_car_device_hint:"Ladestand, Reichweite, Laden, Stecker, Schloss und Klima findet NextFloor selbst am Ger\xE4t des Autos. Ohne Angabe nimmt es den Anwesenheitssensor des Stellplatzes.",live_car_departure_entity:"Abfahrtszeit (optional)",live_car_departure:"Abfahrt {time}",live_car_open:"Offen: {parts}",printer_printing:"druckt",printer_done:"fertig",printer_paused:"pausiert",printer_error:"Fehler",printer_idle:"bereit",printer_done_at:"fertig um {time}",printer_layer:"Schicht",printer_nozzle:"D\xFCse",printer_bed:"Bett",heatpump_heating:"heizt",heatpump_water:"macht Warmwasser",heatpump_cooling:"k\xFChlt",heatpump_defrost:"taut ab",heatpump_idle:"in Ruhe",heatpump_flow_return:"Vor- \u2192 R\xFCcklauf",heatpump_heat:"W\xE4rme",heatpump_power:"Strom",heatpump_outside:"au\xDFen",pack_missing_item:"M\xF6bel aus entferntem Pack",back_to_room:"Zur\xFCck zu {room}",back_to_floor:"Zur\xFCck zur Etage",hint_furniture:"Raum antippen, dann rechts ein M\xF6belst\xFCck w\xE4hlen \xB7 M\xF6bel ziehen, an den Ecken die Gr\xF6\xDFe \xE4ndern",furniture_into:"Neue M\xF6bel kommen in die Mitte von \u201E{room}\u201C.",furniture_pick_room:"Tipp: Erst einen Raum antippen \u2013 dann landen neue M\xF6bel in seiner Mitte.",flows:"Stromfluss",flows_hint:"Energieb\xF6gen zwischen Solarfeldern, Wechselrichter, Akku, Netz und Verbrauchern ein- oder ausblenden",chk_title:"Einrichtung",chk_hint:"Was der Energiefluss braucht. Antippen springt an die Stelle.",chk_solar:"Solarfeld angelegt",chk_solar_add:"Ein Solarfeld aufs Dach legen",chk_meter:"Stromz\xE4hler mit Netzsensor",chk_meter_sensor:"Stromz\xE4hler: Netzsensor (W) fehlt",chk_meter_add:"Stromz\xE4hler anlegen",chk_inverter:"Wechselrichter mit Leistungssensor",chk_inverter_sensor:"Wechselrichter: Leistungssensor fehlt",chk_inverter_add:"Wechselrichter anlegen",chk_battery:"Stromspeicher mit Leistung und Ladestand",chk_battery_sensor:"Stromspeicher: Leistung oder Ladestand fehlt",chk_battery_opt:"Stromspeicher (optional)",chk_grid:"Netzanschluss gesetzt",chk_grid_opt:"Netzanschluss (optional, sonst automatisch)",energy_sign_grid:"Das Haus zeigt Einspeisung, obwohl die Sonne nichts liefert. Der Netzsensor hat wahrscheinlich das umgekehrte Vorzeichen.",energy_sign_battery:"Der Speicher l\xE4dt ohne Sonne und ohne Netzbezug. Sein Sensor hat wahrscheinlich das umgekehrte Vorzeichen.",energy_sign_flip:"Vorzeichen umkehren",help_title:"Hilfe und R\xFCckmeldung",help_hint:"Fehler bitte als Issue auf GitHub, W\xFCnsche als Diskussion \u2013 so geht nichts verloren, und alle sehen den Stand.",help_issue:"Problem melden",help_idea:"Idee vorschlagen",furn_name:"Name (optional)",furn_mirror:"Spiegeln",furn_mirror_hint:"Links und rechts vertauschen \u2013 das L-Sofa andersherum, der Schrank mit der T\xFCr auf der anderen Seite, die K\xFCchenzeile gespiegelt.",hint_opening:"Auf eine Wand tippen, um eine T\xFCr oder ein Fenster einzusetzen \u2013 die Art w\xE4hlst du danach rechts",preset_door:"T\xFCr",preset_door_double:"Doppelt\xFCr",preset_window:"Fenster",preset_window_double:"Fenster 2-fl\xFCgelig",preset_terrace:"Terrassent\xFCr",preset_terrace_double:"Terrassent\xFCr 2-fl\xFCgelig",preset_lift_slide:"Hebe-Schiebet\xFCr",preset_garage:"Garagentor",preset_front:"Haust\xFCr",opening_style:"Stil",sidelight_auto:"automatisch",sidelight_hinge:"Seitenteil an der Anschlagseite",sidelight_hinge_hint:"Das Seitenteil sitzt sonst gegen\xFCber dem Anschlag; mit Haken neben den B\xE4ndern.",sidelight_width:"Breite Seitenteil (m)",sidelight_width_left:"Seitenteil links (m)",sidelight_width_right:"Seitenteil rechts (m)",style_auto:"Automatisch ({style})",style_interior:"Zimmert\xFCr",style_front:"Haust\xFCr",style_front_glass:"Haust\xFCr mit Glasausschnitt",style_sidelight:"Haust\xFCr mit Seitenteil",style_sidelights:"Haust\xFCr mit 2 Seitenteilen",style_glass:"Glast\xFCr",style_sliding:"Schiebet\xFCr",style_p Line truncated
A plugin runs with the same rights as NextFloor in your browser. The file has been reviewed and its content is fixed:
{url}`,manual:"Manual",manual_more:"Learn more",feature_text_energy:"Energy particles fly in arcs from the solar fields to the inverter, between house, battery, grid and consumers \u2013 faster and denser the more power flows. The modules sparkle with their production, a glass card over the roof shows the balance and how self-sufficient the house is right now.",live_autarky:"self-sufficient",live_fold:"Make the card small",live_unfold:"Open the card",live_day_hint:"The last 24 hours: solar (area) and consumption (line)",live_week_hint:"The last 7 days: sun {solar} kWh, use {use} kWh (yellow: sun, light: use)",live_days:"days",live_car_away:"On the road",live_car_charging:"Charging",live_car_plugged:"Plugged in",live_car_lock:"Lock",live_car_unlock:"Unlock",live_car_unlock_confirm:"Really unlock {name}?",live_car_climate:"Climate",live_car_charge:"Start/stop charging",live_media_prev:"Previous",live_media_playpause:"Play/pause",live_media_next:"Next",live_media_volume:"Volume",live_car_device:"Car (any entity of the car)",live_car_device_hint:"Charge, range, charging, plug, lock and climate are found by NextFloor on the car's device. Without one it takes the spot's presence sensor.",live_car_departure_entity:"Departure time (optional)",live_car_departure:"Departs {time}",live_car_open:"Open: {parts}",printer_printing:"printing",printer_done:"done",printer_paused:"paused",printer_error:"error",printer_idle:"idle",printer_done_at:"done at {time}",printer_layer:"Layer",printer_nozzle:"Nozzle",printer_bed:"Bed",heatpump_heating:"heating",heatpump_water:"making hot water",heatpump_cooling:"cooling",heatpump_defrost:"defrosting",heatpump_idle:"resting",heatpump_flow_return:"Flow \u2192 return",heatpump_heat:"Heat",heatpump_power:"Power",heatpump_outside:"outside",pack_missing_item:"Furniture of a removed pack",back_to_room:"Back to {room}",back_to_floor:"Back to the floor",hint_furniture:"Tap a room, then pick an item on the right \xB7 drag items, resize them by their corners",furniture_into:"New items go into the middle of \u201C{room}\u201D.",furniture_pick_room:"Tip: tap a room first \u2013 new items then land in its middle.",flows:"Power flow",flows_hint:"Show or hide the energy arcs between solar fields, inverter, battery, grid and consumers",chk_title:"Setup",chk_hint:"What the energy flow needs. Tap a row to jump there.",chk_solar:"Solar field in place",chk_solar_add:"Put a solar field on the roof",chk_meter:"Meter with grid sensor",chk_meter_sensor:"Meter: grid sensor (W) missing",chk_meter_add:"Add the meter",chk_inverter:"Inverter with power sensor",chk_inverter_sensor:"Inverter: power sensor missing",chk_inverter_add:"Add an inverter",chk_battery:"Home battery with power and charge",chk_battery_sensor:"Home battery: power or charge missing",chk_battery_opt:"Home battery (optional)",chk_grid:"Grid connection set",chk_grid_opt:"Grid connection (optional, else automatic)",energy_sign_grid:"The house shows export while the sun produces nothing. The grid sensor probably has its sign reversed.",energy_sign_battery:"The battery charges with no sun and no grid draw. Its sensor probably has its sign reversed.",energy_sign_flip:"Flip the sign",help_title:"Help and feedback",help_hint:"Please report problems as a GitHub issue and wishes as a discussion \u2013 nothing gets lost, and everyone sees the state.",help_issue:"Report a problem",help_idea:"Propose an idea",furn_name:"Name (optional)",furn_mirror:"Mirror",furn_mirror_hint:"Swap left and right \u2013 the L-sofa the other way round, the cabinet with its door on the other side, the kitchen run mirrored.",hint_opening:"Tap a wall to add a door or window \u2013 choose its kind on the right afterwards",preset_door:"Door",preset_door_double:"Double door",preset_window:"Window",preset_window_double:"Double window",preset_terrace:"Terrace door",preset_terrace_double:"French doors",preset_lift_slide:"Lift-and-slide door",preset_garage:"Garage door",preset_front:"Front door",opening_style:"Style",sidelight_auto:"automatic",sidelight_hinge:"Sidelight on the hinge side",sidelight_hinge_hint:"The sidelight sits opposite the hinge otherwise; ticked, it sits next to the hinges.",sidelight_width:"Sidelight width (m)",sidelight_width_left:"Left sidelight (m)",sidelight_width_right:"Right sidelight (m)",style_auto:"Automatic ({style})",style_interior:"Room door",style_front:"Front door",style_front_glass:"Front door with glass",style_sidelight:"Front door with sidelight",style_sidelights:"Front door with two sidelights",style_glass:"Glass door",style_sliding:"Sliding door",style_passage:"Opening (no door)",style_standard:"Standard",style_bars:"With glazing bars",style_glass_wall:"Glass wall (fixed)",preset_glass_wall:"Glass wall",glass_panes:"Panes",glass_panes_auto:"automatic (about 0.9 m)",glass_panes_hint:"0 = one single pane without mullions, empty = about every 0.9 m",flip_hinge:"Swap hinge side",flip_main_leaf:"Swap main leaf",flip_hinge_hint:"Hinges to the other side" Line truncated
{url}`,manual:"Manual",manual_more:"Learn more",feature_text_energy:"Energy particles fly in arcs from the solar fields to the inverter, between house, battery, grid and consumers \u2013 faster and denser the more power flows. The modules sparkle with their production, a glass card over the roof shows the balance and how self-sufficient the house is right now.",live_autarky:"self-sufficient",live_fold:"Make the card small",live_unfold:"Open the card",live_day_hint:"The last 24 hours: solar (area) and consumption (line)",live_week_hint:"The last 7 days: sun {solar} kWh, use {use} kWh (yellow: sun, light: use)",live_days:"days",live_car_away:"On the road",live_car_charging:"Charging",live_car_plugged:"Plugged in",live_car_lock:"Lock",live_car_unlock:"Unlock",live_car_unlock_confirm:"Really unlock {name}?",live_car_climate:"Climate",live_car_charge:"Start/stop charging",live_media_prev:"Previous",live_media_playpause:"Play/pause",live_media_next:"Next",live_media_volume:"Volume",live_car_device:"Car (any entity of the car)",live_car_device_hint:"Charge, range, charging, plug, lock and climate are found by NextFloor on the car's device. Without one it takes the spot's presence sensor.",live_car_departure_entity:"Departure time (optional)",live_car_departure:"Departs {time}",live_car_open:"Open: {parts}",printer_printing:"printing",printer_done:"done",printer_paused:"paused",printer_error:"error",printer_idle:"idle",printer_done_at:"done at {time}",printer_layer:"Layer",printer_nozzle:"Nozzle",printer_bed:"Bed",heatpump_heating:"heating",heatpump_water:"making hot water",heatpump_cooling:"cooling",heatpump_defrost:"defrosting",heatpump_idle:"resting",heatpump_flow_return:"Flow \u2192 return",heatpump_heat:"Heat",heatpump_power:"Power",heatpump_outside:"outside",pack_missing_item:"Furniture of a removed pack",back_to_room:"Back to {room}",back_to_floor:"Back to the floor",hint_furniture:"Tap a room, then pick an item on the right \xB7 drag items, resize them by their corners",furniture_into:"New items go into the middle of \u201C{room}\u201D.",furniture_pick_room:"Tip: tap a room first \u2013 new items then land in its middle.",flows:"Power flow",flows_hint:"Show or hide the energy arcs between solar fields, inverter, battery, grid and consumers",chk_title:"Setup",chk_hint:"What the energy flow needs. Tap a row to jump there.",chk_solar:"Solar field in place",chk_solar_add:"Put a solar field on the roof",chk_meter:"Meter with grid sensor",chk_meter_sensor:"Meter: grid sensor (W) missing",chk_meter_add:"Add the meter",chk_inverter:"Inverter with power sensor",chk_inverter_sensor:"Inverter: power sensor missing",chk_inverter_add:"Add an inverter",chk_battery:"Home battery with power and charge",chk_battery_sensor:"Home battery: power or charge missing",chk_battery_opt:"Home battery (optional)",chk_grid:"Grid connection set",chk_grid_opt:"Grid connection (optional, else automatic)",energy_sign_grid:"The house shows export while the sun produces nothing. The grid sensor probably has its sign reversed.",energy_sign_battery:"The battery charges with no sun and no grid draw. Its sensor probably has its sign reversed.",energy_sign_flip:"Flip the sign",help_title:"Help and feedback",help_hint:"Please report problems as a GitHub issue and wishes as a discussion \u2013 nothing gets lost, and everyone sees the state.",help_issue:"Report a problem",help_idea:"Propose an idea",furn_name:"Name (optional)",furn_mirror:"Mirror",furn_mirror_hint:"Swap left and right \u2013 the L-sofa the other way round, the cabinet with its door on the other side, the kitchen run mirrored.",hint_opening:"Tap a wall to add a door or window \u2013 choose its kind on the right afterwards",preset_door:"Door",preset_door_double:"Double door",preset_window:"Window",preset_window_double:"Double window",preset_terrace:"Terrace door",preset_terrace_double:"French doors",preset_lift_slide:"Lift-and-slide door",preset_garage:"Garage door",preset_front:"Front door",opening_style:"Style",sidelight_auto:"automatic",sidelight_hinge:"Sidelight on the hinge side",sidelight_hinge_hint:"The sidelight sits opposite the hinge otherwise; ticked, it sits next to the hinges.",sidelight_width:"Sidelight width (m)",sidelight_width_left:"Left sidelight (m)",sidelight_width_right:"Right sidelight (m)",style_auto:"Automatic ({style})",style_interior:"Room door",style_front:"Front door",style_front_glass:"Front door with glass",style_sidelight:"Front door with sidelight",style_sidelights:"Front door with two sidelights",style_glass:"Glass door",style_sliding:"Sliding door",style_passage:"Opening (no door)",style_standard:"Standard",style_bars:"With glazing bars",style_glass_wall:"Glass wall (fixed)",preset_glass_wall:"Glass wall",glass_panes:"Panes",glass_panes_auto:"automatic (about 0.9 m)",glass_panes_hint:"0 = one single pane without mullions, empty = about every 0.9 m",flip_hinge:"Swap hinge side",flip_main_leaf:"Swap main leaf",flip_hinge_hint:"Hinges to the other side" Line truncated
:host {
--nf-text: var(--primary-text-color, #e1e1e1);
--nf-muted: var(--secondary-text-color, #9b9b9b);
@@ -211,7 +211,7 @@ A plugin runs with the same rights as NextFloor in your browser. The file has be
}
`;function _r(r){return r?.themes?.darkMode===!1?"light":"dark"}var Oh=4,Lh=8,Bh=[[255,181,71],[255,236,210],[55,224,255],[91,124,255],[255,95,210],[120,255,150]],zt=r=>m`<svg viewBox="0 0 24 24" width="18" height="18" fill="none" stroke="currentColor" stroke-width="1.7" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">
<path d=${ir(r)} />
</svg>`,br={previous:"M6 6h2v12H6zM20 6v12l-10-6z",play:"M8 5v14l11-7z",pause:"M7 5h4v14H7zM13 5h4v14h-4z",next:"M16 6h2v12h-2zM4 6v12l10-6z"},No=r=>m`<svg viewBox="0 0 24 24" width="16" height="16" fill="currentColor" aria-hidden="true"><path d=${r} /></svg>`,Vh=24,Kh=10,Wo=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 fr(e))this.call("light",t.service,t.data)}renderMoods(e,t){let n=e.moods??[],o=!!this.rooms&&!!this.hass.user?.is_admin;if(!n.length&&!o)return f;let i=(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(mr)}]),this._moodName=null};return m`<div class="nf-rp-moods">
</svg>`,br={previous:"M6 6h2v12H6zM20 6v12l-10-6z",play:"M8 5v14l11-7z",pause:"M7 5h4v14H7zM13 5h4v14h-4z",next:"M16 6h2v12h-2zM4 6v12l10-6z"},Co=r=>m`<svg viewBox="0 0 24 24" width="16" height="16" fill="currentColor" aria-hidden="true"><path d=${r} /></svg>`,Vh=24,Kh=10,No=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 fr(e))this.call("light",t.service,t.data)}renderMoods(e,t){let n=e.moods??[],o=!!this.rooms&&!!this.hass.user?.is_admin;if(!n.length&&!o)return f;let i=(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(mr)}]),this._moodName=null};return m`<div class="nf-rp-moods">
${n.map(l=>m`<span class="nf-rp-mood">
<button class="nf-btn" title=${this.t("mood_set")} @click=${()=>this.runMood(l.lights)}>✨ ${l.name}</button>
${i.length?m`<select class="nf-rp-mood-to" aria-label=${this.t("mood_carry")} title=${this.t("mood_carry")} @change=${c=>{let u=c.target,h=i.find(p=>p.id===u.value);u.value="",h&&this.runMood(il(l,s(h)))}}>
@@ -224,7 +224,7 @@ 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()} />
<button class="nf-btn" @click=${a}>${this.t("mood_save")}</button></span
>`:f}
</div>`}async loadCurve(e){let t=Ve(this.hass,this.floor,e,"temperature"),n=t.length?t:K(this.hass,e).filter(s=>s.startsWith("climate."));if(!n.length)return;let o=Date.now(),i=o-24*36e5;try{let s=await ln(this.hass,n,i,o,!!t.length);if(this.room?.id!==e.id)return;let a=[];for(let l=1;l<=96;l++){let c=Rt(this.hass,s,i+(o-i)*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,p)=>h+p,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=Io(this.hass,this.building,this.floor,e);try{let n=await Ya(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 o=Math.max(...n.map(s=>Date.parse(String(s.last_changed??""))||0)),i=Math.floor((Date.now()-o)/6e4);return!o||i<Kh?f:m`<div class="nf-rp-shade">
</div>`}async loadCurve(e){let t=Ve(this.hass,this.floor,e,"temperature"),n=t.length?t:K(this.hass,e).filter(s=>s.startsWith("climate."));if(!n.length)return;let o=Date.now(),i=o-24*36e5;try{let s=await ln(this.hass,n,i,o,!!t.length);if(this.room?.id!==e.id)return;let a=[];for(let l=1;l<=96;l++){let c=Rt(this.hass,s,i+(o-i)*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,p)=>h+p,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=Ho(this.hass,this.building,this.floor,e);try{let n=await Ya(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 o=Math.max(...n.map(s=>Date.parse(String(s.last_changed??""))||0)),i=Math.floor((Date.now()-o)/6e4);return!o||i<Kh?f:m`<div class="nf-rp-shade">
<span>💡 ${this.t("empty_lights_hint",{n:t.length,min:i})}</span>
<button class="nf-btn nf-rp-small" @click=${()=>this.call("light","turn_off",{entity_id:t.map(s=>s.entity_id)})}>${this.t("empty_lights_off")}</button>
</div>`}renderOpenWhileHeating(e){let t=this.room;if(!t||!this.floor)return f;let n=e.filter(a=>a.attributes.hvac_action==="heating"||a.state==="heat"&&a.attributes.hvac_action===void 0);if(!n.length)return f;let o=a=>!!a&&a!=="none"&&this.hass.states[a]?.state==="on",i=this.floor.openings.filter(a=>a.room_id===t.id&&[a.contact,a.contact2,a.tilt,a.tilt2].some(o));if(!i.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 m`<div class="nf-rp-shade nf-rp-open-heat">
@@ -241,7 +241,7 @@ A plugin runs with the same rights as NextFloor in your browser. The file has be
</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,o=n?{value:Number(n.state),unit:String(n.attributes.unit_of_measurement??"")}:null,i=Ja(e.month,o),s=a=>`${W(this.hass,a,a<10?2:1)} kWh`;return m`<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)})}${i?` \xB7 ${W(this.hass,i.value,2)} ${i.currency}`:""}
</p>`}renderCurve(){let e=this._curve;if(!e)return f;let t=e.filter(c=>c!==null),n=Math.min(...t),o=Math.max(...t),i=Math.max(1,o-n),s=e.map(c=>c===null?null:c-n+i*.1),a=cn(s,220,36,i*1.2),l=c=>`${W(this.hass,oe(this.hass,c),1)}\xB0`;return m`<div class="nf-rp-curve" title=${this.t("room_curve_hint")}>
<svg viewBox="0 0 220 36" preserveAspectRatio="none" aria-hidden="true">${J`<path d=${a}></path>`}</svg>
<svg viewBox="0 0 220 36" preserveAspectRatio="none" aria-hidden="true">${Q`<path d=${a}></path>`}</svg>
<span>24 h · ${l(n)} – ${l(o)}</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 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 o=t.slice(0,t.indexOf(".")),i=()=>o==="script"?this.call("script","turn_on",{entity_id:t}):this.call(o,"press",{entity_id:t});return m`<div class="nf-rp-alloff"><button class="nf-btn nf-rp-small" ?disabled=${I(n)} title=${this.t("room_clean_run_hint")} @click=${i}>🧹 ${this.t("room_clean_run")}</button></div>`}allOff(e){let t=an(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 m`<div class="nf-rp-alloff"><span>${this.t("all_off_done")}</span><button class="nf-btn nf-rp-small" @click=${()=>this.undoAllOff()}>↶ ${this.t("all_off_undo")}</button></div>`;let{count:t}=an(e);return t<2?f:m`<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 m`<button class="nf-rp-name" title=${this.t("details")} @click=${()=>fe(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 o=()=>{this.confirmEntities?.has(e.entity_id)&&!confirm(this.t("confirm_switch",{name:this.name(e.entity_id)}))||n()};return m`<button
class="nf-switch"
@@ -250,7 +250,7 @@ A plugin runs with the same rights as NextFloor in your browser. The file has be
aria-label=${this.name(e.entity_id)}
?disabled=${I(e)}
@click=${o}
></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),o=this.memo,{shown:i,more:s}=e?{shown:e,more:[]}:o&&o.entities===this.hass.entities&&o.floor===this.floor&&o.room===t?o:this.memo={entities:this.hass.entities,floor:this.floor,room:t,...this.floor?Gs(this.hass,this.floor,t):{shown:n,more:[]}},a=go(this.hass,s).map(y=>y.primary),l=a.length,c=this._showAll?[...i,...a]:i,u=y=>c.filter(z=>y.includes(D(z))).map(z=>this.hass.states[z]),h=u(["light"]),p=u(["cover"]),d=u(["climate"]),_=u(["media"]),b=u(["switch","fan","lock"]),g=u(["sensor","binary"]),v=u(["scene","script"]),S=this.facts(d),k=h.filter(y=>y.state==="on");return m`<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),o=this.memo,{shown:i,more:s}=e?{shown:e,more:[]}:o&&o.entities===this.hass.entities&&o.floor===this.floor&&o.room===t?o:this.memo={entities:this.hass.entities,floor:this.floor,room:t,...this.floor?Gs(this.hass,this.floor,t):{shown:n,more:[]}},a=go(this.hass,s).map(y=>y.primary),l=a.length,c=this._showAll?[...i,...a]:i,u=y=>c.filter(z=>y.includes(F(z))).map(z=>this.hass.states[z]),h=u(["light"]),p=u(["cover"]),d=u(["climate"]),_=u(["media"]),b=u(["switch","fan","lock"]),g=u(["sensor","binary"]),v=u(["scene","script"]),S=this.facts(d),k=h.filter(y=>y.state==="on");return m`<section class="nf-rp" aria-label=${t.name}>
<header class="nf-rp-head">
<div>
<h2>${t.name}</h2>
@@ -259,7 +259,7 @@ A plugin runs with the same rights as NextFloor in your browser. The file has be
${this.renderCurve()}
</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}>
<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?J`<path d="M6 14l6-6 6 6" />`:J`<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?Q`<path d="M6 14l6-6 6 6" />`:Q`<path d="M6 12h12" />`}</svg>
</button>
<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>
@@ -273,7 +273,7 @@ A plugin runs with the same rights as NextFloor in your browser. The file has be
${v.map(y=>m`<button
class="nf-btn"
?disabled=${I(y)}
@click=${()=>this.call(D(y.entity_id)==="scene"?"scene":"script","turn_on",{entity_id:y.entity_id})}
@click=${()=>this.call(F(y.entity_id)==="scene"?"scene":"script","turn_on",{entity_id:y.entity_id})}
>
${this.name(y.entity_id)}
</button>`)}
@@ -299,12 +299,12 @@ A plugin runs with the same rights as NextFloor in your browser. The file has be
${this._showAll?this.t("panel_less"):this.t("panel_more",{n:l})}
</button>`:f}
</div>
</section>`}extraValues(e){if(!this.floor)return f;let t=[...this.floor.placements.filter(n=>!n.outside&&H([n.x,n.z],e.points)).map(n=>({name:n.name||O(this.hass,n.entity_id),rows:sr(this.hass,n.values)})),...this.floor.furniture.filter(n=>H([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:sr(this.hass,n.values)}))].filter(n=>n.rows.length);return t.length?this.section("device_values",t.map(n=>m`<div class="nf-extra-values"><b>${n.name}</b>${n.rows.map(o=>m`<div class="nf-rp-row"><span class="nf-rp-icon">${o.icon}</span><span class="nf-rp-name">${o.label}</span><b class="nf-rp-state">${o.text}</b></div>`)}</div>`)):f}facts(e){let t=[],n=this.room;if(!n)return t;let o=(E,F)=>{let C=U(this.hass,this.floor,n,E);if(C===null)return null;if(E==="temperature")return`${W(this.hass,oe(this.hass,C),1)} ${X(this.hass)}`;let R=Ve(this.hass,this.floor,n,E)[0],M=this.hass.states[R]?.attributes.unit_of_measurement??F;return`${W(this.hass,C,1)} ${M}`},i=e.find(E=>typeof E.attributes.current_temperature=="number"),s=o("temperature","\xB0C");s?t.push(s):i&&n.climate?.temperature!=="none"&&t.push(`${W(this.hass,i.attributes.current_temperature,1)} ${X(this.hass)}`);let a=o("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?Ho(this.hass,this.building,this.floor,n):null;c!==null&&t.push(`\u26A1 ${lt(this.hass,c)}`);let u=this.floor?this.floor.openings.filter(E=>E.room_id===n.id).flatMap(E=>[E.contact,E.contact2,E.tilt,E.tilt2]).map(E=>E&&E!=="none"?this.hass.states[E]:void 0).filter(E=>E?.state==="on").map(E=>Date.parse(String(E.last_changed??""))).filter(Number.isFinite):[];u.length&&t.push(`\u{1FA9F} ${this.t("open_since",{time:Co(Date.now()-Math.min(...u))})}`);let h=K(this.hass,n).map(E=>this.hass.states[E]).filter(E=>!!E&&E.entity_id.startsWith("binary_sensor.")&&["motion","occupancy","presence"].includes(String(E.attributes.device_class)));if(h.length)if(h.some(E=>E.state==="on"))t.push(`\u{1F6B6} ${this.t("presence_now")}`);else{let E=Math.max(...h.map(F=>Date.parse(String(F.last_changed??""))||0));E>0&&t.push(`\u{1F6B6} ${this.t("presence_last",{time:Co(Date.now()-E)})}`)}let p=this.building?el(this.hass,this.building).filter(E=>E.roomId===n.id&&E.level<Xa):[];p.length&&t.push(`\u{1FAAB} ${this.t("battery_low_n",{n:p.length,names:p.map(E=>`${this.name(E.entity)} ${Math.round(E.level)} %`).join(", ")})}`);let d=(this.building?.settings.circuits??[]).filter(E=>E.rooms.includes(n.id)).map(E=>E.name),_=this.building?.settings.room_facts_off??[];d.length&&!_.includes("circuits")&&t.push(`\u{1F50C} ${d.join(", ")}`);let{latitude:b,longitude:g,time_zone:v}=this.hass.config??{};if(this.floor&&b!==void 0&&g!==void 0&&this.building&&!_.includes("sun")){let E=At(this.building,this.floor,n,{latitude:b,longitude:g,zone:v});E.facing.length&&t.push(`\u2600 ${this.t("room_sun_hours",{h:W(this.hass,E.hours,1),facing:E.facing.join(", ")})}`)}let S=U(this.hass,this.floor,n,"temperature"),k=U(this.hass,this.floor,n,"humidity"),y=dr(U(this.hass,this.floor,n,"co2"),k,Et(S,k));y&&!_.includes("air")&&t.push(`\u{1F4A8} ${this.t(`air_${y}`)}`);let z=hr(S,k,U(this.hass,this.floor,n,"co2"),at(new Date,this.hass.config?.latitude));return z!==null&&(S!==null||k!==null)&&!_.includes("comfort")&&t.push(`\u{1F60A} ${this.t("comfort_n",{n:z})}`),t}announceSection(e){let t=this.phrases?.length?this.phrases:[1,2,3,4,5].map(i=>this.t(`announce_phrase_${i}`)),n=i=>{let s=i.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))},o=i=>{i.preventDefault();let s=i.currentTarget.querySelector("input");n(s.value),s.value=""};return this.section("panel_announce",[m`<div class="nf-rp-scenes">${t.map(i=>m`<button class="nf-btn" @click=${()=>n(i)}>${i}</button>`)}</div>
</section>`}extraValues(e){if(!this.floor)return f;let t=[...this.floor.placements.filter(n=>!n.outside&&H([n.x,n.z],e.points)).map(n=>({name:n.name||O(this.hass,n.entity_id),rows:sr(this.hass,n.values)})),...this.floor.furniture.filter(n=>H([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:sr(this.hass,n.values)}))].filter(n=>n.rows.length);return t.length?this.section("device_values",t.map(n=>m`<div class="nf-extra-values"><b>${n.name}</b>${n.rows.map(o=>m`<div class="nf-rp-row"><span class="nf-rp-icon">${o.icon}</span><span class="nf-rp-name">${o.label}</span><b class="nf-rp-state">${o.text}</b></div>`)}</div>`)):f}facts(e){let t=[],n=this.room;if(!n)return t;let o=(E,D)=>{let C=U(this.hass,this.floor,n,E);if(C===null)return null;if(E==="temperature")return`${W(this.hass,oe(this.hass,C),1)} ${X(this.hass)}`;let R=Ve(this.hass,this.floor,n,E)[0],M=this.hass.states[R]?.attributes.unit_of_measurement??D;return`${W(this.hass,C,1)} ${M}`},i=e.find(E=>typeof E.attributes.current_temperature=="number"),s=o("temperature","\xB0C");s?t.push(s):i&&n.climate?.temperature!=="none"&&t.push(`${W(this.hass,i.attributes.current_temperature,1)} ${X(this.hass)}`);let a=o("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?Po(this.hass,this.building,this.floor,n):null;c!==null&&t.push(`\u26A1 ${lt(this.hass,c)}`);let u=this.floor?this.floor.openings.filter(E=>E.room_id===n.id).flatMap(E=>[E.contact,E.contact2,E.tilt,E.tilt2]).map(E=>E&&E!=="none"?this.hass.states[E]:void 0).filter(E=>E?.state==="on").map(E=>Date.parse(String(E.last_changed??""))).filter(Number.isFinite):[];u.length&&t.push(`\u{1FA9F} ${this.t("open_since",{time:Io(Date.now()-Math.min(...u))})}`);let h=K(this.hass,n).map(E=>this.hass.states[E]).filter(E=>!!E&&E.entity_id.startsWith("binary_sensor.")&&["motion","occupancy","presence"].includes(String(E.attributes.device_class)));if(h.length)if(h.some(E=>E.state==="on"))t.push(`\u{1F6B6} ${this.t("presence_now")}`);else{let E=Math.max(...h.map(D=>Date.parse(String(D.last_changed??""))||0));E>0&&t.push(`\u{1F6B6} ${this.t("presence_last",{time:Io(Date.now()-E)})}`)}let p=this.building?el(this.hass,this.building).filter(E=>E.roomId===n.id&&E.level<Xa):[];p.length&&t.push(`\u{1FAAB} ${this.t("battery_low_n",{n:p.length,names:p.map(E=>`${this.name(E.entity)} ${Math.round(E.level)} %`).join(", ")})}`);let d=(this.building?.settings.circuits??[]).filter(E=>E.rooms.includes(n.id)).map(E=>E.name),_=this.building?.settings.room_facts_off??[];d.length&&!_.includes("circuits")&&t.push(`\u{1F50C} ${d.join(", ")}`);let{latitude:b,longitude:g,time_zone:v}=this.hass.config??{};if(this.floor&&b!==void 0&&g!==void 0&&this.building&&!_.includes("sun")){let E=At(this.building,this.floor,n,{latitude:b,longitude:g,zone:v});E.facing.length&&t.push(`\u2600 ${this.t("room_sun_hours",{h:W(this.hass,E.hours,1),facing:E.facing.join(", ")})}`)}let S=U(this.hass,this.floor,n,"temperature"),k=U(this.hass,this.floor,n,"humidity"),y=dr(U(this.hass,this.floor,n,"co2"),k,Et(S,k));y&&!_.includes("air")&&t.push(`\u{1F4A8} ${this.t(`air_${y}`)}`);let z=hr(S,k,U(this.hass,this.floor,n,"co2"),at(new Date,this.hass.config?.latitude));return z!==null&&(S!==null||k!==null)&&!_.includes("comfort")&&t.push(`\u{1F60A} ${this.t("comfort_n",{n:z})}`),t}announceSection(e){let t=this.phrases?.length?this.phrases:[1,2,3,4,5].map(i=>this.t(`announce_phrase_${i}`)),n=i=>{let s=i.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))},o=i=>{i.preventDefault();let s=i.currentTarget.querySelector("input");n(s.value),s.value=""};return this.section("panel_announce",[m`<div class="nf-rp-scenes">${t.map(i=>m`<button class="nf-btn" @click=${()=>n(i)}>${i}</button>`)}</div>
<form class="nf-rp-say" @submit=${o}>
<input type="text" maxlength="500" placeholder=${this.t("announce_placeholder")} aria-label=${this.t("announce_placeholder")} />
<button class="nf-btn nf-primary" type="submit">${this.t("announce_send")}</button>
</form>
${this._said?m`<p class="nf-rp-note ${this._said.failed?"nf-rp-fail":""}" role="status">${this._said.text}</p>`:f}`])}pluginSections(e,t){return rs({hass:this.hass,room:{id:e.id,name:e.name,area_id:e.area_id??null},entities:t}).map(o=>m`<div class="nf-rp-sec nf-rp-plugin" data-plugin=${o.key}>
${this._said?m`<p class="nf-rp-note ${this._said.failed?"nf-rp-fail":""}" role="status">${this._said.text}</p>`:f}`])}pluginSections(e,t){return ns({hass:this.hass,room:{id:e.id,name:e.name,area_id:e.area_id??null},entities:t}).map(o=>m`<div class="nf-rp-sec nf-rp-plugin" data-plugin=${o.key}>
<div class="nf-rp-sec-head"><h3>${o.title}</h3></div>
${typeof o.content=="string"?m`<p class="nf-rp-note">${o.content}</p>`:o.content}
</div>`)}section(e,t,n=f){return m`<div class="nf-rp-sec">
@@ -392,20 +392,20 @@ A plugin runs with the same rights as NextFloor in your browser. The file has be
${this.stateLabel(u)}
</button>`)}
</div>`:f}
</div>`}stateOf(e,t=te(this.hass,e)){if(this.room?.no_state?.includes(e.entity_id))return"";let n=D(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,o=I(e)||e.state==="off",i=[t.media_title,t.media_artist].filter(s=>typeof s=="string"&&s).join(" \xB7 ");return m`<div class="nf-rp-row">
</div>`}stateOf(e,t=te(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,o=I(e)||e.state==="off",i=[t.media_title,t.media_artist].filter(s=>typeof s=="string"&&s).join(" \xB7 ");return m`<div class="nf-rp-row">
<span class="nf-rp-icon ${e.state==="playing"?"nf-rp-on":""}">${zt("media")}</span>
${this.nameButton(n)}
<span class="nf-rp-state">${this.stateOf(e,this.stateLabel(e.state))}</span>
${i?m`<p class="nf-rp-media nf-rp-wide">${i}</p>`:f}
<div class="nf-rp-buttons nf-rp-wide">
<button class="nf-btn nf-rp-small" aria-label=${this.t("previous")} ?disabled=${o} @click=${()=>this.call("media_player","media_previous_track",{entity_id:n})}>
${No(br.previous)}
${Co(br.previous)}
</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})}>
${No(e.state==="playing"?br.pause:br.play)}
${Co(e.state==="playing"?br.pause:br.play)}
</button>
<button class="nf-btn nf-rp-small" aria-label=${this.t("next")} ?disabled=${o} @click=${()=>this.call("media_player","media_next_track",{entity_id:n})}>
${No(br.next)}
${Co(br.next)}
</button>
</div>
${typeof t.volume_level=="number"?m`<label class="nf-rp-slider"
@@ -417,12 +417,12 @@ A plugin runs with the same rights as NextFloor in your browser. The file has be
.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})}
/></label>`:f}
</div>`}switchRow(e){let t=e.entity_id,n=D(t),o=t.slice(0,t.indexOf(".")),i=n==="lock"?e.state==="unlocked"||e.state==="open":Q(e),s=()=>n==="lock"?this.call("lock",i?"lock":"unlock",{entity_id:t}):this.call(o,"toggle",{entity_id:t});return m`<div class="nf-rp-row">
</div>`}switchRow(e){let t=e.entity_id,n=F(t),o=t.slice(0,t.indexOf(".")),i=n==="lock"?e.state==="unlocked"||e.state==="open":J(e),s=()=>n==="lock"?this.call("lock",i?"lock":"unlock",{entity_id:t}):this.call(o,"toggle",{entity_id:t});return m`<div class="nf-rp-row">
<span class="nf-rp-icon ${i?"nf-rp-on":""}">${zt(n)}</span>
${this.nameButton(t)}
<span class="nf-rp-state">${this.stateOf(e)}</span>
${this.toggle(e,i,s)}
</div>`}sensorRow(e){let t=D(e.entity_id),n=t==="binary"&&e.state==="on";return m`<div class="nf-rp-row">
</div>`}sensorRow(e){let t=F(e.entity_id),n=t==="binary"&&e.state==="on";return m`<div class="nf-rp-row">
<span class="nf-rp-icon ${n?"nf-rp-on":""}">${zt(t)}</span>
${this.nameButton(e.entity_id)}
<span class="nf-rp-state">${this.stateOf(e)}</span>
@@ -807,8 +807,8 @@ A plugin runs with the same rights as NextFloor in your browser. The file has be
outline: 2px solid var(--nf-accent);
outline-offset: 2px;
}
`]};customElements.get("nf-room-panel")||customElements.define("nf-room-panel",Wo);function dl(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 Gh=[[/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]]],hl=[34,211,238];function Oo(r){return r?Gh.find(([e])=>e.test(r))?.[1]??hl:hl}function Lo(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 Bo=r=>r.state==="playing"||r.state==="on"&&Lo(r);function pl(r,e){let t=[],n=new Set;for(let o of e){if(!o.entity.startsWith("media_player.")||n.has(o.entity))continue;n.add(o.entity);let i=r.states[o.entity];if(!i)continue;let s=i.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:o.entity,name:o.name,at:o.at,playing:Bo(i),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:Oo(l),app:l,group:Array.isArray(s.group_members)?s.group_members.filter(u=>typeof u=="string"&&u!==o.entity):[],rings:o.rings??1})}return t}function ml(r){let e=new Map(r.filter(o=>o.playing).map(o=>[o.entity,o])),t=[],n=new Set;for(let o of e.values())for(let i of o.group){let s=e.get(i),a=[o.entity,i].sort().join("|");s&&!n.has(a)&&(n.add(a),t.push([o,s]))}return t}var Uh=3;function fl(r,e,t){let n=[];for(let o of e.floors)for(let i of o.furniture){if(!i.type.endsWith(":sprinkler"))continue;let s=t?.get(i.id)?.entity??null;!s||!Q(r.states[s])||n.push({id:i.id,at:{floorId:o.id,x:i.x,y:ce(o,i)+i.h,z:i.z},reach:Math.min(15,Math.max(.5,i.spray??Uh))})}return n}var vr=r=>r&&r!=="none"?r:null,gl=r=>Math.min(1,Math.max(0,r));function _l(r,e){let t=new Map;for(let n of e.settings.roof?.windows??[]){let o=ze(r,{cover:vr(n.cover),contact:vr(n.contact),tilt:vr(n.tilt)},"window"),i=vr(n.window),s=i?r.states[i]:void 0,a=o.open;if(s&&!I(s)){let l=s.attributes.current_position;a=typeof l=="number"?gl(l/100):s.state==="open"||s.state==="opening"?1:0}t.set(n.id,{open:a,tilt:o.tilt,cover:o.cover??0})}return t}function jh(r,e){let t=o=>Math.hypot(o.x-e.x,o.z-e.z);return r.placements.filter(o=>o.entity_id.startsWith("media_player.")&&t(o)<Math.max(2,e.w)).sort((o,i)=>t(o)-t(i))[0]?.entity_id??null}var je=(r,e)=>typeof r[e]=="string"?r[e]:"";function bl(r,e,t){let n=[];for(let o of e.floors)for(let i of o.furniture){if(!Qn(i.type))continue;let s=t?.get(i.id)?.entity??null,a=s?.startsWith("media_player.")?s:jh(o,i),l=a?r.states[a]:void 0;if(!l||!Lo(l))continue;let c=l.attributes,u=je(c,"app_name")||je(c,"source")||null;n.push({id:i.id,furnitureId:i.id,floorId:o.id,color:Oo(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:Bo(l),ambilight:i.ambilight??1})}return n}function vl(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 wl(r,e){return(r===null?0:gl((r+4)/16))*(1-.45*e)}function qe(r,e){return e&&r.states[e]?e:Object.keys(r.states).filter(t=>t.startsWith("weather.")).sort()[0]??null}var wr=new Set(["contact_lost","unlocked_night","own"]);function qh(r,e){let t=r.states[e.entity];if(!t||["unavailable","unknown"].includes(t.state))return!1;let n=(e.state??"on").trim(),o=/^([<>])\s*(-?\d+(?:[.,]\d+)?)$/.exec(n);if(o){let i=Number(t.state),s=Number(o[2].replace(",","."));return Number.isFinite(i)&&(o[1]==="<"?i<s:i>s)}return n.split(",").map(i=>i.trim().toLowerCase()).filter(Boolean).includes(String(t.state).toLowerCase())}var Zh=600*1e3,Yh=new Set(["rainy","pouring","lightning-rainy","hail","snowy-rainy"]),Jh=new Map([["smoke","smoke"],["gas","gas"],["carbon_monoxide","co"],["moisture","water"]]),yl=(r,e)=>{if(e.startsWith("binary_sensor."))return Jh.get(String(r.states[e]?.attributes.device_class))};function Qh(r,e){let t=new Set,n=[];for(let o of r.floors)for(let i of o.openings){let s=e.get(i.id);for(let a of s?[s.contact,s.contact2,s.tilt,s.tilt2]:[])!a||t.has(a)||(t.add(a),n.push({floorId:o.id,roomId:i.room_id,entity:a}))}return n}function xl(r,e,t,n){let o=[];for(let a of e.floors)for(let l of a.rooms){let c=K(r,l).filter(u=>yl(r,u)); Line truncated
${J`<circle cx="27" cy="27" r=${22} class="live-ring-bg"></circle>
`]};customElements.get("nf-room-panel")||customElements.define("nf-room-panel",No);function dl(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 Gh=[[/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]]],hl=[34,211,238];function Wo(r){return r?Gh.find(([e])=>e.test(r))?.[1]??hl:hl}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 Lo=r=>r.state==="playing"||r.state==="on"&&Oo(r);function pl(r,e){let t=[],n=new Set;for(let o of e){if(!o.entity.startsWith("media_player.")||n.has(o.entity))continue;n.add(o.entity);let i=r.states[o.entity];if(!i)continue;let s=i.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:o.entity,name:o.name,at:o.at,playing:Lo(i),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:Wo(l),app:l,group:Array.isArray(s.group_members)?s.group_members.filter(u=>typeof u=="string"&&u!==o.entity):[],rings:o.rings??1})}return t}function ml(r){let e=new Map(r.filter(o=>o.playing).map(o=>[o.entity,o])),t=[],n=new Set;for(let o of e.values())for(let i of o.group){let s=e.get(i),a=[o.entity,i].sort().join("|");s&&!n.has(a)&&(n.add(a),t.push([o,s]))}return t}var Uh=3;function fl(r,e,t){let n=[];for(let o of e.floors)for(let i of o.furniture){if(!i.type.endsWith(":sprinkler"))continue;let s=t?.get(i.id)?.entity??null;!s||!J(r.states[s])||n.push({id:i.id,at:{floorId:o.id,x:i.x,y:ce(o,i)+i.h,z:i.z},reach:Math.min(15,Math.max(.5,i.spray??Uh))})}return n}var vr=r=>r&&r!=="none"?r:null,gl=r=>Math.min(1,Math.max(0,r));function _l(r,e){let t=new Map;for(let n of e.settings.roof?.windows??[]){let o=ze(r,{cover:vr(n.cover),contact:vr(n.contact),tilt:vr(n.tilt)},"window"),i=vr(n.window),s=i?r.states[i]:void 0,a=o.open;if(s&&!I(s)){let l=s.attributes.current_position;a=typeof l=="number"?gl(l/100):s.state==="open"||s.state==="opening"?1:0}t.set(n.id,{open:a,tilt:o.tilt,cover:o.cover??0})}return t}function jh(r,e){let t=o=>Math.hypot(o.x-e.x,o.z-e.z);return r.placements.filter(o=>o.entity_id.startsWith("media_player.")&&t(o)<Math.max(2,e.w)).sort((o,i)=>t(o)-t(i))[0]?.entity_id??null}var je=(r,e)=>typeof r[e]=="string"?r[e]:"";function bl(r,e,t){let n=[];for(let o of e.floors)for(let i of o.furniture){if(!Qn(i.type))continue;let s=t?.get(i.id)?.entity??null,a=s?.startsWith("media_player.")?s:jh(o,i),l=a?r.states[a]:void 0;if(!l||!Oo(l))continue;let c=l.attributes,u=je(c,"app_name")||je(c,"source")||null;n.push({id:i.id,furnitureId:i.id,floorId:o.id,color:Wo(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:Lo(l),ambilight:i.ambilight??1})}return n}function vl(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 wl(r,e){return(r===null?0:gl((r+4)/16))*(1-.45*e)}function qe(r,e){return e&&r.states[e]?e:Object.keys(r.states).filter(t=>t.startsWith("weather.")).sort()[0]??null}var wr=new Set(["contact_lost","unlocked_night","own"]);function qh(r,e){let t=r.states[e.entity];if(!t||["unavailable","unknown"].includes(t.state))return!1;let n=(e.state??"on").trim(),o=/^([<>])\s*(-?\d+(?:[.,]\d+)?)$/.exec(n);if(o){let i=Number(t.state),s=Number(o[2].replace(",","."));return Number.isFinite(i)&&(o[1]==="<"?i<s:i>s)}return n.split(",").map(i=>i.trim().toLowerCase()).filter(Boolean).includes(String(t.state).toLowerCase())}var Zh=600*1e3,Yh=new Set(["rainy","pouring","lightning-rainy","hail","snowy-rainy"]),Jh=new Map([["smoke","smoke"],["gas","gas"],["carbon_monoxide","co"],["moisture","water"]]),yl=(r,e)=>{if(e.startsWith("binary_sensor."))return Jh.get(String(r.states[e]?.attributes.device_class))};function Qh(r,e){let t=new Set,n=[];for(let o of r.floors)for(let i of o.openings){let s=e.get(i.id);for(let a of s?[s.contact,s.contact2,s.tilt,s.tilt2]:[])!a||t.has(a)||(t.add(a),n.push({floorId:o.id,roomId:i.room_id,entity:a}))}return n}function xl(r,e,t,n){let o=[];for(let a of e.floors)for(let l of a.rooms){let c=K(r,l).filter(u=>yl(r,u)); Line truncated
${Q`<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>`}
</svg>`}function lm(r,e,t,n){let o=e.summary,i=c=>A(r,c),s=e.autarky,a=n?m`<button class="live-fold" title=${i(n.folded?"live_unfold":"live_fold")} aria-label=${i(n.folded?"live_unfold":"live_fold")} aria-expanded=${!n.folded} @click=${n.toggle}>${n.folded?"+":"\u2212"}</button>`:f;if(n?.folded){let c=o.solar!==null?`\u2600 ${Me(r,o.solar)}`:o.consumption!==null?`\u2302 ${Me(r,o.consumption)}`:null;return m`<div class="live-card live-card-house live-folded" data-i=${t}>
${s!==null?m`<div class="live-own">${vn(s,s>.95?"#4ade80":s>.6?"#facc15":"#f87171")}<div class="live-own-text"><b>${Math.round(s*100)}%</b></div></div>`:f}
@@ -819,15 +819,15 @@ A plugin runs with the same rights as NextFloor in your browser. The file has be
${s!==null?m`<div class="live-own">${vn(s,s>.95?"#4ade80":s>.6?"#facc15":"#f87171")}<div class="live-own-text"><b>${Math.round(s*100)} %</b><span>${i("live_autarky")}</span></div></div>`:f}
<div class="live-rows">${l}</div>
${um(r,e.curves)} ${cm(r,e.week)}
</div>`}function cm(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,[o,i]=[150,30],s=o/7,a=(c,u,h)=>c===null||c<=0?f:J`<rect x=${u.toFixed(1)} y=${(i-c/n*i).toFixed(1)} width=${(s*.36).toFixed(1)} height=${(c/n*i).toFixed(1)} class=${h}></rect>`,l=c=>c.reduce((u,h)=>u+(h??0),0);return m`<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)})}>
</div>`}function cm(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,[o,i]=[150,30],s=o/7,a=(c,u,h)=>c===null||c<=0?f:Q`<rect x=${u.toFixed(1)} y=${(i-c/n*i).toFixed(1)} width=${(s*.36).toFixed(1)} height=${(c/n*i).toFixed(1)} class=${h}></rect>`,l=c=>c.reduce((u,h)=>u+(h??0),0);return m`<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 ${o} ${i}`} preserveAspectRatio="none" aria-hidden="true">
${e.days.map((c,u)=>J`${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)=>Q`${a(e.solar[u],u*s+s*.1,"live-week-solar")}${a(e.use[u],u*s+s*.5,"live-week-use")}`)}
</svg>
<span>7 ${A(r,"live_days")}</span>
</div>`}function um(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,[o,i]=[150,34],s=cn(e.solar,o,i,n),a=cn(e.use,o,i,n);return m`<div class="live-day" title=${A(r,"live_day_hint")}>
<svg viewBox=${`0 0 ${o} ${i}`} preserveAspectRatio="none" aria-hidden="true">
${s?J`<path d=${`${s}L${o},${i}L0,${i}Z`} class="live-day-solar"></path>`:f}
${a?J`<path d=${a} class="live-day-use"></path>`:f}
${s?Q`<path d=${`${s}L${o},${i}L0,${i}Z`} class="live-day-solar"></path>`:f}
${a?Q`<path d=${a} class="live-day-use"></path>`:f}
</svg>
<span>24 h</span>
</div>`}function dm(r,e,t,n){let o=e.car,i=(u,h)=>A(r,u,h),s=gc(o.soc),a=o.home?o.charging?`\u26A1 ${i("live_car_charging")}${o.chargingW?` \xB7 ${Me(r,o.chargingW)}`:""}`:o.plugged?`\u{1F50C} ${i("live_car_plugged")}`:"":`${i("live_car_away")}${o.where?` \xB7 ${o.where}`:""}${o.distance!==null?` \xB7 ${W(r,o.distance,o.distance<10?1:0)} km`:""}`,l=o.entities,c=(u,h,p,d)=>m`<button class="live-btn ${u?"live-on":""}" title=${h} aria-label=${h} aria-pressed=${u??!1} @click=${_=>(_.stopPropagation(),d())}>${p}</button>`;return m`<div class="live-card live-card-car ${o.charging?"live-charging":""} ${o.home?"":"live-away"}" data-i=${t} style=${`--live-soc:${s}`}>
@@ -1219,7 +1219,7 @@ A plugin runs with the same rights as NextFloor in your browser. The file has be
text-transform: uppercase;
letter-spacing: 0.04em;
}
`;function Fr(r){return r.toLocaleLowerCase().normalize("NFD").replace(new RegExp("\\p{M}","gu"),"")}var ai=r=>r.points.length>=3;function wc(r,e,t){return r.rooms.filter(ai).find(n=>H([e,t],n.points))}function gm(r,e,t,n){let o=[];for(let a of e.rooms.filter(ai)){let[l,c]=xe(a.points);o.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 i=new Set,s=(a,l,c,u)=>{if(i.has(a)||!(a in r.states))return;i.add(a);let h=wc(e,l,c),p=[h?.name,n?e.name:void 0].filter(d=>!!d).join(" \xB7 ");o.push({kind:"device",name:O(r,a),where:p,floorId:e.id,roomId:h?.id??null,entity:a,icon:D(a),x:l,z:c,y:u})};for(let a of e.placements){let l=a.y??yt(D(a.entity_id)??"sensor",me(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=me(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=wc(e,a.x,a.z),c=[l?.name,n?e.name:void 0].filter(u=>!!u).join(" \xB7 ");o.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 o}function yc(r,e){let t=it(r,e.floors),n=e.floors.length>1,o=e.floors.flatMap(i=>gm(r,i,t,n));for(let i of e.settings.circuits??[]){let s=e.floors.flatMap(h=>h.rooms.filter(p=>i.rooms.includes(p.id)&&ai(p)).map(p=>({f:h,r:p})));if(!s.length)continue;let[{f:a,r:l}]=s,[c,u]=xe(l.points);o.push({kind:"circuit",name:`\u{1F50C} ${i.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 o}function _m(r,e){return(Fr(r.name).startsWith(e)?0:2)+(r.kind==="room"?0:1)}function xc(r,e,t=8){let n=Fr(e).split(/\s+/).filter(Boolean);if(n.length===0)return[];let o=Fr(e.trim());return r.filter(i=>{let s=Fr([i.name,i.where,i.entity].filter(Boolean).join(" "));return n.every(a=>s.includes(a))}).map(i=>({item:i,cost:_m(i,o)})).sort((i,s)=>i.cost-s.cost||i.item.name.localeCompare(s.item.name)).slice(0,t).map(i=>i.item)}var bm=[[255,181,71],[255,236,210],[55,224,255],[91,124,255],[190,90,255],[255,95,210],[255,70,70],[120,255,150]],vm=[2200,2700,3200,4e3,5e3,6500],wm=["hs","rgb","rgbw","rgbww","xy"],ym=4,kc=16,Sc=32,xm=128;function ci(r){let e=r.attributes.supported_color_modes??[],t=e.some(n=>wm.includes(n));return{dim:e.some(n=>n!=="onoff"),color:t,temp:e.includes("color_temp")}}function ui(r){return((r.attributes.supported_features??0)&ym)!==0&&typeof r.attributes.current_position=="number"}var li=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 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(){fe(this,this.entity),this.close()}ring(e){let t=e.length;return e.map((n,o)=>{let i=o/t*Math.PI*2-Math.PI/2;return m`<div class="qm-at" style="left:${50+Math.cos(i)*39}%;top:${50+Math.sin(i)*39}%">${n}</div>`})}renderLight(e){let t=ci(e),n=e.state==="on",o=n&&typeof e.attributes.brightness=="number"?Math.round(e.attributes.brightness/2.55):n?100:0,i=t.color?bm.map(s=>m`<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?vm.map(s=>m`<button class="qm-swatch" style="background:${km(s)}" aria-label=${`${s} K`} @click=${()=>this.call("light","turn_on",{color_temp_kelvin:s})}></button>`):[];return m`<div class="qm-ring ${i.length?"":"qm-ring-small"}">
`;function Dr(r){return r.toLocaleLowerCase().normalize("NFD").replace(new RegExp("\\p{M}","gu"),"")}var si=r=>r.points.length>=3;function wc(r,e,t){return r.rooms.filter(si).find(n=>H([e,t],n.points))}function gm(r,e,t,n){let o=[];for(let a of e.rooms.filter(si)){let[l,c]=xe(a.points);o.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 i=new Set,s=(a,l,c,u)=>{if(i.has(a)||!(a in r.states))return;i.add(a);let h=wc(e,l,c),p=[h?.name,n?e.name:void 0].filter(d=>!!d).join(" \xB7 ");o.push({kind:"device",name:O(r,a),where:p,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??yt(F(a.entity_id)??"sensor",me(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=me(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=wc(e,a.x,a.z),c=[l?.name,n?e.name:void 0].filter(u=>!!u).join(" \xB7 ");o.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 o}function yc(r,e){let t=it(r,e.floors),n=e.floors.length>1,o=e.floors.flatMap(i=>gm(r,i,t,n));for(let i of e.settings.circuits??[]){let s=e.floors.flatMap(h=>h.rooms.filter(p=>i.rooms.includes(p.id)&&si(p)).map(p=>({f:h,r:p})));if(!s.length)continue;let[{f:a,r:l}]=s,[c,u]=xe(l.points);o.push({kind:"circuit",name:`\u{1F50C} ${i.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 o}function _m(r,e){return(Dr(r.name).startsWith(e)?0:2)+(r.kind==="room"?0:1)}function xc(r,e,t=8){let n=Dr(e).split(/\s+/).filter(Boolean);if(n.length===0)return[];let o=Dr(e.trim());return r.filter(i=>{let s=Dr([i.name,i.where,i.entity].filter(Boolean).join(" "));return n.every(a=>s.includes(a))}).map(i=>({item:i,cost:_m(i,o)})).sort((i,s)=>i.cost-s.cost||i.item.name.localeCompare(s.item.name)).slice(0,t).map(i=>i.item)}var bm=[[255,181,71],[255,236,210],[55,224,255],[91,124,255],[190,90,255],[255,95,210],[255,70,70],[120,255,150]],vm=[2200,2700,3200,4e3,5e3,6500],wm=["hs","rgb","rgbw","rgbww","xy"],ym=4,kc=16,Sc=32,xm=128;function li(r){let e=r.attributes.supported_color_modes??[],t=e.some(n=>wm.includes(n));return{dim:e.some(n=>n!=="onoff"),color:t,temp:e.includes("color_temp")}}function ci(r){return((r.attributes.supported_features??0)&ym)!==0&&typeof r.attributes.current_position=="number"}var ai=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 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(){fe(this,this.entity),this.close()}ring(e){let t=e.length;return e.map((n,o)=>{let i=o/t*Math.PI*2-Math.PI/2;return m`<div class="qm-at" style="left:${50+Math.cos(i)*39}%;top:${50+Math.sin(i)*39}%">${n}</div>`})}renderLight(e){let t=li(e),n=e.state==="on",o=n&&typeof e.attributes.brightness=="number"?Math.round(e.attributes.brightness/2.55):n?100:0,i=t.color?bm.map(s=>m`<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?vm.map(s=>m`<button class="qm-swatch" style="background:${km(s)}" aria-label=${`${s} K`} @click=${()=>this.call("light","turn_on",{color_temp_kelvin:s})}></button>`):[];return m`<div class="qm-ring ${i.length?"":"qm-ring-small"}">
${this.ring(i)}
<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>
@@ -1234,7 +1234,7 @@ A plugin runs with the same rights as NextFloor in your browser. The file has be
.value=${String(Math.max(1,o))}
aria-label=${this.t("brightness")}
@change=${s=>this.call("light","turn_on",{brightness_pct:Number(s.target.value)})}
/>`:f}`}renderCover(e){e=nr(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",o=ui(e),i=(u,h,p,d=!1)=>m`<button class="qm-swatch qm-slot ${d?"qm-slot-on":""}" aria-label=${h} @click=${p}>${u}</button>`,s=u=>t!==null&&Math.abs(t-u)<3,a=[i("\u25B2",this.t("cover_open"),()=>this.ask()&&this.call("cover","open_cover"),s(100)),...o?[75,50].map(u=>i(`${u}`,`${u} %`,()=>this.ask()&&this.call("cover","set_cover_position",{position:u}),s(u))):[],i("\u25BC",this.t("cover_close"),()=>this.ask()&&this.call("cover","close_cover"),s(0)),...o?[25].map(u=>i(`${u}`,`${u} %`,()=>this.ask()&&this.call("cover","set_cover_position",{position:u}),s(u))):[],...Number(e.attributes.supported_features??0)&8?[i("\u25A0",this.t("cover_stop"),()=>this.call("cover","stop_cover"),n)]:[],...this.myPosition!=null&&(o||Number(e.attributes.supported_features??0)&8)?[i("My",this.t("cover_my_go",{p:this.myPosition}),()=>this.ask()&&(o?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 m`<div class="qm-ring">
/>`:f}`}renderCover(e){e=nr(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",o=ci(e),i=(u,h,p,d=!1)=>m`<button class="qm-swatch qm-slot ${d?"qm-slot-on":""}" aria-label=${h} @click=${p}>${u}</button>`,s=u=>t!==null&&Math.abs(t-u)<3,a=[i("\u25B2",this.t("cover_open"),()=>this.ask()&&this.call("cover","open_cover"),s(100)),...o?[75,50].map(u=>i(`${u}`,`${u} %`,()=>this.ask()&&this.call("cover","set_cover_position",{position:u}),s(u))):[],i("\u25BC",this.t("cover_close"),()=>this.ask()&&this.call("cover","close_cover"),s(0)),...o?[25].map(u=>i(`${u}`,`${u} %`,()=>this.ask()&&this.call("cover","set_cover_position",{position:u}),s(u))):[],...Number(e.attributes.supported_features??0)&8?[i("\u25A0",this.t("cover_stop"),()=>this.call("cover","stop_cover"),n)]:[],...this.myPosition!=null&&(o||Number(e.attributes.supported_features??0)&8)?[i("My",this.t("cover_my_go",{p:this.myPosition}),()=>this.ask()&&(o?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 m`<div class="qm-ring">
${this.ring(a)}
<button
class="qm-power qm-blind ${c&&l<100?"qm-on":""}"
@@ -1290,7 +1290,7 @@ A plugin runs with the same rights as NextFloor in your browser. The file has be
${s.length?m`<div class="qm-play-head">${this.t("media_sources")}</div>
<div class="qm-play">${s.map(h=>m`<button class="qm-chip ${o.source===h?"qm-chip-on":""}" @click=${()=>this.call("media_player","select_source",{source:h})}>${h}</button>`)}</div>`:f}
${this.presets?.length?m`<div class="qm-play-head">${this.t("presets")}</div>
<div class="qm-play">${this.presets.map(h=>m`<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=D(this.entity),n=I(e)&&!qt(e)?m`<p class="qm-note">${te(this.hass,e)}</p>`:t==="light"?this.renderLight(e):t==="cover"?this.renderCover(e):t==="media"?this.renderMedia(e):this.renderToggle(e);return m`<div class="qm" role="dialog" aria-label=${O(this.hass,this.entity)}>
<div class="qm-play">${this.presets.map(h=>m`<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)&&!qt(e)?m`<p class="qm-note">${te(this.hass,e)}</p>`:t==="light"?this.renderLight(e):t==="cover"?this.renderCover(e):t==="media"?this.renderMedia(e):this.renderToggle(e);return m`<div class="qm" role="dialog" aria-label=${O(this.hass,this.entity)}>
<div class="qm-title">${O(this.hass,this.entity)}</div>
${n}
<button class="qm-details" @click=${()=>this.details()}>${this.t("details")} …</button>
@@ -1537,9 +1537,9 @@ A plugin runs with the same rights as NextFloor in your browser. The file has be
.qm-note {
color: var(--nf-muted);
}
`]};function km(r){let e=Math.min(1,Math.max(0,(r-2200)/4300)),t=(n,o)=>Math.round(n+(o-n)*e);return`rgb(${t(255,200)},${t(170,225)},${t(80,255)})`}customElements.get("nf-quick-menu")||customElements.define("nf-quick-menu",li);var Sm=new URL(import.meta.url),$m=new URL("./nextfloor-3d.js?v=74227cd20cc3",Sm).href,$c;function Mc(){return $c??=import($m),$c}function Ac(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 Mm=new Set(["on","home","open","true","active","playing","heat","heating"]);function Dr(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 o=String(n.state).toLowerCase(),i=(t.state??"").split(",").map(a=>a.trim().toLowerCase()).filter(Boolean),s=i.length?i.includes(o):Mm.has(o)||Number.isFinite(Number(o))&&Number(o)>0;return t.invert?!s:s}function di(r,e){let t=[];for(let n of e.floors)for(let o of n.furniture)Dr(r,o)||t.push(o.id);return t.sort()}function Ec(r,e){if(!e.length)return r;let t=new Set(e);return{...r,floors:r.floors.map(n=>n.furniture.some(o=>t.has(o.id))?{...n,furniture:n.furniture.filter(o=>!t.has(o.id))}:n)}}var Rc="image:";function hi(r,e,t){let n=(e??"").trim();if(!n)return null;if(n.startsWith(Rc))return t(n.slice(Rc.length));if(/^(https?:\/\/|\/)/.test(n))return n;if(/^[a-z_]+\.[a-z0-9_]+$/.test(n)){let o=r?.states[n]?.attributes.entity_picture;return typeof o=="string"&&o?o:null}return null}var wn=r=>Number(r);function xn(r){if(Array.isArray(r)){let[i,s]=[wn(r[0]),wn(r[1])];return Number.isFinite(i)&&Number.isFinite(s)?[i,s]:null}if(!r||typeof r!="object")return null;let{x:e,y:t}=r,[n,o]=[wn(e),wn(t)];return Number.isFinite(n)&&Number.isFinite(o)?[n,o]:null}function zc(r){return r?xn(r.charger)??xn(r.charger_position):null}function Tc(r){for(let[e,t]of Object.entries(r.states))if(e.startsWith("camera.")&&(xn(t.attributes?.vacuum_position)??zc(t.attributes)))return e;return null}var Am=r=>Array.isArray(r)?typeof r[0]=="number":!!r&&typeof r=="object",yn=(r,e)=>e?[r[0],-r[1]]:r;function Em(r){if(!r)return null;let e=r.mirror===!0,[t,n]=yn(r.ga,e),[o,i]=yn(r.gb,e),[s,a]=r.a,[l,c]=r.b,[u,h]=[o-t,i-n],[p,d]=[l-s,c-a],_=Math.hypot(u,h),b=Math.hypot(p,d);if(!(_>1e-6)||!(b>1e-6))return null;let g=b/_,v=Math.atan2(d,p)-Math.atan2(h,u),[S,k]=[Math.cos(v),Math.sin(v)];return y=>{let z=yn(y,e),[E,F]=[z[0]-t,z[1]-n];return[s+g*(E*S-F*k),a+g*(E*k+F*S)]}}function Rm(r){if(!r)return null;let e=r.mirror===!0,[t,n]=yn(r.ga,e),[o,i]=yn(r.gb,e),s=Math.atan2(r.b[1]-r.a[1],r.b[0]-r.a[0])-Math.atan2(i-n,o-t);return Number.isFinite(s)?s:null}function Fc(r,e,t){if(!e)return null;let n=r.states[e]?.attributes;if(!n)return null;let o=Em(t)??(_=>_),i=Rm(t)??0,s=t?.mirror===!0?-1:1,a=n.vacuum_position,l=xn(a),c=l?(()=>{let[_,b]=o(l),g=wn(a?.a)*s;if(!Number.isFinite(g))return{x:_,z:b,heading:0};let v=g*Math.PI/180+i;return{x:_,z:b,heading:Math.atan2(Math.cos(v),Math.sin(v))}})():null,u=zc(n),h=Array.isArray(n.path)?n.path:[],p=h.length>0&&Am(h[0])?[h]:h,d=[];for(let _ of p){let b=[];for(let g of Array.isArray(_)?_:[]){let v=xn(g);v&&b.push(o(v))}b.length>1&&d.push(b)}return!c&&!u&&!d.length?null:{pose:c,charger:u?o(u):null,path:d}}var Dc="nextfloor.lock3d",Pc=520,mi=class extends re{static properties={hass:{attribute:!1},building:{attribute:!1},floorId:{attribute:!1},roomId:{attribute:!1},wallMode:{attribute:!1},solidWalls:{attribute:!1},glassWalls:{attribute:!1},explode:{type:Boolean},keepRoof:{attribute:!1},markerMode:{attribute:!1},markerNames:{attribute:!1},markersOutside:{attribute:!1},tapInRoom:{type:Boolean},roomDoubleTap:{attribute:!1},heatMode:{attribute:!1},theme:{attribute:!1},accent:{attribute:!1},furnitureColors:{attribute:!1},packs:{attribute:!1},showEnergy:{attribute:!1},flows:{attribute:!1},holograms:{attribute:!1},furnish:{type:Boolean},surfaceGrab:{attribute:!1},furnishTypes:{attribute:!1},weather:{type:Boolean},weatherEntityId:{attribute:!1},weatherDensity:{attribute:!1},timeOfDay:{attribute:!1},selectedFurniture:{attribute:!1},selectedDevice:{attribute:!1},_sky:{state:!0},quality:{attribute:!1},showStats:{type:Boolean},_stats:{state:!0},_error:{state:!0},_energy:{state:!0},_flows:{state:!0},_liveEnergy:{state:!0},_liveCards:{state:!0},_liveCardOn:{state:!0},_houseFolded:{state:!0},_swipe:{state:!0},_menu:{state:!0},_pluginWindow:{state:!0},_plate:{state:!0},_blend:{state:!0},_wallBig:{state:!0},_find:{state:!0},_central:{state:!0},_thumbsCompact:{state:!0},_armed:{state:!0},central:{attribute:!1},centralOpen:{attribute:!1},keepCamera:{attribute:!1},plain:{attribute:!1},rightBack:{attribute:!1},templateName:{attribute:!1},readable:{type:Boolean,reflect:!0},today:{attribute:!1},_todayOpen:{state:!0},_todayItems:{state:!0},_forecast:{state:!0},zoom:{attribute:!1},buttons:{attribute:!1},_thumbs:{state:!0},floorThumbs:{attribute:!1},clean:{attribute:!1},cleanButton:{attribute:!1},clock:{attribute:!1},lockButton:{attribute:!1},walkButto Line truncated
`]};function km(r){let e=Math.min(1,Math.max(0,(r-2200)/4300)),t=(n,o)=>Math.round(n+(o-n)*e);return`rgb(${t(255,200)},${t(170,225)},${t(80,255)})`}customElements.get("nf-quick-menu")||customElements.define("nf-quick-menu",ai);var Sm=new URL(import.meta.url),$m=new URL("./nextfloor-3d.js?v=74227cd20cc3",Sm).href,$c;function Mc(){return $c??=import($m),$c}function Ac(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 Mm=new Set(["on","home","open","true","active","playing","heat","heating"]);function Fr(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 o=String(n.state).toLowerCase(),i=(t.state??"").split(",").map(a=>a.trim().toLowerCase()).filter(Boolean),s=i.length?i.includes(o):Mm.has(o)||Number.isFinite(Number(o))&&Number(o)>0;return t.invert?!s:s}function ui(r,e){let t=[];for(let n of e.floors)for(let o of n.furniture)Fr(r,o)||t.push(o.id);return t.sort()}function Ec(r,e){if(!e.length)return r;let t=new Set(e);return{...r,floors:r.floors.map(n=>n.furniture.some(o=>t.has(o.id))?{...n,furniture:n.furniture.filter(o=>!t.has(o.id))}:n)}}var Rc="image:";function di(r,e,t){let n=(e??"").trim();if(!n)return null;if(n.startsWith(Rc))return t(n.slice(Rc.length));if(/^(https?:\/\/|\/)/.test(n))return n;if(/^[a-z_]+\.[a-z0-9_]+$/.test(n)){let o=r?.states[n]?.attributes.entity_picture;return typeof o=="string"&&o?o:null}return null}var wn=r=>Number(r);function xn(r){if(Array.isArray(r)){let[i,s]=[wn(r[0]),wn(r[1])];return Number.isFinite(i)&&Number.isFinite(s)?[i,s]:null}if(!r||typeof r!="object")return null;let{x:e,y:t}=r,[n,o]=[wn(e),wn(t)];return Number.isFinite(n)&&Number.isFinite(o)?[n,o]:null}function zc(r){return r?xn(r.charger)??xn(r.charger_position):null}function Tc(r){for(let[e,t]of Object.entries(r.states))if(e.startsWith("camera.")&&(xn(t.attributes?.vacuum_position)??zc(t.attributes)))return e;return null}var Am=r=>Array.isArray(r)?typeof r[0]=="number":!!r&&typeof r=="object",yn=(r,e)=>e?[r[0],-r[1]]:r;function Em(r){if(!r)return null;let e=r.mirror===!0,[t,n]=yn(r.ga,e),[o,i]=yn(r.gb,e),[s,a]=r.a,[l,c]=r.b,[u,h]=[o-t,i-n],[p,d]=[l-s,c-a],_=Math.hypot(u,h),b=Math.hypot(p,d);if(!(_>1e-6)||!(b>1e-6))return null;let g=b/_,v=Math.atan2(d,p)-Math.atan2(h,u),[S,k]=[Math.cos(v),Math.sin(v)];return y=>{let z=yn(y,e),[E,D]=[z[0]-t,z[1]-n];return[s+g*(E*S-D*k),a+g*(E*k+D*S)]}}function Rm(r){if(!r)return null;let e=r.mirror===!0,[t,n]=yn(r.ga,e),[o,i]=yn(r.gb,e),s=Math.atan2(r.b[1]-r.a[1],r.b[0]-r.a[0])-Math.atan2(i-n,o-t);return Number.isFinite(s)?s:null}function Dc(r,e,t){if(!e)return null;let n=r.states[e]?.attributes;if(!n)return null;let o=Em(t)??(_=>_),i=Rm(t)??0,s=t?.mirror===!0?-1:1,a=n.vacuum_position,l=xn(a),c=l?(()=>{let[_,b]=o(l),g=wn(a?.a)*s;if(!Number.isFinite(g))return{x:_,z:b,heading:0};let v=g*Math.PI/180+i;return{x:_,z:b,heading:Math.atan2(Math.cos(v),Math.sin(v))}})():null,u=zc(n),h=Array.isArray(n.path)?n.path:[],p=h.length>0&&Am(h[0])?[h]:h,d=[];for(let _ of p){let b=[];for(let g of Array.isArray(_)?_:[]){let v=xn(g);v&&b.push(o(v))}b.length>1&&d.push(b)}return!c&&!u&&!d.length?null:{pose:c,charger:u?o(u):null,path:d}}var Fc="nextfloor.lock3d",Pc=520,pi=class extends re{static properties={hass:{attribute:!1},building:{attribute:!1},floorId:{attribute:!1},roomId:{attribute:!1},wallMode:{attribute:!1},solidWalls:{attribute:!1},glassWalls:{attribute:!1},explode:{type:Boolean},keepRoof:{attribute:!1},markerMode:{attribute:!1},markerNames:{attribute:!1},markersOutside:{attribute:!1},tapInRoom:{type:Boolean},roomDoubleTap:{attribute:!1},heatMode:{attribute:!1},theme:{attribute:!1},accent:{attribute:!1},furnitureColors:{attribute:!1},packs:{attribute:!1},showEnergy:{attribute:!1},flows:{attribute:!1},holograms:{attribute:!1},furnish:{type:Boolean},surfaceGrab:{attribute:!1},furnishTypes:{attribute:!1},weather:{type:Boolean},weatherEntityId:{attribute:!1},weatherDensity:{attribute:!1},timeOfDay:{attribute:!1},selectedFurniture:{attribute:!1},selectedDevice:{attribute:!1},_sky:{state:!0},quality:{attribute:!1},showStats:{type:Boolean},_stats:{state:!0},_error:{state:!0},_energy:{state:!0},_flows:{state:!0},_liveEnergy:{state:!0},_liveCards:{state:!0},_liveCardOn:{state:!0},_houseFolded:{state:!0},_swipe:{state:!0},_menu:{state:!0},_pluginWindow:{state:!0},_plate:{state:!0},_blend:{state:!0},_wallBig:{state:!0},_find:{state:!0},_central:{state:!0},_thumbsCompact:{state:!0},_armed:{state:!0},central:{attribute:!1},centralOpen:{attribute:!1},keepCamera:{attribute:!1},plain:{attribute:!1},rightBack:{attribute:!1},templateName:{attribute:!1},readable:{type:Boolean,reflect:!0},today:{attribute:!1},_todayOpen:{state:!0},_todayItems:{state:!0},_forecast:{state:!0},zoom:{attribute:!1},buttons:{attribute:!1},_thumbs:{state:!0},floorThumbs:{attribute:!1},clean:{attribute:!1},cleanButton:{attribute:!1},clock:{attribute:!1},lockButton:{attribute:!1},walkButto Line truncated
${e.map(t=>m`<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 o=this._travel,i=o&&!o.loading?Rt(this.hass,o.history,o.t):this.hass;if((e||!this.openingLinks||this.linkedRegistry!==i.entities)&&(this.openingLinks=Re(i,n.floors),this.furnitureLinks=it(i,n.floors),this.linkedRegistry=i.entities,this.findIndex=null,this.alertSrc=this.alerts?xl(i,n,this.weatherEntityId,this.openingLinks):null,this.watched=zl({hass:i,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)!==i.states[w])))return;di(i,n).join(",")!==this.shownFor?.key&&t.setBuilding(this.shownBuilding(i)),this.shownStates=new Map(this.watched.map(w=>[w,i.states[w]])),this.refreshToday(n),this.refreshForecast(n);let a=rn(i,n),l=ca(i,n.floors.some(w=>w.layer&&this.hiddenLayers.has(w.id))?this.shownBuilding(i):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(i,n,new Set(l.map(w=>w.id)),new Set(a.map(w=>w.powerEntity)));a.push(...c.consumers);let u=on(i,n,a,Pe(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=st(i,n.floors);let p=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 x of w.outdoor??[]){if(!x.area_id&&!x.temp_entity&&!x.pump_entity)continue;let B=x.temp_entity?i.states[x.temp_entity]:void 0,T=x.pump_entity?i.states[x.pump_entity]:void 0,[L,de]=xe(x.points),Ye=B&&Number.isFinite(Number(B.state))?`${W(i,oe(i,jn(Number(B.state),B.attributes.unit_of_measurement)),1)} ${X(i)}`:"",ht=!!T&&Q(T);l.push({id:x.area_id?`outdoor:${x.id}`:x.pump_entity??x.temp_entity,floorId:w.id,roomId:null,x:L,z:de,y:Ln(w,x,L,de)+.7,icon:ke(x.type==="pool"?"pool":x.type==="terrace"?"table-chair":"tree-outline"),name:x.area_id&&i.areas?.[x.area_id]?.name||A(i,`out_${x.type}`),text:[Ye,ht?A(i,"pool_pump_on"):""].filter(Boolean).join(" \xB7 "),active:ht,unavailable:!1,glow:null,show:"always"})}let d=new Map;for(let w of n.floors){for(let x of w.placements)x.pin_offset&&d.set(`${w.id}:${x.entity_id}`,x.pin_offset);for(let x of w.furniture)x.pin_offset&&d.set(`f:${x.id}`,x.pin_offset)}let _=w=>{let x=w.lamp?void 0:(w.furnitureId?d.get(`f:${w.furnitureId}`):void 0)??d.get(`${w.floorId}:${w.id}`);return x?{...w,x:w.x+(x.x??0),z:w.z+(x.z??0),y:w.y+(x.y??0)}:w};t.setDevices([...[...l,...c.markers].map(_).map(w=>{let x=w.show==="no_power"||"energyDevice"in w&&w.energyDevice?null:h.get(w.id)??null,B={...w,power:x,powerText:x===null?void 0:ae(i,x),effect:this.dimmed?void 0:w.effect,text:this.subMeterText(i,n,u,w.furnitureId)??w.text},T=w.ownName&&(w.showName||this.markerNames)?w.ownName:"",L=p.has(w.id)||!!w.furnitureId&&p.has(w.furnitureId);return{...B,pin:this.showPin(B)&&!L,full:w.show==="always",caption:T}})]),t.setPickTargets(c.targets,this.openingTargets(),this.secondBlinds()),t.setScreens(c.screens),t.setFridgeDoors(Ks(i,n.floors)),t.setCovers(ta(i,n)),t.setRobots(this.robotInfos(i,n));let b=new Map;for(let w of n.floors)for(let x of w.furniture)!Z(x.type)?.pet||!x.room_sensor||x.room_sensor==="none"||b.set(x.id,wo(i,w.rooms.filter(B=>B.points.length>=3),null,x.room_sensor)?.id??null);b.size&&t.setPetRooms(b),t.setRoofWindows(_l(i,n)),t.setParked(Uo(i,n)),t.setGateStates(Il(i,n));let g=new Map(n.floors.flatMap(w=>w.openings.map(x=>[x.id,x.type]))),v=new Map([...this.openingLinks].map(([w,x])=>[w,ze(i,x,g.get(w))]));t.setOpeningStates(v),this.setAlerts(this.alertSrc?Vo(i,n,this.alertSrc,this.openingLinks):[]),this.watchLostContacts(i);let S=[...l,...c.markers].map(w=>`${w.id}:${w.glow?`${w.glow.level.toFixed(1)}/${w.glow.color.map(x=>x.toFixed(1)).join("/")}`:0}`).join(";")+"|"+[...v].map(([w,x])=>`${w}:${x.open}:${x.cover===null?"-":x.cover.toFixed(1)}`).join(";");if(S!==this.thumbSig){let w=this.thumbSig==="";this.thumbSig=S,w||this.scheduleThumbs(1500)}let k=Jl(i,n,a,n.energy.advanced?w=>this.furnitureLinks?.get(w.id)?.power??null:void 0),y=this.liveCars(i,n);for(let w of y){if(!w.car.home||!w.car.charging&&!w.car.plugged)continue;let x=n.floors.flatMap(L=>L.furniture.filter(de=>de.type==="wallbox").map(de=>({floorId:L.id,x:de.x,z:de.z,y:1}))).sort((L,de)=>Math.hypot(L.x-w.at.x,L.z-w.at.z)-Math.hypot(de.x-w.at.x,de.z-w.at.z))[0],B=x&&x.floorId===w.at.floorId&&Math.hypot(x.x-w.at.x,x.z-w.at.z)<9,T=x??gn(n);!T||!w.car.charging&&!B||k.arcs.push({key:`car:${w.spot}`,from:T,to:{...w.at,y:.8},power:w.car.charging?w.car.chargingW??7e3:0,color:[80,175,255],...B?{via:[{...T,y:.35},{floorId:w.at.floorId,x:(T.x+w.at.x)/2,z:(T.z+w.at.z)/2,y:.08},{...w.at,y:.5}],cable:!0}:{}})}let z=gn(n);for(let w of this.liveHeatPumps(n)){let x=w.pump.heat??(w.pump.mode==="heating"||w.pumLine truncated
</div>`}syncDevices(e){let t=this.viewer,n=this.building;if(!t||!n||!this.hass)return;let o=this._travel,i=o&&!o.loading?Rt(this.hass,o.history,o.t):this.hass;if((e||!this.openingLinks||this.linkedRegistry!==i.entities)&&(this.openingLinks=Re(i,n.floors),this.furnitureLinks=it(i,n.floors),this.linkedRegistry=i.entities,this.findIndex=null,this.alertSrc=this.alerts?xl(i,n,this.weatherEntityId,this.openingLinks):null,this.watched=zl({hass:i,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)!==i.states[w])))return;ui(i,n).join(",")!==this.shownFor?.key&&t.setBuilding(this.shownBuilding(i)),this.shownStates=new Map(this.watched.map(w=>[w,i.states[w]])),this.refreshToday(n),this.refreshForecast(n);let a=rn(i,n),l=ca(i,n.floors.some(w=>w.layer&&this.hiddenLayers.has(w.id))?this.shownBuilding(i):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(i,n,new Set(l.map(w=>w.id)),new Set(a.map(w=>w.powerEntity)));a.push(...c.consumers);let u=on(i,n,a,Pe(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=st(i,n.floors);let p=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 x of w.outdoor??[]){if(!x.area_id&&!x.temp_entity&&!x.pump_entity)continue;let B=x.temp_entity?i.states[x.temp_entity]:void 0,T=x.pump_entity?i.states[x.pump_entity]:void 0,[L,de]=xe(x.points),Ye=B&&Number.isFinite(Number(B.state))?`${W(i,oe(i,jn(Number(B.state),B.attributes.unit_of_measurement)),1)} ${X(i)}`:"",ht=!!T&&J(T);l.push({id:x.area_id?`outdoor:${x.id}`:x.pump_entity??x.temp_entity,floorId:w.id,roomId:null,x:L,z:de,y:Ln(w,x,L,de)+.7,icon:ke(x.type==="pool"?"pool":x.type==="terrace"?"table-chair":"tree-outline"),name:x.area_id&&i.areas?.[x.area_id]?.name||A(i,`out_${x.type}`),text:[Ye,ht?A(i,"pool_pump_on"):""].filter(Boolean).join(" \xB7 "),active:ht,unavailable:!1,glow:null,show:"always"})}let d=new Map;for(let w of n.floors){for(let x of w.placements)x.pin_offset&&d.set(`${w.id}:${x.entity_id}`,x.pin_offset);for(let x of w.furniture)x.pin_offset&&d.set(`f:${x.id}`,x.pin_offset)}let _=w=>{let x=w.lamp?void 0:(w.furnitureId?d.get(`f:${w.furnitureId}`):void 0)??d.get(`${w.floorId}:${w.id}`);return x?{...w,x:w.x+(x.x??0),z:w.z+(x.z??0),y:w.y+(x.y??0)}:w};t.setDevices([...[...l,...c.markers].map(_).map(w=>{let x=w.show==="no_power"||"energyDevice"in w&&w.energyDevice?null:h.get(w.id)??null,B={...w,power:x,powerText:x===null?void 0:ae(i,x),effect:this.dimmed?void 0:w.effect,text:this.subMeterText(i,n,u,w.furnitureId)??w.text},T=w.ownName&&(w.showName||this.markerNames)?w.ownName:"",L=p.has(w.id)||!!w.furnitureId&&p.has(w.furnitureId);return{...B,pin:this.showPin(B)&&!L,full:w.show==="always",caption:T}})]),t.setPickTargets(c.targets,this.openingTargets(),this.secondBlinds()),t.setScreens(c.screens),t.setFridgeDoors(Ks(i,n.floors)),t.setCovers(ta(i,n)),t.setRobots(this.robotInfos(i,n));let b=new Map;for(let w of n.floors)for(let x of w.furniture)!Z(x.type)?.pet||!x.room_sensor||x.room_sensor==="none"||b.set(x.id,vo(i,w.rooms.filter(B=>B.points.length>=3),null,x.room_sensor)?.id??null);b.size&&t.setPetRooms(b),t.setRoofWindows(_l(i,n)),t.setParked(Go(i,n)),t.setGateStates(Il(i,n));let g=new Map(n.floors.flatMap(w=>w.openings.map(x=>[x.id,x.type]))),v=new Map([...this.openingLinks].map(([w,x])=>[w,ze(i,x,g.get(w))]));t.setOpeningStates(v),this.setAlerts(this.alertSrc?Bo(i,n,this.alertSrc,this.openingLinks):[]),this.watchLostContacts(i);let S=[...l,...c.markers].map(w=>`${w.id}:${w.glow?`${w.glow.level.toFixed(1)}/${w.glow.color.map(x=>x.toFixed(1)).join("/")}`:0}`).join(";")+"|"+[...v].map(([w,x])=>`${w}:${x.open}:${x.cover===null?"-":x.cover.toFixed(1)}`).join(";");if(S!==this.thumbSig){let w=this.thumbSig==="";this.thumbSig=S,w||this.scheduleThumbs(1500)}let k=Jl(i,n,a,n.energy.advanced?w=>this.furnitureLinks?.get(w.id)?.power??null:void 0),y=this.liveCars(i,n);for(let w of y){if(!w.car.home||!w.car.charging&&!w.car.plugged)continue;let x=n.floors.flatMap(L=>L.furniture.filter(de=>de.type==="wallbox").map(de=>({floorId:L.id,x:de.x,z:de.z,y:1}))).sort((L,de)=>Math.hypot(L.x-w.at.x,L.z-w.at.z)-Math.hypot(de.x-w.at.x,de.z-w.at.z))[0],B=x&&x.floorId===w.at.floorId&&Math.hypot(x.x-w.at.x,x.z-w.at.z)<9,T=x??gn(n);!T||!w.car.charging&&!B||k.arcs.push({key:`car:${w.spot}`,from:T,to:{...w.at,y:.8},power:w.car.charging?w.car.chargingW??7e3:0,color:[80,175,255],...B?{via:[{...T,y:.35},{floorId:w.at.floorId,x:(T.x+w.at.x)/2,z:(T.z+w.at.z)/2,y:.08},{...w.at,y:.5}],cable:!0}:{}})}let z=gn(n);for(let w of this.liveHeatPumps(n)){let x=w.pump.heat??(w.pump.mode==="heating"||w.pumLine truncated
<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=${o}>${n?"\u25B8":"\u25C2"}</button>
<button class="nf-thumb nf-thumb-house" aria-pressed=${this.floorId===null} @click=${()=>this.fire("floor-tap",{floorId:null})}>
<svg viewBox="0 0 24 24" width="18" height="18" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linejoin="round"><path d="M3 11l9-7 9 7M5 10v10h14V10" /></svg>
@@ -1549,12 +1549,12 @@ A plugin runs with the same rights as NextFloor in your browser. The file has be
${n?f:m`<img src=${i.url} alt="" />`}
<span>${e.get(i.floorId)??""}</span>
</button>`)}
</nav>`}onDeviceHold(e,t,n){let o=D(e);o==="light"||o==="cover"||o==="switch"||o==="fan"||o==="lock"?this._menu={entity:e,x:t,y:n}:fe(this,e)}onDeviceSwipe(e,t,n,o,i){let s=this.hass?.states[e];if(t==="start"){if(!s||I(s)||this.confirmSet.has(e))return!1;let l=D(e);if(l==="light"&&ci(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:o,y:i},!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:o,y:i},!0}if(l==="cover"&&ui(s)){let c=s.attributes.current_position;return this._swipe={entity:e,kind:"cover",start:c,value:c,x:o,y:i},!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,ba(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()||!ma(e,this.screenName)||!fa(e))return;let n=ga(e.message);this._announcement={message:e.message,until:Date.now()+n},clearTimeout(this.announceTimer),this.announceTimer=setTimeout(()=>this._announcement=null,n),_a(this.hass,e)}renderAnnouncement(){let e=this._announcement;return e?m`<button class="nf-announcement" role="alert" title=${A(this.hass,"close")} @click=${()=>this._announcement=null}>
</nav>`}onDeviceHold(e,t,n){let o=F(e);o==="light"||o==="cover"||o==="switch"||o==="fan"||o==="lock"?this._menu={entity:e,x:t,y:n}:fe(this,e)}onDeviceSwipe(e,t,n,o,i){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"&&li(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:o,y:i},!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:o,y:i},!0}if(l==="cover"&&ci(s)){let c=s.attributes.current_position;return this._swipe={entity:e,kind:"cover",start:c,value:c,x:o,y:i},!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,ba(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()||!ma(e,this.screenName)||!fa(e))return;let n=ga(e.message);this._announcement={message:e.message,until:Date.now()+n},clearTimeout(this.announceTimer),this.announceTimer=setTimeout(()=>this._announcement=null,n),_a(this.hass,e)}renderAnnouncement(){let e=this._announcement;return e?m`<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>
</button>`:f}renderAlerts(){let e=this.building;if(!this._alerts.length||!e)return f;let t=this._alerts.slice(0,3);return m`<div class="nf-alert-banner" role="alert">
${t.map(n=>m`<button class="nf-alert nf-alert-${n.kind}" style=${n.color?`border-left-color:${n.color}`:""} title=${Ko(this.hass,e,n)} @click=${()=>this.jumpTo(n)}>${Ko(this.hass,e,n)}</button>`)}
${t.map(n=>m`<button class="nf-alert nf-alert-${n.kind}" style=${n.color?`border-left-color:${n.color}`:""} title=${Vo(this.hass,e,n)} @click=${()=>this.jumpTo(n)}>${Vo(this.hass,e,n)}</button>`)}
${this._alerts.length>3?m`<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(i=>i.rooms).find(i=>i.id===this.roomId),n=t?K(this.hass,t).filter(i=>D(i)==="scene"||D(i)==="script").slice(0,6):[];if(!n.length)return f;let o=t?.area_id?this.hass.areas?.[t.area_id]?.name:void 0;return m`<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(i=>i.rooms).find(i=>i.id===this.roomId),n=t?K(this.hass,t).filter(i=>F(i)==="scene"||F(i)==="script").slice(0,6):[];if(!n.length)return f;let o=t?.area_id?this.hass.areas?.[t.area_id]?.name:void 0;return m`<div class="nf-scenes">
${n.map(i=>m`<button class="nf-chip" aria-pressed=${this._sceneFired===i} @click=${()=>this.runScene(i)}>${O(this.hass,i,o)}</button>`)}
</div>`}renderFind(){let e=this.building;if(!e||!this.hass)return f;if(this._find===null)return m`<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>
@@ -1581,7 +1581,7 @@ A plugin runs with the same rights as NextFloor in your browser. The file has be
@click=${()=>{this._central=!this._central,this._armed=null}}
>
<svg viewBox="0 0 24 24" width="19" height="19" fill="none" stroke="currentColor" stroke-width="1.9" stroke-linejoin="round"><path d="M12 3.5l2.6 5.3 5.9.9-4.3 4.1 1 5.8L12 16.9l-5.2 2.7 1-5.8-4.3-4.1 5.9-.9z" /></svg>
</button>`;if(!this._central)return o;let i=this.floorId?e.floors.find(g=>g.id===this.floorId):void 0,s=i?[i]:e.floors,a=s.flatMap(g=>yo(t,g).lights),l=s.flatMap(g=>yo(t,g).covers),c=a.filter(g=>t.states[g]?.state==="on").length,u=!i,h=(g,v,S,k)=>{if(k.length){if(u&&this._armed!==g){this._armed=g,clearTimeout(this.armTimer),this.armTimer=setTimeout(()=>this._armed=null,3500);return}this._armed=null,t.callService(v,S,{entity_id:k})}},p=(g,v,S,k,y)=>m`<button class="nf-btn ${this._armed===g?"nf-central-armed":""}" ?disabled=${!y.length} @click=${()=>h(g,S,k,y)}>
</button>`;if(!this._central)return o;let i=this.floorId?e.floors.find(g=>g.id===this.floorId):void 0,s=i?[i]:e.floors,a=s.flatMap(g=>wo(t,g).lights),l=s.flatMap(g=>wo(t,g).covers),c=a.filter(g=>t.states[g]?.state==="on").length,u=!i,h=(g,v,S,k)=>{if(k.length){if(u&&this._armed!==g){this._armed=g,clearTimeout(this.armTimer),this.armTimer=setTimeout(()=>this._armed=null,3500);return}this._armed=null,t.callService(v,S,{entity_id:k})}},p=(g,v,S,k,y)=>m`<button class="nf-btn ${this._armed===g?"nf-central-armed":""}" ?disabled=${!y.length} @click=${()=>h(g,S,k,y)}>
${this._armed===g?n("central_sure"):n(v)}
</button>`,d=e.settings.favorite_floors??{},_=(e.settings.favorites??[]).filter(g=>t.states[g]&&(!d[g]||!i||d[g]===i.id)),b=this.buttons??e.settings.buttons??[];return m`${o}
<div class="nf-central ${this.centralOpen?"nf-central-big":""}" role="dialog" aria-label=${n("central")}>
@@ -1611,16 +1611,16 @@ A plugin runs with the same rights as NextFloor in your browser. The file has be
${b.map(g=>m`<button
class="nf-chip nf-own-btn"
aria-pressed=${Ys(t,g)}
@click=${v=>{xo(t,v.currentTarget,g),g.action!=="service"&&(this._central=!1)}}
@click=${v=>{yo(t,v.currentTarget,g),g.action!=="service"&&(this._central=!1)}}
>
${g.icon?m`<ha-icon .icon=${g.icon.startsWith("mdi:")?g.icon:`mdi:${g.icon}`}></ha-icon>`:f}${g.label}
</button>`)}
</div>`:f}
</div>`}toggleLock(){this._locked=!this._locked;try{localStorage.setItem(Dc,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 o=await ln(this.hass,al(this.watched),n,t);if(!this._travel||this._travel.from!==n)return;this._travel={...this._travel,history:o,moments:ll(o,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 o=n.t+250*n.speed;o>=n.to&&this.playTravel(!1),this.travelTo(o)},250)))}renderTravel(){if(!this.hass||this.clean)return f;let e=a=>A(this.hass,a),t=this._travel;if(!t)return this.travelButton?m`<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,o=new Intl.DateTimeFormat(n,{weekday:"short",hour:"2-digit",minute:"2-digit"}).format(new Date(t.t)),i=t.to-t.from||1,s=[[60,"travel_speed_min"],[600,"travel_speed_10min"],[3600,"travel_speed_hour"]];return m`<div class="nf-travel" role="group" aria-label=${e("travel")}>
</div>`}toggleLock(){this._locked=!this._locked;try{localStorage.setItem(Fc,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 o=await ln(this.hass,al(this.watched),n,t);if(!this._travel||this._travel.from!==n)return;this._travel={...this._travel,history:o,moments:ll(o,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 o=n.t+250*n.speed;o>=n.to&&this.playTravel(!1),this.travelTo(o)},250)))}renderTravel(){if(!this.hass||this.clean)return f;let e=a=>A(this.hass,a),t=this._travel;if(!t)return this.travelButton?m`<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,o=new Intl.DateTimeFormat(n,{weekday:"short",hour:"2-digit",minute:"2-digit"}).format(new Date(t.t)),i=t.to-t.from||1,s=[[60,"travel_speed_min"],[600,"travel_speed_10min"],[3600,"travel_speed_hour"]];return m`<div class="nf-travel" role="group" aria-label=${e("travel")}>
<button class="nf-travel-play" aria-label=${e(t.playing?"travel_pause":"travel_play")} ?disabled=${t.loading} @click=${()=>this.playTravel(!t.playing)}>${t.playing?"\u23F8":"\u25B6"}</button>
<b class="nf-travel-when">${t.loading?e("travel_loading"):o}</b>
<div class="nf-travel-track">
<svg viewBox="0 0 1000 10" preserveAspectRatio="none" aria-hidden="true">${t.moments.map(a=>J`<rect x=${(a-t.from)/i*1e3} y="0" width="1.6" height="10" />`)}</svg>
<svg viewBox="0 0 1000 10" preserveAspectRatio="none" aria-hidden="true">${t.moments.map(a=>Q`<rect x=${(a-t.from)/i*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))} />
</div>
<select aria-label=${e("travel_speed")} @change=${a=>this._travel={...t,speed:Number(a.target.value)}}>
@@ -1630,7 +1630,7 @@ 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===168} @click=${()=>{this.openTravel(168)}}>7 ${e("travel_days")}</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 o=n.getBoundingClientRect(),i=o.width/2,[s,a]=[(e.clientX-o.left-i)/i,(e.clientY-o.top-i)/i],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 m`<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":J`<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":Q`<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>
${this._walking?m`<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>
@@ -1638,7 +1638,7 @@ A plugin runs with the same rights as NextFloor in your browser. The file has be
<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 m`<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">
<rect x="5" y="11" width="14" height="9" rx="2" />
${this._locked?J`<path d="M8 11V8a4 4 0 0 1 8 0v3" />`:J`<path d="M8 11V8a4 4 0 0 1 7.5-2" />`}
${this._locked?Q`<path d="M8 11V8a4 4 0 0 1 8 0v3" />`:Q`<path d="M8 11V8a4 4 0 0 1 7.5-2" />`}
</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),o=new Intl.DateTimeFormat(t,{hour:"2-digit",minute:"2-digit"}).format(n),i=new Intl.DateTimeFormat(t,{weekday:"long",day:"numeric",month:"long"}).format(n);return m`<div class="nf-clock nf-clock-${this.clock}" aria-hidden="true"><b>${o}</b><span>${i}</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 m`<button
class="nf-eye ${this.clean?"nf-eye-clean":""}"
@@ -1647,14 +1647,14 @@ A plugin runs with the same rights as NextFloor in your browser. The file has be
aria-pressed=${this.clean}
@click=${()=>this.dispatchEvent(new CustomEvent("clean-toggle",{bubbles:!0,composed:!0}))}
>
${this.clean?J`<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>`:J`<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?Q`<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>`:Q`<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 m`<div class="nf-swipe" style="left:${e.x}px;top:${e.y}px">
<span>${O(this.hass,e.entity)}</span>
<b>${t?A(this.hass,"swipe_off"):`${e.value} %`}</b>
<i><em style="height:${e.value}%"></em></i>
</div>`}tapPlate(e,t,n){let o=this.building?.floors.flatMap(s=>s.furniture).find(s=>s.id===e),i=o?ko(o.gang_entities,Z(o.type)?.gangs??0):[];if(i.length===1)return this.onDeviceTap(i[0],t,n);i.length>1&&(this._plate={ids:i,x:t,y:n})}renderPlate(){let e=this._plate;if(!e||!this.hass)return f;let t=this.hass,n=()=>this._plate=null;return m`<div class="nf-menu-backdrop" @click=${n}></div>
</div>`}tapPlate(e,t,n){let o=this.building?.floors.flatMap(s=>s.furniture).find(s=>s.id===e),i=o?xo(o.gang_entities,Z(o.type)?.gangs??0):[];if(i.length===1)return this.onDeviceTap(i[0],t,n);i.length>1&&(this._plate={ids:i,x:t,y:n})}renderPlate(){let e=this._plate;if(!e||!this.hass)return f;let t=this.hass,n=()=>this._plate=null;return m`<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">
${e.ids.map((o,i)=>{let s=t.states[o],a=Q(s)||s?.state==="on";return m`<button role="menuitem" class=${a?"on":""} @click=${()=>{n(),this.onDeviceTap(o,e.x,e.y)}}><b>${i+1}</b><span>${O(t,o)}</span><i>${s?te(t,s):"\u2013"}</i></button>`})}
${e.ids.map((o,i)=>{let s=t.states[o],a=J(s)||s?.state==="on";return m`<button role="menuitem" class=${a?"on":""} @click=${()=>{n(),this.onDeviceTap(o,e.x,e.y)}}><b>${i+1}</b><span>${O(t,o)}</span><i>${s?te(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,o=t?.clientHeight??600,i=Math.max(8,Math.min(n-240,e.x-116)),s=Math.max(8,Math.min(o-360,e.y-170));return m`<div class="nf-menu-backdrop" @click=${()=>this._menu=null}></div>
<nf-quick-menu
style="left:${i}px;top:${s}px"
@@ -1667,10 +1667,10 @@ A plugin runs with the same rights as NextFloor in your browser. The file has be
.myPosition=${this.myPositionOf(e.entity)}
.tiltEntity=${tr(this.hass,this.building?.floors??[],e.entity)}
@close=${()=>this._menu=null}
></nf-quick-menu>`}myPositionOf(e){for(let t of this.building?.floors??[])for(let n of t.openings){let o=this.openingLinks?.get(n.id);if(n.my_position!=null&&(o?.cover===e||o?.cover2===e))return n.my_position}return null}onDeviceTap(e,t=0,n=0){if(e.startsWith("lamp:")||this._travel)return;let o=e.startsWith("tap:")?e.slice(4):this.tapPins.get(e);if(o){let s=this.building?.floors.flatMap(a=>a.furniture).find(a=>a.id===o);s?.tap&&xo(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??Pe(s,l=>this.furnitureLinks?.get(l.id)?.power??null).grid:null;a&&fe(this,a);return}let i=D(e);if(i==="cover"||i==="media"){this._menu={entity:e,x:t,y:n};return}if(i==="lock"){let s=bo(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(i&&ks.has(i)){if(this.confirmSet.has(e)&&!confirm(A(this.hass,"confirm_switch",{name:O(this.hass,e)})))return;da(this.hass,e)}else fe(this,e)}pluginTapped(e){let t=this.hass?.states[e],n=this.placementInfo.get(e);if(!t||!n)return!1;let o=this.building?.floors.find(i=>i.id===n.floorId)?.placements.find(i=>i.entity_id===e);return ns({hass:this.hass,entityId:e,state:t},n,o?.plugin??void 0,{showWindow:(i,s)=>{i&&"hass"in i&&(i.hass=this.hass),this._pluginWindow=i?{node:i,title:s?.title??""}:null},moreInfo:i=>fe(this,i??e)})}renderPluginWindow(){let e=this._pluginWindow;return e?m`<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 o=this.openingLinks?.get(n.id);if(n.my_position!=null&&(o?.cover===e||o?.cover2===e))return n.my_position}return null}onDeviceTap(e,t=0,n=0){if(e.startsWith("lamp:")||this._travel)return;let o=e.startsWith("tap:")?e.slice(4):this.tapPins.get(e);if(o){let s=this.building?.floors.flatMap(a=>a.furniture).find(a=>a.id===o);s?.tap&&yo(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??Pe(s,l=>this.furnitureLinks?.get(l.id)?.power??null).grid:null;a&&fe(this,a);return}let i=F(e);if(i==="cover"||i==="media"){this._menu={entity:e,x:t,y:n};return}if(i==="lock"){let s=_o(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(i&&xs.has(i)){if(this.confirmSet.has(e)&&!confirm(A(this.hass,"confirm_switch",{name:O(this.hass,e)})))return;da(this.hass,e)}else fe(this,e)}pluginTapped(e){let t=this.hass?.states[e],n=this.placementInfo.get(e);if(!t||!n)return!1;let o=this.building?.floors.find(i=>i.id===n.floorId)?.placements.find(i=>i.entity_id===e);return ts({hass:this.hass,entityId:e,state:t},n,o?.plugin??void 0,{showWindow:(i,s)=>{i&&"hass"in i&&(i.hass=this.hass),this._pluginWindow=i?{node:i,title:s?.title??""}:null},moreInfo:i=>fe(this,i??e)})}renderPluginWindow(){let e=this._pluginWindow;return e?m`<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=${A(this.hass,"close")} @click=${()=>this._pluginWindow=null}>✕</button></div>
<div class="nf-pw-body">${e.node}</div>
</div>`:f}startViewOf(){return this.startView??this.building?.settings.start_view??null}currentView(){return this.viewer?.currentView()??null}resetView(){this.viewer?.resetView()}fire(e,t){this.dispatchEvent(new CustomEvent(e,{detail:t,bubbles:!0,composed:!0}))}toggleFlows(){this._flows=!this._flows;try{localStorage.setItem("nextfloor.flows",this._flows?"1":"0")}catch{}this.syncDevices(!0)}liveHeatPumps(e){let t=this.hass;if(!t)return[];let n=[];for(let o of e.floors)for(let i of o.furniture){if(!uc(i.type))continue;let s=this.furnitureLinks?.get(i.id),a=cc(t,s?.entity??s?.power??null);a&&n.push({id:i.id,name:i.name||he(t,i.type),floorId:o.id,x:i.x,z:i.z,at:{floorId:o.id,x:i.x,z:i.z,y:ce(o,i)+i.h+.5},pump:a})}return n}livePrinters(e){let t=this.hass,n=[];if(!t)return n;for(let o of e.floors)for(let i of o.furniture){if(!oi(i.type))continue;let s=this.furnitureLinks?.get(i.id),a=ri(t,s?.entity??s?.power??null);!a||!a.printing&&!/pause|finish|complete|error/.test(a.status)||n.push({id:i.id,name:i.name||he(t,i.type),at:{floorId:o.id,x:i.x,z:i.z,y:ce(o,i)+i.h+.5},printer:a})}return n}liveCars(e,t){let n=[];for(let o of t.floors)for(let i of o.furniture){if(i.type!=="parking")continue;let s=fc(e,i);if(!s||s.soc===null&&s.range===null&&s.locked===null&&s.climateOn===null)continue;let a=Go(e,i),l=a?El(i,a):null,c=i.name||(a?he(e,a):he(e,i.type));n.push({spot:i.id,name:c,at:{floorId:o.id,x:i.x,z:i.z,y:ce(o,i)+(l?.h??.2)+.6},car:s})}return n}liveMedia(e,t){let n=[];for(let o of t.floors){for(let i of o.furniture){let s=this.furnitureLinks?.get(i.id)?.entity;s?.startsWith("media_player.")&&n.push({entity:s,name:i.name||he(e,i.type),at:{floorId:o.id,x:i.x,z:i.z,y:ce(o,i)+i.h+.15},rings:i.sound_rings})}for(let i of o.placements)i.entity_id.startsWith("media_player.")&&n.push({entity:i.entity_id,name:i.name||O(e,i.entity_id),at:{floorId:o.id,x:i.x,z:i.z,y:(i.y??1.1)+.15},rings:i.sound_rings})}return pl(e,n)}refreshToday(e){let t=this.hass,n=e.settings.calendars??[],o=Math.max(1,Math.min(7,e.settings.today_days??1)),i=`${new Date().toDateString()}|${o}`;!t||!n.length||Date.now()-this.todayAt<9e5&&i===this.todayDay||(this.todayAt=Date.now(),this.todayDay=i,oc(t,n,o).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 o=`${n}|${new Date().toDateString()}`;Date.now()-this.forecastAt<18e5&&o===this.forecastKey||(this.forecastAt=Date.now(),this.forecastKey=o,ac(t,n).then(i=>this._forecast=i))}renderForecast(e){let t=this.building,n=this.hass,o=t?.settings.forecast;if(!t||!n||!o||o.corner!==e||this.clean)return f;if(e==="top_right"&&(this.roomId||this.panelOpen))return f;let i=sc(this._forecast,Math.max(1,Math.min(7,o.days)));if(!i.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"}),p=d=>d===null?"\u2013":`${Math.round(d)}\xB0`;return m`<section class="nf-forecast" aria-label=${A(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 o of e.floors)for(let i of o.furniture){if(!uc(i.type))continue;let s=this.furnitureLinks?.get(i.id),a=cc(t,s?.entity??s?.power??null);a&&n.push({id:i.id,name:i.name||he(t,i.type),floorId:o.id,x:i.x,z:i.z,at:{floorId:o.id,x:i.x,z:i.z,y:ce(o,i)+i.h+.5},pump:a})}return n}livePrinters(e){let t=this.hass,n=[];if(!t)return n;for(let o of e.floors)for(let i of o.furniture){if(!ri(i.type))continue;let s=this.furnitureLinks?.get(i.id),a=ni(t,s?.entity??s?.power??null);!a||!a.printing&&!/pause|finish|complete|error/.test(a.status)||n.push({id:i.id,name:i.name||he(t,i.type),at:{floorId:o.id,x:i.x,z:i.z,y:ce(o,i)+i.h+.5},printer:a})}return n}liveCars(e,t){let n=[];for(let o of t.floors)for(let i of o.furniture){if(i.type!=="parking")continue;let s=fc(e,i);if(!s||s.soc===null&&s.range===null&&s.locked===null&&s.climateOn===null)continue;let a=Ko(e,i),l=a?El(i,a):null,c=i.name||(a?he(e,a):he(e,i.type));n.push({spot:i.id,name:c,at:{floorId:o.id,x:i.x,z:i.z,y:ce(o,i)+(l?.h??.2)+.6},car:s})}return n}liveMedia(e,t){let n=[];for(let o of t.floors){for(let i of o.furniture){let s=this.furnitureLinks?.get(i.id)?.entity;s?.startsWith("media_player.")&&n.push({entity:s,name:i.name||he(e,i.type),at:{floorId:o.id,x:i.x,z:i.z,y:ce(o,i)+i.h+.15},rings:i.sound_rings})}for(let i of o.placements)i.entity_id.startsWith("media_player.")&&n.push({entity:i.entity_id,name:i.name||O(e,i.entity_id),at:{floorId:o.id,x:i.x,z:i.z,y:(i.y??1.1)+.15},rings:i.sound_rings})}return pl(e,n)}refreshToday(e){let t=this.hass,n=e.settings.calendars??[],o=Math.max(1,Math.min(7,e.settings.today_days??1)),i=`${new Date().toDateString()}|${o}`;!t||!n.length||Date.now()-this.todayAt<9e5&&i===this.todayDay||(this.todayAt=Date.now(),this.todayDay=i,oc(t,n,o).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 o=`${n}|${new Date().toDateString()}`;Date.now()-this.forecastAt<18e5&&o===this.forecastKey||(this.forecastAt=Date.now(),this.forecastKey=o,ac(t,n).then(i=>this._forecast=i))}renderForecast(e){let t=this.building,n=this.hass,o=t?.settings.forecast;if(!t||!n||!o||o.corner!==e||this.clean)return f;if(e==="top_right"&&(this.roomId||this.panelOpen))return f;let i=sc(this._forecast,Math.max(1,Math.min(7,o.days)));if(!i.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"}),p=d=>d===null?"\u2013":`${Math.round(d)}\xB0`;return m`<section class="nf-forecast" aria-label=${A(n,"forecast")}>
<ul>
${i.map((d,_)=>m`<li>
<span class="nf-fc-day">${_===0?A(n,"today"):h.format(new Date(d.day))}</span>
@@ -1697,12 +1697,12 @@ A plugin runs with the same rights as NextFloor in your browser. The file has be
<span>${A(this.hass,"holos")}</span><b>◫</b>
</button>`}ownSensors(){return(this.sensorBar&&this.hass?this.building?.settings.status_entities??[]:[]).filter(t=>this.hass.states[t]).map(t=>m`<button class="nf-energy-item nf-own-sensor" title=${O(this.hass,t)} @click=${()=>fe(this,t)}>
<span>${O(this.hass,t)}</span><b>${te(this.hass,this.hass.states[t])}</b>
</button>`)}renderMapCredit(){let e=this.building?.settings.map;return Hl(e)?m`<a class="nf-map-credit" href=${jo(e).href} target="_blank" rel="noopener">${jo(e).text}</a>`:f}renderLegend(){if(this.heatMode==="wifi")return this.renderWifiLegend();if(this.heatMode==="none"||this.heatMode==="values")return f;let e=at(new Date,this.hass?.config?.latitude??50),t=pr(this.heatMode,e),n=this.heatMode==="temperature",o=n?oe(this.hass,t.stops[0][0]):t.stops[0][0],i=n?oe(this.hass,t.stops[t.stops.length-1][0]):t.stops[t.stops.length-1][0],s=n?X(this.hass):t.unit,a=l=>A(this.hass,l);return m`<div class="nf-legend">
</button>`)}renderMapCredit(){let e=this.building?.settings.map;return Hl(e)?m`<a class="nf-map-credit" href=${Uo(e).href} target="_blank" rel="noopener">${Uo(e).text}</a>`:f}renderLegend(){if(this.heatMode==="wifi")return this.renderWifiLegend();if(this.heatMode==="none"||this.heatMode==="values")return f;let e=at(new Date,this.hass?.config?.latitude??50),t=pr(this.heatMode,e),n=this.heatMode==="temperature",o=n?oe(this.hass,t.stops[0][0]):t.stops[0][0],i=n?oe(this.hass,t.stops[t.stops.length-1][0]):t.stops[t.stops.length-1][0],s=n?X(this.hass):t.unit,a=l=>A(this.hass,l);return m`<div class="nf-legend">
<b>${a(`heat_${this.heatMode}`)}${this.heatMode==="temperature"?m` <small>${a(e?"heat_summer":"heat_winter")}</small>`:f}</b>
<span class="nf-legend-bar" style="background:${ja(this.heatMode,e)}"></span>
<span class="nf-legend-range"><span>${W(this.hass,o,0)} ${s}</span><span>${W(this.hass,i,0)} ${s}</span></span>
${this.heatValues.size?f:m`<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)=>A(e,c,u),o=t.floors.flatMap(c=>c.furniture.filter(u=>ii(u.type)).map(u=>si(e,this.furnitureLinks?.get(u.id)?.entity??this.furnitureLinks?.get(u.id)?.power??null))),s=o.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=pc(a);return m`<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),o=t.floors.flatMap(c=>c.furniture.filter(u=>oi(u.type)).map(u=>ii(e,this.furnitureLinks?.get(u.id)?.entity??this.furnitureLinks?.get(u.id)?.power??null))),s=o.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=pc(a);return m`<div class="nf-legend">
<b>📶 ${n("heat_wifi")}</b>
<span>${n("wifi_aps",{n:o.length,clients:s})}</span>
${l.online+l.offline.length?m`<span>${n("wifi_network",{online:l.online,offline:l.offline.length})}</span>`:f}
@@ -3299,26 +3299,26 @@ A plugin runs with the same rights as NextFloor in your browser. The file has be
inset: auto 16px 16px;
color: var(--nf-danger);
}
`]};customElements.get("nf-view3d")||customElements.define("nf-view3d",mi);function ae(r,e){return Math.abs(e)>=1e3?`${W(r,e/1e3,1)} kW`:`${Math.round(e)} W`}function pi(r){return r.type==="tv_board"?r.h+.9:r.type==="tv_wall"||r.type==="kitchen_wall"?r.h+.25:r.h+.35}function Tm(r,e){let t=e.attributes.percentage;return e.state==="on"&&typeof t=="number"?`${Math.round(t)} %`:te(r,e)}var Hc;function Ic(){let r=new URL("./nextfloor-editor.js?v=6bcac3b155cd",new URL(import.meta.url)).href;return Hc??=import(r),Hc}var Fm=.25,Cc=r=>Math.round(r*1e3)/1e3,Nc=(r,e,t)=>r.rooms.find(n=>n.points.length>=3&&H([e,t],n.points));function gi(r,e,t,n,o){let i=Nc(r,e,t);if(!i)return[n,o];let s=(a,l)=>H([a,l],i.points);return s(n,o)?[n,o]:s(n,t)?[n,t]:s(e,o)?[e,o]:[e,t]}function Dm(r,e,t,n){return r.rooms.some(o=>o.id!==e.id&&o.points.some((i,s)=>{let a=o.points[(s+1)%o.points.length];return Math.abs(ie(Y(i,t),n))<.02&&Math.abs(ie(Y(a,t),n))<.02}))}var fi=(r,e)=>Math.abs((r-e+540)%360-180);function Wc(r,e,t,n=Fm){let o=Nc(r,e.x,e.z);if(!o)return null;let i=o.points,s=rt(i)>=0?1:-1,a=null;return i.forEach((l,c)=>{let u=i[(c+1)%i.length],h=De(Y(u,l));if(h<.3)return;let p=[(u[0]-l[0])/h,(u[1]-l[1])/h],d=[-p[1]*s,p[0]*s],_=ie(Y([e.x,e.z],l),p);if(_<0||_>h)return;let b=Dm(r,o,l,d)?t/2:0,g=ie(Y([e.x,e.z],l),d)-b,v=Math.atan2(-d[0],d[1])*180/Math.PI,k=[{rotation:v,extent:e.d/2},{rotation:v+90,extent:e.w/2},{rotation:v-90,extent:e.w/2}].reduce((z,E)=>fi(e.rotation,E.rotation)<fi(e.rotation,z.rotation)?E:z);if(fi(e.rotation,k.rotation)>50)return;let y=g-k.extent;Math.abs(y)>n||a&&Math.abs(y)>=Math.abs(a.gap)||(a={x:Cc(e.x-d[0]*y),z:Cc(e.z-d[1]*y),rotation:(Math.round(k.rotation)%360+360)%360,gap:y})}),a&&{x:a.x,z:a.z,rotation:a.rotation}}function Pr(r,e,t){let n=structuredClone(r);for(let o of n.floors){let i=o.furniture.find(s=>s.id===e);i&&t(i,o)}return n}function Hr(r,e,t){let n=structuredClone(r);for(let o of n.floors){let i=o.placements.find(s=>s.entity_id===e);i&&t(i,o)}return n}function Oc(r,e){let t=structuredClone(r);for(let n of t.floors)n.furniture=n.furniture.filter(o=>o.id!==e);return t}function Lc(r,e){let t=structuredClone(r);for(let n of t.floors)n.placements=n.placements.filter(o=>o.entity_id!==e);return t}function Bc(r,e,t,n){return Hr(r,e,(o,i)=>{[o.x,o.z]=gi(i,o.x,o.z,t,n)})}function Vc(r,e,t,n){let o=r.settings.wall_interior??.12;return Pr(r,e,(i,s)=>{[i.x,i.z]=gi(s,i.x,i.z,t,n);let a=Wc(s,i,o);a&&Object.assign(i,a)})}var _i=(r,e)=>((r+e)%360+360)%360,Kc=r=>Number.parseFloat(r.replace(",",".")),kn=(r,e)=>Math.round(r*10**e)/10**e;function bi(r){let{min:e,max:t,accepts:n=()=>!0}=r,o=i=>{let s=Kc(i.target.value);!Number.isFinite(s)||!n(s)||r.apply(t===void 0?s:Math.min(t,Math.max(e,s)))};return m`<label class="nf-size" title=${r.title}
`]};customElements.get("nf-view3d")||customElements.define("nf-view3d",pi);function ae(r,e){return Math.abs(e)>=1e3?`${W(r,e/1e3,1)} kW`:`${Math.round(e)} W`}function hi(r){return r.type==="tv_board"?r.h+.9:r.type==="tv_wall"||r.type==="kitchen_wall"?r.h+.25:r.h+.35}function Tm(r,e){let t=e.attributes.percentage;return e.state==="on"&&typeof t=="number"?`${Math.round(t)} %`:te(r,e)}var Hc;function Ic(){let r=new URL("./nextfloor-editor.js?v=dafe94a24af9",new URL(import.meta.url)).href;return Hc??=import(r),Hc}var Dm=.25,Cc=r=>Math.round(r*1e3)/1e3,Nc=(r,e,t)=>r.rooms.find(n=>n.points.length>=3&&H([e,t],n.points));function fi(r,e,t,n,o){let i=Nc(r,e,t);if(!i)return[n,o];let s=(a,l)=>H([a,l],i.points);return s(n,o)?[n,o]:s(n,t)?[n,t]:s(e,o)?[e,o]:[e,t]}function Fm(r,e,t,n){return r.rooms.some(o=>o.id!==e.id&&o.points.some((i,s)=>{let a=o.points[(s+1)%o.points.length];return Math.abs(ie(Y(i,t),n))<.02&&Math.abs(ie(Y(a,t),n))<.02}))}var mi=(r,e)=>Math.abs((r-e+540)%360-180);function Wc(r,e,t,n=Dm){let o=Nc(r,e.x,e.z);if(!o)return null;let i=o.points,s=rt(i)>=0?1:-1,a=null;return i.forEach((l,c)=>{let u=i[(c+1)%i.length],h=Fe(Y(u,l));if(h<.3)return;let p=[(u[0]-l[0])/h,(u[1]-l[1])/h],d=[-p[1]*s,p[0]*s],_=ie(Y([e.x,e.z],l),p);if(_<0||_>h)return;let b=Fm(r,o,l,d)?t/2:0,g=ie(Y([e.x,e.z],l),d)-b,v=Math.atan2(-d[0],d[1])*180/Math.PI,k=[{rotation:v,extent:e.d/2},{rotation:v+90,extent:e.w/2},{rotation:v-90,extent:e.w/2}].reduce((z,E)=>mi(e.rotation,E.rotation)<mi(e.rotation,z.rotation)?E:z);if(mi(e.rotation,k.rotation)>50)return;let y=g-k.extent;Math.abs(y)>n||a&&Math.abs(y)>=Math.abs(a.gap)||(a={x:Cc(e.x-d[0]*y),z:Cc(e.z-d[1]*y),rotation:(Math.round(k.rotation)%360+360)%360,gap:y})}),a&&{x:a.x,z:a.z,rotation:a.rotation}}function Pr(r,e,t){let n=structuredClone(r);for(let o of n.floors){let i=o.furniture.find(s=>s.id===e);i&&t(i,o)}return n}function Hr(r,e,t){let n=structuredClone(r);for(let o of n.floors){let i=o.placements.find(s=>s.entity_id===e);i&&t(i,o)}return n}function Oc(r,e){let t=structuredClone(r);for(let n of t.floors)n.furniture=n.furniture.filter(o=>o.id!==e);return t}function Lc(r,e){let t=structuredClone(r);for(let n of t.floors)n.placements=n.placements.filter(o=>o.entity_id!==e);return t}function Bc(r,e,t,n){return Hr(r,e,(o,i)=>{[o.x,o.z]=fi(i,o.x,o.z,t,n)})}function Vc(r,e,t,n){let o=r.settings.wall_interior??.12;return Pr(r,e,(i,s)=>{[i.x,i.z]=fi(s,i.x,i.z,t,n);let a=Wc(s,i,o);a&&Object.assign(i,a)})}var gi=(r,e)=>((r+e)%360+360)%360,Kc=r=>Number.parseFloat(r.replace(",",".")),kn=(r,e)=>Math.round(r*10**e)/10**e;function _i(r){let{min:e,max:t,accepts:n=()=>!0}=r,o=i=>{let s=Kc(i.target.value);!Number.isFinite(s)||!n(s)||r.apply(t===void 0?s:Math.min(t,Math.max(e,s)))};return m`<label class="nf-size" title=${r.title}
>${r.label}
<input type="number" inputmode="decimal" step=${r.step} min=${e} max=${t??f} .value=${String(kn(r.value,2))} @change=${o} />
</label>`}var Uc=(r,e)=>m`<button class="nf-chip" @click=${e}>${r.t("height_auto")}</button>`,Gc=(r,e)=>m`<button class="nf-chip" @click=${()=>e(-r)}>↺ ${r}°</button><button class="nf-chip" @click=${()=>e(r)}>↻ ${r}°</button>`;function Pm(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 o=(s,a)=>bi({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]=kn(l,3))}),i=bs(n)?m`${bi({label:"\u2195",title:r.t("mount_height"),value:n.mount_y??ce(t,n),step:.05,min:0,accepts:s=>s>=0,apply:s=>r.editFurniture(e,a=>a.mount_y=kn(s,3))})}
${n.mount_y!=null?Uc(r,()=>r.editFurniture(e,s=>s.mount_y=null)):f}`:f;return m`${o("w","size_short_w")}${o("d","size_short_d")}${o("h","size_short_h")} ${i}`}function Hm(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 o=D(e),i=(l,c,u)=>m`<select class="nf-size-select" title=${r.t(l)} @change=${h=>r.editDevice(e,p=>Object.assign(p,{mount:h.target.value,y:null}))}>
</label>`}var Uc=(r,e)=>m`<button class="nf-chip" @click=${e}>${r.t("height_auto")}</button>`,Gc=(r,e)=>m`<button class="nf-chip" @click=${()=>e(-r)}>↺ ${r}°</button><button class="nf-chip" @click=${()=>e(r)}>↻ ${r}°</button>`;function Pm(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 o=(s,a)=>_i({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]=kn(l,3))}),i=_s(n)?m`${_i({label:"\u2195",title:r.t("mount_height"),value:n.mount_y??ce(t,n),step:.05,min:0,accepts:s=>s>=0,apply:s=>r.editFurniture(e,a=>a.mount_y=kn(s,3))})}
${n.mount_y!=null?Uc(r,()=>r.editFurniture(e,s=>s.mount_y=null)):f}`:f;return m`${o("w","size_short_w")}${o("d","size_short_d")}${o("h","size_short_h")} ${i}`}function Hm(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 o=F(e),i=(l,c,u)=>m`<select class="nf-size-select" title=${r.t(l)} @change=${h=>r.editDevice(e,p=>Object.assign(p,{mount:h.target.value,y:null}))}>
${c.map(([h,p])=>m`<option value=${h} ?selected=${h===u}>${p}</option>`)}
</select>`,s=["ceiling","floor","table","wall"].map(l=>[l,r.t(`lamp_${l}`)]),a=o?yt(o,me(t,n.x,n.z),o==="light"?n.mount??"ceiling":null):1;return m`${o==="light"?i("lamp_mount",s,n.mount??"ceiling"):f}
${bi({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=kn(l,3))})}
${_i({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=kn(l,3))})}
${n.y!==null?Uc(r,()=>r.editDevice(e,l=>l.y=null)):f}`}function jc(r,e,t){let n=r.t,o;if(e){let i=r.building.floors.flatMap(s=>s.furniture).find(s=>s.id===e)?.type;o=m`<span>${i?he(r.hass,i):""}</span>
${Pm(r,e)} ${Gc(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 nf-danger-chip" @click=${()=>r.removeFurniture(e)}>${n("delete")}</button>`}else t?o=m`<span>${O(r.hass,t)}</span>
${Hm(r,t)} ${Gc(45,i=>r.turnDevice(t,i))}
<button class="nf-chip nf-danger-chip" @click=${()=>r.removeDevice(t)}>${n("delete")}</button>`:o=m`<span>${n("furnish_hint")}</span>`;return m`<div class="nf-furnish-bar">${o}<button class="nf-chip nf-chip-on" @click=${()=>r.finish()}>${n("done")}</button></div>`}var qc=J`<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>`:o=m`<span>${n("furnish_hint")}</span>`;return m`<div class="nf-furnish-bar">${o}<button class="nf-chip nf-chip-on" @click=${()=>r.finish()}>${n("done")}</button></div>`}var qc=Q`<svg class="nf-mark" viewBox="60 40 392 420" aria-hidden="true">
<polygon points="106,150 256,66 406,150 256,234" fill="none" stroke="currentColor" stroke-opacity=".55" stroke-width="12" stroke-dasharray="6 22" stroke-linecap="round"/>
<polygon points="106,382 256,466 256,488 106,404" fill="#34507d"/><polygon points="406,382 256,466 256,488 406,404" fill="#2a4068"/><polygon points="106,382 256,298 406,382 256,466" fill="#5f7fb6"/>
<polygon points="106,310 256,394 256,416 106,332" fill="#4a72b8"/><polygon points="406,310 256,394 256,416 406,332" fill="#3b5c98"/><polygon points="106,310 256,226 406,310 256,394" fill="#8ab6f5"/>
<polygon points="106,238 256,322 256,344 106,260" fill="#2a74d8"/><polygon points="406,238 256,322 256,344 406,260" fill="#2161b8"/><polygon points="106,238 256,154 406,238 256,322" fill="#4fb6ff"/>
<circle cx="256" cy="236" r="16" fill="#ffe08a"/>
</svg>`;var le=(r,e)=>({name:r,fallback:e,read:t=>e?t!=="0":t==="1",write:t=>t?"1":"0"}),It=(r,e,t)=>({name:r,fallback:t,read:n=>e.find(o=>o===n)??t,write:n=>n}),vi={explode:le("explode",!0),keepRoof:le("roof",!1),solidWalls:le("solid_walls",!1),quality:It("quality",["auto","low","high"],"auto"),stats:le("stats",!1),markers:It("markers",["none","important","all"],"important"),heat:It("heat",["none","temperature","humidity","co2","mould","comfort","power","sun","values","wifi"],"none"),theme:It("theme",xr,"neon"),clock:It("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:It("floor_stack",["dim","stacked","single"],"dim"),roomNames:le("room_names",!0),clean:le("clean",!1),navWrap:le("nav_wrap",!1),weather:le("weather",!0),timeSlider:le("time_slider",!1),menuOpen:le("menu_open",!1),keepCamera:le("keep_camera",!1),readable:le("readable",!1),plain:le("plain",!1),rightBack:le("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:le("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 Zc(r=Cr()){try{return r?.getItem("nextfloor.screen_name")?.trim()||null}catch{return null}}function Yc(r=Cr()){try{return r?.getItem("nextfloor.announce_muted")==="1"}catch{return!1}}function Cr(){try{return localStorage}catch{return null}}var Ir=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(vi)){let o=vi[n],i=this.raw(o.name);t[n]=i===null?o.fallback:o.read(i)}return new URLSearchParams(e).has("nf_stats")&&(t.stats=!0),t}save(e,t){let n=vi[e];try{this.storage?.setItem(`nextfloor.${n.name}`,n.write(t))}catch{}}};var Jc=ne`
</svg>`;var le=(r,e)=>({name:r,fallback:e,read:t=>e?t!=="0":t==="1",write:t=>t?"1":"0"}),It=(r,e,t)=>({name:r,fallback:t,read:n=>e.find(o=>o===n)??t,write:n=>n}),bi={explode:le("explode",!0),keepRoof:le("roof",!1),solidWalls:le("solid_walls",!1),quality:It("quality",["auto","low","high"],"auto"),stats:le("stats",!1),markers:It("markers",["none","important","all"],"important"),heat:It("heat",["none","temperature","humidity","co2","mould","comfort","power","sun","values","wifi"],"none"),theme:It("theme",xr,"neon"),clock:It("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:It("floor_stack",["dim","stacked","single"],"dim"),roomNames:le("room_names",!0),clean:le("clean",!1),navWrap:le("nav_wrap",!1),weather:le("weather",!0),timeSlider:le("time_slider",!1),menuOpen:le("menu_open",!1),keepCamera:le("keep_camera",!1),readable:le("readable",!1),plain:le("plain",!1),rightBack:le("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:le("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 Zc(r=Cr()){try{return r?.getItem("nextfloor.screen_name")?.trim()||null}catch{return null}}function Yc(r=Cr()){try{return r?.getItem("nextfloor.announce_muted")==="1"}catch{return!1}}function Cr(){try{return localStorage}catch{return null}}var Ir=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(bi)){let o=bi[n],i=this.raw(o.name);t[n]=i===null?o.fallback:o.read(i)}return new URLSearchParams(e).has("nf_stats")&&(t.stats=!0),t}save(e,t){let n=bi[e];try{this.storage?.setItem(`nextfloor.${n.name}`,n.write(t))}catch{}}};var Jc=ne`
.nf-dot {
display: inline-block;
width: 8px;
@@ -3803,11 +3803,11 @@ A plugin runs with the same rights as NextFloor in your browser. The file has be
gap: 12px;
margin: auto;
}
`;var Qc=new WeakMap,Xc=new WeakMap,Im={open_cover:"close_cover",close_cover:"open_cover",open_cover_tilt:"close_cover_tilt",close_cover_tilt:"open_cover_tilt"};function dt(r,e){let t=Xc.get(r)??r,n=Qc.get(t)??new WeakMap;Qc.set(t,n);let o=n.get(e);if(o)return o;let i=new Map;for(let l of e)for(let c of l.placements)c.entity_id.startsWith("cover.")&&i.set(c.entity_id,{inverted:c.cover_inverted,tiltInverted:c.cover_tilt_inverted,tilt:c.cover_tilt==="none"?null:c.cover_tilt,position:c.position,positionInverted:c.position_inverted});for(let l of Re(t,e).values())l.cover&&!i.has(l.cover)&&i.set(l.cover,{inverted:l.coverInverted,tiltInverted:l.coverTiltInverted,tilt:l.coverTilt,position:l.position,positionInverted:l.positionInverted}),l.cover2&&!i.has(l.cover2)&&i.set(l.cover2,{inverted:l.cover2Inverted,tiltInverted:l.cover2TiltInverted,tilt:l.cover2Tilt});let s={...t.states};for(let[l,c]of i){let u=t.states[l];if(!u)continue;let h={...u.attributes,nf_cover_control:!0},p=xt(t,c.position);p!==null&&c.positionInverted&&(p=100-p),p===null&&(p=typeof u.attributes.current_position=="number"?u.attributes.current_position:null),p!==null&&(h.current_position=c.inverted?100-p:p);let d=c.tilt?t.states[c.tilt]:u,_=typeof d?.attributes.current_tilt_position=="number"?d.attributes.current_tilt_position:c.tilt?xt(t,c.tilt):null;_!==null&&(c.tiltInverted&&(_=100-_),h.current_tilt_position=_,h.supported_features=Number(h.supported_features??0)|128);let b=u.state;c.inverted&&(b={open:"closed",closed:"open",opening:"closing",closing:"opening"}[b]??b),typeof h.current_position=="number"&&b!=="unavailable"&&b!=="unknown"&&b!=="opening"&&b!=="closing"&&(b=h.current_position>0?"open":"closed"),s[l]={...u,state:b,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],p=async d=>{let _=typeof d=="string"?i.get(d):void 0;if(!_)return t.callService(l,c,{...u,entity_id:d});let b={...u,entity_id:d},g=c;(g==="toggle"||g==="toggle_cover")&&(g=s[String(d)]?.state==="closed"?"open_cover":"close_cover");let v=g.includes("tilt");if(v&&_.tilt&&(b.entity_id=_.tilt),v?_.tiltInverted:_.inverted){g=Im[g]??g;let k=v?"tilt_position":"position";typeof b[k]=="number"&&(b[k]=100-b[k])}let S=_.tilt?t.states[_.tilt]:void 0;return v&&_.tilt&&!S?.attributes.symcon_id&&typeof S?.attributes.current_tilt_position!="number"&&(g==="set_cover_tilt_position"?(g="set_cover_position",b.position=b.tilt_position,delete b.tilt_position):g==="open_cover_tilt"?g="open_cover":g==="close_cover_tilt"&&(g="close_cover")),t.callService(l,g,b)};return Array.isArray(u.entity_id)?Promise.all(h.map(p)):p(h[0])}};return Xc.set(a,t),n.set(e,a),a}var wi=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 wt(this);store=new Ir(Cr());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:nt(ft(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=i=>`${String(Math.floor(i)).padStart(2,"0")}:${String(Math.round(i%1*60)).padStart(2,"0")}`,o=()=>{let i=new Date;return Math.round((i.getHours()+i.getMinutes()/60)*4)/4};return m`<button class="nf-chip" aria-pressed=${t!==null} title=${e("time_of_day_hint")} @click=${()=>(this._timeDrag=null,this._timeOfDay=t===null?o():null)}>☀ ${t===null?e("time_of_day"):n(t)}</button>
`;var Qc=new WeakMap,Xc=new WeakMap;function dt(r,e){let t=Xc.get(r)??r,n=Qc.get(t)??new WeakMap;Qc.set(t,n);let o=n.get(e);if(o)return o;let i=new Map;for(let l of e)for(let c of l.placements)c.entity_id.startsWith("cover.")&&i.set(c.entity_id,{tilt:c.cover_tilt==="none"?null:c.cover_tilt,position:c.position});for(let l of Re(t,e).values())l.cover&&!i.has(l.cover)&&i.set(l.cover,{tilt:l.coverTilt,position:l.position}),l.cover2&&!i.has(l.cover2)&&i.set(l.cover2,{tilt:l.cover2Tilt});let s={...t.states};for(let[l,c]of i){let u=t.states[l];if(!u)continue;let h={...u.attributes,nf_cover_control:!0},p=xt(t,c.position);p===null&&(p=typeof u.attributes.current_position=="number"?u.attributes.current_position:null),p!==null&&(h.current_position=p);let d=c.tilt?t.states[c.tilt]:u,_=typeof d?.attributes.current_tilt_position=="number"?d.attributes.current_tilt_position:c.tilt?xt(t,c.tilt):null;_!==null&&(h.current_tilt_position=_,h.supported_features=Number(h.supported_features??0)|128);let b=u.state;typeof h.current_position=="number"&&b!=="unavailable"&&b!=="unknown"&&b!=="opening"&&b!=="closing"&&(b=h.current_position>0?"open":"closed"),s[l]={...u,state:b,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],p=async d=>{let _=typeof d=="string"?i.get(d):void 0;if(!_)return t.callService(l,c,{...u,entity_id:d});let b={...u,entity_id:d},g=c;(g==="toggle"||g==="toggle_cover")&&(g=s[String(d)]?.state==="closed"?"open_cover":"close_cover");let v=g.includes("tilt");v&&_.tilt&&(b.entity_id=_.tilt);let S=_.tilt?t.states[_.tilt]:void 0;return v&&_.tilt&&!S?.attributes.symcon_id&&typeof S?.attributes.current_tilt_position!="number"&&(g==="set_cover_tilt_position"?(g="set_cover_position",b.position=b.tilt_position,delete b.tilt_position):g==="open_cover_tilt"?g="open_cover":g==="close_cover_tilt"&&(g="close_cover")),t.callService(l,g,b)};return Array.isArray(u.entity_id)?Promise.all(h.map(p)):p(h[0])}};return Xc.set(a,t),n.set(e,a),a}var vi=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 wt(this);store=new Ir(Cr());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:nt(ft(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=i=>`${String(Math.floor(i)).padStart(2,"0")}:${String(Math.round(i%1*60)).padStart(2,"0")}`,o=()=>{let i=new Date;return Math.round((i.getHours()+i.getMinutes()/60)*4)/4};return m`<button class="nf-chip" aria-pressed=${t!==null} title=${e("time_of_day_hint")} @click=${()=>(this._timeDrag=null,this._timeOfDay=t===null?o():null)}>☀ ${t===null?e("time_of_day"):n(t)}</button>
${t!==null?m`<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=${i=>this._timeDrag=Number(i.target.value)}
@change=${i=>(this._timeDrag=null,this._timeOfDay=Number(i.target.value))}
/></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=_r(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=Jt(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=>Pr(n,e,t)),editDevice:(e,t)=>this.applyEdit(n=>Hr(n,e,t)),turnFurniture:(e,t)=>this.applyEdit(n=>Pr(n,e,o=>o.rotation=_i(o.rotation,t))),turnDevice:(e,t)=>this.applyEdit(n=>Hr(n,e,o=>o.rotation=_i(o.rotation??0,t))),removeFurniture:e=>{this.applyEdit(t=>Oc(t,e)),this._selFurniture=null},removeDevice:e=>{this.applyEdit(t=>Lc(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(o=>({...o,rooms:o.rooms.map(i=>i.id===e?{...i,moods:t.length?t:void 0}:i)}))}))}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&&or(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)),m`<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=_r(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=Jt(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=>Pr(n,e,t)),editDevice:(e,t)=>this.applyEdit(n=>Hr(n,e,t)),turnFurniture:(e,t)=>this.applyEdit(n=>Pr(n,e,o=>o.rotation=gi(o.rotation,t))),turnDevice:(e,t)=>this.applyEdit(n=>Hr(n,e,o=>o.rotation=gi(o.rotation??0,t))),removeFurniture:e=>{this.applyEdit(t=>Oc(t,e)),this._selFurniture=null},removeDevice:e=>{this.applyEdit(t=>Lc(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(o=>({...o,rooms:o.rooms.map(i=>i.id===e?{...i,moods:t.length?t:void 0}:i)}))}))}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&&or(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)),m`<div class="nf-app ${t?"nf-clean":""}" style=${this._prefs.accent?`--nf-accent:${this._prefs.accent}`:""}>
${t?f:m`${this.renderHeader(e)}${this.renderNotices()}`}
${this.data.error&&!e?m`<p class="nf-message">${this.t("load_error")}: ${this.data.error}</p>`:f}
${!e&&!this.data.error?m`<p class="nf-message">${this.t("loading")}</p>`:f}
@@ -3996,7 +3996,7 @@ A plugin runs with the same rights as NextFloor in your browser. The file has be
${t.clean?f:this.renderOverlay(e)}
${this._furnish?jc(this.furnishHost,this._selFurniture,this._selDevice):f}
</div>
`}static styles=[$e,Ue,Jc,gr]};customElements.get("nextfloor-panel")||customElements.define("nextfloor-panel",wi);var Cm=/^(\d{1,2}):(\d{2})\s*-\s*(\d{1,2}):(\d{2})$/,eu=(r,e)=>Number(r)*60+Number(e);function Sn(r,e,t=new Date){if(!r||r==="off")return!1;if(r==="sun")return e?.states["sun.sun"]?.state==="below_horizon";let n=Cm.exec(r.trim());if(!n)return!1;let o=eu(n[1],n[2]),i=eu(n[3],n[4]),s=t.getHours()*60+t.getMinutes();return o>i?s>=o||s<i:s>=o&&s<i}var Nr=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(Sn(this.host.config()?.night,this.host.hass())),6e4)}stop(){clearTimeout(this.cleanTimer),clearTimeout(this.idleTimer),clearInterval(this.nightTimer)}};function tu(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 nu=ne`
`}static styles=[$e,Ue,Jc,gr]};customElements.get("nextfloor-panel")||customElements.define("nextfloor-panel",vi);var Im=/^(\d{1,2}):(\d{2})\s*-\s*(\d{1,2}):(\d{2})$/,eu=(r,e)=>Number(r)*60+Number(e);function Sn(r,e,t=new Date){if(!r||r==="off")return!1;if(r==="sun")return e?.states["sun.sun"]?.state==="below_horizon";let n=Im.exec(r.trim());if(!n)return!1;let o=eu(n[1],n[2]),i=eu(n[3],n[4]),s=t.getHours()*60+t.getMinutes();return o>i?s>=o||s<i:s>=o&&s<i}var Nr=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(Sn(this.host.config()?.night,this.host.hass())),6e4)}stop(){clearTimeout(this.cleanTimer),clearTimeout(this.idleTimer),clearInterval(this.nightTimer)}};function tu(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 nu=ne`
ha-card {
overflow: hidden;
background: var(--nf-bg);
@@ -4120,7 +4120,7 @@ A plugin runs with the same rights as NextFloor in your browser. The file has be
justify-content: flex-end;
}
}
`;function yi(r,e){let t=r.template,n=t?e?.[t]:void 0;if(!n)return r;let{type:o,template:i,...s}=n;return{...s,...r}}function ru(r,e){let t=new Set(e),n=[];for(let i of r.floors){let s=i.rooms.filter(c=>t.has(c.id));if(!s.length)continue;let a=(c,u)=>s.some(h=>h.points.length>=3&&H([c,u],h.points)),l=new Set(s.map(c=>c.id));n.push({...i,rooms:s,openings:i.openings.filter(c=>l.has(c.room_id)),furniture:i.furniture.filter(c=>a(c.x,c.z)),placements:i.placements.filter(c=>a(c.x,c.z)),walls:(i.walls??[]).filter(c=>a((c.a[0]+c.b[0])/2,(c.a[1]+c.b[1])/2)),outdoor:[]})}let o={...r.settings.roof,type:"none",sections:[],solar:[]};return{...r,floors:n,settings:{...r.settings,roof:o}}}var Ct="nf-outside",xi=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}};_own=null;templatesSeen;roomApplied=!1;data=new wt(this);kiosk=new Nr({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}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 Rn(),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._own=e,this._config=yi(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=Sn(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=yi(this._own,t)),this.toggleAttribute("readable",this._config?.readable===!0),e.has("hass")&&(this.style.colorScheme=_r(this.hass)),!e.has("hass")||!this.hass)return;this.data.setHass(this.hass);let n=Sn(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:ru(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,o=e&&e.floors.length===1?e.floors[0].id:e?.floors.some(a=>a.id===n)?n:null,i=!!this._roomId&&t?.room_panel!==!1,s=!!this._roomId&&t?.room_panel===!1||!this.thumbs&&this.canSwitch&&!this._roomId&&!!o&&(e?.floors.length??0)>1;return{floorId:o,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&&!i)}}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,o=["temperature","humidity","co2"].filter(s=>this.shows(s)),i=(s,a)=>m`<div class="nf-seg" role=${s?"group":f} aria-label=${s??f}>${a.map(([l,c,u])=>m`<button aria-pressed=${l} @click=${c}>${u}</button>`)}</div>`;return m`<div class="nf-card-controls">
`;function wi(r,e){let t=r.template,n=t?e?.[t]:void 0;if(!n)return r;let{type:o,template:i,...s}=n;return{...s,...r}}function ru(r,e){let t=new Set(e),n=[];for(let i of r.floors){let s=i.rooms.filter(c=>t.has(c.id));if(!s.length)continue;let a=(c,u)=>s.some(h=>h.points.length>=3&&H([c,u],h.points)),l=new Set(s.map(c=>c.id));n.push({...i,rooms:s,openings:i.openings.filter(c=>l.has(c.room_id)),furniture:i.furniture.filter(c=>a(c.x,c.z)),placements:i.placements.filter(c=>a(c.x,c.z)),walls:(i.walls??[]).filter(c=>a((c.a[0]+c.b[0])/2,(c.a[1]+c.b[1])/2)),outdoor:[]})}let o={...r.settings.roof,type:"none",sections:[],solar:[]};return{...r,floors:n,settings:{...r.settings,roof:o}}}var Ct="nf-outside",yi=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}};_own=null;templatesSeen;roomApplied=!1;data=new wt(this);kiosk=new Nr({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}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 Rn(),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._own=e,this._config=wi(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=Sn(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=wi(this._own,t)),this.toggleAttribute("readable",this._config?.readable===!0),e.has("hass")&&(this.style.colorScheme=_r(this.hass)),!e.has("hass")||!this.hass)return;this.data.setHass(this.hass);let n=Sn(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:ru(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,o=e&&e.floors.length===1?e.floors[0].id:e?.floors.some(a=>a.id===n)?n:null,i=!!this._roomId&&t?.room_panel!==!1,s=!!this._roomId&&t?.room_panel===!1||!this.thumbs&&this.canSwitch&&!this._roomId&&!!o&&(e?.floors.length??0)>1;return{floorId:o,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&&!i)}}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,o=["temperature","humidity","co2"].filter(s=>this.shows(s)),i=(s,a)=>m`<div class="nf-seg" role=${s?"group":f} aria-label=${s??f}>${a.map(([l,c,u])=>m`<button aria-pressed=${l} @click=${c}>${u}</button>`)}</div>`;return m`<div class="nf-card-controls">
${e.canGoBack?m`<button class="nf-chip" @click=${()=>this.back()}>${n("back")}</button>`:f}
${this.shows("walls")?i(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?i(void 0,[[e.explode,()=>this._explode=!0,n("floors_apart")],[!e.explode,()=>this._explode=!1,n("floors_stacked")]]):f}
@@ -4214,7 +4214,7 @@ A plugin runs with the same rights as NextFloor in your browser. The file has be
${n.showBar&&e?this.renderBar(n):f}
${this.renderCorners()}
</div>
</ha-card>`}static styles=[$e,Ue,nu,gr]};if(!customElements.get("nextfloor-card")){customElements.define("nextfloor-card",xi);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})}ro();
</ha-card>`}static styles=[$e,Ue,nu,gr]};if(!customElements.get("nextfloor-card")){customElements.define("nextfloor-card",yi);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})}ro();
/*! Bundled license information:
@lit/reactive-element/css-tag.js: