PageSourceSearch

https://wardrop.casa/frontend_latest/90425.0e64720effef544d.js

js wardrop.casa collected 2026-10-09 22:10:12 UTC 14,169 bytes, 2 lines download raw bytes

1export const __rspack_esm_id=90425;export const __rspack_esm_ids=[90425];export const __webpack_modules__={21739(e,t,s){s.a(e,async function(e,t){try{s(47144),s(89542);var i=s(89797),a=s(58477),o=s(20686),n=s(32379),r=s(66543),l=s(97062),h=s(99401),c=s(47207),d=s(19692),u=e([l]);l=(u.then?(await u)():u)[0];const g=(e,t,s)=>180*(0,d.NN)((0,d.S8)(e,t,s),t,s)/100;class _ extends o.WF{connectedCallback(){super.connectedCallback(),this._rescalePending&&this.hasUpdated&&this._rescaleSvg()}firstUpdated(e){super.firstUpdated(e),(0,c.m)(()=>{this._updated=!0,this.needle&&(this._angle=g(this.value,this.min,this.max)),this._segment_label=this._getSegmentLabel(),this._rescaleSvg()})}willUpdate(e){(e.has("levels")||e.has("min"))&&(this.levels?(this._sortedLevels=[...this.levels].sort((e,t)=>e.level-t.level),this._sortedLevels.length>0&&this._sortedLevels[0].level!==this.min&&this._sortedLevels.unshift({level:this.min,stroke:"var(--info-color)"})):this._sortedLevels=void 0)}updated(e){super.updated(e),this._updated&&(e.has("value")||e.has("valueText")||e.has("label")||e.has("_segment_label"))&&(this._angle=g(this.value,this.min,this.max),this._segment_label=this._getSegmentLabel(),this._rescaleSvg())}render(){const e=40,t=Math.PI*e,s=g(this.value,this.min,this.max),i=this._updated?t*(1-s/180):t;return o.JW` <svg viewBox="-50 -50 100 55" class="gauge"> <path class="levels-base" d="M -40 0 A 40 40 0 0 1 40 0"/> ${this._sortedLevels?.map((t,s,i)=>{const a=t.level,n=s+1<i.length?i[s+1].level:this.max,r=g(a,this.min,this.max),l=g(n,this.min,this.max),h=l-r>180?1:0,c=-40*Math.cos(r*Math.PI/180),d=-40*Math.sin(r*Math.PI/180),u=0===s,_=s===i.length-1;if(u)return o.JW` <path class="level" stroke="${t.stroke}" style="stroke-linecap:butt" d="M ${c} ${d} A ${e} ${e} 0 ${h} 1 40 0"/> `;if(_){const s=l-.5,i=-40*Math.cos(s*Math.PI/180),a=-40*Math.sin(s*Math.PI/180);return o.JW` <path class="level" stroke="${t.stroke}" style="stroke-linecap:butt" d="M ${c} ${d} A ${e} ${e} 0 ${h} 1 40 0"/> <path class="level" stroke="${t.stroke}" style="stroke-linecap:butt" d="M ${i} ${a} A ${e} ${e} 0 0 1 40 0"/> `}return o.JW` <path class="level" stroke="${t.stroke}" style="stroke-linecap:butt" d="M ${c} ${d} A ${e} ${e} 0 ${h} 1 40 0"></path> `})} ${this.needle?o.JW` <path class="needle" d="M -34,-3 L -40,-1 A 1,1,0,0,0,-40,1 L -34,3 A 2,2,0,0,0,-34,-3 Z" style=${(0,r.W)({transform:`rotate(${this._angle}deg)`})}; /> `:o.JW` <path class="value" d="M -40 0 A 40 40 0 0 1 40 0" stroke-dasharray="${t}" style=${(0,r.W)({strokeDashoffset:`${i}`})}; /> `} </svg> <svg class="text"> <text class="value-text" x="0" y="-5" dominant-baseline="middle" text-anchor="middle"> ${this._segment_label?this._segment_label:this.valueText||(0,l.ZV)(this.value,this.locale,this.formatOptions)}${this._segment_label?"":"%"===this.label?(0,h.d)(this.locale)+"%":` ${this.label}`} </text> </svg> `}_rescaleSvg(){if(!this._textSvg||!this._valueText||!this.isConnected)return void(this._rescalePending=!0);const e=this._valueText.getBBox();e.width&&e.height?(this._rescalePending=!1,this._textSvg.setAttribute("viewBox",`${e.x} ${e.y} ${e.width} ${e.height}`)):this._rescalePending=!0}_getSegmentLabel(){if(this._sortedLevels)for(let e=this._sortedLevels.length-1;e>=0;e--)if(this.value>=this._sortedLevels[e].level)return this._sortedLevels[e].label;return""}constructor(...e){super(...e),this.min=0,this.max=100,this.value=0,this.needle=!1,this.label="",this._angle=0,this._updated=!1,this._segment_label="",this._rescalePending=!1,this._resizeController=new a.P(this,{skipInitial:!0,callback:e=>{this._rescalePending&&e[0]?.contentRect.width&&this._rescaleSvg()}})}}_.styles=o.AH`:host{display:block;position:relative}.levels-base{fill:none;stroke:var(--primary-background-color);stroke-width:12px;stroke-linecap:butt}.level{fill:none;stroke-width:12px;stroke-linecap:butt}.value{fill:none;stroke-width:12px;stroke:var(--gauge-color);stroke-linecap:butt;transition:stroke-dashoffset 1s}.needle{fill:var(--primary-text-color);stroke:var(--card-background-color);color:var(--primary-text-color);stroke-width:1px;stroke-linecap:round;transform-origin:0 0;transition:all 1s}.text{max-width:55%;max-height:40%;position:absolute;bottom:10%;left:50%;transform:translate(-50%)}.value-text{font-size:var(--ha-font-size-l);
1fill:var(--primary-text-color);direction:ltr}`,(0,i.Cg)([(0,n.MZ)({type:Number})],_.prototype,"min",void 0),(0,i.Cg)([(0,n.MZ)({type:Number})],_.prototype,"max",void 0),(0,i.Cg)([(0,n.MZ)({type:Number})],_.prototype,"value",void 0),(0,i.Cg)([(0,n.MZ)({attribute:!1})],_.prototype,"formatOptions",void 0),(0,i.Cg)([(0,n.MZ)({attribute:!1})],_.prototype,"valueText",void 0),(0,i.Cg)([(0,n.MZ)({attribute:!1})],_.prototype,"locale",void 0),(0,i.Cg)([(0,n.MZ)({type:Boolean})],_.prototype,"needle",void 0),(0,i.Cg)([(0,n.MZ)({type:Array})],_.prototype,"levels",void 0),(0,i.Cg)([(0,n.MZ)()],_.prototype,"label",void 0),(0,i.Cg)([(0,n.wk)()],_.prototype,"_angle",void 0),(0,i.Cg)([(0,n.wk)()],_.prototype,"_updated",void 0),(0,i.Cg)([(0,n.wk)()],_.prototype,"_segment_label",void 0),(0,i.Cg)([(0,n.P)(".text")],_.prototype,"_textSvg",void 0),(0,i.Cg)([(0,n.P)(".value-text")],_.prototype,"_valueText",void 0),_=(0,i.Cg)([(0,n.EM)("ha-gauge")],_),t()}catch(e){t(e)}})},21649(e,t,s){s(97700);const i=window.externalAppV2||window.externalApp||window.webkit?.messageHandlers?.getExternalAuth||location.search.includes("external_auth=1"),a=window.externalApp||window.externalAppV2;s.d(t,{},{B:a,g:i})},57990(e,t,s){s(97700),s(47144),s(99686);var i=s(89797),a=s(32379);s.d(t,{},{E:e=>{class t extends e{connectedCallback(){super.connectedCallback(),this._checkSubscribed()}disconnectedCallback(){if(super.disconnectedCallback(),this.__unsubs){for(;this.__unsubs.length;){const e=this.__unsubs.pop();e instanceof Promise?e.then(e=>e()):e()}this.__unsubs=void 0}}updated(e){if(super.updated(e),e.has("hass"))this._checkSubscribed();else if(this.hassSubscribeRequiredHostProps)for(const t of e.keys())if(this.hassSubscribeRequiredHostProps.includes(t))return void this._checkSubscribed()}hassSubscribe(){return[]}_checkSubscribed(){void 0===this.__unsubs&&this.isConnected&&void 0!==this.hass&&!this.hassSubscribeRequiredHostProps?.some(e=>void 0===this[e])&&(this.__unsubs=this.hassSubscribe())}}return(0,i.Cg)([(0,a.MZ)({attribute:!1})],t.prototype,"hass",void 0),t}})},93839(e,t,s){s.a(e,async function(e,i){try{s.r(t);var a=s(89797),o=s(20686),n=s(32379),r=s(66543),l=(s(95788),s(21739)),h=(s(79994),s(39622)),c=s(57990),d=s(74654),u=s(70324),g=e([l,h,d]);[l,h,d]=g.then?(await g)():g;const _="M11,9H13V7H11M12,20C7.59,20 4,16.41 4,12C4,7.59 7.59,4 12,4C16.41,4 20,7.59 20,12C20,16.41 16.41,20 12,20M12,2A10,10 0 0,0 2,12A10,10 0 0,0 12,22A10,10 0 0,0 22,12A10,10 0 0,0 12,2M11,17H13V11H11V17Z",p={maximumFractionDigits:0};class v extends((0,c.E)(o.WF)){static async getConfigElement(){return await s.e(90970).then(s.bind(s,88001)),document.createElement("hui-energy-graph-card-editor")}static getStubConfig(e,t,s){return{type:"energy-solar-consumed-gauge"}}hassSubscribe(){return[(0,h.tb)(this.hass,{key:this._config?.collection_key}).subscribe(e=>{this._data=e})]}getCardSize(){return 4}setConfig(e){e.collection_key&&(0,h.s8)(e.collection_key),this._config=e}shouldUpdate(e){return(0,u.xP)(this,e)||e.size>1||!e.has("hass")}render(){if(!this._config||!this.hass)return o.s6;if(!this._data)return o.qy`${this.hass.localize("ui.panel.lovelace.cards.energy.loading")}`;const{summedData:e,compareSummedData:t}=(0,h.gv)(this._data);if(!("solar"in e.total))return o.s6;const s=e.total.to_grid??null;let i;if(null!==s){const t=!!e.to_battery||!!e.from_battery;i=(0,h.pe)(t,e)}return o.qy` <ha-card> ${void 0!==i?o.qy` <ha-gauge min="0" max="100" .value=${i} label="%" .formatOptions=${p} .locale=${this.hass.locale} style=${(0,r.W)({"--gauge-color":this._computeSeverity(i)})};></ha-gauge> <ha-svg-icon id="info" .path=${_}></ha-svg-icon> <ha-tooltip for="info" placement="left"> ${this.hass.localize("ui.panel.lovelace.cards.energy.solar_consumed_gauge.card_indicates_solar_energy_used")} <br/><br/> ${this.hass.localize("ui.panel.lovelace.cards.energy.solar_consumed_gauge.card_indicates_solar_energy_used_charge_home_bat")} </ha-tooltip> <div class="name"> ${this.hass.localize("ui.panel.lovelace.cards.energy.solar_consumed_gauge.self_consumed_solar_energy")} </div> `:null!==s?this.hass.localize("ui.panel.lovelace.cards.energy.solar_consumed_gauge.not_produced_solar_energy"):this.hass.localize("ui.panel.lovelace.cards.energy.solar_consumed_gauge.self_consumed_solar_could_not_calc")} </ha-card> `}_computeSeverity(e){return e>75?d.severityMap.green:e<50?d.severityMap.yellow:d.severityMap.normal}constructor(...e){super(...e),this.hassSubscribeRequiredHostProps=["_config"]}}v.styles=o.AH`ha-card{box-sizing:border-box;flex-direction:column;justify-content:center;align-items:center;height:100%;padding:16px;display:flex;overflow:hidden}ha-gauge{direction:ltr;width:100%;max-width:250px}.name{text-align:center;line-height:initial;color:var(--primary-text-color);width:100%;font-size:var(--ha-font-size-m);margin-top:8px}ha-svg-icon{right:4px;inset-inline-start:initial;inset-inline-end:4px;color:var(--secondary-text-color);position:absolute;top:4px}`,(0,a.Cg)([(0,n.MZ)({attribute:!1})],v.prototype,"hass",void 0),(0,a.Cg)([(0,n.wk)()],v.prototype,"_config",void 0),(0,a.Cg)([(0,n.wk)()],v.prototype,"_data",void 0),v=(0,a.Cg)([(0,n.EM)("hui-energy-solar-consumed-gauge-card")],v),i()}catch(e){i(e)}})}
1,74654(e,t,s){s.a(e,async function(e,i){try{s.r(t);s(47144),s(89542);var a=s(89797),o=s(20686),n=s(32379),r=s(10899),l=s(25771),h=s(66543),c=s(86880),d=s(20125),u=s(56637),g=(s(95788),s(21739)),_=s(52695),p=s(90361),v=s(81748),m=s(35100),f=s(12604),b=s(70324),y=s(37431),x=e([g,y]);[g,y]=x.then?(await x)():x;const $=0,k=100,w={red:"var(--error-color)",green:"var(--success-color)",yellow:"var(--warning-color)",normal:"var(--info-color)"};class C extends o.WF{static async getConfigElement(){return await s.e(22512).then(s.bind(s,11539)),document.createElement("hui-gauge-card-editor")}static getStubConfig(e,t,s){return{type:"gauge",entity:(0,v.B)(e,1,t,s,["counter","input_number","number","sensor"],e=>!isNaN(Number(e.state)))[0]||""}}getCardSize(){return 4}setConfig(e){if(!e.entity)throw new Error("Entity must be specified");if(!(0,u.n)(e.entity))throw new Error("Invalid entity");this._config={min:$,max:k,...e}}render(){if(!this._config||!this.hass)return o.s6;const e=this.hass.states[this._config.entity];if(!e)return o.qy` <hui-warning .hass=${this.hass}> ${(0,y.j)(this.hass,this._config.entity)} </hui-warning> `;if(e.state===_.Hh)return o.qy` <hui-warning>${this.hass.localize("ui.panel.lovelace.warning.entity_unavailable",{entity:this._config.entity})}</hui-warning> `;let t;t=this._config.attribute?this.hass.formatEntityAttributeValueToParts(e,this._config.attribute):this.hass.formatEntityStateToParts(e);const s=this._config.unit,i=s?(0,d.WU)(t):t.map(e=>e.value).join(""),a=this._config.attribute?e.attributes[this._config.attribute]:e.state;if(isNaN(a))return o.qy` <hui-warning>${this.hass.localize(this._config.attribute?"ui.panel.lovelace.warning.attribute_not_numeric":"ui.panel.lovelace.warning.entity_non_numeric",{entity:this._config.entity,attribute:this._config.attribute})}</hui-warning> `;const n=this.hass.formatEntityName(e,this._config.name);return o.qy` <ha-card class=${(0,r.H)({action:(0,f.A)(this._config)})} @action=${this._handleAction} .actionHandler=${(0,p.T)({hasHold:(0,f.h)(this._config.hold_action),hasDoubleClick:(0,f.h)(this._config.double_tap_action)})} tabindex=${(0,l.J)(!this._config.tap_action||(0,f.h)(this._config.tap_action)?"0":void 0)}> <ha-gauge .min=${this._config.min} .max=${this._config.max} .value=${a} .valueText=${i} .locale=${this.hass.locale} .label=${s??""} style=${(0,h.W)({"--gauge-color":this._computeSeverity(Number(a))})}; .needle=${this._config.needle} .levels=${this._config.needle?this._severityLevels():void 0}></ha-gauge> <p class="title" .title=${n}>${n}</p> </ha-card> `}
1shouldUpdate(e){return(0,b.LX)(this,e)}updated(e){if(super.updated(e),!this._config||!this.hass)return;const t=e.get("hass"),s=e.get("_config");t&&s&&t.themes===this.hass.themes&&s.theme===this._config.theme||(0,c.Q)(this,this.hass.themes,this._config.theme)}_computeSeverity(e){if(this._config.needle)return;let t=this._config.segments;if(t){t=[...t].sort((e,t)=>e.from-t.from);for(let s=0;s<t.length;s++){const i=t[s];if(i&&e>=i.from&&(s+1===t.length||e<t[s+1]?.from))return i.color}return w.normal}const s=this._config.severity;if(!s)return w.normal;const i=Object.keys(s).map(e=>[e,s[e]]);for(const e of i)if(null==w[e[0]]||isNaN(e[1]))return w.normal;return i.sort((e,t)=>e[1]-t[1]),e>=i[0][1]&&e<i[1][1]?w[i[0][0]]:e>=i[1][1]&&e<i[2][1]?w[i[1][0]]:e>=i[2][1]?w[i[2][0]]:w.normal}_severityLevels(){const e=this._config.segments;if(e)return e.map(e=>({level:e?.from,stroke:e?.color,label:e?.label}));const t=this._config.severity;if(!t)return[{level:0,stroke:w.normal}];return Object.keys(t).map(e=>({level:t[e],stroke:w[e]}))}_handleAction(e){(0,m.$)(this,this.hass,this._config,e.detail.action)}}C.styles=o.AH`ha-card{height:100%;padding:var(--ha-space-3);box-sizing:border-box;flex-direction:column;justify-content:center;align-items:center;display:flex;overflow:hidden}ha-card.action{cursor:pointer}ha-card:focus{outline:none}.title{width:100%;font-size:var(--ha-font-size-m);line-height:var(--ha-line-height-expanded);text-align:center;box-sizing:border-box;text-overflow:ellipsis;white-space:nowrap;color:var(--primary-text-color);flex:none;margin:0;overflow:hidden}ha-gauge{width:100%;max-width:250px}`,(0,a.Cg)([(0,n.MZ)({attribute:!1})],C.prototype,"hass",void 0),(0,a.Cg)([(0,n.wk)()],C.prototype,"_config",void 0),C=(0,a.Cg)([(0,n.EM)("hui-gauge-card")],C),s.d(t,{},{DEFAULT_MAX:k,DEFAULT_MIN:$,severityMap:w}),i()}catch(e){i(e)}})},19692(e,t,s){s.d(t,{},{NN:(e,t,s)=>100*(e-t)/(s-t),S8:(e,t,s)=>isNaN(e)||isNaN(t)||isNaN(s)?0:e>s?s:e<t?t:e,gN:e=>Math.round(10*e)/10})},32746(e,t,s){var i=s(83793);function a(e,t,s){return(0,i.P)(e,12*t,s)}s.d(t,{e:()=>a})}};
2//# sourceMappingURL=90425.0e64720effef544d.js.map

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.