export const __rspack_esm_id=10682;export const __rspack_esm_ids=[10682];export const __webpack_modules__={23724(t,e,i){i.d(e,{},{z:t=>{if(void 0===t)return;if("object"!=typeof t){if("string"==typeof t||isNaN(t)){const e=t?.toString().split(":")||[];if(1===e.length)return{seconds:Number(e[0])};if(e.length>3)return;const i=Number(e[2])||0,s=Math.floor(i);return{hours:Number(e[0])||0,minutes:Number(e[1])||0,seconds:s,milliseconds:Math.floor(1e3*Number((i-s).toFixed(4)))}}return{seconds:t}}if(!("days"in t))return t;const{days:e,minutes:i,seconds:s,milliseconds:n}=t;let a=t.hours||0;return a=(a||0)+24*(e||0),{hours:a,minutes:i,seconds:s,milliseconds:n}}})},19058(t,e,i){i(18111),i(61701);function s(t){const e=t.split(":").map(Number);return 3600*e[0]+60*e[1]+e[2]}i.d(e,{A:()=>s},{v:t=>86400*(t.days||0)+3600*(t.hours||0)+60*(t.minutes||0)+(t.seconds||0)+(t.milliseconds||0)/1e3})},52372(t,e,i){const s=t=>t<10?`0${t}`:t;function n(t){const e=Math.floor(t/3600),i=Math.floor(t%3600/60),n=Math.floor(t%3600%60);return e>0?`${e}:${s(i)}:${s(n)}`:i>0?`${i}:${s(n)}`:n>0?""+n:null}i.d(e,{A:()=>n})},33668(t,e,i){var s=i(23724),n=i(19058),a=i(52372);i.d(e,{},{CR:(t,e)=>t.callWS({type:"timer/create",...e}),GV:t=>(0,s.z)(t.attributes.duration),PF:(t,e,i)=>{if(!e)return null;if("idle"===e.state||0===i)return t.formatEntityState(e);let s=(0,a.A)(i||0)||"0";return"paused"===e.state&&(s=`${s} (${t.formatEntityState(e)})`),s},kL:t=>t.callWS({type:"timer/list"}),ls:t=>{if(!t.attributes.remaining)return;let e=(0,n.A)(t.attributes.remaining);if("active"===t.state){const i=(new Date).getTime(),s=new Date(t.attributes.finishes_at).getTime();e=Math.max((s-i)/1e3,0)}return e},pZ:(t,e)=>t.callWS({type:"timer/delete",timer_id:e}),r9:(t,e,i)=>t.callWS({type:"timer/update",timer_id:e,...i})})},45409(t,e,i){i.a(t,async function(t,s){try{i.r(e);var n=i(15697),a=i(57527),r=i(79224),o=(i(69385),i(72441)),c=i(59366),l=i(58178),h=t([c,l]);[c,l]=h.then?(await h)():h;class u extends a.WF{setConfig(t){if(!t)throw new Error("Invalid configuration");this._config=t}render(){if(!this._config||!this.hass)return a.s6;const t=this.hass.states[this._config.entity];return t?a.qy` <hui-generic-entity-row .hass=${this.hass} .config=${this._config}> <div class="text-content"> <ha-timer-remaining-time .hass=${this.hass} .stateObj=${t}></ha-timer-remaining-time> </div> </hui-generic-entity-row> `:a.qy` <hui-warning .hass=${this.hass}> ${(0,l.j)(this.hass,this._config.entity)} </hui-warning> `}shouldUpdate(t){return(0,o.LX)(this,t)}}(0,n.Cg)([(0,r.MZ)({attribute:!1})],u.prototype,"hass",void 0),(0,n.Cg)([(0,r.wk)()],u.prototype,"_config",void 0),u=(0,n.Cg)([(0,r.EM)("hui-timer-entity-row")],u),s()}catch(t){s(t)}})},69385(t,e,i){i.r(e);var s=i(15697),n=i(57527),a=i(79224),r=i(33668);class o extends n.mN{createRenderRoot(){return this}update(t){super.update(t),this.innerHTML=(0,r.PF)(this.hass,this.stateObj,this.timeRemaining)??"-"}connectedCallback(){super.connectedCallback(),this.stateObj&&this._startInterval(this.stateObj)}disconnectedCallback(){super.disconnectedCallback(),this._clearInterval()}willUpdate(t){super.willUpdate(t),t.has("stateObj")&&this._startInterval(this.stateObj)}_clearInterval(){this._updateRemaining&&(clearInterval(this._updateRemaining),this._updateRemaining=null)}_startInterval(t){this._clearInterval(),this._calculateRemaining(t),"active"===t.state&&(this._updateRemaining=setInterval(()=>this._calculateRemaining(this.stateObj),1e3))}_calculateRemaining(t){this.timeRemaining=(0,r.ls)(t)}}(0,s.Cg)([(0,a.MZ)({attribute:!1})],o.prototype,"hass",void 0),(0,s.Cg)([(0,a.MZ)({attribute:!1})],o.prototype,"stateObj",void 0),(0,s.Cg)([(0,a.wk)()],o.prototype,"timeRemaining",void 0),o=(0,s.Cg)([(0,a.EM)("ha-timer-remaining-time")],o)}};
//# sourceMappingURL=10682.dbe9bf9d7da38872.js.map