export const __rspack_esm_id="20283";export const __rspack_esm_ids=["20283"];export const __webpack_modules__={90409(t,e,a){a.d(e,{A:()=>i});a(18111),a(61701);function i(t){const e=t.split(":").map(Number);return 3600*e[0]+60*e[1]+e[2]}},27167(t,e,a){a.d(e,{A:()=>n});const i=t=>t<10?`0${t}`:t;function n(t){const e=Math.floor(t/3600),a=Math.floor(t%3600/60),n=Math.floor(t%3600%60);return e>0?`${e}:${i(a)}:${i(n)}`:a>0?`${a}:${i(n)}`:n>0?""+n:null}},49141(t,e,a){a.d(e,{CR:()=>r,PF:()=>m,kL:()=>s,ls:()=>o,pZ:()=>c,r9:()=>l});var i=a(90409),n=a(27167);const s=t=>t.callWS({type:"timer/list"}),r=(t,e)=>t.callWS({type:"timer/create",...e}),l=(t,e,a)=>t.callWS({type:"timer/update",timer_id:e,...a}),c=(t,e)=>t.callWS({type:"timer/delete",timer_id:e}),o=t=>{if(!t.attributes.remaining)return;let e=(0,i.A)(t.attributes.remaining);if("active"===t.state){const a=(new Date).getTime(),i=new Date(t.attributes.finishes_at).getTime();e=Math.max((i-a)/1e3,0)}return e},m=(t,e,a)=>{if(!e)return null;if("idle"===e.state||0===a)return t.formatEntityState(e);let i=(0,n.A)(a||0)||"0";return"paused"===e.state&&(i=`${i} (${t.formatEntityState(e)})`),i}},5078(t,e,a){a.r(e);var i=a(62826),n=a(96196),s=a(97735),r=a(49141);class l 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,i.Cg)([(0,s.MZ)({attribute:!1})],l.prototype,"hass",void 0),(0,i.Cg)([(0,s.MZ)({attribute:!1})],l.prototype,"stateObj",void 0),(0,i.Cg)([(0,s.wk)()],l.prototype,"timeRemaining",void 0),l=(0,i.Cg)([(0,s.EM)("ha-timer-remaining-time")],l)}};
//# sourceMappingURL=20283.1bb3df944e194cec.js.map