"use strict";(self.rspackChunkhome_assistant_frontend=self.rspackChunkhome_assistant_frontend||[]).push([[91474],{23724:function(t,n,e){var i=e(73010),r=(e(2892),e(26099),e(38781),function(t){if(void 0!==t){if("object"!==(0,i.A)(t)){if("string"==typeof t||isNaN(t)){var n=(null==t?void 0:t.toString().split(":"))||[];if(1===n.length)return{seconds:Number(n[0])};if(n.length>3)return;var e=Number(n[2])||0,r=Math.floor(e);return{hours:Number(n[0])||0,minutes:Number(n[1])||0,seconds:r,milliseconds:Math.floor(1e3*Number((e-r).toFixed(4)))}}return{seconds:t}}if(!("days"in t))return t;var a=t.days,u=t.minutes,s=t.seconds,o=t.milliseconds,c=t.hours||0;return{hours:c=(c||0)+24*(a||0),minutes:u,seconds:s,milliseconds:o}}});e.d(n,{z:function(){return r}})},19058:function(t,n,e){e(62062),e(18111),e(61701),e(2892),e(26099);function i(t){var n=t.split(":").map(Number);return 3600*n[0]+60*n[1]+n[2]}var r=function(t){return 86400*(t.days||0)+3600*(t.hours||0)+60*(t.minutes||0)+(t.seconds||0)+(t.milliseconds||0)/1e3};e.d(n,{A:function(){return i},v:function(){return r}})},52372:function(t,n,e){e(28706);var i=function(t){return t<10?"0".concat(t):t};function r(t){var n=Math.floor(t/3600),e=Math.floor(t%3600/60),r=Math.floor(t%3600%60);return n>0?"".concat(n,":").concat(i(e),":").concat(i(r)):e>0?"".concat(e,":").concat(i(r)):r>0?""+r:null}e.d(n,{A:function(){return r}})},33668:function(t,n,e){var i=e(97058),r=(e(28706),e(23724)),a=e(19058),u=e(52372),s=function(t){return t.callWS({type:"timer/list"})},o=function(t,n){return t.callWS((0,i.A)({type:"timer/create"},n))},c=function(t,n,e){return t.callWS((0,i.A)({type:"timer/update",timer_id:n},e))},l=function(t,n){return t.callWS({type:"timer/delete",timer_id:n})},f=function(t){if(t.attributes.remaining){var n=(0,a.A)(t.attributes.remaining);if("active"===t.state){var e=(new Date).getTime(),i=new Date(t.attributes.finishes_at).getTime();n=Math.max((i-e)/1e3,0)}return n}},d=function(t,n,e){if(!n)return null;if("idle"===n.state||0===e)return t.formatEntityState(n);var i=(0,u.A)(e||0)||"0";return"paused"===n.state&&(i="".concat(i," (").concat(t.formatEntityState(n),")")),i},h=function(t){return(0,r.z)(t.attributes.duration)};e.d(n,{CR:function(){return o},GV:function(){return h},PF:function(){return d},kL:function(){return s},ls:function(){return f},pZ:function(){return l},r9:function(){return c}})},69385:function(t,n,e){e.r(n);var i=e(57567),r=e(25979),a=e(12463),u=e(16472),s=e(92297),o=e(15697),c=e(57527),l=e(51209),f=e(33668),d=function(t){function n(){return(0,i.A)(this,n),(0,u.A)(this,n,arguments)}return(0,a.A)(n,t),(0,r.A)(n,[{key:"createRenderRoot",value:function(){return this}},{key:"update",value:function(t){var e;(0,s.A)(n,"update",this,3)([t]),this.innerHTML=null!==(e=(0,f.PF)(this.hass,this.stateObj,this.timeRemaining))&&void 0!==e?e:"-"}},{key:"connectedCallback",value:function(){(0,s.A)(n,"connectedCallback",this,3)([]),this.stateObj&&this._startInterval(this.stateObj)}},{key:"disconnectedCallback",value:function(){(0,s.A)(n,"disconnectedCallback",this,3)([]),this._clearInterval()}},{key:"willUpdate",value:function(t){(0,s.A)(n,"willUpdate",this,3)([t]),t.has("stateObj")&&this._startInterval(this.stateObj)}},{key:"_clearInterval",value:function(){this._updateRemaining&&(clearInterval(this._updateRemaining),this._updateRemaining=null)}},{key:"_startInterval",value:function(t){var n=this;this._clearInterval(),this._calculateRemaining(t),"active"===t.state&&(this._updateRemaining=setInterval(function(){return n._calculateRemaining(n.stateObj)},1e3))}},{key:"_calculateRemaining",value:function(t){this.timeRemaining=(0,f.ls)(t)}}])}(c.mN);(0,o.Cg)([(0,l.MZ)({attribute:!1})],d.prototype,"hass",void 0),(0,o.Cg)([(0,l.MZ)({attribute:!1})],d.prototype,"stateObj",void 0),(0,o.Cg)([(0,l.wk)()],d.prototype,"timeRemaining",void 0),d=(0,o.Cg)([(0,l.EM)("ha-timer-remaining-time")],d)}}]);
//# sourceMappingURL=91474.dd5cef3ed484c270.js.map