`${a}:${l.map(c=>c.toFixed(2)).join(",")}`).join(";"):"";s!==this.tintSig&&(this.tintSig=s,e.setRoomTint(i))}furnitureMarkers(e,t,n,i){let o=[],s=[],a=new Map,l=new Map,c=dn(t);for(let m of t.floors)if(!(m.layer&&this.hiddenLayers.has(m.id)))for(let h of m.furniture){if(!Vr(e,h))continue;let g=this.furnitureLinks.get(h.id),_=this.stateFaces(e,h);_.length&&a.set(h.id,{color:_[0].color,level:_[0].level,faces:_});let b=Gn(h.type);if(b&&h.care_entity){let y=this.careMarker(e,m,h,b,h.care_entity);y&&(o.push(y.marker),y.glow&&a.set(h.id,{color:y.glow,level:.9,faces:[{part:"all",color:y.glow,level:.9}]}),l.set(h.id,h.care_entity));continue}let v=Y(h.type);if(h.cover_entity&&Kn(v)&&l.set(h.id,h.cover_entity),v?.gangs){for(let B of(h.gang_entities??[]).slice(0,v.gangs)){let D=B&&B!=="none"?We(e,B):null,O=D?Z(e.states[D]):null;D&&O!==null&&!i.has(D)&&(i.add(D),s.push({id:B,powerEntity:D,floorId:m.id,x:h.x,z:h.z,power:Math.max(0,O)}))}let y=fa(e,(h.gang_entities??[]).slice(0,v.gangs),/socket/.test(h.type));y.length&&a.set(h.id,{color:y[0].color,level:y[0].level,gangs:y}),Ti(h.gang_entities,v.gangs).length&&l.set(h.id,`gang:${h.id}`);continue}if(Jn(h.type)){let y=this.lampMarker(e,m,h,g?.entity??null),B=g?.power?Z(e.states[g.power]):null;if(g?.power&&B!==null&&(B>=1&&(y.text=y.text?`${y.text} \xB7 ${mt(e,B)}`:mt(e,B)),i.has(g.power)||(i.add(g.power),s.push({id:y.id,powerEntity:g.power,floorId:m.id,x:h.x,z:h.z,power:Math.max(0,B)}))),o.push(y),h.type==="ceiling_fan"){let D=g?.fan?e.states[g.fan]:void 0;y.spin=tu(D),D&&!n.has(D.entity_id)&&(n.add(D.entity_id),o.push({...y,id:D.entity_id,y:Math.max(.5,y.y-.3),icon:h.icon?Me(h.icon):Rt("fan"),name:h.name||L(e,D.entity_id),text:pf(e,D),active:ee(D),unavailable:I(D),glow:null,lamp:null,spin:void 0,pickable:void 0,effect:void 0}))}continue}let k=Ai(h.type)?oa(e,h,y=>`${W(e,se(e,y),1)} ${ne(e)}`):null,S=Ai(h.type)?null:aa(e,h.temp_entity),M=S===null?"":`\u{1F321} ${W(e,se(e,S),1)} ${ne(e)}`,T=h.type==="home_battery"?h.soc:h.type==="wallbox"?h.status:k?h.temp_entity&&h.temp_entity!=="none"?h.temp_entity:h.temp_entity2:S!==null?h.temp_entity:null,z=T&&T!=="none"?T:(h.values??[]).find(y=>y.entity&&y.entity!=="none")?.entity??null,$=g??(z?{entity:null,power:null}:void 0);if(!$)continue;let C=h.type==="home_battery"?z??$.entity??$.power:$.entity??$.power??z;l.set(h.id,C);let E=$.entity?e.states[$.entity]:void 0,R=c.has(h.id),H=R?!!h.meter_invert:h.type==="meter"?t.energy.grid_invert&&!h.export:h.type==="home_battery"?t.energy.battery_invert&&!h.charge:!1,N=$.power?Z(e.states[$.power],H):null,V=h.type==="home_battery"&&h.charge&&h.charge!=="none"?h.charge:h.type==="meter"&&!R&&h.export&&h.export!=="none"?h.export:null,G=V?Z(e.states[V]):null;G!==null&&(N=Math.max(0,N??0)-Math.max(0,G)),$.power&&N!==null&&!i.has($.power)&&(i.add($.power),s.push({id:C,powerEntity:$.power,floorId:m.id,x:h.x,z:h.z,power:Math.max(0,N),wallbox:h.type==="wallbox"||void 0}));let q=(N??0)>10||E?.state==="on"||E?.state==="running"||er(E)&&ee(E);if((h.type==="radiator"||v)&&E&&F(E.entity_id)==="climate"){let y=E.attributes;if(y.hvac_action==="heating"){let B=typeof y.temperature=="number"&&typeof y.current_temperature=="number"?y.temperature-y.current_temperature:1,D=!!v&&!v.parts.some(O=>O.screen);a.set(h.id,{color:[1,.42,.1],level:Math.min(1,.45+.25*Math.max(0,B)),heat:D||void 0})}}else(h.type==="washer"||h.type==="dryer"||h.type==="dishwasher")&&q?a.set(h.id,{color:[.3,.85,1],level:.8}):v&&q&&!v.light&&v.parts.some(y=>y.glow||y.screen)&&a.set(h.id,{color:[.3,.85,1],level:.8,leds:!0});if(yo(h.type)){let y=wo(e,$.entity??$.power);if(y&&y.progress!==null&&(y.printing||/pause/.test(y.status))){let B=y.filaments[0]??"#38bdf8",D=[1,3,5].map(O=>parseInt(B.slice(O,O+2),16)/255);a.set(h.id,{color:D,level:.9,print:Math.max(.02,y.progress/100)})}}if(h.type==="home_battery"&&z){let y=Number(e.states[z]?.state);Number.isFinite(y)&&a.set(h.id,{color:y>60?[.29,.87,.5]:y>25?[.98,.8,.08]:[.97,.44,.44],level:.95,fill:y/100})}if(E&&sr(h.type)){let y=F(E.entity_id)==="light"?Te(E):null,B=F(E.entity_id)==="media"&&["playing","on","paused","idle"].includes(E.state),D=y?y.color:ee(E)||B?[.22,.88,1]:null;D&&a.set(h.id,{color:D,level:E.state==="playing"?1:.6,halo:h.ambilight??1})}if(n.has(C))continue;n.add(C);let re=$.entity?F($.entity):null,w=m.rooms.find(y=>y.points.length>=3&&P([h.x,h.z],y.points));o.push({id:C,floorId:m.id,roomId:w?.id??null,x:h.x,z:h.z,y:zo(h)+de(m,h),icon:h.icon?Me(h.icon):Rt(re??"switch"),name:h.name||($.entity?L(e,$.entity):fe(e,h.type)),ownName:h.name||void 0,showName:!!h.show_name,text:[k?k.text:h.type==="home_battery"?this.batteryText(e,z,N):h.type==="wallbox"?this.wallboxText(e,z,N):h.type==="meter"?R?N===null?"":ce(e,N):this.meterText(e,N):E&&(h.type==="washer"||h.type==="dryer"||h.type==="dishwasher")&&q&&Fi(e,on(e,$.entity??$.power))!==null?A(e,"care_time_left",{time:ba(Fi(e,on(e,$.entity??$.power)))}):E?[ie(e,E),N!==null&&N>5&&!er(E)?ce(e,N):""].filter(Boolean).join(" \xB7 "):N!==null?ce(e,Math.max(0,N)):"",M,sn(e,h.values)].filter(Boolean).join(" \xB7 "),active:k?.warm||S!==null&&S>=sa||(E?ee(E):(N??0)>5),unavailable:E?I(E):!1,glow:null,furnitureId:h.id,energyDevice:h.type==="inverter"||h.type==="home_battery"||h.type==="wallbox"||h.type==="meter",readout:!!k||!!h.values?.some(y=>y.entity&&y.entity!=="none")||void 0,show:h.marker??void 0,fromFurniture:!0})}let u=this.heatMode==="wifi";for(let m of o){let h=m.furnitureId?t.floors.flatMap(_=>_.furniture).find(_=>_.id===m.furnitureId):void 0;if(!h||!xo(h.type))continue;let g=ko(e,this.furnitureLinks.get(h.id)?.entity??this.furnitureLinks.get(h.id)?.power??null);g&&(g.clients!==null&&(m.text=A(e,"wifi_clients",{n:g.clients})),u&&(m.wedge={angle:360,reach:9,near:0,color:Lc(g),opacity:.4,through:!0,walls:!1},m.show="always"))}let d=lc(t,o);this.tapPins=d.pins;for(let m of t.floors.flatMap(h=>h.furniture))m.tap?.action&&l.set(m.id,`tap:${m.id}`);for(let{floor:m,item:h}of d.bare){let g=m.rooms.find(b=>b.points.length>=3&&P([h.x,h.z],b.points)),_=h.name||fe(e,h.type);o.push({id:`tap:${h.id}`,floorId:m.id,roomId:g?.id??null,x:h.x,z:h.z,y:zo(h)+de(m,h),icon:Me(h.icon||"gesture-tap-button"),name:_,ownName:h.name||void 0,showName:!!h.show_name,text:"",active:!1,unavailable:!1,glow:null,furnitureId:h.id,show:h.marker??void 0,fromFurniture:!0})}return{markers:o,consumers:s,screens:a,targets:l}}robotObstacles(e,t){let n=new Set(["rug","worktop","table","table_round","coffee_table","chair","office_chair","stool","bar_stool","bench","desk","robot_vacuum","parking","stairwell","radiator","tv_wall","kitchen_wall","led_strip"]);return e.furniture.filter(i=>{if(n.has(i.type)||i.type.startsWith("lamp_")&&i.type!=="lamp_floor"&&i.type!=="lamp_uplight"||i.h<.04||de(e,i)>.12)return!1;let o=Y(i.type);return o&&(o.hole||/table|desk|chair|stool|bench|rug|carpet|mat$/.test(i.type))?!1:P([i.x,i.z],t)||Qn(i).some(s=>P(s,t))}).map(i=>Qn(i))}robotInfos(e,t){let n=[],i=lu(e),o=cu(e,i,t.settings.vacuum_map??null),s=!1;for(let a of t.floors){for(let l of a.furniture){if(l.type!=="robot_vacuum")continue;let c=this.furnitureLinks.get(l.id)?.entity??null,u=c?e.states[c]?.state:void 0,d=u==="cleaning"?"cleaning":u==="returning"?"returning":u==="error"?"error":u==="docked"||!u?"docked":"idle",m=l.rotation*Math.PI/180,h=l.d*.14,g=[l.x-Math.sin(m)*h,l.z+Math.cos(m)*h],_=a.rooms.filter(C=>C.points.length>=3),v=(d==="cleaning"?Ei(e,_,c,ar(e,c,l.room_sensor)):null)??_.find(C=>P(g,C.points)),k=d==="cleaning"&&v?this.robotObstacles(a,v.points):[],S=i?Date.parse(e.states[i]?.last_updated??""):Number.NaN,M=!Number.isFinite(S)||Date.now()-S<120*1e3,T=c?.startsWith("vacuum.")&&o&&!s&&(M||d!=="cleaning"&&d!=="returning")?o:null;T&&(s=!0);let z=c?Date.parse(e.states[c]?.last_changed??""):Number.NaN,$=d==="cleaning"||d==="returning"?null:Number.isFinite(z)?z:null;n.push({id:l.id,floorId:a.id,rest:g,restHeading:-m,mode:d,room:v?.points??null,roomId:v?.id??null,obstacles:k,track:T?.path??null,pose:T?.pose??null,settledAt:$})}for(let l of a.furniture){if(!/:(robot_mower|mower_dock)$/.test(l.type))continue;let c=this.furnitureLinks.get(l.id)?.entity??null;if(!c?.startsWith("lawn_mower."))continue;let u=e.states[c]?.state,d=u==="mowing"?"cleaning":u==="returning"?"returning":u==="error"?"error":u==="docked"||!u?"docked":"idle",m=[l.x,l.z],h=(a.outdoor??[]).filter(b=>b.type==="lawn"&&b.points.length>=3),g=h.find(b=>P(m,b.points))??[...h].sort((b,v)=>Xt(v.points)-Xt(b.points))[0],_=g?(a.outdoor??[]).filter(b=>b!==g&&b.type!=="lawn"&&b.points.some(v=>P(v,g.points))).map(b=>b.points):[];n.push({id:l.id,floorId:a.id,rest:m,restHeading:-l.rotation*Math.PI/180,mode:d,room:g?.points??null,roomId:g?.id??null,obstacles:_,y:g?Zn(a,g,m[0],m[1]):Yn(a),mower:!0})}}return n}batteryText(e,t,n){let i=t?Number(e.states[t]?.state):Number.NaN,o=[];return Number.isFinite(i)&&o.push(`${W(e,i,0)} %`),n!==null&&Math.abs(n)>=10&&o.push(`${n<0?"\u25B2":"\u25BC"} ${ce(e,Math.abs(n))}`),o.join(" \xB7 ")}subMeterText(e,t,n,i){let o=i?cl(t,n,i):null;return o?ce(e,o.use)+(o.unmetered===null?"":` \xB7 ${A(e,"meter_unmetered",{w:ce(e,o.unmetered)})}`):null}meterText(e,t){return t===null?"":Math.abs(t)<5?ce(e,0):`${A(e,t<0?"energy_grid_export":"energy_grid_import")} ${ce(e,Math.abs(t))}`}wallboxText(e,t,n){let i=t?e.states[t]:void 0,o=String(i?.state??"").toLowerCase(),s=(n??0)>50||/charg|laden|lädt/.test(o),a=i?.entity_id.startsWith("binary_sensor.")?o==="on":/connect|plug|ready|angesteckt|verbunden|wait|paused|suspend/.test(o),l=s?A(e,"wallbox_charging"):a?A(e,"wallbox_plugged"):i&&!I(i)&&!i.entity_id.startsWith("binary_sensor.")?ie(e,i):"",c=n!==null&&n>50?ce(e,n):"";return[l,c].filter(Boolean).join(" \xB7 ")}stateFaces(e,t){let n=[],i=t.state_entity2&&t.state_entity2!=="none"?[[t.state_entity,t.state_split==="top_bottom"?"bottom":"left"],[t.state_entity2,t.state_split==="top_bottom"?"top":"right"]]:[[t.state_entity,"all"]];for(let[o,s]of i){if(!o||o==="none")continue;let a=e.states[o];if(!a||I(a)||!(ee(a)||a.state==="home"||a.state==="occupied"||a.state==="on"))continue;let c=F(o)==="light"?Te(a):null;n.push({part:s,color:c?c.color:[1,.71,.28],level:c?c.level:.85})}return n}careMarker(e,t,n,i,o){let s=e.states[o];if(!s)return null;let a="",l=!1,c=null;if(i==="bin"){let m=lr(s);a=m===null?ie(e,s):m===0?A(e,"care_bin_today"):m===1?A(e,"care_bin_tomorrow"):A(e,"care_bin_days",{n:m}),l=m!==null&&m<=1,l&&(c=[1,.72,.28])}else if(i==="mail")l=ga(s),a=A(e,l?"care_mail_yes":"care_mail_no"),l&&(c=[1,.85,.3]);else{let m=_a(s,n.thirsty_below??20);l=!!m?.thirsty,a=m?Number.isFinite(m.moisture)?`${A(e,l?"care_plant_thirsty":"care_plant_ok")} \xB7 ${Math.round(m.moisture)} %`:A(e,l?"care_plant_thirsty":"care_plant_ok"):ie(e,s),l&&(c=[1,.45,.3])}let u=t.rooms.find(m=>m.points.length>=3&&P([n.x,n.z],m.points)),d={bin:"mdi:trash-can-outline",mail:"mdi:mailbox-outline",plant:"mdi:sprout-outline"}[i];return{glow:c,marker:{id:o,floorId:t.id,roomId:u?.id??null,x:n.x,z:n.z,y:zo(n)+de(t,n),icon:n.icon?Me(n.icon):Me(d),name:n.name||fe(e,n.type),ownName:n.name||void 0,showName:!!n.show_name,text:a,active:l,unavailable:I(s),glow:null,furnitureId:n.id,show:n.marker??void 0,fromFurniture:!0,care:!0}}}lampMarker(e,t,n,i){let o=i?e.states[i]:void 0,s=(n.extra_lights??[]).map(b=>e.states[b]).filter(b=>!!b),a=s.find(b=>ee(b)),l=Y(n.type),c=Cs[n.type]??l?.light??"floor",u=t.rooms.some(b=>b.points.length>=3&&P([n.x,n.z],b.points)),d=c==="strip"&&!u?Qt(t,n.x,n.z)+(n.mount_y??0):n.mount_y!=null&&!l?n.mount_y:l||c==="wall"||c==="strip"?de(t,n):c==="table"?qn(t,n.x,n.z):c==="bollard"||c==="garden"?Qt(t,n.x,n.z):0,m=t.rooms.find(b=>b.points.length>=3&&P([n.x,n.z],b.points)),h=jn(t,n),g=l?l.mount==="ceiling"?Math.max(.5,d-.15):d+n.h+.2:{ceiling:h-.3,downlight:h-.25,spot:h-.35,panel:h-.25,pendant:Math.max(.6,h-n.h-.25),fan:Math.max(.6,h-n.h-.2),floor:d+n.h+.25,uplight:d+n.h+.25,table:d+n.h+.2,wall:d+n.h+.2,strip:n.upright?d+n.w+.15:Math.max(.3,d-.2),bollard:d+n.h+.25,garden:d+n.h+.25}[c],_={id:i??`lamp:${n.id}`,floorId:t.id,roomId:m?.id??null,x:n.x,z:n.z,y:g,icon:Rt("light"),name:n.name||(i?L(e,i):fe(e,n.type)),text:[o&&(ee(o)||!a)?ie(e,o):a?L(e,a.entity_id):"",sn(e,n.values)].filter(Boolean).join(" \xB7 "),readout:!!n.values?.some(b=>b.entity&&b.entity!=="none"),active:(o?ee(o):!1)||!!a,unavailable:o?I(o):!1,glow:o||s.length?Ci(Ks(o,s,n.color_entity&&n.color_entity!=="none"?e.states[n.color_entity]:void 0),n.glow_scale):null,lamp:c,rotation:n.rotation,mirror:!!n.mirror,roll:n.tilt??0,upright:!!n.upright,rise:n.rise??0,size:[n.w,n.d,n.h],base:d,pickable:!!i,furnitureId:n.id,pack:l?n.type:null,lightY:l?l.mount==="ceiling"?d:d+n.h*.85:void 0,ceiling:h,effect:o?.state==="on"?fr(n,$a(e,n,i)):void 0,variant:n.variant,show:n.marker??void 0,fromFurniture:!0};return o&&i?Ni(e,_,o,!1):_}showPin(e){if(this.furnish&&!e.fromFurniture)return!0;if(e.show==="never"||this.markerMode==="none")return!1;if(e.show==="always")return!0;if(e.show==="active"||this.building?.settings.motion_markers_active&&Bs(this.hass,e.id)){if(!e.active)return!1;if(e.show==="active")return!0}if(this.markersOutside&&!(this.roomId&&e.roomId===this.roomId))return this.markersOutside.includes(Ws(e.id,!!e.lamp));if(this.markerMode==="all")return!0;if(e.lamp)return!1;let t=F(e.id);return t==="light"?!1:e.fromFurniture&&t==="fan"?!0:e.care?e.active:e.id.startsWith("tap:")||e.readout?!0:e.fromFurniture?(e.power??0)>=1||t==="media"&&e.active||!!e.energyDevice&&!!e.text:!0}openingTargets(){let e=new Map;for(let[t,n]of this.openingLinks??[]){let i=n.lock??n.cover??n.contact??n.tilt;i&&e.set(t,i)}return e}downloadStl(){let e=this.viewer?.exportStl(10);if(!e)return;let t=URL.createObjectURL(new Blob([e],{type:"model/stl"})),n=document.createElement("a");n.href=t,n.download=`nextfloor-${new Date().toISOString().slice(0,10)}.stl`,n.click(),setTimeout(()=>URL.revokeObjectURL(t),5e3)}secondBlinds(){let e=new Map;for(let[t,n]of this.openingLinks??[])n.cover2&&!n.lock&&n.cover&&e.set(t,n.cover2);return e}scheduleThumbs(e=600){clearTimeout(this.thumbTimer);let t=this.building?.floors.filter(i=>i.rooms.length).length??0;if(!this.floorThumbs||t<2){this._thumbs=[];return}let n=Math.max(e,this.thumbsAt+(this._low?8e3:4e3)-Date.now());this.thumbTimer=setTimeout(()=>{if(!(!this.viewer||this.dimmed&&this._thumbs.length)){if(document.hidden){this.scheduleThumbs(3e3);return}this.thumbsAt=Date.now(),this._thumbs=this.viewer.floorThumbnails(this.narrowThumbs?104:150,this.narrowThumbs?78:112)}},n)}get narrowThumbs(){return this._narrowStage}renderThumbs(){if(!this._thumbs.length||!this.building||this._phoneStage)return f;let e=new Map(this.building.floors.map(o=>[o.id,o.name])),t=[...this._thumbs].sort((o,s)=>(this.building.floors.find(a=>a.id===s.floorId)?.elevation??0)-(this.building.floors.find(a=>a.id===o.floorId)?.elevation??0)),n=this._thumbsCompact,i=()=>{this._thumbsCompact=!n;try{localStorage.setItem("nextfloor.thumbs_compact",this._thumbsCompact?"1":"0")}catch{}};return p``}onDeviceHold(e,t,n){let i=F(e);i==="light"||i==="cover"||i==="switch"||i==="fan"||i==="lock"?this._menu={entity:e,x:t,y:n}:be(this,e)}onDeviceSwipe(e,t,n,i,o){let s=this.hass?.states[e];if(t==="start"){if(!s||I(s)||this.confirmSet.has(e))return!1;let l=F(e);if(l==="light"&&Mo(s).dim){let c=s.state==="on"?typeof s.attributes.brightness=="number"?Math.round(s.attributes.brightness/2.55):100:0;return this._swipe={entity:e,kind:"light",start:c,value:c,x:i,y:o},!0}if(l==="fan"&&typeof s.attributes.percentage_step=="number"){let c=s.state==="on"&&typeof s.attributes.percentage=="number"?s.attributes.percentage:0;return this._swipe={entity:e,kind:"fan",start:c,value:c,x:i,y:o},!0}if(l==="cover"&&Ao(s)){let c=s.attributes.current_position;return this._swipe={entity:e,kind:"cover",start:c,value:c,x:i,y:o},!0}return!1}let a=this._swipe;if(!a||a.entity!==e)return!1;if(t==="move"){let l=Math.round(Math.min(100,Math.max(0,a.start-n/220*100)));l!==a.value&&(this._swipe={...a,value:l});let c=performance.now();c-this.swipeSent>350&&(this.swipeSent=c,this.applySwipe())}else this.applySwipe(),clearTimeout(this.swipeTimer),this.swipeTimer=setTimeout(()=>this._swipe=null,700);return!0}applySwipe(){let e=this._swipe;!e||!this.hass||(e.kind==="light"?e.value<=0?this.hass.callService("light","turn_off",{entity_id:e.entity}):this.hass.callService("light","turn_on",{entity_id:e.entity,brightness_pct:e.value}):e.kind==="fan"?e.value<=0?this.hass.callService("fan","turn_off",{entity_id:e.entity}):this.hass.callService("fan","set_percentage",{entity_id:e.entity,percentage:e.value}):this.hass.callService("cover","set_cover_position",{entity_id:e.entity,position:e.value}))}openRoom(e,t){this.floorId===e&&this.roomId===t||(this.floorId!==e?(this.fire("floor-tap",{floorId:e}),setTimeout(()=>this.fire("room-tap",{floorId:e,roomId:t}),60)):this.fire("room-tap",{floorId:e,roomId:t}))}goTo(e){if(this._find=null,e.kind==="room"||e.kind==="circuit"){e.roomId&&this.openRoom(e.floorId,e.roomId);return}this.floorId!==e.floorId&&this.fire("floor-tap",{floorId:e.floorId}),setTimeout(()=>this.viewer?.focus(e.floorId,e.x,e.z,e.y,e.entity),120)}listenToAnnouncements(e){if(!e){this.stopAnnouncements?.(),this.stopAnnouncements=null,clearTimeout(this.announceTimer);return}if(this.stopAnnouncements)return;let t=!1;this.stopAnnouncements=()=>t=!0,Ia(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()||!Da(e,this.screenName)||!Fa(e))return;let n=Ha(e.message);this._announcement={message:e.message,until:Date.now()+n},clearTimeout(this.announceTimer),this.announceTimer=setTimeout(()=>this._announcement=null,n),Pa(this.hass,e)}renderAnnouncement(){let e=this._announcement;return e?p``:f}renderAlerts(){let e=this.building;if(!this._alerts.length||!e)return f;let t=this._alerts.slice(0,3);return p`
${t.map(n=>p``)}
${this._alerts.length>3?p`+${this._alerts.length-3}`:f}
`}renderScenes(){let e=this.building;if(!this.scenes||!this.roomId||this.panelOpen||!e||!this.hass)return f;let t=e.floors.flatMap(o=>o.rooms).find(o=>o.id===this.roomId),n=t?K(this.hass,t).filter(o=>F(o)==="scene"||F(o)==="script").slice(0,6):[];if(!n.length)return f;let i=t?.area_id?this.hass.areas?.[t.area_id]?.name:void 0;return p`
${n.map(o=>p``)}
`}renderFind(){let e=this.building;if(!e||!this.hass)return f;if(this._find===null)return p``;let t=Yc(this.findIndex??=Zc(this.hass,e),this._find);return p`
this._find=n.target.value}
@keydown=${n=>{n.key==="Escape"&&(this._find=null),n.key==="Enter"&&t[0]&&this.goTo(t[0])}}
/>
${this._find.trim()?p`
${t.length?t.map(n=>p`
`):p`
${A(this.hass,"find_none")}
`}
`:f}
`}renderCentral(){let e=this.building,t=this.hass;if(!e||!t||!this.central||this._find!==null)return f;let n=(b,v)=>A(t,b,v),i=p``;if(!this._central)return i;let o=this.floorId?e.floors.find(b=>b.id===this.floorId):void 0,s=o?[o]:e.floors,a=s.flatMap(b=>Ri(t,b).lights),l=s.flatMap(b=>Ri(t,b).covers),c=a.filter(b=>t.states[b]?.state==="on").length,u=!o,d=(b,v,k,S)=>{if(S.length){if(u&&this._armed!==b){this._armed=b,clearTimeout(this.armTimer),this.armTimer=setTimeout(()=>this._armed=null,3500);return}this._armed=null,t.callService(v,k,{entity_id:S})}},m=(b,v,k,S,M)=>p``,h=e.settings.favorite_floors??{},g=(e.settings.favorites??[]).filter(b=>t.states[b]&&(!h[b]||!o||h[b]===o.id)),_=this.buttons??e.settings.buttons??[];return p`${i}
${o?o.name:n("central_house")}
${n("central_lights")}${a.length?p` ${c}/${a.length}`:f}
${m("lights_on","central_on","light","turn_on",a.filter(b=>t.states[b]?.state==="off"))}
${m("lights_off","central_off","light","turn_off",a.filter(b=>t.states[b]?.state==="on"))}
${l.length?p`
${n("central_covers")} ${l.length}
${m("covers_open","central_open","cover","open_cover",l)}
${m("covers_close","central_close","cover","close_cover",l)}
`:f}
${n("central_favorites")}
${g.length?p`
${g.map(b=>{let[v,k]=ma(b),S=t.states[b],M=v==="homeassistant"&&S?.state==="on";return p``})}
`:_.length?f:p`
${n("central_no_favorites")}
`}
${_.length?p`
${_.map(b=>p``)}
`:f}
`}toggleLock(){this._locked=!this._locked;try{localStorage.setItem(uu,this._locked?"1":"0")}catch{}}async openTravel(e){if(clearInterval(this.travelTimer),this.travelTimer=void 0,e===null||!this.hass){this._travel=null,this.syncDevices(!0);return}let t=Date.now(),n=t-e*36e5;this._travel={history:new Map,from:n,to:t,t:n,playing:!1,speed:e>24?3600:600,hours:e,moments:[],loading:!0};try{let i=await gn(this.hass,Cl(this.watched),n,t);if(!this._travel||this._travel.from!==n)return;this._travel={...this._travel,history:i,moments:Nl(i,n,t),loading:!1}}catch{this._travel=null,this._error=A(this.hass,"travel_failed");return}this.syncDevices(!0)}travelTo(e){let t=this._travel;t&&(this._travel={...t,t:Math.min(t.to,Math.max(t.from,e))},this.syncDevices(!0))}playTravel(e){let t=this._travel;t&&(clearInterval(this.travelTimer),this.travelTimer=void 0,this._travel={...t,playing:e,t:e&&t.t>=t.to?t.from:t.t},e&&(this.travelTimer=setInterval(()=>{let n=this._travel;if(!n)return;let i=n.t+250*n.speed;i>=n.to&&this.playTravel(!1),this.travelTo(i)},250)))}renderTravel(){if(!this.hass||this.clean)return f;let e=a=>A(this.hass,a),t=this._travel;if(!t)return this.travelButton?p``:f;let n=this.hass.language??navigator.language,i=new Intl.DateTimeFormat(n,{weekday:"short",hour:"2-digit",minute:"2-digit"}).format(new Date(t.t)),o=t.to-t.from||1,s=[[60,"travel_speed_min"],[600,"travel_speed_10min"],[3600,"travel_speed_hour"]];return p``}toggleWalk(){let e=this.viewer;e&&(this._walking?(e.stopWalk(),this._walking=!1):this._walking=e.startWalk()!==null,this._stick=null)}stickMove(e,t=!1){let n=e.currentTarget;if(t)n.setPointerCapture(e.pointerId);else if(!this._stick)return;let i=n.getBoundingClientRect(),o=i.width/2,[s,a]=[(e.clientX-i.left-o)/o,(e.clientY-i.top-o)/o],l=Math.hypot(s,a);l>1&&([s,a]=[s/l,a/l]),this._stick=[s,a],this.viewer?.setWalkStick(Math.abs(s)<.12?0:s,Math.abs(a)<.12?0:a)}stickEnd(){this._stick=null,this.viewer?.setWalkStick(0,0)}renderWalk(){if(!this.hass||this.clean||!this.walkButton&&!this._walking)return f;let e=n=>A(this.hass,n),t=this._stick??[0,0];return p`
${this._walking?p`this.stickMove(n,!0)} @pointermove=${n=>this.stickMove(n)} @pointerup=${()=>this.stickEnd()} @pointercancel=${()=>this.stickEnd()}>
${e("walk_hint")}
`:f}`}renderLock(){if(!this.lockButton||!this.hass||this.clean)return f;let e=A(this.hass,this._locked?"lock3d_off":"lock3d_on");return p``}renderClock(e=!1){if(!this.clock||!this.hass||this.clock==="top_left"&&!e)return f;let t=this.hass.language??navigator.language,n=new Date(this._now),i=new Intl.DateTimeFormat(t,{hour:"2-digit",minute:"2-digit"}).format(n),o=new Intl.DateTimeFormat(t,{weekday:"long",day:"numeric",month:"long"}).format(n);return p`${i}${o}
`}renderEye(){if(!this.cleanButton||!this.hass||this._find!==null&&!this.clean)return f;let e=A(this.hass,this.clean?"controls_show":"controls_hide");return p``}renderSwipe(){let e=this._swipe;if(!e||!this.hass)return f;let t=e.kind==="light"&&e.value<=0;return p`
${L(this.hass,e.entity)}
${t?A(this.hass,"swipe_off"):`${e.value} %`}
`}tapPlate(e,t,n){let i=this.building?.floors.flatMap(s=>s.furniture).find(s=>s.id===e),o=i?Ti(i.gang_entities,Y(i.type)?.gangs??0):[];if(o.length===1)return this.onDeviceTap(o[0],t,n);o.length>1&&(this._plate={ids:o,x:t,y:n})}renderPlate(){let e=this._plate;if(!e||!this.hass)return f;let t=this.hass,n=()=>this._plate=null;return p`
`}renderMenu(){let e=this._menu;if(!e||!this.hass)return f;let t=this.renderRoot.querySelector(".nf-stage"),n=t?.clientWidth??800,i=t?.clientHeight??600,o=Math.max(8,Math.min(n-240,e.x-116)),s=Math.max(8,Math.min(i-360,e.y-170));return p`
!a.speakers?.length||a.speakers.includes(e.entity))}
?confirmSwitch=${this.confirmSet.has(e.entity)}
.myPosition=${this.myPositionOf(e.entity)}
.tiltEntity=${cr(this.hass,this.building?.floors??[],e.entity)}
@close=${()=>this._menu=null}
>`}myPositionOf(e){for(let t of this.building?.floors??[])for(let n of t.openings){let i=this.openingLinks?.get(n.id);if(n.my_position!=null&&(i?.cover===e||i?.cover2===e))return n.my_position}return null}onDeviceTap(e,t=0,n=0){if(e.startsWith("lamp:")||this._travel)return;let i=e.startsWith("tap:")?e.slice(4):this.tapPins.get(e);if(i){let s=this.building?.floors.flatMap(a=>a.furniture).find(a=>a.id===i);s?.tap&&zi(this.hass,this,s.tap);return}if(this.pluginTapped(e))return;if(e.startsWith("gang:"))return this.tapPlate(e.slice(5),t,n);if(e.startsWith("outdoor:")){this.fire("room-tap",{floorId:null,roomId:"nf-outside"});return}if(e==="grid"){let s=this.building,a=s?s.energy.grid??Ne(s,l=>this.furnitureLinks?.get(l.id)?.power??null).grid:null;a&&be(this,a);return}let o=F(e);if(o==="cover"||o==="media"){this._menu={entity:e,x:t,y:n};return}if(o==="lock"){let s=Mi(this.hass,e),a=L(this.hass,e);confirm(A(this.hass,s?"lock_confirm_lock":"lock_confirm_unlock",{name:a}))&&this.hass.callService("lock",s?"lock":"unlock",{entity_id:e});return}if(o&&Ls.has(o)){if(this.confirmSet.has(e)&&!confirm(A(this.hass,"confirm_switch",{name:L(this.hass,e)})))return;Ra(this.hass,e)}else be(this,e)}pluginTapped(e){let t=this.hass?.states[e],n=this.placementInfo.get(e);if(!t||!n)return!1;let i=this.building?.floors.find(o=>o.id===n.floorId)?.placements.find(o=>o.entity_id===e);return vs({hass:this.hass,entityId:e,state:t},n,i?.plugin??void 0,{showWindow:(o,s)=>{o&&"hass"in o&&(o.hass=this.hass),this._pluginWindow=o?{node:o,title:s?.title??""}:null},moreInfo:o=>be(this,o??e)})}renderPluginWindow(){let e=this._pluginWindow;return e?p`t.stopPropagation()}>
${e.title}
${e.node}
`:f}startViewOf(){return this.startView??this.building?.settings.start_view??null}currentView(){return this.viewer?.currentView()??null}resetView(){this.viewer?.resetView()}fire(e,t){this.dispatchEvent(new CustomEvent(e,{detail:t,bubbles:!0,composed:!0}))}toggleFlows(){this._flows=!this._flows;try{localStorage.setItem("nextfloor.flows",this._flows?"1":"0")}catch{}this.syncDevices(!0)}liveHeatPumps(e){let t=this.hass;if(!t)return[];let n=[];for(let i of e.floors)for(let o of i.furniture){if(!Nc(o.type))continue;let s=this.furnitureLinks?.get(o.id),a=Cc(t,s?.entity??s?.power??null);a&&n.push({id:o.id,name:o.name||fe(t,o.type),floorId:i.id,x:o.x,z:o.z,at:{floorId:i.id,x:o.x,z:o.z,y:de(i,o)+o.h+.5},pump:a})}return n}livePrinters(e){let t=this.hass,n=[];if(!t)return n;for(let i of e.floors)for(let o of i.furniture){if(!yo(o.type))continue;let s=this.furnitureLinks?.get(o.id),a=wo(t,s?.entity??s?.power??null);!a||!a.printing&&!/pause|finish|complete|error/.test(a.status)||n.push({id:o.id,name:o.name||fe(t,o.type),at:{floorId:i.id,x:o.x,z:o.z,y:de(i,o)+o.h+.5},printer:a})}return n}liveCars(e,t){let n=[];for(let i of t.floors)for(let o of i.furniture){if(o.type!=="parking")continue;let s=Vc(e,o);if(!s||s.soc===null&&s.range===null&&s.locked===null&&s.climateOn===null)continue;let a=so(e,o),l=a?ic(o,a):null,c=o.name||(a?fe(e,a):fe(e,o.type));n.push({spot:o.id,name:c,at:{floorId:i.id,x:o.x,z:o.z,y:de(i,o)+(l?.h??.2)+.6},car:s})}return n}liveMedia(e,t){let n=[];for(let i of t.floors){for(let o of i.furniture){let s=this.furnitureLinks?.get(o.id)?.entity;s?.startsWith("media_player.")&&n.push({entity:s,name:o.name||fe(e,o.type),at:{floorId:i.id,x:o.x,z:o.z,y:de(i,o)+o.h+.15},rings:o.sound_rings})}for(let o of i.placements)o.entity_id.startsWith("media_player.")&&n.push({entity:o.entity_id,name:o.name||L(e,o.entity_id),at:{floorId:i.id,x:o.x,z:o.z,y:(o.y??1.1)+.15},rings:o.sound_rings})}return Vl(e,n)}refreshToday(e){let t=this.hass,n=e.settings.calendars??[],i=Math.max(1,Math.min(7,e.settings.today_days??1)),o=`${new Date().toDateString()}|${i}`;!t||!n.length||Date.now()-this.todayAt<9e5&&o===this.todayDay||(this.todayAt=Date.now(),this.todayDay=o,Dc(t,n,i).then(s=>this._todayItems=s))}refreshForecast(e){let t=this.hass,n=e.settings.forecast&&t?Xe(t,this.weatherEntityId??e.settings.weather_entity):null;if(!t||!n)return;let i=`${n}|${new Date().toDateString()}`;Date.now()-this.forecastAt<18e5&&i===this.forecastKey||(this.forecastAt=Date.now(),this.forecastKey=i,Pc(t,n).then(o=>this._forecast=o))}renderForecast(e){let t=this.building,n=this.hass,i=t?.settings.forecast;if(!t||!n||!i||i.corner!==e||this.clean)return f;if(e==="top_right"&&(this.roomId||this.panelOpen))return f;let o=Hc(this._forecast,Math.max(1,Math.min(7,i.days)));if(!o.length)return f;let s=Xe(n,this.weatherEntityId??t.settings.weather_entity),a=s?n.states[s]?.attributes:void 0,l=String(a?.temperature_unit??"\xB0"),c=String(a?.precipitation_unit??"mm"),u=n.language??navigator.language,d=new Intl.DateTimeFormat(u,{weekday:"short"}),m=h=>h===null?"\u2013":`${Math.round(h)}\xB0`;return p`
${o.map((h,g)=>p`-
${g===0?A(n,"today"):d.format(new Date(h.day))}
${h.icon}
${m(h.high)} ${m(h.low)}
${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)} %`:""}
`)}
`}renderToday(){let e=this.building,t=this.hass;if(!e||!t||this.clean||this.roomId||this.panelOpen)return f;let n=this.renderForecast("top_right"),i=this.today===!1?f:this.renderTodayCard(e,t);return i===f&&n===f?f:p`${i}${n}
`}renderTodayCard(e,t){let n=zc(t,e,Date.now(),{today:A(t,"care_bin_today"),tomorrow:A(t,"care_bin_tomorrow")}),i=Tc([...n,...this._todayItems??[]]);if(!i.length&&!(e.settings.calendars??[]).length)return f;let o=this._todayOpen!==!1,s=new Intl.DateTimeFormat(t.language??navigator.language,{weekday:"long",day:"numeric",month:"long"}).format(new Date),a=t.language??navigator.language,l=u=>{if(u===1)return A(t,"tomorrow");let d=new Date;return d.setDate(d.getDate()+u),new Intl.DateTimeFormat(a,{weekday:"long",day:"numeric",month:"numeric"}).format(d)},c=i.flatMap((u,d)=>[(u.day??0)>0&&(i[d-1]?.day??0)!==u.day?p`${l(u.day??0)}`:f,p`${u.title}${u.source}`]);return p`
${o?i.length?p``:p`${A(t,"today_none")}
`:f}
`}week=null;weekAt=0;refreshWeek(e){let t=this.hass;if(!t||this._travel||Date.now()-this.weekAt<36e5)return;this.weekAt=Date.now();let n=Ne(e,s=>this.furnitureLinks?.get(s.id)?.power??null),i=e.energy,o={solar:i.solar?[i.solar]:n.solar,grid:i.grid??n.grid,gridInvert:!!i.grid_invert,battery:i.battery?[i.battery]:n.battery,batteryInvert:!!i.battery_invert,consumption:i.consumption};Sl(t,o).then(s=>{this.week=s,this.syncDevices(!0)}).catch(()=>this.week=null)}meterRows(e,t=null){let n=this.hass,i=[],o=this.floorId?e.floors.find(a=>a.id===this.floorId):void 0,s=o&&U(n)?ln(n,o,e.floors.flatMap(a=>a.rooms)).find(a=>a.kind==="electricity"&&a.metric==="power"&&a.unit==="W")?.value??null:o?.power_entity?Z(n?.states[o.power_entity]):null;if(o&&s!==null){let a=t&&t>0?` \xB7 ${A(n,"floor_power_share",{n:Math.round(Math.max(0,s)/t*100)})}`:"";i.push({icon:"\u26A1",label:o.name,value:`${mt(n,s)}${a}`})}for(let[a,l,c]of[["gas","\u{1F525}","energy_gas_short"],["water","\u{1F4A7}","energy_water_short"]]){let u=e.energy[a],d=u?n?.states[u]:void 0;d&&!I(d)&&i.push({icon:l,label:A(n,c),value:ie(n,d)})}return i}refreshDayCurves(e){let t=this.hass;if(!t||this._travel||Date.now()-this.curvesAt<6e5)return;this.curvesAt=Date.now();let n=a=>mn(a,e,hn(a,e),Ne(e,l=>this.furnitureLinks?.get(l.id)?.power??null)),i=Wl(t,n),o=Date.now(),s=o-24*36e5;gn(t,i,s,o,!0).then(a=>{this.dayCurves=Ll(t,a,s,o,n),this.syncDevices(!0)}).catch(()=>this.dayCurves=null)}syncLhCards(e,t,n,i,o,s){let a=[],l=n.summary,c=l.solar!==null||l.grid!==null||l.battery!==null||l.consumption!==null,u=Sn(t),d=(this.floorId?t.floors.find(m=>m.id===this.floorId):void 0)??[...t.floors].sort((m,h)=>h.elevation-m.elevation)[0];if(this.liveCardsOn&&!this.dimmed&&!this.roomId&&c&&u&&d){let m=0,h=0,g=0;for(let _ of d.rooms)for(let[b,v]of _.points)m+=b,h+=v,g++;a.push({kind:"house",at:{floorId:d.id,x:g?m/g:u.x,z:g?h/g:u.z,y:d.height+(this.floorId?1.2:3.2)},summary:l,autarky:n.autarky,curves:this.dayCurves??void 0,week:this.week??void 0,meters:this.meterRows(t,l.consumption)}),this.refreshDayCurves(t),this.refreshWeek(t)}if(this.liveCardsOn&&!this.dimmed&&!this.roomId){for(let m of i)a.push({kind:"car",at:m.at,spot:m.spot,name:m.name,car:m.car});for(let m of this.livePrinters(t))a.push({kind:"printer",at:m.at,name:m.name,printer:m.printer});for(let m of this.liveHeatPumps(t))a.push({kind:"heatpump",at:m.at,name:m.name,pump:m.pump});for(let m of o)a.push({kind:"media",at:{...m.at,y:m.at.y+.5},media:m})}this.liveCardsOn&&!this.dimmed&&a.push(...Mc(s,t,this.floorId,this.roomId)),JSON.stringify(a)!==JSON.stringify(this._liveCards)&&(this._liveCards=a),e.setLiveAnchors(a.map(m=>m.at),a.length?(m,h,g,_)=>this.placeLhCard(m,h,g,_):null)}placeLhCard(e,t,n,i){let o=this.renderRoot.querySelector(`.live-card[data-i="${e}"]`);o&&(o.dataset.x=String(t),o.dataset.y=String(n),o.style.visibility=i?"visible":"hidden",e===this._liveCards.length-1&&Gc(this.renderRoot))}toggleHouseFold(){this._houseFolded=!this._houseFolded;try{localStorage.setItem("nextfloor.house_card_folded",this._houseFolded?"1":"0")}catch{}}toggleLhCards(){this._liveCardOn=!this._liveCardOn;try{localStorage.setItem("nextfloor.cards",this._liveCardOn?"1":"0")}catch{}this.syncDevices(!0)}renderTopLeft(){let e=this.clean?f:this.renderLhEnergy(),t=this.renderForecast("top_left");return this.clock!=="top_left"&&t===f||!this.hass?e:p`${this.clock==="top_left"?this.renderClock(!0):f}${e}${t}
`}renderLhEnergy(){let e=this.ownSensors(),t=this._liveEnergy?.summary,n=!!t&&!this.roomId&&this.showEnergy&&!!this.hass&&!(t.consumption===null&&t.grid===null&&t.solar===null&&t.battery===null),o=this.building?.floors.some(c=>c.rooms.some(u=>u.climate_card))?this.renderCardToggle():f,s=this.roomNamesButton?p``:f;if(!n)return e.length||o!==f||s!==f?p`${s}${e}${o}
`:f;let a=c=>A(this.hass,c),l=[];if(t.solar!==null&&l.push({cls:"solar",label:a("energy_solar"),value:ce(this.hass,t.solar)}),t.consumption!==null&&l.push({cls:"total",label:a("energy_consumption"),value:ce(this.hass,t.consumption)}),t.rest!==void 0&&t.rest!==null&&l.push({cls:"total",label:a("energy_rest"),value:ce(this.hass,t.rest)}),t.battery!==null||t.soc!==null){let c=[t.battery!==null?ce(this.hass,Math.abs(t.battery)):null,t.soc!==null?`${Math.round(t.soc)} %`:null].filter(Boolean);l.push({cls:"battery",label:a("energy_battery"),value:c.join(" \xB7 ")})}if(t.grid!==null){let c=t.grid<0;l.push({cls:c?"export":"grid",label:a(c?"energy_grid_export":"energy_grid_import"),value:ce(this.hass,Math.abs(t.grid))})}if(t.tariff&&l.push({cls:"tariff",label:a("energy_tariff"),value:`${W(this.hass,t.tariff.value,3)} ${t.tariff.unit}`.trim()}),this.building)for(let c of this.meterRows(this.building))l.push({cls:"meter",label:`${c.icon} ${c.label}`,value:c.value});return p`
${s}
${this.liveCardsOn&&this._liveCards.some(c=>c.kind==="house")?f:l.map(c=>p`
${c.label}${c.value}
`)}
${this.flows!==null?f:p`
`}
${this.renderCardToggle()}
${e}
`}renderCardToggle(){return this.holograms!==null?f:p``}ownSensors(){let e=this.sensorBar&&this.hass?this.building?.settings.status_entities??[]:[],t=U(this.hass)?(this.building?.presence??[]).filter(a=>Wa(this.hass,a.person,[0])).map(a=>p`${a.name||L(this.hass,a.person)}${oe(this.hass.states[a.person])===null?"\u2013":oe(this.hass.states[a.person])?"Anwesend":"Abwesend"}
`):[],n=U(this.hass)?Object.entries(this.building?.settings.weather_variables??{}).filter(a=>!!a[1]&&a[1]!=="none").map(([a,l])=>[iu[a]||a,l]):[];U(this.hass)&&this.building?.settings.rain_sensor&&this.building.settings.rain_sensor!=="none"&&n.push(["Regensensor",this.building.settings.rain_sensor]);let i=n.length?p`
`:f,o=U(this.hass)?(this.building?.floors??[]).filter(a=>!this.floorId||a.id===this.floorId).map(a=>({floor:a,readings:ln(this.hass,a,this.building?.floors.flatMap(l=>l.rooms))})).filter(a=>a.readings.length):[],s=o.length?p`
`:f;return[...t,i,s,...e.filter(a=>this.hass.states[a]).map(a=>p``)]}renderMapCredit(){let e=this.building?.settings.map;return uc(e)?p`${co(e).text}`:f}renderLegend(){if(this.heatMode==="wifi")return this.renderWifiLegend();if(this.heatMode==="none"||this.heatMode==="values")return f;let e=ht(new Date,this.hass?.config?.latitude??50),t=kr(this.heatMode,e),n=this.heatMode==="temperature",i=n?se(this.hass,t.stops[0][0]):t.stops[0][0],o=n?se(this.hass,t.stops[t.stops.length-1][0]):t.stops[t.stops.length-1][0],s=n?ne(this.hass):t.unit,a=l=>A(this.hass,l);return p`
${a(`heat_${this.heatMode}`)}${this.heatMode==="temperature"?p` ${a(e?"heat_summer":"heat_winter")}`:f}
${W(this.hass,i,0)} ${s}${W(this.hass,o,0)} ${s}
${this.heatValues.size?f:p`${a("heat_none_found")}`}
`}renderWifiLegend(){let e=this.hass,t=this.building;if(!e||!t)return f;let n=(c,u)=>A(e,c,u),i=t.floors.flatMap(c=>c.furniture.filter(u=>xo(u.type)).map(u=>ko(e,this.furnitureLinks?.get(u.id)?.entity??this.furnitureLinks?.get(u.id)?.power??null))),s=i.filter(c=>!!c).reduce((c,u)=>c+(u.clients??0),0),a=t.floors.flatMap(c=>c.placements.map(u=>e.states[u.entity_id])),l=Oc(a);return p`
📶 ${n("heat_wifi")}
${n("wifi_aps",{n:i.length,clients:s})}
${l.online+l.offline.length?p`${n("wifi_network",{online:l.online,offline:l.offline.length})}`:f}
${l.offline.length?p`${l.offline.slice(0,4).join(", ")}`:f}
${i.length?f:p`${n("wifi_none")}`}
`}skyColor(){let e=bn[this.theme]??bn.neon,t=this._sky;return e.night[0].map((n,i)=>Math.round(n+(e.day[0][i]-n)*t))}render(){let e=this._sky,t=(o,s)=>`rgb(${o.map((a,l)=>Math.round(a+(s[l]-a)*e)).join(",")})`,n=bn[this.theme]??bn.neon,i=`--nf-sky:${t(n.night[0],n.day[0])};--nf-ground:${t(n.night[1],n.day[1])}`+Ol(this.building?.settings.backdrop);return p`
${this._error?p`
${this._error}
`:f} ${this.renderTopLeft()} ${Uc(this.hass,this._liveCards,(o,s,a,l)=>this.hass?.callService(o,s,{entity_id:a,...l}),{folded:this._houseFolded,toggle:()=>this.toggleHouseFold()},!!this.roomId||this.panelOpen)} ${this.clean?f:this.renderLegend()} ${this.renderMapCredit()}
${this.renderAlerts()} ${this.renderAnnouncement()} ${this.clean?f:p`${this.renderThumbs()} ${this.renderScenes()} ${this.renderFind()} ${this.renderCentral()}`} ${this.renderSwipe()}
${this.renderMenu()} ${this.renderPlate()} ${this.renderEye()} ${this.renderLock()} ${this.renderWalk()} ${this.renderTravel()} ${this.renderClock()} ${this.renderToday()} ${this.renderLayers()} ${this.renderPluginWindow()}
${this.showStats&&this._stats?p`
${this._stats.fps?A(this.hass,"stats_fps",{fps:this._stats.fps,ms:this._stats.worstMs}):A(this.hass,"stats_idle")}
${this._stats.busy.length?p`(${this._stats.busy.map(o=>A(this.hass,`stats_busy_${o}`)).join(", ")})`:f} ·
${A(this.hass,"stats",{calls:this._stats.calls,tris:this._stats.triangles.toLocaleString()})} ·
${A(this.hass,this._stats.low?"stats_low":"stats_full",{r:W(this.hass,this._stats.pixelRatio,2)})}`:f}
`}static styles=[pe,Ae,jc,Q`
:host {
display: block;
position: relative;
min-height: 200px;
}
.nf-alert-banner {
position: absolute;
left: 50%;
top: 10px;
transform: translateX(-50%);
display: flex;
justify-content: center;
gap: 6px;
max-width: calc(100% - 24px);
z-index: 4;
}
.nf-alert {
flex: 0 1 auto;
min-width: 0;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
padding: 7px 14px 7px 12px;
border: 0;
border-left: 4px solid #ff3b4f;
border-radius: 12px;
background: var(--nf-chrome-solid);
color: var(--nf-text);
font: 600 13.5px var(--nf-font);
box-shadow: 0 0 18px rgba(255, 59, 79, 0.35);
cursor: pointer;
animation: nf-alert-pulse 1.2s ease-in-out infinite;
}
.nf-alert-water,
.nf-alert-window_rain {
border-left-color: #4fb3ff;
box-shadow: 0 0 18px rgba(79, 179, 255, 0.35);
}
.nf-alert-alarm_pending {
border-left-color: #ffb547;
box-shadow: 0 0 18px rgba(255, 181, 71, 0.35);
}
.nf-announcement {
position: absolute;
inset: 18% 8% auto;
z-index: 30;
display: flex;
align-items: center;
gap: 18px;
margin: 0 auto;
max-width: 860px;
padding: 22px 28px;
border: 1px solid color-mix(in srgb, var(--nf-accent) 55%, transparent);
border-radius: 22px;
background: var(--nf-chrome-solid);
color: var(--nf-text);
box-shadow: 0 0 40px color-mix(in srgb, var(--nf-accent) 35%, transparent), 0 18px 50px rgba(0, 0, 0, 0.45);
font: 700 clamp(22px, 3.6vw, 40px) / 1.25 var(--nf-font);
text-align: left;
cursor: pointer;
animation: nf-announce-in 0.35s ease-out;
}
.nf-announcement-icon {
font-size: 1.3em;
}
@keyframes nf-announce-in {
from {
opacity: 0;
transform: translateY(-12px) scale(0.98);
}
}
@media (prefers-reduced-motion: reduce) {
.nf-announcement {
animation: none;
}
}
/* a contact that stopped answering is a chore, not an emergency: no glow, no pulse */
.nf-alert-contact_lost,
.nf-alert-own {
border-left-color: #ffb547;
box-shadow: none;
animation: none;
}
.nf-alert-more {
align-self: center;
color: var(--nf-muted);
font-size: 13px;
}
@keyframes nf-alert-pulse {
50% {
box-shadow: 0 0 4px transparent;
}
}
.nf-has-alerts .nf-energy,
.nf-has-alerts .nf-topleft {
top: 58px;
}
/* the clock top left stacks above the sensor and energy bar rather than covering it */
.nf-topleft {
position: absolute;
left: 12px;
top: 10px;
z-index: 3;
display: flex;
flex-direction: column;
align-items: flex-start;
gap: 8px;
max-width: calc(100% - 24px);
pointer-events: none;
}
.nf-topleft > .nf-clock,
.nf-topleft > .nf-energy {
position: static;
max-width: 100%;
}
.nf-scenes {
position: absolute;
left: 60px;
right: 60px;
bottom: calc(10px + var(--nf-bottom-inset, 0px));
display: flex;
flex-wrap: wrap;
justify-content: center;
gap: 6px;
z-index: 2;
pointer-events: none;
}
.nf-scenes .nf-chip {
pointer-events: auto;
}
@media (prefers-reduced-motion: reduce) {
.nf-alert,
.nf-dev-found {
animation: none;
}
}
.nf-stage {
position: absolute;
inset: 0;
overflow: hidden;
container-type: size;
container-name: nf;
background: radial-gradient(ellipse at 50% 35%, var(--nf-sky, var(--nf-bg2)), var(--nf-ground, var(--nf-bg)) 72%);
transition: background 2s ease;
}
.nf-canvas {
position: absolute;
inset: 0;
width: 100%;
height: 100%;
display: block;
touch-action: none;
cursor: grab;
}
.nf-canvas:active {
cursor: grabbing;
}
:host([readable]) .nf-pin {
font-size: 15px;
padding: 6px 12px;
}
:host([readable]) .nf-pin-info small,
:host([readable]) .nf-pin-floor span {
font-size: 14px;
opacity: 1;
}
:host([readable]) .nf-pin-floor b {
font-size: 18px;
}
:host([readable]) .nf-dev {
font-size: 14px;
color: var(--nf-text);
}
.nf-note-pin {
background: #ffe58a;
color: #3a2e00;
border-color: #c9a400;
max-width: 260px;
overflow: hidden;
text-overflow: ellipsis;
}
.nf-note-pin.nf-note-due {
background: #ffa726;
color: #2a1600;
}
.nf-note-pin.nf-note-open {
white-space: normal;
text-align: left;
}
.nf-note-photo {
display: block;
width: 100%;
max-height: 200px;
object-fit: cover;
margin-top: 6px;
border-radius: 6px;
}
.nf-labels {
position: absolute;
inset: 0;
pointer-events: none;
}
.nf-pin-info {
display: grid;
gap: 1px;
text-align: center;
}
.nf-pin-info small {
font-size: 11px;
font-weight: 500;
opacity: 0.9;
font-variant-numeric: tabular-nums;
}
.nf-pin {
position: absolute;
left: 0;
top: 0;
pointer-events: auto;
font: 600 12.5px var(--nf-title-font);
color: var(--nf-text);
background: var(--nf-chrome);
border: 1px solid var(--nf-line);
border-radius: 10px;
padding: 5px 10px;
cursor: pointer;
white-space: nowrap;
backdrop-filter: blur(6px);
box-shadow: var(--nf-shadow);
}
.nf-pin-floor {
display: grid;
justify-items: start;
gap: 1px;
padding: 8px 14px;
border-radius: 12px;
background: var(--nf-accent);
color: var(--nf-accent-text);
border-color: transparent;
box-shadow: var(--nf-shadow);
}
.nf-pin-floor b {
font: 700 15px var(--nf-title-font);
letter-spacing: -0.01em;
}
.nf-pin-floor span {
font: 500 12px var(--nf-font);
opacity: 0.78;
}
.nf-dev {
position: absolute;
left: 0;
top: 0;
pointer-events: auto;
display: inline-flex;
align-items: center;
gap: 6px;
padding: 4px;
border-radius: 999px;
border: 1px solid var(--nf-line);
background: var(--nf-chrome);
color: var(--nf-muted);
font: 600 12px var(--nf-font);
cursor: pointer;
white-space: nowrap;
backdrop-filter: blur(6px);
touch-action: manipulation;
-webkit-user-select: none;
user-select: none;
transition: opacity 0.2s ease;
}
.nf-dev-icon {
display: grid;
place-items: center;
width: 24px;
height: 24px;
border-radius: 50%;
background: color-mix(in srgb, var(--nf-soft) 14%, transparent);
}
.nf-dev-text {
display: none;
padding-right: 6px;
color: var(--nf-text);
font-variant-numeric: tabular-nums;
max-width: 160px;
overflow: hidden;
text-overflow: ellipsis;
}
.nf-dev-watt:empty {
display: none;
}
.nf-dev-watt {
padding: 1px 6px 1px 0;
color: var(--nf-accent);
font-variant-numeric: tabular-nums;
font-weight: 700;
}
.nf-dev-on .nf-dev-watt {
color: #2a1a00;
}
.nf-person {
position: absolute;
left: 0;
top: 0;
display: grid;
place-items: center;
width: 30px;
height: 30px;
border-radius: 50%;
overflow: hidden;
background: #ff5fd2;
color: #fff;
font: 700 12px var(--nf-font);
box-shadow:
0 0 0 2px rgba(255, 95, 210, 0.45),
0 0 18px #ff5fd2;
pointer-events: auto;
}
.nf-person img {
width: 100%;
height: 100%;
object-fit: cover;
}
.nf-person[hidden] {
display: none;
}
.nf-no-room-names .nf-pin[data-room] {
display: none !important;
}
/* tablet level: blur over the canvas and glowing shadows are expensive on weak GPUs */
.nf-stage.nf-low {
transition: none;
}
.nf-low .nf-pin,
.nf-low .nf-dev,
.nf-low .nf-dev-on,
.nf-low .nf-energy-item,
.nf-low .nf-find input,
.nf-low .nf-find-list,
.nf-low .nf-find-btn,
.nf-low .nf-swipe,
.nf-low .nf-thumb {
backdrop-filter: none;
box-shadow: none;
transition: none;
}
.nf-thumbs {
position: absolute;
left: 12px;
top: 50%;
transform: translateY(-50%);
display: flex;
flex-direction: column;
gap: 8px;
max-height: calc(100% - 140px);
overflow-y: auto;
scrollbar-width: none;
z-index: 2;
}
.nf-thumb {
position: relative;
display: grid;
padding: 0;
width: 150px;
border: 1px solid var(--nf-line);
border-radius: 14px;
background: color-mix(in srgb, var(--nf-chrome) 70%, transparent);
color: var(--nf-text);
cursor: pointer;
overflow: hidden;
font: inherit;
box-shadow: var(--nf-shadow);
opacity: 0.72;
transition: opacity 0.15s, border-color 0.15s;
}
.nf-thumb:hover,
.nf-thumb[aria-pressed="true"] {
opacity: 1;
}
.nf-thumb[aria-pressed="true"] {
border-color: var(--nf-accent);
box-shadow: var(--nf-shadow), 0 0 0 2px var(--nf-accent);
}
.nf-thumb img {
display: block;
width: 100%;
aspect-ratio: 4 / 3;
}
.nf-thumb span {
position: absolute;
left: 8px;
bottom: 6px;
font-size: 12px;
font-weight: 600;
}
.nf-thumb img + span {
inset: auto 0 0 0;
padding: 18px 10px 6px;
color: #fff;
background: linear-gradient(transparent, rgba(0, 0, 0, 0.62));
}
.nf-thumbs-fold {
align-self: flex-start;
width: 26px;
height: 22px;
padding: 0;
border: 1px solid var(--nf-line);
border-radius: 8px;
background: var(--nf-chrome);
color: var(--nf-text);
font-size: 11px;
cursor: pointer;
}
/* folded: plain floor buttons with their names, no pictures (D177) */
.nf-thumbs-compact .nf-thumb {
padding: 6px 10px;
min-width: 0;
}
.nf-thumbs-compact .nf-thumb span {
position: static;
background: none;
padding: 0;
}
.nf-thumb-house {
display: flex;
align-items: center;
gap: 8px;
padding: 8px 10px;
}
.nf-thumb-house span {
position: static;
text-shadow: none;
}
/* a low stage (a card of 420 px): the pictures start under the top bar and stop above the buttons at the bottom left */
.nf-thumbs.nf-thumbs-short {
top: 52px;
transform: none;
max-height: calc(100% - 52px - 150px);
}
.nf-thumbs-small .nf-thumb {
width: 104px;
}
.nf-find-btn {
position: absolute;
left: 12px;
bottom: calc(10px + var(--nf-bottom-inset, 0px));
width: 40px;
height: 40px;
display: grid;
place-items: center;
border: 0;
border-radius: 13px;
background: var(--nf-chrome);
color: var(--nf-text);
box-shadow: var(--nf-shadow);
cursor: pointer;
}
/* the star sits above the search button, its menu opens above it */
.nf-central-btn {
position: absolute;
left: 12px;
bottom: calc(56px + var(--nf-bottom-inset, 0px));
width: 40px;
height: 40px;
display: grid;
place-items: center;
border: 0;
border-radius: 13px;
background: var(--nf-chrome);
color: var(--nf-text);
box-shadow: var(--nf-shadow);
cursor: pointer;
z-index: 3;
}
.nf-central-on {
color: var(--nf-accent);
}
.nf-central {
position: absolute;
left: 12px;
bottom: calc(104px + var(--nf-bottom-inset, 0px));
width: min(320px, calc(100% - 24px));
max-height: calc(100% - 140px);
overflow-y: auto;
box-sizing: border-box;
display: flex;
flex-direction: column;
gap: 8px;
padding: 12px 14px;
border: 1px solid var(--nf-line);
border-radius: 16px;
background: var(--nf-chrome);
color: var(--nf-text);
box-shadow: var(--nf-shadow);
backdrop-filter: blur(10px);
z-index: 4;
}
.nf-central > b {
font-size: 12px;
letter-spacing: 0.08em;
text-transform: uppercase;
opacity: 0.7;
}
.nf-central-row {
display: grid;
grid-template-columns: 1fr auto auto;
gap: 6px;
align-items: center;
}
.nf-central-row small {
opacity: 0.6;
}
.nf-central .nf-btn {
min-width: 64px;
}
.nf-central-armed {
background: #ff8a3d !important;
color: #1a0d00 !important;
}
.nf-central-favs {
display: flex;
flex-wrap: wrap;
gap: 6px;
}
.nf-own-btn {
display: inline-flex;
align-items: center;
gap: 6px;
}
.nf-own-btn ha-icon {
--mdc-icon-size: 18px;
}
.nf-central-hint {
margin: 0;
font-size: 13px;
opacity: 0.7;
}
.nf-layers {
position: absolute;
top: 12px;
left: 50%;
transform: translateX(-50%);
display: flex;
gap: 6px;
z-index: 3;
}
.nf-has-alerts .nf-layers {
top: 58px;
}
/* top right: "Today" and the forecast below it, one column */
.nf-right-col {
position: absolute;
top: 12px;
right: 12px;
width: min(280px, calc(100% - 24px));
max-height: calc(100% - 140px);
display: flex;
flex-direction: column;
align-items: flex-end;
gap: 8px;
z-index: 3;
pointer-events: none;
}
.nf-right-col > * {
pointer-events: auto;
}
.nf-has-alerts .nf-right-col {
top: 58px;
}
/* "Today": the day's appointments and bins, folds to its title */
.nf-today {
width: 100%;
min-height: 0;
overflow-y: auto;
box-sizing: border-box;
padding: 8px 12px 10px;
border-radius: 16px;
border: 1px solid var(--nf-line);
background: var(--nf-chrome);
box-shadow: var(--nf-shadow);
backdrop-filter: blur(10px);
color: var(--nf-text);
z-index: 3;
}
.nf-low :is(.nf-today, .nf-forecast) {
backdrop-filter: none;
}
.nf-today-day {
display: block !important;
margin-top: 4px;
font-size: 12px;
font-weight: 600;
color: var(--nf-muted);
}
/* the forecast: a row per day */
.nf-forecast {
box-sizing: border-box;
flex: none;
padding: 6px 12px;
border-radius: 16px;
border: 1px solid var(--nf-line);
background: var(--nf-chrome);
box-shadow: var(--nf-shadow);
backdrop-filter: blur(10px);
color: var(--nf-text);
pointer-events: auto;
}
.nf-forecast ul {
list-style: none;
margin: 0;
padding: 0;
display: grid;
grid-template-columns: auto auto auto auto;
column-gap: 10px;
row-gap: 2px;
align-items: baseline;
font-size: 13px;
}
.nf-forecast li {
display: contents;
}
.nf-fc-day {
color: var(--nf-muted);
}
.nf-fc-temp {
font-variant-numeric: tabular-nums;
white-space: nowrap;
}
.nf-fc-temp small {
color: var(--nf-muted);
}
.nf-fc-rain {
font-size: 12px;
color: var(--nf-soft);
white-space: nowrap;
}
.nf-today-folded {
width: auto;
align-self: flex-end;
padding-bottom: 8px;
}
.nf-today-head {
display: flex;
gap: 8px;
align-items: baseline;
width: 100%;
padding: 0;
border: 0;
background: none;
color: inherit;
font: inherit;
cursor: pointer;
text-align: left;
}
.nf-today-head span {
font-size: 12px;
color: var(--nf-muted);
}
.nf-today ul {
list-style: none;
margin: 8px 0 0;
padding: 0;
display: grid;
gap: 6px;
}
.nf-today li {
display: grid;
grid-template-columns: 44px 1fr;
gap: 8px;
align-items: baseline;
font-size: 14px;
}
.nf-today time {
font-variant-numeric: tabular-nums;
color: var(--nf-accent);
font-weight: 600;
}
.nf-today small {
display: block;
font-size: 11px;
color: var(--nf-muted);
}
.nf-today-past {
opacity: 0.45;
}
.nf-today-none {
margin: 6px 0 0;
font-size: 13px;
color: var(--nf-muted);
}
/* opened from the start on a wall tablet: a size larger, easy to hit */
.nf-central-big {
width: min(420px, calc(100% - 24px));
font-size: 16px;
}
.nf-central-big .nf-chip,
.nf-central-big .nf-btn {
min-height: 44px;
padding: 8px 16px;
font-size: 15px;
}
.nf-own-btn[aria-pressed="true"] {
border-color: var(--nf-accent);
color: var(--nf-accent);
box-shadow: 0 0 12px color-mix(in srgb, var(--nf-accent) 45%, transparent);
}
.nf-low .nf-central {
backdrop-filter: none;
}
/* the eye sits beside the search button; alone in the corner once the view is clean */
.nf-travel-btn {
position: absolute;
left: 188px;
bottom: calc(10px + var(--nf-bottom-inset, 0px));
width: 36px;
height: 36px;
padding: 0;
border-radius: 50%;
border: 1px solid rgba(160, 240, 255, 0.35);
background: rgba(8, 16, 34, 0.7);
color: var(--nf-text);
font-size: 14px;
cursor: pointer;
z-index: 4;
}
.nf-travel {
position: absolute;
left: 50%;
bottom: calc(62px + var(--nf-bottom-inset, 0px));
transform: translateX(-50%);
width: min(860px, calc(100% - 24px));
display: flex;
align-items: center;
gap: 8px;
padding: 8px 10px;
border-radius: 18px;
background: rgba(8, 16, 34, 0.82);
box-shadow: 0 6px 22px rgba(0, 0, 0, 0.4);
color: var(--nf-text);
z-index: 5;
flex-wrap: wrap;
}
.nf-travel button,
.nf-travel select {
min-height: 32px;
border: 0;
border-radius: 999px;
padding: 0 10px;
background: rgba(127, 127, 127, 0.16);
color: inherit;
font: inherit;
font-size: 13px;
cursor: pointer;
}
.nf-travel select option {
color: #111;
}
.nf-travel .nf-travel-play {
width: 36px;
padding: 0;
background: var(--nf-accent);
color: #041018;
}
.nf-travel-span[aria-pressed="true"] {
box-shadow: inset 0 0 0 1px var(--nf-accent);
color: var(--nf-accent);
}
.nf-travel-live {
color: #ff5a6b !important;
}
.nf-travel-when {
min-width: 92px;
font-variant-numeric: tabular-nums;
font-size: 14px;
}
.nf-travel-track {
position: relative;
flex: 1 1 220px;
height: 28px;
}
.nf-travel-track svg {
position: absolute;
inset: 9px 0;
width: 100%;
height: 10px;
fill: var(--nf-accent);
opacity: 0.55;
pointer-events: none;
}
.nf-travel-track input {
position: absolute;
inset: 0;
width: 100%;
margin: 0;
background: transparent;
accent-color: var(--nf-accent);
}
.nf-walk-btn {
position: absolute;
left: 144px;
bottom: calc(10px + var(--nf-bottom-inset, 0px));
width: 36px;
height: 36px;
display: grid;
place-items: center;
padding: 0;
border-radius: 50%;
border: 1px solid rgba(160, 240, 255, 0.35);
background: rgba(8, 16, 34, 0.7);
color: var(--nf-text);
font-size: 16px;
cursor: pointer;
z-index: 4;
}
.nf-walk-on {
color: #041018;
background: var(--nf-accent);
border-color: var(--nf-accent);
}
.nf-stick {
position: absolute;
right: 28px;
bottom: calc(70px + var(--nf-bottom-inset, 0px));
width: 120px;
height: 120px;
border-radius: 50%;
background: rgba(8, 16, 34, 0.45);
border: 1px solid rgba(160, 240, 255, 0.35);
display: grid;
place-items: center;
touch-action: none;
z-index: 4;
}
.nf-stick span {
width: 52px;
height: 52px;
border-radius: 50%;
background: var(--nf-accent);
opacity: 0.85;
pointer-events: none;
}
.nf-walk-hint {
position: absolute;
left: 50%;
top: 12px;
transform: translateX(-50%);
margin: 0;
padding: 6px 12px;
border-radius: 999px;
background: rgba(8, 16, 34, 0.6);
color: var(--nf-muted);
font-size: 12px;
pointer-events: none;
z-index: 3;
}
.nf-lock3d {
position: absolute;
left: 100px;
bottom: calc(10px + var(--nf-bottom-inset, 0px));
width: 36px;
height: 36px;
display: grid;
place-items: center;
padding: 0;
border-radius: 50%;
border: 1px solid rgba(160, 240, 255, 0.35);
background: rgba(8, 16, 34, 0.7);
color: var(--nf-text);
cursor: pointer;
z-index: 4;
}
.nf-lock3d-on {
color: #041018;
background: var(--nf-accent);
border-color: var(--nf-accent);
}
.nf-plugin-window {
position: absolute;
right: 12px;
bottom: 12px;
z-index: 6;
width: min(420px, calc(100% - 24px));
border-radius: 12px;
overflow: hidden;
background: rgba(10, 16, 22, 0.92);
border: 1px solid rgba(127, 208, 255, 0.35);
box-shadow: 0 8px 28px rgba(0, 0, 0, 0.45);
color: #e6f4fb;
}
.nf-pw-head {
display: flex;
align-items: center;
gap: 8px;
padding: 6px 8px 6px 12px;
font-size: 13px;
}
.nf-pw-head span {
flex: 1;
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
}
.nf-pw-close {
border: 0;
background: transparent;
color: inherit;
font-size: 16px;
cursor: pointer;
padding: 2px 6px;
}
.nf-pw-body {
line-height: 0;
}
.nf-clock {
position: absolute;
z-index: 3;
display: flex;
flex-direction: column;
padding: 8px 14px;
border-radius: 16px;
background: rgba(8, 16, 34, 0.55);
color: var(--nf-text);
pointer-events: none;
line-height: 1.1;
}
.nf-clock b {
font-size: clamp(28px, 6cqmin, 64px);
font-weight: 600;
font-variant-numeric: tabular-nums;
letter-spacing: -0.02em;
}
.nf-clock span {
font-size: clamp(12px, 1.8cqmin, 18px);
color: var(--nf-muted);
}
.nf-clock-top_left {
left: 16px;
top: 16px;
}
.nf-clock-top_right {
right: 16px;
top: 16px;
align-items: flex-end;
}
.nf-clock-bottom_left {
left: 16px;
bottom: calc(60px + var(--nf-bottom-inset, 0px));
}
.nf-clock-bottom_right {
right: 16px;
bottom: calc(60px + var(--nf-bottom-inset, 0px));
align-items: flex-end;
}
.nf-eye {
position: absolute;
left: 56px;
bottom: calc(10px + var(--nf-bottom-inset, 0px));
width: 36px;
height: 36px;
display: grid;
place-items: center;
padding: 0;
border-radius: 50%;
border: 1px solid rgba(160, 240, 255, 0.35);
background: rgba(8, 16, 34, 0.7);
color: var(--nf-text);
cursor: pointer;
z-index: 4;
}
/* in the clean view the button sits at the top: a tablet's taskbar or gesture bar covers the bottom edge and the button was lost there (#75) */
.nf-eye-clean {
left: auto;
bottom: auto;
right: calc(12px + env(safe-area-inset-right, 0px));
top: calc(12px + env(safe-area-inset-top, 0px));
opacity: 0.55;
}
.nf-eye:hover,
.nf-eye-clean:hover {
opacity: 1;
}
.nf-find {
position: absolute;
left: 12px;
bottom: calc(10px + var(--nf-bottom-inset, 0px));
width: min(340px, calc(100% - 24px));
display: flex;
flex-direction: column-reverse;
gap: 6px;
z-index: 3;
}
.nf-find input {
box-sizing: border-box;
width: 100%;
height: 42px;
padding: 0 42px 0 14px;
border: 1px solid var(--nf-line);
border-radius: 14px;
background: var(--nf-chrome);
color: var(--nf-text);
font: inherit;
font-size: 15px;
box-shadow: var(--nf-shadow);
backdrop-filter: blur(8px);
}
.nf-find-close {
position: absolute;
right: 6px;
bottom: 6px;
width: 30px;
height: 30px;
border: 0;
border-radius: 10px;
background: none;
color: var(--nf-muted);
cursor: pointer;
}
.nf-find-list {
display: grid;
padding: 6px;
border-radius: 14px;
background: var(--nf-chrome);
box-shadow: var(--nf-shadow);
backdrop-filter: blur(8px);
}
.nf-find-list button {
display: flex;
align-items: center;
gap: 10px;
padding: 8px 10px;
border: 0;
border-radius: 10px;
background: none;
color: var(--nf-text);
text-align: left;
font: inherit;
cursor: pointer;
}
.nf-find-list button:hover,
.nf-find-list button:focus-visible {
background: rgba(127, 127, 127, 0.14);
}
.nf-find-list b {
display: block;
font-weight: 600;
}
.nf-find-list small,
.nf-find-list p {
color: var(--nf-muted);
font-size: 12px;
margin: 0;
}
.nf-find-list p {
padding: 8px 10px;
}
.nf-find-icon {
display: grid;
place-items: center;
width: 30px;
height: 30px;
border-radius: 10px;
background: rgba(127, 127, 127, 0.15);
flex: none;
}
.nf-find-icon svg {
width: 16px;
height: 16px;
}
.nf-swipe {
position: absolute;
transform: translate(-50%, calc(-100% - 28px));
display: grid;
grid-template-columns: auto auto;
align-items: center;
gap: 2px 12px;
padding: 8px 12px;
border-radius: 14px;
background: var(--nf-chrome);
box-shadow: var(--nf-shadow);
pointer-events: none;
white-space: nowrap;
z-index: 4;
}
.nf-swipe span {
font-size: 12px;
color: var(--nf-muted);
}
.nf-swipe b {
grid-row: 2;
font: 700 22px var(--nf-title-font);
}
.nf-swipe i {
grid-row: 1 / 3;
grid-column: 2;
position: relative;
width: 10px;
height: 44px;
border-radius: 5px;
background: rgba(127, 127, 127, 0.25);
overflow: hidden;
}
.nf-swipe em {
position: absolute;
left: 0;
right: 0;
bottom: 0;
background: var(--nf-warm);
}
.nf-plate-menu {
position: absolute;
z-index: 6;
display: flex;
flex-direction: column;
gap: 4px;
min-width: 220px;
padding: 6px;
border-radius: 16px;
background: var(--nf-bg2, #1c2233);
box-shadow: 0 8px 28px rgba(0, 0, 0, 0.45);
}
.nf-plate-menu button {
display: grid;
grid-template-columns: 24px 1fr auto;
align-items: center;
gap: 8px;
min-height: 42px;
padding: 0 10px;
border: 0;
border-radius: 12px;
background: none;
color: var(--nf-text, #e8eeff);
font: inherit;
text-align: left;
cursor: pointer;
}
.nf-plate-menu button:hover {
background: rgba(127, 127, 127, 0.14);
}
.nf-plate-menu button.on b {
background: var(--nf-accent, #37e0ff);
color: #041018;
}
.nf-plate-menu b {
display: grid;
place-items: center;
width: 24px;
height: 24px;
border-radius: 50%;
background: rgba(127, 127, 127, 0.2);
font-size: 12px;
}
.nf-plate-menu i {
font-style: normal;
color: var(--nf-muted, #9aa5bd);
font-size: 13px;
}
.nf-menu-backdrop {
position: absolute;
inset: 0;
z-index: 5;
}
.nf-through {
position: absolute;
inset: 0;
z-index: 4;
pointer-events: none;
}
/* the camera wall: a glass sheet over the scene with every camera's picture */
.nf-wall {
position: absolute;
inset: 56px 12px calc(var(--nf-bottom-inset, 0px) + 12px);
z-index: 5;
display: flex;
flex-direction: column;
gap: 8px;
padding: 10px 12px;
border-radius: 16px;
background: rgba(8, 16, 34, 0.86);
border: 1px solid rgba(160, 240, 255, 0.4);
box-shadow: var(--nf-shadow);
overflow: auto;
}
.nf-wall-head {
display: flex;
align-items: center;
justify-content: space-between;
font-weight: 600;
color: var(--nf-text);
}
.nf-wall-head .nf-wall-title {
flex: 1;
text-align: center;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
padding: 0 8px;
}
.nf-wall-title b {
color: #ff6b6b;
font-weight: 600;
}
.nf-wall-tools {
display: flex;
gap: 6px;
}
.nf-wall-big {
flex: 1;
min-height: 0;
display: flex;
align-items: center;
justify-content: center;
border-radius: 12px;
overflow: hidden;
background: #0a1426;
}
.nf-wall-big img {
width: 100%;
height: 100%;
object-fit: contain;
}
/* the stream player: a bare card, as wide as the sheet allows for a 16:9 picture */
.nf-wall-big > hui-picture-entity-card,
.nf-wall-big > hui-error-card {
width: min(100%, calc((100vh - 200px) * 16 / 9));
--ha-card-background: transparent;
--ha-card-border-width: 0;
--ha-card-box-shadow: none;
}
.nf-wall-grid {
flex: 1;
display: grid;
align-content: safe center;
justify-content: center;
gap: 12px;
min-height: 0;
overflow-y: auto;
}
.nf-wall-cam {
position: relative;
padding: 0;
border: 1px solid rgba(160, 240, 255, 0.3);
border-radius: 12px;
overflow: hidden;
background: #0a1426;
cursor: pointer;
width: 100%;
height: 100%;
}
.nf-wall-cam img,
.nf-wall-none {
width: 100%;
height: 100%;
object-fit: cover;
display: flex;
align-items: center;
justify-content: center;
color: #8aa;
}
.nf-wall-seen {
border-color: rgba(255, 80, 90, 0.9);
box-shadow: 0 0 14px rgba(255, 60, 70, 0.5);
}
.nf-wall-name {
position: absolute;
left: 0;
right: 0;
bottom: 0;
padding: 4px 8px;
font-size: 12px;
text-align: left;
color: var(--nf-text);
background: linear-gradient(transparent, rgba(0, 0, 0, 0.7));
}
.nf-wall-name b {
color: #ff6b6b;
font-weight: 600;
}
/* a lightning bolt of the weather layer lights up the whole stage for a moment */
.live-flash::after {
content: "";
position: absolute;
inset: 0;
z-index: 3;
background: radial-gradient(circle at 50% 20%, rgba(235, 242, 255, 0.55), rgba(200, 215, 255, 0.18) 70%);
pointer-events: none;
}
.nf-through-img {
position: absolute;
inset: 0;
width: 100%;
height: 100%;
object-fit: cover;
opacity: var(--nf-blend);
}
.nf-through-bar {
position: absolute;
left: 50%;
bottom: calc(var(--nf-bottom-inset, 0px) + 14px);
transform: translateX(-50%);
display: flex;
align-items: center;
gap: 12px;
max-width: calc(100% - 32px);
padding: 8px 10px 8px 16px;
border-radius: 999px;
background: var(--nf-chrome);
backdrop-filter: blur(12px);
border: 1px solid var(--nf-line);
pointer-events: auto;
}
.nf-through-name {
font-weight: 600;
white-space: nowrap;
}
/* a small note that the picture is a still, so nobody wonders why it does not move */
.nf-still {
font-size: 11px;
font-weight: 400;
opacity: 0.65;
white-space: nowrap;
margin-left: 6px;
}
.nf-through-bar input[type="range"] {
width: 140px;
accent-color: var(--nf-accent);
}
.nf-through-on :is(.nf-pin, .nf-dev, .nf-energy, .nf-legend, .nf-thumbs, .nf-scenes, .nf-find-btn, .nf-stats) {
display: none;
}
nf-quick-menu {
position: absolute;
z-index: 6;
}
.nf-dev-found {
animation: nf-found 0.6s ease-in-out 4;
}
@keyframes nf-found {
50% {
scale: 1.35;
filter: drop-shadow(0 0 12px var(--nf-accent));
}
}
.nf-map-credit {
position: absolute;
right: 8px;
bottom: 4px;
z-index: 2;
padding: 1px 6px;
border-radius: 6px;
background: color-mix(in srgb, var(--nf-chrome) 80%, transparent);
color: var(--nf-soft);
font-size: 10px;
text-decoration: none;
}
.nf-legend {
position: absolute;
left: 12px;
/* above the star button */
bottom: calc(104px + var(--nf-bottom-inset, 0px));
display: grid;
gap: 4px;
min-width: 180px;
padding: 8px 11px;
border-radius: 12px;
background: var(--nf-chrome);
box-shadow: var(--nf-shadow);
font-size: 12px;
pointer-events: none;
}
.nf-legend-bar {
height: 8px;
border-radius: 4px;
}
.nf-legend-range {
display: flex;
justify-content: space-between;
color: var(--nf-muted);
font-variant-numeric: tabular-nums;
}
.nf-legend-none {
color: var(--nf-warm);
}
.nf-energy {
position: absolute;
left: 12px;
top: 10px;
display: flex;
flex-wrap: wrap;
gap: 6px;
max-width: calc(100% - 24px);
pointer-events: none;
}
.nf-energy-item {
display: grid;
padding: 5px 11px 6px;
border-radius: 12px;
background: var(--nf-chrome);
border-left: 3px solid var(--nf-line);
box-shadow: var(--nf-shadow);
backdrop-filter: blur(6px);
font-variant-numeric: tabular-nums;
}
.nf-energy-item span {
font-size: 11px;
color: var(--nf-muted);
}
.nf-energy-item b {
font: 700 15px var(--nf-title-font);
}
.nf-energy-total {
border-left-color: #6fd8ff;
}
.nf-energy-grid {
border-left-color: var(--nf-accent);
}
.nf-energy-export,
.nf-energy-solar {
border-left-color: #ffc633;
}
.nf-energy-battery {
border-left-color: #59ff8c;
}
.nf-flow-toggle {
pointer-events: auto;
cursor: pointer;
border: 0;
border-left: 3px solid var(--nf-line);
color: inherit;
text-align: left;
font: inherit;
}
.nf-weather-dialog { pointer-events:auto; width:min(380px,calc(100vw - 32px)); max-height:75dvh; overflow:auto; box-sizing:border-box; padding:16px; background:var(--nf-chrome-solid); color:var(--nf-text); font:14px/1.5 system-ui,sans-serif; border:1px solid var(--nf-line); border-radius:12px; box-shadow:var(--nf-shadow); }
.nf-weather-dialog::backdrop { background:#0008; }
.nf-weather-dialog header,.nf-weather-dialog p { display:flex; justify-content:space-between; gap:16px; margin:8px 0; }
.nf-weather-dialog p span { color:var(--nf-muted); }
.nf-weather-dialog p b { font-size:13px; white-space:nowrap; }
.nf-own-sensor {
pointer-events: auto;
cursor: pointer;
border: 0;
border-left: 3px solid var(--nf-accent);
color: inherit;
text-align: left;
font: inherit;
max-width: 220px;
}
.nf-own-sensor span,
.nf-own-sensor b {
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
}
.nf-flow-toggle[aria-pressed="true"] {
border-left-color: var(--nf-accent);
}
.nf-flow-toggle span {
display: none;
}
.nf-flow-toggle b {
opacity: 0.4;
filter: grayscale(1);
}
.nf-flow-toggle[aria-pressed="true"] b {
opacity: 1;
filter: none;
}
.nf-energy-tariff {
border-left-color: #b98cff;
}
/* narrow stages (portrait tablets, phones): the energy values scroll in one row */
@container nf (max-width: 900px) {
.nf-energy {
flex-wrap: nowrap;
overflow-x: auto;
scrollbar-width: none;
pointer-events: auto;
}
.nf-legend {
bottom: auto;
top: 62px;
}
.nf-has-alerts .nf-legend {
top: 110px;
}
}
/* a room sheet covers the lower half: the view's own controls step aside */
@container nf ((max-width: 700px) or ((orientation: portrait) and (max-width: 1000px))) {
.nf-panel-open :is(.nf-find-btn, .nf-find, .nf-thumbs, .nf-legend, .nf-stats, .nf-scenes) {
display: none;
}
}
@media (pointer: coarse) {
.nf-find-close {
width: 40px;
height: 40px;
right: 1px;
bottom: 1px;
}
.nf-dev {
padding: 6px;
}
.nf-pin {
padding: 8px 12px;
}
}
.nf-dev-full .nf-dev-text {
display: inline;
}
.nf-dev-name:empty {
display: none;
}
.nf-dev-name {
position: absolute;
top: calc(100% + 3px);
left: 50%;
transform: translateX(-50%);
max-width: 140px;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
padding: 1px 6px;
border-radius: 6px;
font-size: 10.5px;
font-weight: 600;
line-height: 1.35;
/* a fixed dark plate, so a fixed light text: the theme text colour can be dark (day themes, pins that are on) */
color: #f2f5fb;
background: rgba(10, 16, 32, 0.72);
pointer-events: none;
}
.nf-dev-sel {
outline: 2px solid var(--nf-accent);
outline-offset: 2px;
}
.nf-dev-on {
color: #2a1a00;
border-color: transparent;
background: var(--nf-glow, var(--nf-warm));
box-shadow: 0 0 16px var(--nf-glow, var(--nf-warm));
}
.nf-dev-on .nf-dev-icon {
background: color-mix(in srgb, var(--nf-text) 28%, transparent);
}
.nf-dev-on .nf-dev-text {
color: #2a1a00;
}
.nf-dev-na {
opacity: 0.45;
}
.nf-dev-dim {
opacity: 0.35;
}
.nf-dev[hidden],
.nf-pin[hidden] {
display: none;
}
.nf-pin-active {
background: var(--nf-accent);
color: var(--nf-accent-text);
border-color: transparent;
box-shadow: var(--nf-shadow);
}
.nf-stats b {
color: var(--nf-accent);
font-weight: 700;
}
.nf-stats {
padding: 4px 9px;
border-radius: 8px;
background: var(--nf-chrome);
position: absolute;
right: 10px;
bottom: calc(8px + var(--nf-bottom-inset, 0px));
font-size: 11.5px;
color: var(--nf-muted);
font-variant-numeric: tabular-nums;
pointer-events: none;
}
.nf-error {
position: absolute;
inset: auto 16px 16px;
color: var(--nf-danger);
}
`]};customElements.get("nf-view3d")||customElements.define("nf-view3d",To);function ce(r,e){return Math.abs(e)>=1e3?`${W(r,e/1e3,1)} kW`:`${Math.round(e)} W`}function zo(r){return r.type==="tv_board"?r.h+.9:r.type==="tv_wall"||r.type==="kitchen_wall"?r.h+.25:r.h+.35}function pf(r,e){let t=e.attributes.percentage;return e.state==="on"&&typeof t=="number"?`${Math.round(t)} %`:ie(r,e)}var hu;function mu(){let r=new URL("./nextfloor-editor.js?v=4fd9c94342a9",new URL(import.meta.url)).href;return hu??=import(r),hu}var ff=.25,pu=r=>Math.round(r*1e3)/1e3,fu=(r,e,t)=>r.rooms.find(n=>n.points.length>=3&&P([e,t],n.points));function Fo(r,e,t,n,i){let o=fu(r,e,t);if(!o)return[n,i];let s=(a,l)=>P([a,l],o.points);return s(n,i)?[n,i]:s(n,t)?[n,t]:s(e,i)?[e,i]:[e,t]}function gf(r,e,t,n){return r.rooms.some(i=>i.id!==e.id&&i.points.some((o,s)=>{let a=i.points[(s+1)%i.points.length];return Math.abs(ae(J(o,t),n))<.02&&Math.abs(ae(J(a,t),n))<.02}))}var Do=(r,e)=>Math.abs((r-e+540)%360-180);function gu(r,e,t,n=ff){let i=fu(r,e.x,e.z);if(!i)return null;let o=i.points,s=lt(o)>=0?1:-1,a=null;return o.forEach((l,c)=>{let u=o[(c+1)%o.length],d=Ce(J(u,l));if(d<.3)return;let m=[(u[0]-l[0])/d,(u[1]-l[1])/d],h=[-m[1]*s,m[0]*s],g=ae(J([e.x,e.z],l),m);if(g<0||g>d)return;let _=gf(r,i,l,h)?t/2:0,b=ae(J([e.x,e.z],l),h)-_,v=Math.atan2(-h[0],h[1])*180/Math.PI,S=[{rotation:v,extent:e.d/2},{rotation:v+90,extent:e.w/2},{rotation:v-90,extent:e.w/2}].reduce((T,z)=>Do(e.rotation,z.rotation)50)return;let M=b-S.extent;Math.abs(M)>n||a&&Math.abs(M)>=Math.abs(a.gap)||(a={x:pu(e.x-h[0]*M),z:pu(e.z-h[1]*M),rotation:(Math.round(S.rotation)%360+360)%360,gap:M})}),a&&{x:a.x,z:a.z,rotation:a.rotation}}function Kr(r,e,t){let n=structuredClone(r);for(let i of n.floors){let o=i.furniture.find(s=>s.id===e);o&&t(o,i)}return n}function Gr(r,e,t){let n=structuredClone(r);for(let i of n.floors){let o=i.placements.find(s=>s.entity_id===e);o&&t(o,i)}return n}function _u(r,e){let t=structuredClone(r);for(let n of t.floors)n.furniture=n.furniture.filter(i=>i.id!==e);return t}function bu(r,e){let t=structuredClone(r);for(let n of t.floors)n.placements=n.placements.filter(i=>i.entity_id!==e);return t}function vu(r,e,t,n){return Gr(r,e,(i,o)=>{[i.x,i.z]=Fo(o,i.x,i.z,t,n)})}function wu(r,e,t,n){let i=r.settings.wall_interior??.12;return Kr(r,e,(o,s)=>{[o.x,o.z]=Fo(s,o.x,o.z,t,n);let a=gu(s,o,i);a&&Object.assign(o,a)})}var Ho=(r,e)=>((r+e)%360+360)%360,yu=r=>Number.parseFloat(r.replace(",",".")),Tn=(r,e)=>Math.round(r*10**e)/10**e;function Po(r){let{min:e,max:t,accepts:n=()=>!0}=r,i=o=>{let s=yu(o.target.value);!Number.isFinite(s)||!n(s)||r.apply(t===void 0?s:Math.min(t,Math.max(e,s)))};return p``}var ku=(r,e)=>p``,xu=(r,e)=>p``;function _f(r,e){let t=r.building.floors.find(s=>s.furniture.some(a=>a.id===e)),n=t?.furniture.find(s=>s.id===e);if(!t||!n)return f;let i=(s,a)=>Po({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]=Tn(l,3))}),o=Ps(n)?p`${Po({label:"\u2195",title:r.t("mount_height"),value:n.mount_y??de(t,n),step:.05,min:0,accepts:s=>s>=0,apply:s=>r.editFurniture(e,a=>a.mount_y=Tn(s,3))})}
${n.mount_y!=null?ku(r,()=>r.editFurniture(e,s=>s.mount_y=null)):f}`:f;return p`${i("w","size_short_w")}${i("d","size_short_d")}${i("h","size_short_h")} ${o}`}function bf(r,e){let t=r.building.floors.find(l=>l.placements.some(c=>c.entity_id===e)),n=t?.placements.find(l=>l.entity_id===e);if(!t||!n)return f;let i=F(e),o=(l,c,u)=>p``,s=["ceiling","floor","table","wall"].map(l=>[l,r.t(`lamp_${l}`)]),a=i?Mt(i,_e(t,n.x,n.z),i==="light"?n.mount??"ceiling":null):1;return p`${i==="light"?o("lamp_mount",s,n.mount??"ceiling"):f}
${Po({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=Tn(l,3))})}
${n.y!==null?ku(r,()=>r.editDevice(e,l=>l.y=null)):f}`}function Su(r,e,t){let n=r.t,i;if(e){let o=r.building.floors.flatMap(s=>s.furniture).find(s=>s.id===e)?.type;i=p`${o?fe(r.hass,o):""}
${_f(r,e)} ${xu(45,s=>r.turnFurniture(e,s))}
`}else t?i=p`${L(r.hass,t)}
${bf(r,t)} ${xu(45,o=>r.turnDevice(t,o))}
`:i=p`${n("furnish_hint")}`;return p`${i}
`}var $u=te``;var ue=(r,e)=>({name:r,fallback:e,read:t=>e?t!=="0":t==="1",write:t=>t?"1":"0"}),Ot=(r,e,t)=>({name:r,fallback:t,read:n=>e.find(i=>i===n)??t,write:n=>n}),Io={explode:ue("explode",!0),keepRoof:ue("roof",!1),solidWalls:ue("solid_walls",!1),quality:Ot("quality",["auto","low","high"],"auto"),stats:ue("stats",!1),markers:Ot("markers",["none","important","all"],"important"),heat:Ot("heat",["none","temperature","humidity","co2","mould","comfort","power","sun","values","wifi"],"none"),theme:Ot("theme",zr,"neon"),clock:Ot("clock",["none","top_left","top_right","bottom_left","bottom_right"],"none"),accent:{name:"accent",fallback:null,read:r=>/^#[0-9a-f]{6}$/i.test(r)?r:null,write:r=>r??""},floorStack:Ot("floor_stack",["dim","stacked","single"],"dim"),roomNames:ue("room_names",!0),clean:ue("clean",!1),navWrap:ue("nav_wrap",!1),weather:ue("weather",!0),timeSlider:ue("time_slider",!1),menuOpen:ue("menu_open",!1),keepCamera:ue("keep_camera",!1),readable:ue("readable",!1),plain:ue("plain",!1),rightBack:ue("right_back",!1),zoom:{name:"zoom",fallback:100,read:r=>/^\d{2,3}$/.test(r)?Math.min(250,Math.max(60,Number(r))):100,write:r=>String(Math.round(Math.min(250,Math.max(60,r))))},screenName:{name:"screen_name",fallback:"",read:r=>r.slice(0,60),write:r=>r.trim().slice(0,60)},announceMuted:ue("announce_muted",!1),glassWalls:{name:"glass_walls",fallback:20,read:r=>/^\d{1,3}$/.test(r)?Math.min(100,Number(r)):20,write:r=>String(Math.round(Math.min(100,Math.max(0,r))))}};function Mu(r=jr()){try{return r?.getItem("nextfloor.screen_name")?.trim()||null}catch{return null}}function Au(r=jr()){try{return r?.getItem("nextfloor.announce_muted")==="1"}catch{return!1}}function jr(){try{return localStorage}catch{return null}}var Ur=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(Io)){let i=Io[n],o=this.raw(i.name);t[n]=o===null?i.fallback:i.read(o)}return new URLSearchParams(e).has("nf_stats")&&(t.stats=!0),t}save(e,t){let n=Io[e];try{this.storage?.setItem(`nextfloor.${n.name}`,n.write(t))}catch{}}};var Eu=Q`
.nf-dot {
display: inline-block;
width: 8px;
height: 8px;
margin-left: 6px;
border-radius: 50%;
background: #ffb547;
box-shadow: 0 0 8px #ffb547;
vertical-align: middle;
}
:host {
display: block;
/* HA gives the custom panel's parent no explicit height, so 100% collapses. */
height: 100vh;
height: 100dvh;
background: var(--nf-bg);
}
.nf-app {
display: flex;
flex-direction: column;
height: 100%;
min-height: 0;
}
.nf-header {
display: flex;
align-items: center;
gap: 12px;
padding: 6px 14px 6px 4px;
min-height: 56px;
border-bottom: var(--app-header-border-bottom, 1px solid var(--nf-line));
background: var(--app-header-background-color, var(--nf-chrome-solid));
color: var(--app-header-text-color, var(--nf-text));
flex-wrap: wrap;
/* above the room bar, so a menu opened from the header (the screen's announcements) is not covered */
position: relative;
z-index: 30;
}
ha-menu-button {
color: var(--app-header-text-color, var(--nf-text));
}
h1 {
display: flex;
align-items: center;
gap: 10px;
font-weight: 400;
font-size: 20px;
margin: 0 4px 0 8px;
white-space: nowrap;
}
.nf-mark {
flex: none;
width: 26px;
height: 28px;
color: var(--nf-accent);
}
.nf-view-title {
min-width: 0;
max-width: min(340px, 45vw);
overflow: hidden;
text-overflow: ellipsis;
}
.nf-notices {
display: grid;
gap: 6px;
padding: 8px 14px 0;
}
.nf-notice {
display: flex;
flex-wrap: wrap;
align-items: center;
gap: 8px 12px;
padding: 9px 12px;
border-radius: 10px;
border: 1px solid var(--nf-line);
background: var(--nf-chrome-solid);
font-size: 13.5px;
}
.nf-notice span {
flex: 1;
min-width: 200px;
}
.nf-notice-warn {
border-color: color-mix(in srgb, var(--nf-warm) 60%, transparent);
color: var(--nf-warm);
}
.nf-notice-error {
border-color: color-mix(in srgb, var(--nf-danger) 60%, transparent);
color: var(--nf-danger);
word-break: break-word;
}
.nf-chip-on {
background: var(--nf-accent);
color: var(--nf-accent-text);
}
.nf-furnish-bar {
position: absolute;
left: 50%;
bottom: 16px;
transform: translateX(-50%);
display: flex;
flex-wrap: wrap;
align-items: center;
justify-content: center;
gap: 8px;
max-width: calc(100% - 24px);
padding: 8px 10px 8px 16px;
border-radius: 999px;
background: var(--nf-chrome);
box-shadow: var(--nf-shadow);
font-size: 13.5px;
}
.nf-size-select {
font: inherit;
color: var(--nf-text);
background: var(--nf-chrome-solid);
border: 1px solid var(--nf-line);
border-radius: 999px;
padding: 4px 10px;
}
.nf-size {
display: inline-flex;
align-items: center;
gap: 4px;
font-size: 12px;
color: var(--nf-muted);
}
.nf-size input {
width: 58px;
padding: 5px 6px;
border: 1px solid rgba(127, 127, 127, 0.35);
border-radius: 8px;
background: transparent;
color: inherit;
font: inherit;
font-size: 13px;
}
.nf-danger-chip {
color: var(--nf-danger);
}
.nf-grow {
flex: 1;
}
.nf-save {
font-size: 12.5px;
color: var(--nf-muted);
}
.nf-view-opts {
display: contents;
}
.nf-opts-btn {
display: none;
}
/* phones: the view options fold behind ⚙ (one header row instead of three) */
@media (max-width: 700px) {
.nf-opts-btn {
display: grid;
place-items: center;
order: 3;
width: 36px;
height: 36px;
border: 1px solid var(--nf-line);
border-radius: 10px;
background: transparent;
color: var(--nf-text);
font-size: 17px;
cursor: pointer;
}
.nf-opts-btn[aria-expanded="true"] {
color: var(--nf-accent);
border-color: var(--nf-accent);
}
.nf-view-opts {
display: none;
}
.nf-view-opts.nf-opts-open {
display: flex;
flex-wrap: wrap;
gap: 8px;
order: 5;
width: 100%;
}
.nf-version {
order: 4;
}
.nf-header .nf-grow {
display: none;
}
}
/* the installed version, at the far right of the header */
.nf-version {
margin-left: auto;
font-size: 11.5px;
color: var(--nf-muted);
white-space: nowrap;
opacity: 0.8;
}
.nf-save-error {
color: var(--nf-danger);
}
.nf-body {
flex: 1;
min-height: 0;
}
/* the colour well beside the look: a small round swatch, the reset arrow next to it */
.nf-accent-pick {
display: inline-flex;
align-items: center;
gap: 2px;
padding: 0 4px;
}
.nf-clock-pick {
display: inline-flex;
align-items: center;
gap: 2px;
padding: 0 4px 0 10px;
font-size: 14px;
}
.nf-clock-pick select {
border: 0;
background: none;
color: var(--nf-text);
font: inherit;
font-size: 13px;
padding: 6px 2px;
cursor: pointer;
}
.nf-clock-pick option {
color: #111;
}
.nf-glass-pick {
display: inline-flex;
align-items: center;
gap: 6px;
padding: 0 10px;
font-size: 13px;
}
.nf-glass-pick input {
width: 80px;
accent-color: var(--nf-accent);
}
.nf-screen-pick {
position: relative;
display: inline-flex;
align-items: center;
}
.nf-screen-pick > summary {
list-style: none;
cursor: pointer;
padding: 6px 10px;
font-size: 14px;
}
.nf-screen-pick > summary::-webkit-details-marker {
display: none;
}
.nf-screen-menu {
position: absolute;
top: calc(100% + 6px);
right: 0;
z-index: 20;
display: grid;
gap: 10px;
width: 260px;
padding: 12px;
border: 1px solid var(--nf-line);
border-radius: 14px;
background: var(--nf-chrome-solid);
box-shadow: 0 12px 32px rgba(0, 0, 0, 0.35);
}
.nf-screen-menu .nf-check {
display: flex;
align-items: center;
gap: 8px;
font-size: 14px;
color: var(--nf-text);
}
.nf-screen-hint {
margin: 0;
font-size: 12px;
color: var(--nf-muted);
}
.nf-accent-pick input[type="color"] {
width: 22px;
height: 22px;
padding: 0;
border: 1px solid var(--nf-line);
border-radius: 50%;
background: none;
cursor: pointer;
}
.nf-accent-pick input[type="color"]::-webkit-color-swatch-wrapper {
padding: 2px;
}
.nf-accent-pick input[type="color"]::-webkit-color-swatch {
border: none;
border-radius: 50%;
}
.nf-accent-reset {
border: none;
background: none;
color: var(--nf-muted);
cursor: pointer;
font-size: 14px;
padding: 0 2px;
}
.nf-nav {
display: flex;
align-items: center;
gap: 6px;
padding: 10px 14px;
overflow-x: auto;
scrollbar-width: none;
flex: none;
}
/* a desktop shows a thin scrollbar while the pointer rests on the bar */
.nf-nav:hover {
scrollbar-width: thin;
}
/* wrapped: several lines, at most about three before the bar itself scrolls */
.nf-nav-wrap {
flex-wrap: wrap;
overflow-x: visible;
overflow-y: auto;
max-height: 132px;
}
.nf-nav-floor {
flex: none;
font-size: 11px;
font-weight: 700;
letter-spacing: 0.04em;
text-transform: uppercase;
color: var(--nf-muted);
margin-left: 6px;
}
.nf-nav-toggle {
flex: none;
margin-left: auto;
position: sticky;
right: 0;
min-width: 34px;
padding-left: 8px;
padding-right: 8px;
}
.nf-nav .nf-chip {
box-shadow: none;
border: 1px solid var(--nf-line);
}
.nf-sep {
flex: none;
width: 1px;
margin: 4px 4px;
background: var(--nf-line);
}
.nf-stage-wrap {
position: relative;
flex: 1;
min-height: 0;
display: flex;
container-type: size;
container-name: nf;
}
.nf-stage-wrap nf-view3d {
flex: 1;
}
.nf-room-panel {
position: absolute;
top: 58px;
right: 14px;
bottom: 14px;
width: min(360px, calc(100% - 28px));
display: flex;
flex-direction: column;
justify-content: flex-start;
pointer-events: none;
}
/* folded, the panel is only its title bar: on a wide stage it drops to the bottom edge, above the switches, instead of hanging in the picture */
.nf-room-panel[folded] {
justify-content: flex-end;
bottom: 62px;
}
.nf-clean .nf-room-panel[folded] {
bottom: 14px;
}
/* the switches sit at the bottom (as in the card), where they never meet the energy values or warnings */
nf-view3d {
--nf-bottom-inset: 52px;
}
.nf-clean nf-view3d {
--nf-bottom-inset: 0px;
}
.nf-furnish-bar {
bottom: 68px;
}
/* small landscape tablets: the room panel gets a little more of the width, its rows stay easy to hit */
@container nf ((min-width: 701px) and (max-width: 1180px)) {
.nf-room-panel {
width: min(420px, 44%);
}
}
/* phones and portrait tablets: panel as a sheet at the bottom, the switches step aside */
@container nf ((max-width: 700px) or ((orientation: portrait) and (max-width: 1000px))) {
.nf-room-panel {
top: auto;
left: 8px;
right: 8px;
bottom: 8px;
width: auto;
height: 55%;
justify-content: flex-end;
}
.nf-room-open .nf-overlay {
display: none;
}
}
.nf-overlay {
position: absolute;
right: 12px;
bottom: 12px;
/* room for the search button and the row beside it (eye, lock, walk, time travel) */
left: 236px;
display: flex;
flex-wrap: wrap;
justify-content: flex-end;
gap: 8px;
align-items: center;
pointer-events: none;
}
.nf-overlay > * {
pointer-events: auto;
}
/* phones: the bar only holds the switches button and "back", so it can span the bottom; the buttons of the view sit above it */
@container nf (max-width: 700px) {
.nf-overlay {
left: 12px;
}
.nf-switches {
left: 0;
width: auto;
}
}
/* the switches: a menu that opens upwards from the bar, over the stage, closed by a tap beside it or Escape */
.nf-switches-veil {
position: fixed;
inset: 0;
z-index: 4;
}
.nf-switches {
position: absolute;
right: 0;
bottom: calc(100% + 8px);
z-index: 5;
display: flex;
flex-wrap: wrap;
align-items: center;
gap: 8px;
width: min(520px, calc(100cqw - 24px));
max-height: min(60vh, 420px);
overflow-y: auto;
overscroll-behavior: contain;
padding: 12px;
border: 1px solid var(--nf-line);
border-radius: 14px;
background: var(--nf-chrome-solid);
box-shadow: var(--nf-shadow);
}
.nf-switches .nf-seg {
flex-wrap: wrap;
}
.nf-switches .nf-chip {
box-shadow: none;
}
.nf-caret {
font-size: 0.75em;
opacity: 0.7;
}
.nf-quality button {
padding: 5px 11px;
min-height: 30px;
font-size: 13px;
}
.nf-message,
.nf-empty {
padding: 32px 20px;
color: var(--nf-muted);
text-align: center;
}
.nf-empty {
display: grid;
justify-items: center;
gap: 12px;
margin: auto;
}
`;var Ru=new WeakMap,zu=new WeakMap;function gt(r,e){let t=zu.get(r)??r,n=Ru.get(t)??new WeakMap;Ru.set(t,n);let i=n.get(e);if(i)return i;let o=new Map;for(let l of e)for(let c of l.placements)c.entity_id.startsWith("cover.")&&o.set(c.entity_id,{tilt:c.cover_tilt==="none"?null:c.cover_tilt,position:c.position});for(let l of De(t,e).values())l.cover&&!o.has(l.cover)&&o.set(l.cover,{tilt:l.coverTilt,position:l.position}),l.cover2&&!o.has(l.cover2)&&o.set(l.cover2,{tilt:l.cover2Tilt});let s={...t.states};for(let[l,c]of o){let u=t.states[l];if(!u)continue;let d={...u.attributes,nf_cover_control:!0},m=At(t,c.position);m===null&&(m=typeof u.attributes.current_position=="number"?u.attributes.current_position:null),m!==null&&(d.current_position=m);let h=c.tilt?t.states[c.tilt]:u,g=typeof h?.attributes.current_tilt_position=="number"?h.attributes.current_tilt_position:c.tilt?At(t,c.tilt):null;g!==null&&(d.current_tilt_position=g,d.supported_features=Number(d.supported_features??0)|128);let _=u.state;typeof d.current_position=="number"&&_!=="unavailable"&&_!=="unknown"&&_!=="opening"&&_!=="closing"&&(_=d.current_position>0?"open":"closed"),s[l]={...u,state:_,attributes:d}}let a={...t,states:s,callService:async(l,c,u={})=>{if(l!=="cover")return t.callService(l,c,u);let d=Array.isArray(u.entity_id)?u.entity_id:[u.entity_id],m=async h=>{let g=typeof h=="string"?o.get(h):void 0;if(!g)return t.callService(l,c,{...u,entity_id:h});let _={...u,entity_id:h},b=c;(b==="toggle"||b==="toggle_cover")&&(b=s[String(h)]?.state==="closed"?"open_cover":"close_cover");let v=b.includes("tilt");v&&g.tilt&&(_.entity_id=g.tilt);let k=g.tilt?t.states[g.tilt]:void 0;return v&&g.tilt&&!k?.attributes.symcon_id&&typeof k?.attributes.current_tilt_position!="number"&&(b==="set_cover_tilt_position"?(b="set_cover_position",_.position=_.tilt_position,delete _.tilt_position):b==="open_cover_tilt"?b="open_cover":b==="close_cover_tilt"&&(b="close_cover")),t.callService(l,b,_)};return Array.isArray(u.entity_id)?Promise.all(d.map(m)):m(d[0])}};return zu.set(a,t),n.set(e,a),a}var Co=class extends X{static properties={hass:{attribute:!1},narrow:{type:Boolean},route:{attribute:!1},panel:{attribute:!1},_mode:{state:!0},_editorReady:{state:!0},_floorId:{state:!0},_roomId:{state:!0},_wallMode:{state:!0},_prefs:{state:!0},_furnish:{state:!0},_selFurniture:{state:!0},_selDevice:{state:!0},_optsOpen:{state:!0},_switchesOpen:{state:!0},_timeOfDay:{state:!0},_outside:{state:!0},_timeDrag:{state:!0},_floorUndo:{state:!0},_variablesLoading:{state:!0},_variablesNotice:{state:!0},_variablesError:{state:!0}};outsideMemo=null;floorUndoTimer;data=new $t(this);store=new Ur(jr());constructor(){super(),this.narrow=!1,this._mode="view",this._editorReady=!!customElements.get("nf-editor"),this._floorId=null,this._roomId=null,this._wallMode="auto",this._prefs=this.store.load(location.search),this._furnish=!1,this._selFurniture=null,this._selDevice=null,this._optsOpen=!1,this._switchesOpen=!1,this._timeOfDay=null,this._outside=!1,this._timeDrag=null,this._floorUndo=null,this._variablesLoading=!1,this._variablesNotice="",this._variablesError=!1}toggleTimeSlider(e){this.setPref("timeSlider",e),e||([this._timeOfDay,this._timeDrag]=[null,null])}sunState(){let e=this.hass?.config;return this._timeOfDay===null||e?.latitude===void 0||e.longitude===void 0?this.hass?.states["sun.sun"]?.state:at(wt(this._timeOfDay,e.time_zone),e.latitude,e.longitude).elevation>0?"above_horizon":"below_horizon"}renderTimeOfDay(){let e=this.t;if(this.hass?.config?.latitude===void 0)return f;let t=this._timeDrag??this._timeOfDay,n=o=>`${String(Math.floor(o)).padStart(2,"0")}:${String(Math.round(o%1*60)).padStart(2,"0")}`,i=()=>{let o=new Date;return Math.round((o.getHours()+o.getMinutes()/60)*4)/4};return p`
${t!==null?p``:f}`}t=(e,t)=>A(this.hass,e,t);setPref(e,t){this._prefs={...this._prefs,[e]:t},this.store.save(e,t)}willUpdate(e){this.toggleAttribute("readable",!!this._prefs?.readable),e.has("hass")&&this.hass&&(this.style.colorScheme=br(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=rn(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=>Kr(n,e,t)),editDevice:(e,t)=>this.applyEdit(n=>Gr(n,e,t)),turnFurniture:(e,t)=>this.applyEdit(n=>Kr(n,e,i=>i.rotation=Ho(i.rotation,t))),turnDevice:(e,t)=>this.applyEdit(n=>Gr(n,e,i=>i.rotation=Ho(i.rotation??0,t))),removeFurniture:e=>{this.applyEdit(t=>_u(t,e)),this._selFurniture=null},removeDevice:e=>{this.applyEdit(t=>bu(t,e)),this._selDevice=null},finish:()=>{this._furnish=!1,this._selFurniture=null,this._selDevice=null}};saveMoods(e,t){this.applyEdit(n=>({...n,floors:n.floors.map(i=>({...i,rooms:i.rooms.map(o=>o.id===e?{...o,moods:t.length?t:void 0}:o)}))}))}applyEdit(e){let t=this.data.building;t&&this.data.edit(e(t))}view3d(){return this.renderRoot.querySelector("nf-view3d")}back(){this._outside?this._outside=!1:this._roomId?this._roomId=null:this._floorId&&(this.data.building?.floors.length??0)>1?this._floorId=null:this.view3d()?.resetView()}onKey=e=>{e.key!=="Escape"||this._mode!=="view"||(this._prefs.clean?this.setPref("clean",!1):this.back())};connectedCallback(){super.connectedCallback(),window.addEventListener("keydown",this.onKey)}disconnectedCallback(){super.disconnectedCallback(),window.removeEventListener("keydown",this.onKey)}render(){if(this.hass&&hr(this.hass,this))return f;let e=this.data.building,t=this._prefs.clean&&this._mode==="view",n=f;return e&&(this._mode==="editor"&&this.isAdmin?n=this.renderEditor(e):this._mode==="extensions"&&this.isAdmin?n=this.renderExtensions():n=this.renderView(e)),p`
${t?f:p`${this.renderHeader(e)}${this.renderNotices()}`}
${this.data.error&&!e?p`
${this.t("load_error")}: ${this.data.error}
`:f}
${!e&&!this.data.error?p`
${this.t("loading")}
`:f}
${n}
`}choiceRow(e,t,n,i,o,s=f){return p`
${t.map(a=>p``)}${s}
`}accentPicker(){let e=this._prefs.accent;return p``}renderViewOptions(){let e=this._prefs;return p`
${this.choiceRow("quality",["auto","low","high"],e.quality,t=>this.t(`quality_${t}`),t=>this.setPref("quality",t))}
${this.choiceRow("theme",zr,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))}
${U(this.hass)?f:p`
${e.announceMuted?"\u{1F507}":"\u{1F4E2}"}
`}
`}async reloadVariables(){if(!(this._variablesLoading||!this.hass.symconRefresh)){this._variablesLoading=!0,this._variablesNotice="",this._variablesError=!1;try{await this.hass.symconRefresh(),this._variablesNotice=this.t("symcon_variables_loaded")}catch(e){this._variablesError=!0,this._variablesNotice=this.t("symcon_variables_error",{error:e instanceof Error?e.message:String(e)})}finally{this._variablesLoading=!1}}}renderHeader(e){let t=this.hass?.symconTitle?.trim()||"NextFloor",n=this.data.saveState,i=(s,a,l="")=>p``,o=n==="saving"?"saving":n==="saved"?"saved":"save_error";return p``}renderNotices(){let e=this.data,t=[];if(this._variablesNotice&&t.push(p`${this._variablesNotice}
`),e.needsRestart&&t.push(e.versionGap==="frontend"?p`
${this.t("needs_reload",{frontend:e.frontendVersion,backend:e.backendVersion??"?"})}
`:p`${e.backendVersion?this.t("needs_restart",{version:e.backendVersion,frontend:e.frontendVersion}):this.t("needs_restart_old")}
`),e.saveState==="error"&&e.saveError&&t.push(p`${this.t("save_failed_detail",{error:e.saveError})}
`),e.draft&&this.isAdmin){let n=new Date(e.draft.savedAt).toLocaleString(this.hass?.language);t.push(p`
${this.t("draft_found",{time:n})}
`)}return t.length>0?p`${t}
`:f}whenEditorLoaded(e){return this._editorReady?e():(mu().then(()=>this._editorReady=!0,t=>this.data.error=String(t)),p``)}renderExtensions(){return this.whenEditorLoaded(()=>p`{this.data.reloadPacks()}}
@plugins-changed=${e=>this.applyEdit(t=>({...t,settings:{...t.settings,plugins:e.detail}}))}>`)}renderEditor(e){return this.whenEditorLoaded(()=>p`this.setPref("roomNames",t.detail.value)}
.packs=${this.data.packs}
.loadCardEditor=${Cn}
@packs-changed=${()=>{this.data.reloadPacks()}}
@building-changed=${t=>this.data.edit(t.detail.building)}
>`)}onNavWheel=e=>{if(this._prefs.navWrap||!e.deltaY||e.deltaX)return;let t=e.currentTarget;t.scrollWidth<=t.clientWidth||(t.scrollLeft+=e.deltaY,e.preventDefault())};allOffChip(e){let t=this._floorId?e.floors.find(i=>i.id===this._floorId):e.floors.length===1?e.floors[0]:void 0;if(!t||!this.hass)return f;if(this._floorUndo){let i=this._floorUndo;return p``}let n=fn(Il(t).map(i=>this.hass.states[i]));return n.count<2?f:p``}renderNav(e){let t=e.floors.filter(c=>!this._floorId||c.id===this._floorId),n=e.floors.length>1,i=this._prefs.navWrap,o=this.outsideIds(e).length?p``:f,s=n?p`
${[...e.floors].reverse().map(c=>p``)}
${o} ${this.allOffChip(e)}
`:p`${o} ${this.allOffChip(e)}`,a=t.flatMap(c=>[t.length>1&&c.rooms.length?p`${c.name}`:f,...c.rooms.map(u=>p``)]),l=this.t(i?"nav_row":"nav_wrap");return p``}toggleChip(e,t,n){return p``}renderOverlay(e){let t=this._prefs,n=this.t,i=(u,d)=>p`${[u,d].map(([m,h,g])=>p``)}
`,o=["none","temperature","humidity","co2","mould","comfort","power","sun","values","wifi"],s=["dim","stacked","single"],a=e.floors.length>1,l=this._roomId||this._floorId&&a?p``:f,c=p``;return this._switchesOpen?p`
this._switchesOpen=!1}>
u.key==="Escape"&&(this._switchesOpen=!1)}>
${["auto","cut","slope"].map(u=>p``)}
${a&&!this._floorId?i([t.explode,()=>this.setPref("explode",!0),n("floors_apart")],[!t.explode,()=>this.setPref("explode",!1),n("floors_stacked")]):f}
${!this._floorId&&e.settings.roof.type!=="none"?p`
`:f}
${a&&this._floorId?p`
${s.map(u=>p``)}
`:f}
${o.map(u=>p``)}
${this.toggleChip("roomNames","room_names_short")}
${this.toggleChip("weather","weather_short","weather_hint")}
${t.timeSlider?this.renderTimeOfDay():f}
${c}${l}
`:p`${c}${l}
`}renderView(e){if(!e.floors.some(i=>i.rooms.length))return p`
${this.t(this.isAdmin?e.floors.length?"no_rooms_admin":"no_building_admin":"no_building")}
${this.isAdmin?p`
`:f}
`;let t=this._prefs,n=e.floors.flatMap(i=>i.rooms).find(i=>i.id===this._roomId)??null;return this.furnishHost.hass=this.hass,this.furnishHost.building=e,p`
${t.clean?f:this.renderNav(e)}
this.setPref("clean",!t.clean)}
?weather=${t.weather}
.panelOpen=${!!this._roomId||this._outside}
.floorId=${e.floors.length>1?this._floorId:e.floors[0]?.id??null}
.roomId=${this._roomId}
.outsideOpen=${this._outside}
.wallMode=${this._wallMode}
.solidWalls=${t.solidWalls}
.explode=${t.explode}
.keepRoof=${t.keepRoof}
.markerMode=${t.markers}
.heatMode=${t.heat}
.theme=${Tr(t.theme,this.sunState())}
.timeOfDay=${this._timeOfDay}
.clock=${t.clock==="none"?null:t.clock}
.announcements=${!U(this.hass)&&!t.announceMuted}
.glassWalls=${t.glassWalls}
.screenName=${t.screenName||null}
.lockButton=${!0}
.walkButton=${!0}
.travelButton=${!0}
.accent=${t.accent}
.centralOpen=${t.menuOpen}
.keepCamera=${t.keepCamera}
.plain=${t.plain}
.rightBack=${t.rightBack}
.readable=${t.readable}
.zoom=${t.zoom/100}
?furnish=${this._furnish}
.selectedFurniture=${this._selFurniture}
@furniture-select=${i=>this._selFurniture=i.detail.id}
@furniture-move=${i=>this.applyEdit(o=>wu(o,i.detail.id,i.detail.x,i.detail.z))}
@device-select=${i=>this._selDevice=i.detail.id}
@device-move=${i=>this.applyEdit(o=>vu(o,i.detail.id,i.detail.x,i.detail.z))}
.quality=${t.quality}
?showStats=${t.stats}
@room-tap=${this.onRoomTap}
@floor-tap=${i=>this.openFloor(i.detail.floorId)}
@back=${()=>this.back()}
>
${n?p`i.rooms.some(o=>o.id===this._roomId))??null}
.confirmEntities=${dt(this.hass,e.floors)}
.phrases=${e.settings.announce_phrases??null}
.rooms=${e.floors.flatMap(i=>i.rooms)}
@mood-change=${i=>this.saveMoods(i.detail.roomId,i.detail.moods)}
@close=${()=>this._roomId=null}
>`:this._outside?p`this._outside=!1}
>`:f}
${t.clean?f:this.renderOverlay(e)}
${this._furnish?Su(this.furnishHost,this._selFurniture,this._selDevice):f}
`}static styles=[pe,Ae,Eu,_r]};customElements.get("nextfloor-panel")||customElements.define("nextfloor-panel",Co);var vf=/^(\d{1,2}):(\d{2})\s*-\s*(\d{1,2}):(\d{2})$/,Tu=(r,e)=>Number(r)*60+Number(e);function Dn(r,e,t=new Date){if(!r||r==="off")return!1;if(r==="sun")return e?.states["sun.sun"]?.state==="below_horizon";let n=vf.exec(r.trim());if(!n)return!1;let i=Tu(n[1],n[2]),o=Tu(n[3],n[4]),s=t.getHours()*60+t.getMinutes();return i>o?s>=i||s=i&&s0&&(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(Dn(this.host.config()?.night,this.host.hass())),6e4)}stop(){clearTimeout(this.cleanTimer),clearTimeout(this.idleTimer),clearInterval(this.nightTimer)}};function Du(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 Fu=Q`
ha-card {
overflow: hidden;
background: var(--nf-bg);
height: 100%;
}
/* night (kiosk): the whole card dimmed */
ha-card.nf-night .nf-card-body {
filter: brightness(0.55);
}
.nf-card-body {
position: relative;
display: flex;
height: 100%;
container-type: size;
container-name: nf;
}
nf-view3d {
flex: 1;
}
.nf-card-msg {
margin: auto;
color: var(--nf-muted);
padding: 16px;
text-align: center;
}
/* the room buttons: a row along the top, clear of the toggles at the left and the corner buttons at the right */
.nf-card-rooms {
position: absolute;
top: 8px;
left: 56px;
right: 56px;
z-index: 3;
display: flex;
align-items: center;
gap: 6px;
overflow-x: auto;
padding-bottom: 2px;
scrollbar-width: none;
}
/* with the room's side panel open the row ends where the panel starts */
@container nf (min-width: 700px) {
.nf-card-rooms-beside {
right: 372px;
}
}
.nf-card-rooms::-webkit-scrollbar {
display: none;
}
.nf-card-rooms button {
flex: none;
}
.nf-card-rooms-floor {
flex: none;
color: var(--nf-soft);
font-size: 11px;
text-transform: uppercase;
letter-spacing: 0.05em;
margin-left: 6px;
}
.nf-card-controls {
position: absolute;
left: 60px;
right: 10px;
bottom: 10px;
display: flex;
flex-wrap: wrap;
justify-content: center;
gap: 8px;
pointer-events: none;
}
.nf-card-controls > * {
pointer-events: auto;
}
.nf-card-full {
position: absolute;
right: 10px;
top: 10px;
width: 38px;
height: 38px;
border: 0;
border-radius: 12px;
background: var(--nf-chrome);
color: var(--nf-text);
box-shadow: var(--nf-shadow);
font-size: 18px;
cursor: pointer;
}
.nf-card-dash {
width: auto;
min-width: 38px;
padding: 0 12px;
font-size: 14px;
font-weight: 600;
}
.nf-card-dash-2 {
right: 56px;
}
.nf-card-panel {
position: absolute;
top: 10px;
right: 10px;
bottom: 10px;
width: min(340px, calc(100% - 20px));
display: flex;
flex-direction: column;
pointer-events: none;
}
/* folded, only the title bar is left: it drops to the bottom edge instead of hanging in the picture */
.nf-card-panel[folded] {
justify-content: flex-end;
}
/* phones and portrait tablets: the room panel becomes a sheet at the bottom */
@container nf ((max-width: 700px) or ((orientation: portrait) and (max-width: 1000px))) {
.nf-card-panel {
top: auto;
left: 8px;
right: 8px;
bottom: 8px;
width: auto;
height: 55%;
justify-content: flex-end;
}
}
`;function No(r,e){let t=r.template,n=t?e?.[t]:void 0;if(!n)return r;let{type:i,template:o,...s}=n;return{...s,...r}}function Hu(r,e){let t=new Set(e),n=[];for(let o of r.floors){let s=o.rooms.filter(c=>t.has(c.id));if(!s.length)continue;let a=(c,u)=>s.some(d=>d.points.length>=3&&P([c,u],d.points)),l=new Set(s.map(c=>c.id));n.push({...o,rooms:s,openings:o.openings.filter(c=>l.has(c.room_id)),furniture:o.furniture.filter(c=>a(c.x,c.z)),placements:o.placements.filter(c=>a(c.x,c.z)),walls:(o.walls??[]).filter(c=>a((c.a[0]+c.b[0])/2,(c.a[1]+c.b[1])/2)),outdoor:[]})}let i={...r.settings.roof,type:"none",sections:[],solar:[]};return{...r,floors:n,settings:{...r.settings,roof:i}}}var Bt="nf-outside",Wo=class extends X{static properties={hass:{attribute:!1},_config:{state:!0},_roomId:{state:!0},_floorId:{state:!0},_walls:{state:!0},_heat:{state:!0},_explode:{state:!0},_fullscreen:{state:!0},_clean:{state:!0},_night:{state:!0},_orbit:{state:!0},_roomNames:{state:!0}};_own=null;templatesSeen;roomApplied=!1;data=new $t(this);kiosk=new qr({config:()=>this._config,hass:()=>this.hass,setClean:e=>this._clean=e,isClean:()=>this._clean,setOrbit:e=>this._orbit=e,isOrbit:()=>this._orbit,setNight:e=>this._night=e,goHome:()=>this.returnHome()});constructor(){super(),this._roomId=null,this._floorId=void 0,this._walls=null,this._heat=null,this._explode=null,this._fullscreen=!1,this._clean=!1,this._night=!1,this._orbit=!1,this._roomNames=null}view3d(){return this.shadowRoot?.querySelector("nf-view3d")}returnHome(){this._roomId=this._config?.room??null,this._floorId=void 0,this.view3d()?.resetView(),this._config?.idle_orbit&&(this._orbit=!0)}openDashboard(e){history.pushState(null,"",e),window.dispatchEvent(new CustomEvent("location-changed",{bubbles:!0,composed:!0,detail:{replace:!1}}))}onFullscreen=()=>this._fullscreen=!!document.fullscreenElement&&this.shadowRoot?.contains(document.fullscreenElement)===!0;connectedCallback(){super.connectedCallback(),document.addEventListener("fullscreenchange",this.onFullscreen),this.kiosk.start()}disconnectedCallback(){super.disconnectedCallback(),document.removeEventListener("fullscreenchange",this.onFullscreen),this.kiosk.stop()}toggleFullscreen(){document.fullscreenElement?document.exitFullscreen():this.shadowRoot?.querySelector("ha-card")?.requestFullscreen?.()}static async getConfigElement(){return await Cn(),document.createElement("nextfloor-card-editor")}static getStubConfig(){return{type:"custom:nextfloor-card"}}setConfig(e){if(e.height!==void 0&&!(e.height>100))throw new Error("height must be a number of pixels above 100");this._roomNames=null,this._own=e,this._config=No(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=Dn(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=No(this._own,t)),this.toggleAttribute("readable",this._config?.readable===!0),e.has("hass")&&(this.style.colorScheme=br(this.hass)),!e.has("hass")||!this.hass)return;this.data.setHass(this.hass);let n=Dn(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:Hu(e,t)}),this.roomsMemo.result}t=e=>A(this.hass,e);stage(){let e=this.plan(),t=this._config,n=this._floorId===void 0?t?.floor??null:this._floorId,i=e&&e.floors.length===1?e.floors[0].id:e?.floors.some(a=>a.id===n)?n:null,o=!!this._roomId&&t?.room_panel!==!1,s=!!this._roomId&&t?.room_panel===!1||!this.thumbs&&this.canSwitch&&!this._roomId&&!!i&&(e?.floors.length??0)>1;return{floorId:i,walls:this._walls??t?.walls??"auto",heat:this._heat??t?.heatmap??"none",explode:this._explode??t?.explode??!0,canGoBack:s,showBar:!!e&&!this._clean&&(s||!!t?.controls&&!o)}}shows(e){let t=this._config?.controls;return t===!0||Array.isArray(t)&&t.includes(e)}renderBar(e){let t=this.plan(),n=this.t,i=["temperature","humidity","co2"].filter(s=>this.shows(s)),o=(s,a)=>p`${a.map(([l,c,u])=>p``)}
`;return p`
${e.canGoBack?p``:f}
${this.shows("walls")?o(void 0,[[e.walls==="auto",()=>this._walls="auto",n("walls_auto")],[e.walls==="cut",()=>this._walls="cut",n("walls_cut")],[e.walls==="slope",()=>this._walls="slope",n("walls_slope")]]):f}
${this.shows("floors")&&t.floors.length>1&&!e.floorId?o(void 0,[[e.explode,()=>this._explode=!0,n("floors_apart")],[!e.explode,()=>this._explode=!1,n("floors_stacked")]]):f}
${i.length>0?o(n("heatmap"),["none",...i].map(s=>[e.heat===s,()=>this._heat=s,n(s==="none"?"heat_off":`heat_short_${s}`)])):f}
`}renderRoomButtons(e){let t=this.plan();if(!this._config?.room_buttons||!t||this._clean)return f;let n=Du(t,e.floorId);if(!n.length)return f;let i=n.length>1,o=(l,c)=>{this.canSwitch&&l!==e.floorId&&(this._floorId=l),this._roomId=c===this._roomId?null:c},s=rn(this.hass,t.floors).length>0,a=()=>{this.canSwitch&&(this._floorId=null),this._roomId=this._roomId===Bt?null:Bt};return p`
${n.map(l=>p`${i?p`${l.floorName}`:f}${l.rooms.map(c=>p``)}`)}
${s?p``:f}
`}renderCorners(){let e=this._config,t=this.t,n=this._clean||!!this._roomId&&e?.room_panel!==!1;return p`${e?.fullscreen_button&&!n?p``:f}
${e?.dashboard&&!n?p``:f}`}renderStage(e){let t=this.plan(),n=this._config,i=()=>{this._clean=!this._clean,this._clean?this.kiosk.stopClean():this.kiosk.armClean()},o=n?.controls_hidden!==void 0||(n?.controls_hide_after??0)>0;return p`({id:`card_${a}`,...s}))??null}
.heatMode=${e.heat}
.theme=${Tr(n?.theme,this.hass?.states["sun.sun"]?.state)}
.clock=${n?.clock&&n.clock!=="none"?n.clock:null}
.lockButton=${n?.lock_button!==!1}
.walkButton=${n?.walk_button!==!1}
.travelButton=${n?.time_travel!==!1}
.accent=${n?.accent??null}
.furnitureColors=${n?.furniture_colors??null}
.showEnergy=${n?.energy??!0}
.flows=${n?.flows??null}
.holograms=${n?.holograms??null}
.floorThumbs=${this.thumbs}
.roomLabels=${this._roomNames??n?.room_names!==!1}
.roomNamesButton=${!0}
@room-names-change=${s=>this._roomNames=s.detail.value}
.floorStack=${n?.floor_stack??"dim"}
.panelOpen=${!!this._roomId&&n?.room_panel!==!1}
.alerts=${n?.alerts!==!1}
.alertJump=${!!n?.alert_jump}
.announcements=${!U(this.hass)&&n?.announcements!==!1&&!Au()}
.sensorBar=${n?.sensor_bar!==!1}
.glassWalls=${typeof n?.glass_walls=="number"?Math.min(100,Math.max(0,n.glass_walls)):null}
.screenName=${n?.screen_name??Mu()}
.scenes=${n?.scenes!==!1}
.clean=${this._clean}
.cleanButton=${o}
@clean-toggle=${i}
?weather=${n?.weather!==!1}
.weatherEntityId=${n?.weather_entity??null}
.weatherDensity=${n?.weather_density??1}
.dimmed=${this._night}
.autoOrbit=${this._orbit}
.startView=${n?.start_view??null}
style=${e.showBar?"--nf-bottom-inset: 52px":""}
@room-tap=${s=>{this.canSwitch&&t.floors.length>1&&s.detail.floorId&&e.floorId!==s.detail.floorId?(this._floorId=s.detail.floorId,this._roomId=null):s.detail.roomId&&(this._roomId=s.detail.roomId===this._roomId?null:s.detail.roomId)}}
@floor-tap=${s=>{this._floorId=s.detail.floorId,this._roomId=null}}
@back=${()=>this.back()}
>`}renderRoomPanel(){let e=this.plan();return p`t.rooms).find(t=>t.id===this._roomId)??null}
.floor=${e.floors.find(t=>t.rooms.some(n=>n.id===this._roomId))??null}
.outside=${this._roomId===Bt?rn(this.hass,e.floors):null}
.confirmEntities=${dt(this.hass,e.floors)}
.phrases=${e.settings.announce_phrases??null}
@close=${()=>this._roomId=null}
>`}render(){if(this.hass&&hr(this.hass,this))return f;let e=this.plan(),t=this._config;!this.roomApplied&&e&&t?.room&&(this.roomApplied=!0,e.floors.some(a=>a.rooms.some(l=>l.id===t.room))&&(this._roomId=t.room));let n=this.stage(),i=this._fullscreen?"100vh":t?.fill?"calc(100vh - var(--header-height, 56px) - 16px)":`${t?.height??420}px`,o=/^#[0-9a-f]{6}$/i.test(t?.accent??"")?t.accent:null,s=()=>this.kiosk.touched();return p`
${e&&e.floors.some(a=>a.rooms.length)?this.renderStage(n):p`
${this.data.error??(e?A(this.hass,"no_building"):A(this.hass,"loading"))}
`}
${this._roomId&&e&&t?.room_panel!==!1?this.renderRoomPanel():f}
${this.renderRoomButtons(n)}
${n.showBar&&e?this.renderBar(n):f}
${this.renderCorners()}
`}static styles=[pe,Ae,Fu,_r]};if(!customElements.get("nextfloor-card")){customElements.define("nextfloor-card",Wo);let r=window;r.customCards=r.customCards??[],r.customCards.push({type:"nextfloor-card",name:A(void 0,"card_name"),description:A(void 0,"card_description"),preview:!1})}mi();
/*! Bundled license information:
@lit/reactive-element/css-tag.js:
(**
* @license
* Copyright 2019 Google LLC
* SPDX-License-Identifier: BSD-3-Clause
*)
@lit/reactive-element/reactive-element.js:
lit-html/lit-html.js:
lit-element/lit-element.js:
(**
* @license
* Copyright 2017 Google LLC
* SPDX-License-Identifier: BSD-3-Clause
*)
lit-html/is-server.js:
(**
* @license
* Copyright 2022 Google LLC
* SPDX-License-Identifier: BSD-3-Clause
*)
*/