`${a}:${l.map(u=>u.toFixed(2)).join(",")}`).join(";"):"";s!==this.tintSig&&(this.tintSig=s,e.setRoomTint(i))}furnitureMarkers(e,t,r,i){let o=[],s=[],a=new Map,l=new Map,u=Dn(t);for(let h of t.floors)if(!(h.layer&&this.hiddenLayers.has(h.id)))for(let p of h.furniture){if(!Qe(e,p))continue;let g=this.furnitureLinks.get(p.id),_=this.stateFaces(e,p);_.length&&a.set(p.id,{color:_[0].color,level:_[0].level,faces:_});let b=fr(p.type);if(b&&p.care_entity){let D=this.careMarker(e,h,p,b,p.care_entity);D&&(o.push(D.marker),D.glow&&a.set(p.id,{color:D.glow,level:.9,faces:[{part:"all",color:D.glow,level:.9}]}),l.set(p.id,p.care_entity));continue}let y=X(p.type);if(p.cover_entity&&mr(y)&&l.set(p.id,p.cover_entity),y?.gangs){for(let v of(p.gang_entities??[]).slice(0,y.gangs)){let w=v&&v!=="none"?$e(e,v):null,K=w?Z(e.states[w]):null;w&&K!==null&&!i.has(w)&&(i.add(w),s.push({id:v,powerEntity:w,floorId:h.id,x:p.x,z:p.z,power:Math.max(0,K)}))}let D=il(e,(p.gang_entities??[]).slice(0,y.gangs),/socket/.test(p.type));D.length&&a.set(p.id,{color:D[0].color,level:D[0].level,gangs:D}),po(p.gang_entities,y.gangs).length&&l.set(p.id,`gang:${p.id}`);continue}if($r(p.type)){let D=this.lampMarker(e,h,p,g?.entity??null),v=g?.power?Z(e.states[g.power]):null;if(g?.power&&v!==null&&(v>=1&&(D.text=D.text?`${D.text} \xB7 ${Et(e,v)}`:Et(e,v)),i.has(g.power)||(i.add(g.power),s.push({id:D.id,powerEntity:g.power,floorId:h.id,x:p.x,z:p.z,power:Math.max(0,v)}))),o.push(D),p.type==="ceiling_fan"){let w=g?.fan?e.states[g.fan]:void 0;D.spin=Qc(w),w&&!r.has(w.entity_id)&&(r.add(w.entity_id),o.push({...D,id:w.entity_id,y:Math.max(.5,D.y-.3),icon:p.icon?Le(p.icon):qt("fan"),name:p.name||L(e,w.entity_id),text:vg(e,w),active:te(w),unavailable:I(w),glow:null,lamp:null,spin:void 0,pickable:void 0,effect:void 0}))}continue}let S=lo(p.type)?qa(e,p,D=>`${N(e,ce(e,D),1)} ${re(e)}`):null,$=lo(p.type)?null:Ya(e,p.temp_entity),A=$===null?"":`\u{1F321} ${N(e,ce(e,$),1)} ${re(e)}`,z=p.type==="home_battery"?p.soc:p.type==="wallbox"?p.status:S?p.temp_entity&&p.temp_entity!=="none"?p.temp_entity:p.temp_entity2:$!==null?p.temp_entity:null,k=z&&z!=="none"?z:(p.values??[]).find(D=>D.entity&&D.entity!=="none")?.entity??null,F=g??(k?{entity:null,power:null}:void 0);if(!F)continue;let T=p.type==="home_battery"?k??F.entity??F.power:F.entity??F.power??k;l.set(p.id,T);let E=F.entity?e.states[F.entity]:void 0,R=u.has(p.id),C=R?!!p.meter_invert:p.type==="meter"?t.energy.grid_invert&&!p.export:p.type==="home_battery"?t.energy.battery_invert&&!p.charge:!1,O=F.power?Z(e.states[F.power],C):null,B=p.type==="home_battery"&&p.charge&&p.charge!=="none"?p.charge:p.type==="meter"&&!R&&p.export&&p.export!=="none"?p.export:null,U=B?Z(e.states[B]):null;U!==null&&(O=Math.max(0,O??0)-Math.max(0,U)),F.power&&O!==null&&!i.has(F.power)&&(i.add(F.power),s.push({id:T,powerEntity:F.power,floorId:h.id,x:p.x,z:p.z,power:Math.max(0,O),wallbox:p.type==="wallbox"||void 0}));let q=(O??0)>10||E?.state==="on"||E?.state==="running"||Rr(E)&&te(E);if((p.type==="radiator"||y)&&E&&P(E.entity_id)==="climate"){let D=E.attributes;if(D.hvac_action==="heating"){let v=typeof D.temperature=="number"&&typeof D.current_temperature=="number"?D.temperature-D.current_temperature:1,w=!!y&&!y.parts.some(K=>K.screen);a.set(p.id,{color:[1,.42,.1],level:Math.min(1,.45+.25*Math.max(0,v)),heat:w||void 0})}}else(p.type==="washer"||p.type==="dryer"||p.type==="dishwasher")&&q?a.set(p.id,{color:[.3,.85,1],level:.8}):y&&q&&!y.light&&y.parts.some(D=>D.glow||D.screen)&&a.set(p.id,{color:[.3,.85,1],level:.8,leds:!0});if(ss(p.type)){let D=os(e,F.entity??F.power);if(D&&D.progress!==null&&(D.printing||/pause/.test(D.status))){let v=D.filaments[0]??"#38bdf8",w=[1,3,5].map(K=>parseInt(v.slice(K,K+2),16)/255);a.set(p.id,{color:w,level:.9,print:Math.max(.02,D.progress/100)})}}if(p.type==="home_battery"&&k){let D=Number(e.states[k]?.state);Number.isFinite(D)&&a.set(p.id,{color:D>60?[.29,.87,.5]:D>25?[.98,.8,.08]:[.97,.44,.44],level:.95,fill:D/100})}if(E&&Hr(p.type)){let D=P(E.entity_id)==="light"?je(E):null,v=P(E.entity_id)==="media"&&["playing","on","paused","idle"].includes(E.state),w=D?D.color:te(E)||v?[.22,.88,1]:null;w&&a.set(p.id,{color:w,level:E.state==="playing"?1:.6,halo:p.ambilight??1})}if(r.has(T))continue;r.add(T);let ie=F.entity?P(F.entity):null,fe=h.rooms.find(D=>D.points.length>=3&&H([p.x,p.z],D.points));o.push({id:T,floorId:h.id,roomId:fe?.id??null,x:p.x,z:p.z,y:gs(p)+oe(h,p),icon:p.icon?Le(p.icon):qt(ie??"switch"),name:p.name||(F.entity?L(e,F.entity):ae(e,p.type)),ownName:p.name||void 0,showName:!!p.show_name,text:[S?S.text:p.type==="home_battery"?this.batteryText(e,k,O):p.type==="wallbox"?this.wallboxText(e,k,O):p.type==="meter"?R?O===null?"":pe(e,O):this.meterText(e,O):E&&(p.type==="washer"||p.type==="dryer"||p.type==="dishwasher")&&q&&fo(e,Rn(e,F.entity??F.power))!==null?M(e,"care_time_left",{time:al(fo(e,Rn(e,F.entity??F.power)))}):E?[se(e,E),O!==null&&O>5&&!Rr(E)?pe(e,O):""].filter(Boolean).join(" \xB7 "):O!==null?pe(e,Math.max(0,O)):"",A,En(e,p.values)].filter(Boolean).join(" \xB7 "),active:S?.warm||$!==null&&$>=Za||(E?te(E):(O??0)>5),unavailable:E?I(E):!1,glow:null,furnitureId:p.id,energyDevice:p.type==="inverter"||p.type==="home_battery"||p.type==="wallbox"||p.type==="meter",readout:!!S||!!p.values?.some(D=>D.entity&&D.entity!=="none")||void 0,show:p.marker??void 0,fromFurniture:!0})}let c=this.heatMode==="wifi";for(let h of o){let p=h.furnitureId?t.floors.flatMap(_=>_.furniture).find(_=>_.id===h.furnitureId):void 0;if(!p||!as(p.type))continue;let g=ls(e,this.furnitureLinks.get(p.id)?.entity??this.furnitureLinks.get(p.id)?.power??null);g&&(g.clients!==null&&(h.text=M(e,"wifi_clients",{n:g.clients})),c&&(h.wedge={angle:360,reach:9,near:0,color:Ic(g),opacity:.4,through:!0,walls:!1},h.show="always"))}let d=nc(t,o);for(let h of t.floors.flatMap(p=>p.furniture))ht(h.type)&&l.set(h.id,`hydronic:${h.id}`);this.tapPins=d.pins;for(let h of t.floors.flatMap(p=>p.furniture))h.tap?.action&&l.set(h.id,`tap:${h.id}`);for(let{floor:h,item:p}of d.bare){let g=h.rooms.find(b=>b.points.length>=3&&H([p.x,p.z],b.points)),_=p.name||ae(e,p.type);o.push({id:`tap:${p.id}`,floorId:h.id,roomId:g?.id??null,x:p.x,z:p.z,y:gs(p)+oe(h,p),icon:Le(p.icon||"gesture-tap-button"),name:_,ownName:p.name||void 0,showName:!!p.show_name,text:"",active:!1,unavailable:!1,glow:null,furnitureId:p.id,show:p.marker??void 0,fromFurniture:!0})}return{markers:o,consumers:s,screens:a,targets:l}}robotObstacles(e,t){let r=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(r.has(i.type)||i.type.startsWith("lamp_")&&i.type!=="lamp_floor"&&i.type!=="lamp_uplight"||i.h<.04||oe(e,i)>.12)return!1;let o=X(i.type);return o&&(o.hole||/table|desk|chair|stool|bench|rug|carpet|mat$/.test(i.type))?!1:H([i.x,i.z],t)||Mr(i).some(s=>H(s,t))}).map(i=>Mr(i))}robotInfos(e,t){let r=[],i=od(e),o=sd(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 u=this.furnitureLinks.get(l.id)?.entity??null,c=u?e.states[u]?.state:void 0,d=c==="cleaning"?"cleaning":c==="returning"?"returning":c==="error"?"error":c==="docked"||!c?"docked":"idle",h=l.rotation*Math.PI/180,p=l.d*.14,g=[l.x-Math.sin(h)*p,l.z+Math.cos(h)*p],_=a.rooms.filter(T=>T.points.length>=3),y=(d==="cleaning"?uo(e,_,u,Pr(e,u,l.room_sensor)):null)??_.find(T=>H(g,T.points)),S=d==="cleaning"&&y?this.robotObstacles(a,y.points):[],$=i?Date.parse(e.states[i]?.last_updated??""):Number.NaN,A=!Number.isFinite($)||Date.now()-$<120*1e3,z=u?.startsWith("vacuum.")&&o&&!s&&(A||d!=="cleaning"&&d!=="returning")?o:null;z&&(s=!0);let k=u?Date.parse(e.states[u]?.last_changed??""):Number.NaN,F=d==="cleaning"||d==="returning"?null:Number.isFinite(k)?k:null;r.push({id:l.id,floorId:a.id,rest:g,restHeading:-h,mode:d,room:y?.points??null,roomId:y?.id??null,obstacles:S,track:z?.path??null,pose:z?.pose??null,settledAt:F})}for(let l of a.furniture){if(!/:(robot_mower|mower_dock)$/.test(l.type))continue;let u=this.furnitureLinks.get(l.id)?.entity??null;if(!u?.startsWith("lawn_mower."))continue;let c=e.states[u]?.state,d=c==="mowing"?"cleaning":c==="returning"?"returning":c==="error"?"error":c==="docked"||!c?"docked":"idle",h=[l.x,l.z],p=(a.outdoor??[]).filter(b=>b.type==="lawn"&&b.points.length>=3),g=p.find(b=>H(h,b.points))??[...p].sort((b,y)=>Sn(y.points)-Sn(b.points))[0],_=g?(a.outdoor??[]).filter(b=>b!==g&&b.type!=="lawn"&&b.points.some(y=>H(y,g.points))).map(b=>b.points):[];r.push({id:l.id,floorId:a.id,rest:h,restHeading:-l.rotation*Math.PI/180,mode:d,room:g?.points??null,roomId:g?.id??null,obstacles:_,y:g?kr(a,g,h[0],h[1]):Sr(a),mower:!0})}}return r}batteryText(e,t,r){let i=t?Number(e.states[t]?.state):Number.NaN,o=[];return Number.isFinite(i)&&o.push(`${N(e,i,0)} %`),r!==null&&Math.abs(r)>=10&&o.push(`${r<0?"\u25B2":"\u25BC"} ${pe(e,Math.abs(r))}`),o.join(" \xB7 ")}subMeterText(e,t,r,i){let o=i?Kl(t,r,i):null;return o?pe(e,o.use)+(o.unmetered===null?"":` \xB7 ${M(e,"meter_unmetered",{w:pe(e,o.unmetered)})}`):null}meterText(e,t){return t===null?"":Math.abs(t)<5?pe(e,0):`${M(e,t<0?"energy_grid_export":"energy_grid_import")} ${pe(e,Math.abs(t))}`}wallboxText(e,t,r){let i=t?e.states[t]:void 0,o=String(i?.state??"").toLowerCase(),s=(r??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?M(e,"wallbox_charging"):a?M(e,"wallbox_plugged"):i&&!I(i)&&!i.entity_id.startsWith("binary_sensor.")?se(e,i):"",u=r!==null&&r>50?pe(e,r):"";return[l,u].filter(Boolean).join(" \xB7 ")}stateFaces(e,t){let r=[],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)||!(te(a)||a.state==="home"||a.state==="occupied"||a.state==="on"))continue;let u=P(o)==="light"?je(a):null;r.push({part:s,color:u?u.color:[1,.71,.28],level:u?u.level:.85})}return r}careMarker(e,t,r,i,o){let s=e.states[o];if(!s)return null;let a="",l=!1,u=null;if(i==="bin"){let h=Ir(s);a=h===null?se(e,s):h===0?M(e,"care_bin_today"):h===1?M(e,"care_bin_tomorrow"):M(e,"care_bin_days",{n:h}),l=h!==null&&h<=1,l&&(u=[1,.72,.28])}else if(i==="mail")l=ol(s),a=M(e,l?"care_mail_yes":"care_mail_no"),l&&(u=[1,.85,.3]);else{let h=sl(s,r.thirsty_below??20);l=!!h?.thirsty,a=h?Number.isFinite(h.moisture)?`${M(e,l?"care_plant_thirsty":"care_plant_ok")} \xB7 ${Math.round(h.moisture)} %`:M(e,l?"care_plant_thirsty":"care_plant_ok"):se(e,s),l&&(u=[1,.45,.3])}let c=t.rooms.find(h=>h.points.length>=3&&H([r.x,r.z],h.points)),d={bin:"mdi:trash-can-outline",mail:"mdi:mailbox-outline",plant:"mdi:sprout-outline"}[i];return{glow:u,marker:{id:o,floorId:t.id,roomId:c?.id??null,x:r.x,z:r.z,y:gs(r)+oe(t,r),icon:r.icon?Le(r.icon):Le(d),name:r.name||ae(e,r.type),ownName:r.name||void 0,showName:!!r.show_name,text:a,active:l,unavailable:I(s),glow:null,furnitureId:r.id,show:r.marker??void 0,fromFurniture:!0,care:!0}}}lampMarker(e,t,r,i){let o=i?e.states[i]:void 0,s=(r.extra_lights??[]).map(b=>e.states[b]).filter(b=>!!b),a=s.find(b=>te(b)),l=X(r.type),u=$a[r.type]??l?.light??"floor",c=t.rooms.some(b=>b.points.length>=3&&H([r.x,r.z],b.points)),d=u==="strip"&&!c?kn(t,r.x,r.z)+(r.mount_y??0):r.mount_y!=null&&!l?r.mount_y:l||u==="wall"||u==="strip"?oe(t,r):u==="table"?br(t,r.x,r.z):u==="bollard"||u==="garden"?kn(t,r.x,r.z):0,h=t.rooms.find(b=>b.points.length>=3&&H([r.x,r.z],b.points)),p=_r(t,r),g=l?l.mount==="ceiling"?Math.max(.5,d-.15):d+r.h+.2:{ceiling:p-.3,downlight:p-.25,spot:p-.35,panel:p-.25,pendant:Math.max(.6,p-r.h-.25),fan:Math.max(.6,p-r.h-.2),floor:d+r.h+.25,uplight:d+r.h+.25,table:d+r.h+.2,wall:d+r.h+.2,strip:r.upright?d+r.w+.15:Math.max(.3,d-.2),bollard:d+r.h+.25,garden:d+r.h+.25}[u],_={id:i??`lamp:${r.id}`,floorId:t.id,roomId:h?.id??null,x:r.x,z:r.z,y:g,icon:qt("light"),name:r.name||(i?L(e,i):ae(e,r.type)),text:[o&&(te(o)||!a)?se(e,o):a?L(e,a.entity_id):"",En(e,r.values)].filter(Boolean).join(" \xB7 "),readout:!!r.values?.some(b=>b.entity&&b.entity!=="none"),active:(o?te(o):!1)||!!a,unavailable:o?I(o):!1,glow:o||s.length?yo(Da(o,s,r.color_entity&&r.color_entity!=="none"?e.states[r.color_entity]:void 0),r.glow_scale):null,lamp:u,rotation:r.rotation,mirror:!!r.mirror,roll:r.tilt??0,upright:!!r.upright,rise:r.rise??0,size:[r.w,r.d,r.h],base:d,pickable:!!i,furnitureId:r.id,pack:l?r.type:null,lightY:l?l.mount==="ceiling"?d:d+r.h*.85:void 0,ceiling:p,effect:o?.state==="on"?Vr(r,ml(e,r,i)):void 0,variant:r.variant,show:r.marker??void 0,fromFurniture:!0};return o&&i?vo(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&&Ta(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(Ra(e.id,!!e.lamp));if(this.markerMode==="all")return!0;if(e.lamp)return!1;let t=P(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,r]of this.openingLinks??[]){let i=r.lock??r.cover??r.contact??r.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"})),r=document.createElement("a");r.href=t,r.download=`nextfloor-${new Date().toISOString().slice(0,10)}.stl`,r.click(),setTimeout(()=>URL.revokeObjectURL(t),5e3)}secondBlinds(){let e=new Map;for(let[t,r]of this.openingLinks??[])r.cover2&&!r.lock&&r.cover&&e.set(t,r.cover2);return e}scheduleThumbs(e=600){clearTimeout(this.thumbTimer);let t=this.building?.floors.filter(i=>i.rooms.length).length??0;if(!this.floorThumbs||!this.building?.topology&&t<2){this._thumbs=[];return}let r=this.building?.topology?e: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}if(this.thumbsAt=Date.now(),this.building?.topology){let i=wr(this.building,this.topologyFocus);for(let o of this.viewer.scopeThumbnails(i,this.narrowThumbs?104:150,this.narrowThumbs?78:112))this.topologyImages.set(o.key,o.url);this.requestUpdate()}else this._thumbs=this.viewer.floorThumbnails(this.narrowThumbs?104:150,this.narrowThumbs?78:112)}},r)}get narrowThumbs(){return this._narrowStage}renderThumbs(){if(this.floorThumbs&&this.building?.topology)return Hu(this.building,this.topologyFocus,this.topologyImages,o=>this.fire("topology-tap",o),this._thumbsCompact,()=>{this._thumbsCompact=!this._thumbsCompact;try{localStorage.setItem("nextfloor.thumbs_compact",this._thumbsCompact?"1":"0")}catch{}},this.narrowThumbs,this._shortStage);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)),r=this._thumbsCompact,i=()=>{this._thumbsCompact=!r;try{localStorage.setItem("nextfloor.thumbs_compact",this._thumbsCompact?"1":"0")}catch{}};return m``}onDeviceHold(e,t,r){let i=P(e);i==="light"||i==="cover"||i==="switch"||i==="fan"||i==="lock"?this._menu={entity:e,x:t,y:r}:Ee(this,e)}onDeviceSwipe(e,t,r,i,o){let s=this.hass?.states[e];if(t==="start"){if(!s||I(s)||!W(this.hass,e)||this.confirmSet.has(e))return!1;let l=P(e);if(l==="light"&&hs(s).dim){let u=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:u,value:u,x:i,y:o},!0}if(l==="fan"&&typeof s.attributes.percentage_step=="number"){let u=s.state==="on"&&typeof s.attributes.percentage=="number"?s.attributes.percentage:0;return this._swipe={entity:e,kind:"fan",start:u,value:u,x:i,y:o},!0}if(l==="cover"&&ps(s)){let u=s.attributes.current_position;return this._swipe={entity:e,kind:"cover",start:u,value:u,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-r/220*100)));l!==a.value&&(this._swipe={...a,value:l});let u=performance.now();u-this.swipeSent>350&&(this.swipeSent=u,this.applySwipe())}else this.applySwipe(),clearTimeout(this.swipeTimer),this.swipeTimer=setTimeout(()=>this._swipe=null,700);return!0}applySwipe(){if(this._swipe&&!W(this.hass,this._swipe.entity))return;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,$l(this.hass,r=>this.announce(r)).then(r=>{t?r():this.stopAnnouncements=r})}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()||!wl(e,this.screenName)||!xl(e))return;let r=kl(e.message);this._announcement={message:e.message,until:Date.now()+r},clearTimeout(this.announceTimer),this.announceTimer=setTimeout(()=>this._announcement=null,r),Sl(this.hass,e)}renderAnnouncement(){let e=this._announcement;return e?m``:f}renderAlerts(){let e=this.building;if(!this._alerts.length||!e)return f;let t=this._alerts.slice(0,3);return m`
${t.map(r=>m``)}
${this._alerts.length>3?m`+${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),r=t?j(this.hass,t).filter(o=>P(o)==="scene"||P(o)==="script").slice(0,6):[];if(!r.length)return f;let i=t?.area_id?this.hass.areas?.[t.area_id]?.name:void 0;return m`
${r.map(o=>m``)}
`}renderFind(){let e=this.building;if(!e||!this.hass)return f;if(this._find===null)return m``;let t=jc(this.findIndex??=Uc(this.hass,e),this._find);return m`
this._find=r.target.value}
@keydown=${r=>{r.key==="Escape"&&(this._find=null),r.key==="Enter"&&t[0]&&this.goTo(t[0])}}
/>
${this._find.trim()?m`
${t.length?t.map(r=>m`
`):m`
${M(this.hass,"find_none")}
`}
`:f}
`}renderCentral(){let e=this.building,t=this.hass;if(!e||!t||!this.central||this._find!==null)return f;let r=(b,y)=>M(t,b,y),i=m``;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=>co(t,b).lights).filter(b=>W(t,b)),l=s.flatMap(b=>co(t,b).covers).filter(b=>W(t,b)),u=a.filter(b=>t.states[b]?.state==="on").length,c=!o,d=(b,y,S,$)=>{if($.length){if(c&&this._armed!==b){this._armed=b,clearTimeout(this.armTimer),this.armTimer=setTimeout(()=>this._armed=null,3500);return}this._armed=null,t.callService(y,S,{entity_id:$})}},h=(b,y,S,$,A)=>m``,p=e.settings.favorite_floors??{},g=(e.settings.favorites??[]).filter(b=>t.states[b]&&(!p[b]||!o||p[b]===o.id)),_=this.buttons??e.settings.buttons??[];return m`${i}
${o?o.name:r("central_house")}
${r("central_lights")}${a.length?m` ${u}/${a.length}`:f}
${h("lights_on","central_on","light","turn_on",a.filter(b=>t.states[b]?.state==="off"))}
${h("lights_off","central_off","light","turn_off",a.filter(b=>t.states[b]?.state==="on"))}
${l.length?m`
${r("central_covers")} ${l.length}
${h("covers_open","central_open","cover","open_cover",l)}
${h("covers_close","central_close","cover","close_cover",l)}
`:f}
${r("central_favorites")}
${g.length?m`
${g.map(b=>{let[y,S]=nl(b),$=t.states[b],A=y==="homeassistant"&&$?.state==="on";return m``})}
`:_.length?f:m`
${r("central_no_favorites")}
`}
${_.length?m`
${_.map(b=>m``)}
`:f}
`}toggleLock(){this._locked=!this._locked;try{localStorage.setItem(ad,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(),r=t-e*36e5;this._travel={history:new Map,from:r,to:t,t:r,playing:!1,speed:e>24?3600:600,hours:e,moments:[],loading:!0};try{let i=await Ln(this.hass,Mu(this.watched),r,t);if(!this._travel||this._travel.from!==r)return;this._travel={...this._travel,history:i,moments:Au(i,r,t),loading:!1}}catch{this._travel=null,this._error=M(this.hass,"travel_failed");return}this.syncDevices(!0)}travelTo(e){let t=this._travel;t&&(this._travel={...t,t:Math.min(t.to,Math.max(t.from,e))},this.syncDevices(!0))}playTravel(e){let t=this._travel;t&&(clearInterval(this.travelTimer),this.travelTimer=void 0,this._travel={...t,playing:e,t:e&&t.t>=t.to?t.from:t.t},e&&(this.travelTimer=setInterval(()=>{let r=this._travel;if(!r)return;let i=r.t+250*r.speed;i>=r.to&&this.playTravel(!1),this.travelTo(i)},250)))}renderTravel(){if(!this.hass||this.clean)return f;let e=a=>M(this.hass,a),t=this._travel;if(!t)return this.travelButton?m``:f;let r=this.hass.language??navigator.language,i=new Intl.DateTimeFormat(r,{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 m``}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 r=e.currentTarget;if(t)r.setPointerCapture(e.pointerId);else if(!this._stick)return;let i=r.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=r=>M(this.hass,r),t=this._stick??[0,0];return m`
${this._walking?m`this.stickMove(r,!0)} @pointermove=${r=>this.stickMove(r)} @pointerup=${()=>this.stickEnd()} @pointercancel=${()=>this.stickEnd()}>
${e("walk_hint")}
`:f}`}renderLock(){if(!this.lockButton||!this.hass||this.clean)return f;let e=M(this.hass,this._locked?"lock3d_off":"lock3d_on");return m``}renderClock(e=!1){if(!this.clock||!this.hass||this.clock==="top_left"&&!e)return f;let t=this.hass.language??navigator.language,r=new Date(this._now),i=new Intl.DateTimeFormat(t,{hour:"2-digit",minute:"2-digit"}).format(r),o=new Intl.DateTimeFormat(t,{weekday:"long",day:"numeric",month:"long"}).format(r);return m`${i}${o}
`}renderEye(){if(!this.cleanButton||!this.hass||this._find!==null&&!this.clean)return f;let e=M(this.hass,this.clean?"controls_show":"controls_hide");return m``}renderSwipe(){let e=this._swipe;if(!e||!this.hass)return f;let t=e.kind==="light"&&e.value<=0;return m`
${L(this.hass,e.entity)}
${t?M(this.hass,"swipe_off"):`${e.value} %`}
`}tapPlate(e,t,r){let i=this.building?.floors.flatMap(s=>s.furniture).find(s=>s.id===e),o=i?po(i.gang_entities,X(i.type)?.gangs??0):[];if(o.length===1)return this.onDeviceTap(o[0],t,r);o.length>1&&(this._plate={ids:o,x:t,y:r})}renderPlate(){let e=this._plate;if(!e||!this.hass)return f;let t=this.hass,r=()=>this._plate=null;return m`
`}renderMenu(){let e=this._menu;if(!e||!this.hass)return f;let t=this.renderRoot.querySelector(".nf-stage"),r=t?.clientWidth??800,i=t?.clientHeight??600,o=Math.max(8,Math.min(r-240,e.x-116)),s=Math.max(8,Math.min(i-360,e.y-170));return m`
!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 r of t.openings){let i=this.openingLinks?.get(r.id);if(r.my_position!=null&&(i?.cover===e||i?.cover2===e))return r.my_position}return null}onDeviceTap(e,t=0,r=0){if(e.startsWith("lamp:")||this._travel)return;if(e.startsWith("hydronic:")){let s=this.building?.floors.flatMap(a=>a.furniture).find(a=>a.id===e.slice(9));s&&this.hass&&is().then(a=>{if(this.isConnected&&this.hass)return this.hydronicModule=a,a.openHydronic(this.hass,s)}).catch(a=>{this._error=String(a)});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&&ho(this.hass,this,s.tap);return}if(this.pluginTapped(e))return;if(e.startsWith("gang:"))return this.tapPlate(e.slice(5),t,r);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??tt(s,l=>this.furnitureLinks?.get(l.id)?.power??null).grid:null;a&&Ee(this,a);return}let o=P(e);if(this.hass.symconObjects!==void 0&&!W(this.hass,e)){this.hass.states[e]&&(this._menu={entity:e,x:t,y:r});return}if(o==="cover"||o==="media"){this._menu={entity:e,x:t,y:r};return}if(o==="lock"){let s=ao(this.hass,e),a=L(this.hass,e);confirm(M(this.hass,s?"lock_confirm_lock":"lock_confirm_unlock",{name:a}))&&this.hass.callService("lock",s?"lock":"unlock",{entity_id:e});return}if(o&&Ea.has(o)){if(this.confirmSet.has(e)&&!confirm(M(this.hass,"confirm_switch",{name:L(this.hass,e)})))return;bl(this.hass,e)}else Ee(this,e)}pluginTapped(e){let t=this.hass?.states[e],r=this.placementInfo.get(e);if(!t||!r)return!1;let i=this.building?.floors.find(o=>o.id===r.floorId)?.placements.find(o=>o.entity_id===e);return sa({hass:this.hass,entityId:e,state:t},r,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=>Ee(this,o??e)})}renderPluginWindow(){let e=this._pluginWindow;return e?m`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 r=[];for(let i of e.floors)for(let o of i.furniture){if(!Hc(o.type))continue;let s=this.furnitureLinks?.get(o.id),a=Dc(t,s?.entity??s?.power??null);a&&r.push({id:o.id,name:o.name||ae(t,o.type),floorId:i.id,x:o.x,z:o.z,at:{floorId:i.id,x:o.x,z:o.z,y:oe(i,o)+o.h+.5},pump:a})}return r}livePrinters(e){let t=this.hass,r=[];if(!t)return r;for(let i of e.floors)for(let o of i.furniture){if(!ss(o.type))continue;let s=this.furnitureLinks?.get(o.id),a=os(t,s?.entity??s?.power??null);!a||!a.printing&&!/pause|finish|complete|error/.test(a.status)||r.push({id:o.id,name:o.name||ae(t,o.type),at:{floorId:i.id,x:o.x,z:o.z,y:oe(i,o)+o.h+.5},printer:a})}return r}liveCars(e,t){let r=[];for(let i of t.floors)for(let o of i.furniture){if(o.type!=="parking")continue;let s=Oc(e,o);if(!s||s.soc===null&&s.range===null&&s.locked===null&&s.climateOn===null)continue;let a=Go(e,o),l=a?Qu(o,a):null,u=o.name||(a?ae(e,a):ae(e,o.type));r.push({spot:o.id,name:u,at:{floorId:i.id,x:o.x,z:o.z,y:oe(i,o)+(l?.h??.2)+.6},car:s})}return r}liveMedia(e,t){let r=[];for(let i of t.floors){for(let o of i.furniture){let s=this.furnitureLinks?.get(o.id)?.entity;s?.startsWith("media_player.")&&r.push({entity:s,name:o.name||ae(e,o.type),at:{floorId:i.id,x:o.x,z:o.z,y:oe(i,o)+o.h+.15},rings:o.sound_rings})}for(let o of i.placements)o.entity_id.startsWith("media_player.")&&r.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 Cu(e,r)}refreshToday(e){let t=this.hass,r=e.settings.calendars??[],i=Math.max(1,Math.min(7,e.settings.today_days??1)),o=`${new Date().toDateString()}|${i}`;!t||!r.length||Date.now()-this.todayAt<9e5&&o===this.todayDay||(this.todayAt=Date.now(),this.todayDay=o,Rc(t,r,i).then(s=>this._todayItems=s))}refreshForecast(e){let t=this.hass,r=e.settings.forecast&&t?ft(t,this.weatherEntityId??e.settings.weather_entity):null;if(!t||!r)return;let i=`${r}|${new Date().toDateString()}`;Date.now()-this.forecastAt<18e5&&i===this.forecastKey||(this.forecastAt=Date.now(),this.forecastKey=i,Tc(t,r).then(o=>this._forecast=o))}renderForecast(e){let t=this.building,r=this.hass,i=t?.settings.forecast;if(!t||!r||!i||i.corner!==e||this.clean)return f;if(e==="top_right"&&(this.roomId||this.panelOpen))return f;let o=zc(this._forecast,Math.max(1,Math.min(7,i.days)));if(!o.length)return f;let s=ft(r,this.weatherEntityId??t.settings.weather_entity),a=s?r.states[s]?.attributes:void 0,l=String(a?.temperature_unit??"\xB0"),u=String(a?.precipitation_unit??"mm"),c=r.language??navigator.language,d=new Intl.DateTimeFormat(c,{weekday:"short"}),h=p=>p===null?"\u2013":`${Math.round(p)}\xB0`;return m`
${o.map((p,g)=>m`-
${g===0?M(r,"today"):d.format(new Date(p.day))}
${p.icon}
${h(p.high)} ${h(p.low)}
${p.rain!==null&&p.rain>0?`\u{1F4A7}${p.rain.toLocaleString(c,{maximumFractionDigits:1})} ${u}`:p.chance!==null&&p.chance>0?`\u{1F4A7}${Math.round(p.chance)} %`:""}
`)}
`}renderToday(e){let t=this.building,r=this.hass;if(!t||!r||this.clean||this.roomId||this.panelOpen)return f;let i=this.renderForecast("top_right"),o=this.today===!1?f:this.renderTodayCard(t,r);return o===f&&i===f&&e===f?f:m`${e}${o}${i}
`}renderTodayCard(e,t){let r=Mc(t,e,Date.now(),{today:M(t,"care_bin_today"),tomorrow:M(t,"care_bin_tomorrow")}),i=Ac([...r,...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=c=>{if(c===1)return M(t,"tomorrow");let d=new Date;return d.setDate(d.getDate()+c),new Intl.DateTimeFormat(a,{weekday:"long",day:"numeric",month:"numeric"}).format(d)},u=i.flatMap((c,d)=>[(c.day??0)>0&&(i[d-1]?.day??0)!==c.day?m`${l(c.day??0)}`:f,m`${c.title}${c.source}`]);return m`
${o?i.length?m``:m`${M(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 r=tt(e,s=>this.furnitureLinks?.get(s.id)?.power??null),i=e.energy,o={solar:i.solar?[i.solar]:r.solar,grid:i.grid??r.grid,gridInvert:!!i.grid_invert,battery:i.battery?[i.battery]:r.battery,batteryInvert:!!i.battery_invert,consumption:i.consumption};pu(t,o).then(s=>{this.week=s,this.syncDevices(!0)}).catch(()=>this.week=null)}meterRows(e,t=null){let r=this.hass,i=[],o=this.floorId?e.floors.find(l=>l.id===this.floorId):void 0,s=o&&V(r)?we(r,o,e.floors.flatMap(l=>l.rooms)).find(l=>l.kind==="electricity"&&l.metric==="power"&&l.unit==="W"):void 0,a=V(r)?s?.value??null:o?.power_entity?Z(r?.states[o.power_entity]):null;if(o&&(s||a!==null)){let l=!s?.incomplete&&a!==null&&t&&t>0?` \xB7 ${M(r,"floor_power_share",{n:Math.round(Math.max(0,a)/t*100)})}`:"";i.push({icon:"\u26A1",label:o.name,value:`${s?Ke(r,s):Et(r,a)}${l}`})}for(let[l,u,c]of[["gas","\u{1F525}","energy_gas_short"],["water","\u{1F4A7}","energy_water_short"]]){let d=e.energy[l],h=d?r?.states[d]:void 0;h&&!I(h)&&i.push({icon:u,label:M(r,c),value:se(r,h)})}return i}refreshDayCurves(e){let t=this.hass;if(!t||this._travel||Date.now()-this.curvesAt<6e5)return;this.curvesAt=Date.now();let r=a=>Pn(a,e,Hn(a,e),tt(e,l=>this.furnitureLinks?.get(l.id)?.power??null)),i=Ru(t,r),o=Date.now(),s=o-24*36e5;Ln(t,i,s,o,!0).then(a=>{this.dayCurves=Eu(t,a,s,o,r),this.syncDevices(!0)}).catch(()=>this.dayCurves=null)}syncHydronics(e,t,r){let i=++this.hydronicGeneration,o=this.shownBuilding(r).floors.filter(s=>!this.floorId||s.id===this.floorId).flatMap(s=>s.furniture.filter(a=>ht(a.type)).map(a=>({floor:s,item:a})));if(!o.length){e.setHydronics([]),this.hydronicModule?.refreshHydronic(r,t,!!this._travel);return}is().then(s=>{i!==this.hydronicGeneration||this.viewer!==e||!this.isConnected||(this.hydronicModule=s,e.setHydronics(o.map(({floor:a,item:l})=>({...s.hydronicVisual(r,l,a.id,oe(a,l)),animate:!this.dimmed&&!this._travel}))),s.refreshHydronic(r,t,!!this._travel))}).catch(s=>{this._error=String(s)})}syncLhCards(e,t,r,i,o,s){let a=[],l=r.summary,u=l.solar!==null||l.grid!==null||l.battery!==null||l.consumption!==null,c=qn(t),d=(this.floorId?t.floors.find(h=>h.id===this.floorId):void 0)??[...t.floors].sort((h,p)=>p.elevation-h.elevation)[0];if(this.liveCardsOn&&!this.dimmed&&!this.roomId&&u&&c&&d){let h=0,p=0,g=0;for(let _ of d.rooms)for(let[b,y]of _.points)h+=b,p+=y,g++;a.push({kind:"house",at:{floorId:d.id,x:g?h/g:c.x,z:g?p/g:c.z,y:d.height+(this.floorId?1.2:3.2)},summary:l,autarky:r.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 h of i)a.push({kind:"car",at:h.at,spot:h.spot,name:h.name,car:h.car});for(let h of this.livePrinters(t))a.push({kind:"printer",at:h.at,name:h.name,printer:h.printer});for(let h of this.liveHeatPumps(t))a.push({kind:"heatpump",at:h.at,name:h.name,pump:h.pump});for(let h of o)a.push({kind:"media",at:{...h.at,y:h.at.y+.5},media:h})}if(this.liveCardsOn&&!this.dimmed){a.push(...vc(s,t,this.floorId,this.roomId)),a.push(...wc(s,t,this.furnitureLinks??new Map,this.floorId,this.roomId));for(let h of t.floors)for(let p of h.furniture){if(!ht(p.type)||p.hydronic?.card===!1||this.floorId&&h.id!==this.floorId||!Qe(s,p))continue;let g=this.roomId?h.rooms.find(_=>_.id===this.roomId):null;this.roomId&&(!g||!H([p.x,p.z],g.points))||a.push({kind:"hydronic",item:p,readOnly:!!this._travel,at:{floorId:h.id,x:p.x+(p.pin_offset?.x??0),z:p.z+(p.pin_offset?.z??0),y:oe(h,p)+p.h+.3+(p.pin_offset?.y??0)}})}}JSON.stringify(a)!==JSON.stringify(this._liveCards)&&(this._liveCards=a),e.setLiveAnchors(a.map(h=>h.at),a.length?(h,p,g,_,b)=>this.placeLhCard(h,p,g,_,b):null)}placeLhCard(e,t,r,i,o){let s=this.renderRoot.querySelector(`.live-card[data-i="${e}"]`);if(!s)return;let a=this._liveCards[e],l=`${a.kind}:${a.at.floorId}:${a.at.x}:${a.at.z}`,u=s.dataset.zoomKey===l&&s.dataset.zoomVisible==="1",c=this.shadowRoot?.activeElement,d=!!c&&s.contains(c),h=d||Kc(a,o,u);s.dataset.zoomKey=l,s.dataset.zoomVisible=h?"1":"0",s.dataset.density=String(Math.round(o)),s.dataset.priority=String(d?110:us(a).priority),s.dataset.focused=d?"1":"0",s.dataset.x=String(t),s.dataset.y=String(r),s.style.visibility=i&&h?"visible":"hidden",e===this._liveCards.length-1&&Wc(this.renderRoot)}toggleHouseFold(){this._houseFolded=!this._houseFolded;try{localStorage.setItem("nextfloor.house_card_folded",this._houseFolded?"1":"0")}catch{}}toggleLhCards(){this._liveCardOn=!this._liveCardOn;try{localStorage.setItem("nextfloor.cards",this._liveCardOn?"1":"0")}catch{}this.syncDevices(!0)}renderTopLeft(){let e=this.clean?f:this.renderLhEnergy(),t=this.renderForecast("top_left");return this.clock!=="top_left"&&t===f||!this.hass?e:m`${this.clock==="top_left"?this.renderClock(!0):f}${e}${t}
`}renderLhEnergy(){let e=this.ownSensors(),t=this._liveEnergy?.summary,r=!!t&&!this.roomId&&this.showEnergy&&!!this.hass&&!(t.consumption===null&&t.grid===null&&t.solar===null&&t.battery===null),o=this.building?.floors.some(u=>u.rooms.some(c=>c.climate_card)||u.furniture.some(c=>c.power_card||ht(c.type)&&c.hydronic?.card!==!1))?this.renderCardToggle():f,s=this.roomNamesButton?m``:f;if(!r)return e.length||o!==f||s!==f?m`${s}${e}${o}
`:f;let a=u=>M(this.hass,u),l=[];if(t.solar!==null&&l.push({cls:"solar",label:a("energy_solar"),value:pe(this.hass,t.solar)}),t.consumption!==null&&l.push({cls:"total",label:a("energy_consumption"),value:pe(this.hass,t.consumption)}),t.rest!==void 0&&t.rest!==null&&l.push({cls:"total",label:a("energy_rest"),value:pe(this.hass,t.rest)}),t.battery!==null||t.soc!==null){let u=[t.battery!==null?pe(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:u.join(" \xB7 ")})}if(t.grid!==null){let u=t.grid<0;l.push({cls:u?"export":"grid",label:a(u?"energy_grid_export":"energy_grid_import"),value:pe(this.hass,Math.abs(t.grid))})}if(t.tariff&&l.push({cls:"tariff",label:a("energy_tariff"),value:`${N(this.hass,t.tariff.value,3)} ${t.tariff.unit}`.trim()}),this.building)for(let u of this.meterRows(this.building))l.push({cls:"meter",label:`${u.icon} ${u.label}`,value:u.value});return m`
${s}
${this.liveCardsOn&&this._liveCards.some(u=>u.kind==="house")?f:l.map(u=>m`
${u.label}${u.value}
`)}
${this.flows!==null?f:m`
`}
${this.renderCardToggle()}
${e}
`}renderCardToggle(){return this.holograms!==null?f:m``}utilityOverview(e){let t=this.building?this.scopeBuilding():null;if(!t||!V(this.hass)||!this.showEnergy||this.clean||this.roomId||this.panelOpen||!e&&!this._utilityOverviewVisible)return f;let r=nd(this.hass,this.building,this.topologyFocus);return!r.totals.length&&!r.entries.length?f:m`{i.stopPropagation(),this.fire("topology-tap",i.detail)}}
@utility-open=${i=>{i.stopPropagation(),i.detail.roomId?this.openRoom(i.detail.floorId,i.detail.roomId):this.fire("floor-tap",{floorId:i.detail.floorId})}}>`}ownSensors(){let e=this.utilityOverview(!0),t=e===f?f:m``,r=this.sensorBar&&this.hass?this.building?.settings.status_entities??[]:[],i=V(this.hass)?(this.building?.presence??[]).filter(u=>Ma(this.hass,u.person,[0])).map(u=>m`${u.name||L(this.hass,u.person)}${le(this.hass.states[u.person])===null?"\u2013":le(this.hass.states[u.person])?"Anwesend":"Abwesend"}${G(this.hass,[u.person],u.name||"Anwesenheit")}
`):[],o=V(this.hass)?Object.entries(this.building?.settings.weather_variables??{}).filter(u=>!!u[1]&&u[1]!=="none").map(([u,c])=>[td[u]||u,c]):[];V(this.hass)&&this.building?.settings.rain_sensor&&this.building.settings.rain_sensor!=="none"&&o.push(["Regensensor",this.building.settings.rain_sensor]);let s=o.length?m`
`:f,a=V(this.hass)?(this.building?this.scopeBuilding().floors:[]).filter(u=>!this.floorId||u.id===this.floorId).map(u=>({floor:u,readings:we(this.hass,u,this.building?.floors.flatMap(c=>c.rooms))})).filter(u=>u.readings.length):[],l=a.length?m`
`:f;return[t,e,...i,s,l,...r.filter(u=>this.hass.states[u]).map(u=>m`${G(this.hass,[u],L(this.hass,u))}`)]}renderMapCredit(){let e=this.building?.settings.map;return ic(e)?m`${qo(e).text}`:f}renderLegend(){if(this.heatMode==="wifi")return this.renderWifiLegend();if(this.heatMode==="none"||this.heatMode==="values")return f;let e=Rt(new Date,this.hass?.config?.latitude??50),t=ii(this.heatMode,e),r=this.heatMode==="temperature",i=r?ce(this.hass,t.stops[0][0]):t.stops[0][0],o=r?ce(this.hass,t.stops[t.stops.length-1][0]):t.stops[t.stops.length-1][0],s=r?re(this.hass):t.unit,a=l=>M(this.hass,l);return m`
${a(`heat_${this.heatMode}`)}${this.heatMode==="temperature"?m` ${a(e?"heat_summer":"heat_winter")}`:f}
${N(this.hass,i,0)} ${s}${N(this.hass,o,0)} ${s}
${this.heatValues.size?f:m`${a("heat_none_found")}`}
`}renderWifiLegend(){let e=this.hass,t=this.building;if(!e||!t)return f;let r=(u,c)=>M(e,u,c),i=t.floors.flatMap(u=>u.furniture.filter(c=>as(c.type)).map(c=>ls(e,this.furnitureLinks?.get(c.id)?.entity??this.furnitureLinks?.get(c.id)?.power??null))),s=i.filter(u=>!!u).reduce((u,c)=>u+(c.clients??0),0),a=t.floors.flatMap(u=>u.placements.map(c=>e.states[c.entity_id])),l=Cc(a);return m`
📶 ${r("heat_wifi")}
${r("wifi_aps",{n:i.length,clients:s})}
${l.online+l.offline.length?m`${r("wifi_network",{online:l.online,offline:l.offline.length})}`:f}
${l.offline.length?m`${l.offline.slice(0,4).join(", ")}`:f}
${i.length?f:m`${r("wifi_none")}`}
`}skyColor(){let e=Bn[this.theme]??Bn.neon,t=this._sky;return e.night[0].map((r,i)=>Math.round(r+(e.day[0][i]-r)*t))}render(){let e=this.utilityOverview(!1),t=this._sky,r=(s,a)=>`rgb(${s.map((l,u)=>Math.round(l+(a[u]-l)*t)).join(",")})`,i=Bn[this.theme]??Bn.neon,o=`--nf-sky:${r(i.night[0],i.day[0])};--nf-ground:${r(i.night[1],i.day[1])}`+Pu(this.building?.settings.backdrop);return m`
${this._error?m`
${this._error}
`:f} ${this.renderTopLeft()} ${Bc(this.hass,this._liveCards,(s,a,l,u)=>this.hass?.callService(s,a,{entity_id:l,...u}),{folded:this._houseFolded,toggle:()=>this.toggleHouseFold()},!!this.roomId||this.panelOpen)} ${this.clean?f:this.renderLegend()} ${this.renderMapCredit()}
${this.renderAlerts()} ${this.renderAnnouncement()} ${this.clean?f:m`${this.renderThumbs()} ${this.renderScenes()} ${this.renderFind()} ${this.renderCentral()}`} ${this.renderSwipe()}
${this.renderMenu()} ${this.renderPlate()} ${this.renderEye()} ${this.renderLock()} ${this.renderWalk()} ${this.renderTravel()} ${this.renderClock()} ${this.renderToday(e)} ${this.renderLayers()} ${this.renderPluginWindow()}
${this.showStats&&this._stats?m`
${this._stats.fps?M(this.hass,"stats_fps",{fps:this._stats.fps,ms:this._stats.worstMs}):M(this.hass,"stats_idle")}
${this._stats.busy.length?m`(${this._stats.busy.map(s=>M(this.hass,`stats_busy_${s}`)).join(", ")})`:f} ·
${M(this.hass,"stats",{calls:this._stats.calls,tris:this._stats.triangles.toLocaleString()})} ·
${M(this.hass,this._stats.low?"stats_low":"stats_full",{r:N(this.hass,this._stats.pixelRatio,2)})}`:f}
`}static styles=[Se,We,Vc,J`
: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-utility-right {
height: calc(100% - 140px);
}
.nf-has-utility-overview:not(.nf-narrow) > .nf-energy,
.nf-has-utility-overview:not(.nf-narrow) > .nf-topleft {
max-width: calc(100% - 316px);
}
.nf-has-utility-overview .nf-energy {
align-items: flex-start;
}
.nf-narrow .nf-utility-right {
top: auto !important;
bottom: 64px;
height: 42%;
max-height: 42%;
justify-content: flex-end;
width: min(280px, calc(100% - 24px));
}
.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",_s);function pe(n,e){return Math.abs(e)>=1e3?`${N(n,e/1e3,1)} kW`:`${Math.round(e)} W`}function gs(n){return n.type==="tv_board"?n.h+.9:n.type==="tv_wall"||n.type==="kitchen_wall"?n.h+.25:n.h+.35}function vg(n,e){let t=e.attributes.percentage;return e.state==="on"&&typeof t=="number"?`${Math.round(t)} %`:se(n,e)}var ud;function cd(){let n=new URL("./nextfloor-editor.js?v=75354d777978",new URL(import.meta.url)).href;return ud??=import(n),ud}var wg=.25,dd=n=>Math.round(n*1e3)/1e3,hd=(n,e,t)=>n.rooms.find(r=>r.points.length>=3&&H([e,t],r.points));function ys(n,e,t,r,i){let o=hd(n,e,t);if(!o)return[r,i];let s=(a,l)=>H([a,l],o.points);return s(r,i)?[r,i]:s(r,t)?[r,t]:s(e,i)?[e,i]:[e,t]}function xg(n,e,t,r){return n.rooms.some(i=>i.id!==e.id&&i.points.some((o,s)=>{let a=i.points[(s+1)%i.points.length];return Math.abs(de(ee(o,t),r))<.02&&Math.abs(de(ee(a,t),r))<.02}))}var bs=(n,e)=>Math.abs((n-e+540)%360-180);function pd(n,e,t,r=wg){let i=hd(n,e.x,e.z);if(!i)return null;let o=i.points,s=St(o)>=0?1:-1,a=null;return o.forEach((l,u)=>{let c=o[(u+1)%o.length],d=et(ee(c,l));if(d<.3)return;let h=[(c[0]-l[0])/d,(c[1]-l[1])/d],p=[-h[1]*s,h[0]*s],g=de(ee([e.x,e.z],l),h);if(g<0||g>d)return;let _=xg(n,i,l,p)?t/2:0,b=de(ee([e.x,e.z],l),p)-_,y=Math.atan2(-p[0],p[1])*180/Math.PI,$=[{rotation:y,extent:e.d/2},{rotation:y+90,extent:e.w/2},{rotation:y-90,extent:e.w/2}].reduce((z,k)=>bs(e.rotation,k.rotation)50)return;let A=b-$.extent;Math.abs(A)>r||a&&Math.abs(A)>=Math.abs(a.gap)||(a={x:dd(e.x-p[0]*A),z:dd(e.z-p[1]*A),rotation:(Math.round($.rotation)%360+360)%360,gap:A})}),a&&{x:a.x,z:a.z,rotation:a.rotation}}function $i(n,e,t){let r=structuredClone(n);for(let i of r.floors){let o=i.furniture.find(s=>s.id===e);o&&t(o,i)}return r}function Mi(n,e,t){let r=structuredClone(n);for(let i of r.floors){let o=i.placements.find(s=>s.entity_id===e);o&&t(o,i)}return r}function md(n,e){let t=structuredClone(n);for(let r of t.floors)r.furniture=r.furniture.filter(i=>i.id!==e);return t}function fd(n,e){let t=structuredClone(n);for(let r of t.floors)r.placements=r.placements.filter(i=>i.entity_id!==e);return t}function gd(n,e,t,r){return Mi(n,e,(i,o)=>{[i.x,i.z]=ys(o,i.x,i.z,t,r)})}function _d(n,e,t,r){let i=n.settings.wall_interior??.12;return $i(n,e,(o,s)=>{[o.x,o.z]=ys(s,o.x,o.z,t,r);let a=pd(s,o,i);a&&Object.assign(o,a)})}var vs=(n,e)=>((n+e)%360+360)%360,bd=n=>Number.parseFloat(n.replace(",",".")),tr=(n,e)=>Math.round(n*10**e)/10**e;function ws(n){let{min:e,max:t,accepts:r=()=>!0}=n,i=o=>{let s=bd(o.target.value);!Number.isFinite(s)||!r(s)||n.apply(t===void 0?s:Math.min(t,Math.max(e,s)))};return m``}var vd=(n,e)=>m``,yd=(n,e)=>m``;function kg(n,e){let t=n.building.floors.find(s=>s.furniture.some(a=>a.id===e)),r=t?.furniture.find(s=>s.id===e);if(!t||!r)return f;let i=(s,a)=>ws({label:n.t(a),title:n.t(`size_${s}`),value:r[s],step:.05,min:.05,accepts:l=>l>0,apply:l=>n.editFurniture(e,u=>u[s]=tr(l,3))}),o=ka(r)?m`${ws({label:"\u2195",title:n.t("mount_height"),value:r.mount_y??oe(t,r),step:.05,min:0,accepts:s=>s>=0,apply:s=>n.editFurniture(e,a=>a.mount_y=tr(s,3))})}
${r.mount_y!=null?vd(n,()=>n.editFurniture(e,s=>s.mount_y=null)):f}`:f;return m`${i("w","size_short_w")}${i("d","size_short_d")}${i("h","size_short_h")} ${o}`}function Sg(n,e){let t=n.building.floors.find(l=>l.placements.some(u=>u.entity_id===e)),r=t?.placements.find(l=>l.entity_id===e);if(!t||!r)return f;let i=P(e),o=(l,u,c)=>m``,s=["ceiling","floor","table","wall"].map(l=>[l,n.t(`lamp_${l}`)]),a=i?Kt(i,Ae(t,r.x,r.z),i==="light"?r.mount??"ceiling":null):1;return m`${i==="light"?o("lamp_mount",s,r.mount??"ceiling"):f}
${ws({label:n.t("size_short_h"),title:n.t("marker_height"),value:r.y??a,step:.05,min:0,accepts:l=>l>=0,apply:l=>n.editDevice(e,u=>u.y=tr(l,3))})}
${r.y!==null?vd(n,()=>n.editDevice(e,l=>l.y=null)):f}`}function wd(n,e,t){let r=n.t,i;if(e){let o=n.building.floors.flatMap(s=>s.furniture).find(s=>s.id===e)?.type;i=m`${o?ae(n.hass,o):""}
${kg(n,e)} ${yd(45,s=>n.turnFurniture(e,s))}
`}else t?i=m`${L(n.hass,t)}
${Sg(n,t)} ${yd(45,o=>n.turnDevice(t,o))}
`:i=m`${r("furnish_hint")}`;return m`${i}
`}var xd=ne``;var me=(n,e)=>({name:n,fallback:e,read:t=>e?t!=="0":t==="1",write:t=>t?"1":"0"}),hn=(n,e,t)=>({name:n,fallback:t,read:r=>e.find(i=>i===r)??t,write:r=>r}),xs={explode:me("explode",!0),keepRoof:me("roof",!1),solidWalls:me("solid_walls",!1),quality:hn("quality",["auto","low","high"],"auto"),stats:me("stats",!1),markers:hn("markers",["none","important","all"],"important"),heat:hn("heat",["none","temperature","humidity","co2","mould","comfort","power","sun","values","wifi"],"none"),theme:hn("theme",hi,"neon"),clock:hn("clock",["none","top_left","top_right","bottom_left","bottom_right"],"none"),accent:{name:"accent",fallback:null,read:n=>/^#[0-9a-f]{6}$/i.test(n)?n:null,write:n=>n??""},floorStack:hn("floor_stack",["dim","stacked","single"],"dim"),roomNames:me("room_names",!0),clean:me("clean",!1),navWrap:me("nav_wrap",!1),weather:me("weather",!0),timeSlider:me("time_slider",!1),menuOpen:me("menu_open",!1),keepCamera:me("keep_camera",!1),readable:me("readable",!1),plain:me("plain",!1),rightBack:me("right_back",!1),zoom:{name:"zoom",fallback:100,read:n=>/^\d{2,3}$/.test(n)?Math.min(250,Math.max(60,Number(n))):100,write:n=>String(Math.round(Math.min(250,Math.max(60,n))))},screenName:{name:"screen_name",fallback:"",read:n=>n.slice(0,60),write:n=>n.trim().slice(0,60)},announceMuted:me("announce_muted",!1),glassWalls:{name:"glass_walls",fallback:20,read:n=>/^\d{1,3}$/.test(n)?Math.min(100,Number(n)):20,write:n=>String(Math.round(Math.min(100,Math.max(0,n))))}};function kd(n=Ri()){try{return n?.getItem("nextfloor.screen_name")?.trim()||null}catch{return null}}function Sd(n=Ri()){try{return n?.getItem("nextfloor.announce_muted")==="1"}catch{return!1}}function Ri(){try{return localStorage}catch{return null}}var Ai=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 r of Object.keys(xs)){let i=xs[r],o=this.raw(i.name);t[r]=o===null?i.fallback:i.read(o)}return new URLSearchParams(e).has("nf_stats")&&(t.stats=!0),t}save(e,t){let r=xs[e];try{this.storage?.setItem(`nextfloor.${r.name}`,r.write(t))}catch{}}};var $d=J`
.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 Md=new WeakMap,Ad=new WeakMap;function Ft(n,e){let t=Ad.get(n)??n,r=Md.get(t)??new WeakMap;Md.set(t,r);let i=r.get(e);if(i)return i;let o=new Map;for(let l of e)for(let u of l.placements)u.entity_id.startsWith("cover.")&&o.set(u.entity_id,{tilt:u.cover_tilt==="none"?null:u.cover_tilt,position:u.position});for(let l of qe(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,u]of o){let c=t.states[l];if(!c)continue;let d={...c.attributes,nf_cover_control:!0},h=Gt(t,u.position);h===null&&(h=typeof c.attributes.current_position=="number"?c.attributes.current_position:null),h!==null&&(d.current_position=h);let p=u.tilt?t.states[u.tilt]:c,g=typeof p?.attributes.current_tilt_position=="number"?p.attributes.current_tilt_position:u.tilt?Gt(t,u.tilt):null;g!==null&&(d.current_tilt_position=g,d.supported_features=Number(d.supported_features??0)|128);let _=c.state;typeof d.current_position=="number"&&_!=="unavailable"&&_!=="unknown"&&_!=="opening"&&_!=="closing"&&(_=d.current_position>0?"open":"closed"),s[l]={...c,state:_,attributes:d}}let a={...t,states:s,callService:async(l,u,c={})=>{if(l!=="cover")return t.callService(l,u,c);let d=Array.isArray(c.entity_id)?c.entity_id:[c.entity_id],h=async p=>{let g=typeof p=="string"?o.get(p):void 0;if(!g)return t.callService(l,u,{...c,entity_id:p});let _={...c,entity_id:p},b=u;(b==="toggle"||b==="toggle_cover")&&(b=s[String(p)]?.state==="closed"?"open_cover":"close_cover");let y=b.includes("tilt");y&&g.tilt&&(_.entity_id=g.tilt);let S=g.tilt?t.states[g.tilt]:void 0;return y&&g.tilt&&!S?.attributes.symcon_id&&typeof S?.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(c.entity_id)?Promise.all(d.map(h)):h(d[0])}};return Ad.set(a,t),r.set(e,a),a}var ks=class extends Q{static properties={hass:{attribute:!1},narrow:{type:Boolean},route:{attribute:!1},panel:{attribute:!1},_mode:{state:!0},_editorReady:{state:!0},_topologyGroup:{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 Vt(this);store=new Ai(Ri());constructor(){super(),this.narrow=!1,this._mode="view",this._editorReady=!!customElements.get("nf-editor"),this._floorId=null,this._topologyGroup=_e,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:xt(It(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,r=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 m`
${t!==null?m``:f}`}t=(e,t)=>M(this.hass,e,t);setPref(e,t){this._prefs={...this._prefs,[e]:t},this.store.save(e,t)}willUpdate(e){this.toggleAttribute("readable",!!this._prefs?.readable),e.has("hass")&&this.hass&&(this.style.colorScheme=Ur(this.hass),this.data.setHass(this.hass));let t=this.data.building;t&&this._floorId&&!t.floors.some(r=>r.id===this._floorId)&&(this._floorId=null,this._topologyGroup=_e,this._roomId=null)}get isAdmin(){return this.hass?.user?.is_admin??!1}setMode(e){e!=="view"&&!this.isAdmin||e!==this._mode&&(e==="view"&&this.data.flush(),this._mode=e)}topologySelection(e){return this._floorId?Ce(e,this._floorId,this._roomId):this._topologyGroup}openTopology(e){let t=this.data.building;t&&(this._roomId=e.kind==="room"?e.id??null:null,this._floorId=e.kind==="room"?e.floorId??null:e.kind==="floor"?e.id??null:lt(t,e)?.id??null,this._topologyGroup=e,this._outside=!1)}openFloor(e){this._topologyGroup=_e,this._floorId=e,this._roomId=null,this._outside=!1}outsideIds(e){if(e.topology)return jt(this.hass,xr(e,this.topologySelection(e)),e.settings.outside_hidden);let t=this.outsideMemo;if(t&&t.building===e&&t.entities===this.hass.entities)return t.ids;let r=jt(this.hass,e.floors,e.settings.outside_hidden);return this.outsideMemo={building:e,entities:this.hass.entities,ids:r},r}openOutside(e){let t=this.data.building;if(t?.topology){let i=Re(t,e?Ce(t,e):this.topologySelection(t)),o=i.find(l=>l.selection.kind==="outside")?.selection,s=[...i].reverse().find(l=>["building","branch","location"].includes(l.selection.kind)&<(t,Wt(l.selection))),a=o??(s?Wt(s.selection):i.find(l=>l.selection.kind==="location")?.selection);if(a){let l=!this._outside;this.openTopology(a),this._outside=l}return}let r=!this._outside;this.openFloor(null),this._outside=r}onRoomTap(e){let{floorId:t,roomId:r}=e.detail;if(r==="nf-outside")return this.openOutside(t);if((this.data.building?.floors.length??0)>1&&t&&this._floorId!==t)return this.openFloor(t);r&&(this._roomId=r===this._roomId?null:r,this._outside=!1)}furnishHost={hass:void 0,building:void 0,t:this.t,editFurniture:(e,t)=>this.applyEdit(r=>$i(r,e,t)),editDevice:(e,t)=>this.applyEdit(r=>Mi(r,e,t)),turnFurniture:(e,t)=>this.applyEdit(r=>$i(r,e,i=>i.rotation=vs(i.rotation,t))),turnDevice:(e,t)=>this.applyEdit(r=>Mi(r,e,i=>i.rotation=vs(i.rotation??0,t))),removeFurniture:e=>{this.applyEdit(t=>md(t,e)),this._selFurniture=null},removeDevice:e=>{this.applyEdit(t=>fd(t,e)),this._selDevice=null},finish:()=>{this._furnish=!1,this._selFurniture=null,this._selDevice=null}};saveMoods(e,t){this.applyEdit(r=>({...r,floors:r.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.data.building?.topology&&this.topologySelection(this.data.building).kind!=="all"?this.openTopology(xn(this.data.building,this.topologySelection(this.data.building))):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&&Lr(this.hass,this))return f;let e=this.data.building,t=this._prefs.clean&&this._mode==="view",r=f;return e&&(this._mode==="editor"&&this.isAdmin?r=this.renderEditor(e):this._mode==="extensions"&&this.isAdmin?r=this.renderExtensions():r=this.renderView(e)),m`
${t?f:m`${this.renderHeader(e)}${this.renderNotices()}`}
${this.data.error&&!e?m`
${this.t("load_error")}: ${this.data.error}
`:f}
${!e&&!this.data.error?m`
${this.t("loading")}
`:f}
${r}
`}choiceRow(e,t,r,i,o,s=f){return m`
${t.map(a=>m``)}${s}
`}accentPicker(){let e=this._prefs.accent;return m``}renderViewOptions(){let e=this._prefs;return m`
${this.choiceRow("quality",["auto","low","high"],e.quality,t=>this.t(`quality_${t}`),t=>this.setPref("quality",t))}
${this.choiceRow("theme",hi,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))}
${V(this.hass)?f:m`
${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",r=this.data.saveState,i=(s,a,l="")=>m``,o=r==="saving"?"saving":r==="saved"?"saved":"save_error";return m``}renderNotices(){let e=this.data,t=[];if(this._variablesNotice&&t.push(m`${this._variablesNotice}
`),!V(this.hass)&&e.needsRestart&&t.push(e.versionGap==="frontend"?m`
${this.t("needs_reload",{frontend:e.frontendVersion,backend:e.backendVersion??"?"})}
`:m`${e.backendVersion?this.t("needs_restart",{version:e.backendVersion,frontend:e.frontendVersion}):this.t("needs_restart_old")}
`),e.saveState==="error"&&e.saveError&&t.push(m`${this.t("save_failed_detail",{error:e.saveError})}
`),e.draft&&this.isAdmin){let r=new Date(e.draft.savedAt).toLocaleString(this.hass?.language);t.push(m`
${this.t("draft_found",{time:r})}
`)}return t.length>0?m`${t}
`:f}whenEditorLoaded(e){return this._editorReady?e():(cd().then(()=>this._editorReady=!0,t=>this.data.error=String(t)),m``)}renderExtensions(){return this.whenEditorLoaded(()=>m`{this.data.reloadPacks()}}
@plugins-changed=${e=>this.applyEdit(t=>({...t,settings:{...t.settings,plugins:e.detail}}))}>`)}renderEditor(e){return this.whenEditorLoaded(()=>m`this.setPref("roomNames",t.detail.value)}
.packs=${this.data.packs}
.loadCardEditor=${ar}
@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 m``}let r=On($u(t).map(i=>this.hass.states[i]));return r.count<2?f:m``}renderNav(e){if(e.topology){let u=e.floors.find(c=>c.id===this._floorId);return!u||wn(u)?f:m``}let t=e.floors.filter(u=>!this._floorId||u.id===this._floorId),r=e.floors.length>1,i=this._prefs.navWrap,o=this.outsideIds(e).length?m``:f,s=r?m`
${[...e.floors].reverse().map(u=>m``)}
${o} ${this.allOffChip(e)}
`:m`${o} ${this.allOffChip(e)}`,a=t.flatMap(u=>[t.length>1&&u.rooms.length?m`${u.name}`:f,...u.rooms.map(c=>m``)]),l=this.t(i?"nav_row":"nav_wrap");return m``}toggleChip(e,t,r){return m``}renderOverlay(e){let t=this._prefs,r=this.t,i=(c,d)=>m`${[c,d].map(([h,p,g])=>m``)}
`,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?m``:f,u=m``;return this._switchesOpen?m`
this._switchesOpen=!1}>
c.key==="Escape"&&(this._switchesOpen=!1)}>
${["auto","cut","slope"].map(c=>m``)}
${a&&!this._floorId?i([t.explode,()=>this.setPref("explode",!0),r("floors_apart")],[!t.explode,()=>this.setPref("explode",!1),r("floors_stacked")]):f}
${!this._floorId&&e.settings.roof.type!=="none"?m`
`:f}
${a&&this._floorId?m`
${s.map(c=>m``)}
`:f}
${o.map(c=>m``)}
${this.toggleChip("roomNames","room_names_short")}
${this.toggleChip("weather","weather_short","weather_hint")}
${t.timeSlider?this.renderTimeOfDay():f}
${u}${l}
`:m`${u}${l}
`}renderView(e){if(!e.floors.some(i=>i.rooms.length||i.outdoor.length||i.furniture.length))return m`
${this.t(this.isAdmin?e.floors.length?"no_rooms_admin":"no_building_admin":"no_building")}
${this.isAdmin?m`
`:f}
`;let t=this._prefs,r=e.floors.flatMap(i=>i.rooms).find(i=>i.id===this._roomId)??null;return this.furnishHost.hass=this.hass,this.furnishHost.building=e,m`
${t.clean?f:this.renderNav(e)}
this.setPref("clean",!t.clean)}
?weather=${t.weather}
.panelOpen=${!!this._roomId||this._outside}
.floorId=${e.topology||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=${pi(t.theme,this.sunState())}
.timeOfDay=${this._timeOfDay}
.clock=${t.clock==="none"?null:t.clock}
.announcements=${!V(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=>_d(o,i.detail.id,i.detail.x,i.detail.z))}
@device-select=${i=>this._selDevice=i.detail.id}
@device-move=${i=>this.applyEdit(o=>gd(o,i.detail.id,i.detail.x,i.detail.z))}
.quality=${t.quality}
?showStats=${t.stats}
@room-tap=${this.onRoomTap}
@topology-tap=${i=>this.openTopology(i.detail)}
@floor-tap=${i=>this.openFloor(i.detail.floorId)}
@back=${()=>this.back()}
>
${r?m`i.rooms.some(o=>o.id===this._roomId))??null}
.confirmEntities=${Mt(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?m`this._outside=!1}
>`:f}
${t.clean?f:this.renderOverlay(e)}
${this._furnish?wd(this.furnishHost,this._selFurniture,this._selDevice):f}
`}static styles=[Se,We,$d,Gr]};customElements.get("nextfloor-panel")||customElements.define("nextfloor-panel",ks);var $g=/^(\d{1,2}):(\d{2})\s*-\s*(\d{1,2}):(\d{2})$/,Rd=(n,e)=>Number(n)*60+Number(e);function nr(n,e,t=new Date){if(!n||n==="off")return!1;if(n==="sun")return e?.states["sun.sun"]?.state==="below_horizon";let r=$g.exec(n.trim());if(!r)return!1;let i=Rd(r[1],r[2]),o=Rd(r[3],r[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(nr(this.host.config()?.night,this.host.hass())),6e4)}stop(){clearTimeout(this.cleanTimer),clearTimeout(this.idleTimer),clearInterval(this.nightTimer)}};function Ed(n,e){return n?n.floors.filter(t=>(e===null||t.id===e)&&t.rooms.length>0).map(t=>({floorId:t.id,floorName:t.name,rooms:t.rooms.map(r=>({id:r.id,name:r.name||"\u2013",floorId:t.id}))})):[]}var zd=J`
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 Ss(n,e){let t=n.template,r=t?e?.[t]:void 0;if(!r)return n;let{type:i,template:o,...s}=r;return{...s,...n}}function Td(n,e){let t=new Set(e),r=[];for(let o of n.floors){let s=o.rooms.filter(u=>t.has(u.id));if(!s.length)continue;let a=(u,c)=>s.some(d=>d.points.length>=3&&H([u,c],d.points)),l=new Set(s.map(u=>u.id));r.push({...o,rooms:s,openings:o.openings.filter(u=>l.has(u.room_id)),furniture:o.furniture.filter(u=>a(u.x,u.z)),placements:o.placements.filter(u=>a(u.x,u.z)),walls:(o.walls??[]).filter(u=>a((u.a[0]+u.b[0])/2,(u.a[1]+u.b[1])/2)),outdoor:[]})}let i={...n.settings.roof,type:"none",sections:[],solar:[]};return{...n,floors:r,settings:{...n.settings,roof:i}}}var Dt="nf-outside",$s=class extends Q{static properties={hass:{attribute:!1},_config:{state:!0},_roomId:{state:!0},_topologyGroup:{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 Vt(this);kiosk=new Ei({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._topologyGroup=_e,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._topologyGroup=_e,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 ar(),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=Ss(e,this.data.building?.settings.card_templates),this._floorId=void 0,this._topologyGroup=_e,this._walls=null,this._heat=null,this._explode=null,this._orbit=!1,this._night=nr(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=Ss(this._own,t)),this.toggleAttribute("readable",this._config?.readable===!0),e.has("hass")&&(this.style.colorScheme=Ur(this.hass)),!e.has("hass")||!this.hass)return;this.data.setHass(this.hass);let r=nr(this._config?.night,this.hass);r!==this._night&&(this._night=r)}get canSwitch(){return!this._config?.floor||this.thumbs}get thumbs(){return this._config?.floor_thumbs??!this._config?.floor}topologySelection(){let e=this.plan(),t=this.stage().floorId;return e&&t?Ce(e,t,this._roomId===Dt?null:this._roomId):this._topologyGroup}openTopology(e){let t=this.plan();t&&(this._floorId=e.kind==="room"?e.floorId??null:e.kind==="floor"?e.id??null:lt(t,e)?.id??null,this._roomId=e.kind==="room"?e.id??null:null,this._topologyGroup=e)}back(){this._roomId?this._roomId=null:this.plan()?.topology?this.openTopology(xn(this.plan(),this.topologySelection())):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 r=t.join(",");return(!this.roomsMemo||this.roomsMemo.source!==e||this.roomsMemo.ids!==r)&&(this.roomsMemo={source:e,ids:r,result:Td(e,t)}),this.roomsMemo.result}t=e=>M(this.hass,e);stage(){let e=this.plan(),t=this._config,r=this._floorId===void 0?t?.floor??null:this._floorId,i=e&&!e.topology&&e.floors.length===1?e.floors[0].id:e?.floors.some(a=>a.id===r)?r: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(),r=this.t,i=["temperature","humidity","co2"].filter(s=>this.shows(s)),o=(s,a)=>m`${a.map(([l,u,c])=>m``)}
`;return m`
${e.canGoBack?m``:f}
${this.shows("walls")?o(void 0,[[e.walls==="auto",()=>this._walls="auto",r("walls_auto")],[e.walls==="cut",()=>this._walls="cut",r("walls_cut")],[e.walls==="slope",()=>this._walls="slope",r("walls_slope")]]):f}
${this.shows("floors")&&t.floors.length>1&&!e.floorId?o(void 0,[[e.explode,()=>this._explode=!0,r("floors_apart")],[!e.explode,()=>this._explode=!1,r("floors_stacked")]]):f}
${i.length>0?o(r("heatmap"),["none",...i].map(s=>[e.heat===s,()=>this._heat=s,r(s==="none"?"heat_off":`heat_short_${s}`)])):f}
`}renderRoomButtons(e){let t=this.plan();if(!this._config?.room_buttons||!t||this._clean)return f;if(t.topology&&(!e.floorId||wn(t.floors.find(l=>l.id===e.floorId))))return f;let r=Ed(t,e.floorId);if(!r.length)return f;let i=r.length>1,o=(l,u)=>{this.canSwitch&&l!==e.floorId&&(this._floorId=l),this._roomId=u===this._roomId?null:u},s=!t.topology&&jt(this.hass,t.floors).length>0,a=()=>{this.canSwitch&&(this._floorId=null),this._roomId=this._roomId===Dt?null:Dt};return m`
${r.map(l=>m`${i?m`${l.floorName}`:f}${l.rooms.map(u=>m``)}`)}
${s?m``:f}
`}renderCorners(){let e=this._config,t=this.t,r=this._clean||!!this._roomId&&e?.room_panel!==!1;return m`${e?.fullscreen_button&&!r?m``:f}
${e?.dashboard&&!r?m``:f}`}renderStage(e){let t=this.plan(),r=this._config,i=()=>{this._clean=!this._clean,this._clean?this.kiosk.stopClean():this.kiosk.armClean()},o=r?.controls_hidden!==void 0||(r?.controls_hide_after??0)>0;return m`({id:`card_${a}`,...s}))??null}
.heatMode=${e.heat}
.theme=${pi(r?.theme,this.hass?.states["sun.sun"]?.state)}
.clock=${r?.clock&&r.clock!=="none"?r.clock:null}
.lockButton=${r?.lock_button!==!1}
.walkButton=${r?.walk_button!==!1}
.travelButton=${r?.time_travel!==!1}
.accent=${r?.accent??null}
.furnitureColors=${r?.furniture_colors??null}
.showEnergy=${r?.energy??!0}
.flows=${r?.flows??null}
.holograms=${r?.holograms??null}
.floorThumbs=${this.thumbs}
.roomLabels=${this._roomNames??r?.room_names!==!1}
.roomNamesButton=${!0}
@room-names-change=${s=>this._roomNames=s.detail.value}
.floorStack=${r?.floor_stack??"dim"}
.panelOpen=${!!this._roomId&&r?.room_panel!==!1}
.alerts=${r?.alerts!==!1}
.alertJump=${!!r?.alert_jump}
.announcements=${!V(this.hass)&&r?.announcements!==!1&&!Sd()}
.sensorBar=${r?.sensor_bar!==!1}
.glassWalls=${typeof r?.glass_walls=="number"?Math.min(100,Math.max(0,r.glass_walls)):null}
.screenName=${r?.screen_name??kd()}
.scenes=${r?.scenes!==!1}
.clean=${this._clean}
.cleanButton=${o}
@clean-toggle=${i}
?weather=${r?.weather!==!1}
.weatherEntityId=${r?.weather_entity??null}
.weatherDensity=${r?.weather_density??1}
.dimmed=${this._night}
.autoOrbit=${this._orbit}
.startView=${r?.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)}}
@topology-tap=${s=>{this.canSwitch&&this.openTopology(s.detail)}}
@floor-tap=${s=>{this._floorId=s.detail.floorId,this._roomId=null,this._topologyGroup=_e}}
@back=${()=>this.back()}
>`}renderRoomPanel(){let e=this.plan();return m`t.rooms).find(t=>t.id===this._roomId)??null}
.floor=${e.floors.find(t=>t.rooms.some(r=>r.id===this._roomId))??null}
.outside=${this._roomId===Dt?jt(this.hass,xr(e,this.topologySelection())):null}
.confirmEntities=${Mt(this.hass,e.floors)}
.phrases=${e.settings.announce_phrases??null}
@close=${()=>this._roomId=null}
>`}render(){if(this.hass&&Lr(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 r=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 m`
${e&&e.floors.some(a=>a.rooms.length)?this.renderStage(r):m`
${this.data.error??(e?M(this.hass,"no_building"):M(this.hass,"loading"))}
`}
${this._roomId&&e&&t?.room_panel!==!1?this.renderRoomPanel():f}
${this.renderRoomButtons(r)}
${r.showBar&&e?this.renderBar(r):f}
${this.renderCorners()}
`}static styles=[Se,We,zd,Gr]};if(!customElements.get("nextfloor-card")){customElements.define("nextfloor-card",$s);let n=window;n.customCards=n.customCards??[],n.customCards.push({type:"nextfloor-card",name:M(void 0,"card_name"),description:M(void 0,"card_description"),preview:!1})}qi();
/*! 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
*)
*/