feat: add floating room climate cards and fix Symcon humidity selection

This commit is contained in:
jhartworks committed 2026-11-09 17:04:46 +01:00
1 parent 24188f96f7
commit ff54f4461a
21 files changed
+764 -398

No files matched your search

@@ -1,7 +1,7 @@
/*! 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"};var bo=globalThis,yo=bo.ShadowRoot&&(bo.ShadyCSS===void 0||bo.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,qi=Symbol(),Ll=new WeakMap,cr=class{constructor(e,n,r){if(this._$cssResult$=!0,r!==qi)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=e,this.t=n}get styleSheet(){let e=this.o,n=this.t;if(yo&&e===void 0){let r=n!==void 0&&n.length===1;r&&(e=Ll.get(n)),e===void 0&&((this.o=e=new CSSStyleSheet).replaceSync(this.cssText),r&&Ll.set(n,e))}return e}toString(){return this.cssText}},Cl=t=>new cr(typeof t=="string"?t:t+"",void 0,qi),se=(t,...e)=>{let n=t.length===1?t[0]:e.reduce((r,o,i)=>r+(s=>{if(s._$cssResult$===!0)return s.cssText;if(typeof s=="number")return s;throw Error("Value passed to 'css' function must be a 'css' function result: "+s+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(o)+t[i+1],t[0]);return new cr(n,t,qi)},Nl=(t,e)=>{if(yo)t.adoptedStyleSheets=e.map(n=>n instanceof CSSStyleSheet?n:n.styleSheet);else for(let n of e){let r=document.createElement("style"),o=bo.litNonce;o!==void 0&&r.setAttribute("nonce",o),r.textContent=n.cssText,t.appendChild(r)}},Yi=yo?t=>t:t=>t instanceof CSSStyleSheet?(e=>{let n="";for(let r of e.cssRules)n+=r.cssText;return Cl(n)})(t):t;var{is:Xg,defineProperty:Qg,getOwnPropertyDescriptor:Jg,getOwnPropertyNames:e_,getOwnPropertySymbols:t_,getPrototypeOf:n_}=Object,wo=globalThis,Bl=wo.trustedTypes,r_=Bl?Bl.emptyScript:"",o_=wo.reactiveElementPolyfillSupport,dr=(t,e)=>t,Xi={toAttribute(t,e){switch(e){case Boolean:t=t?r_:null;break;case Object:case Array:t=t==null?t:JSON.stringify(t)}return t},fromAttribute(t,e){let n=t;switch(e){case Boolean:n=t!==null;break;case Number:n=t===null?null:Number(t);break;case Object:case Array:try{n=JSON.parse(t)}catch{n=null}}return n}},Vl=(t,e)=>!Xg(t,e),Wl={attribute:!0,type:String,converter:Xi,reflect:!1,useDefault:!1,hasChanged:Vl};Symbol.metadata??=Symbol("metadata"),wo.litPropertyMetadata??=new WeakMap;var mt=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,n=Wl){if(n.state&&(n.attribute=!1),this._$Ei(),this.prototype.hasOwnProperty(e)&&((n=Object.create(n)).wrapped=!0),this.elementProperties.set(e,n),!n.noAccessor){let r=Symbol(),o=this.getPropertyDescriptor(e,r,n);o!==void 0&&Qg(this.prototype,e,o)}}static getPropertyDescriptor(e,n,r){let{get:o,set:i}=Jg(this.prototype,e)??{get(){return this[n]},set(s){this[n]=s}};return{get:o,set(s){let l=o?.call(this);i?.call(this,s),this.requestUpdate(e,l,r)},configurable:!0,enumerable:!0}}static getPropertyOptions(e){return this.elementProperties.get(e)??Wl}static _$Ei(){if(this.hasOwnProperty(dr("elementProperties")))return;let e=n_(this);e.finalize(),e.l!==void 0&&(this.l=[...e.l]),this.elementProperties=new Map(e.elementProperties)}static finalize(){if(this.hasOwnProperty(dr("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(dr("properties"))){let n=this.properties,r=[...e_(n),...t_(n)];for(let o of r)this.createProperty(o,n[o])}let e=this[Symbol.metadata];if(e!==null){let n=litPropertyMetadata.get(e);if(n!==void 0)for(let[r,o]of n)this.elementProperties.set(r,o)}this._$Eh=new Map;for(let[n,r]of this.elementProperties){let o=this._$Eu(n,r);o!==void 0&&this._$Eh.set(o,n)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(e){let n=[];if(Array.isArray(e)){let r=new Set(e.flat(1/0).reverse());for(let o of r)n.unshift(Yi(o))}else e!==void 0&&n.push(Yi(e));return n}static _$Eu(e,n){let r=n.attribute;return r===!1?void 0:typeof r=="string"?r:typeof e=="string"?e.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){this._$ES=new Promise(e=>this.enableUpdating=e),this._$AL=new Map,this._$E_(),this.requestUpdate(),this.constructor.l?.forEach(e=>e(this))}addController(e){(this._$EO??=new Set).add(e),this.renderRoot!==void 0&&this.isConnected&&e.hostConnected?.()}removeController(e){this._$EO?.delete(e)}_$E_(){let e=new Map,n=this.constructor.elementProperties;for(let r of n.keys())this.hasOwnProperty(r)&&(e.set(r,this[r]),delete this[r]);e.size>0&&(this._$Ep=e)}createRenderRoot(){let e=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return Nl(e,this.constructor.elementStyles),e}connectedCallback(){this.renderRoot??=this.createRenderRoot(),this.enableUpdating(!0),this._$EO?.forEach(e=>e.hostConnected?.())}enableUpdating(e){}disconnectedCallback(){this._$EO?.Line truncated
\f\r]`,ur=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,jl=/-->/g,Ul=/>/g,Gt=RegExp(`>|${Qi}(?:([^\\s"'>=/]+)(${Qi}*=${Qi}*(?:[^
\f\r"'\`<>=]|("|')|))|$)`,"g"),Zl=/'/g,ql=/"/g,Ql=/^(?:script|style|textarea|title)$/i,rs=t=>(e,...n)=>({_$litType$:t,strings:e,values:n}),m=rs(1),R=rs(2),Ak=rs(3),Qe=Symbol.for("lit-noChange"),_=Symbol.for("lit-nothing"),Yl=new WeakMap,jt=Ut.createTreeWalker(Ut,129);function Jl(t,e){if(!ns(t)||!t.hasOwnProperty("raw"))throw Error("invalid template strings array");return Gl!==void 0?Gl.createHTML(e):e}var ec=(t,e)=>{let n=t.length-1,r=[],o,i=e===2?"<svg>":e===3?"<math>":"",s=ur;for(let l=0;l<n;l++){let a=t[l],c,d,u=-1,p=0;for(;p<a.length&&(s.lastIndex=p,d=s.exec(a),d!==null);)p=s.lastIndex,s===ur?d[1]==="!--"?s=jl:d[1]!==void 0?s=Ul:d[2]!==void 0?(Ql.test(d[2])&&(o=RegExp("</"+d[2],"g")),s=Gt):d[3]!==void 0&&(s=Gt):s===Gt?d[0]===">"?(s=o??ur,u=-1):d[1]===void 0?u=-2:(u=s.lastIndex-d[2].length,c=d[1],s=d[3]===void 0?Gt:d[3]==='"'?ql:Zl):s===ql||s===Zl?s=Gt:s===jl||s===Ul?s=ur:(s=Gt,o=void 0);let h=s===Gt&&t[l+1].startsWith("/>")?" ":"";i+=s===ur?a+i_:u>=0?(r.push(c),a.slice(0,u)+es+a.slice(u)+gt+h):a+gt+(u===-2?l:h)}return[Jl(t,i+(t[n]||"<?>")+(e===2?"</svg>":e===3?"</math>":"")),r]},fr=class t{constructor({strings:e,_$litType$:n},r){let o;this.parts=[];let i=0,s=0,l=e.length-1,a=this.parts,[c,d]=ec(e,n);if(this.el=t.createElement(c,r),jt.currentNode=this.el.content,n===2||n===3){let u=this.el.content.firstChild;u.replaceWith(...u.childNodes)}for(;(o=jt.nextNode())!==null&&a.length<l;){if(o.nodeType===1){if(o.hasAttributes())for(let u of o.getAttributeNames())if(u.endsWith(es)){let p=d[s++],h=o.getAttribute(u).split(gt),f=/([.?@])?(.*)/.exec(p);a.push({type:1,index:i,name:f[2],strings:h,ctor:f[1]==="."?xo:f[1]==="?"?$o:f[1]==="@"?So:qt}),o.removeAttribute(u)}else u.startsWith(gt)&&(a.push({type:6,index:i}),o.removeAttribute(u));if(Ql.test(o.tagName)){let u=o.textContent.split(gt),p=u.length-1;if(p>0){o.textContent=vo?vo.emptyScript:"";for(let h=0;h<p;h++)o.append(u[h],hr()),jt.nextNode(),a.push({type:2,index:++i});o.append(u[p],hr())}}}else if(o.nodeType===8)if(o.data===ts)a.push({type:2,index:i});else{let u=-1;for(;(u=o.data.indexOf(gt,u+1))!==-1;)a.push({type:7,index:i}),u+=gt.length-1}i++}}static createElement(e,n){let r=Ut.createElement("template");return r.innerHTML=e,r}};function Zt(t,e,n=t,r){if(e===Qe)return e;let o=r!==void 0?n._$Co?.[r]:n._$Cl,i=pr(e)?void 0:e._$litDirective$;return o?.constructor!==i&&(o?._$AO?.(!1),i===void 0?o=void 0:(o=new i(t),o._$AT(t,n,r)),r!==void 0?(n._$Co??=[])[r]=o:n._$Cl=o),o!==void 0&&(e=Zt(t,o._$AS(t,e.values),o,r)),e}var ko=class{constructor(e,n){this._$AV=[],this._$AN=void 0,this._$AD=e,this._$AM=n}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(e){let{el:{content:n},parts:r}=this._$AD,o=(e?.creationScope??Ut).importNode(n,!0);jt.currentNode=o;let i=jt.nextNode(),s=0,l=0,a=r[0];for(;a!==void 0;){if(s===a.index){let c;a.type===2?c=new yn(i,i.nextSibling,this,e):a.type===1?c=new a.ctor(i,a.name,a.strings,this,e):a.type===6&&(c=new Mo(i,this,e)),this._$AV.push(c),a=r[++l]}s!==a?.index&&(i=jt.nextNode(),s++)}return jt.currentNode=Ut,o}p(e){let n=0;for(let r of this._$AV)r!==void 0&&(r.strings!==void 0?(r._$AI(e,r,n),n+=r.strings.length-2):r._$AI(e[n])),n++}},yn=class t{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(e,n,r,o){this.type=2,this._$AH=_,this._$AN=void 0,this._$AA=e,this._$AB=n,this._$AM=r,this.options=o,this._$Cv=o?.isConnected??!0}get parentNode(){let e=this._$AA.parentNode,n=this._$AM;return n!==void 0&&e?.nodeType===11&&(e=n.parentNode),e}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(e,n=this){e=Zt(this,e,n),pr(e)?e===_||e==null||e===""?(this._$AH!==_&&this._$AR(),this._$AH=_):e!==this._$AH&&e!==Qe&&this._(e):e._$litType$!==void 0?this.$(e):e.nodeType!==void 0?this.T(e):Xl(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!==_&&pr(this._$AH)?this._$AA.nextSibling.data=e:this.T(Ut.createTextNode(e)),this._$AH=e}$(e){let{values:n,_$litType$:r}=e,o=typeof r=="number"?this._$AC(e):(r.el===void 0&&(r.el=fr.createElement(Jl(r.h,r.h[0]),this.options)),r);if(this._$AH?._$AD===o)this._$AH.p(n);else{let i=new ko(o,this),s=i.u(this.options);i.p(n),this.T(s),this._$AH=i}}_$AC(e){let n=Yl.get(e.strings);return n===void 0&&Yl.set(e.strings,n=new fr(e)),n}k(e){ns(this._$AH)||(this._$AH=[],this._$AR());let n=this._$AH,r,o=0;for(let i of e)o===n.length?n.push(r=new t(this.O(hr()),this.O(hr()),this,this.options)):r=n[o],r._$AI(i),o++;o<n.length&&(this._$AR(r&&r._$AB.nextSibling,o),n.length=o)}_$AR(e=this._$AA.nextSibling,n){for(this._$AP?.(!1,!0,n);e!==this._$AB;){let r=Kl(e).nextSibling;Kl(e).remove(),e=r}}setConnected(e){this._$AM===void 0&&(this._$Cv=e,this._$AP?.(e))}},qt=class{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(e,n,r,o,i){this.type=1,this._$AH=_,this._$AN=void 0,this.element=e,this.name=n,this._$AM=o,this.options=i,r.length>2||r[0]!==""||r[1]!==""?(this._Line truncated
\f\r"'\`<>=]|("|')|))|$)`,"g"),Zl=/'/g,ql=/"/g,Ql=/^(?:script|style|textarea|title)$/i,rs=t=>(e,...n)=>({_$litType$:t,strings:e,values:n}),m=rs(1),R=rs(2),Ak=rs(3),Qe=Symbol.for("lit-noChange"),_=Symbol.for("lit-nothing"),Yl=new WeakMap,jt=Ut.createTreeWalker(Ut,129);function Jl(t,e){if(!ns(t)||!t.hasOwnProperty("raw"))throw Error("invalid template strings array");return Gl!==void 0?Gl.createHTML(e):e}var ec=(t,e)=>{let n=t.length-1,r=[],o,i=e===2?"<svg>":e===3?"<math>":"",s=ur;for(let l=0;l<n;l++){let a=t[l],c,d,u=-1,p=0;for(;p<a.length&&(s.lastIndex=p,d=s.exec(a),d!==null);)p=s.lastIndex,s===ur?d[1]==="!--"?s=jl:d[1]!==void 0?s=Ul:d[2]!==void 0?(Ql.test(d[2])&&(o=RegExp("</"+d[2],"g")),s=Gt):d[3]!==void 0&&(s=Gt):s===Gt?d[0]===">"?(s=o??ur,u=-1):d[1]===void 0?u=-2:(u=s.lastIndex-d[2].length,c=d[1],s=d[3]===void 0?Gt:d[3]==='"'?ql:Zl):s===ql||s===Zl?s=Gt:s===jl||s===Ul?s=ur:(s=Gt,o=void 0);let h=s===Gt&&t[l+1].startsWith("/>")?" ":"";i+=s===ur?a+i_:u>=0?(r.push(c),a.slice(0,u)+es+a.slice(u)+gt+h):a+gt+(u===-2?l:h)}return[Jl(t,i+(t[n]||"<?>")+(e===2?"</svg>":e===3?"</math>":"")),r]},fr=class t{constructor({strings:e,_$litType$:n},r){let o;this.parts=[];let i=0,s=0,l=e.length-1,a=this.parts,[c,d]=ec(e,n);if(this.el=t.createElement(c,r),jt.currentNode=this.el.content,n===2||n===3){let u=this.el.content.firstChild;u.replaceWith(...u.childNodes)}for(;(o=jt.nextNode())!==null&&a.length<l;){if(o.nodeType===1){if(o.hasAttributes())for(let u of o.getAttributeNames())if(u.endsWith(es)){let p=d[s++],h=o.getAttribute(u).split(gt),f=/([.?@])?(.*)/.exec(p);a.push({type:1,index:i,name:f[2],strings:h,ctor:f[1]==="."?xo:f[1]==="?"?$o:f[1]==="@"?So:qt}),o.removeAttribute(u)}else u.startsWith(gt)&&(a.push({type:6,index:i}),o.removeAttribute(u));if(Ql.test(o.tagName)){let u=o.textContent.split(gt),p=u.length-1;if(p>0){o.textContent=vo?vo.emptyScript:"";for(let h=0;h<p;h++)o.append(u[h],hr()),jt.nextNode(),a.push({type:2,index:++i});o.append(u[p],hr())}}}else if(o.nodeType===8)if(o.data===ts)a.push({type:2,index:i});else{let u=-1;for(;(u=o.data.indexOf(gt,u+1))!==-1;)a.push({type:7,index:i}),u+=gt.length-1}i++}}static createElement(e,n){let r=Ut.createElement("template");return r.innerHTML=e,r}};function Zt(t,e,n=t,r){if(e===Qe)return e;let o=r!==void 0?n._$Co?.[r]:n._$Cl,i=pr(e)?void 0:e._$litDirective$;return o?.constructor!==i&&(o?._$AO?.(!1),i===void 0?o=void 0:(o=new i(t),o._$AT(t,n,r)),r!==void 0?(n._$Co??=[])[r]=o:n._$Cl=o),o!==void 0&&(e=Zt(t,o._$AS(t,e.values),o,r)),e}var ko=class{constructor(e,n){this._$AV=[],this._$AN=void 0,this._$AD=e,this._$AM=n}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(e){let{el:{content:n},parts:r}=this._$AD,o=(e?.creationScope??Ut).importNode(n,!0);jt.currentNode=o;let i=jt.nextNode(),s=0,l=0,a=r[0];for(;a!==void 0;){if(s===a.index){let c;a.type===2?c=new yn(i,i.nextSibling,this,e):a.type===1?c=new a.ctor(i,a.name,a.strings,this,e):a.type===6&&(c=new Mo(i,this,e)),this._$AV.push(c),a=r[++l]}s!==a?.index&&(i=jt.nextNode(),s++)}return jt.currentNode=Ut,o}p(e){let n=0;for(let r of this._$AV)r!==void 0&&(r.strings!==void 0?(r._$AI(e,r,n),n+=r.strings.length-2):r._$AI(e[n])),n++}},yn=class t{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(e,n,r,o){this.type=2,this._$AH=_,this._$AN=void 0,this._$AA=e,this._$AB=n,this._$AM=r,this.options=o,this._$Cv=o?.isConnected??!0}get parentNode(){let e=this._$AA.parentNode,n=this._$AM;return n!==void 0&&e?.nodeType===11&&(e=n.parentNode),e}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(e,n=this){e=Zt(this,e,n),pr(e)?e===_||e==null||e===""?(this._$AH!==_&&this._$AR(),this._$AH=_):e!==this._$AH&&e!==Qe&&this._(e):e._$litType$!==void 0?this.$(e):e.nodeType!==void 0?this.T(e):Xl(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!==_&&pr(this._$AH)?this._$AA.nextSibling.data=e:this.T(Ut.createTextNode(e)),this._$AH=e}$(e){let{values:n,_$litType$:r}=e,o=typeof r=="number"?this._$AC(e):(r.el===void 0&&(r.el=fr.createElement(Jl(r.h,r.h[0]),this.options)),r);if(this._$AH?._$AD===o)this._$AH.p(n);else{let i=new ko(o,this),s=i.u(this.options);i.p(n),this.T(s),this._$AH=i}}_$AC(e){let n=Yl.get(e.strings);return n===void 0&&Yl.set(e.strings,n=new fr(e)),n}k(e){ns(this._$AH)||(this._$AH=[],this._$AR());let n=this._$AH,r,o=0;for(let i of e)o===n.length?n.push(r=new t(this.O(hr()),this.O(hr()),this,this.options)):r=n[o],r._$AI(i),o++;o<n.length&&(this._$AR(r&&r._$AB.nextSibling,o),n.length=o)}_$AR(e=this._$AA.nextSibling,n){for(this._$AP?.(!1,!0,n);e!==this._$AB;){let r=Kl(e).nextSibling;Kl(e).remove(),e=r}}setConnected(e){this._$AM===void 0&&(this._$Cv=e,this._$AP?.(e))}},qt=class{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(e,n,r,o,i){this.type=1,this._$AH=_,this._$AN=void 0,this.element=e,this.name=n,this._$AM=o,this.options=i,r.length>2||r[0]!==""||r[1]!==""?(this._Line truncated
:host {
--nf-text: var(--primary-text-color, #e1e1e1);
--nf-muted: var(--secondary-text-color, #9b9b9b);
@@ -971,9 +971,11 @@ ${i}`}else o=ju(s)}}catch(s){let l=s.message,a={not_json:"import_error_not_json"
${M(t.t("devices_panel_hint"))}
${t.admin?m`<div class="nf-seg nf-dev-source">${d.map(([p,h])=>m`<button aria-pressed=${a===p} @click=${()=>e.deviceSource=p}>${h}</button>`)}</div>`:_}
${a!=="area"?m`${u}${M0(t,e,n,l,a)}`:R0(t,e,n,l,s,i,r)}
</section>`}function zp(t,e,n){let{hass:r}=t;if(!r)return _;let o=!!e.climate&&Object.values(e.climate).some(l=>l!=null),i=(l,a)=>{let c={...e.climate??{},[l]:a};n({climate:Object.values(c).every(d=>d==null)?null:c})},s=(l,a)=>{let c=pd(r,t.floor??null,{...e,climate:null},l),d=L(r,y=>Ms(r,y,l)),u=Fp(d,y=>(Tt(r,y)===e.area_id?0:1)+(Rs(r,y)?0:2)),p=[e.climate?.[l]??null].flat(),h=y=>{let b=y.filter(v=>!!v&&v!=="none");i(l,y[0]==="none"?"none":b.length>1?b:b[0]??null)},g=p[0]&&p[0]!=="none"?[...p,null]:p;return g.map((y,b)=>P(t,b?t.t("climate_more"):a,y,b?void 0:c[0]??null,u,v=>h(g.map((w,x)=>x===b?v:w))))};return m`<details class="nf-points" ?open=${o}>
</section>`}function zp(t,e,n){let{hass:r}=t;if(!r)return _;let o=!!e.climate&&Object.values(e.climate).some(l=>l!=null),i=(l,a)=>{let c={...e.climate??{},[l]:a};n({climate:Object.values(c).every(d=>d==null)?null:c})},s=(l,a)=>{let c=pd(r,t.floor??null,{...e,climate:null},l),d=[e.climate?.[l]??null].flat(),u=L(r,y=>Ms(r,y,l,!0)&&(!r.states[y]?.attributes.symcon_source_entity||d.includes(y))),p=Fp(u,y=>(Tt(r,y)===e.area_id?0:1)+(Rs(r,y)?0:2)),h=y=>{let b=y.filter(v=>!!v&&v!=="none");i(l,y[0]==="none"?"none":b.length>1?b:b[0]??null)},g=d[0]&&d[0]!=="none"?[...d,null]:d;return g.map((y,b)=>P(t,b?t.t("climate_more"):a,y,b?void 0:c[0]??null,p,v=>h(g.map((w,x)=>x===b?v:w))))};return m`<details class="nf-points" ?open=${o||!!e.climate_card}>
<summary>${t.t("climate")}</summary>
<div class="nf-form">${s("temperature",t.t("climate_temperature"))} ${s("humidity",t.t("climate_humidity"))} ${s("co2",t.t("climate_co2"))}</div>
${H(t,t.t("climate_card"),!!e.climate_card,l=>n({climate_card:l||void 0}))}
${M(t.t("climate_card_hint"))}
${M(t.t("climate_hint"))}
</details>`}var Na="metric",Ip=t=>{Na=t==="imperial"?"imperial":"metric"};var Pp=.3048;function he(t,e,n=2,r=Na){if(r==="metric")return`${j(t,e,n)} m`;let o=e<0?"\u2212":"",i=Math.round(Math.abs(e)/.0254*2),s=Math.floor(i/24),l=i-s*24,a=`${Math.floor(l/2)}${l%2?"\xBD":""}`;return s?`${o}${s}\u2032 ${a}\u2033`:`${o}${a}\u2033`}function Ae(t,e,n=Na){return n==="metric"?`${j(t,e,1)} m\xB2`:`${j(t,e/(Pp*Pp),0)} ft\xB2`}var E0=.15,A0=(t,e)=>Math.abs((t-e+540)%360-180);function F0(t,e,n,r){return t.rooms.some(o=>o.id!==e.id&&o.points.some((i,s)=>{let l=o.points[(s+1)%o.points.length];return Math.abs(Q(K(i,n),r))<.02&&Math.abs(Q(K(l,n),r))<.02}))}function Wa(t,e,n,r){let o=e.points,[i,s]=[o[n],o[(n+1)%o.length]],l=fe(K(s,i)),a=ge(o)>=0?1:-1,c=[(s[0]-i[0])/l,(s[1]-i[1])/l],d=[-c[1]*a||0,c[0]*a||0],u=c[0]*d[1]-c[1]*d[0]>0,p=e.wall_heights?.[n],h=e.ceiling??t.height,f=typeof p=="number"?p:Array.isArray(p)?Math.max(...p.map(b=>b??h)):h,g=e.wall_slopes?.[n],y=typeof g=="number"&&typeof p=="number"?g:f;return{origin:u?i:s,along:u?c:[-c[0],-c[1]],normal:d,length:l,face:F0(t,e,i,d)?r/2:0,heightLeft:u?f:y,heightRight:u?y:f}}function Ba(t,e){let n=K(e,t.origin);return{u:Q(n,t.along),depth:Q(n,t.normal)-t.face}}function T0(t,e){let n=t.rooms.find(s=>s.id===e.room_id);if(!n||e.wall)return null;let[r,o]=[n.points[e.edge],n.points[(e.edge+1)%n.points.length]];if(!r||!o)return null;let i=fe(K(o,r))||1;return[r[0]+(o[0]-r[0])*e.offset/i,r[1]+(o[1]-r[1])*e.offset/i]}var Dp=t=>G(t.type)?.mount==="wall"||t.type==="lamp_wall"||t.mount_y!=null;function Op(t,e,n){let r=[];for(let i of t.openings){let s=T0(t,i);if(!s)continue;let{u:l,depth:a}=Ba(n,s);Math.abs(a+n.face)>.3||l<-.01||l>n.length+.01||r.push({id:i.id,kind:"opening",type:i.type,x0:l-i.width/2,x1:l+i.width/2,y0:i.sill,y1:i.sill+i.height,lifts:i.type==="window"})}let o=Math.atan2(-n.normal[0],n.normal[1])*180/Math.PI;for(let i of t.furniture){if(!N([i.x,i.z],e.points)||A0(i.rotation,o)>20)continue;let{u:s,depth:l}=Ba(n,[i.x,i.z]);if(l-i.d/2>E0||s<0||s>n.length)continue;let a=At(t,i);r.push({id:i.id,kind:"furniture",type:i.type,x0:s-i.w/2,x1:s+i.w/2,y0:a,y1:a+i.h,lifts:Dp(i)})}return r.sort((i,s)=>+(i.kind==="furniture")-+(s.kind==="furniture")||i.x0-s.x0)}var ao=t=>Math.round(t*1e3)/1e3;function Hp(t,e,n,r){let o=Ba(t,[e.x,e.z]).depth,i=Math.min(t.length-e.w/2,Math.max(e.w/2,n+e.w/2)),s=[t.origin[0]+t.along[0]*i+t.normal[0]*(o+t.face),t.origin[1]+t.along[1]*i+t.normal[1]*(o+t.face)];return{x:ao(s[0]),z:ao(s[1]),...r!==null&&Dp(e)?{mount_y:ao(Math.max(0,r))}:{}}}function Lp(t,e,n,r,o){let[i]=[e.points[n.edge]],s=Math.min(t.length-n.width/2,Math.max(n.width/2,r+n.width/2)),l=fe(K(i,t.origin))<1e-6?s:t.length-s;return{offset:ao(l),...o!==null&&n.type==="window"?{sill:ao(Math.max(0,o))}:{}}}var Cp=.01,Np=t=>Math.round(t/Cp)*Cp,Va=class extends ne{static properties={host:{attribute:!1},doc:{attribute:!1},roomId:{},edge:{type:Number},_sel:{state:!0},_drag:{state:!0}};constructor(){super(),this._sel=null,this._drag=null}get room(){return this.host.floor?.rooms.find(e=>e.id===this.roomId)}frame(){let e=this.room;return e&&this.host.floor?Wa(this.host.floor,e,this.edge,this.host.doc.settings.wall_interior):null}boxes(){let e=this.room,n=this.frame();return e&&n&&this.host.floor?Op(this.host.floor,e,n):[]}place(e,n,r){let o=this.room,i=this.frame();!o||!i||this.host.change((s,l)=>{if(e.kind==="furniture"){let a=l.furniture.find(c=>c.id===e.id);a&&Object.assign(a,Hp(i,a,n,e.lifts?r:null))}else{let a=l.openings.find(d=>d.id===e.id),c=l.rooms.find(d=>d.id===a?.room_id);a&&c&&Object.assign(a,Lp(c.id===o.id?i:Wa(l,c,a.edge,this.host.doc.settings.wall_interior),c,a,n,e.lifts?r:null))}})}toWall(e){let r=this.renderRoot.querySelector("svg").getScreenCTM()?.inverse();if(!r)return[0,0];let o=new DOMPoint(e.clientX,e.clientY).matrixTransform(r);return[o.x,-o.y]}down(e,n){if(this._sel=n.id,!this.host.admin)return;e.currentTarget.setPointerCapture(e.pointerId);let[r,o]=this.toWall(e);this._drag={id:n.id,x0:n.x0,y0:n.y0,startU:r,startY:o,fromX:n.x0,fromY:n.y0}}move(e,n){let r=this._drag;if(!r||r.id!==n.id)return;let[o,i]=this.toWall(e),s=this.frame(),l=n.x1-n.x0,a=Math.min((s?.length??0)-l,Math.max(0,Np(r.fromX+o-r.startU))),c=n.lifts?Math.max(0,Np(r.fromY+i-r.startY)):r.fromY;this._drag={...r,x0:a,y0:c}}up(e){let n=this._drag;this._drag=null,!(!n||n.id!==e.id||Math.abs(n.x0-n.fromX)<1e-6&&Math.abs(n.y0-n.fromY)<1e-6)&&this.place(e,n.x0,n.y0)}nameOf(e){if(e.kind==="furniture")return this.host.floor?.furniture.find(o=>o.id===e.id)?.name||qe(this.host.hass,e.type);let n=this.host.floor?.openings.find(r=>r.id===e.id);return n?this.host.t(`preset_${xn(n)}`):e.type}updated(e){(e.has("edge")||e.has("roomId"))&&(this._sel=null)}render(){let e=this.host.t,n=this.room,r=this.frame();if(!n||!r)return _;let o=n.points.length,i=h=>he(this.host.hass,h),s=this.boxes().map(h=>this._drag?.id===h.id?{...h,x1:this._drag.x0+(h.x1-h.x0),y1:this._drag.y0+(h.y1-h.y0),x0:this._drag.x0,y0:this._drag.y0}:h),l=Math.max(r.heLine truncated
<line x1="0" x2=${d.x0} y1=${-(d.y0+d.y1)/2} y2=${-(d.y0+d.y1)/2} />