"use strict";(self.webpackChunkhome_assistant_frontend=self.webpackChunkhome_assistant_frontend||[]).push([["43388"],{41367:function(t,i,e){e.a(t,async function(t,s){try{e.r(i),e.d(i,{HuiClockCardDigital:function(){return f}});e(18111),e(20116);var a=e(74487),o=e(40445),r=e(96196),n=e(77845),m=e(69543),d=e(8480),c=t([a,d]);[a,d]=c.then?(await c)():c;let l,h,p,u,v=t=>t;const g=1e3;class f extends r.WF{_initDate(){var t,i,e,s;if(!this.config||!this.hass)return;let a=null===(t=this.hass)||void 0===t?void 0:t.locale;null!==(i=this.config)&&void 0!==i&&i.time_format&&(a=Object.assign(Object.assign({},a),{},{time_format:this.config.time_format}));const o=(0,m.J)(a);this._dateTimeFormat=new Intl.DateTimeFormat(this.hass.locale.language,{hour:o?"numeric":"2-digit",minute:"2-digit",second:"2-digit",hourCycle:o?"h12":"h23",timeZone:(null===(e=this.config)||void 0===e?void 0:e.time_zone)||(0,d.w)(a.time_zone,null===(s=this.hass.config)||void 0===s?void 0:s.time_zone)}),this._tick()}updated(t){if(t.has("hass")){var i;const e=t.get("hass");e&&e.locale===(null===(i=this.hass)||void 0===i?void 0:i.locale)||this._initDate()}}connectedCallback(){super.connectedCallback(),this._startTick()}disconnectedCallback(){super.disconnectedCallback(),this._stopTick()}_startTick(){this._tickInterval=window.setInterval(()=>this._tick(),g),this._tick()}_stopTick(){this._tickInterval&&(clearInterval(this._tickInterval),this._tickInterval=void 0)}_tick(){var t,i,e,s,a;if(!this._dateTimeFormat)return;const o=this._dateTimeFormat.formatToParts();this._timeHour=null===(t=o.find(t=>"hour"===t.type))||void 0===t?void 0:t.value,this._timeMinute=null===(i=o.find(t=>"minute"===t.type))||void 0===i?void 0:i.value,this._timeSecond=null!==(e=this.config)&&void 0!==e&&e.show_seconds?null===(s=o.find(t=>"second"===t.type))||void 0===s?void 0:s.value:void 0,this._timeAmPm=null===(a=o.find(t=>"dayPeriod"===t.type))||void 0===a?void 0:a.value}render(){if(!this.config)return r.s6;const t=this.config.clock_size?`size-${this.config.clock_size}`:"";return(0,r.qy)(l||(l=v` <div class="time-parts ${0}"> <div class="time-part hour">${0}</div> <div class="time-part minute">${0}</div> ${0} ${0} </div> `),t,this._timeHour,this._timeMinute,void 0!==this._timeSecond?(0,r.qy)(h||(h=v`<div class="time-part second">${0}</div>`),this._timeSecond):r.s6,void 0!==this._timeAmPm?(0,r.qy)(p||(p=v`<div class="time-part am-pm">${0}</div>`),this._timeAmPm):r.s6)}}f.styles=(0,r.AH)(u||(u=v`:host{display:block}.time-parts{align-items:center;display:grid;grid-template-areas:"hour minute second" "hour minute am-pm";font-size:1.5rem;font-weight:var(--ha-font-weight-medium);line-height:.8;direction:ltr}.time-title+.time-parts{font-size:1.5rem}.time-parts.size-medium{font-size:3rem}.time-parts.size-large{font-size:4rem}.time-parts.size-medium .time-part.am-pm,.time-parts.size-medium .time-part.second{font-size:var(--ha-font-size-l);margin-left:6px}.time-parts.size-large .time-part.am-pm,.time-parts.size-large .time-part.second{font-size:var(--ha-font-size-2xl);margin-left:8px}.time-parts .time-part.hour{grid-area:hour}.time-parts .time-part.minute{grid-area:minute}.time-parts .time-part.second{grid-area:second;line-height:.9;opacity:.4}.time-parts .time-part.am-pm{grid-area:am-pm;line-height:.9;opacity:.6}.time-parts .time-part.am-pm,.time-parts .time-part.second{font-size:var(--ha-font-size-xs);margin-left:4px}.time-parts .time-part.hour:after{content:":";margin:0 2px}`)),(0,o.Cg)([(0,n.MZ)({attribute:!1})],f.prototype,"hass",void 0),(0,o.Cg)([(0,n.MZ)({attribute:!1})],f.prototype,"config",void 0),(0,o.Cg)([(0,n.wk)()],f.prototype,"_dateTimeFormat",void 0),(0,o.Cg)([(0,n.wk)()],f.prototype,"_timeHour",void 0),(0,o.Cg)([(0,n.wk)()],f.prototype,"_timeMinute",void 0),(0,o.Cg)([(0,n.wk)()],f.prototype,"_timeSecond",void 0),(0,o.Cg)([(0,n.wk)()],f.prototype,"_timeAmPm",void 0),f=(0,o.Cg)([(0,n.EM)("hui-clock-card-digital")],f),s()}catch(l){s(l)}})}}]);
//# sourceMappingURL=43388.d82475a15e704fa1.js.map