-
Notifications
You must be signed in to change notification settings - Fork 0
/
timer-card.js
189 lines (189 loc) · 56 KB
/
timer-card.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
/*! For license information please see timer-card.js.LICENSE.txt */
(()=>{"use strict";var t={197:(t,e,i)=>{i.r(e),i.d(e,{DEFAULT_DOMAIN_ICON:()=>X,DEFAULT_PANEL:()=>G,DEFAULT_VIEW_ENTITY_ID:()=>at,DOMAINS_HIDE_MORE_INFO:()=>et,DOMAINS_MORE_INFO_NO_HISTORY:()=>it,DOMAINS_TOGGLE:()=>rt,DOMAINS_WITH_CARD:()=>Q,DOMAINS_WITH_MORE_INFO:()=>tt,NumberFormat:()=>n,STATES_OFF:()=>nt,TimeFormat:()=>r,UNIT_C:()=>ot,UNIT_F:()=>st,applyThemesOnElement:()=>U,computeCardSize:()=>H,computeDomain:()=>F,computeEntity:()=>L,computeRTL:()=>V,computeRTLDirection:()=>z,computeStateDisplay:()=>J,computeStateDomain:()=>q,createThing:()=>dt,debounce:()=>ht,domainIcon:()=>pt,evaluateFilter:()=>ft,fireEvent:()=>ct,fixedIcons:()=>mt,formatDate:()=>u,formatDateMonth:()=>_,formatDateMonthYear:()=>v,formatDateNumeric:()=>h,formatDateShort:()=>p,formatDateTime:()=>A,formatDateTimeNumeric:()=>C,formatDateTimeWithSeconds:()=>k,formatDateWeekday:()=>c,formatDateYear:()=>b,formatNumber:()=>Y,formatTime:()=>D,formatTimeWeekday:()=>M,formatTimeWithSeconds:()=>O,forwardHaptic:()=>vt,getLovelace:()=>Ct,handleAction:()=>wt,handleActionConfig:()=>bt,handleClick:()=>$t,hasAction:()=>At,hasConfigOrEntityChanged:()=>St,hasDoubleClick:()=>kt,isNumericState:()=>B,navigate:()=>gt,numberFormatToLocale:()=>W,relativeTime:()=>R,round:()=>K,stateIcon:()=>Tt,timerTimeRemaining:()=>j,toggleEntity:()=>yt,turnOnOffEntities:()=>Et,turnOnOffEntity:()=>_t});var n,r,o,s=function(){return s=Object.assign||function(t){for(var e,i=1,n=arguments.length;i<n;i++)for(var r in e=arguments[i])Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t},s.apply(this,arguments)},a={second:45,minute:45,hour:22,day:5},c=function(t,e){return l(e).format(t)},l=function(t){return new Intl.DateTimeFormat(t.language,{weekday:"long",month:"long",day:"numeric"})},u=function(t,e){return d(e).format(t)},d=function(t){return new Intl.DateTimeFormat(t.language,{year:"numeric",month:"long",day:"numeric"})},h=function(t,e){return m(e).format(t)},m=function(t){return new Intl.DateTimeFormat(t.language,{year:"numeric",month:"numeric",day:"numeric"})},p=function(t,e){return f(e).format(t)},f=function(t){return new Intl.DateTimeFormat(t.language,{day:"numeric",month:"short"})},v=function(t,e){return g(e).format(t)},g=function(t){return new Intl.DateTimeFormat(t.language,{month:"long",year:"numeric"})},_=function(t,e){return y(e).format(t)},y=function(t){return new Intl.DateTimeFormat(t.language,{month:"long"})},b=function(t,e){return w(e).format(t)},w=function(t){return new Intl.DateTimeFormat(t.language,{year:"numeric"})};(o=n||(n={})).language="language",o.system="system",o.comma_decimal="comma_decimal",o.decimal_comma="decimal_comma",o.space_comma="space_comma",o.none="none",function(t){t.language="language",t.system="system",t.am_pm="12",t.twenty_four="24"}(r||(r={}));var $=function(t){if(t.time_format===r.language||t.time_format===r.system){var e=t.time_format===r.language?t.language:void 0,i=(new Date).toLocaleString(e);return i.includes("AM")||i.includes("PM")}return t.time_format===r.am_pm},A=function(t,e){return S(e).format(t)},S=function(t){return new Intl.DateTimeFormat(t.language,{year:"numeric",month:"long",day:"numeric",hour:$(t)?"numeric":"2-digit",minute:"2-digit",hour12:$(t)})},k=function(t,e){return E(e).format(t)},E=function(t){return new Intl.DateTimeFormat(t.language,{year:"numeric",month:"long",day:"numeric",hour:$(t)?"numeric":"2-digit",minute:"2-digit",second:"2-digit",hour12:$(t)})},C=function(t,e){return x(e).format(t)},x=function(t){return new Intl.DateTimeFormat(t.language,{year:"numeric",month:"numeric",day:"numeric",hour:"numeric",minute:"2-digit",hour12:$(t)})},D=function(t,e){return T(e).format(t)},T=function(t){return new Intl.DateTimeFormat(t.language,{hour:"numeric",minute:"2-digit",hour12:$(t)})},O=function(t,e){return N(e).format(t)},N=function(t){return new Intl.DateTimeFormat(t.language,{hour:$(t)?"numeric":"2-digit",minute:"2-digit",second:"2-digit",hour12:$(t)})},M=function(t,e){return P(e).format(t)},P=function(t){return new Intl.DateTimeFormat(t.language,{hour:$(t)?"numeric":"2-digit",minute:"2-digit",second:"2-digit",hour12:$(t)})},R=function(t,e,i,n){void 0===n&&(n=!0);var r=function(t,e,i){void 0===e&&(e=Date.now()),void 0===i&&(i={});var n=s(s({},a),i||{}),r=(+t-+e)/1e3;if(Math.abs(r)<n.second)return{value:Math.round(r),unit:"second"};var o=r/60;if(Math.abs(o)<n.minute)return{value:Math.round(o),unit:"minute"};var c=r/3600;if(Math.abs(c)<n.hour)return{value:Math.round(c),unit:"hour"};var l=r/86400;if(Math.abs(l)<n.day)return{value:Math.round(l),unit:"day"};var u=new Date(t),d=new Date(e),h=u.getFullYear()-d.getFullYear();if(Math.round(Math.abs(h))>0)return{value:Math.round(h),unit:"year"};var m=12*h+u.getMonth()-d.getMonth();if(Math.round(Math.abs(m))>0)return{value:Math.round(m),unit:"month"};var p=r/604800;return{value:Math.round(p),unit:"week"}}(t,i);return n?function(t){return new Intl.RelativeTimeFormat(t.language,{numeric:"auto"})}(e).format(r.value,r.unit):Intl.NumberFormat(e.language,{style:"unit",unit:r.unit,unitDisplay:"long"}).format(Math.abs(r.value))};function j(t){var e,i=3600*(e=t.attributes.remaining.split(":").map(Number))[0]+60*e[1]+e[2];if("active"===t.state){var n=(new Date).getTime(),r=new Date(t.last_changed).getTime();i=Math.max(i-(n-r)/1e3,0)}return i}function I(){return(I=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var i=arguments[e];for(var n in i)Object.prototype.hasOwnProperty.call(i,n)&&(t[n]=i[n])}return t}).apply(this,arguments)}var U=function(t,e,i,n){void 0===n&&(n=!1),t._themes||(t._themes={});var r=e.default_theme;("default"===i||i&&e.themes[i])&&(r=i);var o=I({},t._themes);if("default"!==r){var s=e.themes[r];Object.keys(s).forEach((function(e){var i="--"+e;t._themes[i]="",o[i]=s[e]}))}if(t.updateStyles?t.updateStyles(o):window.ShadyCSS&&window.ShadyCSS.styleSubtree(t,o),n){var a=document.querySelector("meta[name=theme-color]");if(a){a.hasAttribute("default-content")||a.setAttribute("default-content",a.getAttribute("content"));var c=o["--primary-color"]||a.getAttribute("default-content");a.setAttribute("content",c)}}},H=function(t){return"function"==typeof t.getCardSize?t.getCardSize():4};function F(t){return t.substr(0,t.indexOf("."))}function L(t){return t.substr(t.indexOf(".")+1)}function V(t){var e,i=(null==t||null==(e=t.locale)?void 0:e.language)||"en";return t.translationMetadata.translations[i]&&t.translationMetadata.translations[i].isRTL||!1}function z(t){return V(t)?"rtl":"ltr"}function q(t){return F(t.entity_id)}var B=function(t){return!!t.attributes.unit_of_measurement||!!t.attributes.state_class},W=function(t){switch(t.number_format){case n.comma_decimal:return["en-US","en"];case n.decimal_comma:return["de","es","it"];case n.space_comma:return["fr","sv","cs"];case n.system:return;default:return t.language}},K=function(t,e){return void 0===e&&(e=2),Math.round(t*Math.pow(10,e))/Math.pow(10,e)},Y=function(t,e,i){var r=e?W(e):void 0;if(Number.isNaN=Number.isNaN||function t(e){return"number"==typeof e&&t(e)},(null==e?void 0:e.number_format)!==n.none&&!Number.isNaN(Number(t))&&Intl)try{return new Intl.NumberFormat(r,Z(t,i)).format(Number(t))}catch(e){return console.error(e),new Intl.NumberFormat(void 0,Z(t,i)).format(Number(t))}return"string"==typeof t?t:K(t,null==i?void 0:i.maximumFractionDigits).toString()+("currency"===(null==i?void 0:i.style)?" "+i.currency:"")},Z=function(t,e){var i=I({maximumFractionDigits:2},e);if("string"!=typeof t)return i;if(!e||!e.minimumFractionDigits&&!e.maximumFractionDigits){var n=t.indexOf(".")>-1?t.split(".")[1].length:0;i.minimumFractionDigits=n,i.maximumFractionDigits=n}return i},J=function(t,e,i,n){var r=void 0!==n?n:e.state;if("unknown"===r||"unavailable"===r)return t("state.default."+r);if(B(e)){if("monetary"===e.attributes.device_class)try{return Y(r,i,{style:"currency",currency:e.attributes.unit_of_measurement})}catch(t){}return Y(r,i)+(e.attributes.unit_of_measurement?" "+e.attributes.unit_of_measurement:"")}var o=q(e);if("input_datetime"===o){var s;if(void 0===n)return e.attributes.has_date&&e.attributes.has_time?(s=new Date(e.attributes.year,e.attributes.month-1,e.attributes.day,e.attributes.hour,e.attributes.minute),A(s,i)):e.attributes.has_date?(s=new Date(e.attributes.year,e.attributes.month-1,e.attributes.day),u(s,i)):e.attributes.has_time?((s=new Date).setHours(e.attributes.hour,e.attributes.minute),D(s,i)):e.state;try{var a=n.split(" ");if(2===a.length)return A(new Date(a.join("T")),i);if(1===a.length){if(n.includes("-"))return u(new Date(n+"T00:00"),i);if(n.includes(":")){var c=new Date;return D(new Date(c.toISOString().split("T")[0]+"T"+n),i)}}return n}catch(t){return n}}return"humidifier"===o&&"on"===r&&e.attributes.humidity?e.attributes.humidity+" %":"counter"===o||"number"===o||"input_number"===o?Y(r,i):e.attributes.device_class&&t("component."+o+".state."+e.attributes.device_class+"."+r)||t("component."+o+".state._."+r)||r},X="mdi:bookmark",G="lovelace",Q=["climate","cover","configurator","input_select","input_number","input_text","lock","media_player","scene","script","timer","vacuum","water_heater","weblink"],tt=["alarm_control_panel","automation","camera","climate","configurator","cover","fan","group","history_graph","input_datetime","light","lock","media_player","script","sun","updater","vacuum","water_heater","weather"],et=["input_number","input_select","input_text","scene","weblink"],it=["camera","configurator","history_graph","scene"],nt=["closed","locked","off"],rt=new Set(["fan","input_boolean","light","switch","group","automation"]),ot="°C",st="°F",at="group.default_view",ct=function(t,e,i,n){n=n||{},i=null==i?{}:i;var r=new Event(e,{bubbles:void 0===n.bubbles||n.bubbles,cancelable:Boolean(n.cancelable),composed:void 0===n.composed||n.composed});return r.detail=i,t.dispatchEvent(r),r},lt=new Set(["call-service","divider","section","weblink","cast","select"]),ut={alert:"toggle",automation:"toggle",climate:"climate",cover:"cover",fan:"toggle",group:"group",input_boolean:"toggle",input_number:"input-number",input_select:"input-select",input_text:"input-text",light:"toggle",lock:"lock",media_player:"media-player",remote:"toggle",scene:"scene",script:"script",sensor:"sensor",timer:"timer",switch:"toggle",vacuum:"toggle",water_heater:"climate",input_datetime:"input-datetime"},dt=function(t,e){void 0===e&&(e=!1);var i=function(t,e){return n("hui-error-card",{type:"error",error:t,config:e})},n=function(t,e){var n=window.document.createElement(t);try{if(!n.setConfig)return;n.setConfig(e)}catch(n){return console.error(t,n),i(n.message,e)}return n};if(!t||"object"!=typeof t||!e&&!t.type)return i("No type defined",t);var r=t.type;if(r&&r.startsWith("custom:"))r=r.substr(7);else if(e)if(lt.has(r))r="hui-"+r+"-row";else{if(!t.entity)return i("Invalid config given.",t);var o=t.entity.split(".",1)[0];r="hui-"+(ut[o]||"text")+"-entity-row"}else r="hui-"+r+"-card";if(customElements.get(r))return n(r,t);var s=i("Custom element doesn't exist: "+t.type+".",t);s.style.display="None";var a=setTimeout((function(){s.style.display=""}),2e3);return customElements.whenDefined(t.type).then((function(){clearTimeout(a),ct(s,"ll-rebuild",{},s)})),s},ht=function(t,e,i){var n;return void 0===i&&(i=!1),function(){var r=[].slice.call(arguments),o=this,s=i&&!n;clearTimeout(n),n=setTimeout((function(){n=null,i||t.apply(o,r)}),e),s&&t.apply(o,r)}},mt={alert:"mdi:alert",automation:"mdi:playlist-play",calendar:"mdi:calendar",camera:"mdi:video",climate:"mdi:thermostat",configurator:"mdi:settings",conversation:"mdi:text-to-speech",device_tracker:"mdi:account",fan:"mdi:fan",group:"mdi:google-circles-communities",history_graph:"mdi:chart-line",homeassistant:"mdi:home-assistant",homekit:"mdi:home-automation",image_processing:"mdi:image-filter-frames",input_boolean:"mdi:drawing",input_datetime:"mdi:calendar-clock",input_number:"mdi:ray-vertex",input_select:"mdi:format-list-bulleted",input_text:"mdi:textbox",light:"mdi:lightbulb",mailbox:"mdi:mailbox",notify:"mdi:comment-alert",person:"mdi:account",plant:"mdi:flower",proximity:"mdi:apple-safari",remote:"mdi:remote",scene:"mdi:google-pages",script:"mdi:file-document",sensor:"mdi:eye",simple_alarm:"mdi:bell",sun:"mdi:white-balance-sunny",switch:"mdi:flash",timer:"mdi:timer",updater:"mdi:cloud-upload",vacuum:"mdi:robot-vacuum",water_heater:"mdi:thermometer",weblink:"mdi:open-in-new"};function pt(t,e){if(t in mt)return mt[t];switch(t){case"alarm_control_panel":switch(e){case"armed_home":return"mdi:bell-plus";case"armed_night":return"mdi:bell-sleep";case"disarmed":return"mdi:bell-outline";case"triggered":return"mdi:bell-ring";default:return"mdi:bell"}case"binary_sensor":return e&&"off"===e?"mdi:radiobox-blank":"mdi:checkbox-marked-circle";case"cover":return"closed"===e?"mdi:window-closed":"mdi:window-open";case"lock":return e&&"unlocked"===e?"mdi:lock-open":"mdi:lock";case"media_player":return e&&"off"!==e&&"idle"!==e?"mdi:cast-connected":"mdi:cast";case"zwave":switch(e){case"dead":return"mdi:emoticon-dead";case"sleeping":return"mdi:sleep";case"initializing":return"mdi:timer-sand";default:return"mdi:z-wave"}default:return console.warn("Unable to find icon for domain "+t+" ("+e+")"),"mdi:bookmark"}}var ft=function(t,e){var i=e.value||e,n=e.attribute?t.attributes[e.attribute]:t.state;switch(e.operator||"=="){case"==":return n===i;case"<=":return n<=i;case"<":return n<i;case">=":return n>=i;case">":return n>i;case"!=":return n!==i;case"regex":return n.match(i);default:return!1}},vt=function(t){ct(window,"haptic",t)},gt=function(t,e,i){void 0===i&&(i=!1),i?history.replaceState(null,"",e):history.pushState(null,"",e),ct(window,"location-changed",{replace:i})},_t=function(t,e,i){void 0===i&&(i=!0);var n,r=F(e),o="group"===r?"homeassistant":r;switch(r){case"lock":n=i?"unlock":"lock";break;case"cover":n=i?"open_cover":"close_cover";break;default:n=i?"turn_on":"turn_off"}return t.callService(o,n,{entity_id:e})},yt=function(t,e){var i=nt.includes(t.states[e].state);return _t(t,e,i)},bt=function(t,e,i,n){if(n||(n={action:"more-info"}),!n.confirmation||n.confirmation.exemptions&&n.confirmation.exemptions.some((function(t){return t.user===e.user.id}))||(vt("warning"),confirm(n.confirmation.text||"Are you sure you want to "+n.action+"?")))switch(n.action){case"more-info":(i.entity||i.camera_image)&&ct(t,"hass-more-info",{entityId:i.entity?i.entity:i.camera_image});break;case"navigate":n.navigation_path&>(0,n.navigation_path);break;case"url":n.url_path&&window.open(n.url_path);break;case"toggle":i.entity&&(yt(e,i.entity),vt("success"));break;case"call-service":if(!n.service)return void vt("failure");var r=n.service.split(".",2);e.callService(r[0],r[1],n.service_data,n.target),vt("success");break;case"fire-dom-event":ct(t,"ll-custom",n)}},wt=function(t,e,i,n){var r;"double_tap"===n&&i.double_tap_action?r=i.double_tap_action:"hold"===n&&i.hold_action?r=i.hold_action:"tap"===n&&i.tap_action&&(r=i.tap_action),bt(t,e,i,r)},$t=function(t,e,i,n,r){var o;if(r&&i.double_tap_action?o=i.double_tap_action:n&&i.hold_action?o=i.hold_action:!n&&i.tap_action&&(o=i.tap_action),o||(o={action:"more-info"}),!o.confirmation||o.confirmation.exemptions&&o.confirmation.exemptions.some((function(t){return t.user===e.user.id}))||confirm(o.confirmation.text||"Are you sure you want to "+o.action+"?"))switch(o.action){case"more-info":(o.entity||i.entity||i.camera_image)&&(ct(t,"hass-more-info",{entityId:o.entity?o.entity:i.entity?i.entity:i.camera_image}),o.haptic&&vt(o.haptic));break;case"navigate":o.navigation_path&&(gt(0,o.navigation_path),o.haptic&&vt(o.haptic));break;case"url":o.url_path&&window.open(o.url_path),o.haptic&&vt(o.haptic);break;case"toggle":i.entity&&(yt(e,i.entity),o.haptic&&vt(o.haptic));break;case"call-service":if(!o.service)return;var s=o.service.split(".",2),a=s[0],c=s[1],l=I({},o.service_data);"entity"===l.entity_id&&(l.entity_id=i.entity),e.callService(a,c,l,o.target),o.haptic&&vt(o.haptic);break;case"fire-dom-event":ct(t,"ll-custom",o),o.haptic&&vt(o.haptic)}};function At(t){return void 0!==t&&"none"!==t.action}function St(t,e,i){if(e.has("config")||i)return!0;if(t.config.entity){var n=e.get("hass");return!n||n.states[t.config.entity]!==t.hass.states[t.config.entity]}return!1}function kt(t){return void 0!==t&&"none"!==t.action}var Et=function(t,e,i){void 0===i&&(i=!0);var n={};e.forEach((function(e){if(nt.includes(t.states[e].state)===i){var r=F(e),o=["cover","lock"].includes(r)?r:"homeassistant";o in n||(n[o]=[]),n[o].push(e)}})),Object.keys(n).forEach((function(e){var r;switch(e){case"lock":r=i?"unlock":"lock";break;case"cover":r=i?"open_cover":"close_cover";break;default:r=i?"turn_on":"turn_off"}t.callService(e,r,{entity_id:n[e]})}))},Ct=function(){var t=document.querySelector("home-assistant");if(t=(t=(t=(t=(t=(t=(t=(t=t&&t.shadowRoot)&&t.querySelector("home-assistant-main"))&&t.shadowRoot)&&t.querySelector("app-drawer-layout partial-panel-resolver"))&&t.shadowRoot||t)&&t.querySelector("ha-panel-lovelace"))&&t.shadowRoot)&&t.querySelector("hui-root")){var e=t.lovelace;return e.current_view=t.___curView,e}return null},xt={humidity:"mdi:water-percent",illuminance:"mdi:brightness-5",temperature:"mdi:thermometer",pressure:"mdi:gauge",power:"mdi:flash",signal_strength:"mdi:wifi"},Dt={binary_sensor:function(t,e){var i="off"===t;switch(null==e?void 0:e.attributes.device_class){case"battery":return i?"mdi:battery":"mdi:battery-outline";case"battery_charging":return i?"mdi:battery":"mdi:battery-charging";case"cold":return i?"mdi:thermometer":"mdi:snowflake";case"connectivity":return i?"mdi:server-network-off":"mdi:server-network";case"door":return i?"mdi:door-closed":"mdi:door-open";case"garage_door":return i?"mdi:garage":"mdi:garage-open";case"power":case"plug":return i?"mdi:power-plug-off":"mdi:power-plug";case"gas":case"problem":case"safety":case"tamper":return i?"mdi:check-circle":"mdi:alert-circle";case"smoke":return i?"mdi:check-circle":"mdi:smoke";case"heat":return i?"mdi:thermometer":"mdi:fire";case"light":return i?"mdi:brightness-5":"mdi:brightness-7";case"lock":return i?"mdi:lock":"mdi:lock-open";case"moisture":return i?"mdi:water-off":"mdi:water";case"motion":return i?"mdi:walk":"mdi:run";case"occupancy":case"presence":return i?"mdi:home-outline":"mdi:home";case"opening":return i?"mdi:square":"mdi:square-outline";case"running":return i?"mdi:stop":"mdi:play";case"sound":return i?"mdi:music-note-off":"mdi:music-note";case"update":return i?"mdi:package":"mdi:package-up";case"vibration":return i?"mdi:crop-portrait":"mdi:vibrate";case"window":return i?"mdi:window-closed":"mdi:window-open";default:return i?"mdi:radiobox-blank":"mdi:checkbox-marked-circle"}},cover:function(t){var e="closed"!==t.state;switch(t.attributes.device_class){case"garage":return e?"mdi:garage-open":"mdi:garage";case"door":return e?"mdi:door-open":"mdi:door-closed";case"shutter":return e?"mdi:window-shutter-open":"mdi:window-shutter";case"blind":return e?"mdi:blinds-open":"mdi:blinds";case"window":return e?"mdi:window-open":"mdi:window-closed";default:return pt("cover",t.state)}},sensor:function(t){var e=t.attributes.device_class;if(e&&e in xt)return xt[e];if("battery"===e){var i=Number(t.state);if(isNaN(i))return"mdi:battery-unknown";var n=10*Math.round(i/10);return n>=100?"mdi:battery":n<=0?"mdi:battery-alert":"hass:battery-"+n}var r=t.attributes.unit_of_measurement;return"°C"===r||"°F"===r?"mdi:thermometer":pt("sensor")},input_datetime:function(t){return t.attributes.has_date?t.attributes.has_time?pt("input_datetime"):"mdi:calendar":"mdi:clock"}},Tt=function(t){if(!t)return"mdi:bookmark";if(t.attributes.icon)return t.attributes.icon;var e=F(t.entity_id);return e in Dt?Dt[e](t):pt(e,t.state)}},243:(t,e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.BaseCard=void 0,e.BaseCard=class{constructor(t){this.config=t.config,this.hass=t._hass,this.parent=t}translation(t){return!this.config.translations||Object.keys(this.config.translations).indexOf(t)<0?this.defaultTranslations[t]:this.config.translations[t]}getProperties(){var t;return null===(t=this.parent.properties)||void 0===t||t.get("cardValues"),{}}getParentCardValues(){var t,e;const i=null!==(t=this.parent.properties)&&void 0!==t?t:new Map;return{properties:null!==(e=i.get("cardValues"))&&void 0!==e?e:{},cardValues:i}}}},727:function(t,e,i){var n=this&&this.__await||function(t){return this instanceof n?(this.v=t,this):new n(t)},r=this&&this.__asyncGenerator||function(t,e,i){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var r,o=i.apply(t,e||[]),s=[];return r={},a("next"),a("throw"),a("return"),r[Symbol.asyncIterator]=function(){return this},r;function a(t){o[t]&&(r[t]=function(e){return new Promise((function(i,n){s.push([t,e,i,n])>1||c(t,e)}))})}function c(t,e){try{(i=o[t](e)).value instanceof n?Promise.resolve(i.value.v).then(l,u):d(s[0][2],i)}catch(t){d(s[0][3],t)}var i}function l(t){c("next",t)}function u(t){c("throw",t)}function d(t,e){t(e),s.shift(),s.length&&c(s[0][0],s[0][1])}};Object.defineProperty(e,"__esModule",{value:!0});const o=i(692),s=i(243),a=i(884);class c extends s.BaseCard{constructor(t){super(t),this.defaultTranslations={days:"d",hours:"h",minutes:"m",seconds:"s",timer_complete:"Timer Completed",timer_not_started:"Timer Not Started"}}cardSize(){return 6}isValidDate(t){return t instanceof Date&&!isNaN(t.getTime())}getFormattedDate(t){const e=(new Date).getTime(),i=this.config.reverse?e-t.getTime():t.getTime()-e,n=Math.floor(i/864e5),r=Math.floor(i%864e5/36e5),o=Math.floor(i%36e5/6e4),s=Math.floor(i%6e4/1e3);return`${n}${this.translation("days")} ${r}${this.translation("hours")} ${o}${this.translation("minutes")} ${s}${this.translation("seconds")} `}getEntityDate(t){const[e,i]=t.split(" "),[n,r,o]=e.split("-").map(Number),[s,a,c]=i.split(":").map(Number);return new Date(n,r-1,o,s,a,c)}runTimer(t,e){return r(this,arguments,(function*(){if(e){for(;new Date>t;)yield yield n(this.getFormattedDate(t)),yield n(new Promise((t=>setTimeout(t,1e3))));yield yield n(this.translation("timer_not_started"))}else{for(;t>new Date;)yield yield n(this.getFormattedDate(t)),yield n(new Promise((t=>setTimeout(t,1e3))));yield yield n(this.translation("timer_complete"))}}))}render(){let t;if(this.config.date){const e=new Date(this.config.date);if(!this.isValidDate(e))throw new Error("Please define a valid date.");t=e}else if(this.config.entity){const e=new Date(this.getEntityDate(this.config.hass.states[this.config.entity].state));if(!this.isValidDate(e))throw new Error("Please define a valid entity.");t=e}const e=this.runTimer(t,this.config.reverse);return o.html`<table>
<tr>
<td class="text-center">
<h1>${(0,a.asyncReplace)(e)}</h1>
</td>
</tr>
</table>`}}e.default=c},312:(t,e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.CARD_EDITOR_NAME=e.CARD_NAME=void 0,e.CARD_NAME="timer-card",e.CARD_EDITOR_NAME=`${e.CARD_NAME}-editor`},384:function(t,e,i){var n=this&&this.__decorate||function(t,e,i,n){var r,o=arguments.length,s=o<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,i,n);else for(var a=t.length-1;a>=0;a--)(r=t[a])&&(s=(o<3?r(s):o>3?r(e,i,s):r(e,i))||s);return o>3&&s&&Object.defineProperty(e,i,s),s};Object.defineProperty(e,"__esModule",{value:!0}),e.FormulaOneCardEditor=void 0;const r=i(197),o=i(677),s=i(692),a=i(595),c=i(312);let l=class extends o.LitElement{setConfig(t){this.config=t}get _title(){var t;return null===(t=this.config)||void 0===t?void 0:t.title}get _date(){var t;return null===(t=this.config)||void 0===t?void 0:t.date}get _entity(){var t;return null===(t=this.config)||void 0===t?void 0:t.entity}get _reverse(){var t,e;return void 0!==(null===(t=this.config)||void 0===t?void 0:t.reverse)&&(null===(e=this.config)||void 0===e?void 0:e.reverse)}generateCheckbox(t,e,i){return s.html`
<ha-formfield label=${e}>
<ha-switch
.checked=${i}
.configValue=${t}
@change=${this._valueChanged}
></ha-switch>
</ha-formfield>
`}render(){return this.hass&&this.config?s.html`
<div class="card-config">
<div class="tabs">
<div class="tab">
<input type="checkbox" id="entity" class="tab-checkbox">
<label class="tab-label" for="entity">Basic configuration</label>
<div class="tab-content">
<paper-input
label="Title"
.value=${this._title}
.placeholder=${this._title}
.configValue=${"title"}
@value-changed=${this._valueChanged}
></paper-input>
<paper-input
label="Date"
.value=${this._date}
.placeholder=${this._date}
.configValue=${"date"}
@value-changed=${this._valueChanged}
></paper-input>
<paper-input
label="Entity"
.value=${this._entity}
.placeholder=${this._entity}
.configValue=${"entity"}
@value-changed=${this._valueChanged}
></paper-input>
<div class="side-by-side">
${this.generateCheckbox("reverse","Reverse?",this._reverse)}
</div>
</div>
</div>
</div>
</div>
`:s.html``}_valueChangedSelect(t){if(!this.config||!this.hass)return;const e=t.detail.value.itemValue,i=t.detail.value.parentElement.configValue;if(i)if(""===t.detail.value.itemValue){const t=Object.assign({},this.config);delete t[i],this.config=t}else this.config=Object.assign(Object.assign({},this.config),{[i]:e});(0,r.fireEvent)(this,"config-changed",{config:this.config})}_valueChanged(t){if(!this.config||!this.hass)return;const e=t.target;if(e.configValue)if(""===e.value){const t=Object.assign({},this.config);delete t[e.configValue],this.config=t}else this.config=Object.assign(Object.assign({},this.config),{[e.configValue]:void 0!==e.checked?e.checked:e.value});(0,r.fireEvent)(this,"config-changed",{config:this.config})}static get styles(){return o.css`
ha-switch {
padding: 16px 6px;
}
.side-by-side {
display: flex;
flex-flow: row wrap;
}
.side-by-side > * {
padding-right: 8px;
width: 50%;
flex-flow: column wrap;
box-sizing: border-box;
}
.side-by-side > *:last-child {
flex: 1;
padding-right: 0;
}
.suffix {
margin: 0 8px;
}
.group {
padding: 15px;
border: 1px solid var(--primary-text-color)
}
.tabs {
overflow: hidden;
}
.tab {
width: 100%;
color: var(--primary-text-color);
overflow: hidden;
}
.tab-label {
display: flex;
justify-content: space-between;
padding: 1em 1em 1em 0em;
border-bottom: 1px solid var(--secondary-text-color);
font-weight: bold;
cursor: pointer;
}
.tab-label:hover {
/*background: #1a252f;*/
}
.tab-label::after {
content: "❯";
width: 1em;
height: 1em;
text-align: center;
transition: all 0.35s;
}
.tab-content {
max-height: 0;
padding: 0 1em;
background: var(--secondary-background-color);
transition: all 0.35s;
}
input.tab-checkbox {
position: absolute;
opacity: 0;
z-index: -1;
}
input.tab-checkbox:checked + .tab-label {
border-color: var(--accent-color);
}
input.tab-checkbox:checked + .tab-label::after {
transform: rotate(90deg);
}
input.tab-checkbox:checked ~ .tab-content {
max-height: 100vh;
padding: 1em;
}
`}};n([(0,a.property)({attribute:!1})],l.prototype,"hass",void 0),n([(0,a.state)()],l.prototype,"config",void 0),l=n([(0,a.customElement)(c.CARD_EDITOR_NAME)],l),e.FormulaOneCardEditor=l},607:function(t,e,i){var n=this&&this.__decorate||function(t,e,i,n){var r,o=arguments.length,s=o<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,i,n);else for(var a=t.length-1;a>=0;a--)(r=t[a])&&(s=(o<3?r(s):o>3?r(e,i,s):r(e,i))||s);return o>3&&s&&Object.defineProperty(e,i,s),s},r=this&&this.__awaiter||function(t,e,i,n){return new(i||(i=Promise))((function(r,o){function s(t){try{c(n.next(t))}catch(t){o(t)}}function a(t){try{c(n.throw(t))}catch(t){o(t)}}function c(t){var e;t.done?r(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(s,a)}c((n=n.apply(t,e||[])).next())}))};Object.defineProperty(e,"__esModule",{value:!0});const o=i(147),s=i(595),a=i(677),c=i(593),l=i(299),u=i(727),d=i(312);console.info(`%c ${d.CARD_NAME.toUpperCase()} %c ${o.version}`,"color: cyan; background: black; font-weight: bold;","color: darkblue; background: white; font-weight: bold;"),window.customCards=window.customCards||[],window.customCards.push({type:"timer-card",name:"Timer Card",preview:!1,description:"Display a simple timer"});let h=class extends a.LitElement{set properties(t){this._cardValues=t,this.update(t)}get properties(){return this._cardValues}constructor(){super()}static getConfigElement(){return r(this,void 0,void 0,(function*(){return yield Promise.resolve().then((()=>i(384))),document.createElement(d.CARD_EDITOR_NAME)}))}setConfig(t){(0,c.checkConfig)(t),this.config=Object.assign({},t)}shouldUpdate(t){return(0,c.hasConfigOrCardValuesChanged)(this.config,this,t)}set hass(t){this._hass=t,this.config.hass=t,this.card=new u.default(this)}static get styles(){return l.styles}render(){if(!this._hass||!this.config)return a.html``;try{return a.html`
<ha-card elevation="2">
${this.warning?a.html`<hui-warning>${this.warning}</hui-warning>`:""}
${this.config.title?a.html`<h1 class="card-header">${this.config.title}</h1>`:""}
${this.card.render()}
</ha-card>
`}catch(t){return a.html`<hui-warning>${t.toString()}</hui-warning>`}}getCardSize(){return this.card.cardSize()}};n([(0,s.property)()],h.prototype,"_hass",void 0),n([(0,s.property)()],h.prototype,"config",void 0),n([(0,s.property)()],h.prototype,"card",void 0),n([(0,s.property)()],h.prototype,"warning",void 0),n([(0,s.property)()],h.prototype,"properties",null),h=n([(0,s.customElement)(d.CARD_NAME)],h),e.default=h},299:(t,e,i)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.styles=void 0;const n=i(677);e.styles=n.css`
table {
width: 100%;
border-spacing: 0;
border-collapse: separate;
padding: 16px;
}
table.nopadding {
padding: 0px;
width: 100%;
border-spacing: 0;
border-collapse: separate;
}
th {
background-color: var(--table-row-alternative-background-color, #eee);
}
th, td {
padding: 5px;
text-align: left;
}
tr {
color: var(--secondary-text-color);
}
tr:nth-child(even) {
background-color: var(--table-row-alternative-background-color, #eee);
}
.text-center {
text-align: center;
}
.width-40 {
width: 40px;
}
.width-50 {
width: 50px;
}
.width-60 {
width: 60px;
}
.hide {
display: none;
}
.strikethrough {
text-decoration: line-through;
}
.italic {
font-style: italic;
}
a {
text-decoration: none;
color: var(--secondary-text-color);
}
.clickable {
cursor: pointer;
}
ha-icon {
color: var(--secondary-text-color);
}
.transparent {
background-color: transparent !important;
}
`},593:(t,e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.reduceArray=e.checkConfig=e.hasConfigOrCardValuesChanged=void 0,e.hasConfigOrCardValuesChanged=(t,e,i)=>{if(i.has("config"))return!0;const n=i.get("_hass");if(n&&t.entity)return n.states[t.entity]!==t.hass.states[t.entity];const r=i.get("card");if(r&&r.parent)return r.parent.properties!==e.properties;const o=i.get("cardValues");return!!o&&o!=e.properties},e.checkConfig=t=>{if(!(""!==t.date&&null!==t.date&&void 0!==t.date||""!==t.entity&&null!==t.entity&&void 0!==t.entity))throw new Error("Please define a date or a entity.")},e.reduceArray=(t,e)=>void 0===t?[]:e?t.slice(0,e):t},692:(t,e,i)=>{var n;i.r(e),i.d(e,{_$LH:()=>V,html:()=>k,noChange:()=>C,nothing:()=>x,render:()=>q,svg:()=>E});const r=window,o=r.trustedTypes,s=o?o.createPolicy("lit-html",{createHTML:t=>t}):void 0,a="$lit$",c=`lit$${(Math.random()+"").slice(9)}$`,l="?"+c,u=`<${l}>`,d=document,h=()=>d.createComment(""),m=t=>null===t||"object"!=typeof t&&"function"!=typeof t,p=Array.isArray,f=t=>p(t)||"function"==typeof(null==t?void 0:t[Symbol.iterator]),v="[ \t\n\f\r]",g=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,_=/-->/g,y=/>/g,b=RegExp(`>|${v}(?:([^\\s"'>=/]+)(${v}*=${v}*(?:[^ \t\n\f\r"'\`<>=]|("|')|))|$)`,"g"),w=/'/g,$=/"/g,A=/^(?:script|style|textarea|title)$/i,S=t=>(e,...i)=>({_$litType$:t,strings:e,values:i}),k=S(1),E=S(2),C=Symbol.for("lit-noChange"),x=Symbol.for("lit-nothing"),D=new WeakMap,T=d.createTreeWalker(d,129,null,!1),O=(t,e)=>{const i=t.length-1,n=[];let r,o=2===e?"<svg>":"",l=g;for(let e=0;e<i;e++){const i=t[e];let s,d,h=-1,m=0;for(;m<i.length&&(l.lastIndex=m,d=l.exec(i),null!==d);)m=l.lastIndex,l===g?"!--"===d[1]?l=_:void 0!==d[1]?l=y:void 0!==d[2]?(A.test(d[2])&&(r=RegExp("</"+d[2],"g")),l=b):void 0!==d[3]&&(l=b):l===b?">"===d[0]?(l=null!=r?r:g,h=-1):void 0===d[1]?h=-2:(h=l.lastIndex-d[2].length,s=d[1],l=void 0===d[3]?b:'"'===d[3]?$:w):l===$||l===w?l=b:l===_||l===y?l=g:(l=b,r=void 0);const p=l===b&&t[e+1].startsWith("/>")?" ":"";o+=l===g?i+u:h>=0?(n.push(s),i.slice(0,h)+a+i.slice(h)+c+p):i+c+(-2===h?(n.push(void 0),e):p)}const d=o+(t[i]||"<?>")+(2===e?"</svg>":"");if(!Array.isArray(t)||!t.hasOwnProperty("raw"))throw Error("invalid template strings array");return[void 0!==s?s.createHTML(d):d,n]};class N{constructor({strings:t,_$litType$:e},i){let n;this.parts=[];let r=0,s=0;const u=t.length-1,d=this.parts,[m,p]=O(t,e);if(this.el=N.createElement(m,i),T.currentNode=this.el.content,2===e){const t=this.el.content,e=t.firstChild;e.remove(),t.append(...e.childNodes)}for(;null!==(n=T.nextNode())&&d.length<u;){if(1===n.nodeType){if(n.hasAttributes()){const t=[];for(const e of n.getAttributeNames())if(e.endsWith(a)||e.startsWith(c)){const i=p[s++];if(t.push(e),void 0!==i){const t=n.getAttribute(i.toLowerCase()+a).split(c),e=/([.?@])?(.*)/.exec(i);d.push({type:1,index:r,name:e[2],strings:t,ctor:"."===e[1]?I:"?"===e[1]?H:"@"===e[1]?F:j})}else d.push({type:6,index:r})}for(const e of t)n.removeAttribute(e)}if(A.test(n.tagName)){const t=n.textContent.split(c),e=t.length-1;if(e>0){n.textContent=o?o.emptyScript:"";for(let i=0;i<e;i++)n.append(t[i],h()),T.nextNode(),d.push({type:2,index:++r});n.append(t[e],h())}}}else if(8===n.nodeType)if(n.data===l)d.push({type:2,index:r});else{let t=-1;for(;-1!==(t=n.data.indexOf(c,t+1));)d.push({type:7,index:r}),t+=c.length-1}r++}}static createElement(t,e){const i=d.createElement("template");return i.innerHTML=t,i}}function M(t,e,i=t,n){var r,o,s,a;if(e===C)return e;let c=void 0!==n?null===(r=i._$Co)||void 0===r?void 0:r[n]:i._$Cl;const l=m(e)?void 0:e._$litDirective$;return(null==c?void 0:c.constructor)!==l&&(null===(o=null==c?void 0:c._$AO)||void 0===o||o.call(c,!1),void 0===l?c=void 0:(c=new l(t),c._$AT(t,i,n)),void 0!==n?(null!==(s=(a=i)._$Co)&&void 0!==s?s:a._$Co=[])[n]=c:i._$Cl=c),void 0!==c&&(e=M(t,c._$AS(t,e.values),c,n)),e}class P{constructor(t,e){this.u=[],this._$AN=void 0,this._$AD=t,this._$AM=e}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}v(t){var e;const{el:{content:i},parts:n}=this._$AD,r=(null!==(e=null==t?void 0:t.creationScope)&&void 0!==e?e:d).importNode(i,!0);T.currentNode=r;let o=T.nextNode(),s=0,a=0,c=n[0];for(;void 0!==c;){if(s===c.index){let e;2===c.type?e=new R(o,o.nextSibling,this,t):1===c.type?e=new c.ctor(o,c.name,c.strings,this,t):6===c.type&&(e=new L(o,this,t)),this.u.push(e),c=n[++a]}s!==(null==c?void 0:c.index)&&(o=T.nextNode(),s++)}return r}p(t){let e=0;for(const i of this.u)void 0!==i&&(void 0!==i.strings?(i._$AI(t,i,e),e+=i.strings.length-2):i._$AI(t[e])),e++}}class R{constructor(t,e,i,n){var r;this.type=2,this._$AH=x,this._$AN=void 0,this._$AA=t,this._$AB=e,this._$AM=i,this.options=n,this._$Cm=null===(r=null==n?void 0:n.isConnected)||void 0===r||r}get _$AU(){var t,e;return null!==(e=null===(t=this._$AM)||void 0===t?void 0:t._$AU)&&void 0!==e?e:this._$Cm}get parentNode(){let t=this._$AA.parentNode;const e=this._$AM;return void 0!==e&&11===(null==t?void 0:t.nodeType)&&(t=e.parentNode),t}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(t,e=this){t=M(this,t,e),m(t)?t===x||null==t||""===t?(this._$AH!==x&&this._$AR(),this._$AH=x):t!==this._$AH&&t!==C&&this.g(t):void 0!==t._$litType$?this.$(t):void 0!==t.nodeType?this.T(t):f(t)?this.k(t):this.g(t)}S(t){return this._$AA.parentNode.insertBefore(t,this._$AB)}T(t){this._$AH!==t&&(this._$AR(),this._$AH=this.S(t))}g(t){this._$AH!==x&&m(this._$AH)?this._$AA.nextSibling.data=t:this.T(d.createTextNode(t)),this._$AH=t}$(t){var e;const{values:i,_$litType$:n}=t,r="number"==typeof n?this._$AC(t):(void 0===n.el&&(n.el=N.createElement(n.h,this.options)),n);if((null===(e=this._$AH)||void 0===e?void 0:e._$AD)===r)this._$AH.p(i);else{const t=new P(r,this),e=t.v(this.options);t.p(i),this.T(e),this._$AH=t}}_$AC(t){let e=D.get(t.strings);return void 0===e&&D.set(t.strings,e=new N(t)),e}k(t){p(this._$AH)||(this._$AH=[],this._$AR());const e=this._$AH;let i,n=0;for(const r of t)n===e.length?e.push(i=new R(this.S(h()),this.S(h()),this,this.options)):i=e[n],i._$AI(r),n++;n<e.length&&(this._$AR(i&&i._$AB.nextSibling,n),e.length=n)}_$AR(t=this._$AA.nextSibling,e){var i;for(null===(i=this._$AP)||void 0===i||i.call(this,!1,!0,e);t&&t!==this._$AB;){const e=t.nextSibling;t.remove(),t=e}}setConnected(t){var e;void 0===this._$AM&&(this._$Cm=t,null===(e=this._$AP)||void 0===e||e.call(this,t))}}class j{constructor(t,e,i,n,r){this.type=1,this._$AH=x,this._$AN=void 0,this.element=t,this.name=e,this._$AM=n,this.options=r,i.length>2||""!==i[0]||""!==i[1]?(this._$AH=Array(i.length-1).fill(new String),this.strings=i):this._$AH=x}get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}_$AI(t,e=this,i,n){const r=this.strings;let o=!1;if(void 0===r)t=M(this,t,e,0),o=!m(t)||t!==this._$AH&&t!==C,o&&(this._$AH=t);else{const n=t;let s,a;for(t=r[0],s=0;s<r.length-1;s++)a=M(this,n[i+s],e,s),a===C&&(a=this._$AH[s]),o||(o=!m(a)||a!==this._$AH[s]),a===x?t=x:t!==x&&(t+=(null!=a?a:"")+r[s+1]),this._$AH[s]=a}o&&!n&&this.j(t)}j(t){t===x?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,null!=t?t:"")}}class I extends j{constructor(){super(...arguments),this.type=3}j(t){this.element[this.name]=t===x?void 0:t}}const U=o?o.emptyScript:"";class H extends j{constructor(){super(...arguments),this.type=4}j(t){t&&t!==x?this.element.setAttribute(this.name,U):this.element.removeAttribute(this.name)}}class F extends j{constructor(t,e,i,n,r){super(t,e,i,n,r),this.type=5}_$AI(t,e=this){var i;if((t=null!==(i=M(this,t,e,0))&&void 0!==i?i:x)===C)return;const n=this._$AH,r=t===x&&n!==x||t.capture!==n.capture||t.once!==n.once||t.passive!==n.passive,o=t!==x&&(n===x||r);r&&this.element.removeEventListener(this.name,this,n),o&&this.element.addEventListener(this.name,this,t),this._$AH=t}handleEvent(t){var e,i;"function"==typeof this._$AH?this._$AH.call(null!==(i=null===(e=this.options)||void 0===e?void 0:e.host)&&void 0!==i?i:this.element,t):this._$AH.handleEvent(t)}}class L{constructor(t,e,i){this.element=t,this.type=6,this._$AN=void 0,this._$AM=e,this.options=i}get _$AU(){return this._$AM._$AU}_$AI(t){M(this,t)}}const V={P:a,A:c,M:l,C:1,L:O,D:P,R:f,V:M,I:R,H:j,N:H,U:F,F:I,B:L},z=r.litHtmlPolyfillSupport;null==z||z(N,R),(null!==(n=r.litHtmlVersions)&&void 0!==n?n:r.litHtmlVersions=[]).push("2.7.0");const q=(t,e,i)=>{var n,r;const o=null!==(n=null==i?void 0:i.renderBefore)&&void 0!==n?n:e;let s=o._$litPart$;if(void 0===s){const t=null!==(r=null==i?void 0:i.renderBefore)&&void 0!==r?r:null;o._$litPart$=s=new R(e.insertBefore(h(),t),t,void 0,null!=i?i:{})}return s._$AI(t),s}},595:(t,e,i)=>{i.r(e),i.d(e,{customElement:()=>n,eventOptions:()=>c,property:()=>o,query:()=>l,queryAll:()=>u,queryAssignedElements:()=>p,queryAssignedNodes:()=>f,queryAsync:()=>d,state:()=>s});const n=t=>e=>"function"==typeof e?((t,e)=>(customElements.define(t,e),e))(t,e):((t,e)=>{const{kind:i,elements:n}=e;return{kind:i,elements:n,finisher(e){customElements.define(t,e)}}})(t,e),r=(t,e)=>"method"===e.kind&&e.descriptor&&!("value"in e.descriptor)?{...e,finisher(i){i.createProperty(e.key,t)}}:{kind:"field",key:Symbol(),placement:"own",descriptor:{},originalKey:e.key,initializer(){"function"==typeof e.initializer&&(this[e.key]=e.initializer.call(this))},finisher(i){i.createProperty(e.key,t)}};function o(t){return(e,i)=>void 0!==i?((t,e,i)=>{e.constructor.createProperty(i,t)})(t,e,i):r(t,e)}function s(t){return o({...t,state:!0})}const a=({finisher:t,descriptor:e})=>(i,n)=>{var r;if(void 0===n){const n=null!==(r=i.originalKey)&&void 0!==r?r:i.key,o=null!=e?{kind:"method",placement:"prototype",key:n,descriptor:e(i.key)}:{...i,key:n};return null!=t&&(o.finisher=function(e){t(e,n)}),o}{const r=i.constructor;void 0!==e&&Object.defineProperty(i,n,e(n)),null==t||t(r,n)}};function c(t){return a({finisher:(e,i)=>{Object.assign(e.prototype[i],t)}})}function l(t,e){return a({descriptor:i=>{const n={get(){var e,i;return null!==(i=null===(e=this.renderRoot)||void 0===e?void 0:e.querySelector(t))&&void 0!==i?i:null},enumerable:!0,configurable:!0};if(e){const e="symbol"==typeof i?Symbol():"__"+i;n.get=function(){var i,n;return void 0===this[e]&&(this[e]=null!==(n=null===(i=this.renderRoot)||void 0===i?void 0:i.querySelector(t))&&void 0!==n?n:null),this[e]}}return n}})}function u(t){return a({descriptor:e=>({get(){var e,i;return null!==(i=null===(e=this.renderRoot)||void 0===e?void 0:e.querySelectorAll(t))&&void 0!==i?i:[]},enumerable:!0,configurable:!0})})}function d(t){return a({descriptor:e=>({async get(){var e;return await this.updateComplete,null===(e=this.renderRoot)||void 0===e?void 0:e.querySelector(t)},enumerable:!0,configurable:!0})})}var h;const m=null!=(null===(h=window.HTMLSlotElement)||void 0===h?void 0:h.prototype.assignedElements)?(t,e)=>t.assignedElements(e):(t,e)=>t.assignedNodes(e).filter((t=>t.nodeType===Node.ELEMENT_NODE));function p(t){const{slot:e,selector:i}=null!=t?t:{};return a({descriptor:n=>({get(){var n;const r="slot"+(e?`[name=${e}]`:":not([name])"),o=null===(n=this.renderRoot)||void 0===n?void 0:n.querySelector(r),s=null!=o?m(o,t):[];return i?s.filter((t=>t.matches(i))):s},enumerable:!0,configurable:!0})})}function f(t,e,i){let n,r=t;return"object"==typeof t?(r=t.slot,n=t):n={flatten:e},i?p({slot:r,flatten:e,selector:i}):a({descriptor:t=>({get(){var t,e;const i="slot"+(r?`[name=${r}]`:":not([name])"),o=null===(t=this.renderRoot)||void 0===t?void 0:t.querySelector(i);return null!==(e=null==o?void 0:o.assignedNodes(n))&&void 0!==e?e:[]},enumerable:!0,configurable:!0})})}},884:(t,e,i)=>{i.r(e),i.d(e,{AsyncReplaceDirective:()=>f,asyncReplace:()=>v});var n=i(692);const{I:r}=n._$LH;class o{constructor(t){}get _$AU(){return this._$AM._$AU}_$AT(t,e,i){this._$Ct=t,this._$AM=e,this._$Ci=i}_$AS(t,e){return this.update(t,e)}update(t,e){return this.render(...e)}}const s=(t,e)=>{var i,n;const r=t._$AN;if(void 0===r)return!1;for(const t of r)null===(n=(i=t)._$AO)||void 0===n||n.call(i,e,!1),s(t,e);return!0},a=t=>{let e,i;do{if(void 0===(e=t._$AM))break;i=e._$AN,i.delete(t),t=e}while(0===(null==i?void 0:i.size))},c=t=>{for(let e;e=t._$AM;t=e){let i=e._$AN;if(void 0===i)e._$AN=i=new Set;else if(i.has(t))break;i.add(t),d(e)}};function l(t){void 0!==this._$AN?(a(this),this._$AM=t,c(this)):this._$AM=t}function u(t,e=!1,i=0){const n=this._$AH,r=this._$AN;if(void 0!==r&&0!==r.size)if(e)if(Array.isArray(n))for(let t=i;t<n.length;t++)s(n[t],!1),a(n[t]);else null!=n&&(s(n,!1),a(n));else s(this,t)}const d=t=>{var e,i,n,r;2==t.type&&(null!==(e=(n=t)._$AP)&&void 0!==e||(n._$AP=u),null!==(i=(r=t)._$AQ)&&void 0!==i||(r._$AQ=l))};class h extends o{constructor(){super(...arguments),this._$AN=void 0}_$AT(t,e,i){super._$AT(t,e,i),c(this),this.isConnected=t._$AU}_$AO(t,e=!0){var i,n;t!==this.isConnected&&(this.isConnected=t,t?null===(i=this.reconnected)||void 0===i||i.call(this):null===(n=this.disconnected)||void 0===n||n.call(this)),e&&(s(this,t),a(this))}setValue(t){if((t=>void 0===this._$Ct.strings)())this._$Ct._$AI(t,this);else{const e=[...this._$Ct._$AH];e[this._$Ci]=t,this._$Ct._$AI(e,this,0)}}disconnected(){}reconnected(){}}class m{constructor(t){this.Y=t}disconnect(){this.Y=void 0}reconnect(t){this.Y=t}deref(){return this.Y}}class p{constructor(){this.Z=void 0,this.q=void 0}get(){return this.Z}pause(){var t;null!==(t=this.Z)&&void 0!==t||(this.Z=new Promise((t=>this.q=t)))}resume(){var t;null===(t=this.q)||void 0===t||t.call(this),this.Z=this.q=void 0}}class f extends h{constructor(){super(...arguments),this._$CK=new m(this),this._$CX=new p}render(t,e){return n.noChange}update(t,[e,i]){if(this.isConnected||this.disconnected(),e===this._$CJ)return;this._$CJ=e;let r=0;const{_$CK:o,_$CX:s}=this;return(async(t,e)=>{for await(const i of t)if(!1===await e(i))return})(e,(async t=>{for(;s.get();)await s.get();const n=o.deref();if(void 0!==n){if(n._$CJ!==e)return!1;void 0!==i&&(t=i(t,r)),n.commitValue(t,r),r++}return!0})),n.noChange}commitValue(t,e){this.setValue(t)}disconnected(){this._$CK.disconnect(),this._$CX.pause()}reconnected(){this._$CK.reconnect(this),this._$CX.resume()}}const v=(g=f,(...t)=>({_$litDirective$:g,values:t}));var g},677:(t,e,i)=>{i.r(e),i.d(e,{CSSResult:()=>a,LitElement:()=>k,ReactiveElement:()=>b,UpdatingElement:()=>S,_$LE:()=>C,_$LH:()=>A._$LH,adoptStyles:()=>u,css:()=>l,defaultConverter:()=>g,getCompatibleStyle:()=>d,html:()=>A.html,isServer:()=>x,noChange:()=>A.noChange,notEqual:()=>_,nothing:()=>A.nothing,render:()=>A.render,supportsAdoptingStyleSheets:()=>r,svg:()=>A.svg,unsafeCSS:()=>c});const n=window,r=n.ShadowRoot&&(void 0===n.ShadyCSS||n.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,o=Symbol(),s=new WeakMap;class a{constructor(t,e,i){if(this._$cssResult$=!0,i!==o)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=t,this.t=e}get styleSheet(){let t=this.o;const e=this.t;if(r&&void 0===t){const i=void 0!==e&&1===e.length;i&&(t=s.get(e)),void 0===t&&((this.o=t=new CSSStyleSheet).replaceSync(this.cssText),i&&s.set(e,t))}return t}toString(){return this.cssText}}const c=t=>new a("string"==typeof t?t:t+"",void 0,o),l=(t,...e)=>{const i=1===t.length?t[0]:e.reduce(((e,i,n)=>e+(t=>{if(!0===t._$cssResult$)return t.cssText;if("number"==typeof t)return t;throw Error("Value passed to 'css' function must be a 'css' function result: "+t+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(i)+t[n+1]),t[0]);return new a(i,t,o)},u=(t,e)=>{r?t.adoptedStyleSheets=e.map((t=>t instanceof CSSStyleSheet?t:t.styleSheet)):e.forEach((e=>{const i=document.createElement("style"),r=n.litNonce;void 0!==r&&i.setAttribute("nonce",r),i.textContent=e.cssText,t.appendChild(i)}))},d=r?t=>t:t=>t instanceof CSSStyleSheet?(t=>{let e="";for(const i of t.cssRules)e+=i.cssText;return c(e)})(t):t;var h;const m=window,p=m.trustedTypes,f=p?p.emptyScript:"",v=m.reactiveElementPolyfillSupport,g={toAttribute(t,e){switch(e){case Boolean:t=t?f:null;break;case Object:case Array:t=null==t?t:JSON.stringify(t)}return t},fromAttribute(t,e){let i=t;switch(e){case Boolean:i=null!==t;break;case Number:i=null===t?null:Number(t);break;case Object:case Array:try{i=JSON.parse(t)}catch(t){i=null}}return i}},_=(t,e)=>e!==t&&(e==e||t==t),y={attribute:!0,type:String,converter:g,reflect:!1,hasChanged:_};class b extends HTMLElement{constructor(){super(),this._$Ei=new Map,this.isUpdatePending=!1,this.hasUpdated=!1,this._$El=null,this.u()}static addInitializer(t){var e;this.finalize(),(null!==(e=this.h)&&void 0!==e?e:this.h=[]).push(t)}static get observedAttributes(){this.finalize();const t=[];return this.elementProperties.forEach(((e,i)=>{const n=this._$Ep(i,e);void 0!==n&&(this._$Ev.set(n,i),t.push(n))})),t}static createProperty(t,e=y){if(e.state&&(e.attribute=!1),this.finalize(),this.elementProperties.set(t,e),!e.noAccessor&&!this.prototype.hasOwnProperty(t)){const i="symbol"==typeof t?Symbol():"__"+t,n=this.getPropertyDescriptor(t,i,e);void 0!==n&&Object.defineProperty(this.prototype,t,n)}}static getPropertyDescriptor(t,e,i){return{get(){return this[e]},set(n){const r=this[t];this[e]=n,this.requestUpdate(t,r,i)},configurable:!0,enumerable:!0}}static getPropertyOptions(t){return this.elementProperties.get(t)||y}static finalize(){if(this.hasOwnProperty("finalized"))return!1;this.finalized=!0;const t=Object.getPrototypeOf(this);if(t.finalize(),void 0!==t.h&&(this.h=[...t.h]),this.elementProperties=new Map(t.elementProperties),this._$Ev=new Map,this.hasOwnProperty("properties")){const t=this.properties,e=[...Object.getOwnPropertyNames(t),...Object.getOwnPropertySymbols(t)];for(const i of e)this.createProperty(i,t[i])}return this.elementStyles=this.finalizeStyles(this.styles),!0}static finalizeStyles(t){const e=[];if(Array.isArray(t)){const i=new Set(t.flat(1/0).reverse());for(const t of i)e.unshift(d(t))}else void 0!==t&&e.push(d(t));return e}static _$Ep(t,e){const i=e.attribute;return!1===i?void 0:"string"==typeof i?i:"string"==typeof t?t.toLowerCase():void 0}u(){var t;this._$E_=new Promise((t=>this.enableUpdating=t)),this._$AL=new Map,this._$Eg(),this.requestUpdate(),null===(t=this.constructor.h)||void 0===t||t.forEach((t=>t(this)))}addController(t){var e,i;(null!==(e=this._$ES)&&void 0!==e?e:this._$ES=[]).push(t),void 0!==this.renderRoot&&this.isConnected&&(null===(i=t.hostConnected)||void 0===i||i.call(t))}removeController(t){var e;null===(e=this._$ES)||void 0===e||e.splice(this._$ES.indexOf(t)>>>0,1)}_$Eg(){this.constructor.elementProperties.forEach(((t,e)=>{this.hasOwnProperty(e)&&(this._$Ei.set(e,this[e]),delete this[e])}))}createRenderRoot(){var t;const e=null!==(t=this.shadowRoot)&&void 0!==t?t:this.attachShadow(this.constructor.shadowRootOptions);return u(e,this.constructor.elementStyles),e}connectedCallback(){var t;void 0===this.renderRoot&&(this.renderRoot=this.createRenderRoot()),this.enableUpdating(!0),null===(t=this._$ES)||void 0===t||t.forEach((t=>{var e;return null===(e=t.hostConnected)||void 0===e?void 0:e.call(t)}))}enableUpdating(t){}disconnectedCallback(){var t;null===(t=this._$ES)||void 0===t||t.forEach((t=>{var e;return null===(e=t.hostDisconnected)||void 0===e?void 0:e.call(t)}))}attributeChangedCallback(t,e,i){this._$AK(t,i)}_$EO(t,e,i=y){var n;const r=this.constructor._$Ep(t,i);if(void 0!==r&&!0===i.reflect){const o=(void 0!==(null===(n=i.converter)||void 0===n?void 0:n.toAttribute)?i.converter:g).toAttribute(e,i.type);this._$El=t,null==o?this.removeAttribute(r):this.setAttribute(r,o),this._$El=null}}_$AK(t,e){var i;const n=this.constructor,r=n._$Ev.get(t);if(void 0!==r&&this._$El!==r){const t=n.getPropertyOptions(r),o="function"==typeof t.converter?{fromAttribute:t.converter}:void 0!==(null===(i=t.converter)||void 0===i?void 0:i.fromAttribute)?t.converter:g;this._$El=r,this[r]=o.fromAttribute(e,t.type),this._$El=null}}requestUpdate(t,e,i){let n=!0;void 0!==t&&(((i=i||this.constructor.getPropertyOptions(t)).hasChanged||_)(this[t],e)?(this._$AL.has(t)||this._$AL.set(t,e),!0===i.reflect&&this._$El!==t&&(void 0===this._$EC&&(this._$EC=new Map),this._$EC.set(t,i))):n=!1),!this.isUpdatePending&&n&&(this._$E_=this._$Ej())}async _$Ej(){this.isUpdatePending=!0;try{await this._$E_}catch(t){Promise.reject(t)}const t=this.scheduleUpdate();return null!=t&&await t,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){var t;if(!this.isUpdatePending)return;this.hasUpdated,this._$Ei&&(this._$Ei.forEach(((t,e)=>this[e]=t)),this._$Ei=void 0);let e=!1;const i=this._$AL;try{e=this.shouldUpdate(i),e?(this.willUpdate(i),null===(t=this._$ES)||void 0===t||t.forEach((t=>{var e;return null===(e=t.hostUpdate)||void 0===e?void 0:e.call(t)})),this.update(i)):this._$Ek()}catch(t){throw e=!1,this._$Ek(),t}e&&this._$AE(i)}willUpdate(t){}_$AE(t){var e;null===(e=this._$ES)||void 0===e||e.forEach((t=>{var e;return null===(e=t.hostUpdated)||void 0===e?void 0:e.call(t)})),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(t)),this.updated(t)}_$Ek(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$E_}shouldUpdate(t){return!0}update(t){void 0!==this._$EC&&(this._$EC.forEach(((t,e)=>this._$EO(e,this[e],t))),this._$EC=void 0),this._$Ek()}updated(t){}firstUpdated(t){}}b.finalized=!0,b.elementProperties=new Map,b.elementStyles=[],b.shadowRootOptions={mode:"open"},null==v||v({ReactiveElement:b}),(null!==(h=m.reactiveElementVersions)&&void 0!==h?h:m.reactiveElementVersions=[]).push("1.6.1");var w,$,A=i(692);const S=b;class k extends b{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){var t,e;const i=super.createRenderRoot();return null!==(t=(e=this.renderOptions).renderBefore)&&void 0!==t||(e.renderBefore=i.firstChild),i}update(t){const e=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(t),this._$Do=(0,A.render)(e,this.renderRoot,this.renderOptions)}connectedCallback(){var t;super.connectedCallback(),null===(t=this._$Do)||void 0===t||t.setConnected(!0)}disconnectedCallback(){var t;super.disconnectedCallback(),null===(t=this._$Do)||void 0===t||t.setConnected(!1)}render(){return A.noChange}}k.finalized=!0,k._$litElement$=!0,null===(w=globalThis.litElementHydrateSupport)||void 0===w||w.call(globalThis,{LitElement:k});const E=globalThis.litElementPolyfillSupport;null==E||E({LitElement:k});const C={_$AK:(t,e,i)=>{t._$AK(e,i)},_$AL:t=>t._$AL};(null!==($=globalThis.litElementVersions)&&void 0!==$?$:globalThis.litElementVersions=[]).push("3.3.0");const x=!1},147:t=>{t.exports=JSON.parse('{"name":"timer-card","version":"0.0.1","description":"Display a simple timer","main":"index.js","scripts":{"lint":"eslint src/**/*.ts","dev":"webpack -c webpack.config.js","build":"yarn lint && webpack -c webpack.config.js","test":"jest","coverage":"jest --coverage","workflow":"jest --coverage --json --outputFile=/home/runner/work/timer-card/timer-card/jest.results.json","prebuild":"cp git-hooks/pre-commit .git/hooks/ && echo \'hook copied\'"},"repository":{"type":"git","url":"git+https://github.com/wwwescape/timer-card.git"},"keywords":[],"author":"","license":"ISC","bugs":{"url":"https://github.com/wwwescape/timer-card/issues"},"homepage":"https://github.com/wwwescape/timer-card#readme","devDependencies":{"@types/jest":"^29.5.2","@typescript-eslint/eslint-plugin":"^5.59.8","@typescript-eslint/parser":"^5.59.1","codecov":"^3.8.3","eslint":"^8.44.0","home-assistant-js-websocket":"^8.1.0","lit":"^2.7.4","typescript":"^4.9.5","webpack":"^5.81.0","webpack-cli":"^5.0.2"},"dependencies":{"@babel/plugin-transform-runtime":"^7.22.5","@babel/preset-env":"^7.22.5","@lit-labs/scoped-registry-mixin":"^1.0.1","babel-jest":"^29.5.0","compression-webpack-plugin":"^10.0.0","custom-card-helpers":"^1.9.0","isomorphic-fetch":"^3.0.0","jest-environment-jsdom":"^29.5.0","jest-fetch-mock":"^3.0.3","jest-ts-auto-mock":"^2.1.0","ts-auto-mock":"^3.6.4","ts-jest":"^29.1.1","ts-loader":"^9.4.2","ttypescript":"^1.5.15","yarn":"^1.22.19"}}')}},e={};function i(n){var r=e[n];if(void 0!==r)return r.exports;var o=e[n]={exports:{}};return t[n].call(o.exports,o,o.exports,i),o.exports}i.d=(t,e)=>{for(var n in e)i.o(e,n)&&!i.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:e[n]})},i.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),i.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},i(607)})();