0?(r-e.t)/t:0;return{c1:Mt(e.c1,n.c1,i),c2:Mt(e.c2,n.c2,i),c3:Mt(e.c3,n.c3,i),mood:i<.5?e.mood:n.mood}}}const n=i[i.length-1];return{c1:n.c1,c2:n.c2,c3:n.c3,mood:n.mood}}function Rt(t,e,i,r){const n=(r-90)*Math.PI/180;return[t+i*Math.cos(n),e+i*Math.sin(n)]}function Ut(t,e,i,r,n){const[s,o]=Rt(t,e,i,r),[a,l]=Rt(t,e,i,n);return`M ${s} ${o} A ${i} ${i} 0 ${n-r>180?1:0} 1 ${a} ${l}`}const Ot=t=>1-Math.pow(1-t,3),zt="radial-gradient(120% 80% at 50% 0%, rgba(40, 90, 200, 0.25), transparent 60%), linear-gradient(180deg, #0b1326, #060a14)",Nt="linear-gradient(180deg, #0b1326, #060a14)";function Lt(t,e){const i=(t??"").trim(),r=0===i.length?e:i,n="transparent"===r.toLowerCase();return{"--pg-bg":r,"--pg-text":n?"var(--primary-text-color, #eef3ff)":"#eef3ff","--pg-muted":n?"var(--secondary-text-color, #6b7894)":"#6b7894"}}const Tt="#1ee0ff",Ht="#ff7a2b",jt="#ff1a3c";function Dt(t,e,i,r,n){let s=e,o=i??r;return"number"==typeof t?s=t:t&&"object"==typeof t&&("number"==typeof t.value&&(s=t.value),"string"==typeof t.color&&t.color.trim().length>0&&(o=t.color)),{value:s,color:o,mood:n}}function Ft(t){const e=t.min??0,i=t.max??5e3,r=Math.max(1,i-e),n=Dt(t.normal,e+.2*r,t.normal_color,Tt,"NORMAL"),s=Dt(t.warning,e+.6*r,t.warning_color,Ht,"WARNING"),o=Dt(t.critical,i,t.critical_color,jt,"CRITICAL"),a=t=>{return{t:Ct((t.value-e)/r,0,1),...(i=t.color,{c1:i,c2:Mt(i,"#000000",.35),c3:Mt(i,"#000000",.7)}),mood:t.mood};var i};return[a(n),a(s),a(o)]}(window.customCards=window.customCards||[]).push({type:yt,name:"Power Gauge Card",description:"A glowing, animated power consumption gauge that shifts colors with load.",preview:!0,documentationURL:"https://github.com/lirum/ha-power-gauge"});const It=200,Wt=200,Bt=150,qt=130;let Gt=class extends dt{constructor(){super(...arguments),this._animated=0,this._live=0,this._stops=[],this._target=0,this._initialized=!1,this._animFrom=0,this._animTo=0,this._animStart=0,this._ambientStart=0}static async getConfigElement(){return await Promise.resolve().then(function(){return Qt}),document.createElement(wt)}static getStubConfig(){return{type:`custom:${yt}`,entity:"",max:5e3}}setConfig(t){if(!t)throw new Error("Invalid configuration");if(!t.entity)throw new Error("You need to define an entity");this._config={min:0,max:5e3,precision:0,rolling_numbers:!0,...t},this._stops=Ft(this._config)}getCardSize(){return 5}connectedCallback(){super.connectedCallback(),this._ambientStart=performance.now(),this._startAmbient()}disconnectedCallback(){super.disconnectedCallback(),this._animRaf&&cancelAnimationFrame(this._animRaf),this._ambientRaf&&cancelAnimationFrame(this._ambientRaf)}willUpdate(t){if(!this.hass||!this._config)return;const e=this._readEntityValue();return null===e?(this._initialized=!1,this._animRaf&&cancelAnimationFrame(this._animRaf),void(this._animRaf=void 0)):this._initialized?void(e!==this._target&&(this._target=e,this._startAnim(e))):(this._initialized=!0,this._target=e,this._animated=e,void(this._live=e))}_readEntityValue(){if(!this.hass||!this._config)return null;const t=this.hass.states[this._config.entity];if(!t)return null;const e=t.state.trim();if(""===e||"unavailable"===e||"unknown"===e)return null;const i=Number(e);return Number.isFinite(i)?i:null}_startAnim(t){this._animRaf&&cancelAnimationFrame(this._animRaf),this._animFrom=this._animated,this._animTo=t,this._animStart=performance.now();const e=t=>{const i=Ct((t-this._animStart)/700,0,1);this._animated=St(this._animFrom,this._animTo,Ot(i)),this._animRaf=i<1?requestAnimationFrame(e):void 0};this._animRaf=requestAnimationFrame(e)}_startAmbient(){const t=e=>{if(this._initialized&&(this._config?.rolling_numbers??1)){const t=(e-this._ambientStart)/1e3,i=.012*Math.sin(t*Math.PI*2/2.6);this._live=this._animated+i*this._animated}else this._initialized&&(this._live=this._animated);this._ambientRaf=requestAnimationFrame(t)};this._ambientRaf=requestAnimationFrame(t)}render(){if(!this._config||!this.hass)return J;const t=this.hass.states[this._config.entity];if(!t)return q`
Entity not found: ${this._config.entity}
`;const e=this._config.min??0,i=this._config.max??5e3,r=Math.max(1,i-e),n=this._initialized&&null!==this._readEntityValue(),s=n?this._live:e,o=n?Ct((s-e)/r,0,1):0,a=Pt(o,this._stops),l=this._config.unit??t.attributes.unit_of_measurement??"W",c=this._config.name??t.attributes.friendly_name??this._config.entity,d=this._config.precision??0,h=n?this._format(s,d):"—",p=n?this._secondaryLine(s,l,a):"NO DATA",u={"--c1":a.c1,"--c2":a.c2,"--c3":a.c3,...Lt(this._config.background,zt)},m=qt+280*o,[f,g]=Rt(It,Wt,Bt,m);return q`
${this._renderSvg(a,m)}
${n?"Live draw":"Source unavailable"}
${h}${n?q`${l} `:J}
${p}
${n?"Streaming":"No data"}
Now ${n?`${h} ${l}`:"—"}
Limit ${n?this._formatLimit(i,l):"—"}
`}_format(t,e){return e<=0?Math.round(t).toLocaleString():t.toLocaleString(void 0,{minimumFractionDigits:e,maximumFractionDigits:e})}_formatLimit(t,e){return"W"===e&&t>=1e3?`${(t/1e3).toFixed(1)} kW`:`${t.toLocaleString()} ${e}`}_secondaryLine(t,e,i){return"W"===e?`${(t/1e3).toFixed(2)} kW · ${i.mood}`:i.mood}_renderSvg(t,e){const i=[],r=(e-qt)/280;for(let e=0;e<=80;e++){const n=e/80,s=qt+280*n,o=e%8==0,a=128,l=Bt-(o?8:14),[c,d]=Rt(It,Wt,a,s),[h,p]=Rt(It,Wt,l,s),u=n<=r;i.push(G`
`)}return q`
${i}
`}};Gt.styles=a`
:host {
--pg-bg: ${o(zt)};
--pg-text: #eef3ff;
--pg-muted: #6b7894;
--c1: #1ee0ff;
--c2: #2a7bff;
--c3: #0a3aa0;
display: block;
}
ha-card {
background: var(--pg-bg);
color: var(--pg-text);
border: 1px solid color-mix(in oklab, currentColor 12%, transparent);
border-radius: var(--ha-card-border-radius, 16px);
box-shadow:
0 20px 40px rgba(0, 0, 0, 0.45),
0 0 0 1px color-mix(in oklab, currentColor 2%, transparent) inset;
overflow: hidden;
font-family: 'Inter', var(--primary-font-family, system-ui, sans-serif);
}
.panel {
position: relative;
padding: 22px 20px 18px;
display: flex;
flex-direction: column;
}
.panel::before {
content: '';
position: absolute;
inset: 0;
pointer-events: none;
background:
radial-gradient(1px 1px at 20% 30%, color-mix(in oklab, currentColor 60%, transparent), transparent),
radial-gradient(1px 1px at 70% 60%, color-mix(in oklab, currentColor 40%, transparent), transparent),
radial-gradient(1px 1px at 40% 80%, color-mix(in oklab, currentColor 50%, transparent), transparent),
radial-gradient(1px 1px at 85% 20%, color-mix(in oklab, currentColor 30%, transparent), transparent),
radial-gradient(1px 1px at 15% 70%, color-mix(in oklab, currentColor 40%, transparent), transparent);
opacity: 0.3;
}
.header {
display: flex;
justify-content: space-between;
align-items: flex-start;
position: relative;
z-index: 1;
}
.title {
font-size: 20px;
font-weight: 600;
line-height: 1.1;
letter-spacing: -0.4px;
}
.subtitle {
font-size: 11px;
color: var(--pg-muted);
margin-top: 4px;
letter-spacing: 0.4px;
}
.stage {
flex: 1;
display: grid;
place-items: center;
position: relative;
margin: 8px 0;
z-index: 1;
}
.gauge {
position: relative;
width: 100%;
max-width: 320px;
aspect-ratio: 1 / 1;
}
.gauge svg {
position: absolute;
inset: 0;
width: 100%;
height: 100%;
}
.center {
position: absolute;
inset: 0;
display: grid;
place-items: center;
pointer-events: none;
}
.core {
width: 56%;
height: 56%;
border-radius: 50%;
background:
radial-gradient(circle at 50% 40%, rgba(255, 255, 255, 0.06), transparent 60%),
radial-gradient(
circle at 50% 100%,
color-mix(in oklab, var(--c2) 35%, transparent),
transparent 70%
),
#050912;
border: 1px solid rgba(255, 255, 255, 0.06);
box-shadow:
inset 0 0 40px color-mix(in oklab, var(--c2) 30%, transparent),
inset 0 0 0 1px rgba(255, 255, 255, 0.04),
0 0 60px color-mix(in oklab, var(--c1) 20%, transparent);
display: grid;
place-items: center;
transition: box-shadow 0.6s;
}
.reading {
text-align: center;
padding: 0 8px;
}
.label-now {
font-size: 9px;
letter-spacing: 2.5px;
color: var(--pg-muted);
text-transform: uppercase;
font-weight: 600;
margin-bottom: 6px;
}
.value {
font-size: 36px;
font-weight: 300;
letter-spacing: -1.2px;
font-variant-numeric: tabular-nums;
/* Always white inside the dark gauge core regardless of card theme. */
color: #fff;
text-shadow: 0 0 20px color-mix(in oklab, var(--c1) 60%, transparent);
line-height: 1;
}
.unit-inline {
font-size: 16px;
color: color-mix(in oklab, #fff 55%, transparent);
margin-left: 4px;
}
.unit {
font-size: 11px;
color: color-mix(in oklab, #fff 55%, transparent);
margin-top: 6px;
letter-spacing: 1.5px;
font-weight: 500;
}
.knob {
position: absolute;
width: 22px;
height: 22px;
border-radius: 50%;
background: #0a1020;
border: 1.5px solid rgba(255, 255, 255, 0.6);
transform: translate(-50%, -50%);
pointer-events: none;
box-shadow:
0 0 0 4px rgba(0, 0, 0, 0.4),
0 0 20px color-mix(in oklab, var(--c1) 80%, transparent);
display: grid;
place-items: center;
}
.knob::after {
content: '';
width: 7px;
height: 7px;
border-radius: 50%;
background: var(--c1);
box-shadow: 0 0 8px var(--c1);
}
.status {
display: flex;
justify-content: space-between;
gap: 8px;
padding: 6px 4px 0;
font-size: 11px;
color: var(--pg-muted);
font-variant-numeric: tabular-nums;
position: relative;
z-index: 1;
}
.status b {
color: var(--pg-text);
font-weight: 600;
font-family: 'SF Mono', 'JetBrains Mono', 'Menlo', 'Consolas', ui-monospace, monospace;
letter-spacing: 0;
}
.pulse-dot {
display: inline-block;
width: 6px;
height: 6px;
border-radius: 50%;
background: var(--c1);
margin-right: 6px;
animation: pg-pulse 1.4s ease-in-out infinite;
box-shadow: 0 0 8px var(--c1);
}
.pulse-dot.inactive {
background: var(--pg-muted);
animation: none;
box-shadow: none;
}
.gauge.no-data .spin-slow,
.gauge.no-data .spin-fast,
.gauge.no-data .shimmer {
animation: none;
}
@keyframes pg-pulse {
0%,
100% {
opacity: 1;
transform: scale(1);
}
50% {
opacity: 0.4;
transform: scale(0.7);
}
}
@keyframes pg-spin {
to {
transform: rotate(360deg);
}
}
.spin-slow {
animation: pg-spin 24s linear infinite;
transform-origin: 50% 50%;
}
.spin-fast {
animation: pg-spin 9s linear infinite reverse;
transform-origin: 50% 50%;
}
@keyframes pg-shimmer {
0%,
100% {
opacity: 0.85;
}
50% {
opacity: 1;
}
}
.shimmer {
animation: pg-shimmer 2.4s ease-in-out infinite;
}
.error {
padding: 16px;
color: var(--error-color, #db4437);
}
@media (prefers-reduced-motion: reduce) {
.spin-slow,
.spin-fast,
.shimmer,
.pulse-dot {
animation: none;
}
}
`,t([ft({attribute:!1})],Gt.prototype,"hass",void 0),t([gt()],Gt.prototype,"_config",void 0),t([gt()],Gt.prototype,"_animated",void 0),t([gt()],Gt.prototype,"_live",void 0),t([gt()],Gt.prototype,"_stops",void 0),Gt=t([pt(yt)],Gt),(window.customCards=window.customCards||[]).push({type:At,name:"Power Gauge Bar Card",description:"A compact linear power gauge — stack one row per device, sharing color levels.",preview:!0,documentationURL:"https://github.com/Lirum-Labs/ha-power-gauge"});let Vt=class extends dt{constructor(){super(...arguments),this._live={},this._animated={},this._targets={},this._ramps={},this._initialized=new Set,this._ambientStart=0,this._loop=()=>{const t=performance.now(),e=this._config?.rolling_numbers??!0,i=(t-this._ambientStart)/1e3,r=e?.012*Math.sin(i*Math.PI*2/2.6):0,n={};for(const i of Object.keys(this._animated)){const s=this._ramps[i];if(s){const e=Ct((t-s.start)/500,0,1);this._animated[i]=St(s.from,s.to,Ot(e)),e>=1&&delete this._ramps[i]}const o=this._animated[i];n[i]=e?o+r*o:o}this._live=n,this._raf=requestAnimationFrame(this._loop)}}static async getConfigElement(){return await Promise.resolve().then(function(){return re}),document.createElement(kt)}static getStubConfig(){return{type:`custom:${At}`,entities:[],max:5e3}}setConfig(t){if(!t)throw new Error("Invalid configuration");if(!Array.isArray(t.entities)||0===t.entities.length)throw new Error("You need to define at least one entity");this._config={min:0,max:5e3,precision:0,rolling_numbers:!0,...t}}getCardSize(){return Math.max(1,this._config?.entities.length??1)}connectedCallback(){super.connectedCallback(),this._ambientStart=performance.now(),this._loop()}disconnectedCallback(){super.disconnectedCallback(),this._raf&&cancelAnimationFrame(this._raf)}willUpdate(t){if(this.hass&&this._config)for(const t of this._config.entities){const e="string"==typeof t?t:t.entity;if(!e)continue;const i=this._readValue(e);null!==i?this._initialized.has(e)?this._targets[e]!==i&&(this._targets[e]=i,this._ramps[e]={from:this._animated[e]??i,to:i,start:performance.now()}):(this._initialized.add(e),this._targets[e]=i,this._animated[e]=i,this._live[e]=i):(this._initialized.delete(e),delete this._targets[e],delete this._animated[e],delete this._live[e],delete this._ramps[e])}}_readValue(t){if(!this.hass)return null;const e=this.hass.states[t];if(!e)return null;const i=e.state.trim();if(""===i||"unavailable"===i||"unknown"===i)return null;const r=Number(i);return Number.isFinite(r)?r:null}_resolveRow(t){if(!this.hass||!this._config)return null;const e="object"==typeof t&&null!==t,i=e?t.entity:t;if(!i)return null;const r=this.hass.states[i],n={...this._config,...e?t:{}},s=n.min??0,o=n.max??5e3,a=n.unit??r?.attributes.unit_of_measurement??"W",l=n.precision??0;return{entity:i,name:e&&t.name||r?.attributes.friendly_name||i,unit:a,precision:l,min:s,max:o,stops:Ft(n)}}render(){if(!this._config||!this.hass)return J;const t=this._config.entities.map(t=>this._resolveRow(t)).filter(t=>null!==t),e=Lt(this._config.background,Nt);return q`
${this._config.title?q`
${this._config.title}
`:J}
${t.map(t=>this._renderRow(t))}
`}_renderRow(t){const e=this._initialized.has(t.entity)&&null!==this._readValue(t.entity),i=this._live[t.entity]??this._animated[t.entity]??0,r=Math.max(1,t.max-t.min),n=e?Ct((i-t.min)/r,0,1):0,s=Pt(n,t.stops),o=e?this._format(i,t.precision):"—";return q`
${t.name}
${o}${e?q`${t.unit} `:J}
`}_format(t,e){return e<=0?Math.round(t).toLocaleString():t.toLocaleString(void 0,{minimumFractionDigits:e,maximumFractionDigits:e})}};Vt.styles=a`
:host {
--pg-bg: ${o(Nt)};
--pg-text: #eef3ff;
--pg-muted: #6b7894;
display: block;
}
ha-card {
background: var(--pg-bg);
color: var(--pg-text);
border: 1px solid color-mix(in oklab, currentColor 12%, transparent);
border-radius: var(--ha-card-border-radius, 14px);
box-shadow:
0 12px 28px rgba(0, 0, 0, 0.35),
0 0 0 1px color-mix(in oklab, currentColor 2%, transparent) inset;
overflow: hidden;
font-family: 'Inter', var(--primary-font-family, system-ui, sans-serif);
}
.wrap {
padding: 14px 14px 16px;
display: flex;
flex-direction: column;
gap: 12px;
}
.card-title {
font-size: 13px;
font-weight: 600;
letter-spacing: 0.4px;
text-transform: uppercase;
color: color-mix(in oklab, currentColor 70%, transparent);
padding: 2px 2px 0;
}
.stack {
display: flex;
flex-direction: column;
gap: 10px;
}
.row {
--c1: #1ee0ff;
--c2: #2a7bff;
position: relative;
padding: 10px 14px 12px;
border-radius: 12px;
background: linear-gradient(
180deg,
color-mix(in oklab, currentColor 3%, transparent),
color-mix(in oklab, currentColor 0.5%, transparent)
);
border: 1px solid color-mix(in oklab, currentColor 10%, transparent);
box-shadow: inset 0 1px 0 color-mix(in oklab, currentColor 3%, transparent);
display: grid;
grid-template-columns: 1fr auto;
grid-template-rows: auto auto;
column-gap: 14px;
row-gap: 8px;
align-items: center;
}
.label {
grid-column: 1;
grid-row: 1;
font-size: 12px;
color: color-mix(in oklab, currentColor 78%, transparent);
letter-spacing: 0.2px;
font-weight: 500;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.value {
grid-column: 2;
grid-row: 1;
font-family: 'JetBrains Mono', ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
font-size: 14px;
font-weight: 500;
color: var(--pg-text);
font-variant-numeric: tabular-nums;
letter-spacing: -0.2px;
}
.value .unit {
font-size: 11px;
color: color-mix(in oklab, currentColor 55%, transparent);
margin-left: 4px;
font-weight: 400;
}
.track {
grid-column: 1 / -1;
grid-row: 2;
position: relative;
height: 6px;
border-radius: 999px;
background: color-mix(in oklab, currentColor 8%, transparent);
overflow: hidden;
}
.fill {
position: absolute;
inset: 0;
width: var(--w);
border-radius: 999px;
background: linear-gradient(90deg, var(--c1), var(--c2));
box-shadow:
0 0 8px color-mix(in oklab, var(--c1) 50%, transparent),
0 0 14px color-mix(in oklab, var(--c2) 30%, transparent);
transition: background 0.4s;
}
.cap {
position: absolute;
top: 50%;
left: var(--w);
width: 10px;
height: 10px;
border-radius: 50%;
background: var(--c1);
transform: translate(-50%, -50%);
box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.5), 0 0 8px var(--c1);
}
.row.no-data .fill,
.row.no-data .cap {
opacity: 0;
}
@media (prefers-reduced-motion: reduce) {
.fill {
transition: none;
}
}
`,t([ft({attribute:!1})],Vt.prototype,"hass",void 0),t([gt()],Vt.prototype,"_config",void 0),t([gt()],Vt.prototype,"_live",void 0),Vt=t([pt(At)],Vt),console.info("%c POWER-GAUGE %c v0.2.3 ","color:#fff; background:#1ee0ff; font-weight:600; padding:2px 6px; border-radius:3px 0 0 3px;","color:#1ee0ff; background:#0a0f1c; font-weight:600; padding:2px 6px; border-radius:0 3px 3px 0;");const Jt={number:{mode:"box",step:1}},Yt=[{name:"entity",required:!0,selector:{entity:{domain:["sensor","input_number"]}}},{name:"",type:"grid",schema:[{name:"name",selector:{text:{}}},{name:"unit",selector:{text:{}}}]},{name:"",type:"grid",schema:[{name:"min",selector:Jt},{name:"max",selector:Jt},{name:"precision",selector:{number:{mode:"box",min:0,max:4,step:1}}}]},{name:"rolling_numbers",selector:{boolean:{}}},{name:"background",selector:{text:{}}},{name:"",type:"expandable",title:"Color levels",schema:[{name:"",type:"grid",schema:[{name:"normal",selector:Jt},{name:"normal_color",selector:{text:{}}}]},{name:"",type:"grid",schema:[{name:"warning",selector:Jt},{name:"warning_color",selector:{text:{}}}]},{name:"",type:"grid",schema:[{name:"critical",selector:Jt},{name:"critical_color",selector:{text:{}}}]}]}],Zt={entity:"Entity (required)",name:"Name (optional)",unit:"Unit override (optional)",min:"Minimum value",max:"Maximum value",precision:"Decimal places",rolling_numbers:"Rolling numbers (rapid fluctuation around the live value)",background:'Background (CSS color/gradient, "transparent" for HA theme)',normal:"Normal threshold",normal_color:`Normal color (default ${Tt})`,warning:"Warning threshold",warning_color:`Warning color (default ${Ht})`,critical:"Critical threshold",critical_color:`Critical color (default ${jt})`};let Kt=class extends dt{constructor(){super(...arguments),this._computeLabel=t=>Zt[t.name]??t.name}setConfig(t){this._config=t}render(){return this.hass&&this._config?q`
`:J}_valueChanged(t){const e=t.detail;this.dispatchEvent(new CustomEvent("config-changed",{detail:{config:e.value},bubbles:!0,composed:!0}))}};Kt.styles=a`
:host {
display: block;
}
ha-form {
display: block;
}
`,t([ft({attribute:!1})],Kt.prototype,"hass",void 0),t([gt()],Kt.prototype,"_config",void 0),Kt=t([pt(wt)],Kt);var Qt=Object.freeze({__proto__:null,get PowerGaugeCardEditor(){return Kt}});const Xt={number:{mode:"box",step:1}},te=[{name:"title",selector:{text:{}}},{name:"entities",required:!0,selector:{entity:{multiple:!0,domain:["sensor","input_number"]}}},{name:"",type:"grid",schema:[{name:"min",selector:Xt},{name:"max",selector:Xt},{name:"precision",selector:{number:{mode:"box",min:0,max:4,step:1}}},{name:"unit",selector:{text:{}}}]},{name:"rolling_numbers",selector:{boolean:{}}},{name:"background",selector:{text:{}}},{name:"",type:"expandable",title:"Color levels",schema:[{name:"",type:"grid",schema:[{name:"normal",selector:Xt},{name:"normal_color",selector:{text:{}}}]},{name:"",type:"grid",schema:[{name:"warning",selector:Xt},{name:"warning_color",selector:{text:{}}}]},{name:"",type:"grid",schema:[{name:"critical",selector:Xt},{name:"critical_color",selector:{text:{}}}]}]}],ee={title:"Card title (optional)",entities:"Entities (one bar per entity)",min:"Minimum value",max:"Maximum value",precision:"Decimal places",unit:"Unit override (optional)",rolling_numbers:"Rolling numbers (rapid fluctuation around the live value)",background:'Background (CSS color/gradient, "transparent" for HA theme)',normal:"Normal threshold",normal_color:`Normal color (default ${Tt})`,warning:"Warning threshold",warning_color:`Warning color (default ${Ht})`,critical:"Critical threshold",critical_color:`Critical color (default ${jt})`};let ie=class extends dt{constructor(){super(...arguments),this._computeLabel=t=>ee[t.name]??t.name}setConfig(t){this._config=t}render(){return this.hass&&this._config?q`
For per-row overrides (custom name, max, or color per device), edit the
card YAML — each entry under entities can be
{ entity, name, max, normal, warning, critical, ... }.
`:J}_valueChanged(t){const e=t.detail;this.dispatchEvent(new CustomEvent("config-changed",{detail:{config:e.value},bubbles:!0,composed:!0}))}};ie.styles=a`
:host {
display: block;
}
ha-form {
display: block;
}
.hint {
margin: 12px 4px 0;
font-size: 12px;
color: var(--secondary-text-color, #6b7894);
}
code {
font-family: ui-monospace, 'SF Mono', Menlo, monospace;
font-size: 11px;
background: rgba(127, 127, 127, 0.12);
padding: 1px 5px;
border-radius: 4px;
}
`,t([ft({attribute:!1})],ie.prototype,"hass",void 0),t([gt()],ie.prototype,"_config",void 0),ie=t([pt(kt)],ie);var re=Object.freeze({__proto__:null,get PowerGaugeBarCardEditor(){return ie}});