+ `,Kt=1e3;function Vt(t){return t&&Array.isArray(t.spaces)?t.spaces.map(t=>{const e=Kt/t.aspect;return{id:t.id,title:t.title,vb:[t.view_box[0]*Kt,t.view_box[1]*e,t.view_box[2]*Kt,t.view_box[3]*e],bg:t.plan_url?{href:t.plan_url,x:0,y:0,w:Kt,h:e}:null,rooms:(t.rooms||[]).map(t=>({id:t.id,name:t.name,area:t.area??null,x:null!=t.x?t.x*Kt:void 0,y:null!=t.y?t.y*e:void 0,w:null!=t.w?t.w*Kt:void 0,h:null!=t.h?t.h*e:void 0,poly:t.poly?t.poly.map(t=>[t[0]*Kt,t[1]*e]):void 0}))}}):[]}function Zt(t){if(t.poly&&t.poly.length){const e=t.poly.map(t=>t[0]),i=t.poly.map(t=>t[1]),s=Math.min(...e),a=Math.min(...i);return{x:s,y:a,w:Math.max(...e)-s,h:Math.max(...i)-a}}return{x:t.x??0,y:t.y??0,w:t.w??0,h:t.h??0}}function Yt(t){if(t.poly){const e=t.poly.length;return[t.poly.reduce((t,e)=>t+e[0],0)/e,t.poly.reduce((t,e)=>t+e[1],0)/e]}return[t.x+t.w/2,t.y+.1*Math.min(t.w,t.h)]}function Jt(t){const e=Vt(t.cfg),i=e.find(e=>e.id===t.spaceId);if(!i)return null;const s=i.vb,a=Mt(t.cfg.spaces.find(e=>e.id===t.spaceId)),o=t.iconSize??2.5,r=o>8?2.5:o,n={};for(const e of t.cfg.spaces||[])for(const t of e.rooms||[])t.area&&(n[t.area]=e.id);const l=t.cfg.settings?.exclude_integrations?new Set(t.cfg.settings.exclude_integrations):ht,c=pt(t.cfg.settings?.icon_rules?.length?t.cfg.settings.icon_rules:dt),h=It({hass:t.hass,areaToSpace:n,markers:t.cfg.markers||[],settings:t.cfg.settings||{},excluded:l,showAll:!!t.cfg.settings?.show_all,firstSpaceId:e[0]?.id||"",loc:e=>jt(t.lang,e),iconRules:c}),d=h.filter(e=>e.space===t.spaceId),p=function(t,e,i){const s={},a=i/100*Kt*1.3;for(const i of e.rooms){if(!i.area)continue;const e=t.filter(t=>t.area===i.area);if(!e.length)continue;const o=Zt(i),r=.1*Math.min(o.w,o.h),n=o.w-2*r,l=o.h-2*r,c=Math.max(1,Math.round(Math.sqrt(e.length*n/Math.max(l,1)))),h=n/c,d=l/Math.max(Math.ceil(e.length/c),1),p=e.map((t,e)=>({x:o.x+r+h*(e%c+.5),y:o.y+r+d*(Math.floor(e/c)+.5)}));wt(p,o,a,.5*r),e.forEach((t,e)=>s[t.id]=p[e])}return s}(d,i,r),_=i.rooms.filter(t=>t.area||a.showBorders).map(e=>{let s="room "+(i.bg?"overlay":"yard"),o="";if(a.showBorders||"none"!==a.fill){s+=" styled";const i=[`--room-stroke:${a.color}`,`--room-stroke-op:${a.showBorders?a.opacity:0}`],r=e.area?Dt(a.fill,"lqi"===a.fill?function(t,e,i){const s=[];for(const a of e){if(a.area!==i||a.virtual)continue;const e=Tt(t,a.entities);null!=e&&s.push(e)}return yt(s)}(t.hass,d,e.area):null,"light"===a.fill?Ut(t.hass,d,e.area):"none","temp"===a.fill?qt(t.hass,d,e.area):null,a.tempMin,a.tempMax):null;r?(s+=" filled",i.push(`--room-fill:${r}`,`--room-fill-op:${(.3*a.opacity).toFixed(3)}`)):i.push("--room-fill:transparent","--room-fill-op:0"),o=i.join(";")}const r=!i.bg&&!a.showNames,n=Yt(e),l=e.poly?B`
`:B`
`;return B`${l}${r?B`
${e.name}`:K}`}),u=d.map(e=>{const a=function(t,e,i,s,a){const o=e[t.id];if(o&&o.s===t.space){const e=i.spaces.find(e=>e.id===t.space)?.aspect||1;return{x:o.x*Kt,y:o.y*(Kt/e)}}if(s[t.id])return s[t.id];const r=a.vb;return{x:r[0]+r[2]/2,y:r[1]+r[3]/2}}(e,t.layout,t.cfg,p,i),o=(a.x-s[0])/s[2]*100,r=(a.y-s[1])/s[3]*100;return j`
-
`}),m=a.showNames?i.rooms.filter(t=>t.name).map(e=>{const o=function(t,e,i,s){const a=i["rl_"+(t.id||"")];if(a&&a.s===e){const t=s.spaces.find(t=>t.id===e)?.aspect||1;return{x:a.x*Bt,y:a.y*(Bt/t)}}const o=Vt(t);return{x:o[0],y:o[1]}}(e,i.id,t.layout,t.cfg),r=(o.x-s[0])/s[2]*100,n=(o.y-s[1])/s[3]*100,l=Math.min(1,a.opacity+.25);return j`
${e.name}
`}):[];return j`
+
`}),m=a.showNames?i.rooms.filter(t=>t.name).map(e=>{const o=function(t,e,i,s){const a=i["rl_"+(t.id||"")];if(a&&a.s===e){const t=s.spaces.find(t=>t.id===e)?.aspect||1;return{x:a.x*Kt,y:a.y*(Kt/t)}}const o=Yt(t);return{x:o[0],y:o[1]}}(e,i.id,t.layout,t.cfg),r=(o.x-s[0])/s[2]*100,n=(o.y-s[1])/s[3]*100,l=Math.min(1,a.opacity+.25);return j`