fix: bound Symcon API responses below the kernel output limit
This commit is contained in:
1 parent
1a78cde02d
commit
03e9eaa355
5 files changed
+299
-94
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 */
|
/*! NextFloor, MIT licence. Includes three.js (MIT) and Lit (BSD-3-Clause); see LICENSE and THIRD_PARTY_NOTICES.md */
|
||||||
var S={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 yn=globalThis,xn=yn.ShadowRoot&&(yn.ShadyCSS===void 0||yn.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,Hr=Symbol(),wi=new WeakMap,Pt=class{constructor(e,t,n){if(this._$cssResult$=!0,n!==Hr)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(xn&&e===void 0){let n=t!==void 0&&t.length===1;n&&(e=wi.get(t)),e===void 0&&((this.o=e=new CSSStyleSheet).replaceSync(this.cssText),n&&wi.set(t,e))}return e}toString(){return this.cssText}},vi=r=>new Pt(typeof r=="string"?r:r+"",void 0,Hr),te=(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 Pt(t,r,Hr)},yi=(r,e)=>{if(xn)r.adoptedStyleSheets=e.map(t=>t instanceof CSSStyleSheet?t:t.styleSheet);else for(let t of e){let n=document.createElement("style"),o=yn.litNonce;o!==void 0&&n.setAttribute("nonce",o),n.textContent=t.cssText,r.appendChild(n)}},Ir=xn?r=>r:r=>r instanceof CSSStyleSheet?(e=>{let t="";for(let n of e.cssRules)t+=n.cssText;return vi(t)})(r):r;var{is:Zc,defineProperty:Yc,getOwnPropertyDescriptor:Jc,getOwnPropertyNames:Qc,getOwnPropertySymbols:Xc,getPrototypeOf:eu}=Object,kn=globalThis,xi=kn.trustedTypes,tu=xi?xi.emptyScript:"",nu=kn.reactiveElementPolyfillSupport,Ht=(r,e)=>r,Cr={toAttribute(r,e){switch(e){case Boolean:r=r?tu: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}},Si=(r,e)=>!Zc(r,e),ki={attribute:!0,type:String,converter:Cr,reflect:!1,useDefault:!1,hasChanged:Si};Symbol.metadata??=Symbol("metadata"),kn.litPropertyMetadata??=new WeakMap;var $e=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=ki){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&&Yc(this.prototype,e,o)}}static getPropertyDescriptor(e,t,n){let{get:o,set:i}=Jc(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)??ki}static _$Ei(){if(this.hasOwnProperty(Ht("elementProperties")))return;let e=eu(this);e.finalize(),e.l!==void 0&&(this.l=[...e.l]),this.elementProperties=new Map(e.elementProperties)}static finalize(){if(this.hasOwnProperty(Ht("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(Ht("properties"))){let t=this.properties,n=[...Qc(t),...Xc(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(Ir(o))}else e!==void 0&&t.push(Ir(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
|
var S={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 xn=globalThis,kn=xn.ShadowRoot&&(xn.ShadyCSS===void 0||xn.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,Hr=Symbol(),vi=new WeakMap,Pt=class{constructor(e,t,n){if(this._$cssResult$=!0,n!==Hr)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(kn&&e===void 0){let n=t!==void 0&&t.length===1;n&&(e=vi.get(t)),e===void 0&&((this.o=e=new CSSStyleSheet).replaceSync(this.cssText),n&&vi.set(t,e))}return e}toString(){return this.cssText}},yi=r=>new Pt(typeof r=="string"?r:r+"",void 0,Hr),te=(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 Pt(t,r,Hr)},xi=(r,e)=>{if(kn)r.adoptedStyleSheets=e.map(t=>t instanceof CSSStyleSheet?t:t.styleSheet);else for(let t of e){let n=document.createElement("style"),o=xn.litNonce;o!==void 0&&n.setAttribute("nonce",o),n.textContent=t.cssText,r.appendChild(n)}},Ir=kn?r=>r:r=>r instanceof CSSStyleSheet?(e=>{let t="";for(let n of e.cssRules)t+=n.cssText;return yi(t)})(r):r;var{is:Yc,defineProperty:Jc,getOwnPropertyDescriptor:Qc,getOwnPropertyNames:Xc,getOwnPropertySymbols:eu,getPrototypeOf:tu}=Object,Sn=globalThis,ki=Sn.trustedTypes,nu=ki?ki.emptyScript:"",ru=Sn.reactiveElementPolyfillSupport,Ht=(r,e)=>r,Cr={toAttribute(r,e){switch(e){case Boolean:r=r?nu: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}},Mi=(r,e)=>!Yc(r,e),Si={attribute:!0,type:String,converter:Cr,reflect:!1,useDefault:!1,hasChanged:Mi};Symbol.metadata??=Symbol("metadata"),Sn.litPropertyMetadata??=new WeakMap;var $e=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=Si){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&&Jc(this.prototype,e,o)}}static getPropertyDescriptor(e,t,n){let{get:o,set:i}=Qc(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)??Si}static _$Ei(){if(this.hasOwnProperty(Ht("elementProperties")))return;let e=tu(this);e.finalize(),e.l!==void 0&&(this.l=[...e.l]),this.elementProperties=new Map(e.elementProperties)}static finalize(){if(this.hasOwnProperty(Ht("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(Ht("properties"))){let t=this.properties,n=[...Xc(t),...eu(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(Ir(o))}else e!==void 0&&t.push(Ir(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]`,It=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,Ai=/-->/g,Ei=/>/g,qe=RegExp(`>|${Nr}(?:([^\\s"'>=/]+)(${Nr}*=${Nr}*(?:[^
|
\f\r]`,It=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,Ei=/-->/g,Ri=/>/g,qe=RegExp(`>|${Nr}(?:([^\\s"'>=/]+)(${Nr}*=${Nr}*(?:[^
|
||||||
\f\r"'\`<>=]|("|')|))|$)`,"g"),Ri=/'/g,zi=/"/g,Pi=/^(?:script|style|textarea|title)$/i,Ur=r=>(e,...t)=>({_$litType$:r,strings:e,values:t}),m=Ur(1),J=Ur(2),Hm=Ur(3),Je=Symbol.for("lit-noChange"),f=Symbol.for("lit-nothing"),Ti=new WeakMap,Ze=Ye.createTreeWalker(Ye,129);function Hi(r,e){if(!Gr(r)||!r.hasOwnProperty("raw"))throw Error("invalid template strings array");return $i!==void 0?$i.createHTML(e):e}var iu=(r,e)=>{let t=r.length-1,n=[],o,i=e===2?"<svg>":e===3?"<math>":"",s=It;for(let a=0;a<t;a++){let l=r[a],c,u,d=-1,p=0;for(;p<l.length&&(s.lastIndex=p,u=s.exec(l),u!==null);)p=s.lastIndex,s===It?u[1]==="!--"?s=Ai:u[1]!==void 0?s=Ei:u[2]!==void 0?(Pi.test(u[2])&&(o=RegExp("</"+u[2],"g")),s=qe):u[3]!==void 0&&(s=qe):s===qe?u[0]===">"?(s=o??It,d=-1):u[1]===void 0?d=-2:(d=s.lastIndex-u[2].length,c=u[1],s=u[3]===void 0?qe:u[3]==='"'?zi:Ri):s===zi||s===Ri?s=qe:s===Ai||s===Ei?s=It:(s=qe,o=void 0);let h=s===qe&&r[a+1].startsWith("/>")?" ":"";i+=s===It?l+ru:d>=0?(n.push(c),l.slice(0,d)+Fi+l.slice(d)+Oe+h):l+Oe+(d===-2?a:h)}return[Hi(r,i+(r[t]||"<?>")+(e===2?"</svg>":e===3?"</math>":"")),n]},Ot=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]=iu(e,t);if(this.el=r.createElement(c,n),Ze.currentNode=this.el.content,t===2||t===3){let d=this.el.content.firstChild;d.replaceWith(...d.childNodes)}for(;(o=Ze.nextNode())!==null&&l.length<a;){if(o.nodeType===1){if(o.hasAttributes())for(let d of o.getAttributeNames())if(d.endsWith(Fi)){let p=u[s++],h=o.getAttribute(d).split(Oe),w=/([.?@])?(.*)/.exec(p);l.push({type:1,index:i,name:w[2],strings:h,ctor:w[1]==="."?Wr:w[1]==="?"?Lr:w[1]==="@"?Br:ut}),o.removeAttribute(d)}else d.startsWith(Oe)&&(l.push({type:6,index:i}),o.removeAttribute(d));if(Pi.test(o.tagName)){let d=o.textContent.split(Oe),p=d.length-1;if(p>0){o.textContent=Sn?Sn.emptyScript:"";for(let h=0;h<p;h++)o.append(d[h],Ct()),Ze.nextNode(),l.push({type:2,index:++i});o.append(d[p],Ct())}}}else if(o.nodeType===8)if(o.data===Di)l.push({type:2,index:i});else{let d=-1;for(;(d=o.data.indexOf(Oe,d+1))!==-1;)l.push({type:7,index:i}),d+=Oe.length-1}i++}}static createElement(e,t){let n=Ye.createElement("template");return n.innerHTML=e,n}};function ct(r,e,t=r,n){if(e===Je)return e;let o=n!==void 0?t._$Co?.[n]:t._$Cl,i=Nt(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=ct(r,o._$AS(r,e.values),o,n)),e}var Or=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??Ye).importNode(t,!0);Ze.currentNode=o;let i=Ze.nextNode(),s=0,a=0,l=n[0];for(;l!==void 0;){if(s===l.index){let c;l.type===2?c=new Wt(i,i.nextSibling,this,e):l.type===1?c=new l.ctor(i,l.name,l.strings,this,e):l.type===6&&(c=new Vr(i,this,e)),this._$AV.push(c),l=n[++a]}s!==l?.index&&(i=Ze.nextNode(),s++)}return Ze.currentNode=Ye,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++}},Wt=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=ct(this,e,t),Nt(e)?e===f||e==null||e===""?(this._$AH!==f&&this._$AR(),this._$AH=f):e!==this._$AH&&e!==Je&&this._(e):e._$litType$!==void 0?this.$(e):e.nodeType!==void 0?this.T(e):ou(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&&Nt(this._$AH)?this._$AA.nextSibling.data=e:this.T(Ye.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=Ot.createElement(Hi(n.h,n.h[0]),this.options)),n);if(this._$AH?._$AD===o)this._$AH.p(t);else{let i=new Or(o,this),s=i.u(this.options);i.p(t),this.T(s),this._$AH=i}}_$AC(e){let t=Ti.get(e.strings);return t===void 0&&Ti.set(e.strings,t=new Ot(e)),t}k(e){Gr(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(Ct()),this.O(Ct()),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=Mi(e).nextSibling;Mi(e).remove(),e=n}}setConnected(e){this._$AM===void 0&&(this._$Cv=e,this._$AP?.(e))}},ut=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
|
\f\r"'\`<>=]|("|')|))|$)`,"g"),zi=/'/g,Ti=/"/g,Hi=/^(?:script|style|textarea|title)$/i,Ur=r=>(e,...t)=>({_$litType$:r,strings:e,values:t}),m=Ur(1),J=Ur(2),Cm=Ur(3),Je=Symbol.for("lit-noChange"),f=Symbol.for("lit-nothing"),Fi=new WeakMap,Ze=Ye.createTreeWalker(Ye,129);function Ii(r,e){if(!Gr(r)||!r.hasOwnProperty("raw"))throw Error("invalid template strings array");return Ai!==void 0?Ai.createHTML(e):e}var su=(r,e)=>{let t=r.length-1,n=[],o,i=e===2?"<svg>":e===3?"<math>":"",s=It;for(let a=0;a<t;a++){let l=r[a],c,u,d=-1,p=0;for(;p<l.length&&(s.lastIndex=p,u=s.exec(l),u!==null);)p=s.lastIndex,s===It?u[1]==="!--"?s=Ei:u[1]!==void 0?s=Ri:u[2]!==void 0?(Hi.test(u[2])&&(o=RegExp("</"+u[2],"g")),s=qe):u[3]!==void 0&&(s=qe):s===qe?u[0]===">"?(s=o??It,d=-1):u[1]===void 0?d=-2:(d=s.lastIndex-u[2].length,c=u[1],s=u[3]===void 0?qe:u[3]==='"'?Ti:zi):s===Ti||s===zi?s=qe:s===Ei||s===Ri?s=It:(s=qe,o=void 0);let h=s===qe&&r[a+1].startsWith("/>")?" ":"";i+=s===It?l+ou:d>=0?(n.push(c),l.slice(0,d)+Di+l.slice(d)+Oe+h):l+Oe+(d===-2?a:h)}return[Ii(r,i+(r[t]||"<?>")+(e===2?"</svg>":e===3?"</math>":"")),n]},Ot=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]=su(e,t);if(this.el=r.createElement(c,n),Ze.currentNode=this.el.content,t===2||t===3){let d=this.el.content.firstChild;d.replaceWith(...d.childNodes)}for(;(o=Ze.nextNode())!==null&&l.length<a;){if(o.nodeType===1){if(o.hasAttributes())for(let d of o.getAttributeNames())if(d.endsWith(Di)){let p=u[s++],h=o.getAttribute(d).split(Oe),w=/([.?@])?(.*)/.exec(p);l.push({type:1,index:i,name:w[2],strings:h,ctor:w[1]==="."?Wr:w[1]==="?"?Lr:w[1]==="@"?Br:ut}),o.removeAttribute(d)}else d.startsWith(Oe)&&(l.push({type:6,index:i}),o.removeAttribute(d));if(Hi.test(o.tagName)){let d=o.textContent.split(Oe),p=d.length-1;if(p>0){o.textContent=Mn?Mn.emptyScript:"";for(let h=0;h<p;h++)o.append(d[h],Ct()),Ze.nextNode(),l.push({type:2,index:++i});o.append(d[p],Ct())}}}else if(o.nodeType===8)if(o.data===Pi)l.push({type:2,index:i});else{let d=-1;for(;(d=o.data.indexOf(Oe,d+1))!==-1;)l.push({type:7,index:i}),d+=Oe.length-1}i++}}static createElement(e,t){let n=Ye.createElement("template");return n.innerHTML=e,n}};function ct(r,e,t=r,n){if(e===Je)return e;let o=n!==void 0?t._$Co?.[n]:t._$Cl,i=Nt(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=ct(r,o._$AS(r,e.values),o,n)),e}var Or=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??Ye).importNode(t,!0);Ze.currentNode=o;let i=Ze.nextNode(),s=0,a=0,l=n[0];for(;l!==void 0;){if(s===l.index){let c;l.type===2?c=new Wt(i,i.nextSibling,this,e):l.type===1?c=new l.ctor(i,l.name,l.strings,this,e):l.type===6&&(c=new Vr(i,this,e)),this._$AV.push(c),l=n[++a]}s!==l?.index&&(i=Ze.nextNode(),s++)}return Ze.currentNode=Ye,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++}},Wt=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=ct(this,e,t),Nt(e)?e===f||e==null||e===""?(this._$AH!==f&&this._$AR(),this._$AH=f):e!==this._$AH&&e!==Je&&this._(e):e._$litType$!==void 0?this.$(e):e.nodeType!==void 0?this.T(e):iu(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&&Nt(this._$AH)?this._$AA.nextSibling.data=e:this.T(Ye.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=Ot.createElement(Ii(n.h,n.h[0]),this.options)),n);if(this._$AH?._$AD===o)this._$AH.p(t);else{let i=new Or(o,this),s=i.u(this.options);i.p(t),this.T(s),this._$AH=i}}_$AC(e){let t=Fi.get(e.strings);return t===void 0&&Fi.set(e.strings,t=new Ot(e)),t}k(e){Gr(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(Ct()),this.O(Ct()),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=$i(e).nextSibling;$i(e).remove(),e=n}}setConnected(e){this._$AM===void 0&&(this._$Cv=e,this._$AP?.(e))}},ut=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:
|
Ein Plugin l\xE4uft mit denselben Rechten wie NextFloor in deinem Browser. Die Datei wurde gepr\xFCft, ihr Inhalt ist festgelegt:
|
||||||
{url}`,manual:"Anleitung",manual_more:"Mehr erfahren",feature_text_energy:"Energieteilchen fliegen in B\xF6gen von den Solarfeldern zum Wechselrichter, zwischen Haus, Akku, Netz und Verbrauchern \u2013 schneller und dichter, je mehr Strom flie\xDFt. Die Module funkeln mit ihrer Produktion, eine Glaskarte \xFCber dem Dach zeigt die Bilanz und wie autark das Haus gerade ist.",live_autarky:"autark",live_fold:"Karte verkleinern",live_unfold:"Karte aufklappen",live_day_hint:"Die letzten 24 Stunden: Solar (Fl\xE4che) und Verbrauch (Linie)",live_week_hint:"Die letzten 7 Tage: Sonne {solar} kWh, Verbrauch {use} kWh (gelb: Sonne, hell: Verbrauch)",live_days:"Tage",live_car_away:"Unterwegs",live_car_charging:"L\xE4dt",live_car_plugged:"Eingesteckt",live_car_lock:"Verriegeln",live_car_unlock:"Entriegeln",live_car_unlock_confirm:"{name} wirklich entriegeln?",live_car_climate:"Klimatisierung",live_car_charge:"Laden starten/stoppen",live_media_prev:"Zur\xFCck",live_media_playpause:"Abspielen/Pause",live_media_next:"Weiter",live_media_volume:"Lautst\xE4rke",live_car_device:"Auto (eine Entit\xE4t des Autos)",live_car_device_hint:"Ladestand, Reichweite, Laden, Stecker, Schloss und Klima findet NextFloor selbst am Ger\xE4t des Autos. Ohne Angabe nimmt es den Anwesenheitssensor des Stellplatzes.",live_car_departure_entity:"Abfahrtszeit (optional)",live_car_departure:"Abfahrt {time}",live_car_open:"Offen: {parts}",printer_printing:"druckt",printer_done:"fertig",printer_paused:"pausiert",printer_error:"Fehler",printer_idle:"bereit",printer_done_at:"fertig um {time}",printer_layer:"Schicht",printer_nozzle:"D\xFCse",printer_bed:"Bett",heatpump_heating:"heizt",heatpump_water:"macht Warmwasser",heatpump_cooling:"k\xFChlt",heatpump_defrost:"taut ab",heatpump_idle:"in Ruhe",heatpump_flow_return:"Vor- \u2192 R\xFCcklauf",heatpump_heat:"W\xE4rme",heatpump_power:"Strom",heatpump_outside:"au\xDFen",pack_missing_item:"M\xF6bel aus entferntem Pack",back_to_room:"Zur\xFCck zu {room}",back_to_floor:"Zur\xFCck zur Etage",hint_furniture:"Raum antippen, dann rechts ein M\xF6belst\xFCck w\xE4hlen \xB7 M\xF6bel ziehen, an den Ecken die Gr\xF6\xDFe \xE4ndern",furniture_into:"Neue M\xF6bel kommen in die Mitte von \u201E{room}\u201C.",furniture_pick_room:"Tipp: Erst einen Raum antippen \u2013 dann landen neue M\xF6bel in seiner Mitte.",flows:"Stromfluss",flows_hint:"Energieb\xF6gen zwischen Solarfeldern, Wechselrichter, Akku, Netz und Verbrauchern ein- oder ausblenden",chk_title:"Einrichtung",chk_hint:"Was der Energiefluss braucht. Antippen springt an die Stelle.",chk_solar:"Solarfeld angelegt",chk_solar_add:"Ein Solarfeld aufs Dach legen",chk_meter:"Stromz\xE4hler mit Netzsensor",chk_meter_sensor:"Stromz\xE4hler: Netzsensor (W) fehlt",chk_meter_add:"Stromz\xE4hler anlegen",chk_inverter:"Wechselrichter mit Leistungssensor",chk_inverter_sensor:"Wechselrichter: Leistungssensor fehlt",chk_inverter_add:"Wechselrichter anlegen",chk_battery:"Stromspeicher mit Leistung und Ladestand",chk_battery_sensor:"Stromspeicher: Leistung oder Ladestand fehlt",chk_battery_opt:"Stromspeicher (optional)",chk_grid:"Netzanschluss gesetzt",chk_grid_opt:"Netzanschluss (optional, sonst automatisch)",energy_sign_grid:"Das Haus zeigt Einspeisung, obwohl die Sonne nichts liefert. Der Netzsensor hat wahrscheinlich das umgekehrte Vorzeichen.",energy_sign_battery:"Der Speicher l\xE4dt ohne Sonne und ohne Netzbezug. Sein Sensor hat wahrscheinlich das umgekehrte Vorzeichen.",energy_sign_flip:"Vorzeichen umkehren",help_title:"Hilfe und R\xFCckmeldung",help_hint:"Fehler bitte als Issue auf GitHub, W\xFCnsche als Diskussion \u2013 so geht nichts verloren, und alle sehen den Stand.",help_issue:"Problem melden",help_idea:"Idee vorschlagen",furn_name:"Name (optional)",furn_mirror:"Spiegeln",furn_mirror_hint:"Links und rechts vertauschen \u2013 das L-Sofa andersherum, der Schrank mit der T\xFCr auf der anderen Seite, die K\xFCchenzeile gespiegelt.",hint_opening:"Auf eine Wand tippen, um eine T\xFCr oder ein Fenster einzusetzen \u2013 die Art w\xE4hlst du danach rechts",preset_door:"T\xFCr",preset_door_double:"Doppelt\xFCr",preset_window:"Fenster",preset_window_double:"Fenster 2-fl\xFCgelig",preset_terrace:"Terrassent\xFCr",preset_terrace_double:"Terrassent\xFCr 2-fl\xFCgelig",preset_lift_slide:"Hebe-Schiebet\xFCr",preset_garage:"Garagentor",preset_front:"Haust\xFCr",opening_style:"Stil",sidelight_auto:"automatisch",sidelight_hinge:"Seitenteil an der Anschlagseite",sidelight_hinge_hint:"Das Seitenteil sitzt sonst gegen\xFCber dem Anschlag; mit Haken neben den B\xE4ndern.",sidelight_width:"Breite Seitenteil (m)",sidelight_width_left:"Seitenteil links (m)",sidelight_width_right:"Seitenteil rechts (m)",style_auto:"Automatisch ({style})",style_interior:"Zimmert\xFCr",style_front:"Haust\xFCr",style_front_glass:"Haust\xFCr mit Glasausschnitt",style_sidelight:"Haust\xFCr mit Seitenteil",style_sidelights:"Haust\xFCr mit 2 Seitenteilen",style_glass:"Glast\xFCr",style_sliding:"Schiebet\xFCr",style_p
Line truncated
|
{url}`,manual:"Anleitung",manual_more:"Mehr erfahren",feature_text_energy:"Energieteilchen fliegen in B\xF6gen von den Solarfeldern zum Wechselrichter, zwischen Haus, Akku, Netz und Verbrauchern \u2013 schneller und dichter, je mehr Strom flie\xDFt. Die Module funkeln mit ihrer Produktion, eine Glaskarte \xFCber dem Dach zeigt die Bilanz und wie autark das Haus gerade ist.",live_autarky:"autark",live_fold:"Karte verkleinern",live_unfold:"Karte aufklappen",live_day_hint:"Die letzten 24 Stunden: Solar (Fl\xE4che) und Verbrauch (Linie)",live_week_hint:"Die letzten 7 Tage: Sonne {solar} kWh, Verbrauch {use} kWh (gelb: Sonne, hell: Verbrauch)",live_days:"Tage",live_car_away:"Unterwegs",live_car_charging:"L\xE4dt",live_car_plugged:"Eingesteckt",live_car_lock:"Verriegeln",live_car_unlock:"Entriegeln",live_car_unlock_confirm:"{name} wirklich entriegeln?",live_car_climate:"Klimatisierung",live_car_charge:"Laden starten/stoppen",live_media_prev:"Zur\xFCck",live_media_playpause:"Abspielen/Pause",live_media_next:"Weiter",live_media_volume:"Lautst\xE4rke",live_car_device:"Auto (eine Entit\xE4t des Autos)",live_car_device_hint:"Ladestand, Reichweite, Laden, Stecker, Schloss und Klima findet NextFloor selbst am Ger\xE4t des Autos. Ohne Angabe nimmt es den Anwesenheitssensor des Stellplatzes.",live_car_departure_entity:"Abfahrtszeit (optional)",live_car_departure:"Abfahrt {time}",live_car_open:"Offen: {parts}",printer_printing:"druckt",printer_done:"fertig",printer_paused:"pausiert",printer_error:"Fehler",printer_idle:"bereit",printer_done_at:"fertig um {time}",printer_layer:"Schicht",printer_nozzle:"D\xFCse",printer_bed:"Bett",heatpump_heating:"heizt",heatpump_water:"macht Warmwasser",heatpump_cooling:"k\xFChlt",heatpump_defrost:"taut ab",heatpump_idle:"in Ruhe",heatpump_flow_return:"Vor- \u2192 R\xFCcklauf",heatpump_heat:"W\xE4rme",heatpump_power:"Strom",heatpump_outside:"au\xDFen",pack_missing_item:"M\xF6bel aus entferntem Pack",back_to_room:"Zur\xFCck zu {room}",back_to_floor:"Zur\xFCck zur Etage",hint_furniture:"Raum antippen, dann rechts ein M\xF6belst\xFCck w\xE4hlen \xB7 M\xF6bel ziehen, an den Ecken die Gr\xF6\xDFe \xE4ndern",furniture_into:"Neue M\xF6bel kommen in die Mitte von \u201E{room}\u201C.",furniture_pick_room:"Tipp: Erst einen Raum antippen \u2013 dann landen neue M\xF6bel in seiner Mitte.",flows:"Stromfluss",flows_hint:"Energieb\xF6gen zwischen Solarfeldern, Wechselrichter, Akku, Netz und Verbrauchern ein- oder ausblenden",chk_title:"Einrichtung",chk_hint:"Was der Energiefluss braucht. Antippen springt an die Stelle.",chk_solar:"Solarfeld angelegt",chk_solar_add:"Ein Solarfeld aufs Dach legen",chk_meter:"Stromz\xE4hler mit Netzsensor",chk_meter_sensor:"Stromz\xE4hler: Netzsensor (W) fehlt",chk_meter_add:"Stromz\xE4hler anlegen",chk_inverter:"Wechselrichter mit Leistungssensor",chk_inverter_sensor:"Wechselrichter: Leistungssensor fehlt",chk_inverter_add:"Wechselrichter anlegen",chk_battery:"Stromspeicher mit Leistung und Ladestand",chk_battery_sensor:"Stromspeicher: Leistung oder Ladestand fehlt",chk_battery_opt:"Stromspeicher (optional)",chk_grid:"Netzanschluss gesetzt",chk_grid_opt:"Netzanschluss (optional, sonst automatisch)",energy_sign_grid:"Das Haus zeigt Einspeisung, obwohl die Sonne nichts liefert. Der Netzsensor hat wahrscheinlich das umgekehrte Vorzeichen.",energy_sign_battery:"Der Speicher l\xE4dt ohne Sonne und ohne Netzbezug. Sein Sensor hat wahrscheinlich das umgekehrte Vorzeichen.",energy_sign_flip:"Vorzeichen umkehren",help_title:"Hilfe und R\xFCckmeldung",help_hint:"Fehler bitte als Issue auf GitHub, W\xFCnsche als Diskussion \u2013 so geht nichts verloren, und alle sehen den Stand.",help_issue:"Problem melden",help_idea:"Idee vorschlagen",furn_name:"Name (optional)",furn_mirror:"Spiegeln",furn_mirror_hint:"Links und rechts vertauschen \u2013 das L-Sofa andersherum, der Schrank mit der T\xFCr auf der anderen Seite, die K\xFCchenzeile gespiegelt.",hint_opening:"Auf eine Wand tippen, um eine T\xFCr oder ein Fenster einzusetzen \u2013 die Art w\xE4hlst du danach rechts",preset_door:"T\xFCr",preset_door_double:"Doppelt\xFCr",preset_window:"Fenster",preset_window_double:"Fenster 2-fl\xFCgelig",preset_terrace:"Terrassent\xFCr",preset_terrace_double:"Terrassent\xFCr 2-fl\xFCgelig",preset_lift_slide:"Hebe-Schiebet\xFCr",preset_garage:"Garagentor",preset_front:"Haust\xFCr",opening_style:"Stil",sidelight_auto:"automatisch",sidelight_hinge:"Seitenteil an der Anschlagseite",sidelight_hinge_hint:"Das Seitenteil sitzt sonst gegen\xFCber dem Anschlag; mit Haken neben den B\xE4ndern.",sidelight_width:"Breite Seitenteil (m)",sidelight_width_left:"Seitenteil links (m)",sidelight_width_right:"Seitenteil rechts (m)",style_auto:"Automatisch ({style})",style_interior:"Zimmert\xFCr",style_front:"Haust\xFCr",style_front_glass:"Haust\xFCr mit Glasausschnitt",style_sidelight:"Haust\xFCr mit Seitenteil",style_sidelights:"Haust\xFCr mit 2 Seitenteilen",style_glass:"Glast\xFCr",style_sliding:"Schiebet\xFCr",style_p
Line truncated
|
||||||
|
|
||||||
A plugin runs with the same rights as NextFloor in your browser. The file has been reviewed and its content is fixed:
|
A plugin runs with the same rights as NextFloor in your browser. The file has been reviewed and its content is fixed:
|
||||||
{url}`,manual:"Manual",manual_more:"Learn more",feature_text_energy:"Energy particles fly in arcs from the solar fields to the inverter, between house, battery, grid and consumers \u2013 faster and denser the more power flows. The modules sparkle with their production, a glass card over the roof shows the balance and how self-sufficient the house is right now.",live_autarky:"self-sufficient",live_fold:"Make the card small",live_unfold:"Open the card",live_day_hint:"The last 24 hours: solar (area) and consumption (line)",live_week_hint:"The last 7 days: sun {solar} kWh, use {use} kWh (yellow: sun, light: use)",live_days:"days",live_car_away:"On the road",live_car_charging:"Charging",live_car_plugged:"Plugged in",live_car_lock:"Lock",live_car_unlock:"Unlock",live_car_unlock_confirm:"Really unlock {name}?",live_car_climate:"Climate",live_car_charge:"Start/stop charging",live_media_prev:"Previous",live_media_playpause:"Play/pause",live_media_next:"Next",live_media_volume:"Volume",live_car_device:"Car (any entity of the car)",live_car_device_hint:"Charge, range, charging, plug, lock and climate are found by NextFloor on the car's device. Without one it takes the spot's presence sensor.",live_car_departure_entity:"Departure time (optional)",live_car_departure:"Departs {time}",live_car_open:"Open: {parts}",printer_printing:"printing",printer_done:"done",printer_paused:"paused",printer_error:"error",printer_idle:"idle",printer_done_at:"done at {time}",printer_layer:"Layer",printer_nozzle:"Nozzle",printer_bed:"Bed",heatpump_heating:"heating",heatpump_water:"making hot water",heatpump_cooling:"cooling",heatpump_defrost:"defrosting",heatpump_idle:"resting",heatpump_flow_return:"Flow \u2192 return",heatpump_heat:"Heat",heatpump_power:"Power",heatpump_outside:"outside",pack_missing_item:"Furniture of a removed pack",back_to_room:"Back to {room}",back_to_floor:"Back to the floor",hint_furniture:"Tap a room, then pick an item on the right \xB7 drag items, resize them by their corners",furniture_into:"New items go into the middle of \u201C{room}\u201D.",furniture_pick_room:"Tip: tap a room first \u2013 new items then land in its middle.",flows:"Power flow",flows_hint:"Show or hide the energy arcs between solar fields, inverter, battery, grid and consumers",chk_title:"Setup",chk_hint:"What the energy flow needs. Tap a row to jump there.",chk_solar:"Solar field in place",chk_solar_add:"Put a solar field on the roof",chk_meter:"Meter with grid sensor",chk_meter_sensor:"Meter: grid sensor (W) missing",chk_meter_add:"Add the meter",chk_inverter:"Inverter with power sensor",chk_inverter_sensor:"Inverter: power sensor missing",chk_inverter_add:"Add an inverter",chk_battery:"Home battery with power and charge",chk_battery_sensor:"Home battery: power or charge missing",chk_battery_opt:"Home battery (optional)",chk_grid:"Grid connection set",chk_grid_opt:"Grid connection (optional, else automatic)",energy_sign_grid:"The house shows export while the sun produces nothing. The grid sensor probably has its sign reversed.",energy_sign_battery:"The battery charges with no sun and no grid draw. Its sensor probably has its sign reversed.",energy_sign_flip:"Flip the sign",help_title:"Help and feedback",help_hint:"Please report problems as a GitHub issue and wishes as a discussion \u2013 nothing gets lost, and everyone sees the state.",help_issue:"Report a problem",help_idea:"Propose an idea",furn_name:"Name (optional)",furn_mirror:"Mirror",furn_mirror_hint:"Swap left and right \u2013 the L-sofa the other way round, the cabinet with its door on the other side, the kitchen run mirrored.",hint_opening:"Tap a wall to add a door or window \u2013 choose its kind on the right afterwards",preset_door:"Door",preset_door_double:"Double door",preset_window:"Window",preset_window_double:"Double window",preset_terrace:"Terrace door",preset_terrace_double:"French doors",preset_lift_slide:"Lift-and-slide door",preset_garage:"Garage door",preset_front:"Front door",opening_style:"Style",sidelight_auto:"automatic",sidelight_hinge:"Sidelight on the hinge side",sidelight_hinge_hint:"The sidelight sits opposite the hinge otherwise; ticked, it sits next to the hinges.",sidelight_width:"Sidelight width (m)",sidelight_width_left:"Left sidelight (m)",sidelight_width_right:"Right sidelight (m)",style_auto:"Automatic ({style})",style_interior:"Room door",style_front:"Front door",style_front_glass:"Front door with glass",style_sidelight:"Front door with sidelight",style_sidelights:"Front door with two sidelights",style_glass:"Glass door",style_sliding:"Sliding door",style_passage:"Opening (no door)",style_standard:"Standard",style_bars:"With glazing bars",style_glass_wall:"Glass wall (fixed)",preset_glass_wall:"Glass wall",glass_panes:"Panes",glass_panes_auto:"automatic (about 0.9 m)",glass_panes_hint:"0 = one single pane without mullions, empty = about every 0.9 m",flip_hinge:"Swap hinge side",flip_main_leaf:"Swap main leaf",flip_hinge_hint:"Hinges to the other side"
Line truncated
|
{url}`,manual:"Manual",manual_more:"Learn more",feature_text_energy:"Energy particles fly in arcs from the solar fields to the inverter, between house, battery, grid and consumers \u2013 faster and denser the more power flows. The modules sparkle with their production, a glass card over the roof shows the balance and how self-sufficient the house is right now.",live_autarky:"self-sufficient",live_fold:"Make the card small",live_unfold:"Open the card",live_day_hint:"The last 24 hours: solar (area) and consumption (line)",live_week_hint:"The last 7 days: sun {solar} kWh, use {use} kWh (yellow: sun, light: use)",live_days:"days",live_car_away:"On the road",live_car_charging:"Charging",live_car_plugged:"Plugged in",live_car_lock:"Lock",live_car_unlock:"Unlock",live_car_unlock_confirm:"Really unlock {name}?",live_car_climate:"Climate",live_car_charge:"Start/stop charging",live_media_prev:"Previous",live_media_playpause:"Play/pause",live_media_next:"Next",live_media_volume:"Volume",live_car_device:"Car (any entity of the car)",live_car_device_hint:"Charge, range, charging, plug, lock and climate are found by NextFloor on the car's device. Without one it takes the spot's presence sensor.",live_car_departure_entity:"Departure time (optional)",live_car_departure:"Departs {time}",live_car_open:"Open: {parts}",printer_printing:"printing",printer_done:"done",printer_paused:"paused",printer_error:"error",printer_idle:"idle",printer_done_at:"done at {time}",printer_layer:"Layer",printer_nozzle:"Nozzle",printer_bed:"Bed",heatpump_heating:"heating",heatpump_water:"making hot water",heatpump_cooling:"cooling",heatpump_defrost:"defrosting",heatpump_idle:"resting",heatpump_flow_return:"Flow \u2192 return",heatpump_heat:"Heat",heatpump_power:"Power",heatpump_outside:"outside",pack_missing_item:"Furniture of a removed pack",back_to_room:"Back to {room}",back_to_floor:"Back to the floor",hint_furniture:"Tap a room, then pick an item on the right \xB7 drag items, resize them by their corners",furniture_into:"New items go into the middle of \u201C{room}\u201D.",furniture_pick_room:"Tip: tap a room first \u2013 new items then land in its middle.",flows:"Power flow",flows_hint:"Show or hide the energy arcs between solar fields, inverter, battery, grid and consumers",chk_title:"Setup",chk_hint:"What the energy flow needs. Tap a row to jump there.",chk_solar:"Solar field in place",chk_solar_add:"Put a solar field on the roof",chk_meter:"Meter with grid sensor",chk_meter_sensor:"Meter: grid sensor (W) missing",chk_meter_add:"Add the meter",chk_inverter:"Inverter with power sensor",chk_inverter_sensor:"Inverter: power sensor missing",chk_inverter_add:"Add an inverter",chk_battery:"Home battery with power and charge",chk_battery_sensor:"Home battery: power or charge missing",chk_battery_opt:"Home battery (optional)",chk_grid:"Grid connection set",chk_grid_opt:"Grid connection (optional, else automatic)",energy_sign_grid:"The house shows export while the sun produces nothing. The grid sensor probably has its sign reversed.",energy_sign_battery:"The battery charges with no sun and no grid draw. Its sensor probably has its sign reversed.",energy_sign_flip:"Flip the sign",help_title:"Help and feedback",help_hint:"Please report problems as a GitHub issue and wishes as a discussion \u2013 nothing gets lost, and everyone sees the state.",help_issue:"Report a problem",help_idea:"Propose an idea",furn_name:"Name (optional)",furn_mirror:"Mirror",furn_mirror_hint:"Swap left and right \u2013 the L-sofa the other way round, the cabinet with its door on the other side, the kitchen run mirrored.",hint_opening:"Tap a wall to add a door or window \u2013 choose its kind on the right afterwards",preset_door:"Door",preset_door_double:"Double door",preset_window:"Window",preset_window_double:"Double window",preset_terrace:"Terrace door",preset_terrace_double:"French doors",preset_lift_slide:"Lift-and-slide door",preset_garage:"Garage door",preset_front:"Front door",opening_style:"Style",sidelight_auto:"automatic",sidelight_hinge:"Sidelight on the hinge side",sidelight_hinge_hint:"The sidelight sits opposite the hinge otherwise; ticked, it sits next to the hinges.",sidelight_width:"Sidelight width (m)",sidelight_width_left:"Left sidelight (m)",sidelight_width_right:"Right sidelight (m)",style_auto:"Automatic ({style})",style_interior:"Room door",style_front:"Front door",style_front_glass:"Front door with glass",style_sidelight:"Front door with sidelight",style_sidelights:"Front door with two sidelights",style_glass:"Glass door",style_sliding:"Sliding door",style_passage:"Opening (no door)",style_standard:"Standard",style_bars:"With glazing bars",style_glass_wall:"Glass wall (fixed)",preset_glass_wall:"Glass wall",glass_panes:"Panes",glass_panes_auto:"automatic (about 0.9 m)",glass_panes_hint:"0 = one single pane without mullions, empty = about every 0.9 m",flip_hinge:"Swap hinge side",flip_main_leaf:"Swap main leaf",flip_hinge_hint:"Hinges to the other side"
Line truncated
|
||||||
:host {
|
:host {
|
||||||
--nf-text: var(--primary-text-color, #e1e1e1);
|
--nf-text: var(--primary-text-color, #e1e1e1);
|
||||||
--nf-muted: var(--secondary-text-color, #9b9b9b);
|
--nf-muted: var(--secondary-text-color, #9b9b9b);
|
||||||
@@ -35,7 +35,7 @@ A plugin runs with the same rights as NextFloor in your browser. The file has be
|
|||||||
font-family: var(--nf-font);
|
font-family: var(--nf-font);
|
||||||
color: var(--nf-text);
|
color: var(--nf-text);
|
||||||
}
|
}
|
||||||
`,ur=te`
|
`,dr=te`
|
||||||
:host([readable]) {
|
:host([readable]) {
|
||||||
--secondary-text-color: var(--primary-text-color, #e1e1e1);
|
--secondary-text-color: var(--primary-text-color, #e1e1e1);
|
||||||
--divider-color: color-mix(in srgb, var(--primary-text-color, #e1e1e1) 40%, transparent);
|
--divider-color: color-mix(in srgb, var(--primary-text-color, #e1e1e1) 40%, transparent);
|
||||||
@@ -209,12 +209,12 @@ A plugin runs with the same rights as NextFloor in your browser. The file has be
|
|||||||
min-height: 40px;
|
min-height: 40px;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
`;function dr(r){return r?.themes?.darkMode===!1?"light":"dark"}var Eh=4,Rh=8,zh=[[255,181,71],[255,236,210],[55,224,255],[91,124,255],[255,95,210],[120,255,150]],$t=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">
|
`;function hr(r){return r?.themes?.darkMode===!1?"light":"dark"}var Rh=4,zh=8,Th=[[255,181,71],[255,236,210],[55,224,255],[91,124,255],[255,95,210],[120,255,150]],$t=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=${er(r)} />
|
<path d=${tr(r)} />
|
||||||
</svg>`,hr={previous:"M6 6h2v12H6zM20 6v12l-10-6z",play:"M8 5v14l11-7z",pause:"M7 5h4v14H7zM13 5h4v14h-4z",next:"M16 6h2v12h-2zM4 6v12l10-6z"},Do=r=>m`<svg viewBox="0 0 24 24" width="16" height="16" fill="currentColor" aria-hidden="true"><path d=${r} /></svg>`,Th=24,Fh=10,Po=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 cr(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(lr)}]),this._moodName=null};return m`<div class="nf-rp-moods">
|
</svg>`,pr={previous:"M6 6h2v12H6zM20 6v12l-10-6z",play:"M8 5v14l11-7z",pause:"M7 5h4v14H7zM13 5h4v14h-4z",next:"M16 6h2v12h-2zM4 6v12l10-6z"},Do=r=>m`<svg viewBox="0 0 24 24" width="16" height="16" fill="currentColor" aria-hidden="true"><path d=${r} /></svg>`,Fh=24,Dh=10,Po=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 ur(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(cr)}]),this._moodName=null};return m`<div class="nf-rp-moods">
|
||||||
${n.map(l=>m`<span class="nf-rp-mood">
|
${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>
|
<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,d=i.find(p=>p.id===u.value);u.value="",d&&this.runMood(Xa(l,s(d)))}}>
|
${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,d=i.find(p=>p.id===u.value);u.value="",d&&this.runMood(el(l,s(d)))}}>
|
||||||
<option value="">→</option>
|
<option value="">→</option>
|
||||||
${i.map(c=>m`<option value=${c.id}>${c.name}</option>`)}
|
${i.map(c=>m`<option value=${c.id}>${c.name}</option>`)}
|
||||||
</select>`:f}
|
</select>`:f}
|
||||||
@@ -224,21 +224,21 @@ A plugin runs with the same rights as NextFloor in your browser. The file has be
|
|||||||
><input type="text" maxlength="40" placeholder=${this.t("mood_new")} .value=${this._moodName} @input=${l=>this._moodName=l.target.value} @keydown=${l=>l.key==="Enter"&&a()} />
|
><input type="text" maxlength="40" placeholder=${this.t("mood_new")} .value=${this._moodName} @input=${l=>this._moodName=l.target.value} @keydown=${l=>l.key==="Enter"&&a()} />
|
||||||
<button class="nf-btn" @click=${a}>${this.t("mood_save")}</button></span
|
<button class="nf-btn" @click=${a}>${this.t("mood_save")}</button></span
|
||||||
>`:f}
|
>`:f}
|
||||||
</div>`}async loadCurve(e){let t=qn(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 rn(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=Mt(this.hass,s,i+(o-i)*l/96),u=n.map(d=>d.startsWith("climate.")?Number(c.states[d]?.attributes.current_temperature):Number(c.states[d]?.state)).filter(Number.isFinite);a.push(u.length?u.reduce((d,p)=>d+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=To(this.hass,this.building,this.floor,e);try{let n=await Ka(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<Fh?f:m`<div class="nf-rp-shade">
|
</div>`}async loadCurve(e){let t=Zn(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 rn(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=Mt(this.hass,s,i+(o-i)*l/96),u=n.map(d=>d.startsWith("climate.")?Number(c.states[d]?.attributes.current_temperature):Number(c.states[d]?.state)).filter(Number.isFinite);a.push(u.length?u.reduce((d,p)=>d+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=To(this.hass,this.building,this.floor,e);try{let n=await Ga(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<Dh?f:m`<div class="nf-rp-shade">
|
||||||
<span>💡 ${this.t("empty_lights_hint",{n:t.length,min:i})}</span>
|
<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>
|
<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">
|
</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">
|
||||||
<span>🪟 ${this.t("open_heating_hint",{n:i.length})}</span>
|
<span>🪟 ${this.t("open_heating_hint",{n:i.length})}</span>
|
||||||
<button class="nf-btn nf-rp-small" @click=${s}>${this.t("open_heating_off")}</button>
|
<button class="nf-btn nf-rp-small" @click=${s}>${this.t("open_heating_off")}</button>
|
||||||
</div>`}renderShade(){let e=this.room,{latitude:t,longitude:n}=this.hass.config??{};if(!e||!this.floor||!this.building||t===void 0||n===void 0)return f;let o=Y(this.hass,this.floor,e,"temperature");if(o===null||o<Th)return f;let i=a=>{let l=a&&a!=="none"?this.hass.states[a]:void 0;if(!l||I(l))return!1;let c=l.attributes.current_position;return typeof c=="number"?c>30:l.state==="open"},s=[...new Set(Ca(this.building,this.floor,e,{latitude:t,longitude:n}).flatMap(a=>[a.cover,a.cover2].filter(i)))];return s.length?m`<div class="nf-rp-shade">
|
</div>`}renderShade(){let e=this.room,{latitude:t,longitude:n}=this.hass.config??{};if(!e||!this.floor||!this.building||t===void 0||n===void 0)return f;let o=Y(this.hass,this.floor,e,"temperature");if(o===null||o<Fh)return f;let i=a=>{let l=a&&a!=="none"?this.hass.states[a]:void 0;if(!l||I(l))return!1;let c=l.attributes.current_position;return typeof c=="number"?c>30:l.state==="open"},s=[...new Set(Na(this.building,this.floor,e,{latitude:t,longitude:n}).flatMap(a=>[a.cover,a.cover2].filter(i)))];return s.length?m`<div class="nf-rp-shade">
|
||||||
<span>☀ ${this.t("shade_hint",{n:s.length,temp:`${O(this.hass,ue(this.hass,o),1)} ${ne(this.hass)}`})}</span>
|
<span>☀ ${this.t("shade_hint",{n:s.length,temp:`${O(this.hass,ue(this.hass,o),1)} ${ne(this.hass)}`})}</span>
|
||||||
<button class="nf-btn nf-rp-small" @click=${()=>this.call("cover","close_cover",{entity_id:s})}>${this.t("shade_close")}</button>
|
<button class="nf-btn nf-rp-small" @click=${()=>this.call("cover","close_cover",{entity_id:s})}>${this.t("shade_close")}</button>
|
||||||
</div>`:f}renderSunYear(){let e=this.room,{latitude:t,longitude:n}=this.hass.config??{};if(!e||!this.floor||!this.building||t===void 0||n===void 0)return f;let o={latitude:t,longitude:n};if(!kt(this.building,this.floor,e,{...o,zone:this.hass.config?.time_zone}).facing.length)return f;let s=m`<button class="nf-rp-sun-year" aria-expanded=${this._sunYear} title=${this.t("room_sun_year_hint")} @click=${()=>this._sunYear=!this._sunYear}>
|
</div>`:f}renderSunYear(){let e=this.room,{latitude:t,longitude:n}=this.hass.config??{};if(!e||!this.floor||!this.building||t===void 0||n===void 0)return f;let o={latitude:t,longitude:n};if(!kt(this.building,this.floor,e,{...o,zone:this.hass.config?.time_zone}).facing.length)return f;let s=m`<button class="nf-rp-sun-year" aria-expanded=${this._sunYear} title=${this.t("room_sun_year_hint")} @click=${()=>this._sunYear=!this._sunYear}>
|
||||||
☀ ${this.t("room_sun_year")}
|
☀ ${this.t("room_sun_year")}
|
||||||
</button>`;if(!this._sunYear)return s;let a=Ia(this.building,this.floor,e,o),l=Math.max(1,...a),c=Array.from({length:12},(u,d)=>new Date(2026,d,15).toLocaleDateString(this.hass.language,{month:"narrow"}));return m`${s}
|
</button>`;if(!this._sunYear)return s;let a=Ca(this.building,this.floor,e,o),l=Math.max(1,...a),c=Array.from({length:12},(u,d)=>new Date(2026,d,15).toLocaleDateString(this.hass.language,{month:"narrow"}));return m`${s}
|
||||||
<div class="nf-rp-sun-bars" role="img" aria-label=${a.map((u,d)=>`${c[d]} ${O(this.hass,u,1)} h`).join(", ")}>
|
<div class="nf-rp-sun-bars" role="img" aria-label=${a.map((u,d)=>`${c[d]} ${O(this.hass,u,1)} h`).join(", ")}>
|
||||||
${a.map((u,d)=>m`<span title=${`${O(this.hass,u,1)} h`}><i style=${`height:${Math.round(u/l*100)}%`}></i><b>${c[d]}</b></span>`)}
|
${a.map((u,d)=>m`<span title=${`${O(this.hass,u,1)} h`}><i style=${`height:${Math.round(u/l*100)}%`}></i><b>${c[d]}</b></span>`)}
|
||||||
</div>`}renderEnergy(){let e=this._energy;if(!e||e.month<=0)return f;let t=this.building?.energy.tariff,n=t?this.hass.states[t]:void 0,o=n?{value:Number(n.state),unit:String(n.attributes.unit_of_measurement??"")}:null,i=Ga(e.month,o),s=a=>`${O(this.hass,a,a<10?2:1)} kWh`;return m`<p class="nf-rp-facts nf-rp-energy" title=${this.t("room_energy_hint")}>
|
</div>`}renderEnergy(){let e=this._energy;if(!e||e.month<=0)return f;let t=this.building?.energy.tariff,n=t?this.hass.states[t]:void 0,o=n?{value:Number(n.state),unit:String(n.attributes.unit_of_measurement??"")}:null,i=Ua(e.month,o),s=a=>`${O(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 ${O(this.hass,i.value,2)} ${i.currency}`:""}
|
⚡ ${this.t("room_energy",{today:s(e.today),month:s(e.month)})}${i?` \xB7 ${O(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=on(s,220,36,i*1.2),l=c=>`${O(this.hass,ue(this.hass,c),1)}\xB0`;return m`<div class="nf-rp-curve" title=${this.t("room_curve_hint")}>
|
</p>`}renderCurve(){let e=this._curve;if(!e)return f;let t=e.filter(c=>c!==null),n=Math.min(...t),o=Math.max(...t),i=Math.max(1,o-n),s=e.map(c=>c===null?null:c-n+i*.1),a=on(s,220,36,i*1.2),l=c=>`${O(this.hass,ue(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">${J`<path d=${a}></path>`}</svg>
|
||||||
@@ -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)}
|
aria-label=${this.name(e.entity_id)}
|
||||||
?disabled=${I(e)}
|
?disabled=${I(e)}
|
||||||
@click=${o}
|
@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?Os(this.hass,this.floor,t):{shown:n,more:[]}},a=ho(this.hass,s).map(x=>x.primary),l=a.length,c=this._showAll?[...i,...a]:i,u=x=>c.filter(y=>x.includes(D(y))).map(y=>this.hass.states[y]),d=u(["light"]),p=u(["cover"]),h=u(["climate"]),w=u(["media"]),b=u(["switch","fan","lock"]),g=u(["sensor","binary"]),_=u(["scene","script"]),M=this.facts(h),$=d.filter(x=>x.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?Ws(this.hass,this.floor,t):{shown:n,more:[]}},a=ho(this.hass,s).map(x=>x.primary),l=a.length,c=this._showAll?[...i,...a]:i,u=x=>c.filter(y=>x.includes(D(y))).map(y=>this.hass.states[y]),d=u(["light"]),p=u(["cover"]),h=u(["climate"]),w=u(["media"]),b=u(["switch","fan","lock"]),g=u(["sensor","binary"]),_=u(["scene","script"]),M=this.facts(h),$=d.filter(x=>x.state==="on");return m`<section class="nf-rp" aria-label=${t.name}>
|
||||||
<header class="nf-rp-head">
|
<header class="nf-rp-head">
|
||||||
<div>
|
<div>
|
||||||
<h2>${t.name}</h2>
|
<h2>${t.name}</h2>
|
||||||
@@ -283,27 +283,27 @@ A plugin runs with the same rights as NextFloor in your browser. The file has be
|
|||||||
</button>`:f}${$.length?m`<button class="nf-btn nf-rp-small" @click=${()=>this.call("light","turn_off",{entity_id:$.map(x=>x.entity_id)})}>
|
</button>`:f}${$.length?m`<button class="nf-btn nf-rp-small" @click=${()=>this.call("light","turn_off",{entity_id:$.map(x=>x.entity_id)})}>
|
||||||
${this.t("panel_all_off")}
|
${this.t("panel_all_off")}
|
||||||
</button>`:f}`):f}
|
</button>`:f}`):f}
|
||||||
${p.length?this.section("panel_covers",p.map(x=>this.coverRow(x)),p.length>1&&Ln(p,this.confirmEntities).length?m`<button class="nf-btn nf-rp-small" @click=${()=>this.call("cover","open_cover",{entity_id:Ln(p,this.confirmEntities)})}>
|
${p.length?this.section("panel_covers",p.map(x=>this.coverRow(x)),p.length>1&&Bn(p,this.confirmEntities).length?m`<button class="nf-btn nf-rp-small" @click=${()=>this.call("cover","open_cover",{entity_id:Bn(p,this.confirmEntities)})}>
|
||||||
${this.t("panel_all_open")}</button
|
${this.t("panel_all_open")}</button
|
||||||
><button class="nf-btn nf-rp-small" @click=${()=>this.call("cover","close_cover",{entity_id:Ln(p,this.confirmEntities)})}>
|
><button class="nf-btn nf-rp-small" @click=${()=>this.call("cover","close_cover",{entity_id:Bn(p,this.confirmEntities)})}>
|
||||||
${this.t("panel_all_close")}
|
${this.t("panel_all_close")}
|
||||||
</button>`:f):f}
|
</button>`:f):f}
|
||||||
${h.length?this.section("panel_climate",h.map(x=>this.climateRow(x))):f}
|
${h.length?this.section("panel_climate",h.map(x=>this.climateRow(x))):f}
|
||||||
${w.length?this.section("panel_media",w.map(x=>this.mediaRow(x))):f}
|
${w.length?this.section("panel_media",w.map(x=>this.mediaRow(x))):f}
|
||||||
${b.length?this.section("panel_switches",b.map(x=>this.switchRow(x))):f}
|
${b.length?this.section("panel_switches",b.map(x=>this.switchRow(x))):f}
|
||||||
${g.length?this.section("panel_sensors",g.map(x=>this.sensorRow(x))):f}
|
${g.length?this.section("panel_sensors",g.map(x=>this.sensorRow(x))):f}
|
||||||
${ma(this.hass)&&pa(this.hass,this.floor,t)?this.announceSection(t):f}
|
${fa(this.hass)&&ma(this.hass,this.floor,t)?this.announceSection(t):f}
|
||||||
${this.pluginSections(t,c)}
|
${this.pluginSections(t,c)}
|
||||||
${l?m`<button class="nf-btn nf-rp-small nf-rp-more" @click=${()=>this._showAll=!this._showAll}>
|
${l?m`<button class="nf-btn nf-rp-small nf-rp-more" @click=${()=>this._showAll=!this._showAll}>
|
||||||
${this._showAll?this.t("panel_less"):this.t("panel_more",{n:l})}
|
${this._showAll?this.t("panel_less"):this.t("panel_more",{n:l})}
|
||||||
</button>`:f}
|
</button>`:f}
|
||||||
</div>
|
</div>
|
||||||
</section>`}facts(e){let t=[],n=this.room;if(!n)return t;let o=(y,F)=>{let T=Y(this.hass,this.floor,n,y);if(T===null)return null;if(y==="temperature")return`${O(this.hass,ue(this.hass,T),1)} ${ne(this.hass)}`;let C=qn(this.hass,this.floor,n,y)[0],E=this.hass.states[C]?.attributes.unit_of_measurement??F;return`${O(this.hass,T,1)} ${E}`},i=e.find(y=>typeof y.attributes.current_temperature=="number"),s=o("temperature","\xB0C");s?t.push(s):i&&n.climate?.temperature!=="none"&&t.push(`${O(this.hass,i.attributes.current_temperature,1)} ${ne(this.hass)}`);let a=o("humidity","%");a&&t.push(a);let l=this.floor&&this.building?zo(this.hass,this.building,this.floor,n):null;l!==null&&t.push(`\u26A1 ${it(this.hass,l)}`);let c=this.floor?this.floor.openings.filter(y=>y.room_id===n.id).flatMap(y=>[y.contact,y.contact2,y.tilt,y.tilt2]).map(y=>y&&y!=="none"?this.hass.states[y]:void 0).filter(y=>y?.state==="on").map(y=>Date.parse(String(y.last_changed??""))).filter(Number.isFinite):[];c.length&&t.push(`\u{1FA9F} ${this.t("open_since",{time:Fo(Date.now()-Math.min(...c))})}`);let u=K(this.hass,n).map(y=>this.hass.states[y]).filter(y=>!!y&&y.entity_id.startsWith("binary_sensor.")&&["motion","occupancy","presence"].includes(String(y.attributes.device_class)));if(u.length)if(u.some(y=>y.state==="on"))t.push(`\u{1F6B6} ${this.t("presence_now")}`);else{let y=Math.max(...u.map(F=>Date.parse(String(F.last_changed??""))||0));y>0&&t.push(`\u{1F6B6} ${this.t("presence_last",{time:Fo(Date.now()-y)})}`)}let d=this.building?qa(this.hass,this.building).filter(y=>y.roomId===n.id&&y.level<ja):[];d.length&&t.push(`\u{1FAAB} ${this.t("battery_low_n",{n:d.length,names:d.map(y=>`${this.name(y.entity)} ${Math.round(y.level)} %`).join(", ")})}`);let p=(this.building?.settings.circuits??[]).filter(y=>y.rooms.includes(n.id)).map(y=>y.name),h=this.building?.settings.room_facts_off??[];p.length&&!h.includes("circuits")&&t.push(`\u{1F50C} ${p.join(", ")}`);let{latitude:w,longitude:b,time_zone:g}=this.hass.config??{};if(this.floor&&w!==void 0&&b!==void 0&&this.building&&!h.includes("sun")){let y=kt(this.building,this.floor,n,{latitude:w,longitude:b,zone:g});y.facing.length&&t.push(`\u2600 ${this.t("room_sun_hours",{h:O(this.hass,y.hours,1),facing:y.facing.join(", ")})}`)}let _=Y(this.hass,this.floor,n,"temperature"),M=Y(this.hass,this.floor,n,"humidity"),$=ir(Y(this.hass,this.floor,n,"co2"),M,St(_,M));$&&!h.includes("air")&&t.push(`\u{1F4A8} ${this.t(`air_${$}`)}`);let x=sr(_,M,Y(this.hass,this.floor,n,"co2"),ot(new Date,this.hass.config?.latitude));return x!==null&&(_!==null||M!==null)&&!h.includes("comfort")&&t.push(`\u{1F60A} ${this.t("comfort_n",{n:x})}`),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>`}facts(e){let t=[],n=this.room;if(!n)return t;let o=(y,F)=>{let T=Y(this.hass,this.floor,n,y);if(T===null)return null;if(y==="temperature")return`${O(this.hass,ue(this.hass,T),1)} ${ne(this.hass)}`;let C=Zn(this.hass,this.floor,n,y)[0],E=this.hass.states[C]?.attributes.unit_of_measurement??F;return`${O(this.hass,T,1)} ${E}`},i=e.find(y=>typeof y.attributes.current_temperature=="number"),s=o("temperature","\xB0C");s?t.push(s):i&&n.climate?.temperature!=="none"&&t.push(`${O(this.hass,i.attributes.current_temperature,1)} ${ne(this.hass)}`);let a=o("humidity","%");a&&t.push(a);let l=this.floor&&this.building?zo(this.hass,this.building,this.floor,n):null;l!==null&&t.push(`\u26A1 ${it(this.hass,l)}`);let c=this.floor?this.floor.openings.filter(y=>y.room_id===n.id).flatMap(y=>[y.contact,y.contact2,y.tilt,y.tilt2]).map(y=>y&&y!=="none"?this.hass.states[y]:void 0).filter(y=>y?.state==="on").map(y=>Date.parse(String(y.last_changed??""))).filter(Number.isFinite):[];c.length&&t.push(`\u{1FA9F} ${this.t("open_since",{time:Fo(Date.now()-Math.min(...c))})}`);let u=K(this.hass,n).map(y=>this.hass.states[y]).filter(y=>!!y&&y.entity_id.startsWith("binary_sensor.")&&["motion","occupancy","presence"].includes(String(y.attributes.device_class)));if(u.length)if(u.some(y=>y.state==="on"))t.push(`\u{1F6B6} ${this.t("presence_now")}`);else{let y=Math.max(...u.map(F=>Date.parse(String(F.last_changed??""))||0));y>0&&t.push(`\u{1F6B6} ${this.t("presence_last",{time:Fo(Date.now()-y)})}`)}let d=this.building?Za(this.hass,this.building).filter(y=>y.roomId===n.id&&y.level<qa):[];d.length&&t.push(`\u{1FAAB} ${this.t("battery_low_n",{n:d.length,names:d.map(y=>`${this.name(y.entity)} ${Math.round(y.level)} %`).join(", ")})}`);let p=(this.building?.settings.circuits??[]).filter(y=>y.rooms.includes(n.id)).map(y=>y.name),h=this.building?.settings.room_facts_off??[];p.length&&!h.includes("circuits")&&t.push(`\u{1F50C} ${p.join(", ")}`);let{latitude:w,longitude:b,time_zone:g}=this.hass.config??{};if(this.floor&&w!==void 0&&b!==void 0&&this.building&&!h.includes("sun")){let y=kt(this.building,this.floor,n,{latitude:w,longitude:b,zone:g});y.facing.length&&t.push(`\u2600 ${this.t("room_sun_hours",{h:O(this.hass,y.hours,1),facing:y.facing.join(", ")})}`)}let _=Y(this.hass,this.floor,n,"temperature"),M=Y(this.hass,this.floor,n,"humidity"),$=sr(Y(this.hass,this.floor,n,"co2"),M,St(_,M));$&&!h.includes("air")&&t.push(`\u{1F4A8} ${this.t(`air_${$}`)}`);let x=ar(_,M,Y(this.hass,this.floor,n,"co2"),ot(new Date,this.hass.config?.latitude));return x!==null&&(_!==null||M!==null)&&!h.includes("comfort")&&t.push(`\u{1F60A} ${this.t("comfort_n",{n:x})}`),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}>
|
<form class="nf-rp-say" @submit=${o}>
|
||||||
<input type="text" maxlength="500" placeholder=${this.t("announce_placeholder")} aria-label=${this.t("announce_placeholder")} />
|
<input type="text" maxlength="500" placeholder=${this.t("announce_placeholder")} aria-label=${this.t("announce_placeholder")} />
|
||||||
<button class="nf-btn nf-primary" type="submit">${this.t("announce_send")}</button>
|
<button class="nf-btn nf-primary" type="submit">${this.t("announce_send")}</button>
|
||||||
</form>
|
</form>
|
||||||
${this._said?m`<p class="nf-rp-note ${this._said.failed?"nf-rp-fail":""}" role="status">${this._said.text}</p>`:f}`])}pluginSections(e,t){return Xi({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 es({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>
|
<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}
|
${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">
|
</div>`)}section(e,t,n=f){return m`<div class="nf-rp-sec">
|
||||||
@@ -334,7 +334,7 @@ A plugin runs with the same rights as NextFloor in your browser. The file has be
|
|||||||
@change=${h=>this.call("light","turn_on",{entity_id:d,color_temp_kelvin:Number(h.target.value)})}
|
@change=${h=>this.call("light","turn_on",{entity_id:d,color_temp_kelvin:Number(h.target.value)})}
|
||||||
/></label>`:f}
|
/></label>`:f}
|
||||||
${n&&a&&!p?m`<div class="nf-rp-swatches" role="group" aria-label=${this.t("color")}>
|
${n&&a&&!p?m`<div class="nf-rp-swatches" role="group" aria-label=${this.t("color")}>
|
||||||
${zh.map(h=>m`<button
|
${Th.map(h=>m`<button
|
||||||
class="nf-rp-swatch"
|
class="nf-rp-swatch"
|
||||||
style="--c: rgb(${h.join(",")})"
|
style="--c: rgb(${h.join(",")})"
|
||||||
aria-label="rgb(${h.join(", ")})"
|
aria-label="rgb(${h.join(", ")})"
|
||||||
@@ -347,10 +347,10 @@ A plugin runs with the same rights as NextFloor in your browser. The file has be
|
|||||||
<span class="nf-rp-state">${this.stateOf(e)}</span>
|
<span class="nf-rp-state">${this.stateOf(e)}</span>
|
||||||
<div class="nf-rp-buttons">
|
<div class="nf-rp-buttons">
|
||||||
<button class="nf-btn nf-rp-small" ?disabled=${i} @click=${()=>this.askFor(o)&&this.call("cover","open_cover",{entity_id:o})}>${this.t("cover_open")}</button>
|
<button class="nf-btn nf-rp-small" ?disabled=${i} @click=${()=>this.askFor(o)&&this.call("cover","open_cover",{entity_id:o})}>${this.t("cover_open")}</button>
|
||||||
${n&Rh?m`<button class="nf-btn nf-rp-small" ?disabled=${i} @click=${()=>this.call("cover","stop_cover",{entity_id:o})}>${this.t("cover_stop")}</button>`:f}
|
${n&zh?m`<button class="nf-btn nf-rp-small" ?disabled=${i} @click=${()=>this.call("cover","stop_cover",{entity_id:o})}>${this.t("cover_stop")}</button>`:f}
|
||||||
<button class="nf-btn nf-rp-small" ?disabled=${i} @click=${()=>this.askFor(o)&&this.call("cover","close_cover",{entity_id:o})}>${this.t("cover_close")}</button>
|
<button class="nf-btn nf-rp-small" ?disabled=${i} @click=${()=>this.askFor(o)&&this.call("cover","close_cover",{entity_id:o})}>${this.t("cover_close")}</button>
|
||||||
</div>
|
</div>
|
||||||
${n&Eh&&typeof t.current_position=="number"?m`<label class="nf-rp-slider"
|
${n&Rh&&typeof t.current_position=="number"?m`<label class="nf-rp-slider"
|
||||||
><span>${this.t("position")}</span>
|
><span>${this.t("position")}</span>
|
||||||
<input
|
<input
|
||||||
type="range"
|
type="range"
|
||||||
@@ -398,13 +398,13 @@ A plugin runs with the same rights as NextFloor in your browser. The file has be
|
|||||||
${i?m`<p class="nf-rp-media nf-rp-wide">${i}</p>`:f}
|
${i?m`<p class="nf-rp-media nf-rp-wide">${i}</p>`:f}
|
||||||
<div class="nf-rp-buttons nf-rp-wide">
|
<div class="nf-rp-buttons nf-rp-wide">
|
||||||
<button class="nf-btn nf-rp-small" aria-label=${this.t("previous")} ?disabled=${o} @click=${()=>this.call("media_player","media_previous_track",{entity_id:n})}>
|
<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})}>
|
||||||
${Do(hr.previous)}
|
${Do(pr.previous)}
|
||||||
</button>
|
</button>
|
||||||
<button class="nf-btn nf-rp-small" aria-label=${this.t("play_pause")} ?disabled=${I(e)} @click=${()=>this.call("media_player","media_play_pause",{entity_id:n})}>
|
<button class="nf-btn nf-rp-small" aria-label=${this.t("play_pause")} ?disabled=${I(e)} @click=${()=>this.call("media_player","media_play_pause",{entity_id:n})}>
|
||||||
${Do(e.state==="playing"?hr.pause:hr.play)}
|
${Do(e.state==="playing"?pr.pause:pr.play)}
|
||||||
</button>
|
</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})}>
|
<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})}>
|
||||||
${Do(hr.next)}
|
${Do(pr.next)}
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
${typeof t.volume_level=="number"?m`<label class="nf-rp-slider"
|
${typeof t.volume_level=="number"?m`<label class="nf-rp-slider"
|
||||||
@@ -806,10 +806,10 @@ A plugin runs with the same rights as NextFloor in your browser. The file has be
|
|||||||
outline: 2px solid var(--nf-accent);
|
outline: 2px solid var(--nf-accent);
|
||||||
outline-offset: 2px;
|
outline-offset: 2px;
|
||||||
}
|
}
|
||||||
`]};customElements.get("nf-room-panel")||customElements.define("nf-room-panel",Po);function il(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 Dh=[[/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]]],sl=[34,211,238];function Ho(r){return r?Dh.find(([e])=>e.test(r))?.[1]??sl:sl}function Io(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 Co=r=>r.state==="playing"||r.state==="on"&&Io(r);function al(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:Co(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:Ho(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 ll(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 Ph=3;function cl(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:le(o,i)+i.h,z:i.z},reach:Math.min(15,Math.max(.5,i.spray??Ph))})}return n}var pr=r=>r&&r!=="none"?r:null,ul=r=>Math.min(1,Math.max(0,r));function dl(r,e){let t=new Map;for(let n of e.settings.roof?.windows??[]){let o=Ee(r,{cover:pr(n.cover),contact:pr(n.contact),tilt:pr(n.tilt)},"window"),i=pr(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"?ul(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 Hh(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 Ke=(r,e)=>typeof r[e]=="string"?r[e]:"";function hl(r,e,t){let n=[];for(let o of e.floors)for(let i of o.furniture){if(!Zn(i.type))continue;let s=t?.get(i.id)?.entity??null,a=s?.startsWith("media_player.")?s:Hh(o,i),l=a?r.states[a]:void 0;if(!l||!Io(l))continue;let c=l.attributes,u=Ke(c,"app_name")||Ke(c,"source")||null;n.push({id:i.id,furnitureId:i.id,floorId:o.id,color:Ho(u),title:Ke(c,"media_title")||Ke(c,"media_channel")||u||"",subtitle:Ke(c,"media_artist")||Ke(c,"media_series_title")||Ke(c,"media_album_name"),app:u,picture:Ke(c,"entity_picture")||null,playing:Co(l),ambilight:i.ambilight??1})}return n}function pl(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 ml(r,e){return(r===null?0:ul((r+4)/16))*(1-.45*e)}function Ge(r,e){return e&&r.states[e]?e:Object.keys(r.states).filter(t=>t.startsWith("weather.")).sort()[0]??null}var mr=new Set(["contact_lost","unlocked_night","own"]);function Ih(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 Ch=600*1e3,Nh=new Set(["rainy","pouring","lightning-rainy","hail","snowy-rainy"]),Oh=new Map([["smoke","smoke"],["gas","gas"],["carbon_monoxide","co"],["moisture","water"]]),fl=(r,e)=>{if(e.startsWith("binary_sensor."))return Oh.get(String(r.states[e]?.attributes.device_class))};function Wh(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 gl(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=>fl(r,u));
Line truncated
|
`]};customElements.get("nf-room-panel")||customElements.define("nf-room-panel",Po);function sl(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 Ph=[[/spotify/i,[30,215,96]],[/netflix/i,[229,9,20]],[/youtube/i,[255,0,51]],[/prime|amazon/i,[0,168,225]],[/disney/i,[17,60,207]],[/apple ?music|itunes/i,[250,45,72]],[/apple ?tv/i,[200,200,210]],[/plex/i,[229,160,13]],[/tidal/i,[0,255,255]],[/deezer/i,[162,56,255]],[/radio|tunein/i,[255,140,60]]],al=[34,211,238];function Ho(r){return r?Ph.find(([e])=>e.test(r))?.[1]??al:al}function Io(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 Co=r=>r.state==="playing"||r.state==="on"&&Io(r);function ll(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:Co(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:Ho(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 cl(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 Hh=3;function ul(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:le(o,i)+i.h,z:i.z},reach:Math.min(15,Math.max(.5,i.spray??Hh))})}return n}var mr=r=>r&&r!=="none"?r:null,dl=r=>Math.min(1,Math.max(0,r));function hl(r,e){let t=new Map;for(let n of e.settings.roof?.windows??[]){let o=Ee(r,{cover:mr(n.cover),contact:mr(n.contact),tilt:mr(n.tilt)},"window"),i=mr(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"?dl(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 Ih(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 Ke=(r,e)=>typeof r[e]=="string"?r[e]:"";function pl(r,e,t){let n=[];for(let o of e.floors)for(let i of o.furniture){if(!Yn(i.type))continue;let s=t?.get(i.id)?.entity??null,a=s?.startsWith("media_player.")?s:Ih(o,i),l=a?r.states[a]:void 0;if(!l||!Io(l))continue;let c=l.attributes,u=Ke(c,"app_name")||Ke(c,"source")||null;n.push({id:i.id,furnitureId:i.id,floorId:o.id,color:Ho(u),title:Ke(c,"media_title")||Ke(c,"media_channel")||u||"",subtitle:Ke(c,"media_artist")||Ke(c,"media_series_title")||Ke(c,"media_album_name"),app:u,picture:Ke(c,"entity_picture")||null,playing:Co(l),ambilight:i.ambilight??1})}return n}function ml(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 fl(r,e){return(r===null?0:dl((r+4)/16))*(1-.45*e)}function Ge(r,e){return e&&r.states[e]?e:Object.keys(r.states).filter(t=>t.startsWith("weather.")).sort()[0]??null}var fr=new Set(["contact_lost","unlocked_night","own"]);function Ch(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 Nh=600*1e3,Oh=new Set(["rainy","pouring","lightning-rainy","hail","snowy-rainy"]),Wh=new Map([["smoke","smoke"],["gas","gas"],["carbon_monoxide","co"],["moisture","water"]]),gl=(r,e)=>{if(e.startsWith("binary_sensor."))return Wh.get(String(r.states[e]?.attributes.device_class))};function Lh(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 _l(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=>gl(r,u));
Line truncated
|
||||||
${J`<circle cx="27" cy="27" r=${22} class="live-ring-bg"></circle>
|
${J`<circle cx="27" cy="27" r=${22} class="live-ring-bg"></circle>
|
||||||
<circle cx="27" cy="27" r=${22} stroke=${e} stroke-dasharray=${`${(n*Math.max(0,Math.min(1,r))).toFixed(1)} ${n.toFixed(1)}`} transform="rotate(-90 27 27)" class="live-ring-fg"></circle>`}
|
<circle cx="27" cy="27" r=${22} stroke=${e} stroke-dasharray=${`${(n*Math.max(0,Math.min(1,r))).toFixed(1)} ${n.toFixed(1)}`} transform="rotate(-90 27 27)" class="live-ring-fg"></circle>`}
|
||||||
</svg>`}function Yp(r,e,t,n){let o=e.summary,i=c=>R(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}>
|
</svg>`}function Jp(r,e,t,n){let o=e.summary,i=c=>R(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">${fn(s,s>.95?"#4ade80":s>.6?"#facc15":"#f87171")}<div class="live-own-text"><b>${Math.round(s*100)}%</b></div></div>`:f}
|
${s!==null?m`<div class="live-own">${fn(s,s>.95?"#4ade80":s>.6?"#facc15":"#f87171")}<div class="live-own-text"><b>${Math.round(s*100)}%</b></div></div>`:f}
|
||||||
${c?m`<b>${c}</b>`:s===null?m`<b>⌂</b>`:f}
|
${c?m`<b>${c}</b>`:s===null?m`<b>⌂</b>`:f}
|
||||||
${a}
|
${a}
|
||||||
@@ -817,19 +817,19 @@ A plugin runs with the same rights as NextFloor in your browser. The file has be
|
|||||||
${a}
|
${a}
|
||||||
${s!==null?m`<div class="live-own">${fn(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}
|
${s!==null?m`<div class="live-own">${fn(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>
|
<div class="live-rows">${l}</div>
|
||||||
${Qp(r,e.curves)} ${Jp(r,e.week)}
|
${Xp(r,e.curves)} ${Qp(r,e.week)}
|
||||||
</div>`}function Jp(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,d)=>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=${d}></rect>`,l=c=>c.reduce((u,d)=>u+(d??0),0);return m`<div class="live-day live-week" title=${R(r,"live_week_hint",{solar:O(r,l(e.solar),0),use:O(r,l(e.use),0)})}>
|
</div>`}function Qp(r,e){if(!e)return f;let t=[...e.solar,...e.use].filter(c=>c!==null&&c>0);if(!t.length)return f;let n=Math.max(...t)*1.1||1,[o,i]=[150,30],s=o/7,a=(c,u,d)=>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=${d}></rect>`,l=c=>c.reduce((u,d)=>u+(d??0),0);return m`<div class="live-day live-week" title=${R(r,"live_week_hint",{solar:O(r,l(e.solar),0),use:O(r,l(e.use),0)})}>
|
||||||
<svg viewBox=${`0 0 ${o} ${i}`} preserveAspectRatio="none" aria-hidden="true">
|
<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)=>J`${a(e.solar[u],u*s+s*.1,"live-week-solar")}${a(e.use[u],u*s+s*.5,"live-week-use")}`)}
|
||||||
</svg>
|
</svg>
|
||||||
<span>7 ${R(r,"live_days")}</span>
|
<span>7 ${R(r,"live_days")}</span>
|
||||||
</div>`}function Qp(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=on(e.solar,o,i,n),a=on(e.use,o,i,n);return m`<div class="live-day" title=${R(r,"live_day_hint")}>
|
</div>`}function Xp(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=on(e.solar,o,i,n),a=on(e.use,o,i,n);return m`<div class="live-day" title=${R(r,"live_day_hint")}>
|
||||||
<svg viewBox=${`0 0 ${o} ${i}`} preserveAspectRatio="none" aria-hidden="true">
|
<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}
|
${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}
|
${a?J`<path d=${a} class="live-day-use"></path>`:f}
|
||||||
</svg>
|
</svg>
|
||||||
<span>24 h</span>
|
<span>24 h</span>
|
||||||
</div>`}function Xp(r,e,t,n){let o=e.car,i=(u,d)=>R(r,u,d),s=lc(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 ${O(r,o.distance,o.distance<10?1:0)} km`:""}`,l=o.entities,c=(u,d,p,h)=>m`<button class="live-btn ${u?"live-on":""}" title=${d} aria-label=${d} aria-pressed=${u??!1} @click=${w=>(w.stopPropagation(),h())}>${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}`}>
|
</div>`}function em(r,e,t,n){let o=e.car,i=(u,d)=>R(r,u,d),s=cc(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 ${O(r,o.distance,o.distance<10?1:0)} km`:""}`,l=o.entities,c=(u,d,p,h)=>m`<button class="live-btn ${u?"live-on":""}" title=${d} aria-label=${d} aria-pressed=${u??!1} @click=${w=>(w.stopPropagation(),h())}>${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}`}>
|
||||||
<div class="live-own">
|
<div class="live-own">
|
||||||
${fn((o.soc??0)/100,s)}
|
${fn((o.soc??0)/100,s)}
|
||||||
<div class="live-own-text"><b>${o.soc!==null?`${Math.round(o.soc)} %`:"\u2013"}</b><span>${o.range!==null?`${Math.round(o.range)} ${o.rangeUnit}`:""}</span></div>
|
<div class="live-own-text"><b>${o.soc!==null?`${Math.round(o.soc)} %`:"\u2013"}</b><span>${o.range!==null?`${Math.round(o.range)} ${o.rangeUnit}`:""}</span></div>
|
||||||
@@ -846,7 +846,7 @@ A plugin runs with the same rights as NextFloor in your browser. The file has be
|
|||||||
${l.charge&&o.home?c(o.charging,i("live_car_charge"),"\u26A1",()=>n(l.charge.split(".")[0],"toggle",l.charge)):f}
|
${l.charge&&o.home?c(o.charging,i("live_car_charge"),"\u26A1",()=>n(l.charge.split(".")[0],"toggle",l.charge)):f}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>`}function em(r,e,t,n){let o=e.media,i=l=>R(r,l),s=`rgb(${o.color.join(",")})`,a=(l,c,u)=>m`<button class="live-btn" title=${l} aria-label=${l} @click=${d=>(d.stopPropagation(),n("media_player",u,o.entity))}>${c}</button>`;return m`<div class="live-card live-card-media" data-i=${t} style=${`--live-soc:${s}`} @click=${l=>l.currentTarget.classList.toggle("live-open")}>
|
</div>`}function tm(r,e,t,n){let o=e.media,i=l=>R(r,l),s=`rgb(${o.color.join(",")})`,a=(l,c,u)=>m`<button class="live-btn" title=${l} aria-label=${l} @click=${d=>(d.stopPropagation(),n("media_player",u,o.entity))}>${c}</button>`;return m`<div class="live-card live-card-media" data-i=${t} style=${`--live-soc:${s}`} @click=${l=>l.currentTarget.classList.toggle("live-open")}>
|
||||||
${o.picture?m`<img class="live-cover" src=${o.picture} alt="" loading="lazy" />`:m`<div class="live-cover live-cover-none">♪</div>`}
|
${o.picture?m`<img class="live-cover" src=${o.picture} alt="" loading="lazy" />`:m`<div class="live-cover live-cover-none">♪</div>`}
|
||||||
<div class="live-rows">
|
<div class="live-rows">
|
||||||
<div class="live-title" title=${o.title}>${o.title||o.name}</div>
|
<div class="live-title" title=${o.title}>${o.title||o.name}</div>
|
||||||
@@ -865,7 +865,7 @@ A plugin runs with the same rights as NextFloor in your browser. The file has be
|
|||||||
/>`:f}
|
/>`:f}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>`}function cc(r){let e=[...r.querySelectorAll(".live-card")].filter(i=>i.style.visibility!=="hidden"),t=[],n=e[0]?.parentElement?.clientWidth??0,o=e.map(i=>{let[s,a]=[Number(i.dataset.x),i.offsetWidth],l=n?n>a+16?Math.min(Math.max(s,a/2+8),n-a/2-8):n/2:s;return i.style.setProperty("--live-dx",`${Math.round(s-l)}px`),{el:i,x:l,y:Number(i.dataset.y),w:a,h:i.offsetHeight}}).sort((i,s)=>s.y-i.y);for(let i of o){let s=i.y;for(let l=0;l<12;l++){let c={x0:i.x-i.w/2,x1:i.x+i.w/2,y0:s-i.h,y1:s},u=t.find(d=>c.x0<d.x1+6&&c.x1>d.x0-6&&c.y0<d.y1+6&&c.y1>d.y0-6);if(!u)break;s=u.y0-8}t.push({x0:i.x-i.w/2,x1:i.x+i.w/2,y0:s-i.h,y1:s});let a=i.y-s;i.el.style.transform=`translate(${Math.round(i.x)}px, ${Math.round(s)}px) translate(-50%, -100%)`,i.el.style.setProperty("--live-thread",`${Math.round(18+a)}px`)}}function tm(r,e,t){let n=e.printer,o=(c,u)=>R(r,c,u),i=n.progress??0,s=c=>new Intl.DateTimeFormat(r?.language??navigator.language,{hour:"2-digit",minute:"2-digit"}).format(new Date(c)),a=n.remaining!==null?n.remaining>=60?`${Math.floor(n.remaining/60)} h ${Math.round(n.remaining%60)} min`:`${Math.round(n.remaining)} min`:null,l=[n.nozzle!==null?`${o("printer_nozzle")} ${Math.round(n.nozzle)}\xB0`:null,n.bed!==null?`${o("printer_bed")} ${Math.round(n.bed)}\xB0`:null].filter(Boolean).join(" \xB7 ");return m`<div class="live-card live-card-printer ${n.printing?"live-charging":""}" data-i=${t}>
|
</div>`}function uc(r){let e=[...r.querySelectorAll(".live-card")].filter(i=>i.style.visibility!=="hidden"),t=[],n=e[0]?.parentElement?.clientWidth??0,o=e.map(i=>{let[s,a]=[Number(i.dataset.x),i.offsetWidth],l=n?n>a+16?Math.min(Math.max(s,a/2+8),n-a/2-8):n/2:s;return i.style.setProperty("--live-dx",`${Math.round(s-l)}px`),{el:i,x:l,y:Number(i.dataset.y),w:a,h:i.offsetHeight}}).sort((i,s)=>s.y-i.y);for(let i of o){let s=i.y;for(let l=0;l<12;l++){let c={x0:i.x-i.w/2,x1:i.x+i.w/2,y0:s-i.h,y1:s},u=t.find(d=>c.x0<d.x1+6&&c.x1>d.x0-6&&c.y0<d.y1+6&&c.y1>d.y0-6);if(!u)break;s=u.y0-8}t.push({x0:i.x-i.w/2,x1:i.x+i.w/2,y0:s-i.h,y1:s});let a=i.y-s;i.el.style.transform=`translate(${Math.round(i.x)}px, ${Math.round(s)}px) translate(-50%, -100%)`,i.el.style.setProperty("--live-thread",`${Math.round(18+a)}px`)}}function nm(r,e,t){let n=e.printer,o=(c,u)=>R(r,c,u),i=n.progress??0,s=c=>new Intl.DateTimeFormat(r?.language??navigator.language,{hour:"2-digit",minute:"2-digit"}).format(new Date(c)),a=n.remaining!==null?n.remaining>=60?`${Math.floor(n.remaining/60)} h ${Math.round(n.remaining%60)} min`:`${Math.round(n.remaining)} min`:null,l=[n.nozzle!==null?`${o("printer_nozzle")} ${Math.round(n.nozzle)}\xB0`:null,n.bed!==null?`${o("printer_bed")} ${Math.round(n.bed)}\xB0`:null].filter(Boolean).join(" \xB7 ");return m`<div class="live-card live-card-printer ${n.printing?"live-charging":""}" data-i=${t}>
|
||||||
<div class="live-own">
|
<div class="live-own">
|
||||||
${n.picture?m`<img class="live-print-pic" src=${n.picture} alt="" />`:fn(i/100,n.printing?"#38bdf8":"#8aa0c8")}
|
${n.picture?m`<img class="live-print-pic" src=${n.picture} alt="" />`:fn(i/100,n.printing?"#38bdf8":"#8aa0c8")}
|
||||||
<div class="live-own-text"><b>${n.progress!==null?`${Math.round(i)} %`:"\u2013"}</b><span>${o(`printer_${n.printing?"printing":/finish|complete|fertig/.test(n.status)?"done":/pause/.test(n.status)?"paused":/error|fail/.test(n.status)?"error":"idle"}`)}</span></div>
|
<div class="live-own-text"><b>${n.progress!==null?`${Math.round(i)} %`:"\u2013"}</b><span>${o(`printer_${n.printing?"printing":/finish|complete|fertig/.test(n.status)?"done":/pause/.test(n.status)?"paused":/error|fail/.test(n.status)?"error":"idle"}`)}</span></div>
|
||||||
@@ -878,7 +878,7 @@ A plugin runs with the same rights as NextFloor in your browser. The file has be
|
|||||||
${l?m`<div class="live-status">🌡 ${l}</div>`:f}
|
${l?m`<div class="live-status">🌡 ${l}</div>`:f}
|
||||||
${n.filaments.length?m`<div class="live-filaments">${n.filaments.map(c=>m`<i style=${`background:${c}`}></i>`)}</div>`:f}
|
${n.filaments.length?m`<div class="live-filaments">${n.filaments.map(c=>m`<i style=${`background:${c}`}></i>`)}</div>`:f}
|
||||||
</div>
|
</div>
|
||||||
</div>`}function nm(r,e,t){let n=e.pump,o=a=>R(r,a),i=a=>a===null?"\u2013":`${O(r,a,1)}\xB0`,s={heating:"\u{1F525}",water:"\u{1F6BF}",cooling:"\u2744",defrost:"\u{1F9CA}",idle:"\u23F8"}[n.mode];return m`<div class="live-card live-card-heatpump ${n.mode==="idle"?"":"live-charging"}" data-i=${t}>
|
</div>`}function rm(r,e,t){let n=e.pump,o=a=>R(r,a),i=a=>a===null?"\u2013":`${O(r,a,1)}\xB0`,s={heating:"\u{1F525}",water:"\u{1F6BF}",cooling:"\u2744",defrost:"\u{1F9CA}",idle:"\u23F8"}[n.mode];return m`<div class="live-card live-card-heatpump ${n.mode==="idle"?"":"live-charging"}" data-i=${t}>
|
||||||
<div class="live-own">
|
<div class="live-own">
|
||||||
${fn(Math.min(1,(n.cop??0)/6),(n.cop??0)>=3.5?"#4ade80":(n.cop??0)>=2.5?"#facc15":"#fb923c")}
|
${fn(Math.min(1,(n.cop??0)/6),(n.cop??0)>=3.5?"#4ade80":(n.cop??0)>=2.5?"#facc15":"#fb923c")}
|
||||||
<div class="live-own-text"><b>${n.cop!==null?O(r,n.cop,1):s}</b><span>${n.cop!==null?"COP":""}</span></div>
|
<div class="live-own-text"><b>${n.cop!==null?O(r,n.cop,1):s}</b><span>${n.cop!==null?"COP":""}</span></div>
|
||||||
@@ -891,9 +891,9 @@ A plugin runs with the same rights as NextFloor in your browser. The file has be
|
|||||||
${n.power!==null?m`<div class="live-row live-house"><span>${o("heatpump_power")}</span><b>${Me(r,n.power)}</b></div>`:f}
|
${n.power!==null?m`<div class="live-row live-house"><span>${o("heatpump_power")}</span><b>${Me(r,n.power)}</b></div>`:f}
|
||||||
${n.outside!==null?m`<div class="live-status">🌡 ${o("heatpump_outside")} ${i(n.outside)}</div>`:f}
|
${n.outside!==null?m`<div class="live-status">🌡 ${o("heatpump_outside")} ${i(n.outside)}</div>`:f}
|
||||||
</div>
|
</div>
|
||||||
</div>`}function uc(r,e,t,n){return e.length?m`<div class="live-cards">
|
</div>`}function dc(r,e,t,n){return e.length?m`<div class="live-cards">
|
||||||
${e.map((o,i)=>o.kind==="house"?Yp(r,o,i,n):o.kind==="car"?Xp(r,o,i,t):o.kind==="printer"?tm(r,o,i):o.kind==="heatpump"?nm(r,o,i):em(r,o,i,t))}
|
${e.map((o,i)=>o.kind==="house"?Jp(r,o,i,n):o.kind==="car"?em(r,o,i,t):o.kind==="printer"?nm(r,o,i):o.kind==="heatpump"?rm(r,o,i):tm(r,o,i,t))}
|
||||||
</div>`:f}var dc=te`
|
</div>`:f}var hc=te`
|
||||||
.live-cards {
|
.live-cards {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
inset: 0;
|
inset: 0;
|
||||||
@@ -1199,7 +1199,7 @@ A plugin runs with the same rights as NextFloor in your browser. The file has be
|
|||||||
text-transform: uppercase;
|
text-transform: uppercase;
|
||||||
letter-spacing: 0.04em;
|
letter-spacing: 0.04em;
|
||||||
}
|
}
|
||||||
`;function $r(r){return r.toLocaleLowerCase().normalize("NFD").replace(new RegExp("\\p{M}","gu"),"")}var ri=r=>r.points.length>=3;function hc(r,e,t){return r.rooms.filter(ri).find(n=>H([e,t],n.points))}function rm(r,e,t,n){let o=[];for(let a of e.rooms.filter(ri)){let[l,c]=We(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 d=hc(e,l,c),p=[d?.name,n?e.name:void 0].filter(h=>!!h).join(" \xB7 ");o.push({kind:"device",name:L(r,a),where:p,floorId:e.id,roomId:d?.id??null,entity:a,icon:D(a),x:l,z:c,y:u})};for(let a of e.placements){let l=a.y??_t(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=hc(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 pc(r,e){let t=nt(r,e.floors),n=e.floors.length>1,o=e.floors.flatMap(i=>rm(r,i,t,n));for(let i of e.settings.circuits??[]){let s=e.floors.flatMap(d=>d.rooms.filter(p=>i.rooms.includes(p.id)&&ri(p)).map(p=>({f:d,r:p})));if(!s.length)continue;let[{f:a,r:l}]=s,[c,u]=We(l.points);o.push({kind:"circuit",name:`\u{1F50C} ${i.name}`,where:s.map(d=>d.r.name).join(", "),floorId:a.id,roomId:l.id,entity:null,icon:null,x:c,z:u,y:0})}return o}function om(r,e){return($r(r.name).startsWith(e)?0:2)+(r.kind==="room"?0:1)}function mc(r,e,t=8){let n=$r(e).split(/\s+/).filter(Boolean);if(n.length===0)return[];let o=$r(e.trim());return r.filter(i=>{let s=$r([i.name,i.where,i.entity].filter(Boolean).join(" "));return n.every(a=>s.includes(a))}).map(i=>({item:i,cost:om(i,o)})).sort((i,s)=>i.cost-s.cost||i.item.name.localeCompare(s.item.name)).slice(0,t).map(i=>i.item)}var im=[[255,181,71],[255,236,210],[55,224,255],[91,124,255],[190,90,255],[255,95,210],[255,70,70],[120,255,150]],sm=[2200,2700,3200,4e3,5e3,6500],am=["hs","rgb","rgbw","rgbww","xy"],lm=4,fc=16,gc=32,cm=128;function ii(r){let e=r.attributes.supported_color_modes??[],t=e.some(n=>am.includes(n));return{dim:e.some(n=>n!=="onoff"),color:t,temp:e.includes("color_temp")}}function si(r){return((r.attributes.supported_features??0)&lm)!==0&&typeof r.attributes.current_position=="number"}var oi=class extends re{static properties={hass:{attribute:!1},entity:{attribute:!1},car:{attribute:!1},presets:{attribute:!1},confirmSwitch:{type:Boolean},myPosition:{attribute:!1},low:{type:Boolean,reflect:!0}};t(e,t){return R(this.hass,e,t)}ask(){return!this.confirmSwitch||confirm(this.t("confirm_switch",{name:L(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=ii(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?im.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?sm.map(s=>m`<button class="qm-swatch" style="background:${um(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 Ar(r){return r.toLocaleLowerCase().normalize("NFD").replace(new RegExp("\\p{M}","gu"),"")}var ri=r=>r.points.length>=3;function pc(r,e,t){return r.rooms.filter(ri).find(n=>H([e,t],n.points))}function om(r,e,t,n){let o=[];for(let a of e.rooms.filter(ri)){let[l,c]=We(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 d=pc(e,l,c),p=[d?.name,n?e.name:void 0].filter(h=>!!h).join(" \xB7 ");o.push({kind:"device",name:L(r,a),where:p,floorId:e.id,roomId:d?.id??null,entity:a,icon:D(a),x:l,z:c,y:u})};for(let a of e.placements){let l=a.y??_t(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=pc(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 mc(r,e){let t=nt(r,e.floors),n=e.floors.length>1,o=e.floors.flatMap(i=>om(r,i,t,n));for(let i of e.settings.circuits??[]){let s=e.floors.flatMap(d=>d.rooms.filter(p=>i.rooms.includes(p.id)&&ri(p)).map(p=>({f:d,r:p})));if(!s.length)continue;let[{f:a,r:l}]=s,[c,u]=We(l.points);o.push({kind:"circuit",name:`\u{1F50C} ${i.name}`,where:s.map(d=>d.r.name).join(", "),floorId:a.id,roomId:l.id,entity:null,icon:null,x:c,z:u,y:0})}return o}function im(r,e){return(Ar(r.name).startsWith(e)?0:2)+(r.kind==="room"?0:1)}function fc(r,e,t=8){let n=Ar(e).split(/\s+/).filter(Boolean);if(n.length===0)return[];let o=Ar(e.trim());return r.filter(i=>{let s=Ar([i.name,i.where,i.entity].filter(Boolean).join(" "));return n.every(a=>s.includes(a))}).map(i=>({item:i,cost:im(i,o)})).sort((i,s)=>i.cost-s.cost||i.item.name.localeCompare(s.item.name)).slice(0,t).map(i=>i.item)}var sm=[[255,181,71],[255,236,210],[55,224,255],[91,124,255],[190,90,255],[255,95,210],[255,70,70],[120,255,150]],am=[2200,2700,3200,4e3,5e3,6500],lm=["hs","rgb","rgbw","rgbww","xy"],cm=4,gc=16,_c=32,um=128;function ii(r){let e=r.attributes.supported_color_modes??[],t=e.some(n=>lm.includes(n));return{dim:e.some(n=>n!=="onoff"),color:t,temp:e.includes("color_temp")}}function si(r){return((r.attributes.supported_features??0)&cm)!==0&&typeof r.attributes.current_position=="number"}var oi=class extends re{static properties={hass:{attribute:!1},entity:{attribute:!1},car:{attribute:!1},presets:{attribute:!1},confirmSwitch:{type:Boolean},myPosition:{attribute:!1},low:{type:Boolean,reflect:!0}};t(e,t){return R(this.hass,e,t)}ask(){return!this.confirmSwitch||confirm(this.t("confirm_switch",{name:L(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=ii(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?sm.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?am.map(s=>m`<button class="qm-swatch" style="background:${dm(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)}
|
${this.ring(i)}
|
||||||
<button class="qm-power ${n?"qm-on":""}" aria-pressed=${n} @click=${()=>this.ask()&&this.call("light","toggle")}>
|
<button class="qm-power ${n?"qm-on":""}" aria-pressed=${n} @click=${()=>this.ask()&&this.call("light","toggle")}>
|
||||||
<svg viewBox="0 0 24 24" width="22" height="22" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round"><path d="M12 3v8M6.3 6.8a8 8 0 1 0 11.4 0" /></svg>
|
<svg viewBox="0 0 24 24" width="22" height="22" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round"><path d="M12 3v8M6.3 6.8a8 8 0 1 0 11.4 0" /></svg>
|
||||||
@@ -1236,7 +1236,7 @@ A plugin runs with the same rights as NextFloor in your browser. The file has be
|
|||||||
aria-label=${this.t("position")}
|
aria-label=${this.t("position")}
|
||||||
@change=${u=>this.call("cover","set_cover_position",{position:Number(u.target.value)})}
|
@change=${u=>this.call("cover","set_cover_position",{position:Number(u.target.value)})}
|
||||||
/>`:f}
|
/>`:f}
|
||||||
${this.renderTilt(e)}`}renderTilt(e){let t=(e.attributes.supported_features??0)|0,n=typeof e.attributes.current_tilt_position=="number"?e.attributes.current_tilt_position:null;return t&cm&&n!==null?m`<label class="qm-tilt"
|
${this.renderTilt(e)}`}renderTilt(e){let t=(e.attributes.supported_features??0)|0,n=typeof e.attributes.current_tilt_position=="number"?e.attributes.current_tilt_position:null;return t&um&&n!==null?m`<label class="qm-tilt"
|
||||||
><span>${this.t("cover_tilt")} · ${n} %</span>
|
><span>${this.t("cover_tilt")} · ${n} %</span>
|
||||||
<input
|
<input
|
||||||
class="qm-slider"
|
class="qm-slider"
|
||||||
@@ -1246,9 +1246,9 @@ A plugin runs with the same rights as NextFloor in your browser. The file has be
|
|||||||
.value=${String(n)}
|
.value=${String(n)}
|
||||||
aria-label=${this.t("cover_tilt")}
|
aria-label=${this.t("cover_tilt")}
|
||||||
@change=${o=>this.call("cover","set_cover_tilt_position",{tilt_position:Number(o.target.value)})}
|
@change=${o=>this.call("cover","set_cover_tilt_position",{tilt_position:Number(o.target.value)})}
|
||||||
/></label>`:t&(fc|gc)?m`<div class="qm-tilt-buttons">
|
/></label>`:t&(gc|_c)?m`<div class="qm-tilt-buttons">
|
||||||
${t&fc?m`<button class="qm-swatch qm-slot" @click=${()=>this.call("cover","open_cover_tilt")}>${this.t("cover_tilt_open")}</button>`:f}
|
${t&gc?m`<button class="qm-swatch qm-slot" @click=${()=>this.call("cover","open_cover_tilt")}>${this.t("cover_tilt_open")}</button>`:f}
|
||||||
${t&gc?m`<button class="qm-swatch qm-slot" @click=${()=>this.call("cover","close_cover_tilt")}>${this.t("cover_tilt_close")}</button>`:f}
|
${t&_c?m`<button class="qm-swatch qm-slot" @click=${()=>this.call("cover","close_cover_tilt")}>${this.t("cover_tilt_close")}</button>`:f}
|
||||||
</div>`:f}renderToggle(e){let t=e.state==="on"||e.state==="unlocked"||e.state==="playing",n=e.entity_id.split(".")[0];return m`<div class="qm-ring qm-ring-small">
|
</div>`:f}renderToggle(e){let t=e.state==="on"||e.state==="unlocked"||e.state==="playing",n=e.entity_id.split(".")[0];return m`<div class="qm-ring qm-ring-small">
|
||||||
<button
|
<button
|
||||||
class="qm-power ${t?"qm-on":""}"
|
class="qm-power ${t?"qm-on":""}"
|
||||||
@@ -1517,9 +1517,9 @@ A plugin runs with the same rights as NextFloor in your browser. The file has be
|
|||||||
.qm-note {
|
.qm-note {
|
||||||
color: var(--nf-muted);
|
color: var(--nf-muted);
|
||||||
}
|
}
|
||||||
`]};function um(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",oi);var dm=new URL(import.meta.url),hm=new URL("./nextfloor-3d.js?v=473b84f8bac7",dm).href,_c;function bc(){return _c??=import(hm),_c}function wc(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 pm=new Set(["on","home","open","true","active","playing","heat","heating"]);function Ar(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):pm.has(o)||Number.isFinite(Number(o))&&Number(o)>0;return t.invert?!s:s}function ai(r,e){let t=[];for(let n of e.floors)for(let o of n.furniture)Ar(r,o)||t.push(o.id);return t.sort()}function vc(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 yc="image:";function li(r,e,t){let n=(e??"").trim();if(!n)return null;if(n.startsWith(yc))return t(n.slice(yc.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 gn=r=>Number(r);function bn(r){if(Array.isArray(r)){let[i,s]=[gn(r[0]),gn(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]=[gn(e),gn(t)];return Number.isFinite(n)&&Number.isFinite(o)?[n,o]:null}function xc(r){return r?bn(r.charger)??bn(r.charger_position):null}function kc(r){for(let[e,t]of Object.entries(r.states))if(e.startsWith("camera.")&&(bn(t.attributes?.vacuum_position)??xc(t.attributes)))return e;return null}var mm=r=>Array.isArray(r)?typeof r[0]=="number":!!r&&typeof r=="object",_n=(r,e)=>e?[r[0],-r[1]]:r;function fm(r){if(!r)return null;let e=r.mirror===!0,[t,n]=_n(r.ga,e),[o,i]=_n(r.gb,e),[s,a]=r.a,[l,c]=r.b,[u,d]=[o-t,i-n],[p,h]=[l-s,c-a],w=Math.hypot(u,d),b=Math.hypot(p,h);if(!(w>1e-6)||!(b>1e-6))return null;let g=b/w,_=Math.atan2(h,p)-Math.atan2(d,u),[M,$]=[Math.cos(_),Math.sin(_)];return x=>{let y=_n(x,e),[F,T]=[y[0]-t,y[1]-n];return[s+g*(F*M-T*$),a+g*(F*$+T*M)]}}function gm(r){if(!r)return null;let e=r.mirror===!0,[t,n]=_n(r.ga,e),[o,i]=_n(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 Sc(r,e,t){if(!e)return null;let n=r.states[e]?.attributes;if(!n)return null;let o=fm(t)??(w=>w),i=gm(t)??0,s=t?.mirror===!0?-1:1,a=n.vacuum_position,l=bn(a),c=l?(()=>{let[w,b]=o(l),g=gn(a?.a)*s;if(!Number.isFinite(g))return{x:w,z:b,heading:0};let _=g*Math.PI/180+i;return{x:w,z:b,heading:Math.atan2(Math.cos(_),Math.sin(_))}})():null,u=xc(n),d=Array.isArray(n.path)?n.path:[],p=d.length>0&&mm(d[0])?[d]:d,h=[];for(let w of p){let b=[];for(let g of Array.isArray(w)?w:[]){let _=bn(g);_&&b.push(o(_))}b.length>1&&h.push(b)}return!c&&!u&&!h.length?null:{pose:c,charger:u?o(u):null,path:h}}var Mc="nextfloor.lock3d",$c=520,ui=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 dm(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",oi);var hm=new URL(import.meta.url),pm=new URL("./nextfloor-3d.js?v=473b84f8bac7",hm).href,bc;function wc(){return bc??=import(pm),bc}function vc(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 Er(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 ai(r,e){let t=[];for(let n of e.floors)for(let o of n.furniture)Er(r,o)||t.push(o.id);return t.sort()}function yc(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 xc="image:";function li(r,e,t){let n=(e??"").trim();if(!n)return null;if(n.startsWith(xc))return t(n.slice(xc.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 gn=r=>Number(r);function bn(r){if(Array.isArray(r)){let[i,s]=[gn(r[0]),gn(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]=[gn(e),gn(t)];return Number.isFinite(n)&&Number.isFinite(o)?[n,o]:null}function kc(r){return r?bn(r.charger)??bn(r.charger_position):null}function Sc(r){for(let[e,t]of Object.entries(r.states))if(e.startsWith("camera.")&&(bn(t.attributes?.vacuum_position)??kc(t.attributes)))return e;return null}var fm=r=>Array.isArray(r)?typeof r[0]=="number":!!r&&typeof r=="object",_n=(r,e)=>e?[r[0],-r[1]]:r;function gm(r){if(!r)return null;let e=r.mirror===!0,[t,n]=_n(r.ga,e),[o,i]=_n(r.gb,e),[s,a]=r.a,[l,c]=r.b,[u,d]=[o-t,i-n],[p,h]=[l-s,c-a],w=Math.hypot(u,d),b=Math.hypot(p,h);if(!(w>1e-6)||!(b>1e-6))return null;let g=b/w,_=Math.atan2(h,p)-Math.atan2(d,u),[M,$]=[Math.cos(_),Math.sin(_)];return x=>{let y=_n(x,e),[F,T]=[y[0]-t,y[1]-n];return[s+g*(F*M-T*$),a+g*(F*$+T*M)]}}function _m(r){if(!r)return null;let e=r.mirror===!0,[t,n]=_n(r.ga,e),[o,i]=_n(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 Mc(r,e,t){if(!e)return null;let n=r.states[e]?.attributes;if(!n)return null;let o=gm(t)??(w=>w),i=_m(t)??0,s=t?.mirror===!0?-1:1,a=n.vacuum_position,l=bn(a),c=l?(()=>{let[w,b]=o(l),g=gn(a?.a)*s;if(!Number.isFinite(g))return{x:w,z:b,heading:0};let _=g*Math.PI/180+i;return{x:w,z:b,heading:Math.atan2(Math.cos(_),Math.sin(_))}})():null,u=kc(n),d=Array.isArray(n.path)?n.path:[],p=d.length>0&&fm(d[0])?[d]:d,h=[];for(let w of p){let b=[];for(let g of Array.isArray(w)?w:[]){let _=bn(g);_&&b.push(o(_))}b.length>1&&h.push(b)}return!c&&!u&&!h.length?null:{pose:c,charger:u?o(u):null,path:h}}var $c="nextfloor.lock3d",Ac=520,ui=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>`)}
|
${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?Mt(this.hass,o.history,o.t):this.hass;if((e||!this.openingLinks||this.linkedRegistry!==i.entities)&&(this.openingLinks=Ut(i,n.floors),this.furnitureLinks=nt(i,n.floors),this.linkedRegistry=i.entities,this.findIndex=null,this.alertSrc=this.alerts?gl(i,n,this.weatherEntityId,this.openingLinks):null,this.watched=kl({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(v=>this.shownStates.get(v)!==i.states[v])))return;ai(i,n).join(",")!==this.shownFor?.key&&t.setBuilding(this.shownBuilding(i)),this.shownStates=new Map(this.watched.map(v=>[v,i.states[v]])),this.refreshToday(n),this.refreshForecast(n);let a=Xt(i,n),l=ra(i,n.floors.some(v=>v.layer&&this.hiddenLayers.has(v.id))?this.shownBuilding(i):n);this.placementInfo=new Map(l.map(v=>[v.id,{floorId:v.floorId,roomId:v.roomId,x:v.x,z:v.z,y:v.y,rotation:v.rotation??0}]));let c=this.furnitureMarkers(i,n,new Set(l.map(v=>v.id)),new Set(a.map(v=>v.powerEntity)));a.push(...c.consumers);let u=en(i,n,a,Fe(n,v=>this.furnitureLinks?.get(v.id)?.power??null)),d=new Map(a.filter(v=>v.id!==v.powerEntity).map(v=>[v.id,v.power]));this.confirmSet=rt(i,n.floors);let p=new Set(this.liveCardsOn?this._liveCards.flatMap(v=>v.kind==="media"?[v.media.entity]:v.kind==="car"?[v.spot]:[]):[]);for(let v of n.floors)for(let k of v.outdoor??[]){if(!k.area_id&&!k.temp_entity&&!k.pump_entity)continue;let B=k.temp_entity?i.states[k.temp_entity]:void 0,z=k.pump_entity?i.states[k.pump_entity]:void 0,[W,de]=We(k.points),je=B&&Number.isFinite(Number(B.state))?`${O(i,ue(i,Vn(Number(B.state),B.attributes.unit_of_measurement)),1)} ${ne(i)}`:"",lt=!!z&&Q(z);l.push({id:k.area_id?`outdoor:${k.id}`:k.pump_entity??k.temp_entity,floorId:v.id,roomId:null,x:W,z:de,y:Cn(v,k,W,de)+.7,icon:xe(k.type==="pool"?"pool":k.type==="terrace"?"table-chair":"tree-outline"),name:k.area_id&&i.areas?.[k.area_id]?.name||R(i,`out_${k.type}`),text:[je,lt?R(i,"pool_pump_on"):""].filter(Boolean).join(" \xB7 "),active:lt,unavailable:!1,glow:null,show:"always"})}let h=new Map;for(let v of n.floors){for(let k of v.placements)k.pin_offset&&h.set(`${v.id}:${k.entity_id}`,k.pin_offset);for(let k of v.furniture)k.pin_offset&&h.set(`f:${k.id}`,k.pin_offset)}let w=v=>{let k=v.lamp?void 0:(v.furnitureId?h.get(`f:${v.furnitureId}`):void 0)??h.get(`${v.floorId}:${v.id}`);return k?{...v,x:v.x+(k.x??0),z:v.z+(k.z??0),y:v.y+(k.y??0)}:v};t.setDevices([...[...l,...c.markers].map(w).map(v=>{let k=v.show==="no_power"||"energyDevice"in v&&v.energyDevice?null:d.get(v.id)??null,B={...v,power:k,powerText:k===null?void 0:se(i,k),effect:this.dimmed?void 0:v.effect,text:this.subMeterText(i,n,u,v.furnitureId)??v.text},z=v.ownName&&(v.showName||this.markerNames)?v.ownName:"",W=p.has(v.id)||!!v.furnitureId&&p.has(v.furnitureId);return{...B,pin:this.showPin(B)&&!W,full:v.show==="always",caption:z}})]),t.setPickTargets(c.targets,this.openingTargets(),this.secondBlinds()),t.setScreens(c.screens),t.setFridgeDoors(Ns(i,n.floors)),t.setCovers(Zs(i,n)),t.setRobots(this.robotInfos(i,n));let b=new Map;for(let v of n.floors)for(let k of v.furniture)!q(k.type)?.pet||!k.room_sensor||k.room_sensor==="none"||b.set(k.id,fo(i,v.rooms.filter(B=>B.points.length>=3),null,k.room_sensor)?.id??null);b.size&&t.setPetRooms(b),t.setRoofWindows(dl(i,n)),t.setParked(Lo(i,n)),t.setGateStates(Rl(i,n));let g=new Map(n.floors.flatMap(v=>v.openings.map(k=>[k.id,k.type]))),_=new Map([...this.openingLinks].map(([v,k])=>[v,Ee(i,k,g.get(v))]));t.setOpeningStates(_),this.setAlerts(this.alertSrc?No(i,n,this.alertSrc,this.openingLinks):[]),this.watchLostContacts(i);let M=[...l,...c.markers].map(v=>`${v.id}:${v.glow?`${v.glow.level.toFixed(1)}/${v.glow.color.map(k=>k.toFixed(1)).join("/")}`:0}`).join(";")+"|"+[..._].map(([v,k])=>`${v}:${k.open}:${k.cover===null?"-":k.cover.toFixed(1)}`).join(";");if(M!==this.thumbSig){let v=this.thumbSig==="";this.thumbSig=M,v||this.scheduleThumbs(1500)}let $=Kl(i,n,a,n.energy.advanced?v=>this.furnitureLinks?.get(v.id)?.power??null:void 0),x=this.liveCars(i,n);for(let v of x){if(!v.car.home||!v.car.charging&&!v.car.plugged)continue;let k=n.floors.flatMap(W=>W.furniture.filter(de=>de.type==="wallbox").map(de=>({floorId:W.id,x:de.x,z:de.z,y:1}))).sort((W,de)=>Math.hypot(W.x-v.at.x,W.z-v.at.z)-Math.hypot(de.x-v.at.x,de.z-v.at.z))[0],B=k&&k.floorId===v.at.floorId&&Math.hypot(k.x-v.at.x,k.z-v.at.z)<9,z=k??hn(n);!z||!v.car.charging&&!B||$.arcs.push({key:`car:${v.spot}`,from:z,to:{...v.at,y:.8},power:v.car.charging?v.car.chargingW??7e3:0,color:[80,175,255],...B?{via:[{...z,y:.35},{floorId:v.at.floorId,x:(z.x+v.at.x)/2,z:(z.z+v.at.z)/2,y:.08},{...v.at,y:.5}],cable:!0}:{}})}let y=hn(n);for(let v of this.liveHeatPumps(n)){let k=v.pump.heat??(v.pump.mode==="heating"||v.puLine 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?Mt(this.hass,o.history,o.t):this.hass;if((e||!this.openingLinks||this.linkedRegistry!==i.entities)&&(this.openingLinks=Ut(i,n.floors),this.furnitureLinks=nt(i,n.floors),this.linkedRegistry=i.entities,this.findIndex=null,this.alertSrc=this.alerts?_l(i,n,this.weatherEntityId,this.openingLinks):null,this.watched=Sl({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(v=>this.shownStates.get(v)!==i.states[v])))return;ai(i,n).join(",")!==this.shownFor?.key&&t.setBuilding(this.shownBuilding(i)),this.shownStates=new Map(this.watched.map(v=>[v,i.states[v]])),this.refreshToday(n),this.refreshForecast(n);let a=Xt(i,n),l=oa(i,n.floors.some(v=>v.layer&&this.hiddenLayers.has(v.id))?this.shownBuilding(i):n);this.placementInfo=new Map(l.map(v=>[v.id,{floorId:v.floorId,roomId:v.roomId,x:v.x,z:v.z,y:v.y,rotation:v.rotation??0}]));let c=this.furnitureMarkers(i,n,new Set(l.map(v=>v.id)),new Set(a.map(v=>v.powerEntity)));a.push(...c.consumers);let u=en(i,n,a,Fe(n,v=>this.furnitureLinks?.get(v.id)?.power??null)),d=new Map(a.filter(v=>v.id!==v.powerEntity).map(v=>[v.id,v.power]));this.confirmSet=rt(i,n.floors);let p=new Set(this.liveCardsOn?this._liveCards.flatMap(v=>v.kind==="media"?[v.media.entity]:v.kind==="car"?[v.spot]:[]):[]);for(let v of n.floors)for(let k of v.outdoor??[]){if(!k.area_id&&!k.temp_entity&&!k.pump_entity)continue;let B=k.temp_entity?i.states[k.temp_entity]:void 0,z=k.pump_entity?i.states[k.pump_entity]:void 0,[W,de]=We(k.points),je=B&&Number.isFinite(Number(B.state))?`${O(i,ue(i,Kn(Number(B.state),B.attributes.unit_of_measurement)),1)} ${ne(i)}`:"",lt=!!z&&Q(z);l.push({id:k.area_id?`outdoor:${k.id}`:k.pump_entity??k.temp_entity,floorId:v.id,roomId:null,x:W,z:de,y:Nn(v,k,W,de)+.7,icon:xe(k.type==="pool"?"pool":k.type==="terrace"?"table-chair":"tree-outline"),name:k.area_id&&i.areas?.[k.area_id]?.name||R(i,`out_${k.type}`),text:[je,lt?R(i,"pool_pump_on"):""].filter(Boolean).join(" \xB7 "),active:lt,unavailable:!1,glow:null,show:"always"})}let h=new Map;for(let v of n.floors){for(let k of v.placements)k.pin_offset&&h.set(`${v.id}:${k.entity_id}`,k.pin_offset);for(let k of v.furniture)k.pin_offset&&h.set(`f:${k.id}`,k.pin_offset)}let w=v=>{let k=v.lamp?void 0:(v.furnitureId?h.get(`f:${v.furnitureId}`):void 0)??h.get(`${v.floorId}:${v.id}`);return k?{...v,x:v.x+(k.x??0),z:v.z+(k.z??0),y:v.y+(k.y??0)}:v};t.setDevices([...[...l,...c.markers].map(w).map(v=>{let k=v.show==="no_power"||"energyDevice"in v&&v.energyDevice?null:d.get(v.id)??null,B={...v,power:k,powerText:k===null?void 0:se(i,k),effect:this.dimmed?void 0:v.effect,text:this.subMeterText(i,n,u,v.furnitureId)??v.text},z=v.ownName&&(v.showName||this.markerNames)?v.ownName:"",W=p.has(v.id)||!!v.furnitureId&&p.has(v.furnitureId);return{...B,pin:this.showPin(B)&&!W,full:v.show==="always",caption:z}})]),t.setPickTargets(c.targets,this.openingTargets(),this.secondBlinds()),t.setScreens(c.screens),t.setFridgeDoors(Os(i,n.floors)),t.setCovers(Ys(i,n)),t.setRobots(this.robotInfos(i,n));let b=new Map;for(let v of n.floors)for(let k of v.furniture)!q(k.type)?.pet||!k.room_sensor||k.room_sensor==="none"||b.set(k.id,fo(i,v.rooms.filter(B=>B.points.length>=3),null,k.room_sensor)?.id??null);b.size&&t.setPetRooms(b),t.setRoofWindows(hl(i,n)),t.setParked(Lo(i,n)),t.setGateStates(zl(i,n));let g=new Map(n.floors.flatMap(v=>v.openings.map(k=>[k.id,k.type]))),_=new Map([...this.openingLinks].map(([v,k])=>[v,Ee(i,k,g.get(v))]));t.setOpeningStates(_),this.setAlerts(this.alertSrc?No(i,n,this.alertSrc,this.openingLinks):[]),this.watchLostContacts(i);let M=[...l,...c.markers].map(v=>`${v.id}:${v.glow?`${v.glow.level.toFixed(1)}/${v.glow.color.map(k=>k.toFixed(1)).join("/")}`:0}`).join(";")+"|"+[..._].map(([v,k])=>`${v}:${k.open}:${k.cover===null?"-":k.cover.toFixed(1)}`).join(";");if(M!==this.thumbSig){let v=this.thumbSig==="";this.thumbSig=M,v||this.scheduleThumbs(1500)}let $=Gl(i,n,a,n.energy.advanced?v=>this.furnitureLinks?.get(v.id)?.power??null:void 0),x=this.liveCars(i,n);for(let v of x){if(!v.car.home||!v.car.charging&&!v.car.plugged)continue;let k=n.floors.flatMap(W=>W.furniture.filter(de=>de.type==="wallbox").map(de=>({floorId:W.id,x:de.x,z:de.z,y:1}))).sort((W,de)=>Math.hypot(W.x-v.at.x,W.z-v.at.z)-Math.hypot(de.x-v.at.x,de.z-v.at.z))[0],B=k&&k.floorId===v.at.floorId&&Math.hypot(k.x-v.at.x,k.z-v.at.z)<9,z=k??hn(n);!z||!v.car.charging&&!B||$.arcs.push({key:`car:${v.spot}`,from:z,to:{...v.at,y:.8},power:v.car.charging?v.car.chargingW??7e3:0,color:[80,175,255],...B?{via:[{...z,y:.35},{floorId:v.at.floorId,x:(z.x+v.at.x)/2,z:(z.z+v.at.z)/2,y:.08},{...v.at,y:.5}],cable:!0}:{}})}let y=hn(n);for(let v of this.liveHeatPumps(n)){let k=v.pump.heat??(v.pump.mode==="heating"||v.puLine truncated
|
||||||
<button class="nf-thumbs-fold" title=${R(this.hass,n?"thumbs_show":"thumbs_fold")} aria-label=${R(this.hass,n?"thumbs_show":"thumbs_fold")} @click=${o}>${n?"\u25B8":"\u25C2"}</button>
|
<button class="nf-thumbs-fold" title=${R(this.hass,n?"thumbs_show":"thumbs_fold")} aria-label=${R(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})}>
|
<button class="nf-thumb nf-thumb-house" aria-pressed=${this.floorId===null} @click=${()=>this.fire("floor-tap",{floorId:null})}>
|
||||||
<svg viewBox="0 0 24 24" width="18" height="18" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linejoin="round"><path d="M3 11l9-7 9 7M5 10v10h14V10" /></svg>
|
<svg viewBox="0 0 24 24" width="18" height="18" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linejoin="round"><path d="M3 11l9-7 9 7M5 10v10h14V10" /></svg>
|
||||||
@@ -1529,7 +1529,7 @@ A plugin runs with the same rights as NextFloor in your browser. The file has be
|
|||||||
${n?f:m`<img src=${i.url} alt="" />`}
|
${n?f:m`<img src=${i.url} alt="" />`}
|
||||||
<span>${e.get(i.floorId)??""}</span>
|
<span>${e.get(i.floorId)??""}</span>
|
||||||
</button>`)}
|
</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"&&ii(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"&&si(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,ha(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()||!la(e,this.screenName)||!ca(e))return;let n=ua(e.message);this._announcement={message:e.message,until:Date.now()+n},clearTimeout(this.announceTimer),this.announceTimer=setTimeout(()=>this._announcement=null,n),da(this.hass,e)}renderAnnouncement(){let e=this._announcement;return e?m`<button class="nf-announcement" role="alert" title=${R(this.hass,"close")} @click=${()=>this._announcement=null}>
|
</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"&&ii(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"&&si(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,pa(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()||!ca(e,this.screenName)||!ua(e))return;let n=da(e.message);this._announcement={message:e.message,until:Date.now()+n},clearTimeout(this.announceTimer),this.announceTimer=setTimeout(()=>this._announcement=null,n),ha(this.hass,e)}renderAnnouncement(){let e=this._announcement;return e?m`<button class="nf-announcement" role="alert" title=${R(this.hass,"close")} @click=${()=>this._announcement=null}>
|
||||||
<span class="nf-announcement-icon" aria-hidden="true">📢</span><span class="nf-announcement-text">${e.message}</span>
|
<span class="nf-announcement-icon" aria-hidden="true">📢</span><span class="nf-announcement-text">${e.message}</span>
|
||||||
</button>`:f}renderAlerts(){let e=this.building;if(!this._alerts.length||!e)return f;let t=this._alerts.slice(0,3);return m`<div class="nf-alert-banner" role="alert">
|
</button>`:f}renderAlerts(){let e=this.building;if(!this._alerts.length||!e)return f;let t=this._alerts.slice(0,3);return 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=${Oo(this.hass,e,n)} @click=${()=>this.jumpTo(n)}>${Oo(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=${Oo(this.hass,e,n)} @click=${()=>this.jumpTo(n)}>${Oo(this.hass,e,n)}</button>`)}
|
||||||
@@ -1538,7 +1538,7 @@ A plugin runs with the same rights as NextFloor in your browser. The file has be
|
|||||||
${n.map(i=>m`<button class="nf-chip" aria-pressed=${this._sceneFired===i} @click=${()=>this.runScene(i)}>${L(this.hass,i,o)}</button>`)}
|
${n.map(i=>m`<button class="nf-chip" aria-pressed=${this._sceneFired===i} @click=${()=>this.runScene(i)}>${L(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=${R(this.hass,"find")} aria-label=${R(this.hass,"find")} @click=${()=>this._find=""}>
|
</div>`}renderFind(){let e=this.building;if(!e||!this.hass)return f;if(this._find===null)return m`<button class="nf-find-btn" title=${R(this.hass,"find")} aria-label=${R(this.hass,"find")} @click=${()=>this._find=""}>
|
||||||
<svg viewBox="0 0 24 24" width="18" height="18" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round"><circle cx="11" cy="11" r="6.5" /><path d="M16 16l4.5 4.5" /></svg>
|
<svg viewBox="0 0 24 24" width="18" height="18" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round"><circle cx="11" cy="11" r="6.5" /><path d="M16 16l4.5 4.5" /></svg>
|
||||||
</button>`;let t=mc(this.findIndex??=pc(this.hass,e),this._find);return m`<div class="nf-find">
|
</button>`;let t=fc(this.findIndex??=mc(this.hass,e),this._find);return m`<div class="nf-find">
|
||||||
<input
|
<input
|
||||||
type="search"
|
type="search"
|
||||||
placeholder=${R(this.hass,"find_placeholder")}
|
placeholder=${R(this.hass,"find_placeholder")}
|
||||||
@@ -1549,7 +1549,7 @@ A plugin runs with the same rights as NextFloor in your browser. The file has be
|
|||||||
<button class="nf-find-close" aria-label=${R(this.hass,"close")} @click=${()=>this._find=null}>✕</button>
|
<button class="nf-find-close" aria-label=${R(this.hass,"close")} @click=${()=>this._find=null}>✕</button>
|
||||||
${this._find.trim()?m`<div class="nf-find-list">
|
${this._find.trim()?m`<div class="nf-find-list">
|
||||||
${t.length?t.map(n=>m`<button @click=${()=>this.goTo(n)}>
|
${t.length?t.map(n=>m`<button @click=${()=>this.goTo(n)}>
|
||||||
<span class="nf-find-icon"><svg viewBox="0 0 24 24" width="16" height="16" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"><path d=${n.icon?er(n.icon):"M4 10l8-6 8 6v10H4z"} /></svg></span>
|
<span class="nf-find-icon"><svg viewBox="0 0 24 24" width="16" height="16" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"><path d=${n.icon?tr(n.icon):"M4 10l8-6 8 6v10H4z"} /></svg></span>
|
||||||
<span><b>${n.name}</b>${n.where?m`<small>${n.where}</small>`:f}</span>
|
<span><b>${n.name}</b>${n.where?m`<small>${n.where}</small>`:f}</span>
|
||||||
</button>`):m`<p>${R(this.hass,"find_none")}</p>`}
|
</button>`):m`<p>${R(this.hass,"find_none")}</p>`}
|
||||||
</div>`:f}
|
</div>`:f}
|
||||||
@@ -1578,7 +1578,7 @@ A plugin runs with the same rights as NextFloor in your browser. The file has be
|
|||||||
</div>`:f}
|
</div>`:f}
|
||||||
<b>${n("central_favorites")}</b>
|
<b>${n("central_favorites")}</b>
|
||||||
${w.length?m`<div class="nf-central-favs">
|
${w.length?m`<div class="nf-central-favs">
|
||||||
${w.map(g=>{let[_,M]=Vs(g),$=t.states[g],x=_==="homeassistant"&&$?.state==="on";return m`<button
|
${w.map(g=>{let[_,M]=Ks(g),$=t.states[g],x=_==="homeassistant"&&$?.state==="on";return m`<button
|
||||||
class="nf-chip"
|
class="nf-chip"
|
||||||
aria-pressed=${x||this._sceneFired===g}
|
aria-pressed=${x||this._sceneFired===g}
|
||||||
?disabled=${I($)}
|
?disabled=${I($)}
|
||||||
@@ -1590,13 +1590,13 @@ A plugin runs with the same rights as NextFloor in your browser. The file has be
|
|||||||
${b.length?m`<div class="nf-central-favs">
|
${b.length?m`<div class="nf-central-favs">
|
||||||
${b.map(g=>m`<button
|
${b.map(g=>m`<button
|
||||||
class="nf-chip nf-own-btn"
|
class="nf-chip nf-own-btn"
|
||||||
aria-pressed=${Ks(t,g)}
|
aria-pressed=${Gs(t,g)}
|
||||||
@click=${_=>{_o(t,_.currentTarget,g),g.action!=="service"&&(this._central=!1)}}
|
@click=${_=>{_o(t,_.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}
|
${g.icon?m`<ha-icon .icon=${g.icon.startsWith("mdi:")?g.icon:`mdi:${g.icon}`}></ha-icon>`:f}${g.label}
|
||||||
</button>`)}
|
</button>`)}
|
||||||
</div>`:f}
|
</div>`:f}
|
||||||
</div>`}toggleLock(){this._locked=!this._locked;try{localStorage.setItem(Mc,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 rn(this.hass,tl(this.watched),n,t);if(!this._travel||this._travel.from!==n)return;this._travel={...this._travel,history:o,moments:nl(o,n,t),loading:!1}}catch{this._travel=null,this._error=R(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=>R(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($c,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 rn(this.hass,nl(this.watched),n,t);if(!this._travel||this._travel.from!==n)return;this._travel={...this._travel,history:o,moments:rl(o,n,t),loading:!1}}catch{this._travel=null,this._error=R(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=>R(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>
|
<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>
|
<b class="nf-travel-when">${t.loading?e("travel_loading"):o}</b>
|
||||||
<div class="nf-travel-track">
|
<div class="nf-travel-track">
|
||||||
@@ -1646,10 +1646,10 @@ A plugin runs with the same rights as NextFloor in your browser. The file has be
|
|||||||
?confirmSwitch=${this.confirmSet.has(e.entity)}
|
?confirmSwitch=${this.confirmSet.has(e.entity)}
|
||||||
.myPosition=${this.myPositionOf(e.entity)}
|
.myPosition=${this.myPositionOf(e.entity)}
|
||||||
@close=${()=>this._menu=null}
|
@close=${()=>this._menu=null}
|
||||||
></nf-quick-menu>`}myPositionOf(e){for(let t of this.building?.floors??[])for(let n of t.openings){let 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&&_o(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??Fe(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=po(this.hass,e),a=L(this.hass,e);confirm(R(this.hass,s?"lock_confirm_lock":"lock_confirm_unlock",{name:a}))&&this.hass.callService("lock",s?"lock":"unlock",{entity_id:e});return}if(i&&bs.has(i)){if(this.confirmSet.has(e)&&!confirm(R(this.hass,"confirm_switch",{name:L(this.hass,e)})))return;ia(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 Qi({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&&_o(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??Fe(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=po(this.hass,e),a=L(this.hass,e);confirm(R(this.hass,s?"lock_confirm_lock":"lock_confirm_unlock",{name:a}))&&this.hass.callService("lock",s?"lock":"unlock",{entity_id:e});return}if(i&&ws.has(i)){if(this.confirmSet.has(e)&&!confirm(R(this.hass,"confirm_switch",{name:L(this.hass,e)})))return;sa(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 Xi({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=${R(this.hass,"close")} @click=${()=>this._pluginWindow=null}>✕</button></div>
|
<div class="nf-pw-head"><span>${e.title}</span><button class="nf-pw-close" aria-label=${R(this.hass,"close")} @click=${()=>this._pluginWindow=null}>✕</button></div>
|
||||||
<div class="nf-pw-body">${e.node}</div>
|
<div class="nf-pw-body">${e.node}</div>
|
||||||
</div>`:f}startViewOf(){return this.startView??this.building?.settings.start_view??null}currentView(){return this.viewer?.currentView()??null}resetView(){this.viewer?.resetView()}fire(e,t){this.dispatchEvent(new CustomEvent(e,{detail:t,bubbles:!0,composed:!0}))}toggleFlows(){this._flows=!this._flows;try{localStorage.setItem("nextfloor.flows",this._flows?"1":"0")}catch{}this.syncDevices(!0)}liveHeatPumps(e){let t=this.hass;if(!t)return[];let n=[];for(let o of e.floors)for(let i of o.furniture){if(!nc(i.type))continue;let s=this.furnitureLinks?.get(i.id),a=tc(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:le(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(!ei(i.type))continue;let s=this.furnitureLinks?.get(i.id),a=Xo(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:le(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=ac(e,i);if(!s||s.soc===null&&s.range===null&&s.locked===null&&s.climateOn===null)continue;let a=Wo(e,i),l=a?xl(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:le(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:le(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||L(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 al(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,Yl(t,n,o).then(s=>this._todayItems=s))}refreshForecast(e){let t=this.hass,n=e.settings.forecast&&t?Ge(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,Xl(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=Ql(this._forecast,Math.max(1,Math.min(7,o.days)));if(!i.length)return f;let s=Ge(n,this.weatherEntityId??t.settings.weather_entity),a=s?n.states[s]?.attributes:void 0,l=String(a?.temperature_unit??"\xB0"),c=String(a?.precipitation_unit??"mm"),u=n.language??navigator.language,d=new Intl.DateTimeFormat(u,{weekday:"short"}),p=h=>h===null?"\u2013":`${Math.round(h)}\xB0`;return m`<section class="nf-forecast" aria-label=${R(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(!rc(i.type))continue;let s=this.furnitureLinks?.get(i.id),a=nc(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:le(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(!ei(i.type))continue;let s=this.furnitureLinks?.get(i.id),a=Xo(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:le(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=lc(e,i);if(!s||s.soc===null&&s.range===null&&s.locked===null&&s.climateOn===null)continue;let a=Wo(e,i),l=a?kl(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:le(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:le(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||L(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 ll(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,Jl(t,n,o).then(s=>this._todayItems=s))}refreshForecast(e){let t=this.hass,n=e.settings.forecast&&t?Ge(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,ec(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=Xl(this._forecast,Math.max(1,Math.min(7,o.days)));if(!i.length)return f;let s=Ge(n,this.weatherEntityId??t.settings.weather_entity),a=s?n.states[s]?.attributes:void 0,l=String(a?.temperature_unit??"\xB0"),c=String(a?.precipitation_unit??"mm"),u=n.language??navigator.language,d=new Intl.DateTimeFormat(u,{weekday:"short"}),p=h=>h===null?"\u2013":`${Math.round(h)}\xB0`;return m`<section class="nf-forecast" aria-label=${R(n,"forecast")}>
|
||||||
<ul>
|
<ul>
|
||||||
${i.map((h,w)=>m`<li>
|
${i.map((h,w)=>m`<li>
|
||||||
<span class="nf-fc-day">${w===0?R(n,"today"):d.format(new Date(h.day))}</span>
|
<span class="nf-fc-day">${w===0?R(n,"today"):d.format(new Date(h.day))}</span>
|
||||||
@@ -1658,14 +1658,14 @@ A plugin runs with the same rights as NextFloor in your browser. The file has be
|
|||||||
<span class="nf-fc-rain">${h.rain!==null&&h.rain>0?`\u{1F4A7}${h.rain.toLocaleString(u,{maximumFractionDigits:1})} ${c}`:h.chance!==null&&h.chance>0?`\u{1F4A7}${Math.round(h.chance)} %`:""}</span>
|
<span class="nf-fc-rain">${h.rain!==null&&h.rain>0?`\u{1F4A7}${h.rain.toLocaleString(u,{maximumFractionDigits:1})} ${c}`:h.chance!==null&&h.chance>0?`\u{1F4A7}${Math.round(h.chance)} %`:""}</span>
|
||||||
</li>`)}
|
</li>`)}
|
||||||
</ul>
|
</ul>
|
||||||
</section>`}renderToday(){let e=this.building,t=this.hass;if(!e||!t||this.clean||this.roomId||this.panelOpen)return f;let n=this.renderForecast("top_right"),o=this.today===!1?f:this.renderTodayCard(e,t);return o===f&&n===f?f:m`<div class="nf-right-col" style=${this.clock==="top_right"?"top: 78px":""}>${o}${n}</div>`}renderTodayCard(e,t){let n=ql(t,e,Date.now(),{today:R(t,"care_bin_today"),tomorrow:R(t,"care_bin_tomorrow")}),o=Zl([...n,...this._todayItems??[]]);if(!o.length&&!(e.settings.calendars??[]).length)return f;let i=this._todayOpen!==!1,s=new Intl.DateTimeFormat(t.language??navigator.language,{weekday:"long",day:"numeric",month:"long"}).format(new Date),a=t.language??navigator.language,l=u=>{if(u===1)return R(t,"tomorrow");let d=new Date;return d.setDate(d.getDate()+u),new Intl.DateTimeFormat(a,{weekday:"long",day:"numeric",month:"numeric"}).format(d)},c=o.flatMap((u,d)=>[(u.day??0)>0&&(o[d-1]?.day??0)!==u.day?m`<li class="nf-today-day">${l(u.day??0)}</li>`:f,m`<li class=${u.past?"nf-today-past":""}><time>${u.kind==="bin"?"\u{1F5D1}":u.time||"\u25CF"}</time><span>${u.title}<small>${u.source}</small></span></li>`]);return m`<section class="nf-today ${i?"":"nf-today-folded"}" aria-label=${R(t,"today")}>
|
</section>`}renderToday(){let e=this.building,t=this.hass;if(!e||!t||this.clean||this.roomId||this.panelOpen)return f;let n=this.renderForecast("top_right"),o=this.today===!1?f:this.renderTodayCard(e,t);return o===f&&n===f?f:m`<div class="nf-right-col" style=${this.clock==="top_right"?"top: 78px":""}>${o}${n}</div>`}renderTodayCard(e,t){let n=Zl(t,e,Date.now(),{today:R(t,"care_bin_today"),tomorrow:R(t,"care_bin_tomorrow")}),o=Yl([...n,...this._todayItems??[]]);if(!o.length&&!(e.settings.calendars??[]).length)return f;let i=this._todayOpen!==!1,s=new Intl.DateTimeFormat(t.language??navigator.language,{weekday:"long",day:"numeric",month:"long"}).format(new Date),a=t.language??navigator.language,l=u=>{if(u===1)return R(t,"tomorrow");let d=new Date;return d.setDate(d.getDate()+u),new Intl.DateTimeFormat(a,{weekday:"long",day:"numeric",month:"numeric"}).format(d)},c=o.flatMap((u,d)=>[(u.day??0)>0&&(o[d-1]?.day??0)!==u.day?m`<li class="nf-today-day">${l(u.day??0)}</li>`:f,m`<li class=${u.past?"nf-today-past":""}><time>${u.kind==="bin"?"\u{1F5D1}":u.time||"\u25CF"}</time><span>${u.title}<small>${u.source}</small></span></li>`]);return m`<section class="nf-today ${i?"":"nf-today-folded"}" aria-label=${R(t,"today")}>
|
||||||
<button class="nf-today-head" aria-expanded=${i} @click=${()=>this._todayOpen=!i}>
|
<button class="nf-today-head" aria-expanded=${i} @click=${()=>this._todayOpen=!i}>
|
||||||
<b>📅 ${R(t,"today")}</b><span>${s}</span>
|
<b>📅 ${R(t,"today")}</b><span>${s}</span>
|
||||||
</button>
|
</button>
|
||||||
${i?o.length?m`<ul>
|
${i?o.length?m`<ul>
|
||||||
${c}
|
${c}
|
||||||
</ul>`:m`<p class="nf-today-none">${R(t,"today_none")}</p>`:f}
|
</ul>`:m`<p class="nf-today-none">${R(t,"today_none")}</p>`:f}
|
||||||
</section>`}week=null;weekAt=0;refreshWeek(e){let t=this.hass;if(!t||this._travel||Date.now()-this.weekAt<36e5)return;this.weekAt=Date.now();let n=Fe(e,s=>this.furnitureLinks?.get(s.id)?.power??null),o=e.energy,i={solar:o.solar?[o.solar]:n.solar,grid:o.grid??n.grid,gridInvert:!!o.grid_invert,battery:o.battery?[o.battery]:n.battery,batteryInvert:!!o.battery_invert,consumption:o.consumption};Ba(t,i).then(s=>{this.week=s,this.syncDevices(!0)}).catch(()=>this.week=null)}meterRows(e,t=null){let n=this.hass,o=[],i=this.floorId?e.floors.find(a=>a.id===this.floorId):void 0,s=i?.power_entity?j(n?.states[i.power_entity]):null;if(i&&s!==null){let a=t&&t>0?` \xB7 ${R(n,"floor_power_share",{n:Math.round(Math.max(0,s)/t*100)})}`:"";o.push({icon:"\u26A1",label:i.name,value:`${it(n,s)}${a}`})}for(let[a,l,c]of[["gas","\u{1F525}","energy_gas_short"],["water","\u{1F4A7}","energy_water_short"]]){let u=e.energy[a],d=u?n?.states[u]:void 0;d&&!I(d)&&o.push({icon:l,label:R(n,c),value:ee(n,d)})}return o}refreshDayCurves(e){let t=this.hass;if(!t||this._travel||Date.now()-this.curvesAt<6e5)return;this.curvesAt=Date.now();let n=a=>en(a,e,Xt(a,e),Fe(e,l=>this.furnitureLinks?.get(l.id)?.power??null)),o=rl(t,n),i=Date.now(),s=i-24*36e5;rn(t,o,s,i,!0).then(a=>{this.dayCurves=ol(t,a,s,i,n),this.syncDevices(!0)}).catch(()=>this.dayCurves=null)}syncLhCards(e,t,n,o,i){let s=[],a=n.summary,l=a.solar!==null||a.grid!==null||a.battery!==null||a.consumption!==null,c=hn(t),u=(this.floorId?t.floors.find(d=>d.id===this.floorId):void 0)??[...t.floors].sort((d,p)=>p.elevation-d.elevation)[0];if(this.liveCardsOn&&!this.dimmed&&!this.roomId&&l&&c&&u){let d=0,p=0,h=0;for(let w of u.rooms)for(let[b,g]of w.points)d+=b,p+=g,h++;s.push({kind:"house",at:{floorId:u.id,x:h?d/h:c.x,z:h?p/h:c.z,y:u.height+(this.floorId?1.2:3.2)},summary:a,autarky:n.autarky,curves:this.dayCurves??void 0,week:this.week??void 0,meters:this.meterRows(t,a.consumption)}),this.refreshDayCurves(t),this.refreshWeek(t)}if(this.liveCardsOn&&!this.dimmed&&!this.roomId){for(let d of o)s.push({kind:"car",at:d.at,spot:d.spot,name:d.name,car:d.car});for(let d of this.livePrinters(t))s.push({kind:"printer",at:d.at,name:d.name,printer:d.printer});for(let d of this.liveHeatPumps(t))s.push({kind:"heatpump",at:d.at,name:d.name,pump:d.pump});for(let d of i)s.push({kind:"media",at:{...d.at,y:d.at.y+.5},media:d})}JSON.stringify(s)!==JSON.stringify(this._liveCards)&&(this._liveCards=s),e.setLiveAnchors(s.map(d=>d.at),s.length?(d,p,h,w)=>this.placeLhCard(d,p,h,w):null)}placeLhCard(e,t,n,o){let i=this.renderRoot.querySelector(`.live-card[data-i="${e}"]`);i&&(i.dataset.x=String(t),i.dataset.y=String(n),i.style.visibility=o?"visible":"hidden",e===this._liveCards.length-1&&cc(this.renderRoot))}toggleHouseFold(){this._houseFolded=!this._houseFolded;try{localStorage.setItem("nextfloor.house_card_folded",this._houseFolded?"1":"0")}catch{}}toggleLhCards(){this._liveCardOn=!this._liveCardOn;try{localStorage.setItem("nextfloor.cards",this._liveCardOn?"1":"0")}catch{}this.syncDevices(!0)}renderTopLeft(){let e=this.clean?f:this.renderLhEnergy(),t=this.renderForecast("top_left");return this.clock!=="top_left"&&t===f||!this.hass?e:m`<div class="nf-topleft">${this.clock==="top_left"?this.renderClock(!0):f}${e}${t}</div>`}renderLhEnergy(){let e=this.ownSensors(),t=this._liveEnergy?.summary;if(!(!!t&&!this.roomId&&this.showEnergy&&!!this.hass&&!(t.consumption===null&&t.grid===null&&t.solar===null&&t.battery===null)))return e.length?m`<div class="nf-energy" aria-live="off">${e}</div>`:f;let o=s=>R(this.hass,s),i=[];if(t.solar!==null&&i.push({cls:"solar",label:o("energy_solar"),value:se(this.hass,t.solar)}),t.consumption!==null&&i.push({cls:"total",label:o("energy_consumption"),value:se(this.hass,t.consumption)}),t.rest!==void 0&&t.rest!==null&&i.push({cls:"total",label:o("energy_rest"),value:se(this.hass,t.rest)}),t.battery!==null||t.soc!==null){let s=[t.battery!==null?se(this.hass,Math.abs(t.battery)):null,t.soc!==null?`${Math.round(t.soc)} %`:null].filter(Boolean);i.push({cls:"battery",label:o("energy_battery"),value:s.join(" \xB7 ")})}if(t.grid!==null){let s=t.grid<0;i.push({cls:s?"export":"grid",label:o(s?"energy_grid_export":"energy_grid_import"),value:se(this.hass,Math.abs(t.grid))})}if(t.tariff&&i.push({cls:"tariff",label:o("energy_tariff"),value:`${O(this.hass,t.tariff.value,3)} ${t.tariff.unit}`.trim()}),this.building)for(let s of this.meterRows(this.building))i.push({cls:"meter",label:`${s.icon} ${s.label}`,value:s.value});return m`<div class="nf-energy" aria-live="off">
|
</section>`}week=null;weekAt=0;refreshWeek(e){let t=this.hass;if(!t||this._travel||Date.now()-this.weekAt<36e5)return;this.weekAt=Date.now();let n=Fe(e,s=>this.furnitureLinks?.get(s.id)?.power??null),o=e.energy,i={solar:o.solar?[o.solar]:n.solar,grid:o.grid??n.grid,gridInvert:!!o.grid_invert,battery:o.battery?[o.battery]:n.battery,batteryInvert:!!o.battery_invert,consumption:o.consumption};Va(t,i).then(s=>{this.week=s,this.syncDevices(!0)}).catch(()=>this.week=null)}meterRows(e,t=null){let n=this.hass,o=[],i=this.floorId?e.floors.find(a=>a.id===this.floorId):void 0,s=i?.power_entity?j(n?.states[i.power_entity]):null;if(i&&s!==null){let a=t&&t>0?` \xB7 ${R(n,"floor_power_share",{n:Math.round(Math.max(0,s)/t*100)})}`:"";o.push({icon:"\u26A1",label:i.name,value:`${it(n,s)}${a}`})}for(let[a,l,c]of[["gas","\u{1F525}","energy_gas_short"],["water","\u{1F4A7}","energy_water_short"]]){let u=e.energy[a],d=u?n?.states[u]:void 0;d&&!I(d)&&o.push({icon:l,label:R(n,c),value:ee(n,d)})}return o}refreshDayCurves(e){let t=this.hass;if(!t||this._travel||Date.now()-this.curvesAt<6e5)return;this.curvesAt=Date.now();let n=a=>en(a,e,Xt(a,e),Fe(e,l=>this.furnitureLinks?.get(l.id)?.power??null)),o=ol(t,n),i=Date.now(),s=i-24*36e5;rn(t,o,s,i,!0).then(a=>{this.dayCurves=il(t,a,s,i,n),this.syncDevices(!0)}).catch(()=>this.dayCurves=null)}syncLhCards(e,t,n,o,i){let s=[],a=n.summary,l=a.solar!==null||a.grid!==null||a.battery!==null||a.consumption!==null,c=hn(t),u=(this.floorId?t.floors.find(d=>d.id===this.floorId):void 0)??[...t.floors].sort((d,p)=>p.elevation-d.elevation)[0];if(this.liveCardsOn&&!this.dimmed&&!this.roomId&&l&&c&&u){let d=0,p=0,h=0;for(let w of u.rooms)for(let[b,g]of w.points)d+=b,p+=g,h++;s.push({kind:"house",at:{floorId:u.id,x:h?d/h:c.x,z:h?p/h:c.z,y:u.height+(this.floorId?1.2:3.2)},summary:a,autarky:n.autarky,curves:this.dayCurves??void 0,week:this.week??void 0,meters:this.meterRows(t,a.consumption)}),this.refreshDayCurves(t),this.refreshWeek(t)}if(this.liveCardsOn&&!this.dimmed&&!this.roomId){for(let d of o)s.push({kind:"car",at:d.at,spot:d.spot,name:d.name,car:d.car});for(let d of this.livePrinters(t))s.push({kind:"printer",at:d.at,name:d.name,printer:d.printer});for(let d of this.liveHeatPumps(t))s.push({kind:"heatpump",at:d.at,name:d.name,pump:d.pump});for(let d of i)s.push({kind:"media",at:{...d.at,y:d.at.y+.5},media:d})}JSON.stringify(s)!==JSON.stringify(this._liveCards)&&(this._liveCards=s),e.setLiveAnchors(s.map(d=>d.at),s.length?(d,p,h,w)=>this.placeLhCard(d,p,h,w):null)}placeLhCard(e,t,n,o){let i=this.renderRoot.querySelector(`.live-card[data-i="${e}"]`);i&&(i.dataset.x=String(t),i.dataset.y=String(n),i.style.visibility=o?"visible":"hidden",e===this._liveCards.length-1&&uc(this.renderRoot))}toggleHouseFold(){this._houseFolded=!this._houseFolded;try{localStorage.setItem("nextfloor.house_card_folded",this._houseFolded?"1":"0")}catch{}}toggleLhCards(){this._liveCardOn=!this._liveCardOn;try{localStorage.setItem("nextfloor.cards",this._liveCardOn?"1":"0")}catch{}this.syncDevices(!0)}renderTopLeft(){let e=this.clean?f:this.renderLhEnergy(),t=this.renderForecast("top_left");return this.clock!=="top_left"&&t===f||!this.hass?e:m`<div class="nf-topleft">${this.clock==="top_left"?this.renderClock(!0):f}${e}${t}</div>`}renderLhEnergy(){let e=this.ownSensors(),t=this._liveEnergy?.summary;if(!(!!t&&!this.roomId&&this.showEnergy&&!!this.hass&&!(t.consumption===null&&t.grid===null&&t.solar===null&&t.battery===null)))return e.length?m`<div class="nf-energy" aria-live="off">${e}</div>`:f;let o=s=>R(this.hass,s),i=[];if(t.solar!==null&&i.push({cls:"solar",label:o("energy_solar"),value:se(this.hass,t.solar)}),t.consumption!==null&&i.push({cls:"total",label:o("energy_consumption"),value:se(this.hass,t.consumption)}),t.rest!==void 0&&t.rest!==null&&i.push({cls:"total",label:o("energy_rest"),value:se(this.hass,t.rest)}),t.battery!==null||t.soc!==null){let s=[t.battery!==null?se(this.hass,Math.abs(t.battery)):null,t.soc!==null?`${Math.round(t.soc)} %`:null].filter(Boolean);i.push({cls:"battery",label:o("energy_battery"),value:s.join(" \xB7 ")})}if(t.grid!==null){let s=t.grid<0;i.push({cls:s?"export":"grid",label:o(s?"energy_grid_export":"energy_grid_import"),value:se(this.hass,Math.abs(t.grid))})}if(t.tariff&&i.push({cls:"tariff",label:o("energy_tariff"),value:`${O(this.hass,t.tariff.value,3)} ${t.tariff.unit}`.trim()}),this.building)for(let s of this.meterRows(this.building))i.push({cls:"meter",label:`${s.icon} ${s.label}`,value:s.value});return m`<div class="nf-energy" aria-live="off">
|
||||||
${this.liveCardsOn&&this._liveCards.some(s=>s.kind==="house")?f:i.map(s=>m`<div class="nf-energy-item nf-energy-${s.cls}"><span>${s.label}</span><b>${s.value}</b></div>`)}
|
${this.liveCardsOn&&this._liveCards.some(s=>s.kind==="house")?f:i.map(s=>m`<div class="nf-energy-item nf-energy-${s.cls}"><span>${s.label}</span><b>${s.value}</b></div>`)}
|
||||||
${this.flows!==null?f:m`<button class="nf-energy-item nf-flow-toggle" aria-pressed=${this._flows} title=${o("flows_hint")} aria-label=${o("flows")} @click=${()=>this.toggleFlows()}>
|
${this.flows!==null?f:m`<button class="nf-energy-item nf-flow-toggle" aria-pressed=${this._flows} title=${o("flows_hint")} aria-label=${o("flows")} @click=${()=>this.toggleFlows()}>
|
||||||
<span>${o("flows")}</span><b>⚡</b>
|
<span>${o("flows")}</span><b>⚡</b>
|
||||||
@@ -1676,22 +1676,22 @@ A plugin runs with the same rights as NextFloor in your browser. The file has be
|
|||||||
${e}
|
${e}
|
||||||
</div>`}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=${L(this.hass,t)} @click=${()=>fe(this,t)}>
|
</div>`}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=${L(this.hass,t)} @click=${()=>fe(this,t)}>
|
||||||
<span>${L(this.hass,t)}</span><b>${ee(this.hass,this.hass.states[t])}</b>
|
<span>${L(this.hass,t)}</span><b>${ee(this.hass,this.hass.states[t])}</b>
|
||||||
</button>`)}renderMapCredit(){let e=this.building?.settings.map;return El(e)?m`<a class="nf-map-credit" href=${Vo(e).href} target="_blank" rel="noopener">${Vo(e).text}</a>`:f}renderLegend(){if(this.heatMode==="wifi")return this.renderWifiLegend();if(this.heatMode==="none"||this.heatMode==="values")return f;let e=ot(new Date,this.hass?.config?.latitude??50),t=ar(this.heatMode,e),n=this.heatMode==="temperature",o=n?ue(this.hass,t.stops[0][0]):t.stops[0][0],i=n?ue(this.hass,t.stops[t.stops.length-1][0]):t.stops[t.stops.length-1][0],s=n?ne(this.hass):t.unit,a=l=>R(this.hass,l);return m`<div class="nf-legend">
|
</button>`)}renderMapCredit(){let e=this.building?.settings.map;return Rl(e)?m`<a class="nf-map-credit" href=${Vo(e).href} target="_blank" rel="noopener">${Vo(e).text}</a>`:f}renderLegend(){if(this.heatMode==="wifi")return this.renderWifiLegend();if(this.heatMode==="none"||this.heatMode==="values")return f;let e=ot(new Date,this.hass?.config?.latitude??50),t=lr(this.heatMode,e),n=this.heatMode==="temperature",o=n?ue(this.hass,t.stops[0][0]):t.stops[0][0],i=n?ue(this.hass,t.stops[t.stops.length-1][0]):t.stops[t.stops.length-1][0],s=n?ne(this.hass):t.unit,a=l=>R(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>
|
<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:${La(this.heatMode,e)}"></span>
|
<span class="nf-legend-bar" style="background:${Ba(this.heatMode,e)}"></span>
|
||||||
<span class="nf-legend-range"><span>${O(this.hass,o,0)} ${s}</span><span>${O(this.hass,i,0)} ${s}</span></span>
|
<span class="nf-legend-range"><span>${O(this.hass,o,0)} ${s}</span><span>${O(this.hass,i,0)} ${s}</span></span>
|
||||||
${this.heatValues.size?f:m`<span class="nf-legend-none">${a("heat_none_found")}</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)=>R(e,c,u),o=t.floors.flatMap(c=>c.furniture.filter(u=>ti(u.type)).map(u=>ni(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=ic(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)=>R(e,c,u),o=t.floors.flatMap(c=>c.furniture.filter(u=>ti(u.type)).map(u=>ni(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=sc(a);return m`<div class="nf-legend">
|
||||||
<b>📶 ${n("heat_wifi")}</b>
|
<b>📶 ${n("heat_wifi")}</b>
|
||||||
<span>${n("wifi_aps",{n:o.length,clients:s})}</span>
|
<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}
|
${l.online+l.offline.length?m`<span>${n("wifi_network",{online:l.online,offline:l.offline.length})}</span>`:f}
|
||||||
${l.offline.length?m`<span class="nf-legend-none">${l.offline.slice(0,4).join(", ")}</span>`:f}
|
${l.offline.length?m`<span class="nf-legend-none">${l.offline.slice(0,4).join(", ")}</span>`:f}
|
||||||
${o.length?f:m`<span class="nf-legend-none">${n("wifi_none")}</span>`}
|
${o.length?f:m`<span class="nf-legend-none">${n("wifi_none")}</span>`}
|
||||||
</div>`}skyColor(){let e=sn[this.theme]??sn.neon,t=this._sky;return e.night[0].map((n,o)=>Math.round(n+(e.day[0][o]-n)*t))}render(){let e=this._sky,t=(i,s)=>`rgb(${i.map((a,l)=>Math.round(a+(s[l]-a)*e)).join(",")})`,n=sn[this.theme]??sn.neon,o=`--nf-sky:${t(n.night[0],n.day[0])};--nf-ground:${t(n.night[1],n.day[1])}`+il(this.building?.settings.backdrop);return m`<div
|
</div>`}skyColor(){let e=sn[this.theme]??sn.neon,t=this._sky;return e.night[0].map((n,o)=>Math.round(n+(e.day[0][o]-n)*t))}render(){let e=this._sky,t=(i,s)=>`rgb(${i.map((a,l)=>Math.round(a+(s[l]-a)*e)).join(",")})`,n=sn[this.theme]??sn.neon,o=`--nf-sky:${t(n.night[0],n.day[0])};--nf-ground:${t(n.night[1],n.day[1])}`+sl(this.building?.settings.backdrop);return m`<div
|
||||||
class="nf-stage ${this.roomLabels?"":"nf-no-room-names"} ${this._low?"nf-low":""} ${this.panelOpen?"nf-panel-open":""} ${this._alerts.length?"nf-has-alerts":""} ${this._narrowStage?"nf-narrow":""}"
|
class="nf-stage ${this.roomLabels?"":"nf-no-room-names"} ${this._low?"nf-low":""} ${this.panelOpen?"nf-panel-open":""} ${this._alerts.length?"nf-has-alerts":""} ${this._narrowStage?"nf-narrow":""}"
|
||||||
style=${o}
|
style=${o}
|
||||||
>
|
>
|
||||||
${this._error?m`<p class="nf-error">${this._error}</p>`:f} ${this.renderTopLeft()} ${uc(this.hass,this.roomId||this.panelOpen?[]:this._liveCards,(i,s,a,l)=>this.hass?.callService(i,s,{entity_id:a,...l}),{folded:this._houseFolded,toggle:()=>this.toggleHouseFold()})} ${this.clean?f:this.renderLegend()} ${this.renderMapCredit()}
|
${this._error?m`<p class="nf-error">${this._error}</p>`:f} ${this.renderTopLeft()} ${dc(this.hass,this.roomId||this.panelOpen?[]:this._liveCards,(i,s,a,l)=>this.hass?.callService(i,s,{entity_id:a,...l}),{folded:this._houseFolded,toggle:()=>this.toggleHouseFold()})} ${this.clean?f:this.renderLegend()} ${this.renderMapCredit()}
|
||||||
${this.renderAlerts()} ${this.renderAnnouncement()} ${this.clean?f:m`${this.renderThumbs()} ${this.renderScenes()} ${this.renderFind()} ${this.renderCentral()}`} ${this.renderSwipe()}
|
${this.renderAlerts()} ${this.renderAnnouncement()} ${this.clean?f:m`${this.renderThumbs()} ${this.renderScenes()} ${this.renderFind()} ${this.renderCentral()}`} ${this.renderSwipe()}
|
||||||
${this.renderMenu()} ${this.renderPlate()} ${this.renderEye()} ${this.renderLock()} ${this.renderWalk()} ${this.renderTravel()} ${this.renderClock()} ${this.renderToday()} ${this.renderLayers()} ${this.renderPluginWindow()}
|
${this.renderMenu()} ${this.renderPlate()} ${this.renderEye()} ${this.renderLock()} ${this.renderWalk()} ${this.renderTravel()} ${this.renderClock()} ${this.renderToday()} ${this.renderLayers()} ${this.renderPluginWindow()}
|
||||||
${this.showStats&&this._stats?m`<span class="nf-stats"
|
${this.showStats&&this._stats?m`<span class="nf-stats"
|
||||||
@@ -1700,7 +1700,7 @@ A plugin runs with the same rights as NextFloor in your browser. The file has be
|
|||||||
${R(this.hass,"stats",{calls:this._stats.calls,tris:this._stats.triangles.toLocaleString()})} ·
|
${R(this.hass,"stats",{calls:this._stats.calls,tris:this._stats.triangles.toLocaleString()})} ·
|
||||||
${R(this.hass,this._stats.low?"stats_low":"stats_full",{r:O(this.hass,this._stats.pixelRatio,2)})}</span
|
${R(this.hass,this._stats.low?"stats_low":"stats_full",{r:O(this.hass,this._stats.pixelRatio,2)})}</span
|
||||||
>`:f}
|
>`:f}
|
||||||
</div>`}static styles=[Se,Ve,dc,te`
|
</div>`}static styles=[Se,Ve,hc,te`
|
||||||
:host {
|
:host {
|
||||||
display: block;
|
display: block;
|
||||||
position: relative;
|
position: relative;
|
||||||
@@ -3278,26 +3278,26 @@ A plugin runs with the same rights as NextFloor in your browser. The file has be
|
|||||||
inset: auto 16px 16px;
|
inset: auto 16px 16px;
|
||||||
color: var(--nf-danger);
|
color: var(--nf-danger);
|
||||||
}
|
}
|
||||||
`]};customElements.get("nf-view3d")||customElements.define("nf-view3d",ui);function se(r,e){return Math.abs(e)>=1e3?`${O(r,e/1e3,1)} kW`:`${Math.round(e)} W`}function ci(r){return r.type==="tv_board"?r.h+.9:r.type==="tv_wall"||r.type==="kitchen_wall"?r.h+.25:r.h+.35}function bm(r,e){let t=e.attributes.percentage;return e.state==="on"&&typeof t=="number"?`${Math.round(t)} %`:ee(r,e)}var Ac;function Ec(){let r=new URL("./nextfloor-editor.js?v=37bfd8f9f2b7",new URL(import.meta.url)).href;return Ac??=import(r),Ac}var wm=.25,Rc=r=>Math.round(r*1e3)/1e3,zc=(r,e,t)=>r.rooms.find(n=>n.points.length>=3&&H([e,t],n.points));function hi(r,e,t,n,o){let i=zc(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 vm(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(oe(Z(i,t),n))<.02&&Math.abs(oe(Z(a,t),n))<.02}))}var di=(r,e)=>Math.abs((r-e+540)%360-180);function Tc(r,e,t,n=wm){let o=zc(r,e.x,e.z);if(!o)return null;let i=o.points,s=et(i)>=0?1:-1,a=null;return i.forEach((l,c)=>{let u=i[(c+1)%i.length],d=Te(Z(u,l));if(d<.3)return;let p=[(u[0]-l[0])/d,(u[1]-l[1])/d],h=[-p[1]*s,p[0]*s],w=oe(Z([e.x,e.z],l),p);if(w<0||w>d)return;let b=vm(r,o,l,h)?t/2:0,g=oe(Z([e.x,e.z],l),h)-b,_=Math.atan2(-h[0],h[1])*180/Math.PI,$=[{rotation:_,extent:e.d/2},{rotation:_+90,extent:e.w/2},{rotation:_-90,extent:e.w/2}].reduce((y,F)=>di(e.rotation,F.rotation)<di(e.rotation,y.rotation)?F:y);if(di(e.rotation,$.rotation)>50)return;let x=g-$.extent;Math.abs(x)>n||a&&Math.abs(x)>=Math.abs(a.gap)||(a={x:Rc(e.x-h[0]*x),z:Rc(e.z-h[1]*x),rotation:(Math.round($.rotation)%360+360)%360,gap:x})}),a&&{x:a.x,z:a.z,rotation:a.rotation}}function Er(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 Rr(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 Fc(r,e){let t=structuredClone(r);for(let n of t.floors)n.furniture=n.furniture.filter(o=>o.id!==e);return t}function Dc(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 Pc(r,e,t,n){return Rr(r,e,(o,i)=>{[o.x,o.z]=hi(i,o.x,o.z,t,n)})}function Hc(r,e,t,n){let o=r.settings.wall_interior??.12;return Er(r,e,(i,s)=>{[i.x,i.z]=hi(s,i.x,i.z,t,n);let a=Tc(s,i,o);a&&Object.assign(i,a)})}var pi=(r,e)=>((r+e)%360+360)%360,Ic=r=>Number.parseFloat(r.replace(",",".")),wn=(r,e)=>Math.round(r*10**e)/10**e;function mi(r){let{min:e,max:t,accepts:n=()=>!0}=r,o=i=>{let s=Ic(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",ui);function se(r,e){return Math.abs(e)>=1e3?`${O(r,e/1e3,1)} kW`:`${Math.round(e)} W`}function ci(r){return r.type==="tv_board"?r.h+.9:r.type==="tv_wall"||r.type==="kitchen_wall"?r.h+.25:r.h+.35}function wm(r,e){let t=e.attributes.percentage;return e.state==="on"&&typeof t=="number"?`${Math.round(t)} %`:ee(r,e)}var Ec;function Rc(){let r=new URL("./nextfloor-editor.js?v=37bfd8f9f2b7",new URL(import.meta.url)).href;return Ec??=import(r),Ec}var vm=.25,zc=r=>Math.round(r*1e3)/1e3,Tc=(r,e,t)=>r.rooms.find(n=>n.points.length>=3&&H([e,t],n.points));function hi(r,e,t,n,o){let i=Tc(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 ym(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(oe(Z(i,t),n))<.02&&Math.abs(oe(Z(a,t),n))<.02}))}var di=(r,e)=>Math.abs((r-e+540)%360-180);function Fc(r,e,t,n=vm){let o=Tc(r,e.x,e.z);if(!o)return null;let i=o.points,s=et(i)>=0?1:-1,a=null;return i.forEach((l,c)=>{let u=i[(c+1)%i.length],d=Te(Z(u,l));if(d<.3)return;let p=[(u[0]-l[0])/d,(u[1]-l[1])/d],h=[-p[1]*s,p[0]*s],w=oe(Z([e.x,e.z],l),p);if(w<0||w>d)return;let b=ym(r,o,l,h)?t/2:0,g=oe(Z([e.x,e.z],l),h)-b,_=Math.atan2(-h[0],h[1])*180/Math.PI,$=[{rotation:_,extent:e.d/2},{rotation:_+90,extent:e.w/2},{rotation:_-90,extent:e.w/2}].reduce((y,F)=>di(e.rotation,F.rotation)<di(e.rotation,y.rotation)?F:y);if(di(e.rotation,$.rotation)>50)return;let x=g-$.extent;Math.abs(x)>n||a&&Math.abs(x)>=Math.abs(a.gap)||(a={x:zc(e.x-h[0]*x),z:zc(e.z-h[1]*x),rotation:(Math.round($.rotation)%360+360)%360,gap:x})}),a&&{x:a.x,z:a.z,rotation:a.rotation}}function Rr(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 zr(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 Dc(r,e){let t=structuredClone(r);for(let n of t.floors)n.furniture=n.furniture.filter(o=>o.id!==e);return t}function Pc(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 Hc(r,e,t,n){return zr(r,e,(o,i)=>{[o.x,o.z]=hi(i,o.x,o.z,t,n)})}function Ic(r,e,t,n){let o=r.settings.wall_interior??.12;return Rr(r,e,(i,s)=>{[i.x,i.z]=hi(s,i.x,i.z,t,n);let a=Fc(s,i,o);a&&Object.assign(i,a)})}var pi=(r,e)=>((r+e)%360+360)%360,Cc=r=>Number.parseFloat(r.replace(",",".")),wn=(r,e)=>Math.round(r*10**e)/10**e;function mi(r){let{min:e,max:t,accepts:n=()=>!0}=r,o=i=>{let s=Cc(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}
|
>${r.label}
|
||||||
<input type="number" inputmode="decimal" step=${r.step} min=${e} max=${t??f} .value=${String(wn(r.value,2))} @change=${o} />
|
<input type="number" inputmode="decimal" step=${r.step} min=${e} max=${t??f} .value=${String(wn(r.value,2))} @change=${o} />
|
||||||
</label>`}var Nc=(r,e)=>m`<button class="nf-chip" @click=${e}>${r.t("height_auto")}</button>`,Cc=(r,e)=>m`<button class="nf-chip" @click=${()=>e(-r)}>↺ ${r}°</button><button class="nf-chip" @click=${()=>e(r)}>↻ ${r}°</button>`;function ym(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)=>mi({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]=wn(l,3))}),i=ms(n)?m`${mi({label:"\u2195",title:r.t("mount_height"),value:n.mount_y??le(t,n),step:.05,min:0,accepts:s=>s>=0,apply:s=>r.editFurniture(e,a=>a.mount_y=wn(s,3))})}
|
</label>`}var Oc=(r,e)=>m`<button class="nf-chip" @click=${e}>${r.t("height_auto")}</button>`,Nc=(r,e)=>m`<button class="nf-chip" @click=${()=>e(-r)}>↺ ${r}°</button><button class="nf-chip" @click=${()=>e(r)}>↻ ${r}°</button>`;function xm(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)=>mi({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]=wn(l,3))}),i=fs(n)?m`${mi({label:"\u2195",title:r.t("mount_height"),value:n.mount_y??le(t,n),step:.05,min:0,accepts:s=>s>=0,apply:s=>r.editFurniture(e,a=>a.mount_y=wn(s,3))})}
|
||||||
${n.mount_y!=null?Nc(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 xm(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=${d=>r.editDevice(e,p=>Object.assign(p,{mount:d.target.value,y:null}))}>
|
${n.mount_y!=null?Oc(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 km(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=${d=>r.editDevice(e,p=>Object.assign(p,{mount:d.target.value,y:null}))}>
|
||||||
${c.map(([d,p])=>m`<option value=${d} ?selected=${d===u}>${p}</option>`)}
|
${c.map(([d,p])=>m`<option value=${d} ?selected=${d===u}>${p}</option>`)}
|
||||||
</select>`,s=["ceiling","floor","table","wall"].map(l=>[l,r.t(`lamp_${l}`)]),a=o?_t(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}
|
</select>`,s=["ceiling","floor","table","wall"].map(l=>[l,r.t(`lamp_${l}`)]),a=o?_t(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}
|
||||||
${mi({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=wn(l,3))})}
|
${mi({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=wn(l,3))})}
|
||||||
${n.y!==null?Nc(r,()=>r.editDevice(e,l=>l.y=null)):f}`}function Oc(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>
|
${n.y!==null?Oc(r,()=>r.editDevice(e,l=>l.y=null)):f}`}function Wc(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>
|
||||||
${ym(r,e)} ${Cc(45,s=>r.turnFurniture(e,s))}
|
${xm(r,e)} ${Nc(45,s=>r.turnFurniture(e,s))}
|
||||||
<button class="nf-chip" title=${n("furn_mirror_hint")} @click=${()=>r.editFurniture(e,s=>s.mirror=!s.mirror)}>⇋ ${n("furn_mirror")}</button>
|
<button class="nf-chip" title=${n("furn_mirror_hint")} @click=${()=>r.editFurniture(e,s=>s.mirror=!s.mirror)}>⇋ ${n("furn_mirror")}</button>
|
||||||
<button class="nf-chip nf-danger-chip" @click=${()=>r.removeFurniture(e)}>${n("delete")}</button>`}else t?o=m`<span>${L(r.hass,t)}</span>
|
<button class="nf-chip nf-danger-chip" @click=${()=>r.removeFurniture(e)}>${n("delete")}</button>`}else t?o=m`<span>${L(r.hass,t)}</span>
|
||||||
${xm(r,t)} ${Cc(45,i=>r.turnDevice(t,i))}
|
${km(r,t)} ${Nc(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 Wc=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 Lc=J`<svg class="nf-mark" viewBox="60 40 392 420" aria-hidden="true">
|
||||||
<polygon points="106,150 256,66 406,150 256,234" fill="none" stroke="currentColor" stroke-opacity=".55" stroke-width="12" stroke-dasharray="6 22" stroke-linecap="round"/>
|
<polygon points="106,150 256,66 406,150 256,234" fill="none" stroke="currentColor" stroke-opacity=".55" stroke-width="12" stroke-dasharray="6 22" stroke-linecap="round"/>
|
||||||
<polygon points="106,382 256,466 256,488 106,404" fill="#34507d"/><polygon points="406,382 256,466 256,488 406,404" fill="#2a4068"/><polygon points="106,382 256,298 406,382 256,466" fill="#5f7fb6"/>
|
<polygon points="106,382 256,466 256,488 106,404" fill="#34507d"/><polygon points="406,382 256,466 256,488 406,404" fill="#2a4068"/><polygon points="106,382 256,298 406,382 256,466" fill="#5f7fb6"/>
|
||||||
<polygon points="106,310 256,394 256,416 106,332" fill="#4a72b8"/><polygon points="406,310 256,394 256,416 406,332" fill="#3b5c98"/><polygon points="106,310 256,226 406,310 256,394" fill="#8ab6f5"/>
|
<polygon points="106,310 256,394 256,416 106,332" fill="#4a72b8"/><polygon points="406,310 256,394 256,416 406,332" fill="#3b5c98"/><polygon points="106,310 256,226 406,310 256,394" fill="#8ab6f5"/>
|
||||||
<polygon points="106,238 256,322 256,344 106,260" fill="#2a74d8"/><polygon points="406,238 256,322 256,344 406,260" fill="#2161b8"/><polygon points="106,238 256,154 406,238 256,322" fill="#4fb6ff"/>
|
<polygon points="106,238 256,322 256,344 106,260" fill="#2a74d8"/><polygon points="406,238 256,322 256,344 406,260" fill="#2161b8"/><polygon points="106,238 256,154 406,238 256,322" fill="#4fb6ff"/>
|
||||||
<circle cx="256" cy="236" r="16" fill="#ffe08a"/>
|
<circle cx="256" cy="236" r="16" fill="#ffe08a"/>
|
||||||
</svg>`;var ae=(r,e)=>({name:r,fallback:e,read:t=>e?t!=="0":t==="1",write:t=>t?"1":"0"}),Ft=(r,e,t)=>({name:r,fallback:t,read:n=>e.find(o=>o===n)??t,write:n=>n}),fi={explode:ae("explode",!0),keepRoof:ae("roof",!1),solidWalls:ae("solid_walls",!1),quality:Ft("quality",["auto","low","high"],"auto"),stats:ae("stats",!1),markers:Ft("markers",["none","important","all"],"important"),heat:Ft("heat",["none","temperature","humidity","co2","mould","comfort","power","sun","values","wifi"],"none"),theme:Ft("theme",gr,"neon"),clock:Ft("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:Ft("floor_stack",["dim","stacked","single"],"dim"),roomNames:ae("room_names",!0),clean:ae("clean",!1),navWrap:ae("nav_wrap",!1),weather:ae("weather",!0),timeSlider:ae("time_slider",!1),menuOpen:ae("menu_open",!1),keepCamera:ae("keep_camera",!1),readable:ae("readable",!1),plain:ae("plain",!1),rightBack:ae("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:ae("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 Lc(r=Tr()){try{return r?.getItem("nextfloor.screen_name")?.trim()||null}catch{return null}}function Bc(r=Tr()){try{return r?.getItem("nextfloor.announce_muted")==="1"}catch{return!1}}function Tr(){try{return localStorage}catch{return null}}var zr=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(fi)){let o=fi[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=fi[e];try{this.storage?.setItem(`nextfloor.${n.name}`,n.write(t))}catch{}}};var Vc=te`
|
</svg>`;var ae=(r,e)=>({name:r,fallback:e,read:t=>e?t!=="0":t==="1",write:t=>t?"1":"0"}),Ft=(r,e,t)=>({name:r,fallback:t,read:n=>e.find(o=>o===n)??t,write:n=>n}),fi={explode:ae("explode",!0),keepRoof:ae("roof",!1),solidWalls:ae("solid_walls",!1),quality:Ft("quality",["auto","low","high"],"auto"),stats:ae("stats",!1),markers:Ft("markers",["none","important","all"],"important"),heat:Ft("heat",["none","temperature","humidity","co2","mould","comfort","power","sun","values","wifi"],"none"),theme:Ft("theme",_r,"neon"),clock:Ft("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:Ft("floor_stack",["dim","stacked","single"],"dim"),roomNames:ae("room_names",!0),clean:ae("clean",!1),navWrap:ae("nav_wrap",!1),weather:ae("weather",!0),timeSlider:ae("time_slider",!1),menuOpen:ae("menu_open",!1),keepCamera:ae("keep_camera",!1),readable:ae("readable",!1),plain:ae("plain",!1),rightBack:ae("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:ae("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 Bc(r=Fr()){try{return r?.getItem("nextfloor.screen_name")?.trim()||null}catch{return null}}function Vc(r=Fr()){try{return r?.getItem("nextfloor.announce_muted")==="1"}catch{return!1}}function Fr(){try{return localStorage}catch{return null}}var Tr=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(fi)){let o=fi[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=fi[e];try{this.storage?.setItem(`nextfloor.${n.name}`,n.write(t))}catch{}}};var Kc=te`
|
||||||
.nf-dot {
|
.nf-dot {
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
width: 8px;
|
width: 8px;
|
||||||
@@ -3782,11 +3782,11 @@ A plugin runs with the same rights as NextFloor in your browser. The file has be
|
|||||||
gap: 12px;
|
gap: 12px;
|
||||||
margin: auto;
|
margin: auto;
|
||||||
}
|
}
|
||||||
`;var gi=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}};outsideMemo=null;floorUndoTimer;data=new gt(this);store=new zr(Tr());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}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:Xe(dt(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 gi=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}};outsideMemo=null;floorUndoTimer;data=new gt(this);store=new Tr(Fr());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}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:Xe(dt(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"
|
${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)}
|
><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))}
|
@change=${i=>(this._timeDrag=null,this._timeOfDay=Number(i.target.value))}
|
||||||
/></label>`:f}`}t=(e,t)=>R(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=dr(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=qt(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=>Er(n,e,t)),editDevice:(e,t)=>this.applyEdit(n=>Rr(n,e,t)),turnFurniture:(e,t)=>this.applyEdit(n=>Er(n,e,o=>o.rotation=pi(o.rotation,t))),turnDevice:(e,t)=>this.applyEdit(n=>Rr(n,e,o=>o.rotation=pi(o.rotation??0,t))),removeFurniture:e=>{this.applyEdit(t=>Fc(t,e)),this._selFurniture=null},removeDevice:e=>{this.applyEdit(t=>Dc(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&&Xn(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)=>R(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=hr(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=qt(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=>Rr(n,e,t)),editDevice:(e,t)=>this.applyEdit(n=>zr(n,e,t)),turnFurniture:(e,t)=>this.applyEdit(n=>Rr(n,e,o=>o.rotation=pi(o.rotation,t))),turnDevice:(e,t)=>this.applyEdit(n=>zr(n,e,o=>o.rotation=pi(o.rotation??0,t))),removeFurniture:e=>{this.applyEdit(t=>Dc(t,e)),this._selFurniture=null},removeDevice:e=>{this.applyEdit(t=>Pc(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&&er(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()}`}
|
${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}
|
${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}
|
${!e&&!this.data.error?m`<p class="nf-message">${this.t("loading")}</p>`:f}
|
||||||
@@ -3799,7 +3799,7 @@ A plugin runs with the same rights as NextFloor in your browser. The file has be
|
|||||||
</label>`}renderViewOptions(){let e=this._prefs;return m`<button class="nf-opts-btn" aria-expanded=${this._optsOpen} title=${this.t("view_options")} aria-label=${this.t("view_options")} @click=${()=>this._optsOpen=!this._optsOpen}>⚙</button>
|
</label>`}renderViewOptions(){let e=this._prefs;return m`<button class="nf-opts-btn" aria-expanded=${this._optsOpen} title=${this.t("view_options")} aria-label=${this.t("view_options")} @click=${()=>this._optsOpen=!this._optsOpen}>⚙</button>
|
||||||
<div class="nf-view-opts ${this._optsOpen?"nf-opts-open":""}">
|
<div class="nf-view-opts ${this._optsOpen?"nf-opts-open":""}">
|
||||||
${this.choiceRow("quality",["auto","low","high"],e.quality,t=>this.t(`quality_${t}`),t=>this.setPref("quality",t))}
|
${this.choiceRow("quality",["auto","low","high"],e.quality,t=>this.t(`quality_${t}`),t=>this.setPref("quality",t))}
|
||||||
${this.choiceRow("theme",gr,e.theme,t=>this.t(`theme_${t}`),t=>this.setPref("theme",t),this.accentPicker())}
|
${this.choiceRow("theme",_r,e.theme,t=>this.t(`theme_${t}`),t=>this.setPref("theme",t),this.accentPicker())}
|
||||||
${this.choiceRow("markers",["none","important","all"],e.markers,t=>this.t(`markers_${t}`),t=>this.setPref("markers",t))}
|
${this.choiceRow("markers",["none","important","all"],e.markers,t=>this.t(`markers_${t}`),t=>this.setPref("markers",t))}
|
||||||
<label class="nf-seg nf-clock-pick" title=${this.t("clock")}
|
<label class="nf-seg nf-clock-pick" title=${this.t("clock")}
|
||||||
>🕒
|
>🕒
|
||||||
@@ -3838,7 +3838,7 @@ A plugin runs with the same rights as NextFloor in your browser. The file has be
|
|||||||
</div>
|
</div>
|
||||||
</div>`}renderHeader(e){let t=this.data.saveState,n=(i,s,a="")=>m`<button role="tab" class=${a} aria-pressed=${this._mode===i} @click=${()=>this.setMode(i)}>${s}</button>`,o=t==="saving"?"saving":t==="saved"?"saved":"save_error";return m`<header class="nf-header">
|
</div>`}renderHeader(e){let t=this.data.saveState,n=(i,s,a="")=>m`<button role="tab" class=${a} aria-pressed=${this._mode===i} @click=${()=>this.setMode(i)}>${s}</button>`,o=t==="saving"?"saving":t==="saved"?"saved":"save_error";return m`<header class="nf-header">
|
||||||
<ha-menu-button .hass=${this.hass} .narrow=${this.narrow}></ha-menu-button>
|
<ha-menu-button .hass=${this.hass} .narrow=${this.narrow}></ha-menu-button>
|
||||||
<h1>${Wc}NextFloor</h1>
|
<h1>${Lc}NextFloor</h1>
|
||||||
${this.isAdmin?m`<div class="nf-seg" role="tablist">${n("view",this.t("view"))}${n("editor",this.t("editor"))}${n("extensions",`\u2726 ${this.t("ext_tab")}`,"nf-tab-ext")}</div>`:f}
|
${this.isAdmin?m`<div class="nf-seg" role="tablist">${n("view",this.t("view"))}${n("editor",this.t("editor"))}${n("extensions",`\u2726 ${this.t("ext_tab")}`,"nf-tab-ext")}</div>`:f}
|
||||||
<span class="nf-grow"></span>
|
<span class="nf-grow"></span>
|
||||||
${this._mode==="view"&&e?.floors.some(i=>i.rooms.length)?this.renderViewOptions():f}
|
${this._mode==="view"&&e?.floors.some(i=>i.rooms.length)?this.renderViewOptions():f}
|
||||||
@@ -3851,7 +3851,7 @@ A plugin runs with the same rights as NextFloor in your browser. The file has be
|
|||||||
<span>${this.t("draft_found",{time:n})}</span>
|
<span>${this.t("draft_found",{time:n})}</span>
|
||||||
<button class="nf-btn nf-primary" @click=${()=>e.restoreDraft()}>${this.t("draft_restore")}</button>
|
<button class="nf-btn nf-primary" @click=${()=>e.restoreDraft()}>${this.t("draft_restore")}</button>
|
||||||
<button class="nf-btn" @click=${()=>e.discardDraft()}>${this.t("draft_discard")}</button>
|
<button class="nf-btn" @click=${()=>e.discardDraft()}>${this.t("draft_discard")}</button>
|
||||||
</div>`)}return t.length>0?m`<div class="nf-notices">${t}</div>`:f}whenEditorLoaded(e){return this._editorReady?e():(Ec().then(()=>this._editorReady=!0,t=>this.data.error=String(t)),m`<div class="nf-empty"><p>${this.t("loading")}</p></div>`)}renderExtensions(){return this.whenEditorLoaded(()=>m`<nf-extensions class="nf-body" .hass=${this.hass} .packs=${this.data.packs} .plugins=${this.data.building?.settings.plugins??[]}
|
</div>`)}return t.length>0?m`<div class="nf-notices">${t}</div>`:f}whenEditorLoaded(e){return this._editorReady?e():(Rc().then(()=>this._editorReady=!0,t=>this.data.error=String(t)),m`<div class="nf-empty"><p>${this.t("loading")}</p></div>`)}renderExtensions(){return this.whenEditorLoaded(()=>m`<nf-extensions class="nf-body" .hass=${this.hass} .packs=${this.data.packs} .plugins=${this.data.building?.settings.plugins??[]}
|
||||||
@packs-changed=${()=>{this.data.reloadPacks()}}
|
@packs-changed=${()=>{this.data.reloadPacks()}}
|
||||||
@plugins-changed=${e=>this.applyEdit(t=>({...t,settings:{...t.settings,plugins:e.detail}}))}></nf-extensions>`)}renderEditor(e){return this.whenEditorLoaded(()=>m`<nf-editor
|
@plugins-changed=${e=>this.applyEdit(t=>({...t,settings:{...t.settings,plugins:e.detail}}))}></nf-extensions>`)}renderEditor(e){return this.whenEditorLoaded(()=>m`<nf-editor
|
||||||
class="nf-body"
|
class="nf-body"
|
||||||
@@ -3859,10 +3859,10 @@ A plugin runs with the same rights as NextFloor in your browser. The file has be
|
|||||||
.building=${e}
|
.building=${e}
|
||||||
.narrow=${this.narrow}
|
.narrow=${this.narrow}
|
||||||
.packs=${this.data.packs}
|
.packs=${this.data.packs}
|
||||||
.loadCardEditor=${Mn}
|
.loadCardEditor=${$n}
|
||||||
@packs-changed=${()=>{this.data.reloadPacks()}}
|
@packs-changed=${()=>{this.data.reloadPacks()}}
|
||||||
@building-changed=${t=>this.data.edit(t.detail.building)}
|
@building-changed=${t=>this.data.edit(t.detail.building)}
|
||||||
></nf-editor>`)}onNavWheel=e=>{if(this._prefs.navWrap||!e.deltaY||e.deltaX)return;let t=e.currentTarget;t.scrollWidth<=t.clientWidth||(t.scrollLeft+=e.deltaY,e.preventDefault())};allOffChip(e){let t=this._floorId?e.floors.find(o=>o.id===this._floorId):e.floors.length===1?e.floors[0]:void 0;if(!t||!this.hass)return f;if(this._floorUndo){let o=this._floorUndo;return m`<button class="nf-chip" aria-pressed="true" @click=${()=>{for(let i of o)this.hass.callService(i.domain,i.service,i.data);this._floorUndo=null,clearTimeout(this.floorUndoTimer)}}>↶ ${this.t("all_off_undo")}</button>`}let n=nn(el(t).map(o=>this.hass.states[o]));return n.count<2?f:m`<button class="nf-chip" title=${this.t("all_off_floor",{floor:t.name,n:n.count})} @click=${()=>{for(let o of n.off)this.hass.callService(o.domain,o.service,o.data);this._floorUndo=n.undo,clearTimeout(this.floorUndoTimer),this.floorUndoTimer=setTimeout(()=>this._floorUndo=null,1e4)}}>⏻ ${n.count}</button>`}renderNav(e){let t=e.floors.filter(c=>!this._floorId||c.id===this._floorId),n=e.floors.length>1,o=this._prefs.navWrap,i=this.outsideIds(e).length?m`<button class="nf-chip" aria-pressed=${this._outside} title=${this.t("outside_area_hint")} @click=${()=>this.openOutside()}>🌳 ${this.t("outside_area")}</button>`:f,s=n?m`<button class="nf-chip" aria-pressed=${this._floorId===null} @click=${()=>this.openFloor(null)}>${this.t("all_floors")}</button>
|
></nf-editor>`)}onNavWheel=e=>{if(this._prefs.navWrap||!e.deltaY||e.deltaX)return;let t=e.currentTarget;t.scrollWidth<=t.clientWidth||(t.scrollLeft+=e.deltaY,e.preventDefault())};allOffChip(e){let t=this._floorId?e.floors.find(o=>o.id===this._floorId):e.floors.length===1?e.floors[0]:void 0;if(!t||!this.hass)return f;if(this._floorUndo){let o=this._floorUndo;return m`<button class="nf-chip" aria-pressed="true" @click=${()=>{for(let i of o)this.hass.callService(i.domain,i.service,i.data);this._floorUndo=null,clearTimeout(this.floorUndoTimer)}}>↶ ${this.t("all_off_undo")}</button>`}let n=nn(tl(t).map(o=>this.hass.states[o]));return n.count<2?f:m`<button class="nf-chip" title=${this.t("all_off_floor",{floor:t.name,n:n.count})} @click=${()=>{for(let o of n.off)this.hass.callService(o.domain,o.service,o.data);this._floorUndo=n.undo,clearTimeout(this.floorUndoTimer),this.floorUndoTimer=setTimeout(()=>this._floorUndo=null,1e4)}}>⏻ ${n.count}</button>`}renderNav(e){let t=e.floors.filter(c=>!this._floorId||c.id===this._floorId),n=e.floors.length>1,o=this._prefs.navWrap,i=this.outsideIds(e).length?m`<button class="nf-chip" aria-pressed=${this._outside} title=${this.t("outside_area_hint")} @click=${()=>this.openOutside()}>🌳 ${this.t("outside_area")}</button>`:f,s=n?m`<button class="nf-chip" aria-pressed=${this._floorId===null} @click=${()=>this.openFloor(null)}>${this.t("all_floors")}</button>
|
||||||
${[...e.floors].reverse().map(c=>m`<button class="nf-chip" aria-pressed=${c.id===this._floorId} @click=${()=>this.openFloor(c.id)}>${c.name}</button>`)}
|
${[...e.floors].reverse().map(c=>m`<button class="nf-chip" aria-pressed=${c.id===this._floorId} @click=${()=>this.openFloor(c.id)}>${c.name}</button>`)}
|
||||||
${i} ${this.allOffChip(e)}
|
${i} ${this.allOffChip(e)}
|
||||||
<span class="nf-sep"></span>`:m`${i} ${this.allOffChip(e)}`,a=t.flatMap(c=>[t.length>1&&c.rooms.length?m`<span class="nf-nav-floor">${c.name}</span>`:f,...c.rooms.map(u=>m`<button
|
<span class="nf-sep"></span>`:m`${i} ${this.allOffChip(e)}`,a=t.flatMap(c=>[t.length>1&&c.rooms.length?m`<span class="nf-nav-floor">${c.name}</span>`:f,...c.rooms.map(u=>m`<button
|
||||||
@@ -3922,7 +3922,7 @@ A plugin runs with the same rights as NextFloor in your browser. The file has be
|
|||||||
.keepRoof=${t.keepRoof}
|
.keepRoof=${t.keepRoof}
|
||||||
.markerMode=${t.markers}
|
.markerMode=${t.markers}
|
||||||
.heatMode=${t.heat}
|
.heatMode=${t.heat}
|
||||||
.theme=${_r(t.theme,this.sunState())}
|
.theme=${br(t.theme,this.sunState())}
|
||||||
.timeOfDay=${this._timeOfDay}
|
.timeOfDay=${this._timeOfDay}
|
||||||
.clock=${t.clock==="none"?null:t.clock}
|
.clock=${t.clock==="none"?null:t.clock}
|
||||||
.announcements=${!t.announceMuted}
|
.announcements=${!t.announceMuted}
|
||||||
@@ -3941,9 +3941,9 @@ A plugin runs with the same rights as NextFloor in your browser. The file has be
|
|||||||
?furnish=${this._furnish}
|
?furnish=${this._furnish}
|
||||||
.selectedFurniture=${this._selFurniture}
|
.selectedFurniture=${this._selFurniture}
|
||||||
@furniture-select=${o=>this._selFurniture=o.detail.id}
|
@furniture-select=${o=>this._selFurniture=o.detail.id}
|
||||||
@furniture-move=${o=>this.applyEdit(i=>Hc(i,o.detail.id,o.detail.x,o.detail.z))}
|
@furniture-move=${o=>this.applyEdit(i=>Ic(i,o.detail.id,o.detail.x,o.detail.z))}
|
||||||
@device-select=${o=>this._selDevice=o.detail.id}
|
@device-select=${o=>this._selDevice=o.detail.id}
|
||||||
@device-move=${o=>this.applyEdit(i=>Pc(i,o.detail.id,o.detail.x,o.detail.z))}
|
@device-move=${o=>this.applyEdit(i=>Hc(i,o.detail.id,o.detail.x,o.detail.z))}
|
||||||
.quality=${t.quality}
|
.quality=${t.quality}
|
||||||
?showStats=${t.stats}
|
?showStats=${t.stats}
|
||||||
@room-tap=${this.onRoomTap}
|
@room-tap=${this.onRoomTap}
|
||||||
@@ -3972,9 +3972,9 @@ A plugin runs with the same rights as NextFloor in your browser. The file has be
|
|||||||
@close=${()=>this._outside=!1}
|
@close=${()=>this._outside=!1}
|
||||||
></nf-room-panel>`:f}
|
></nf-room-panel>`:f}
|
||||||
${t.clean?f:this.renderOverlay(e)}
|
${t.clean?f:this.renderOverlay(e)}
|
||||||
${this._furnish?Oc(this.furnishHost,this._selFurniture,this._selDevice):f}
|
${this._furnish?Wc(this.furnishHost,this._selFurniture,this._selDevice):f}
|
||||||
</div>
|
</div>
|
||||||
`}static styles=[Se,Ve,Vc,ur]};customElements.get("nextfloor-panel")||customElements.define("nextfloor-panel",gi);var km=/^(\d{1,2}):(\d{2})\s*-\s*(\d{1,2}):(\d{2})$/,Kc=(r,e)=>Number(r)*60+Number(e);function vn(r,e,t=new Date){if(!r||r==="off")return!1;if(r==="sun")return e?.states["sun.sun"]?.state==="below_horizon";let n=km.exec(r.trim());if(!n)return!1;let o=Kc(n[1],n[2]),i=Kc(n[3],n[4]),s=t.getHours()*60+t.getMinutes();return o>i?s>=o||s<i:s>=o&&s<i}var Fr=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(vn(this.host.config()?.night,this.host.hass())),6e4)}stop(){clearTimeout(this.cleanTimer),clearTimeout(this.idleTimer),clearInterval(this.nightTimer)}};function Gc(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 Uc=te`
|
`}static styles=[Se,Ve,Kc,dr]};customElements.get("nextfloor-panel")||customElements.define("nextfloor-panel",gi);var Sm=/^(\d{1,2}):(\d{2})\s*-\s*(\d{1,2}):(\d{2})$/,Gc=(r,e)=>Number(r)*60+Number(e);function vn(r,e,t=new Date){if(!r||r==="off")return!1;if(r==="sun")return e?.states["sun.sun"]?.state==="below_horizon";let n=Sm.exec(r.trim());if(!n)return!1;let o=Gc(n[1],n[2]),i=Gc(n[3],n[4]),s=t.getHours()*60+t.getMinutes();return o>i?s>=o||s<i:s>=o&&s<i}var Dr=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(vn(this.host.config()?.night,this.host.hass())),6e4)}stop(){clearTimeout(this.cleanTimer),clearTimeout(this.idleTimer),clearInterval(this.nightTimer)}};function Uc(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 jc=te`
|
||||||
ha-card {
|
ha-card {
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
background: var(--nf-bg);
|
background: var(--nf-bg);
|
||||||
@@ -4098,12 +4098,12 @@ A plugin runs with the same rights as NextFloor in your browser. The file has be
|
|||||||
justify-content: flex-end;
|
justify-content: flex-end;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
`;function _i(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 jc(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(d=>d.points.length>=3&&H([c,u],d.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 Dt="nf-outside",bi=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 gt(this);kiosk=new Fr({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 Mn(),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=_i(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=vn(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=_i(this._own,t)),this.toggleAttribute("readable",this._config?.readable===!0),e.has("hass")&&(this.style.colorScheme=dr(this.hass)),!e.has("hass")||!this.hass)return;this.data.setHass(this.hass);let n=vn(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:jc(e,t)}),this.roomsMemo.result}t=e=>R(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 _i(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 qc(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(d=>d.points.length>=3&&H([c,u],d.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 Dt="nf-outside",bi=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 gt(this);kiosk=new Dr({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 $n(),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=_i(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=vn(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=_i(this._own,t)),this.toggleAttribute("readable",this._config?.readable===!0),e.has("hass")&&(this.style.colorScheme=hr(this.hass)),!e.has("hass")||!this.hass)return;this.data.setHass(this.hass);let n=vn(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:qc(e,t)}),this.roomsMemo.result}t=e=>R(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}
|
${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("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}
|
${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}
|
||||||
${o.length>0?i(n("heatmap"),["none",...o].map(s=>[e.heat===s,()=>this._heat=s,n(s==="none"?"heat_off":`heat_short_${s}`)])):f}
|
${o.length>0?i(n("heatmap"),["none",...o].map(s=>[e.heat===s,()=>this._heat=s,n(s==="none"?"heat_off":`heat_short_${s}`)])):f}
|
||||||
</div>`}renderRoomButtons(e){let t=this.plan();if(!this._config?.room_buttons||!t||this._clean)return f;let n=Gc(t,e.floorId);if(!n.length)return f;let o=n.length>1,i=(l,c)=>{this.canSwitch&&l!==e.floorId&&(this._floorId=l),this._roomId=c===this._roomId?null:c},s=qt(this.hass,t.floors).length>0,a=()=>{this.canSwitch&&(this._floorId=null),this._roomId=this._roomId===Dt?null:Dt};return m`<div class="nf-card-rooms ${this._roomId&&this._config?.room_panel!==!1?"nf-card-rooms-beside":""}" role="group" aria-label=${this.t("card_room_buttons")}>
|
</div>`}renderRoomButtons(e){let t=this.plan();if(!this._config?.room_buttons||!t||this._clean)return f;let n=Uc(t,e.floorId);if(!n.length)return f;let o=n.length>1,i=(l,c)=>{this.canSwitch&&l!==e.floorId&&(this._floorId=l),this._roomId=c===this._roomId?null:c},s=qt(this.hass,t.floors).length>0,a=()=>{this.canSwitch&&(this._floorId=null),this._roomId=this._roomId===Dt?null:Dt};return m`<div class="nf-card-rooms ${this._roomId&&this._config?.room_panel!==!1?"nf-card-rooms-beside":""}" role="group" aria-label=${this.t("card_room_buttons")}>
|
||||||
${n.map(l=>m`${o?m`<span class="nf-card-rooms-floor">${l.floorName}</span>`:f}${l.rooms.map(c=>m`<button class="nf-chip" aria-pressed=${c.id===this._roomId} @click=${()=>i(l.floorId,c.id)}>${c.name}</button>`)}`)}
|
${n.map(l=>m`${o?m`<span class="nf-card-rooms-floor">${l.floorName}</span>`:f}${l.rooms.map(c=>m`<button class="nf-chip" aria-pressed=${c.id===this._roomId} @click=${()=>i(l.floorId,c.id)}>${c.name}</button>`)}`)}
|
||||||
${s?m`<button class="nf-chip" aria-pressed=${this._roomId===Dt} title=${this.t("outside_area_hint")} @click=${a}>🌳 ${this.t("outside_area")}</button>`:f}
|
${s?m`<button class="nf-chip" aria-pressed=${this._roomId===Dt} title=${this.t("outside_area_hint")} @click=${a}>🌳 ${this.t("outside_area")}</button>`:f}
|
||||||
</div>`}renderCorners(){let e=this._config,t=this.t,n=this._clean||!!this._roomId&&e?.room_panel!==!1;return m`${e?.fullscreen_button&&!n?m`<button class="nf-card-full" title=${t(this._fullscreen?"fullscreen_exit":"fullscreen")} aria-label=${t(this._fullscreen?"fullscreen_exit":"fullscreen")} @click=${()=>this.toggleFullscreen()}>
|
</div>`}renderCorners(){let e=this._config,t=this.t,n=this._clean||!!this._roomId&&e?.room_panel!==!1;return m`${e?.fullscreen_button&&!n?m`<button class="nf-card-full" title=${t(this._fullscreen?"fullscreen_exit":"fullscreen")} aria-label=${t(this._fullscreen?"fullscreen_exit":"fullscreen")} @click=${()=>this.toggleFullscreen()}>
|
||||||
@@ -4140,7 +4140,7 @@ A plugin runs with the same rights as NextFloor in your browser. The file has be
|
|||||||
.zoom=${typeof n?.zoom=="number"?n.zoom:1}
|
.zoom=${typeof n?.zoom=="number"?n.zoom:1}
|
||||||
.buttons=${n?.buttons?.map((s,a)=>({id:`card_${a}`,...s}))??null}
|
.buttons=${n?.buttons?.map((s,a)=>({id:`card_${a}`,...s}))??null}
|
||||||
.heatMode=${e.heat}
|
.heatMode=${e.heat}
|
||||||
.theme=${_r(n?.theme,this.hass?.states["sun.sun"]?.state)}
|
.theme=${br(n?.theme,this.hass?.states["sun.sun"]?.state)}
|
||||||
.clock=${n?.clock&&n.clock!=="none"?n.clock:null}
|
.clock=${n?.clock&&n.clock!=="none"?n.clock:null}
|
||||||
.lockButton=${n?.lock_button!==!1}
|
.lockButton=${n?.lock_button!==!1}
|
||||||
.walkButton=${n?.walk_button!==!1}
|
.walkButton=${n?.walk_button!==!1}
|
||||||
@@ -4156,10 +4156,10 @@ A plugin runs with the same rights as NextFloor in your browser. The file has be
|
|||||||
.panelOpen=${!!this._roomId&&n?.room_panel!==!1}
|
.panelOpen=${!!this._roomId&&n?.room_panel!==!1}
|
||||||
.alerts=${n?.alerts!==!1}
|
.alerts=${n?.alerts!==!1}
|
||||||
.alertJump=${!!n?.alert_jump}
|
.alertJump=${!!n?.alert_jump}
|
||||||
.announcements=${n?.announcements!==!1&&!Bc()}
|
.announcements=${n?.announcements!==!1&&!Vc()}
|
||||||
.sensorBar=${n?.sensor_bar!==!1}
|
.sensorBar=${n?.sensor_bar!==!1}
|
||||||
.glassWalls=${typeof n?.glass_walls=="number"?Math.min(100,Math.max(0,n.glass_walls)):null}
|
.glassWalls=${typeof n?.glass_walls=="number"?Math.min(100,Math.max(0,n.glass_walls)):null}
|
||||||
.screenName=${n?.screen_name??Lc()}
|
.screenName=${n?.screen_name??Bc()}
|
||||||
.scenes=${n?.scenes!==!1}
|
.scenes=${n?.scenes!==!1}
|
||||||
.clean=${this._clean}
|
.clean=${this._clean}
|
||||||
.cleanButton=${i}
|
.cleanButton=${i}
|
||||||
@@ -4184,7 +4184,7 @@ A plugin runs with the same rights as NextFloor in your browser. The file has be
|
|||||||
.confirmEntities=${rt(this.hass,e.floors)}
|
.confirmEntities=${rt(this.hass,e.floors)}
|
||||||
.phrases=${e.settings.announce_phrases??null}
|
.phrases=${e.settings.announce_phrases??null}
|
||||||
@close=${()=>this._roomId=null}
|
@close=${()=>this._roomId=null}
|
||||||
></nf-room-panel>`}render(){if(this.hass&&Xn(this.hass,this))return f;let e=this.plan(),t=this._config;!this.roomApplied&&e&&t?.room&&(this.roomApplied=!0,e.floors.some(a=>a.rooms.some(l=>l.id===t.room))&&(this._roomId=t.room));let n=this.stage(),o=this._fullscreen?"100vh":t?.fill?"calc(100vh - var(--header-height, 56px) - 16px)":`${t?.height??420}px`,i=/^#[0-9a-f]{6}$/i.test(t?.accent??"")?t.accent:null,s=()=>this.kiosk.touched();return m`<ha-card class=${this._night?"nf-night":""} style=${i?`--nf-accent:${i}`:""} @pointerdown=${s} @keydown=${s} @wheel=${s}>
|
></nf-room-panel>`}render(){if(this.hass&&er(this.hass,this))return f;let e=this.plan(),t=this._config;!this.roomApplied&&e&&t?.room&&(this.roomApplied=!0,e.floors.some(a=>a.rooms.some(l=>l.id===t.room))&&(this._roomId=t.room));let n=this.stage(),o=this._fullscreen?"100vh":t?.fill?"calc(100vh - var(--header-height, 56px) - 16px)":`${t?.height??420}px`,i=/^#[0-9a-f]{6}$/i.test(t?.accent??"")?t.accent:null,s=()=>this.kiosk.touched();return m`<ha-card class=${this._night?"nf-night":""} style=${i?`--nf-accent:${i}`:""} @pointerdown=${s} @keydown=${s} @wheel=${s}>
|
||||||
<div class="nf-card-body" style="height:${o}">
|
<div class="nf-card-body" style="height:${o}">
|
||||||
${e&&e.floors.some(a=>a.rooms.length)?this.renderStage(n):m`<p class="nf-card-msg">${this.data.error??(e?R(this.hass,"no_building"):R(this.hass,"loading"))}</p>`}
|
${e&&e.floors.some(a=>a.rooms.length)?this.renderStage(n):m`<p class="nf-card-msg">${this.data.error??(e?R(this.hass,"no_building"):R(this.hass,"loading"))}</p>`}
|
||||||
${this._roomId&&e&&t?.room_panel!==!1?this.renderRoomPanel():f}
|
${this._roomId&&e&&t?.room_panel!==!1?this.renderRoomPanel():f}
|
||||||
@@ -4192,7 +4192,7 @@ A plugin runs with the same rights as NextFloor in your browser. The file has be
|
|||||||
${n.showBar&&e?this.renderBar(n):f}
|
${n.showBar&&e?this.renderBar(n):f}
|
||||||
${this.renderCorners()}
|
${this.renderCorners()}
|
||||||
</div>
|
</div>
|
||||||
</ha-card>`}static styles=[Se,Ve,Uc,ur]};if(!customElements.get("nextfloor-card")){customElements.define("nextfloor-card",bi);let r=window;r.customCards=r.customCards??[],r.customCards.push({type:"nextfloor-card",name:R(void 0,"card_name"),description:R(void 0,"card_description"),preview:!1})}Xr();function Sm(){let r=window.__NEXTFLOOR_SYMCON__;if(!r?.endpoint||!r.token)throw new Error("NextFloor Symcon host configuration is missing");return r}async function Dr(r,e,t={}){let n=await fetch(`${r.endpoint}/api?token=${encodeURIComponent(r.token)}`,{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json"},credentials:"same-origin",body:JSON.stringify({action:e,...t})}),o=await n.json().catch(()=>({error:`HTTP ${n.status}`}));if(!n.ok||!o||typeof o!="object"||"error"in o){let i=o&&typeof o=="object"&&"error"in o?o.error:`HTTP ${n.status}`;throw new Error(String(i))}return o}var Pr=class{settings=Sm();changeListeners=new Set;buildingListeners=new Set;timer;stateRevision=-1;buildingRevision=-1;objectsSignature="";states={};entities={};areas={};facade={language:this.settings.language||navigator.language||"de",user:{is_admin:!0,name:this.settings.title||"IP-Symcon"},states:this.states,entities:this.entities,areas:this.areas,symconObjects:[],config:{unit_system:{temperature:"\xB0C"}},themes:{darkMode:window.matchMedia?.("(prefers-color-scheme: dark)").matches??!0},services:{},connection:{subscribeMessage:async(e,t)=>{if(t.type==="nextfloor/building/subscribe"){let n=o=>e({revision:o});return this.buildingListeners.add(n),async()=>{this.buildingListeners.delete(n)}}return async()=>{}}},callWS:e=>this.callWS(e),callService:(e,t,n)=>this.callService(e,t,n),fetchWithAuth:(e,t)=>this.fetchWithToken(e,t),hassUrl:(e="")=>new URL(e,window.location.origin).href};async start(){let e=await Dr(this.settings,"bootstrap");return this.apply(e),this.stateRevision=e.state_revision,this.buildingRevision=e.building_revision,this.timer=setInterval(()=>{this.refresh()},800),this.snapshot()}stop(){this.timer&&clearInterval(this.timer),this.timer=void 0}onChange(e){return this.changeListeners.add(e),()=>this.changeListeners.delete(e)}snapshot(){return{...this.facade,states:{...this.states},entities:{...this.entities},areas:{...this.areas}}}async refresh(){try{let e=await Dr(this.settings,"variables/snapshot",{revision:this.stateRevision});if(e.state_revision!==this.stateRevision&&e.variables){this.stateRevision=e.state_revision,this.apply({variables:e.variables,areas:e.areas,objects:e.objects});for(let t of this.changeListeners)t()}if(e.building_revision!==this.buildingRevision){this.buildingRevision=e.building_revision;for(let t of this.buildingListeners)t(e.building_revision)}}catch{}}apply(e){if(this.states=Object.fromEntries(e.variables.map(t=>[t.entity_id,{entity_id:t.entity_id,state:t.state,attributes:{...t.attributes,friendly_name:t.name,symcon_path:t.path}}])),this.entities=Object.fromEntries(e.variables.map(t=>[t.entity_id,{entity_id:t.entity_id,name:t.name,area_id:t.area_id??null,device_id:t.device_id??null}])),e.areas&&(this.areas=Object.fromEntries(e.areas.map(t=>[t.area_id,t]))),this.facade.states=this.states,this.facade.entities=this.entities,this.facade.areas=this.areas,e.objects){let t=JSON.stringify(e.objects);t!==this.objectsSignature&&(this.facade.symconObjects=e.objects,this.objectsSignature=t)}}async callWS(e){let t=String(e.type??"");if(!t.startsWith("nextfloor/"))throw new Error(`Unsupported Symcon websocket command: ${t}`);let{type:n,...o}=e;return Dr(this.settings,t.slice(10),o)}async callService(e,t,n={}){return Dr(this.settings,"variables/action",{domain:e,service:t,data:n})}fetchWithToken(e,t={}){let n=new URL(e,window.location.origin);return n.searchParams.set("token",this.settings.token),fetch(n,{...t,credentials:"same-origin"})}};function Mm(){return new URLSearchParams(window.location.search).get("mode")==="tile"?"tile":"designer"}async function $m(){let r=new Pr,e=await r.start(),t=Mm()==="tile",n=t?document.createElement("nextfloor-card"):document.createElement("nextfloor-panel");n.className=t?"nf-symcon-tile":"nf-symcon-designer",n.hass=e,t?n.setConfig({type:"custom:nextfloor-card",fill:!0,room_buttons:!0,controls:!0,weather:!1,announcements:!1}):n.narrow=!1,document.body.replaceChildren(n),r.onChange(()=>{n.hass=r.snapshot()}),window.addEventListener("pagehide",()=>r.stop(),{once:!0})}$m().catch(r=>{document.body.textContent=`NextFloor konnte nicht geladen werden: ${r instanceof Error?r.message:String(r)}`});
|
</ha-card>`}static styles=[Se,Ve,jc,dr]};if(!customElements.get("nextfloor-card")){customElements.define("nextfloor-card",bi);let r=window;r.customCards=r.customCards??[],r.customCards.push({type:"nextfloor-card",name:R(void 0,"card_name"),description:R(void 0,"card_description"),preview:!1})}Xr();var Mm="nextfloor-chunks-v1";async function wi(r,e,t){let n=await fetch(`${r.endpoint}/api?token=${encodeURIComponent(r.token)}`,{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json"},credentials:"same-origin",body:JSON.stringify({...t,action:e,transport:Mm})}),o=await n.text(),i;try{i=JSON.parse(o)}catch{throw/Output-Buffer exceeds Limit/i.test(o)?new Error("Symcon hat die Antwort wegen seiner Ausgabebegrenzung abgebrochen. Bitte das NextFloor-Modul aktualisieren und den Designer neu laden."):new Error(`Symcon liefert ${o.trim()?"kein g\xFCltiges JSON":"eine leere Antwort"} f\xFCr \u201E${e}\u201C (HTTP ${n.status}).`)}if(!n.ok||!i||typeof i!="object"||"error"in i){let s=i&&typeof i=="object"&&"error"in i?i.error:`HTTP ${n.status}`;throw new Error(String(s))}return i}async function yn(r,e,t={}){let n=await wi(r,e,t);if(!("_nextfloor_transfer"in n))return n;let o=n._nextfloor_transfer;if(!o||!/^[a-f0-9]{32}$/.test(o.id)||!Number.isSafeInteger(o.bytes)||o.bytes<=0||o.bytes>67108864||!Number.isSafeInteger(o.chunk_bytes)||o.chunk_bytes<=0||o.chunk_bytes>128*1024||o.chunks!==Math.ceil(o.bytes/o.chunk_bytes)||o.chunks>512)throw new Error("Symcon hat eine ung\xFCltige Daten\xFCbertragung angek\xFCndigt.");try{let i=new TextDecoder("utf-8",{fatal:!0}),s=[];for(let a=0;a<o.chunks;a++){let l=await wi(r,"transport/read",{transfer_id:o.id,index:a});if(l.index!==a||typeof l.data!="string")throw new Error("Ein Symcon-Datenpaket fehlt oder ist ung\xFCltig.");let c=Uint8Array.from(atob(l.data),u=>u.charCodeAt(0));if(c.length!==Math.min(o.chunk_bytes,o.bytes-a*o.chunk_bytes))throw new Error("Ein Symcon-Datenpaket wurde unvollst\xE4ndig \xFCbertragen.");s.push(i.decode(c,{stream:!0}))}return s.push(i.decode()),JSON.parse(s.join(""))}finally{await wi(r,"transport/release",{transfer_id:o.id}).catch(()=>{})}}function $m(){let r=window.__NEXTFLOOR_SYMCON__;if(!r?.endpoint||!r.token)throw new Error("NextFloor Symcon host configuration is missing");return r}var Pr=class{settings=$m();changeListeners=new Set;buildingListeners=new Set;timer;stateRevision=-1;buildingRevision=-1;objectsSignature="";refreshing=!1;states={};entities={};areas={};facade={language:this.settings.language||navigator.language||"de",user:{is_admin:!0,name:this.settings.title||"IP-Symcon"},states:this.states,entities:this.entities,areas:this.areas,symconObjects:[],config:{unit_system:{temperature:"\xB0C"}},themes:{darkMode:window.matchMedia?.("(prefers-color-scheme: dark)").matches??!0},services:{},connection:{subscribeMessage:async(e,t)=>{if(t.type==="nextfloor/building/subscribe"){let n=o=>e({revision:o});return this.buildingListeners.add(n),async()=>{this.buildingListeners.delete(n)}}return async()=>{}}},callWS:e=>this.callWS(e),callService:(e,t,n)=>this.callService(e,t,n),fetchWithAuth:(e,t)=>this.fetchWithToken(e,t),hassUrl:(e="")=>new URL(e,window.location.origin).href};async start(){let e=await yn(this.settings,"bootstrap");return this.apply(e),this.stateRevision=e.state_revision,this.buildingRevision=e.building_revision,this.timer=setInterval(()=>{this.refresh()},800),this.snapshot()}stop(){this.timer&&clearInterval(this.timer),this.timer=void 0}onChange(e){return this.changeListeners.add(e),()=>this.changeListeners.delete(e)}snapshot(){return{...this.facade,states:{...this.states},entities:{...this.entities},areas:{...this.areas}}}async refresh(){if(!this.refreshing){this.refreshing=!0;try{let e=await yn(this.settings,"variables/snapshot",{revision:this.stateRevision});if(e.state_revision!==this.stateRevision&&e.variables){this.stateRevision=e.state_revision,this.apply({variables:e.variables,areas:e.areas,objects:e.objects});for(let t of this.changeListeners)t()}if(e.building_revision!==this.buildingRevision){this.buildingRevision=e.building_revision;for(let t of this.buildingListeners)t(e.building_revision)}}catch{}finally{this.refreshing=!1}}}apply(e){if(this.states=Object.fromEntries(e.variables.map(t=>[t.entity_id,{entity_id:t.entity_id,state:t.state,attributes:{...t.attributes,friendly_name:t.name,symcon_path:t.path}}])),this.entities=Object.fromEntries(e.variables.map(t=>[t.entity_id,{entity_id:t.entity_id,name:t.name,area_id:t.area_id??null,device_id:t.device_id??null}])),e.areas&&(this.areas=Object.fromEntries(e.areas.map(t=>[t.area_id,t]))),this.facade.states=this.states,this.facade.entities=this.entities,this.facade.areas=this.areas,e.objects){let t=JSON.stringify(e.objects);t!==this.objectsSignature&&(this.facade.symconObjects=e.objects,this.objectsSignature=t)}}async callWS(e){let t=String(e.type??"");if(!t.startsWith("nextfloor/"))throw new Error(`Unsupported Symcon websocket command: ${t}`);let{type:n,...o}=e;Line truncated
|
||||||
/*! Bundled license information:
|
/*! Bundled license information:
|
||||||
|
|
||||||
@lit/reactive-element/css-tag.js:
|
@lit/reactive-element/css-tag.js:
|
||||||
|
|||||||
+119
-3
@@ -14,6 +14,10 @@ class NextFloor extends IPSModuleStrict
|
|||||||
private const MAX_BUILDING_BYTES = 8_000_000;
|
private const MAX_BUILDING_BYTES = 8_000_000;
|
||||||
private const MAX_IMAGE_BYTES = 8_000_000;
|
private const MAX_IMAGE_BYTES = 8_000_000;
|
||||||
private const MAX_HISTORY = 20;
|
private const MAX_HISTORY = 20;
|
||||||
|
private const MAX_API_RESPONSE_BYTES = 256 * 1024;
|
||||||
|
private const TRANSFER_CHUNK_BYTES = 128 * 1024;
|
||||||
|
private const MAX_TRANSFER_BYTES = 64 * 1024 * 1024;
|
||||||
|
private const TRANSFER_TTL = 120;
|
||||||
|
|
||||||
public function Create(): void
|
public function Create(): void
|
||||||
{
|
{
|
||||||
@@ -304,9 +308,11 @@ class NextFloor extends IPSModuleStrict
|
|||||||
'backup/export' => ['format' => 'nextfloor-backup', 'version' => 1, 'building' => $this->building(), 'packs' => $this->importedPacks()],
|
'backup/export' => ['format' => 'nextfloor-backup', 'version' => 1, 'building' => $this->building(), 'packs' => $this->importedPacks()],
|
||||||
'backup/import' => $this->backupImport($this->arrayValue($request, 'building'), $request['packs'] ?? []),
|
'backup/import' => $this->backupImport($this->arrayValue($request, 'building'), $request['packs'] ?? []),
|
||||||
'variables/action' => $this->variableAction((string) ($request['domain'] ?? ''), (string) ($request['service'] ?? ''), $this->arrayValue($request, 'data')),
|
'variables/action' => $this->variableAction((string) ($request['domain'] ?? ''), (string) ($request['service'] ?? ''), $this->arrayValue($request, 'data')),
|
||||||
|
'transport/read' => $this->readTransfer((string) ($request['transfer_id'] ?? ''), (int) ($request['index'] ?? -1)),
|
||||||
|
'transport/release' => $this->releaseTransfer((string) ($request['transfer_id'] ?? '')),
|
||||||
default => throw new RuntimeException('unknown_action')
|
default => throw new RuntimeException('unknown_action')
|
||||||
};
|
};
|
||||||
$this->sendJson($result);
|
$this->sendApiResult($result, ($request['transport'] ?? '') === 'nextfloor-chunks-v1');
|
||||||
} catch (InvalidArgumentException $error) {
|
} catch (InvalidArgumentException $error) {
|
||||||
$this->sendError(400, $error->getMessage());
|
$this->sendError(400, $error->getMessage());
|
||||||
} catch (RuntimeException $error) {
|
} catch (RuntimeException $error) {
|
||||||
@@ -522,7 +528,7 @@ class NextFloor extends IPSModuleStrict
|
|||||||
|
|
||||||
private function stateRevision(array $objects): int
|
private function stateRevision(array $objects): int
|
||||||
{
|
{
|
||||||
$hash = hash('sha256', json_encode($objects, JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE));
|
$hash = hash('sha256', $this->encodeResponse($objects));
|
||||||
if (!hash_equals($this->ReadAttributeString('StateHash'), $hash)) {
|
if (!hash_equals($this->ReadAttributeString('StateHash'), $hash)) {
|
||||||
$this->WriteAttributeString('StateHash', $hash);
|
$this->WriteAttributeString('StateHash', $hash);
|
||||||
$this->WriteAttributeInteger('StateRevision', $this->ReadAttributeInteger('StateRevision') + 1);
|
$this->WriteAttributeInteger('StateRevision', $this->ReadAttributeInteger('StateRevision') + 1);
|
||||||
@@ -827,9 +833,119 @@ class NextFloor extends IPSModuleStrict
|
|||||||
|
|
||||||
private function sendJson(array $data): void
|
private function sendJson(array $data): void
|
||||||
{
|
{
|
||||||
|
$encoded = $this->encodeResponse($data);
|
||||||
header('Content-Type: application/json; charset=utf-8');
|
header('Content-Type: application/json; charset=utf-8');
|
||||||
header('Cache-Control: no-store');
|
header('Cache-Control: no-store');
|
||||||
echo json_encode($data, JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE);
|
echo $encoded;
|
||||||
|
}
|
||||||
|
|
||||||
|
private function encodeResponse(array $data): string
|
||||||
|
{
|
||||||
|
return json_encode($data, JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE | JSON_INVALID_UTF8_SUBSTITUTE | JSON_THROW_ON_ERROR);
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Never emit a JSON response near the kernel's default 1 MiB PHP output limit. */
|
||||||
|
private function sendApiResult(array $data, bool $supportsChunks): void
|
||||||
|
{
|
||||||
|
$encoded = $this->encodeResponse($data);
|
||||||
|
if (strlen($encoded) <= self::MAX_API_RESPONSE_BYTES) {
|
||||||
|
header('Content-Type: application/json; charset=utf-8');
|
||||||
|
header('Cache-Control: no-store');
|
||||||
|
echo $encoded;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (!$supportsChunks) {
|
||||||
|
$this->sendError(409, 'client_update_required: Bitte den Designer neu laden.');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
$this->sendJson(['_nextfloor_transfer' => $this->createTransfer($encoded)]);
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Large results use private, short-lived snapshots, not the module's size-limited SetBuffer. */
|
||||||
|
private function transferDirectory(): string
|
||||||
|
{
|
||||||
|
$directory = rtrim(sys_get_temp_dir(), '/\\') . DIRECTORY_SEPARATOR . 'nextfloor-transfers-' . $this->InstanceID;
|
||||||
|
if (is_link($directory) || (!is_dir($directory) && !mkdir($directory, 0700, true) && !is_dir($directory))) {
|
||||||
|
throw new RuntimeException('transfer_storage_unavailable');
|
||||||
|
}
|
||||||
|
return $directory;
|
||||||
|
}
|
||||||
|
|
||||||
|
private function transferFile(string $id): string
|
||||||
|
{
|
||||||
|
if (preg_match('/^[a-f0-9]{32}$/D', $id) !== 1) {
|
||||||
|
throw new InvalidArgumentException('invalid_transfer_id');
|
||||||
|
}
|
||||||
|
return $this->transferDirectory() . DIRECTORY_SEPARATOR . $id . '.json';
|
||||||
|
}
|
||||||
|
|
||||||
|
private function createTransfer(string $encoded): array
|
||||||
|
{
|
||||||
|
$bytes = strlen($encoded);
|
||||||
|
if ($bytes > self::MAX_TRANSFER_BYTES) {
|
||||||
|
throw new InvalidArgumentException('response_too_large');
|
||||||
|
}
|
||||||
|
$active = 0;
|
||||||
|
foreach (glob($this->transferDirectory() . DIRECTORY_SEPARATOR . '*.json') ?: [] as $file) {
|
||||||
|
if (preg_match('/^[a-f0-9]{32}\.json$/D', basename($file)) !== 1 || is_link($file)) continue;
|
||||||
|
if ((int) filemtime($file) < time() - self::TRANSFER_TTL) {
|
||||||
|
unlink($file);
|
||||||
|
} else {
|
||||||
|
$active++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if ($active >= 8) throw new RuntimeException('transfer_busy: Bitte kurz warten und erneut laden.');
|
||||||
|
$id = bin2hex(random_bytes(16));
|
||||||
|
$file = $this->transferFile($id);
|
||||||
|
$handle = fopen($file, 'xb');
|
||||||
|
if ($handle === false) throw new RuntimeException('transfer_storage_unavailable');
|
||||||
|
chmod($file, 0600);
|
||||||
|
try {
|
||||||
|
$written = 0;
|
||||||
|
while ($written < $bytes) {
|
||||||
|
$count = fwrite($handle, substr($encoded, $written));
|
||||||
|
if ($count === false || $count === 0) throw new RuntimeException('transfer_write_failed');
|
||||||
|
$written += $count;
|
||||||
|
}
|
||||||
|
} catch (Throwable $error) {
|
||||||
|
fclose($handle);
|
||||||
|
unlink($file);
|
||||||
|
throw $error;
|
||||||
|
}
|
||||||
|
fclose($handle);
|
||||||
|
return ['id' => $id, 'bytes' => $bytes, 'chunk_bytes' => self::TRANSFER_CHUNK_BYTES, 'chunks' => (int) ceil($bytes / self::TRANSFER_CHUNK_BYTES)];
|
||||||
|
}
|
||||||
|
|
||||||
|
private function readTransfer(string $id, int $index): array
|
||||||
|
{
|
||||||
|
$file = $this->transferFile($id);
|
||||||
|
if (!is_file($file) || is_link($file)) throw new RuntimeException('transfer_not_found');
|
||||||
|
if ((int) filemtime($file) < time() - self::TRANSFER_TTL) {
|
||||||
|
unlink($file);
|
||||||
|
throw new RuntimeException('transfer_expired: Bitte erneut laden.');
|
||||||
|
}
|
||||||
|
$bytes = (int) filesize($file);
|
||||||
|
if ($index < 0 || $index >= (int) ceil($bytes / self::TRANSFER_CHUNK_BYTES)) {
|
||||||
|
throw new InvalidArgumentException('invalid_transfer_index');
|
||||||
|
}
|
||||||
|
$handle = fopen($file, 'rb');
|
||||||
|
if ($handle === false) throw new RuntimeException('transfer_not_found');
|
||||||
|
try {
|
||||||
|
if (fseek($handle, $index * self::TRANSFER_CHUNK_BYTES) !== 0) throw new RuntimeException('transfer_read_failed');
|
||||||
|
$data = fread($handle, self::TRANSFER_CHUNK_BYTES);
|
||||||
|
if ($data === false) throw new RuntimeException('transfer_read_failed');
|
||||||
|
} finally {
|
||||||
|
fclose($handle);
|
||||||
|
}
|
||||||
|
touch($file); // Active slow connections keep their immutable snapshot alive.
|
||||||
|
return ['index' => $index, 'data' => base64_encode($data)];
|
||||||
|
}
|
||||||
|
|
||||||
|
private function releaseTransfer(string $id): array
|
||||||
|
{
|
||||||
|
$file = $this->transferFile($id);
|
||||||
|
if (is_file($file) && !is_link($file)) unlink($file);
|
||||||
|
return [];
|
||||||
}
|
}
|
||||||
|
|
||||||
private function sendError(int $status, string $error): void
|
private function sendError(int $status, string $error): void
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ In **Kerninstanzen → Modules** wird dieses Repository verwendet:
|
|||||||
|
|
||||||
Im Zahnrad des Eintrags den Branch **`symcon`** wählen und auf Aktualisierungen prüfen.
|
Im Zahnrad des Eintrags den Branch **`symcon`** wählen und auf Aktualisierungen prüfen.
|
||||||
`main` enthält die Quellen für die Entwicklung, `symcon` die installierbare Bibliothek.
|
`main` enthält die Quellen für die Entwicklung, `symcon` die installierbare Bibliothek.
|
||||||
Nach der Aktualisierung auf **0.2.2 / Build 5** die Konsole neu laden. Unter
|
Nach der Aktualisierung auf **0.2.3 / Build 6** die Konsole neu laden. Unter
|
||||||
**Instanz hinzufügen → Hersteller NextFloor** erscheint **„NextFloor Designer und 3D-Kachel“**.
|
**Instanz hinzufügen → Hersteller NextFloor** erscheint **„NextFloor Designer und 3D-Kachel“**.
|
||||||
|
|
||||||
### Für die Entwicklung
|
### Für die Entwicklung
|
||||||
@@ -46,6 +46,23 @@ Die Dateien unter `NextFloor/assets/` und `NextFloor/packs/` werden durch
|
|||||||
Der Build prüft anschließend die Modulmetadaten und die installierbare Verzeichnisstruktur.
|
Der Build prüft anschließend die Modulmetadaten und die installierbare Verzeichnisstruktur.
|
||||||
Dieselbe Prüfung lässt sich separat mit `node symcon/tests/validate-package.mjs` ausführen.
|
Dieselbe Prüfung lässt sich separat mit `node symcon/tests/validate-package.mjs` ausführen.
|
||||||
|
|
||||||
|
## Änderungen in 0.2.3
|
||||||
|
|
||||||
|
- Große Objektbäume verursachen beim Laden nicht mehr „Output-Buffer exceeds Limit
|
||||||
|
(1048576 bytes)“. Große API-Antworten werden vollständig in kleinen Paketen übertragen;
|
||||||
|
keine einzelne JSON-Antwort überschreitet 256 KiB. Das gilt auch für Möbelpakete,
|
||||||
|
Bilder, Pläne und Backups, die über dieselbe API geladen werden.
|
||||||
|
- Ein Test mit 10.000 Variablen und Objekten überträgt rund 5,5 MB bei höchstens
|
||||||
|
rund 175 KB pro Antwort. Namen und Werte bleiben einschließlich Umlauten und Emojis erhalten.
|
||||||
|
- Die Übertragung verwendet eine unveränderliche Momentaufnahme in privaten temporären
|
||||||
|
Dateien statt des ebenfalls größenbegrenzten Modul-Buffers. Nach Abschluss werden diese
|
||||||
|
gelöscht; verwaiste Übertragungen verfallen nach zwei Minuten Inaktivität und werden
|
||||||
|
beim nächsten Zugriff aufgeräumt.
|
||||||
|
- Während einer laufenden Aktualisierung wird keine zweite gestartet. Fehlerhafte
|
||||||
|
oder leere Antworten werden verständlich gemeldet statt nur als „HTTP 200“.
|
||||||
|
|
||||||
|
Nach dem Update den Designer neu laden, damit die neue Übertragung auf beiden Seiten aktiv ist.
|
||||||
|
|
||||||
## Änderungen in 0.2.2
|
## Änderungen in 0.2.2
|
||||||
|
|
||||||
- Die Datenpunktauswahl zeigt in der Hauptansicht die Objekte der Hauptkategorie.
|
- Die Datenpunktauswahl zeigt in der Hauptansicht die Objekte der Hauptkategorie.
|
||||||
|
|||||||
+2
-2
@@ -6,7 +6,7 @@
|
|||||||
"compatibility": {
|
"compatibility": {
|
||||||
"version": "9.0"
|
"version": "9.0"
|
||||||
},
|
},
|
||||||
"version": "0.2.2",
|
"version": "0.2.3",
|
||||||
"build": 5,
|
"build": 6,
|
||||||
"date": 1794211200
|
"date": 1794211200
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,72 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
class IPSModuleStrict
|
||||||
|
{
|
||||||
|
protected int $InstanceID;
|
||||||
|
public function __construct(int $id) { $this->InstanceID = $id; }
|
||||||
|
}
|
||||||
|
function check(bool $condition, string $message): void { if (!$condition) throw new RuntimeException($message); }
|
||||||
|
require __DIR__ . '/../NextFloor/module.php';
|
||||||
|
$module = new NextFloor(random_int(1000000, 2000000));
|
||||||
|
$send = new ReflectionMethod($module, 'sendApiResult');
|
||||||
|
$read = new ReflectionMethod($module, 'readTransfer');
|
||||||
|
$release = new ReflectionMethod($module, 'releaseTransfer');
|
||||||
|
$directoryMethod = new ReflectionMethod($module, 'transferDirectory');
|
||||||
|
$directory = $directoryMethod->invoke($module);
|
||||||
|
$capture = static function (array $data, bool $chunked = true) use ($send, $module): string {
|
||||||
|
ob_start();
|
||||||
|
try { $send->invoke($module, $data, $chunked); return (string) ob_get_contents(); }
|
||||||
|
finally { ob_end_clean(); }
|
||||||
|
};
|
||||||
|
$fixture = ['variables' => [], 'objects' => []];
|
||||||
|
for ($index = 0; $index < 10000; $index++) {
|
||||||
|
$variable = ['entity_id' => 'sensor.' . $index, 'name' => 'Zähler Küche ÄÖÜ 🌞 ' . $index,
|
||||||
|
'path' => 'Haus / Küche / ' . str_repeat('Unterkategorie / ', 8) . $index, 'state' => '21.5', 'attributes' => ['unit_of_measurement' => '°C']];
|
||||||
|
$fixture['variables'][] = $variable;
|
||||||
|
$fixture['objects'][] = ['object_id' => $index + 1, 'parent_id' => 0, 'name' => $variable['name'], 'path' => $variable['path'], 'object_type' => 2];
|
||||||
|
}
|
||||||
|
$raw = json_encode($fixture, JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE | JSON_THROW_ON_ERROR);
|
||||||
|
check(strlen($raw) > 1048576, 'Large fixture must exceed the reported kernel limit');
|
||||||
|
$small = $capture(['revision' => 1]);
|
||||||
|
check(json_decode($small, true) === ['revision' => 1], 'Small responses remain ordinary JSON');
|
||||||
|
$manifestJson = $capture($fixture);
|
||||||
|
$manifest = json_decode($manifestJson, true, 512, JSON_THROW_ON_ERROR)['_nextfloor_transfer'];
|
||||||
|
$file = $directory . DIRECTORY_SEPARATOR . $manifest['id'] . '.json';
|
||||||
|
try {
|
||||||
|
$assembled = '';
|
||||||
|
$largest = strlen($manifestJson);
|
||||||
|
for ($index = 0; $index < $manifest['chunks']; $index++) {
|
||||||
|
$chunk = $read->invoke($module, $manifest['id'], $index);
|
||||||
|
$wire = $capture($chunk);
|
||||||
|
$largest = max($largest, strlen($wire));
|
||||||
|
check(strlen($wire) <= 256 * 1024, 'Every wire response must stay safely below 1 MiB');
|
||||||
|
$decoded = json_decode($wire, true, 512, JSON_THROW_ON_ERROR);
|
||||||
|
$assembled .= base64_decode($decoded['data'], true);
|
||||||
|
}
|
||||||
|
check($assembled === $raw, 'All variables and objects must survive the transfer byte-for-byte');
|
||||||
|
check(strlen($assembled) === $manifest['bytes'], 'Manifest size must match the actual JSON bytes');
|
||||||
|
$release->invoke($module, $manifest['id']);
|
||||||
|
check(!is_file($file), 'Completed transfers must be removed');
|
||||||
|
|
||||||
|
foreach (['../escape', str_repeat('a', 31), str_repeat('z', 32)] as $badID) {
|
||||||
|
try { $read->invoke($module, $badID, 0); throw new LogicException('Invalid transfer ID was accepted'); }
|
||||||
|
catch (InvalidArgumentException $expected) {}
|
||||||
|
}
|
||||||
|
$expired = json_decode($capture($fixture), true)['_nextfloor_transfer'];
|
||||||
|
$expiredFile = $directory . DIRECTORY_SEPARATOR . $expired['id'] . '.json';
|
||||||
|
touch($expiredFile, time() - 180);
|
||||||
|
clearstatcache(true, $expiredFile);
|
||||||
|
try { $read->invoke($module, $expired['id'], 0); throw new LogicException('Expired transfer was accepted'); }
|
||||||
|
catch (RuntimeException $expected) { check(str_starts_with($expected->getMessage(), 'transfer_expired'), 'Report transfer expiry'); }
|
||||||
|
check(!is_file($expiredFile), 'Expired snapshots must be deleted');
|
||||||
|
|
||||||
|
$legacy = json_decode($capture($fixture, false), true);
|
||||||
|
check(http_response_code() === 409 && str_contains($legacy['error'], 'client_update_required'), 'A stale browser must get a small reload error, never an oversized response');
|
||||||
|
echo 'OK: 10000 variables and objects (' . strlen($raw) . ' bytes), largest response ' . $largest . " bytes; exact reassembly, expiry, cleanup and legacy-client guard\n";
|
||||||
|
} finally {
|
||||||
|
$release->invoke($module, $manifest['id']);
|
||||||
|
// Only this fixture's freshly-created directory, and only if empty (no recursive cleanup).
|
||||||
|
if ((glob($directory . DIRECTORY_SEPARATOR . '*') ?: []) === []) rmdir($directory);
|
||||||
|
}
|
||||||
Reference in new issue
Block a user