+ ${t.controls.length?j`
+ ${t.controls.map(e=>j`
${this.hass.states[e]?.attributes?.friendly_name||e}
this._markerDialog={...t,controls:t.controls.filter(t=>t!==e)}}>
`)}
@@ -5110,8 +5156,8 @@ globalThis.__HOUSEPLAN_BUILD_FINGERPRINT__="632caa531a2449590d979a92f8d99ab07114
this._markerDialog={...t,controlsFilter:e.target.value}} />
- ${t.controlsFilter.trim()?W`
- ${Object.keys(this.hass.states).filter(e=>Qs(t.binding,[e],s).length>0&&!t.controls.includes(e)&&this._planEntityAvailable(e)).filter(e=>{const i=t.controlsFilter.trim().toLowerCase(),s=String(this.hass.states[e]?.attributes?.friendly_name||"");return e.toLowerCase().includes(i)||s.toLowerCase().includes(i)}).slice(0,8).map(e=>W`
`:G}
- ${this._bindingHasClimate(t.binding)?W`
${this._t("marker.icon_label")}
- ${customElements.get("ha-icon-picker")?W`{const i=e.detail.value||"";(t.icon||i!==t.autoIcon)&&(this._markerDialog={...t,icon:i})}}>`:W`{const i=e.detail.value||"";(t.icon||i!==t.autoIcon)&&(this._markerDialog={...t,icon:i})}}>`:j`this._markerDialog={...t,icon:e.target.value}} />`}
- ${!t.icon&&t.autoIcon?W`
+ ${!t.icon&&t.autoIcon?j`
${this._t("marker.icon_auto",{icon:t.autoIcon})}
this._markerDialog={...t,icon:t.autoIcon}}>
@@ -5155,23 +5201,23 @@ globalThis.__HOUSEPLAN_BUILD_FINGERPRINT__="632caa531a2449590d979a92f8d99ab07114
${this._t("marker.display_label")}
${this._t("marker.display_hint")}
- ${"static_icon"===t.display&&this._bindingHasAlarm(t.binding)?W`
+ ${"static_icon"===t.display&&this._bindingHasAlarm(t.binding)?j`
${this._t("marker.static_alarm_warning")}
`:G}
- ${l?W`
- `:W`
+ `:j`
${this._t("marker.preview.select_source")}
`}
- ${"icon_ripple"===t.display?W`
+ ${"icon_ripple"===t.display?j`
${this._t("marker.activity_color")}
this._markerDialog={...t,rippleColor:e.target.value}} />
@@ -5207,7 +5253,7 @@ globalThis.__HOUSEPLAN_BUILD_FINGERPRINT__="632caa531a2449590d979a92f8d99ab07114
${this._t("marker.manuals_label")}
- ${t.pdfs.map(t=>W`
+ ${t.pdfs.map(t=>j`
${t.name}
this._removeMarkerPdf(t.url)}>`)}
@@ -5219,7 +5265,7 @@ globalThis.__HOUSEPLAN_BUILD_FINGERPRINT__="632caa531a2449590d979a92f8d99ab07114
- `}_renderSpaceDialog(){const t=this._spaceDialog,e=this._importTotal>0&&"create"===t.mode?this._t("import.progress",{i:this._importTotal-this._importQueue.length,n:this._importTotal}):"",i=()=>{this._spaceDialog=null,this._importQueue=[],this._importTotal=0};return W`
`}_renderSpaceDialog(){const t=this._spaceDialog,e=this._importTotal>0&&"create"===t.mode?this._t("import.progress",{i:this._importTotal-this._importQueue.length,n:this._importTotal}):"",i=()=>{this._spaceDialog=null,this._importQueue=[],this._importTotal=0};return j`
@@ -5256,8 +5302,8 @@ globalThis.__HOUSEPLAN_BUILD_FINGERPRINT__="632caa531a2449590d979a92f8d99ab07114
@change=${()=>this._spaceDialog={...t,source:"file"}} />
${this._t("space.source_file")}
- ${"file"===t.source?W`
- ${t.planFile?W`
${t.planFile.name}`:t.planUrl?W`
})
`:W`
${this._t("space.no_plan")}`}
+ ${"file"===t.source?j`
+ ${t.planFile?j`
${t.planFile.name}`:t.planUrl?j`
})
`:j`
${this._t("space.no_plan")}`}
${t.planUrl||t.planFile?this._t("btn.replace"):this._t("btn.upload")}
- {const i=nc(e.target.value);this._spaceDialog={...t,cellCm:null!=i&&i>0?Math.max(.1,Math.min(ec,i)):t.cellCm}}} />
+ @input=${e=>{const i=lc(e.target.value);this._spaceDialog={...t,cellCm:null!=i&&i>0?Math.max(.1,Math.min(oc,i)):t.cellCm}}} />
${this._t("space.scale_unit")}
@@ -5308,7 +5354,7 @@ globalThis.__HOUSEPLAN_BUILD_FINGERPRINT__="632caa531a2449590d979a92f8d99ab07114
${this._t("space.hide_openings_tip")}
${this._t("space.roomcard_section")}
- ${[["labelTemp","space.label_temp"],["labelHum","space.label_hum"],["labelLqi","space.label_lqi"],["labelLight","space.label_light"]].map(([e,i])=>W`
+ ${[["labelTemp","space.label_temp"],["labelHum","space.label_hum"],["labelLqi","space.label_lqi"],["labelLight","space.label_light"]].map(([e,i])=>j`
${this._boolInput(t[e],i=>this._spaceDialog={...t,[e]:i})}
${this._t(i)}
`)}
@@ -5333,12 +5379,12 @@ globalThis.__HOUSEPLAN_BUILD_FINGERPRINT__="632caa531a2449590d979a92f8d99ab07114
- ${"static"===(t.bgMode??xo(this._settings,{}))?W`${this._t("space.bg_color")}
+ ${"static"===(t.bgMode??$o(this._settings,{}))?j`${this._t("space.bg_color")}
this._spaceDialog={...t,bgColor:e.target.value}} />
- ${t.bgColor?W`this._spaceDialog={...t,bgColor:null}}>
- ${this._t("space.bg_inherit")}`:W`${this._t("space.bg_inherited")}`}
+ ${t.bgColor?j`this._spaceDialog={...t,bgColor:null}}>
+ ${this._t("space.bg_inherit")}`:j`${this._t("space.bg_inherited")}`}
`:G}
${this._t("space.north")}
@@ -5346,7 +5392,7 @@ globalThis.__HOUSEPLAN_BUILD_FINGERPRINT__="632caa531a2449590d979a92f8d99ab07114
placeholder=${this._t("space.sun_inherit")}
.value=${null===t.northDeg?"":String(t.northDeg)}
@input=${e=>{const i=e.target.value.trim(),s=""===i?null:Math.round(Number(i));this._spaceDialog={...t,northDeg:null!==s&&Number.isFinite(s)?Math.min(359,Math.max(0,s)):null}}} />
- ${null===t.northDeg?this._t("space.north_inherited",{v:null===ko(this._settings,{})?"—":String(ko(this._settings,{}))+"°"}):"°"}
+ ${null===t.northDeg?this._t("space.north_inherited",{v:null===xo(this._settings,{})?"—":String(xo(this._settings,{}))+"°"}):"°"}
${this._t("space.sun_rays")}
${this._t("space.fill_label")}
- ${mi.map(t=>[t,"fill."+t]).map(([e,i])=>W`
+ ${mi.map(t=>[t,"fill."+t]).map(([e,i])=>j`
this._spaceDialog={...t,fillMode:e}} />
${this._t(i)}
- ${"temp"===e&&"temp"===t.fillMode?W`
+ ${"temp"===e&&"temp"===t.fillMode?j`
{const i=nc(e.target.value);null!=i&&(this._spaceDialog={...t,tempMin:i})}} />
+ @input=${e=>{const i=lc(e.target.value);null!=i&&(this._spaceDialog={...t,tempMin:i})}} />
–
{const i=nc(e.target.value);null!=i&&(this._spaceDialog={...t,tempMax:i})}} />
+ @input=${e=>{const i=lc(e.target.value);null!=i&&(this._spaceDialog={...t,tempMax:i})}} />
°C
`:G}
`)}
+
+ ${this._boolInput(t.glowEnabled,e=>{this._spaceDialog={...t,glowEnabled:e}})}
+ ${this._t("space.glow_enabled")}
+
- ${"edit"===t.mode?W`
+ ${"edit"===t.mode?j`
${this._t("btn.delete")}
`:G}
- ${this._importTotal>0&&"create"===t.mode?W`this._skipImport()}>${this._t("btn.skip")}`:G}
+ ${this._importTotal>0&&"create"===t.mode?j`this._skipImport()}>${this._t("btn.skip")}`:G}
${this._t("btn.cancel")}
${t.busy?"…":this._t("btn.save")}
- `}_renderMergeDialog(){const t=this._mergeDialog,e=this._spaceModel().rooms,i=(i,s)=>{const n=e.find(t=>t.id===i),o=n?.area?this.hass.areas[n.area]?.name:null;return W`
+ `}_renderMergeDialog(){const t=this._mergeDialog,e=this._spaceModel().rooms,i=(i,s)=>{const n=e.find(t=>t.id===i),o=n?.area?this.hass.areas[n.area]?.name:null;return j`
this._mergeDialog={...t,pick:s}} />
${n?.name||""} · ${o||this._t("merge.no_area")}
- `};return W``};return j`this._mergeDialog=null}>
${this._t("merge.hint")}
@@ -5402,7 +5452,7 @@ globalThis.__HOUSEPLAN_BUILD_FINGERPRINT__="632caa531a2449590d979a92f8d99ab07114
${this._t("btn.save")}
- `}_renderCardPreview(t,e,i){const s=18*t;return W`
+ `}_renderCardPreview(t,e,i){const s=18*t;return j`
${this._t("preview.room_name")}
@@ -5410,7 +5460,7 @@ globalThis.__HOUSEPLAN_BUILD_FINGERPRINT__="632caa531a2449590d979a92f8d99ab07114
45% ·
${this._t("roomcard.light_partial",{on:1,total:3})}
-
`}_renderRoomSource(t){const e="temp"===t?this._roomTempSrc:this._roomHumSrc,i=e=>{"temp"===t?this._roomTempSrc=e:this._roomHumSrc=e,this.requestUpdate()},s=this._roomSrcOpen===t;return W`
+
`}_renderRoomSource(t){const e="temp"===t?this._roomTempSrc:this._roomHumSrc,i=e=>{"temp"===t?this._roomTempSrc=e:this._roomHumSrc=e,this.requestUpdate()},s=this._roomSrcOpen===t;return j`
${this._t("temp"===t?"room.temp_src_label":"room.hum_src_label")}
${this._t("room.src_pick")}
- ${e||s?W`{this._roomSrcOpen=s?null:t,this._roomSrcFilter=""}}>
- ${e?W`${this._roomSrcLabel(e)}${e}`:W`${this._t("room.src_ph")}`}
+ ${e?j`${this._roomSrcLabel(e)}${e}`:j`${this._t("room.src_ph")}`}
- ${s?W`
+ ${s?j`
{this._roomSrcFilter=t.target.value,this.requestUpdate()}} />
- ${this._roomSrcCandidates().map(t=>W`
j`
{i(t.value),this._roomSrcOpen=null}}>
${t.label}${t.sub}
`)}
-
`:G}`:G}`}_renderRoomDialog(){const t=!!this._roomEditId,e=!!this._areaSel||!!this._nameSel.trim(),i=[...this._freeAreas];if(t&&this._areaSel&&!i.some(t=>t.area_id===this._areaSel)){const t=this.hass.areas[this._areaSel];t&&i.unshift(t)}return W`
`:G}`:G}`}_renderRoomDialog(){const t=!!this._roomEditId,e=!!this._areaSel||!!this._nameSel.trim(),i=[...this._freeAreas];if(t&&this._areaSel&&!i.some(t=>t.area_id===this._areaSel)){const t=this.hass.areas[this._areaSel];t&&i.unshift(t)}return j`
@@ -5449,12 +5499,12 @@ globalThis.__HOUSEPLAN_BUILD_FINGERPRINT__="632caa531a2449590d979a92f8d99ab07114
${this._t("room.settings_section")}
${this._t("room.fill_label")}
- ${[["","fill.inherit"],...gi.map(t=>[t,"fill."+t])].map(([t,e])=>W`
+ ${[["","fill.inherit"],...gi.map(t=>[t,"fill."+t])].map(([t,e])=>j`
{this._roomFill=t,this.requestUpdate()}} />
${this._t(e)}
@@ -5478,13 +5528,13 @@ globalThis.__HOUSEPLAN_BUILD_FINGERPRINT__="632caa531a2449590d979a92f8d99ab07114
- `}}Mc.properties={_hdrH:{state:!0},_booting:{state:!0},_bootFading:{state:!0},_bootSoft:{state:!0},_tapConfirm:{state:!0},hass:{attribute:!1},_config:{state:!0},_space:{state:!0},_layout:{state:!0},_devices:{state:!0},_tip:{state:!0},_hoverRoom:{state:!0},_selId:{state:!0},_toast:{state:!0},_serverCfg:{state:!0},_mode:{state:!0},_tool:{state:!0},_wallDialog:{state:!0},_drawWallField:{state:!0},_activeDraftId:{state:!0},_physicalSel:{state:!0},_physicalDialog:{state:!0},_physicalDrag:{state:!0},_physicalRotate:{state:!0},_duplicateColumnId:{state:!0},_rszSel:{state:!0},_rszLive:{state:!0},_opMeasure:{state:!0},_path:{state:!0},_cursorPt:{state:!0},_mergeSel:{state:!0},_openingDialog:{state:!0},_openingInfo:{state:!0},_mergeDialog:{state:!0},_openWallAnchor:{state:!0},_splitSel:{state:!0},_decorTool:{state:!0},_decorStyle:{state:!0},_decorDraft:{state:!0},_decorSel:{state:!0},_decorEraseConfirm:{state:!0},_decorTextDialog:{state:!0},_decorShapeDialog:{state:!0},_backdropDialog:{state:!0},_furnPalette:{state:!0},_bdDrag:{state:!0},_dtBox:{state:!0},_dtDrag:{state:!0},_kioskDialog:{state:!0},_vacFit:{state:!0},_vacAllCamerasFor:{state:!0},_vacCalConfirm:{state:!0},_kioskDots:{state:!0},_areaSel:{state:!0},_nameSel:{state:!0},_roomDialog:{state:!0},_roomEditId:{state:!0},_roomFill:{state:!0},_roomTempSrc:{state:!0},_roomHumSrc:{state:!0},_roomSrcOpen:{state:!0},_roomSrcFilter:{state:!0},_roomNameScale:{state:!0},_roomLabelScale:{state:!0},_spaceDialog:{state:!0},_infoCard:{state:!0},_rulesDialog:{state:!0},_settingsDialog:{state:!0},_alignDialog:{state:!0},_importDialog:{state:!0},_markerDialog:{state:!0},_zoom:{state:!0},_view:{state:!0}},Mc.ZOOM_MAX=8,Mc.ZOOM_MIN=1/3,Mc._touchSeen=!1,Mc._noHoverMq="undefined"!=typeof window&&"function"==typeof window.matchMedia&&window.matchMedia("(hover: none)").matches,Mc.styles=[yt,Nl],customElements.get("houseplan-card")||customElements.define("houseplan-card",Mc),window.customCards=window.customCards||[],window.customCards.find(t=>"houseplan-card"===t.type)||window.customCards.push({type:"houseplan-card",name:"House Plan Card",description:"Interactive house plan: spaces, rooms and devices with live states and drag layout."}),console.info(`%c HOUSEPLAN-CARD %c v${Ql} `,"background:#3ea6ff;color:#04121f;font-weight:700","");
+ `}}Pc.properties={_hdrH:{state:!0},_booting:{state:!0},_bootFading:{state:!0},_bootSoft:{state:!0},_tapConfirm:{state:!0},hass:{attribute:!1},_config:{state:!0},_space:{state:!0},_layout:{state:!0},_devices:{state:!0},_tip:{state:!0},_hoverRoom:{state:!0},_selId:{state:!0},_toast:{state:!0},_serverCfg:{state:!0},_mode:{state:!0},_tool:{state:!0},_wallDialog:{state:!0},_drawWallField:{state:!0},_activeDraftId:{state:!0},_physicalSel:{state:!0},_physicalDialog:{state:!0},_physicalDrag:{state:!0},_physicalRotate:{state:!0},_duplicateColumnId:{state:!0},_rszSel:{state:!0},_rszLive:{state:!0},_opMeasure:{state:!0},_path:{state:!0},_cursorPt:{state:!0},_mergeSel:{state:!0},_openingDialog:{state:!0},_openingInfo:{state:!0},_mergeDialog:{state:!0},_openWallAnchor:{state:!0},_splitSel:{state:!0},_decorTool:{state:!0},_decorStyle:{state:!0},_decorDraft:{state:!0},_decorSel:{state:!0},_decorEraseConfirm:{state:!0},_decorTextDialog:{state:!0},_decorShapeDialog:{state:!0},_backdropDialog:{state:!0},_furnPalette:{state:!0},_bdDrag:{state:!0},_dtBox:{state:!0},_dtDrag:{state:!0},_kioskDialog:{state:!0},_vacFit:{state:!0},_vacAllCamerasFor:{state:!0},_vacCalConfirm:{state:!0},_kioskDots:{state:!0},_areaSel:{state:!0},_nameSel:{state:!0},_roomDialog:{state:!0},_roomEditId:{state:!0},_roomFill:{state:!0},_roomTempSrc:{state:!0},_roomHumSrc:{state:!0},_roomSrcOpen:{state:!0},_roomSrcFilter:{state:!0},_roomNameScale:{state:!0},_roomLabelScale:{state:!0},_spaceDialog:{state:!0},_infoCard:{state:!0},_rulesDialog:{state:!0},_settingsDialog:{state:!0},_alignDialog:{state:!0},_importDialog:{state:!0},_markerDialog:{state:!0},_zoom:{state:!0},_view:{state:!0}},Pc.ZOOM_MAX=8,Pc.ZOOM_MIN=1/3,Pc._touchSeen=!1,Pc._noHoverMq="undefined"!=typeof window&&"function"==typeof window.matchMedia&&window.matchMedia("(hover: none)").matches,Pc.styles=[yt,Ol],customElements.get("houseplan-card")||customElements.define("houseplan-card",Pc),window.customCards=window.customCards||[],window.customCards.find(t=>"houseplan-card"===t.type)||window.customCards.push({type:"houseplan-card",name:"House Plan Card",description:"Interactive house plan: spaces, rooms and devices with live states and drag layout."}),console.info(`%c HOUSEPLAN-CARD %c v${sc} `,"background:#3ea6ff;color:#04121f;font-weight:700","");
diff --git a/custom_components/houseplan/manifest.json b/custom_components/houseplan/manifest.json
index 1e08d475..34fff542 100755
--- a/custom_components/houseplan/manifest.json
+++ b/custom_components/houseplan/manifest.json
@@ -16,5 +16,5 @@
"issue_tracker": "https://github.com/Matysh/houseplan-card/issues",
"requirements": [],
"single_config_entry": true,
- "version": "1.61.0-beta.1"
+ "version": "1.61.0-beta.2"
}
diff --git a/custom_components/houseplan/validation.py b/custom_components/houseplan/validation.py
index 73931001..265fe614 100644
--- a/custom_components/houseplan/validation.py
+++ b/custom_components/houseplan/validation.py
@@ -215,7 +215,8 @@ ROOM_SCHEMA = vol.All(
None,
vol.Schema(
{
- vol.Optional("fill_mode"): vol.Any(None, vol.In(["none", "lqi", "light", "temp"])),
+ vol.Optional("fill_mode"): vol.Any(None, vol.In(["none", "lqi", "light", "temp", "glow"])),
+ vol.Optional("glow"): vol.Any(bool, None),
vol.Optional("temp_source"): vol.Any(str, None),
vol.Optional("hum_source"): vol.Any(str, None),
vol.Optional("name_scale"): vol.Any(None, vol.All(vol.Coerce(float), vol.Range(min=0.5, max=3))),
@@ -259,6 +260,7 @@ SPACE_DISPLAY_SCHEMA = vol.Schema(
vol.Optional("bg_color"): _COLOR,
vol.Optional("room_opacity"): vol.All(vol.Coerce(float), vol.Range(min=0, max=1)),
vol.Optional("fill_mode"): vol.In(["none", "lqi", "light", "temp", "glow"]),
+ vol.Optional("glow_enabled"): bool,
vol.Optional("temp_min"): vol.Coerce(float),
vol.Optional("temp_max"): vol.Coerce(float),
vol.Optional("show_lqi"): bool,
diff --git a/demo/benchmark_glow.mjs b/demo/benchmark_glow.mjs
new file mode 100644
index 00000000..50f9cd62
--- /dev/null
+++ b/demo/benchmark_glow.mjs
@@ -0,0 +1,292 @@
+#!/usr/bin/env node
+/** Isolated 1/10/30/60-pool performance profiles for #19 and #55. */
+import { mkdirSync, readFileSync, writeFileSync } from 'node:fs';
+import { dirname, resolve } from 'node:path';
+import { performance } from 'node:perf_hooks';
+import { launch } from './serve.mjs';
+import { assertFreshDemoBundle } from './bundle-freshness.mjs';
+import { summarizeLongTasks, summarizeTimings } from './performance/evaluate.mjs';
+import { makeLargeHouseFixture } from './fixtures/large-house.mjs';
+
+const valueArg = (name) => process.argv.find((arg) => arg.startsWith(`--${name}=`))?.slice(name.length + 3);
+const profile = valueArg('profile') || 'large-light-blend-v1';
+if (!['large-light-blend-v1', 'large-house-glow-overlay-v1'].includes(profile))
+ throw new Error(`unknown Glow profile: ${profile}`);
+const parsedSamples = Number(valueArg('samples'));
+const parsedWarmups = Number(valueArg('warmups'));
+const samples = Math.max(1, Math.min(20, Number.isFinite(parsedSamples) && parsedSamples > 0 ? parsedSamples : 7));
+const warmups = Math.max(0, Math.min(5, Number.isFinite(parsedWarmups) && parsedWarmups >= 0 ? parsedWarmups : 1));
+const output = valueArg('output') ? resolve(valueArg('output')) : null;
+const targetRoot = resolve(valueArg('target-root') ?? '.');
+const additiveFixture = JSON.parse(readFileSync(
+ new URL('../test/fixtures/glow/additive-pools.json', import.meta.url), 'utf8',
+));
+additiveFixture.sourceIds = Object.keys(additiveFixture.ha.states)
+ .filter((entityId) => entityId.startsWith('light.'));
+additiveFixture.roomCount = additiveFixture.config.spaces
+ .reduce((sum, space) => sum + space.rooms.length, 0);
+additiveFixture.deviceCount = Object.keys(additiveFixture.ha.devices).length;
+
+const makeOverlayFixture = () => {
+ const large = makeLargeHouseFixture();
+ const firstSpace = large.config.spaces[0].id;
+ const sourceDeviceIds = Object.entries(large.layout)
+ .filter(([, position]) => position.s === firstSpace)
+ .slice(0, 60)
+ .map(([deviceId]) => deviceId);
+ const sourceIds = [];
+ sourceDeviceIds.forEach((deviceId, index) => {
+ for (const [entityId, entity] of Object.entries(large.entities)) {
+ if (entity.device_id !== deviceId) continue;
+ delete large.entities[entityId];
+ delete large.states[entityId];
+ }
+ const entityId = `light.glow_overlay_${String(index + 1).padStart(3, '0')}`;
+ large.entities[entityId] = {
+ entity_id: entityId, device_id: deviceId, platform: 'houseplan_perf',
+ config_entry_id: 'perf_entry', disabled_by: null,
+ };
+ large.states[entityId] = {
+ entity_id: entityId, state: 'on',
+ attributes: {
+ friendly_name: `Overlay light ${index + 1}`,
+ brightness: 96 + (index % 5) * 32,
+ rgb_color: index % 2 ? [255, 154, 72] : [92, 156, 255],
+ },
+ };
+ sourceIds.push(entityId);
+ });
+ // The shared large-house fixture already contains a few ordinary lights.
+ // Keep them as devices but turn them off so the profile's pool cardinality
+ // is exactly the declared 1/10/30/60, not N plus an unrelated background lamp.
+ for (const [entityId, state] of Object.entries(large.states)) {
+ if (entityId.startsWith('light.') && !sourceIds.includes(entityId)) {
+ large.states[entityId] = { ...state, state: 'off' };
+ }
+ }
+ for (const space of large.config.spaces) {
+ space.settings = { ...(space.settings || {}), fill_mode: 'temp', glow_enabled: true };
+ }
+ return {
+ fixture: 'large-house-glow-overlay-v1', variants: [1, 10, 30, 60],
+ config: large.config, layout: large.layout,
+ ha: { devices: large.devices, entities: large.entities, areas: large.areas, states: large.states },
+ sourceIds,
+ roomCount: large.counts.rooms,
+ deviceCount: large.counts.devices,
+ };
+};
+const fixture = profile === 'large-light-blend-v1' ? additiveFixture : makeOverlayFixture();
+const viewport = { width: 1280, height: 900 };
+
+const { page, browser } = await launch(
+ viewport, 1,
+ ['--enable-precise-memory-info', '--js-flags=--expose-gc'],
+ {}, resolve(targetRoot, 'demo/srv'),
+);
+const cdp = await page.context().newCDPSession(page);
+await cdp.send('Emulation.setCPUThrottlingRate', { rate: 4 });
+await page.emulateMedia({ reducedMotion: 'reduce' });
+await page.addStyleTag({
+ content: '*,*::before,*::after{animation-duration:0s!important;transition-duration:0s!important;caret-color:transparent!important}',
+});
+const chromium = await browser.version();
+let buildFingerprint;
+try {
+ buildFingerprint = await assertFreshDemoBundle(page, targetRoot);
+} catch (error) {
+ await browser.close();
+ throw error;
+}
+
+const rows = [];
+try {
+ for (let iteration = 0; iteration < warmups + samples; iteration++) {
+ const sample = iteration - warmups;
+ const row = await page.evaluate(async ({ fixture, profile, sample }) => {
+ const frame = () => new Promise((done) => requestAnimationFrame(() => requestAnimationFrame(done)));
+ const until = async (predicate, timeout = 10000) => {
+ const started = performance.now();
+ while (!predicate()) {
+ if (performance.now() - started > timeout) throw new Error('Glow benchmark timed out');
+ await new Promise((done) => setTimeout(done, 10));
+ }
+ };
+ const observeLongTasks = () => {
+ const entries = [];
+ if (!PerformanceObserver.supportedEntryTypes?.includes('longtask'))
+ return { stop: async () => ({ supported: false, count: 0, maxMs: 0, totalMs: 0 }) };
+ const observer = new PerformanceObserver((list) => entries.push(...list.getEntries()));
+ observer.observe({ type: 'longtask', buffered: false });
+ return { stop: async () => {
+ await new Promise((done) => setTimeout(done, 0));
+ entries.push(...observer.takeRecords());
+ observer.disconnect();
+ const values = entries.map((entry) => entry.duration);
+ return {
+ supported: true,
+ count: values.length,
+ maxMs: Number((values.length ? Math.max(...values) : 0).toFixed(2)),
+ totalMs: Number(values.reduce((sum, value) => sum + value, 0).toFixed(2)),
+ };
+ }};
+ };
+ const forceGc = async () => {
+ if (typeof globalThis.gc !== 'function') return false;
+ globalThis.gc(); await frame(); globalThis.gc(); await frame();
+ return true;
+ };
+ const configFor = () => {
+ const config = structuredClone(fixture.config);
+ if (profile === 'large-light-blend-v1') {
+ const settings = config.spaces[0].settings;
+ settings.fill_mode = 'glow';
+ delete settings.glow_enabled;
+ }
+ return config;
+ };
+ const statesFor = (count, brightnessDelta = 0) => {
+ const active = new Set(fixture.sourceIds.slice(0, count));
+ const sources = new Set(fixture.sourceIds);
+ return Object.fromEntries(Object.entries(fixture.ha.states).map(([entityId, state]) => {
+ if (!sources.has(entityId)) return [entityId, state];
+ return [entityId, {
+ ...state,
+ state: active.has(entityId) ? 'on' : 'off',
+ attributes: {
+ ...state.attributes,
+ brightness: Math.max(1, Math.min(255, Number(state.attributes.brightness) + brightnessDelta)),
+ },
+ }];
+ }));
+ };
+ const connection = {
+ subscribeEvents: async () => () => undefined,
+ subscribeMessage: async () => () => undefined,
+ };
+ const hassFor = (states) => ({
+ language: 'en', locale: { language: 'en' },
+ user: { id: 'glow-perf', name: 'Glow performance', is_admin: true },
+ devices: fixture.ha.devices, entities: fixture.ha.entities,
+ areas: fixture.ha.areas, states, floors: {}, connection,
+ callWS: async (message) => {
+ if (message.type === 'houseplan/config/get')
+ return { config: configFor(), rev: 1, can_write: true };
+ if (message.type === 'houseplan/layout/get')
+ return { layout: structuredClone(fixture.layout), rev: 1 };
+ if (message.type === 'config/device_registry/list') return Object.values(fixture.ha.devices);
+ if (message.type === 'config/entity_registry/list') return Object.values(fixture.ha.entities);
+ if (message.type === 'config_entries/get')
+ return [{ entry_id: 'glow_fixture', domain: 'houseplan_fixture', title: 'Glow fixture' }];
+ if (message.type === 'manifest/list')
+ return [{ domain: 'houseplan_fixture', name: 'House Plan Glow Fixture' }];
+ return { ok: true };
+ },
+ callService: async () => undefined,
+ localize: () => null,
+ formatEntityState: (state) => state.state,
+ config: { unit_system: { length: 'km' } },
+ });
+ const cacheSnapshot = (card) => ({
+ cleanFloor: card._cleanFloorCache?.size ?? 0,
+ glowClip: card._glowClipCache?.size ?? 0,
+ wallUnion: card._wallUnionCache ? 1 : 0,
+ openingTunnel: card._openingTunnelCache ? 1 : 0,
+ openingWallIndex: card._openingWallIndexCache ? 1 : 0,
+ });
+
+ window.__card?.remove?.();
+ localStorage.clear();
+ const host = document.getElementById('host');
+ const result = { sample, longTasks: {}, renderCounts: {}, poolCounts: {} };
+ const card = document.createElement('houseplan-card');
+ card.setConfig({ type: 'custom:houseplan-card', title: `Glow ${profile}`, icon_size: 2.4 });
+ host.replaceChildren(card);
+ card.hass = hassFor(statesFor(1));
+ await until(() => card._loadOk && card._devices?.length === fixture.deviceCount);
+ if ('_glowScreenBlend' in card) {
+ const probeDeadline = performance.now() + 2500;
+ while (!card._glowScreenBlend && performance.now() < probeDeadline)
+ await new Promise((done) => setTimeout(done, 10));
+ }
+ await card.updateComplete;
+ await frame();
+ for (const count of fixture.variants) {
+ // Mount cost is not part of this profile. Prime each source-count
+ // state on the same full plan, then measure only the following HA tick.
+ card.hass = hassFor(statesFor(count));
+ await card.updateComplete;
+ await frame();
+ let renders = 0;
+ const originalUpdate = card.performUpdate.bind(card);
+ card.performUpdate = () => { renders++; return originalUpdate(); };
+ const longTasks = observeLongTasks();
+ const started = performance.now();
+ card.hass = hassFor(statesFor(count, 1));
+ await card.updateComplete;
+ await frame();
+ result[`stateUpdate${count}Ms`] = Number((performance.now() - started).toFixed(2));
+ result.longTasks[`stateUpdate${count}`] = await longTasks.stop();
+ result.renderCounts[count] = renders;
+ result.poolCounts[count] = card.renderRoot.querySelectorAll('.glow-pool, .glowlayer circle').length;
+ }
+ window.__card = card;
+ await forceGc();
+ const cacheBefore = cacheSnapshot(card);
+ const heapBefore = performance.memory?.usedJSHeapSize ?? null;
+ for (let index = 0; index < 5; index++) {
+ card.hass = hassFor(statesFor(60, index % 2));
+ await card.updateComplete;
+ await frame();
+ }
+ await forceGc();
+ const cacheEntries = cacheSnapshot(card);
+ const heapAfter = performance.memory?.usedJSHeapSize ?? null;
+ result.cacheEntries = cacheEntries;
+ result.cacheGrowth = Object.fromEntries(
+ Object.keys(cacheEntries).map((key) => [key, cacheEntries[key] - cacheBefore[key]]),
+ );
+ result.heapGrowthBytes = heapBefore == null || heapAfter == null ? null : heapAfter - heapBefore;
+ result.preciseGc = typeof globalThis.gc === 'function';
+ result.renderedDevices = card._devices?.length ?? 0;
+ result.screenBlend = card._glowScreenBlend === true;
+ return result;
+ }, { fixture, profile, sample });
+ const captureStarted = performance.now();
+ await page.screenshot({ type: 'png' });
+ row.screenshotCaptureMs = Number((performance.now() - captureStarted).toFixed(2));
+ if (sample >= 0) rows.push(row);
+ }
+} finally {
+ await cdp.send('Emulation.setCPUThrottlingRate', { rate: 1 }).catch(() => undefined);
+ await browser.close();
+}
+
+const metricNames = [
+ 'stateUpdate1Ms', 'stateUpdate10Ms', 'stateUpdate30Ms', 'stateUpdate60Ms', 'screenshotCaptureMs',
+];
+const report = {
+ schema: 2,
+ profile,
+ generatedAt: new Date().toISOString(),
+ buildFingerprint,
+ runtime: {
+ node: process.version, chromium, platform: process.platform, arch: process.arch,
+ viewport, deviceScaleFactor: 1, cpuThrottleRate: 4, reducedMotion: true,
+ },
+ fixture: {
+ id: fixture.fixture, variants: fixture.variants,
+ rooms: fixture.roomCount, devices: fixture.deviceCount,
+ },
+ samples,
+ warmups,
+ summary: summarizeTimings(rows, metricNames),
+ longTasks: summarizeLongTasks(rows),
+ rows,
+};
+const text = `${JSON.stringify(report, null, 2)}\n`;
+if (output) {
+ mkdirSync(dirname(output), { recursive: true });
+ writeFileSync(output, text, 'utf8');
+ console.log(output);
+} else process.stdout.write(text);
diff --git a/demo/fixtures/visual-matrix.mjs b/demo/fixtures/visual-matrix.mjs
index 95327b70..36253f14 100644
--- a/demo/fixtures/visual-matrix.mjs
+++ b/demo/fixtures/visual-matrix.mjs
@@ -82,7 +82,7 @@ const lightingSpace = {
view_box: [0, 0, 1, 1],
cell_cm: 5,
settings: {
- fill_mode: 'glow', show_borders: true, show_names: true,
+ fill_mode: 'none', glow_enabled: true, show_borders: true, show_names: true,
north_deg: 0, sun_rays: true, bg_mode: 'static',
},
rooms: lightingRooms,
diff --git a/demo/golden/harness.mjs b/demo/golden/harness.mjs
index 49556c60..0d570f67 100644
--- a/demo/golden/harness.mjs
+++ b/demo/golden/harness.mjs
@@ -53,14 +53,31 @@ export async function prepareGoldenScenario(page, scenario) {
const fixture = fixtureFor(scenario.fixture);
if (scenario.deviceName && fixture.devices?.[scenario.deviceId])
fixture.devices[scenario.deviceId].name = scenario.deviceName;
- if (scenario.fillMode) {
+ if (scenario.fillMode || typeof scenario.glowEnabled === 'boolean') {
const space = fixture.config.spaces.find((item) => item.id === scenario.space);
- space.settings = { ...(space.settings || {}), fill_mode: scenario.fillMode };
+ space.settings = {
+ ...(space.settings || {}),
+ ...(scenario.fillMode ? { fill_mode: scenario.fillMode } : {}),
+ ...(typeof scenario.glowEnabled === 'boolean' ? { glow_enabled: scenario.glowEnabled } : {}),
+ };
}
if (scenario.hideOpenings) {
const space = fixture.config.spaces.find((item) => item.id === scenario.space);
space.settings = { ...(space.settings || {}), hide_openings: true };
}
+ if (scenario.roomGlow) {
+ const space = fixture.config.spaces.find((item) => item.id === scenario.space);
+ for (const room of space.rooms) {
+ if (!(room.id in scenario.roomGlow)) continue;
+ room.settings = { ...(room.settings || {}), glow: scenario.roomGlow[room.id] };
+ }
+ }
+ if (scenario.allLightsOff) {
+ for (const [entityId, state] of Object.entries(fixture.states || {})) {
+ if (!entityId.startsWith('light.')) continue;
+ fixture.states[entityId] = { ...state, state: 'off' };
+ }
+ }
return page.evaluate(async ({ fixture, scenario }) => {
const wait = (ms) => new Promise((done) => setTimeout(done, ms));
diff --git a/demo/golden/matrix.mjs b/demo/golden/matrix.mjs
index b504d8c8..8dafe191 100644
--- a/demo/golden/matrix.mjs
+++ b/demo/golden/matrix.mjs
@@ -1,5 +1,5 @@
/** Data-only HP-QA-01 capture matrix. Bump when framing or scenarios change. */
-export const GOLDEN_MATRIX_VERSION = 3;
+export const GOLDEN_MATRIX_VERSION = 4;
const stage = { capture: 'stage', threshold: { maxChannelDelta: 10, maxDiffRatio: 0.0005 } };
const page = { capture: 'page', threshold: { maxChannelDelta: 10, maxDiffRatio: 0.0008 } };
@@ -38,17 +38,27 @@ export const GOLDEN_SCENARIOS = Object.freeze([
{ id: 'geometry-diagonal-45-opening-dark', fixture: 'visual', space: 'golden-geometry', mode: 'view',
theme: 'dark', viewport: { width: 1000, height: 900 }, ...stage },
{ id: 'openings-thick-wall-dark', fixture: 'visual', space: 'golden-lighting', mode: 'view',
- fillMode: 'none', theme: 'dark', viewport: { width: 1000, height: 900 }, ...stage },
+ fillMode: 'none', glowEnabled: false, theme: 'dark', viewport: { width: 1000, height: 900 }, ...stage },
{ id: 'openings-hidden-view-dark', fixture: 'visual', space: 'golden-lighting', mode: 'view',
- fillMode: 'none', hideOpenings: true, theme: 'dark', viewport: { width: 1000, height: 900 }, ...stage },
+ fillMode: 'none', glowEnabled: false, hideOpenings: true, theme: 'dark', viewport: { width: 1000, height: 900 }, ...stage },
{ id: 'lighting-glow-sun-dark', fixture: 'visual', space: 'golden-lighting', mode: 'view',
theme: 'dark', viewport: { width: 1000, height: 900 }, ...stage },
{ id: 'lighting-fill-light-axis-split-dark', fixture: 'visual', space: 'golden-lighting', mode: 'view',
- fillMode: 'light', theme: 'dark', viewport: { width: 1000, height: 900 }, ...stage },
+ fillMode: 'light', glowEnabled: false, theme: 'dark', viewport: { width: 1000, height: 900 }, ...stage },
{ id: 'lighting-fill-temp-axis-split-dark', fixture: 'visual', space: 'golden-lighting', mode: 'view',
- fillMode: 'temp', theme: 'dark', viewport: { width: 1000, height: 900 }, ...stage },
+ fillMode: 'temp', glowEnabled: false, theme: 'dark', viewport: { width: 1000, height: 900 }, ...stage },
{ id: 'lighting-fill-lqi-axis-split-dark', fixture: 'visual', space: 'golden-lighting', mode: 'view',
- fillMode: 'lqi', theme: 'dark', viewport: { width: 1000, height: 900 }, ...stage },
+ fillMode: 'lqi', glowEnabled: false, theme: 'dark', viewport: { width: 1000, height: 900 }, ...stage },
+ { id: 'lighting-temp-glow-dark', fixture: 'visual', space: 'golden-lighting', mode: 'view',
+ fillMode: 'temp', glowEnabled: true, theme: 'dark', viewport: { width: 1000, height: 900 }, ...stage },
+ { id: 'lighting-temp-glow-light', fixture: 'visual', space: 'golden-lighting', mode: 'view',
+ fillMode: 'temp', glowEnabled: true, theme: 'light', viewport: { width: 1000, height: 900 }, ...stage },
+ { id: 'lighting-temp-glow-no-sources-dark', fixture: 'visual', space: 'golden-lighting', mode: 'view',
+ fillMode: 'temp', glowEnabled: true, allLightsOff: true,
+ theme: 'dark', viewport: { width: 1000, height: 900 }, ...stage },
+ { id: 'lighting-temp-glow-room-override-dark', fixture: 'visual', space: 'golden-lighting', mode: 'view',
+ fillMode: 'temp', glowEnabled: true, roomGlow: { 'light-left': true, 'light-right': false },
+ theme: 'dark', viewport: { width: 1000, height: 900 }, ...stage },
{ id: 'hover-over-glow-dark', fixture: 'visual', space: 'golden-lighting', mode: 'view',
hoverRoom: 'light-right', theme: 'dark', viewport: { width: 1000, height: 900 }, ...stage },
{ id: 'hover-nested-room-dark', fixture: 'visual', space: 'golden-geometry', mode: 'view',
diff --git a/demo/performance/README.md b/demo/performance/README.md
index 7fcd6e64..b8aab3de 100644
--- a/demo/performance/README.md
+++ b/demo/performance/README.md
@@ -73,9 +73,31 @@ The `cleanFloor` entry ceiling is 160: the reviewed fixture currently warms
120 deterministic room/physical-body entries, and the extra 40 slots allow a
legitimate fixture extension without weakening the separate zero-growth gate.
-The absolute switch-cycle/Long-Task ceilings include roughly 20–30% headroom
-over the paired 2026-08-09 Ubuntu run where the unchanged base and candidate
-both reached about 5.3 s / 2.45 s / 22 tasks / 9.9 s total under runner load.
-The same-runner relative checks remain tighter for an actual candidate-only
-regression; this prevents an overloaded but symmetric runner from turning an
-absolute safety ceiling into a flaky code-regression signal.
+## Glow profiles
+
+Both Glow profiles run deterministic 1/10/30/60-pool variants at DPR 1 and
+Chromium CPU throttling x4, but deliberately exercise different fixtures:
+
+- `large-light-blend-v1` compares the isolated screen group with the previous
+ normal-layer implementation on the shared frontend/backend schema fixture
+ `test/fixtures/glow/additive-pools.json`;
+- `large-house-glow-overlay-v1` measures simultaneous temperature fill and
+ independent Glow on the existing 60-room/200-device large-house fixture,
+ without changing `large-house-v1`.
+
+```bash
+npm run benchmark:glow -- --profile=large-light-blend-v1 --output=artifacts/performance/glow.json
+npm run benchmark:glow -- --profile=large-house-glow-overlay-v1 --output=artifacts/performance/overlay.json
+```
+
+Reports include per-variant state-update timings, render/pool counts, Long
+Tasks, screenshot time, heap and cache growth. The first CI comparison against
+a base SHA that predates `glow_enabled` bootstraps only the overlay profile's
+relative baseline from the candidate; its absolute ceilings still gate that
+introduction. Every subsequent revision compares both profiles to the real
+base SHA.
+
+The initial absolute ceilings are intentionally conservative bootstrap limits;
+they must be reviewed against the first paired Ubuntu artifacts before the
+feature is promoted from beta. Same-runner relative checks remain the primary
+candidate-only regression signal.
diff --git a/demo/performance/budgets-large-house-glow-overlay.json b/demo/performance/budgets-large-house-glow-overlay.json
new file mode 100644
index 00000000..f3f52fde
--- /dev/null
+++ b/demo/performance/budgets-large-house-glow-overlay.json
@@ -0,0 +1,27 @@
+{
+ "schema": 1,
+ "profile": "large-house-glow-overlay-v1",
+ "minimumSamples": 7,
+ "timings": {
+ "stateUpdate1Ms": { "stat": "median", "maxRegressionRatio": 0.5, "noiseAllowanceMs": 50, "hardMaxMs": 750 },
+ "stateUpdate10Ms": { "stat": "median", "maxRegressionRatio": 0.5, "noiseAllowanceMs": 75, "hardMaxMs": 1100 },
+ "stateUpdate30Ms": { "stat": "median", "maxRegressionRatio": 0.5, "noiseAllowanceMs": 100, "hardMaxMs": 1500 },
+ "stateUpdate60Ms": { "stat": "median", "maxRegressionRatio": 0.5, "noiseAllowanceMs": 150, "hardMaxMs": 2200 },
+ "screenshotCaptureMs": { "stat": "median", "maxRegressionRatio": 0.5, "noiseAllowanceMs": 250, "hardMaxMs": 3200 }
+ },
+ "longTasks": {
+ "maxSingleMs": 2700,
+ "maxSingleRegressionRatio": 0.5,
+ "maxSingleNoiseAllowanceMs": 200,
+ "maxCountP95": 12,
+ "maxCountRegressionRatio": 0.5,
+ "countNoiseAllowance": 2,
+ "maxTotalP95Ms": 5500,
+ "maxTotalRegressionRatio": 0.5,
+ "noiseAllowanceMs": 250
+ },
+ "heap": { "required": true, "hardMaxGrowthBytes": 67108864, "maxRegressionRatio": 0.75, "noiseAllowanceBytes": 16777216 },
+ "cacheEntries": { "cleanFloor": 80, "glowClip": 128, "wallUnion": 1, "openingTunnel": 1, "openingWallIndex": 1 },
+ "cacheGrowth": { "cleanFloor": 0, "glowClip": 0, "wallUnion": 0, "openingTunnel": 0, "openingWallIndex": 0 },
+ "renderedDevices": 200
+}
diff --git a/demo/performance/budgets-large-light-blend.json b/demo/performance/budgets-large-light-blend.json
new file mode 100644
index 00000000..ece0b4c9
--- /dev/null
+++ b/demo/performance/budgets-large-light-blend.json
@@ -0,0 +1,27 @@
+{
+ "schema": 1,
+ "profile": "large-light-blend-v1",
+ "minimumSamples": 7,
+ "timings": {
+ "stateUpdate1Ms": { "stat": "median", "maxRegressionRatio": 0.5, "noiseAllowanceMs": 50, "hardMaxMs": 700 },
+ "stateUpdate10Ms": { "stat": "median", "maxRegressionRatio": 0.5, "noiseAllowanceMs": 75, "hardMaxMs": 1000 },
+ "stateUpdate30Ms": { "stat": "median", "maxRegressionRatio": 0.5, "noiseAllowanceMs": 100, "hardMaxMs": 1400 },
+ "stateUpdate60Ms": { "stat": "median", "maxRegressionRatio": 0.5, "noiseAllowanceMs": 150, "hardMaxMs": 2000 },
+ "screenshotCaptureMs": { "stat": "median", "maxRegressionRatio": 0.5, "noiseAllowanceMs": 250, "hardMaxMs": 3000 }
+ },
+ "longTasks": {
+ "maxSingleMs": 2500,
+ "maxSingleRegressionRatio": 0.5,
+ "maxSingleNoiseAllowanceMs": 200,
+ "maxCountP95": 12,
+ "maxCountRegressionRatio": 0.5,
+ "countNoiseAllowance": 2,
+ "maxTotalP95Ms": 5000,
+ "maxTotalRegressionRatio": 0.5,
+ "noiseAllowanceMs": 250
+ },
+ "heap": { "required": true, "hardMaxGrowthBytes": 67108864, "maxRegressionRatio": 0.75, "noiseAllowanceBytes": 16777216 },
+ "cacheEntries": { "cleanFloor": 8, "glowClip": 200, "wallUnion": 1, "openingTunnel": 1, "openingWallIndex": 1 },
+ "cacheGrowth": { "cleanFloor": 0, "glowClip": 0, "wallUnion": 0, "openingTunnel": 0, "openingWallIndex": 0 },
+ "renderedDevices": 60
+}
diff --git a/demo/smoke_glow_blending.mjs b/demo/smoke_glow_blending.mjs
new file mode 100644
index 00000000..d40e2260
--- /dev/null
+++ b/demo/smoke_glow_blending.mjs
@@ -0,0 +1,135 @@
+/** Browser pixel smoke for the isolated additive group (#19). */
+import { readFileSync } from 'node:fs';
+import { launch } from './serve.mjs';
+
+const fixture = JSON.parse(readFileSync(
+ new URL('../test/fixtures/glow/additive-pools.json', import.meta.url), 'utf8',
+));
+const { page, browser } = await launch({ width: 1100, height: 820 });
+try {
+ const out = await page.evaluate(async (fixture) => {
+ const wait = (ms) => new Promise((done) => setTimeout(done, ms));
+ const frame = () => new Promise((done) => requestAnimationFrame(() => requestAnimationFrame(done)));
+ const until = async (predicate, timeout = 10000, label = 'condition') => {
+ const started = performance.now();
+ while (!predicate()) {
+ if (performance.now() - started > timeout) throw new Error(`Glow blending smoke timed out: ${label}`);
+ await wait(15);
+ }
+ };
+ const base = window.__card.hass;
+ const connection = { subscribeEvents: async () => () => undefined, subscribeMessage: async () => () => undefined };
+ const hass = {
+ ...base,
+ language: 'en', locale: { language: 'en' }, user: { id: 'smoke', is_admin: true },
+ devices: fixture.ha.devices, entities: fixture.ha.entities,
+ areas: fixture.ha.areas, states: fixture.ha.states, floors: {}, connection,
+ callWS: async (message) => {
+ if (message.type === 'houseplan/config/get') return { config: structuredClone(fixture.config), rev: 1, can_write: true };
+ if (message.type === 'houseplan/layout/get') return { layout: structuredClone(fixture.layout), rev: 1 };
+ if (message.type === 'config/device_registry/list') return Object.values(fixture.ha.devices);
+ if (message.type === 'config/entity_registry/list') return Object.values(fixture.ha.entities);
+ if (message.type === 'config_entries/get') return [{ entry_id: 'glow_fixture', domain: 'houseplan_fixture', title: 'Glow fixture' }];
+ if (message.type === 'manifest/list') return [{ domain: 'houseplan_fixture', name: 'Glow fixture' }];
+ return { ok: true };
+ },
+ callService: async () => undefined, localize: () => null,
+ formatEntityState: (state) => state.state,
+ config: { unit_system: { length: 'km' } },
+ };
+ const card = document.createElement('houseplan-card');
+ card.setConfig({ type: 'custom:houseplan-card' });
+ document.getElementById('host').replaceChildren(card);
+ card.hass = hass;
+ try {
+ await until(() => card._loadOk && card._devices?.length === 60, 10000, 'fixture load');
+ } catch (error) {
+ throw new Error(`${error.message}; loadOk=${card._loadOk}; model=${card._model?.length}; devices=${card._devices?.length}; error=${card._error || ''}`);
+ }
+ await until(() => card._glowScreenBlend === true, 3000, `screen probe (${card._glowScreenBlend})`);
+ await card.updateComplete;
+ await frame();
+ const poolGroup = card.renderRoot.querySelector('.glow-pools');
+
+ const raster = async (
+ reverse, screen,
+ a = [224, 80, 32], b = [32, 112, 224], bg = [20, 30, 40],
+ ) => {
+ const shapes = reverse
+ ? ``
+ : ``;
+ const source = ``;
+ const url = URL.createObjectURL(new Blob([source], { type: 'image/svg+xml' }));
+ try {
+ const image = await new Promise((resolve, reject) => {
+ const node = new Image(); node.onload = () => resolve(node); node.onerror = reject; node.src = url;
+ });
+ const canvas = document.createElement('canvas'); canvas.width = 4; canvas.height = 1;
+ const context = canvas.getContext('2d', { willReadFrequently: true });
+ context.drawImage(image, 0, 0);
+ return [...context.getImageData(0, 0, 4, 1).data];
+ } finally { URL.revokeObjectURL(url); }
+ };
+ const forward = await raster(false, true);
+ const reverse = await raster(true, true);
+ const fallback = await raster(false, false);
+ const sameDim = await raster(false, true, [72, 88, 104], [72, 88, 104]);
+ const fullBase = card.renderRoot.querySelector('.glow-base-layer .glow-base');
+ const dataTunnel = card.renderRoot.querySelector('.opening-tunnels[data-layer="data"]');
+ const baseTunnel = card.renderRoot.querySelector('.opening-tunnels[data-layer="glow-base"]');
+ const poolFrame = card.renderRoot.querySelector('.glow-pools-frame');
+ const follows = (left, right) => !!left && !!right
+ && !!(left.compareDocumentPosition(right) & Node.DOCUMENT_POSITION_FOLLOWING);
+ const clippedPools = [...card.renderRoot.querySelectorAll('.glow-pool')]
+ .filter((pool) => pool.hasAttribute('clip-path')).length;
+
+ await customElements.whenDefined('houseplan-space-card');
+ const staticCard = document.createElement('houseplan-space-card');
+ staticCard.setConfig({
+ type: 'custom:houseplan-space-card', space: fixture.config.spaces[0].id,
+ show_button: false,
+ });
+ staticCard.hass = hass;
+ document.body.appendChild(staticCard);
+ await until(() => staticCard.renderRoot?.querySelector('.hp-static-stage'));
+ await staticCard.updateComplete;
+ const staticBase = staticCard.renderRoot.querySelector('.glow-base-layer .glow-base');
+ const staticPools = staticCard.renderRoot.querySelectorAll('.glow-pool, .glowlayer').length;
+ const baseParity = !!fullBase && !!staticBase
+ && fullBase.getAttribute('fill') === staticBase.getAttribute('fill')
+ && fullBase.getAttribute('fill-opacity') === staticBase.getAttribute('fill-opacity');
+ staticCard.remove();
+ return {
+ blend: poolGroup?.getAttribute('data-blend'),
+ pools: card.renderRoot.querySelectorAll('.glow-pool').length,
+ clippedPools, layerOrder: follows(dataTunnel, fullBase)
+ && follows(fullBase, baseTunnel) && follows(baseTunnel, poolFrame),
+ staticBase: !!staticBase, staticPools, baseParity,
+ forward, reverse, fallback, sameDim,
+ };
+ }, fixture);
+ const pixel = (data, index) => data.slice(index * 4, index * 4 + 4);
+ const screen = (a, b) => a.map((value, index) => Math.round(255 - ((255 - value) * (255 - b[index])) / 255));
+ const over = (fg, bg, alpha) => fg.map((value, index) => Math.round(value * alpha + bg[index] * (1 - alpha)));
+ const bg = [20, 30, 40];
+ const expected = [...over(screen([224, 80, 32], [32, 112, 224]), bg, 0.7), 255];
+ const expectedFallback = [...over([32, 112, 224], bg, 0.7), 255];
+ const close = (actual, wanted) => actual.every((value, index) => Math.abs(value - wanted[index]) <= 2);
+ if (out.blend !== 'screen') throw new Error(`runtime probe did not enable screen: ${out.blend}`);
+ if (out.pools !== 60) throw new Error(`expected 60 pools, got ${out.pools}`);
+ if (!close(pixel(out.forward, 1), expected)) throw new Error(`screen pixel mismatch: ${pixel(out.forward, 1)} vs ${expected}`);
+ if (!close(pixel(out.reverse, 1), expected)) throw new Error('screen result depends on marker order');
+ if (!close(pixel(out.fallback, 1), expectedFallback)) throw new Error('normal fallback no longer matches baseline composition');
+ const singleDim = pixel(out.sameDim, 0);
+ const overlapDim = pixel(out.sameDim, 1);
+ if (![0, 1, 2].every((index) => overlapDim[index] > singleDim[index] && overlapDim[index] < 255))
+ throw new Error(`same-colour dim overlap did not brighten without clipping: ${singleDim} -> ${overlapDim}`);
+ if (!close(pixel(out.forward, 3), [106, 123, 140, 255])) throw new Error('non-pool sector/background changed');
+ if (out.clippedPools !== out.pools) throw new Error(`lost per-source clips: ${out.clippedPools}/${out.pools}`);
+ if (!out.layerOrder) throw new Error('data/base/tunnel/pool layer order changed');
+ if (!out.staticBase || out.staticPools !== 0 || !out.baseParity)
+ throw new Error(`static-card Glow contract failed: base=${out.staticBase}, pools=${out.staticPools}, parity=${out.baseParity}`);
+ console.log(JSON.stringify({ ok: true, blend: out.blend, pools: out.pools, staticParity: true }));
+} finally {
+ await browser.close();
+}
diff --git a/demo/smoke_long_press_gesture.mjs b/demo/smoke_long_press_gesture.mjs
new file mode 100644
index 00000000..03d0d190
--- /dev/null
+++ b/demo/smoke_long_press_gesture.mjs
@@ -0,0 +1,69 @@
+/** Regression smoke for #59: a modal must terminate the held view gesture. */
+import { launch } from './serve.mjs';
+
+const { page, browser } = await launch({ width: 1000, height: 820 }, 1);
+try {
+ const result = await page.evaluate(async () => {
+ const card = window.__card;
+ const wait = (ms) => new Promise((done) => setTimeout(done, ms));
+ const until = async (predicate, timeout = 5000) => {
+ const started = performance.now();
+ while (!predicate()) {
+ if (performance.now() - started > timeout) throw new Error('long-press smoke timed out');
+ await wait(20);
+ }
+ };
+ card._setMode('view');
+ await card.updateComplete;
+ const device = card.renderRoot.querySelector('.stage .dev');
+ const stage = card.renderRoot.querySelector('.stage');
+ if (!device || !stage) throw new Error('fixture has no view marker/stage');
+
+ device.dispatchEvent(new PointerEvent('pointerdown', {
+ bubbles: true, composed: true, pointerId: 5901, pointerType: 'mouse',
+ clientX: 240, clientY: 260, button: 0, buttons: 1,
+ }));
+ if (!card._panStart || !card._pointers.has(5901))
+ throw new Error('precondition failed: stage gesture did not start');
+ await until(() => !!card._infoCard, 1500);
+ await card.updateComplete;
+ const clearedOnOpen = !card._panStart && !card._pinchStart
+ && card._pointers.size === 0 && !card._swipeStart;
+
+ const dialog = card.renderRoot.querySelector('hp-dialog');
+ dialog?.dispatchEvent(new CustomEvent('hp-close', { bubbles: true, composed: true }));
+ await card.updateComplete;
+ const before = JSON.stringify(card._view);
+ stage.dispatchEvent(new PointerEvent('pointermove', {
+ bubbles: true, composed: true, pointerId: 5901, pointerType: 'mouse',
+ clientX: 520, clientY: 470, buttons: 0,
+ }));
+ await card.updateComplete;
+ const idleAfterClose = !card._infoCard && !card._panStart
+ && card._pointers.size === 0 && JSON.stringify(card._view) === before;
+
+ // One clean click on the stage must not consume a stale marker press or
+ // reopen the device card. Device-specific short-click actions (toggle,
+ // more-info, cover, run) are covered by their dedicated smokes.
+ stage.dispatchEvent(new PointerEvent('pointerdown', {
+ bubbles: true, composed: true, pointerId: 5902, pointerType: 'mouse',
+ clientX: 740, clientY: 680, button: 0, buttons: 1,
+ }));
+ stage.dispatchEvent(new PointerEvent('pointerup', {
+ bubbles: true, composed: true, pointerId: 5902, pointerType: 'mouse',
+ clientX: 740, clientY: 680, button: 0, buttons: 0,
+ }));
+ stage.dispatchEvent(new MouseEvent('click', {
+ bubbles: true, composed: true, clientX: 740, clientY: 680, button: 0,
+ }));
+ await card.updateComplete;
+ const normalNextClick = !card._infoCard && !card._holdFired
+ && !card._panStart && card._pointers.size === 0;
+ return { clearedOnOpen, idleAfterClose, normalNextClick };
+ });
+ if (!Object.values(result).every(Boolean))
+ throw new Error(`long-press gesture regression: ${JSON.stringify(result)}`);
+ console.log(JSON.stringify({ ok: true, ...result }));
+} finally {
+ await browser.close();
+}
diff --git a/demo/smoke_opening_tunnel_fill.mjs b/demo/smoke_opening_tunnel_fill.mjs
index 90bf35d5..a6cc1bf9 100644
--- a/demo/smoke_opening_tunnel_fill.mjs
+++ b/demo/smoke_opening_tunnel_fill.mjs
@@ -59,18 +59,22 @@ const result = await page.evaluate(async () => {
c._setMode('view');
await update();
- const tunnels = () => [...root().querySelectorAll('[data-hp="opening-tunnel"]')];
- const byId = (id) => root().querySelector(`[data-hp="opening-tunnel"][data-id="${id}"]`);
+ const tunnels = (layer) => [...root().querySelectorAll(
+ `.opening-tunnels[data-layer="${layer}"] [data-hp="opening-tunnel"]`,
+ )];
+ const byId = (id, layer) => root().querySelector(
+ `.opening-tunnels[data-layer="${layer}"] [data-hp="opening-tunnel"][data-id="${id}"]`,
+ );
const out = {};
- out.allThreeTypes = tunnels().length === 3;
- out.windowRepeatsColdRoom = byId('tunnel-window')?.getAttribute('fill') === '#112233'
+ out.allThreeTypes = new Set([...tunnels('data'), ...tunnels('glow-base')]
+ .map((node) => node.getAttribute('data-kind'))).size === 3;
+ out.windowRepeatsColdRoom = byId('tunnel-window', 'data')?.getAttribute('fill') === '#112233'
&& (root().querySelector('[data-hp="room"][data-id="tunnel-left"]')?.getAttribute('style') || '')
.includes('--room-fill:#112233');
- out.gateRepeatsHotRoom = byId('tunnel-gate')?.getAttribute('fill') === '#445566'
- && (root().querySelector('[data-hp="room"][data-id="tunnel-right"]')?.getAttribute('style') || '')
- .includes('--room-fill:#445566');
+ out.gateRepeatsHotRoom = byId('tunnel-gate', 'glow-base')?.getAttribute('fill') === '#445566'
+ && !!root().querySelector('.glow-base-layer [data-room-id="tunnel-right"]');
- const shared = byId('tunnel-door');
+ const shared = byId('tunnel-door', 'data');
const stops = [...(shared?.querySelectorAll('stop') || [])].map((s) => ({
offset: s.getAttribute('offset'), color: s.getAttribute('stop-color'),
opacity: s.getAttribute('stop-opacity'),
@@ -79,7 +83,8 @@ const result = await page.evaluate(async () => {
out.sharedStopsOnWallAxis = stops[1]?.offset === '50.000000%'
&& stops[2]?.offset === '50.000000%';
out.sharedCarriesBothRooms = new Set(stops.map((s) => s.color)).has('#112233')
- && new Set(stops.map((s) => s.color)).has('#445566');
+ && stops.some((s) => s.color === '#000000' && s.opacity === '0')
+ && byId('tunnel-door', 'glow-base')?.getAttribute('fill') === '#445566';
const svgEl = root().querySelector('.stage svg');
const tunnelGroup = root().querySelector('.opening-tunnels');
@@ -90,22 +95,28 @@ const result = await page.evaluate(async () => {
sp.settings.hide_openings = true;
await update();
out.hideSymbolKeepsTunnel = root().querySelectorAll('[data-hp="opening"]').length === 0
- && tunnels().length === 3;
+ && tunnels('data').length === 2 && tunnels('glow-base').length === 3;
sp.settings.show_borders = false;
await update();
out.hiddenBordersKeepTunnel = root().querySelectorAll('.wallbodies').length === 0
- && tunnels().length === 3;
+ && tunnels('data').length === 2 && tunnels('glow-base').length === 3;
c._setMode('decor');
await update();
- out.backdropUsesSingleGroupOpacity = tunnels().length === 3
- && getComputedStyle(root().querySelector('.opening-tunnels')).opacity === '0.35'
- && byId('tunnel-window')?.getAttribute('fill-opacity') === '0.21';
+ out.backdropUsesSingleGroupOpacity = tunnels('data').length === 2
+ && tunnels('glow-base').length === 3
+ && [...root().querySelectorAll('.opening-tunnels')]
+ .every((group) => getComputedStyle(group).opacity === '0.35')
+ && getComputedStyle(root().querySelector('.glow-base-layer')).opacity === '0.35'
+ && getComputedStyle(root().querySelector('.glow-pools-frame')).opacity === '0.35'
+ && byId('tunnel-window', 'data')?.getAttribute('fill-opacity') === '0.21'
+ && byId('tunnel-gate', 'glow-base')?.getAttribute('fill-opacity') === '0.42';
c._setMode('plan');
await update();
- out.planGestureCannotLeaveStalePatch = tunnels().length === 0;
+ out.planGestureCannotLeaveStalePatch = tunnels('data').length === 0
+ && tunnels('glow-base').length === 0;
return out;
});
diff --git a/demo/smoke_space_settings.mjs b/demo/smoke_space_settings.mjs
index 390d1da2..46e734ac 100644
--- a/demo/smoke_space_settings.mjs
+++ b/demo/smoke_space_settings.mjs
@@ -62,8 +62,8 @@ checkAll(res, {
"livingStyle": {"stroke": "#ff8800", "strokeOpacity": 0.8, "fill": "#ffd45c", "fillOpacity": 0.18},
"lqiFills": 0,
"atticSquare": true,
- // fill_mode 'glow' — the default for NEW spaces since v1.54 (owner call).
- // Existing spaces with an absent fill_mode still resolve to 'none'.
- "atticSettings": {"show_borders": true, "show_names": true, "room_color": "#55606c", "room_opacity": 0.55, "fill_mode": "glow", "temp_min": 20, "temp_max": 25, "show_lqi": true, "label_temp": false, "label_hum": false, "label_lqi": false, "label_light": false},
+ // New spaces keep the product default (Glow on), but store it independently
+ // from the ordinary data fill.
+ "atticSettings": {"show_borders": true, "show_names": true, "room_color": "#55606c", "room_opacity": 0.55, "fill_mode": "none", "glow_enabled": true, "temp_min": 20, "temp_max": 25, "show_lqi": true, "label_temp": false, "label_hum": false, "label_lqi": false, "label_light": false},
});
await finish(browser, res);
diff --git a/demo/srv/assets/houseplan-card.js b/demo/srv/assets/houseplan-card.js
index 1de2f5fb..ec5488a0 100755
--- a/demo/srv/assets/houseplan-card.js
+++ b/demo/srv/assets/houseplan-card.js
@@ -1,7 +1,7 @@
-globalThis.__HOUSEPLAN_BUILD_FINGERPRINT__="632caa531a2449590d979a92f8d99ab07114931c775b9df58ea529267299ea7d";const t=globalThis,e=t.ShadowRoot&&(void 0===t.ShadyCSS||t.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,i=Symbol(),s=new WeakMap;let n=class{constructor(t,e,s){if(this._$cssResult$=!0,s!==i)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=t,this.t=e}get styleSheet(){let t=this.o;const i=this.t;if(e&&void 0===t){const e=void 0!==i&&1===i.length;e&&(t=s.get(i)),void 0===t&&((this.o=t=new CSSStyleSheet).replaceSync(this.cssText),e&&s.set(i,t))}return t}toString(){return this.cssText}};const o=(t,...e)=>{const s=1===t.length?t[0]:e.reduce((e,i,s)=>e+(t=>{if(!0===t._$cssResult$)return t.cssText;if("number"==typeof t)return t;throw Error("Value passed to 'css' function must be a 'css' function result: "+t+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(i)+t[s+1],t[0]);return new n(s,t,i)},r=e?t=>t:t=>t instanceof CSSStyleSheet?(t=>{let e="";for(const i of t.cssRules)e+=i.cssText;return(t=>new n("string"==typeof t?t:t+"",void 0,i))(e)})(t):t,{is:a,defineProperty:l,getOwnPropertyDescriptor:c,getOwnPropertyNames:h,getOwnPropertySymbols:d,getPrototypeOf:p}=Object,u=globalThis,_=u.trustedTypes,m=_?_.emptyScript:"",g=u.reactiveElementPolyfillSupport,f=(t,e)=>t,v={toAttribute(t,e){switch(e){case Boolean:t=t?m:null;break;case Object:case Array:t=null==t?t:JSON.stringify(t)}return t},fromAttribute(t,e){let i=t;switch(e){case Boolean:i=null!==t;break;case Number:i=null===t?null:Number(t);break;case Object:case Array:try{i=JSON.parse(t)}catch(t){i=null}}return i}},y=(t,e)=>!a(t,e),b={attribute:!0,type:String,converter:v,reflect:!1,useDefault:!1,hasChanged:y};Symbol.metadata??=Symbol("metadata"),u.litPropertyMetadata??=new WeakMap;let w=class extends HTMLElement{static addInitializer(t){this._$Ei(),(this.l??=[]).push(t)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(t,e=b){if(e.state&&(e.attribute=!1),this._$Ei(),this.prototype.hasOwnProperty(t)&&((e=Object.create(e)).wrapped=!0),this.elementProperties.set(t,e),!e.noAccessor){const i=Symbol(),s=this.getPropertyDescriptor(t,i,e);void 0!==s&&l(this.prototype,t,s)}}static getPropertyDescriptor(t,e,i){const{get:s,set:n}=c(this.prototype,t)??{get(){return this[e]},set(t){this[e]=t}};return{get:s,set(e){const o=s?.call(this);n?.call(this,e),this.requestUpdate(t,o,i)},configurable:!0,enumerable:!0}}static getPropertyOptions(t){return this.elementProperties.get(t)??b}static _$Ei(){if(this.hasOwnProperty(f("elementProperties")))return;const t=p(this);t.finalize(),void 0!==t.l&&(this.l=[...t.l]),this.elementProperties=new Map(t.elementProperties)}static finalize(){if(this.hasOwnProperty(f("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(f("properties"))){const t=this.properties,e=[...h(t),...d(t)];for(const i of e)this.createProperty(i,t[i])}const t=this[Symbol.metadata];if(null!==t){const e=litPropertyMetadata.get(t);if(void 0!==e)for(const[t,i]of e)this.elementProperties.set(t,i)}this._$Eh=new Map;for(const[t,e]of this.elementProperties){const i=this._$Eu(t,e);void 0!==i&&this._$Eh.set(i,t)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(t){const e=[];if(Array.isArray(t)){const i=new Set(t.flat(1/0).reverse());for(const t of i)e.unshift(r(t))}else void 0!==t&&e.push(r(t));return e}static _$Eu(t,e){const i=e.attribute;return!1===i?void 0:"string"==typeof i?i:"string"==typeof t?t.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){this._$ES=new Promise(t=>this.enableUpdating=t),this._$AL=new Map,this._$E_(),this.requestUpdate(),this.constructor.l?.forEach(t=>t(this))}addController(t){(this._$EO??=new Set).add(t),void 0!==this.renderRoot&&this.isConnected&&t.hostConnected?.()}removeController(t){this._$EO?.delete(t)}_$E_(){const t=new Map,e=this.constructor.elementProperties;for(const i of e.keys())this.hasOwnProperty(i)&&(t.set(i,this[i]),delete this[i]);t.size>0&&(this._$Ep=t)}createRenderRoot(){const i=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return((i,s)=>{if(e)i.adoptedStyleSheets=s.map(t=>t instanceof CSSStyleSheet?t:t.styleSheet);else for(const e of s){const s=document.createElement("style"),n=t.litNonce;void 0!==n&&s.setAttribute("nonce",n),s.textContent=e.cssText,i.appendChild(s)}})(i,this.constructor.elementStyles),i}connectedCallback(){this.renderRoot??=this.createRenderRoot(),this.enableUpdating(!0),this._$EO?.forEach(t=>t.hostConnected?.())}enableUpdating(t){}disconnectedCallback(){this._$EO?.forEach(t=>t.hostDisconnected?.())}attributeChangedCallback(t,e,i){this._$AK(t,i)}_$ET(t,e){const i=this.constructor.elementProperties.get(t),s=this.constructor._$Eu(t,i);if(void 0!==s&&!0===i.reflect){const n=(void 0!==i.converter?.toAttribute?i.converter:v).toAttribute(e,i.type);this._$Em=t,null==n?this.removeAttribute(s):this.setAttribute(s,n),this._$Em=null}}_$AK(t,e){const i=this.constructor,s=i._$Eh.get(t);if(void 0!==s&&this._$Em!==s){const t=i.getPropertyOptions(s),n="function"==typeof t.converter?{fromAttribute:t.converter}:void 0!==t.converter?.fromAttribute?t.converter:v;this._$Em=s;const o=n.fromAttribute(e,t.type);this[s]=o??this._$Ej?.get(s)??o,this._$Em=null}}requestUpdate(t,e,i,s=!1,n){if(void 0!==t){const o=this.constructor;if(!1===s&&(n=this[t]),i??=o.getPropertyOptions(t),!((i.hasChanged??y)(n,e)||i.useDefault&&i.reflect&&n===this._$Ej?.get(t)&&!this.hasAttribute(o._$Eu(t,i))))return;this.C(t,e,i)}!1===this.isUpdatePending&&(this._$ES=this._$EP())}C(t,e,{useDefault:i,reflect:s,wrapped:n},o){i&&!(this._$Ej??=new Map).has(t)&&(this._$Ej.set(t,o??e??this[t]),!0!==n||void 0!==o)||(this._$AL.has(t)||(this.hasUpdated||i||(e=void 0),this._$AL.set(t,e)),!0===s&&this._$Em!==t&&(this._$Eq??=new Set).add(t))}async _$EP(){this.isUpdatePending=!0;try{await this._$ES}catch(t){Promise.reject(t)}const t=this.scheduleUpdate();return null!=t&&await t,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??=this.createRenderRoot(),this._$Ep){for(const[t,e]of this._$Ep)this[t]=e;this._$Ep=void 0}const t=this.constructor.elementProperties;if(t.size>0)for(const[e,i]of t){const{wrapped:t}=i,s=this[e];!0!==t||this._$AL.has(e)||void 0===s||this.C(e,void 0,i,s)}}let t=!1;const e=this._$AL;try{t=this.shouldUpdate(e),t?(this.willUpdate(e),this._$EO?.forEach(t=>t.hostUpdate?.()),this.update(e)):this._$EM()}catch(e){throw t=!1,this._$EM(),e}t&&this._$AE(e)}willUpdate(t){}_$AE(t){this._$EO?.forEach(t=>t.hostUpdated?.()),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(t)),this.updated(t)}_$EM(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(t){return!0}update(t){this._$Eq&&=this._$Eq.forEach(t=>this._$ET(t,this[t])),this._$EM()}updated(t){}firstUpdated(t){}};w.elementStyles=[],w.shadowRootOptions={mode:"open"},w[f("elementProperties")]=new Map,w[f("finalized")]=new Map,g?.({ReactiveElement:w}),(u.reactiveElementVersions??=[]).push("2.1.2");const k=globalThis,x=t=>t,$=k.trustedTypes,S=$?$.createPolicy("lit-html",{createHTML:t=>t}):void 0,M="$lit$",C=`lit$${Math.random().toFixed(9).slice(2)}$`,D="?"+C,T=`<${D}>`,P=document,R=()=>P.createComment(""),z=t=>null===t||"object"!=typeof t&&"function"!=typeof t,A=Array.isArray,I="[ \t\n\f\r]",E=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,N=/-->/g,O=/>/g,F=RegExp(`>|${I}(?:([^\\s"'>=/]+)(${I}*=${I}*(?:[^ \t\n\f\r"'\`<>=]|("|')|))|$)`,"g"),L=/'/g,H=/"/g,q=/^(?:script|style|textarea|title)$/i,U=t=>(e,...i)=>({_$litType$:t,strings:e,values:i}),W=U(1),j=U(2),B=Symbol.for("lit-noChange"),G=Symbol.for("lit-nothing"),K=new WeakMap,V=P.createTreeWalker(P,129);function Y(t,e){if(!A(t)||!t.hasOwnProperty("raw"))throw Error("invalid template strings array");return void 0!==S?S.createHTML(e):e}const J=(t,e)=>{const i=t.length-1,s=[];let n,o=2===e?"":3===e?"":"")),s]};class Z{constructor({strings:t,_$litType$:e},i){let s;this.parts=[];let n=0,o=0;const r=t.length-1,a=this.parts,[l,c]=J(t,e);if(this.el=Z.createElement(l,i),V.currentNode=this.el.content,2===e||3===e){const t=this.el.content.firstChild;t.replaceWith(...t.childNodes)}for(;null!==(s=V.nextNode())&&a.length0){s.textContent=$?$.emptyScript:"";for(let i=0;iA(t)||"function"==typeof t?.[Symbol.iterator])(t)?this.k(t):this._(t)}O(t){return this._$AA.parentNode.insertBefore(t,this._$AB)}T(t){this._$AH!==t&&(this._$AR(),this._$AH=this.O(t))}_(t){this._$AH!==G&&z(this._$AH)?this._$AA.nextSibling.data=t:this.T(P.createTextNode(t)),this._$AH=t}$(t){const{values:e,_$litType$:i}=t,s="number"==typeof i?this._$AC(t):(void 0===i.el&&(i.el=Z.createElement(Y(i.h,i.h[0]),this.options)),i);if(this._$AH?._$AD===s)this._$AH.p(e);else{const t=new Q(s,this),i=t.u(this.options);t.p(e),this.T(i),this._$AH=t}}_$AC(t){let e=K.get(t.strings);return void 0===e&&K.set(t.strings,e=new Z(t)),e}k(t){A(this._$AH)||(this._$AH=[],this._$AR());const e=this._$AH;let i,s=0;for(const n of t)s===e.length?e.push(i=new tt(this.O(R()),this.O(R()),this,this.options)):i=e[s],i._$AI(n),s++;s2||""!==i[0]||""!==i[1]?(this._$AH=Array(i.length-1).fill(new String),this.strings=i):this._$AH=G}_$AI(t,e=this,i,s){const n=this.strings;let o=!1;if(void 0===n)t=X(this,t,e,0),o=!z(t)||t!==this._$AH&&t!==B,o&&(this._$AH=t);else{const s=t;let r,a;for(t=n[0],r=0;r{const s=i?.renderBefore??e;let n=s._$litPart$;if(void 0===n){const t=i?.renderBefore??null;s._$litPart$=n=new tt(e.insertBefore(R(),t),t,void 0,i??{})}return n._$AI(t),n})(e,this.renderRoot,this.renderOptions)}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(!1)}render(){return B}}lt._$litElement$=!0,lt.finalized=!0,at.litElementHydrateSupport?.({LitElement:lt});const ct=at.litElementPolyfillSupport;ct?.({LitElement:lt}),(at.litElementVersions??=[]).push("4.2.2");const ht=new WeakMap;let dt=0;class pt extends lt{constructor(){super(...arguments),this.title="",this.icon="",this.wide=!1,this.dismissOnScrim=!1,this.hass=null,this._opener=null,this._focusRoot=null,this._useHaDialog=!1,this._closing=!1,this._titleId="hp-dialog-title-"+ ++dt,this._focusInitial=()=>{const t=this.querySelector("[autofocus]")||this._focusableElements()[0]||(this._useHaDialog?null:this.renderRoot.querySelector(".close"))||this.renderRoot.querySelector(".surface")||this.renderRoot.querySelector("ha-dialog");t?.focus({preventScroll:!0})},this._requestClose=()=>{this._closing||(this._closing=!0,this.dispatchEvent(new CustomEvent("hp-close",{bubbles:!0,composed:!0})))},this._onKeyDown=t=>{if("Escape"===t.key)return t.preventDefault(),t.stopImmediatePropagation(),void this._requestClose();if("Tab"!==t.key||this._useHaDialog)return;const e=this.renderRoot.querySelector(".close"),i=e?[e,...this._focusableElements()]:this._focusableElements();if(!i.length)return t.preventDefault(),void this.renderRoot.querySelector(".surface")?.focus({preventScroll:!0});const s=this._deepActiveElement(),n=i[0],o=i[i.length-1];!t.shiftKey||s!==n&&i.includes(s)?t.shiftKey||s!==o||(t.preventDefault(),n.focus()):(t.preventDefault(),o.focus())},this._onFallbackCancel=t=>{t.preventDefault(),this._requestClose()},this._onFallbackClick=t=>{this.dismissOnScrim&&t.target===t.currentTarget&&this._requestClose()}}connectedCallback(){super.connectedCallback(),this._opener=this._deepActiveElement();const t=this.getRootNode();this._focusRoot=t;const e=ht.get(t)||{dialogs:new Set,opener:this._opener};e.dialogs.add(this),ht.set(t,e),this._useHaDialog=!!customElements.get("ha-dialog"),this.addEventListener("keydown",this._onKeyDown,!0)}disconnectedCallback(){this.removeEventListener("keydown",this._onKeyDown,!0);const t=this._focusRoot,e=this._opener;this._opener=null,this._focusRoot=null;const i=t?ht.get(t):void 0;i?.dialogs.delete(this),super.disconnectedCallback(),t&&i&&requestAnimationFrame(()=>{const i=ht.get(t);if(!i)return;if(!i.dialogs.size)return i.opener?.isConnected&&i.opener.focus({preventScroll:!0}),void ht.delete(t);const s=e?.closest("hp-dialog");e?.isConnected&&s&&i.dialogs.has(s)&&e.focus({preventScroll:!0})})}firstUpdated(t){if(super.firstUpdated(t),!this._useHaDialog){const t=this.renderRoot.querySelector("dialog");t&&!t.open&&t.showModal()}queueMicrotask(()=>this._focusInitial())}_deepActiveElement(){let t=document.activeElement;for(;t?.shadowRoot?.activeElement;)t=t.shadowRoot.activeElement;return t&&t!==document.body?t:null}_focusableElements(){const t=["[autofocus]","a[href]","button:not([disabled])",'input:not([disabled]):not([type="hidden"])',"select:not([disabled])","textarea:not([disabled])",'[contenteditable="true"]','[tabindex]:not([tabindex="-1"])'].join(",");return Array.from(this.querySelectorAll(t)).filter(t=>{const e=getComputedStyle(t);return!t.hidden&&"none"!==e.display&&"hidden"!==e.visibility})}render(){const t=W`
- ${this.icon?W``:G}
+globalThis.__HOUSEPLAN_BUILD_FINGERPRINT__="9a912cf81f41f7f9db8ee550b7a54fb4a0a19d5eb9b2252ef1a3d545b54f6a59";const t=globalThis,e=t.ShadowRoot&&(void 0===t.ShadyCSS||t.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,i=Symbol(),s=new WeakMap;let n=class{constructor(t,e,s){if(this._$cssResult$=!0,s!==i)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=t,this.t=e}get styleSheet(){let t=this.o;const i=this.t;if(e&&void 0===t){const e=void 0!==i&&1===i.length;e&&(t=s.get(i)),void 0===t&&((this.o=t=new CSSStyleSheet).replaceSync(this.cssText),e&&s.set(i,t))}return t}toString(){return this.cssText}};const o=(t,...e)=>{const s=1===t.length?t[0]:e.reduce((e,i,s)=>e+(t=>{if(!0===t._$cssResult$)return t.cssText;if("number"==typeof t)return t;throw Error("Value passed to 'css' function must be a 'css' function result: "+t+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(i)+t[s+1],t[0]);return new n(s,t,i)},r=e?t=>t:t=>t instanceof CSSStyleSheet?(t=>{let e="";for(const i of t.cssRules)e+=i.cssText;return(t=>new n("string"==typeof t?t:t+"",void 0,i))(e)})(t):t,{is:a,defineProperty:l,getOwnPropertyDescriptor:c,getOwnPropertyNames:h,getOwnPropertySymbols:d,getPrototypeOf:p}=Object,u=globalThis,_=u.trustedTypes,m=_?_.emptyScript:"",g=u.reactiveElementPolyfillSupport,f=(t,e)=>t,v={toAttribute(t,e){switch(e){case Boolean:t=t?m:null;break;case Object:case Array:t=null==t?t:JSON.stringify(t)}return t},fromAttribute(t,e){let i=t;switch(e){case Boolean:i=null!==t;break;case Number:i=null===t?null:Number(t);break;case Object:case Array:try{i=JSON.parse(t)}catch(t){i=null}}return i}},y=(t,e)=>!a(t,e),b={attribute:!0,type:String,converter:v,reflect:!1,useDefault:!1,hasChanged:y};Symbol.metadata??=Symbol("metadata"),u.litPropertyMetadata??=new WeakMap;let w=class extends HTMLElement{static addInitializer(t){this._$Ei(),(this.l??=[]).push(t)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(t,e=b){if(e.state&&(e.attribute=!1),this._$Ei(),this.prototype.hasOwnProperty(t)&&((e=Object.create(e)).wrapped=!0),this.elementProperties.set(t,e),!e.noAccessor){const i=Symbol(),s=this.getPropertyDescriptor(t,i,e);void 0!==s&&l(this.prototype,t,s)}}static getPropertyDescriptor(t,e,i){const{get:s,set:n}=c(this.prototype,t)??{get(){return this[e]},set(t){this[e]=t}};return{get:s,set(e){const o=s?.call(this);n?.call(this,e),this.requestUpdate(t,o,i)},configurable:!0,enumerable:!0}}static getPropertyOptions(t){return this.elementProperties.get(t)??b}static _$Ei(){if(this.hasOwnProperty(f("elementProperties")))return;const t=p(this);t.finalize(),void 0!==t.l&&(this.l=[...t.l]),this.elementProperties=new Map(t.elementProperties)}static finalize(){if(this.hasOwnProperty(f("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(f("properties"))){const t=this.properties,e=[...h(t),...d(t)];for(const i of e)this.createProperty(i,t[i])}const t=this[Symbol.metadata];if(null!==t){const e=litPropertyMetadata.get(t);if(void 0!==e)for(const[t,i]of e)this.elementProperties.set(t,i)}this._$Eh=new Map;for(const[t,e]of this.elementProperties){const i=this._$Eu(t,e);void 0!==i&&this._$Eh.set(i,t)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(t){const e=[];if(Array.isArray(t)){const i=new Set(t.flat(1/0).reverse());for(const t of i)e.unshift(r(t))}else void 0!==t&&e.push(r(t));return e}static _$Eu(t,e){const i=e.attribute;return!1===i?void 0:"string"==typeof i?i:"string"==typeof t?t.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){this._$ES=new Promise(t=>this.enableUpdating=t),this._$AL=new Map,this._$E_(),this.requestUpdate(),this.constructor.l?.forEach(t=>t(this))}addController(t){(this._$EO??=new Set).add(t),void 0!==this.renderRoot&&this.isConnected&&t.hostConnected?.()}removeController(t){this._$EO?.delete(t)}_$E_(){const t=new Map,e=this.constructor.elementProperties;for(const i of e.keys())this.hasOwnProperty(i)&&(t.set(i,this[i]),delete this[i]);t.size>0&&(this._$Ep=t)}createRenderRoot(){const i=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return((i,s)=>{if(e)i.adoptedStyleSheets=s.map(t=>t instanceof CSSStyleSheet?t:t.styleSheet);else for(const e of s){const s=document.createElement("style"),n=t.litNonce;void 0!==n&&s.setAttribute("nonce",n),s.textContent=e.cssText,i.appendChild(s)}})(i,this.constructor.elementStyles),i}connectedCallback(){this.renderRoot??=this.createRenderRoot(),this.enableUpdating(!0),this._$EO?.forEach(t=>t.hostConnected?.())}enableUpdating(t){}disconnectedCallback(){this._$EO?.forEach(t=>t.hostDisconnected?.())}attributeChangedCallback(t,e,i){this._$AK(t,i)}_$ET(t,e){const i=this.constructor.elementProperties.get(t),s=this.constructor._$Eu(t,i);if(void 0!==s&&!0===i.reflect){const n=(void 0!==i.converter?.toAttribute?i.converter:v).toAttribute(e,i.type);this._$Em=t,null==n?this.removeAttribute(s):this.setAttribute(s,n),this._$Em=null}}_$AK(t,e){const i=this.constructor,s=i._$Eh.get(t);if(void 0!==s&&this._$Em!==s){const t=i.getPropertyOptions(s),n="function"==typeof t.converter?{fromAttribute:t.converter}:void 0!==t.converter?.fromAttribute?t.converter:v;this._$Em=s;const o=n.fromAttribute(e,t.type);this[s]=o??this._$Ej?.get(s)??o,this._$Em=null}}requestUpdate(t,e,i,s=!1,n){if(void 0!==t){const o=this.constructor;if(!1===s&&(n=this[t]),i??=o.getPropertyOptions(t),!((i.hasChanged??y)(n,e)||i.useDefault&&i.reflect&&n===this._$Ej?.get(t)&&!this.hasAttribute(o._$Eu(t,i))))return;this.C(t,e,i)}!1===this.isUpdatePending&&(this._$ES=this._$EP())}C(t,e,{useDefault:i,reflect:s,wrapped:n},o){i&&!(this._$Ej??=new Map).has(t)&&(this._$Ej.set(t,o??e??this[t]),!0!==n||void 0!==o)||(this._$AL.has(t)||(this.hasUpdated||i||(e=void 0),this._$AL.set(t,e)),!0===s&&this._$Em!==t&&(this._$Eq??=new Set).add(t))}async _$EP(){this.isUpdatePending=!0;try{await this._$ES}catch(t){Promise.reject(t)}const t=this.scheduleUpdate();return null!=t&&await t,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??=this.createRenderRoot(),this._$Ep){for(const[t,e]of this._$Ep)this[t]=e;this._$Ep=void 0}const t=this.constructor.elementProperties;if(t.size>0)for(const[e,i]of t){const{wrapped:t}=i,s=this[e];!0!==t||this._$AL.has(e)||void 0===s||this.C(e,void 0,i,s)}}let t=!1;const e=this._$AL;try{t=this.shouldUpdate(e),t?(this.willUpdate(e),this._$EO?.forEach(t=>t.hostUpdate?.()),this.update(e)):this._$EM()}catch(e){throw t=!1,this._$EM(),e}t&&this._$AE(e)}willUpdate(t){}_$AE(t){this._$EO?.forEach(t=>t.hostUpdated?.()),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(t)),this.updated(t)}_$EM(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(t){return!0}update(t){this._$Eq&&=this._$Eq.forEach(t=>this._$ET(t,this[t])),this._$EM()}updated(t){}firstUpdated(t){}};w.elementStyles=[],w.shadowRootOptions={mode:"open"},w[f("elementProperties")]=new Map,w[f("finalized")]=new Map,g?.({ReactiveElement:w}),(u.reactiveElementVersions??=[]).push("2.1.2");const k=globalThis,x=t=>t,$=k.trustedTypes,S=$?$.createPolicy("lit-html",{createHTML:t=>t}):void 0,M="$lit$",C=`lit$${Math.random().toFixed(9).slice(2)}$`,D="?"+C,T=`<${D}>`,P=document,R=()=>P.createComment(""),z=t=>null===t||"object"!=typeof t&&"function"!=typeof t,A=Array.isArray,I="[ \t\n\f\r]",E=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,N=/-->/g,O=/>/g,F=RegExp(`>|${I}(?:([^\\s"'>=/]+)(${I}*=${I}*(?:[^ \t\n\f\r"'\`<>=]|("|')|))|$)`,"g"),L=/'/g,H=/"/g,q=/^(?:script|style|textarea|title)$/i,U=t=>(e,...i)=>({_$litType$:t,strings:e,values:i}),j=U(1),W=U(2),B=Symbol.for("lit-noChange"),G=Symbol.for("lit-nothing"),V=new WeakMap,K=P.createTreeWalker(P,129);function Y(t,e){if(!A(t)||!t.hasOwnProperty("raw"))throw Error("invalid template strings array");return void 0!==S?S.createHTML(e):e}const J=(t,e)=>{const i=t.length-1,s=[];let n,o=2===e?"":3===e?"":"")),s]};class Z{constructor({strings:t,_$litType$:e},i){let s;this.parts=[];let n=0,o=0;const r=t.length-1,a=this.parts,[l,c]=J(t,e);if(this.el=Z.createElement(l,i),K.currentNode=this.el.content,2===e||3===e){const t=this.el.content.firstChild;t.replaceWith(...t.childNodes)}for(;null!==(s=K.nextNode())&&a.length0){s.textContent=$?$.emptyScript:"";for(let i=0;iA(t)||"function"==typeof t?.[Symbol.iterator])(t)?this.k(t):this._(t)}O(t){return this._$AA.parentNode.insertBefore(t,this._$AB)}T(t){this._$AH!==t&&(this._$AR(),this._$AH=this.O(t))}_(t){this._$AH!==G&&z(this._$AH)?this._$AA.nextSibling.data=t:this.T(P.createTextNode(t)),this._$AH=t}$(t){const{values:e,_$litType$:i}=t,s="number"==typeof i?this._$AC(t):(void 0===i.el&&(i.el=Z.createElement(Y(i.h,i.h[0]),this.options)),i);if(this._$AH?._$AD===s)this._$AH.p(e);else{const t=new Q(s,this),i=t.u(this.options);t.p(e),this.T(i),this._$AH=t}}_$AC(t){let e=V.get(t.strings);return void 0===e&&V.set(t.strings,e=new Z(t)),e}k(t){A(this._$AH)||(this._$AH=[],this._$AR());const e=this._$AH;let i,s=0;for(const n of t)s===e.length?e.push(i=new tt(this.O(R()),this.O(R()),this,this.options)):i=e[s],i._$AI(n),s++;s2||""!==i[0]||""!==i[1]?(this._$AH=Array(i.length-1).fill(new String),this.strings=i):this._$AH=G}_$AI(t,e=this,i,s){const n=this.strings;let o=!1;if(void 0===n)t=X(this,t,e,0),o=!z(t)||t!==this._$AH&&t!==B,o&&(this._$AH=t);else{const s=t;let r,a;for(t=n[0],r=0;r{const s=i?.renderBefore??e;let n=s._$litPart$;if(void 0===n){const t=i?.renderBefore??null;s._$litPart$=n=new tt(e.insertBefore(R(),t),t,void 0,i??{})}return n._$AI(t),n})(e,this.renderRoot,this.renderOptions)}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(!1)}render(){return B}}lt._$litElement$=!0,lt.finalized=!0,at.litElementHydrateSupport?.({LitElement:lt});const ct=at.litElementPolyfillSupport;ct?.({LitElement:lt}),(at.litElementVersions??=[]).push("4.2.2");const ht=new WeakMap;let dt=0;class pt extends lt{constructor(){super(...arguments),this.title="",this.icon="",this.wide=!1,this.dismissOnScrim=!1,this.hass=null,this._opener=null,this._focusRoot=null,this._useHaDialog=!1,this._closing=!1,this._titleId="hp-dialog-title-"+ ++dt,this._focusInitial=()=>{const t=this.querySelector("[autofocus]")||this._focusableElements()[0]||(this._useHaDialog?null:this.renderRoot.querySelector(".close"))||this.renderRoot.querySelector(".surface")||this.renderRoot.querySelector("ha-dialog");t?.focus({preventScroll:!0})},this._requestClose=()=>{this._closing||(this._closing=!0,this.dispatchEvent(new CustomEvent("hp-close",{bubbles:!0,composed:!0})))},this._onKeyDown=t=>{if("Escape"===t.key)return t.preventDefault(),t.stopImmediatePropagation(),void this._requestClose();if("Tab"!==t.key||this._useHaDialog)return;const e=this.renderRoot.querySelector(".close"),i=e?[e,...this._focusableElements()]:this._focusableElements();if(!i.length)return t.preventDefault(),void this.renderRoot.querySelector(".surface")?.focus({preventScroll:!0});const s=this._deepActiveElement(),n=i[0],o=i[i.length-1];!t.shiftKey||s!==n&&i.includes(s)?t.shiftKey||s!==o||(t.preventDefault(),n.focus()):(t.preventDefault(),o.focus())},this._onFallbackCancel=t=>{t.preventDefault(),this._requestClose()},this._onFallbackClick=t=>{this.dismissOnScrim&&t.target===t.currentTarget&&this._requestClose()}}connectedCallback(){super.connectedCallback(),this._opener=this._deepActiveElement();const t=this.getRootNode();this._focusRoot=t;const e=ht.get(t)||{dialogs:new Set,opener:this._opener};e.dialogs.add(this),ht.set(t,e),this._useHaDialog=!!customElements.get("ha-dialog"),this.addEventListener("keydown",this._onKeyDown,!0)}disconnectedCallback(){this.removeEventListener("keydown",this._onKeyDown,!0);const t=this._focusRoot,e=this._opener;this._opener=null,this._focusRoot=null;const i=t?ht.get(t):void 0;i?.dialogs.delete(this),super.disconnectedCallback(),t&&i&&requestAnimationFrame(()=>{const i=ht.get(t);if(!i)return;if(!i.dialogs.size)return i.opener?.isConnected&&i.opener.focus({preventScroll:!0}),void ht.delete(t);const s=e?.closest("hp-dialog");e?.isConnected&&s&&i.dialogs.has(s)&&e.focus({preventScroll:!0})})}firstUpdated(t){if(super.firstUpdated(t),!this._useHaDialog){const t=this.renderRoot.querySelector("dialog");t&&!t.open&&t.showModal()}queueMicrotask(()=>this._focusInitial())}_deepActiveElement(){let t=document.activeElement;for(;t?.shadowRoot?.activeElement;)t=t.shadowRoot.activeElement;return t&&t!==document.body?t:null}_focusableElements(){const t=["[autofocus]","a[href]","button:not([disabled])",'input:not([disabled]):not([type="hidden"])',"select:not([disabled])","textarea:not([disabled])",'[contenteditable="true"]','[tabindex]:not([tabindex="-1"])'].join(",");return Array.from(this.querySelectorAll(t)).filter(t=>{const e=getComputedStyle(t);return!t.hidden&&"none"!==e.display&&"hidden"!==e.visibility})}render(){const t=j`
+ ${this.icon?j``:G}
${this.title}
- `;return this._useHaDialog?W``;return this._useHaDialog?j`${t}
- `:W`