forked from marcokreeft87/formulaone-card
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathformulaone-card.js
492 lines (491 loc) · 111 KB
/
formulaone-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
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
/*! For license information please see formulaone-card.js.LICENSE.txt */
(()=>{"use strict";var t={8455:(t,e,n)=>{Object.defineProperty(e,"__esModule",{value:!0});const i=n(6197),r=n(936),o=n(7399),a=n(6926);class s extends r.LitElement{constructor(){super(...arguments),this.controlRenderers={[o.FormControlType.Dropdown]:a.renderDropdown,[o.FormControlType.Radio]:a.renderRadio,[o.FormControlType.Checkboxes]:a.renderCheckboxes,[o.FormControlType.EntityDropdown]:a.renderDropdown,[o.FormControlType.Switch]:a.renderSwitch,[o.FormControlType.Textbox]:a.renderTextbox,[o.FormControlType.Filler]:a.renderFiller}}setConfig(t){this._config=t}set hass(t){this._hass=t}renderForm(t){return r.html`
<div class="card-config">
${t.map((t=>{const e=t.cssClass?`form-row ${t.cssClass}`:"form-row";return t.hidden?"":r.html`
<div class="${e}">
<label>${t.label}</label>
${t.controls.map((t=>this.renderControl(t)))}
</div>
`}))}
</div>
`}renderControl(t){const e=this.controlRenderers[t.type];if(!e)throw new Error(`Unsupported control type: ${t.type}`);return e(this,t)}_valueChanged(t){if(!this._config||!this._hass)return;const e=t.target,n=t.detail;if("HA-CHECKBOX"===e.tagName){const t=this._config[e.configValue].indexOf(e.value);e.checked&&t<0?this._config[e.configValue]=[...this._config[e.configValue],e.value]:!e.checked&&t>-1&&(this._config[e.configValue]=[...this._config[e.configValue].slice(0,t),...this._config[e.configValue].slice(t+1)])}else if(e.configValue)if(e.configValue.indexOf(".")>-1){const[t,n]=e.configValue.split(".");this._config={...this._config,[t]:{...this._config[t],[n]:e.checked}}}else this._config={...this._config,[e.configValue]:void 0===e.checked&&(null==n?void 0:n.value)?e.checked||n.value:e.value||e.checked};(0,i.fireEvent)(this,"config-changed",{config:this._config},{bubbles:!0,composed:!0}),this.requestUpdate("_config")}static get styles(){return r.css`
.form-row {
margin-bottom: 10px;
}
.form-control {
display: flex;
align-items: center;
}
ha-switch {
padding: 16px 6px;
}
.side-by-side {
display: flex;
flex-flow: row wrap;
}
.side-by-side > label {
width: 100%;
}
.side-by-side > .form-control {
width: 49%;
padding: 2px;
}
ha-textfield {
width: 100%;
}
`}}e.default=s},7399:(t,e)=>{var n;Object.defineProperty(e,"__esModule",{value:!0}),e.FormControlType=void 0,function(t){t.Dropdown="dropdown",t.Checkbox="checkbox",t.Checkboxes="checkboxes",t.Radio="radio",t.Switch="switch",t.Textbox="textbox",t.Filler="filler",t.EntityDropdown="entity-dropdown"}(n||(e.FormControlType=n={}))},6926:(t,e,n)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.renderCheckboxes=e.renderRadio=e.renderDropdown=e.renderSwitch=e.renderTextbox=e.renderEntityDropdown=e.renderFiller=void 0;const i=n(936),r=n(9049);e.renderFiller=()=>i.html`<div class="form-control"></div>`,e.renderEntityDropdown=(t,e)=>{var n;return i.html`
<div class="form-control">
<ha-entity-picker
label="${e.label}"
.value="${null!==(n=t._config[e.configValue])&&void 0!==n?n:""}"
.configValue="${e.configValue}"
.hass="${t._hass}"
domain-filter="${e.domain}"
@change="${t._valueChanged}">
</ha-entity-picker>
</div>
`},e.renderTextbox=(t,e)=>{var n;return i.html`
<div class="form-control">
<ha-textfield
label="${e.label}"
.value="${null!==(n=t._config[e.configValue])&&void 0!==n?n:""}"
.configValue="${e.configValue}"
@change="${t._valueChanged}">
</ha-textfield>
</div>
`},e.renderSwitch=(t,e)=>i.html`
<div class="form-control">
<ha-switch
id="${e.configValue}"
name="${e.configValue}"
.checked="${t._config[e.configValue]}"
.configValue="${e.configValue}"
@change="${t._valueChanged}"
>
</ha-switch>
<label for="${e.configValue}">${e.label}</label>
</div>
`,e.renderDropdown=(t,e)=>{var n;const o=null!==(n=e.items)&&void 0!==n?n:(0,r.getEntitiesByDomain)(t._hass,e.domain);return i.html`
<div class="form-control">
<ha-combo-box
label="${e.label}"
.value="${t._config[e.configValue]}"
.configValue="${e.configValue}"
.items="${o}"
@value-changed="${t._valueChanged}"
@change=${t._valueChanged}
></ha-combo-box>
</div>
`},e.renderRadio=(t,e)=>i.html`
<div class="form-control">
<label>${e.label}</label>
${e.items.map((n=>i.html`
<ha-radio
id="${e.configValue}_${n.value}"
name="${e.configValue}"
.checked="${t._config[e.configValue]===n.value}"
.configValue="${e.configValue}"
.value="${n.value}"
@change="${t._valueChanged}"
>
</ha-radio>
<label for="${e.configValue}_${n.value}">${n.label}</label>
`))}
</div>
`,e.renderCheckboxes=(t,e)=>i.html`
<label>${e.label}</label>
${e.items.map((n=>{var r;return i.html`
<div class="form-control">
<ha-checkbox
id="${e.configValue}_${n.value}"
name="${e.configValue}[]"
.checked="${(null===(r=t._config[e.configValue])||void 0===r?void 0:r.indexOf(n.value))>-1}"
.configValue="${e.configValue}"
.value="${n.value}"
@change="${t._valueChanged}"
>
</ha-checkbox>
<label for="${e.configValue}_${n.value}">${n.label}</label>
</div>
`}))}
`},9049:(t,e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.getDropdownOptionsFromEnum=e.formatList=e.getEntitiesByDeviceClass=e.getEntitiesByDomain=void 0,e.getEntitiesByDomain=(t,n)=>Object.keys(t.states).filter((t=>t.substr(0,t.indexOf("."))===n)).map((n=>(0,e.formatList)(n,t))),e.getEntitiesByDeviceClass=(t,n,i)=>Object.keys(t.states).filter((e=>e.substr(0,e.indexOf("."))===n&&t.states[e].attributes.device_class===i)).map((n=>(0,e.formatList)(n,t))),e.formatList=(t,e)=>({label:e.states[t].attributes.friendly_name,value:t}),e.getDropdownOptionsFromEnum=t=>{const e=[];for(const[n,i]of Object.entries(t))e.push({value:i,label:n});return e}},6197:(t,e,n)=>{n.r(e),n.d(e,{DEFAULT_DOMAIN_ICON:()=>X,DEFAULT_PANEL:()=>J,DEFAULT_VIEW_ENTITY_ID:()=>st,DOMAINS_HIDE_MORE_INFO:()=>et,DOMAINS_MORE_INFO_NO_HISTORY:()=>nt,DOMAINS_TOGGLE:()=>rt,DOMAINS_WITH_CARD:()=>Z,DOMAINS_WITH_MORE_INFO:()=>tt,NumberFormat:()=>i,STATES_OFF:()=>it,TimeFormat:()=>r,UNIT_C:()=>ot,UNIT_F:()=>at,applyThemesOnElement:()=>L,computeCardSize:()=>V,computeDomain:()=>j,computeEntity:()=>H,computeRTL:()=>U,computeRTLDirection:()=>G,computeStateDisplay:()=>K,computeStateDomain:()=>B,createThing:()=>ut,debounce:()=>ht,domainIcon:()=>pt,evaluateFilter:()=>ft,fireEvent:()=>lt,fixedIcons:()=>mt,formatDate:()=>d,formatDateMonth:()=>y,formatDateMonthYear:()=>g,formatDateNumeric:()=>h,formatDateShort:()=>p,formatDateTime:()=>C,formatDateTimeNumeric:()=>A,formatDateTimeWithSeconds:()=>T,formatDateWeekday:()=>l,formatDateYear:()=>b,formatNumber:()=>Q,formatTime:()=>R,formatTimeWeekday:()=>F,formatTimeWithSeconds:()=>k,forwardHaptic:()=>gt,getLovelace:()=>At,handleAction:()=>wt,handleActionConfig:()=>bt,handleClick:()=>$t,hasAction:()=>Ct,hasConfigOrEntityChanged:()=>St,hasDoubleClick:()=>Tt,isNumericState:()=>q,navigate:()=>vt,numberFormatToLocale:()=>W,relativeTime:()=>M,round:()=>z,stateIcon:()=>Et,timerTimeRemaining:()=>P,toggleEntity:()=>_t,turnOnOffEntities:()=>Dt,turnOnOffEntity:()=>yt});var i,r,o,a=function(){return a=Object.assign||function(t){for(var e,n=1,i=arguments.length;n<i;n++)for(var r in e=arguments[n])Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t},a.apply(this,arguments)},s={second:45,minute:45,hour:22,day:5},l=function(t,e){return c(e).format(t)},c=function(t){return new Intl.DateTimeFormat(t.language,{weekday:"long",month:"long",day:"numeric"})},d=function(t,e){return u(e).format(t)},u=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"})},g=function(t,e){return v(e).format(t)},v=function(t){return new Intl.DateTimeFormat(t.language,{month:"long",year:"numeric"})},y=function(t,e){return _(e).format(t)},_=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=i||(i={})).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,n=(new Date).toLocaleString(e);return n.includes("AM")||n.includes("PM")}return t.time_format===r.am_pm},C=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)})},T=function(t,e){return D(e).format(t)},D=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)})},A=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)})},R=function(t,e){return E(e).format(t)},E=function(t){return new Intl.DateTimeFormat(t.language,{hour:"numeric",minute:"2-digit",hour12:$(t)})},k=function(t,e){return O(e).format(t)},O=function(t){return new Intl.DateTimeFormat(t.language,{hour:$(t)?"numeric":"2-digit",minute:"2-digit",second:"2-digit",hour12:$(t)})},F=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,n,i){void 0===i&&(i=!0);var r=function(t,e,n){void 0===e&&(e=Date.now()),void 0===n&&(n={});var i=a(a({},s),n||{}),r=(+t-+e)/1e3;if(Math.abs(r)<i.second)return{value:Math.round(r),unit:"second"};var o=r/60;if(Math.abs(o)<i.minute)return{value:Math.round(o),unit:"minute"};var l=r/3600;if(Math.abs(l)<i.hour)return{value:Math.round(l),unit:"hour"};var c=r/86400;if(Math.abs(c)<i.day)return{value:Math.round(c),unit:"day"};var d=new Date(t),u=new Date(e),h=d.getFullYear()-u.getFullYear();if(Math.round(Math.abs(h))>0)return{value:Math.round(h),unit:"year"};var m=12*h+d.getMonth()-u.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,n);return i?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 P(t){var e,n=3600*(e=t.attributes.remaining.split(":").map(Number))[0]+60*e[1]+e[2];if("active"===t.state){var i=(new Date).getTime(),r=new Date(t.last_changed).getTime();n=Math.max(n-(i-r)/1e3,0)}return n}function I(){return(I=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(t[i]=n[i])}return t}).apply(this,arguments)}var L=function(t,e,n,i){void 0===i&&(i=!1),t._themes||(t._themes={});var r=e.default_theme;("default"===n||n&&e.themes[n])&&(r=n);var o=I({},t._themes);if("default"!==r){var a=e.themes[r];Object.keys(a).forEach((function(e){var n="--"+e;t._themes[n]="",o[n]=a[e]}))}if(t.updateStyles?t.updateStyles(o):window.ShadyCSS&&window.ShadyCSS.styleSubtree(t,o),i){var s=document.querySelector("meta[name=theme-color]");if(s){s.hasAttribute("default-content")||s.setAttribute("default-content",s.getAttribute("content"));var l=o["--primary-color"]||s.getAttribute("default-content");s.setAttribute("content",l)}}},V=function(t){return"function"==typeof t.getCardSize?t.getCardSize():4};function j(t){return t.substr(0,t.indexOf("."))}function H(t){return t.substr(t.indexOf(".")+1)}function U(t){var e,n=(null==t||null==(e=t.locale)?void 0:e.language)||"en";return t.translationMetadata.translations[n]&&t.translationMetadata.translations[n].isRTL||!1}function G(t){return U(t)?"rtl":"ltr"}function B(t){return j(t.entity_id)}var q=function(t){return!!t.attributes.unit_of_measurement||!!t.attributes.state_class},W=function(t){switch(t.number_format){case i.comma_decimal:return["en-US","en"];case i.decimal_comma:return["de","es","it"];case i.space_comma:return["fr","sv","cs"];case i.system:return;default:return t.language}},z=function(t,e){return void 0===e&&(e=2),Math.round(t*Math.pow(10,e))/Math.pow(10,e)},Q=function(t,e,n){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)!==i.none&&!Number.isNaN(Number(t))&&Intl)try{return new Intl.NumberFormat(r,Y(t,n)).format(Number(t))}catch(e){return console.error(e),new Intl.NumberFormat(void 0,Y(t,n)).format(Number(t))}return"string"==typeof t?t:z(t,null==n?void 0:n.maximumFractionDigits).toString()+("currency"===(null==n?void 0:n.style)?" "+n.currency:"")},Y=function(t,e){var n=I({maximumFractionDigits:2},e);if("string"!=typeof t)return n;if(!e||!e.minimumFractionDigits&&!e.maximumFractionDigits){var i=t.indexOf(".")>-1?t.split(".")[1].length:0;n.minimumFractionDigits=i,n.maximumFractionDigits=i}return n},K=function(t,e,n,i){var r=void 0!==i?i:e.state;if("unknown"===r||"unavailable"===r)return t("state.default."+r);if(q(e)){if("monetary"===e.attributes.device_class)try{return Q(r,n,{style:"currency",currency:e.attributes.unit_of_measurement})}catch(t){}return Q(r,n)+(e.attributes.unit_of_measurement?" "+e.attributes.unit_of_measurement:"")}var o=B(e);if("input_datetime"===o){var a;if(void 0===i)return e.attributes.has_date&&e.attributes.has_time?(a=new Date(e.attributes.year,e.attributes.month-1,e.attributes.day,e.attributes.hour,e.attributes.minute),C(a,n)):e.attributes.has_date?(a=new Date(e.attributes.year,e.attributes.month-1,e.attributes.day),d(a,n)):e.attributes.has_time?((a=new Date).setHours(e.attributes.hour,e.attributes.minute),R(a,n)):e.state;try{var s=i.split(" ");if(2===s.length)return C(new Date(s.join("T")),n);if(1===s.length){if(i.includes("-"))return d(new Date(i+"T00:00"),n);if(i.includes(":")){var l=new Date;return R(new Date(l.toISOString().split("T")[0]+"T"+i),n)}}return i}catch(t){return i}}return"humidifier"===o&&"on"===r&&e.attributes.humidity?e.attributes.humidity+" %":"counter"===o||"number"===o||"input_number"===o?Q(r,n):e.attributes.device_class&&t("component."+o+".state."+e.attributes.device_class+"."+r)||t("component."+o+".state._."+r)||r},X="mdi:bookmark",J="lovelace",Z=["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"],nt=["camera","configurator","history_graph","scene"],it=["closed","locked","off"],rt=new Set(["fan","input_boolean","light","switch","group","automation"]),ot="°C",at="°F",st="group.default_view",lt=function(t,e,n,i){i=i||{},n=null==n?{}:n;var r=new Event(e,{bubbles:void 0===i.bubbles||i.bubbles,cancelable:Boolean(i.cancelable),composed:void 0===i.composed||i.composed});return r.detail=n,t.dispatchEvent(r),r},ct=new Set(["call-service","divider","section","weblink","cast","select"]),dt={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"},ut=function(t,e){void 0===e&&(e=!1);var n=function(t,e){return i("hui-error-card",{type:"error",error:t,config:e})},i=function(t,e){var i=window.document.createElement(t);try{if(!i.setConfig)return;i.setConfig(e)}catch(i){return console.error(t,i),n(i.message,e)}return i};if(!t||"object"!=typeof t||!e&&!t.type)return n("No type defined",t);var r=t.type;if(r&&r.startsWith("custom:"))r=r.substr(7);else if(e)if(ct.has(r))r="hui-"+r+"-row";else{if(!t.entity)return n("Invalid config given.",t);var o=t.entity.split(".",1)[0];r="hui-"+(dt[o]||"text")+"-entity-row"}else r="hui-"+r+"-card";if(customElements.get(r))return i(r,t);var a=n("Custom element doesn't exist: "+t.type+".",t);a.style.display="None";var s=setTimeout((function(){a.style.display=""}),2e3);return customElements.whenDefined(t.type).then((function(){clearTimeout(s),lt(a,"ll-rebuild",{},a)})),a},ht=function(t,e,n){var i;return void 0===n&&(n=!1),function(){var r=[].slice.call(arguments),o=this,a=n&&!i;clearTimeout(i),i=setTimeout((function(){i=null,n||t.apply(o,r)}),e),a&&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 n=e.value||e,i=e.attribute?t.attributes[e.attribute]:t.state;switch(e.operator||"=="){case"==":return i===n;case"<=":return i<=n;case"<":return i<n;case">=":return i>=n;case">":return i>n;case"!=":return i!==n;case"regex":return i.match(n);default:return!1}},gt=function(t){lt(window,"haptic",t)},vt=function(t,e,n){void 0===n&&(n=!1),n?history.replaceState(null,"",e):history.pushState(null,"",e),lt(window,"location-changed",{replace:n})},yt=function(t,e,n){void 0===n&&(n=!0);var i,r=j(e),o="group"===r?"homeassistant":r;switch(r){case"lock":i=n?"unlock":"lock";break;case"cover":i=n?"open_cover":"close_cover";break;default:i=n?"turn_on":"turn_off"}return t.callService(o,i,{entity_id:e})},_t=function(t,e){var n=it.includes(t.states[e].state);return yt(t,e,n)},bt=function(t,e,n,i){if(i||(i={action:"more-info"}),!i.confirmation||i.confirmation.exemptions&&i.confirmation.exemptions.some((function(t){return t.user===e.user.id}))||(gt("warning"),confirm(i.confirmation.text||"Are you sure you want to "+i.action+"?")))switch(i.action){case"more-info":(n.entity||n.camera_image)&<(t,"hass-more-info",{entityId:n.entity?n.entity:n.camera_image});break;case"navigate":i.navigation_path&&vt(0,i.navigation_path);break;case"url":i.url_path&&window.open(i.url_path);break;case"toggle":n.entity&&(_t(e,n.entity),gt("success"));break;case"call-service":if(!i.service)return void gt("failure");var r=i.service.split(".",2);e.callService(r[0],r[1],i.service_data,i.target),gt("success");break;case"fire-dom-event":lt(t,"ll-custom",i)}},wt=function(t,e,n,i){var r;"double_tap"===i&&n.double_tap_action?r=n.double_tap_action:"hold"===i&&n.hold_action?r=n.hold_action:"tap"===i&&n.tap_action&&(r=n.tap_action),bt(t,e,n,r)},$t=function(t,e,n,i,r){var o;if(r&&n.double_tap_action?o=n.double_tap_action:i&&n.hold_action?o=n.hold_action:!i&&n.tap_action&&(o=n.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||n.entity||n.camera_image)&&(lt(t,"hass-more-info",{entityId:o.entity?o.entity:n.entity?n.entity:n.camera_image}),o.haptic&>(o.haptic));break;case"navigate":o.navigation_path&&(vt(0,o.navigation_path),o.haptic&>(o.haptic));break;case"url":o.url_path&&window.open(o.url_path),o.haptic&>(o.haptic);break;case"toggle":n.entity&&(_t(e,n.entity),o.haptic&>(o.haptic));break;case"call-service":if(!o.service)return;var a=o.service.split(".",2),s=a[0],l=a[1],c=I({},o.service_data);"entity"===c.entity_id&&(c.entity_id=n.entity),e.callService(s,l,c,o.target),o.haptic&>(o.haptic);break;case"fire-dom-event":lt(t,"ll-custom",o),o.haptic&>(o.haptic)}};function Ct(t){return void 0!==t&&"none"!==t.action}function St(t,e,n){if(e.has("config")||n)return!0;if(t.config.entity){var i=e.get("hass");return!i||i.states[t.config.entity]!==t.hass.states[t.config.entity]}return!1}function Tt(t){return void 0!==t&&"none"!==t.action}var Dt=function(t,e,n){void 0===n&&(n=!0);var i={};e.forEach((function(e){if(it.includes(t.states[e].state)===n){var r=j(e),o=["cover","lock"].includes(r)?r:"homeassistant";o in i||(i[o]=[]),i[o].push(e)}})),Object.keys(i).forEach((function(e){var r;switch(e){case"lock":r=n?"unlock":"lock";break;case"cover":r=n?"open_cover":"close_cover";break;default:r=n?"turn_on":"turn_off"}t.callService(e,r,{entity_id:i[e]})}))},At=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"},Rt={binary_sensor:function(t,e){var n="off"===t;switch(null==e?void 0:e.attributes.device_class){case"battery":return n?"mdi:battery":"mdi:battery-outline";case"battery_charging":return n?"mdi:battery":"mdi:battery-charging";case"cold":return n?"mdi:thermometer":"mdi:snowflake";case"connectivity":return n?"mdi:server-network-off":"mdi:server-network";case"door":return n?"mdi:door-closed":"mdi:door-open";case"garage_door":return n?"mdi:garage":"mdi:garage-open";case"power":case"plug":return n?"mdi:power-plug-off":"mdi:power-plug";case"gas":case"problem":case"safety":case"tamper":return n?"mdi:check-circle":"mdi:alert-circle";case"smoke":return n?"mdi:check-circle":"mdi:smoke";case"heat":return n?"mdi:thermometer":"mdi:fire";case"light":return n?"mdi:brightness-5":"mdi:brightness-7";case"lock":return n?"mdi:lock":"mdi:lock-open";case"moisture":return n?"mdi:water-off":"mdi:water";case"motion":return n?"mdi:walk":"mdi:run";case"occupancy":case"presence":return n?"mdi:home-outline":"mdi:home";case"opening":return n?"mdi:square":"mdi:square-outline";case"running":return n?"mdi:stop":"mdi:play";case"sound":return n?"mdi:music-note-off":"mdi:music-note";case"update":return n?"mdi:package":"mdi:package-up";case"vibration":return n?"mdi:crop-portrait":"mdi:vibrate";case"window":return n?"mdi:window-closed":"mdi:window-open";default:return n?"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 n=Number(t.state);if(isNaN(n))return"mdi:battery-unknown";var i=10*Math.round(n/10);return i>=100?"mdi:battery":i<=0?"mdi:battery-alert":"hass:battery-"+i}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"}},Et=function(t){if(!t)return"mdi:bookmark";if(t.attributes.icon)return t.attributes.icon;var e=j(t.entity_id);return e in Rt?Rt[e](t):pt(e,t.state)}},239:function(t,e){var n=this&&this.__awaiter||function(t,e,n,i){return new(n||(n=Promise))((function(r,o){function a(t){try{l(i.next(t))}catch(t){o(t)}}function s(t){try{l(i.throw(t))}catch(t){o(t)}}function l(t){var e;t.done?r(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(a,s)}l((i=i.apply(t,e||[])).next())}))};Object.defineProperty(e,"__esModule",{value:!0}),e.ClientBase=void 0,e.ClientBase=class{GetData(t,e,i){return n(this,void 0,void 0,(function*(){const n=localStorage.getItem(t);if(n&&e){const t=JSON.parse(n),e=new Date;if(e.setHours(e.getHours()-i),new Date(t.created)>e)return JSON.parse(t.data)}const r=yield fetch(`${this.baseUrl}/${t}`,{headers:{Accept:"application/json"}});if(!r||!r.ok)return Promise.reject(r);const o=yield r.json(),a={data:JSON.stringify(o),created:new Date};return e&&localStorage.setItem(t,JSON.stringify(a)),o}))}}},171:function(t,e,n){var i=this&&this.__awaiter||function(t,e,n,i){return new(n||(n=Promise))((function(r,o){function a(t){try{l(i.next(t))}catch(t){o(t)}}function s(t){try{l(i.throw(t))}catch(t){o(t)}}function l(t){var e;t.done?r(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(a,s)}l((i=i.apply(t,e||[])).next())}))};Object.defineProperty(e,"__esModule",{value:!0});const r=n(8593),o=n(239);class a extends o.ClientBase{constructor(){super(...arguments),this.baseUrl="https://ergast.com/api/f1"}GetSchedule(t){return i(this,void 0,void 0,(function*(){return(yield this.GetData(`${t}.json`,!0,72)).MRData.RaceTable.Races}))}GetLastResult(){return i(this,void 0,void 0,(function*(){const t=(0,r.getRefreshTime)("current/last/results.json");return(yield this.GetData("current/last/results.json",!0,t)).MRData.RaceTable.Races[0]}))}GetDriverStandings(){return i(this,void 0,void 0,(function*(){const t=(0,r.getRefreshTime)("current/driverStandings.json");return(yield this.GetData("current/driverStandings.json",!0,t)).MRData.StandingsTable.StandingsLists[0].DriverStandings}))}GetConstructorStandings(){return i(this,void 0,void 0,(function*(){const t=(0,r.getRefreshTime)("current/constructorStandings.json");return(yield this.GetData("current/constructorStandings.json",!0,t)).MRData.StandingsTable.StandingsLists[0].ConstructorStandings}))}GetSprintResults(t,e){return i(this,void 0,void 0,(function*(){return(yield this.GetData(`${t}/${e}/sprint.json`,!1,0)).MRData.RaceTable}))}GetQualifyingResults(t,e){return i(this,void 0,void 0,(function*(){return(yield this.GetData(`${t}/${e}/qualifying.json`,!1,0)).MRData.RaceTable}))}GetResults(t,e){return i(this,void 0,void 0,(function*(){return(yield this.GetData(`${t}/${e}/results.json`,!1,0)).MRData.RaceTable}))}GetSeasons(){return i(this,void 0,void 0,(function*(){return(yield this.GetData("seasons.json?limit=200",!0,72)).MRData.SeasonTable.Seasons}))}GetSeasonRaces(t){return i(this,void 0,void 0,(function*(){return(yield this.GetData(`${t}.json`,!0,72)).MRData.RaceTable.Races}))}GetLastYearsResults(t){return i(this,void 0,void 0,(function*(){const e=(new Date).getFullYear()-1,n=(yield this.GetData(`${e}.json`,!0,72)).MRData.RaceTable.Races.findIndex((e=>e.Circuit.circuitName===t))+1;return(yield this.GetData(`${e}/${n}/results.json`,!1,0)).MRData.RaceTable.Races[0]}))}}e.default=a},4099:(t,e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.default=class{GetImage(t){const e=localStorage.getItem(t);if(e){const t=JSON.parse(e),n=new Date;if(n.setHours(n.getHours()-672),new Date(t.created)>n)return t.data}return fetch(t).then((t=>t.blob())).then((e=>{const n=new FileReader;n.readAsDataURL(e),n.onloadend=function(){const e={data:n.result,created:new Date};return localStorage.setItem(t,JSON.stringify(e)),e.data}})),t}}},2930:function(t,e,n){var i=this&&this.__awaiter||function(t,e,n,i){return new(n||(n=Promise))((function(r,o){function a(t){try{l(i.next(t))}catch(t){o(t)}}function s(t){try{l(i.throw(t))}catch(t){o(t)}}function l(t){var e;t.done?r(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(a,s)}l((i=i.apply(t,e||[])).next())}))};Object.defineProperty(e,"__esModule",{value:!0});const r=n(239);class o extends r.ClientBase{constructor(){super(...arguments),this.baseUrl="https://restcountries.com/v2"}GetAll(){return i(this,void 0,void 0,(function*(){return yield this.GetData("all",!0,730)}))}GetCountriesFromLocalStorage(){const t=localStorage.getItem("all");if(t){const e=JSON.parse(t);return JSON.parse(e.data)}return[]}}e.default=o},4820:function(t,e,n){var i=this&&this.__awaiter||function(t,e,n,i){return new(n||(n=Promise))((function(r,o){function a(t){try{l(i.next(t))}catch(t){o(t)}}function s(t){try{l(i.throw(t))}catch(t){o(t)}}function l(t){var e;t.done?r(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(a,s)}l((i=i.apply(t,e||[])).next())}))};Object.defineProperty(e,"__esModule",{value:!0});const r=n(239);class o extends r.ClientBase{constructor(t,e){super(),this.unitGroup="metric",this.baseUrl="https://weather.visualcrossing.com/VisualCrossingWebServices/rest/services/timeline",this.apiKey=t,this.unitGroup=null!=e?e:this.unitGroup}getWeatherData(t,e,n){return i(this,void 0,void 0,(function*(){const i=`${t},${e}/${n}?unitGroup=${this.unitGroup}&key=${this.apiKey}&contentType=json`;return yield this.GetData(i,!0,1)}))}}e.default=o},5243:(t,e,n)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.BaseCard=void 0;const i=n(171),r=n(4099),o=n(4820);e.BaseCard=class{constructor(t){var e,n;this.config=t.config,this.client=new i.default,this.hass=t._hass,this.parent=t,this.weatherClient=new o.default(null!==(n=null===(e=this.config.weather_options)||void 0===e?void 0:e.api_key)&&void 0!==n?n:""),this.imageClient=new r.default}translation(t){return!this.config.translations||Object.keys(this.config.translations).indexOf(t)<0?this.defaultTranslations[t]:this.config.translations[t]}getProperties(){var t,e;const n=null===(t=this.parent.properties)||void 0===t?void 0:t.get("cardValues");return{races:null==n?void 0:n.races,selectedRace:null==n?void 0:n.selectedRace,selectedSeason:null==n?void 0:n.selectedSeason,selectedTabIndex:null!==(e=null==n?void 0:n.selectedTabIndex)&&void 0!==e?e:0}}getParentCardValues(){var t,e;const n=null!==(t=this.parent.properties)&&void 0!==t?t:new Map;return{properties:null!==(e=n.get("cardValues"))&&void 0!==e?e:{},cardValues:n}}}},6521:(t,e,n)=>{Object.defineProperty(e,"__esModule",{value:!0});const i=n(3692),r=n(7345),o=n(8593),a=n(5243);class s extends a.BaseCard{constructor(t){super(t),this.defaultTranslations={constructor:"Constructor",points:"Pts",wins:"Wins"}}cardSize(){return 11}renderStandingRow(t){var e;return i.html`
<tr>
<td class="width-50 text-center">${t.position}</td>
<td>${(null===(e=this.config.standings)||void 0===e?void 0:e.show_teamlogo)?i.html`<img class="constructor-logo" height="20" width="20" src="${(0,o.getTeamImage)(this,t.Constructor.constructorId)}"> `:""}${t.Constructor.name}</td>
<td class="width-60 text-center">${t.points}</td>
<td class="text-center">${t.wins}</td>
</tr>`}render(){return i.html`${(0,r.until)(this.client.GetConstructorStandings().then((t=>i.html`
<table>
<thead>
<tr>
<th class="width-50"> </th>
<th>${this.translation("constructor")}</th>
<th class="width-60 text-center">${this.translation("points")}</th>
<th class="text-center">${this.translation("wins")}</th>
</tr>
</thead>
<tbody>
${(0,o.reduceArray)(t,this.config.row_limit).map((t=>this.renderStandingRow(t)))}
</tbody>
</table>
`)).catch((()=>i.html`${(0,o.getApiErrorMessage)("standings")}`)),i.html`${(0,o.getApiLoadingMessage)()}`)}`}}e.default=s},2765:function(t,e,n){var i=this&&this.__await||function(t){return this instanceof i?(this.v=t,this):new i(t)},r=this&&this.__asyncGenerator||function(t,e,n){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var r,o=n.apply(t,e||[]),a=[];return r={},s("next"),s("throw"),s("return"),r[Symbol.asyncIterator]=function(){return this},r;function s(t){o[t]&&(r[t]=function(e){return new Promise((function(n,i){a.push([t,e,n,i])>1||l(t,e)}))})}function l(t,e){try{(n=o[t](e)).value instanceof i?Promise.resolve(n.value.v).then(c,d):u(a[0][2],n)}catch(t){u(a[0][3],t)}var n}function c(t){l("next",t)}function d(t){l("throw",t)}function u(t,e){t(e),a.shift(),a.length&&l(a[0][0],a[0][1])}};Object.defineProperty(e,"__esModule",{value:!0});const o=n(3692),a=n(7345),s=n(8593),l=n(5243),c=n(530),d=n(6197),u=n(8342),h=n(9098);class m extends l.BaseCard{constructor(t){var e;super(t),this.defaultTranslations={days:"d",hours:"h",minutes:"m",seconds:"s",endofseason:"Season is over. See you next year!",racenow:"We are racing!",date:"Date",practice1:"Practice 1",practice2:"Practice 2",practice3:"Practice 3",race:"Race",racename:"Race name",circuitname:"Circuit name",location:"Location",city:"City",racetime:"Race",sprint:"Sprint",qualifying:"Qualifying",until:"Until"},this.config.countdown_type=null!==(e=this.config.countdown_type)&&void 0!==e?e:h.CountdownType.Race}cardSize(){return this.config.show_raceinfo?12:6}renderHeader(t,e){return this.config.show_raceinfo?o.html`<table><tr><td colspan="5">${(0,s.renderHeader)(this,t,!0)}</td></tr>
${(0,s.renderRaceInfo)(this,t,e)}</table>`:null}countDownTillDate(t){return r(this,arguments,(function*(){for(;t>new Date;){const e=(new Date).getTime(),n=t.getTime()-e,r=Math.floor(n/864e5),o=Math.floor(n%864e5/36e5),a=Math.floor(n%36e5/6e4),s=Math.floor(n%6e4/1e3);yield yield i(`${r}${this.translation("days")} ${o}${this.translation("hours")} ${a}${this.translation("minutes")} ${s}${this.translation("seconds")} `),yield i(new Promise((t=>setTimeout(t,1e3))))}yield yield i(this.translation("racenow"))}))}render(){const t=t=>{this.hass&&this.config.actions&&t.detail.action&&(0,s.clickHandler)(this.parent,this.config,this.hass,t)};return o.html`${(0,a.until)(this.client.GetSchedule((new Date).getFullYear()).then((e=>{var n,i;const{nextRace:r,raceDateTime:a,countdownType:l}=this.getNextEvent(e);if(!r)return(0,s.getEndOfSeasonMessage)(this.translation("endofseason"));const h=this.countDownTillDate(a),m=void 0!==this.config.actions;return o.html`<table @action=${t}
.actionHandler=${(0,u.actionHandler)({hasHold:(0,d.hasAction)(null===(n=this.config.actions)||void 0===n?void 0:n.hold_action),hasDoubleClick:(0,d.hasAction)(null===(i=this.config.actions)||void 0===i?void 0:i.double_tap_action)})} class="${m?"clickable":null}">
<tr>
<td>
<h2 class="${this.config.f1_font?"formulaone-font":""}"><img height="25" src="${(0,s.getCountryFlagByName)(this,r.Circuit.Location.country)}"> ${r.round} : ${r.raceName}</h2>
</td>
</tr>
<tr>
<td class="text-center">
<h1 class="${this.config.f1_font?"formulaone-font":""}">${(0,c.asyncReplace)(h)}</h1>
</td>
</tr>
${Array.isArray(this.config.countdown_type)&&this.config.countdown_type.length>1?o.html`<tr>
<td class="text-center">
<h1 class="${this.config.f1_font?"formulaone-font":""}">${this.translation("until")} ${this.translation(l.toLowerCase())}</h1>
</td>
</tr>`:null}
</table>
${this.renderHeader(r,a)}`})).catch((()=>o.html`${(0,s.getApiErrorMessage)("next race")}`)),o.html`${(0,s.getApiLoadingMessage)()}`)}`}getNextEvent(t){var e;const n=t.filter((t=>{const e=new Date(t.date+"T"+t.time);return e.setHours(e.getHours()+3),e>=new Date}))[0];let i=null,r=this.config.countdown_type;if(n){const t=this.config.countdown_type,o=[{Date:new Date(n.FirstPractice.date+"T"+n.FirstPractice.time),Type:h.CountdownType.Practice1},{Date:new Date(n.SecondPractice.date+"T"+n.SecondPractice.time),Type:h.CountdownType.Practice2},{Date:n.ThirdPractice?new Date(n.ThirdPractice.date+"T"+n.ThirdPractice.time):null,Type:h.CountdownType.Practice3},{Date:n.Sprint?new Date(n.Sprint.date+"T"+n.Sprint.time):null,Type:h.CountdownType.Sprint},{Date:new Date(n.Qualifying.date+"T"+n.Qualifying.time),Type:h.CountdownType.Qualifying},{Date:new Date(n.date+"T"+n.time),Type:h.CountdownType.Race}].filter((t=>t.Date)).filter((t=>t.Date>new Date)).sort(((t,e)=>t.Date.getTime()-e.Date.getTime())).filter((e=>null==t?void 0:t.includes(e.Type)))[0];i=null==o?void 0:o.Date,r=null!==(e=null==o?void 0:o.Type)&&void 0!==e?e:r}return{nextRace:n,raceDateTime:i,countdownType:r}}}e.default=m},9412:(t,e,n)=>{Object.defineProperty(e,"__esModule",{value:!0});const i=n(3692),r=n(7345),o=n(8593),a=n(5243);class s extends a.BaseCard{constructor(t){super(t),this.defaultTranslations={driver:"Driver",team:"Team",points:"Pts",wins:"Wins"}}cardSize(){return 12}renderStandingRow(t){var e,n;return i.html`
<tr>
<td class="width-40 text-center">${t.position}</td>
<td>${(null===(e=this.config.standings)||void 0===e?void 0:e.show_flag)?i.html`<img height="10" width="20" src="${(0,o.getCountryFlagByNationality)(this,t.Driver.nationality)}"> `:""}${t.Driver.code}</td>
<td>${(0,o.getDriverName)(t.Driver,this.config)}</td>
${(null===(n=this.config.standings)||void 0===n?void 0:n.show_team)?i.html`${(0,o.renderConstructorColumn)(this,t.Constructors[0])}`:""}
<td class="width-60 text-center">${t.points}</td>
<td class="text-center">${t.wins}</td>
</tr>`}render(){return i.html`${(0,r.until)(this.client.GetDriverStandings().then((t=>{var e;return i.html`
<table>
<thead>
<tr>
<th class="width-50" colspan="2"> </th>
<th>${this.translation("driver")}</th>
${(null===(e=this.config.standings)||void 0===e?void 0:e.show_team)?i.html`<th>${this.translation("team")}</th>`:""}
<th class="width-60 text-center">${this.translation("points")}</th>
<th class="text-center">${this.translation("wins")}</th>
</tr>
</thead>
<tbody>
${(0,o.reduceArray)(t,this.config.row_limit).map((t=>this.renderStandingRow(t)))}
</tbody>
</table>
`})).catch((()=>i.html`${(0,o.getApiErrorMessage)("standings")}`)),i.html`${(0,o.getApiLoadingMessage)()}`)}`}}e.default=s},1958:(t,e,n)=>{Object.defineProperty(e,"__esModule",{value:!0});const i=n(3692),r=n(7345),o=n(8593),a=n(5243);class s extends a.BaseCard{constructor(t){super(t),this.defaultTranslations={driver:"Driver",grid:"Grid",points:"Points",status:"Status"}}cardSize(){return 11}renderResultRow(t){return i.html`
<tr>
<td class="width-50 text-center">${t.position}</td>
<td>${(0,o.getDriverName)(t.Driver,this.config)}</td>
<td>${t.grid}</td>
<td class="width-60 text-center">${t.points}</td>
<td class="width-50 text-center">${t.status}</td>
</tr>`}render(){return i.html`${(0,r.until)(this.client.GetLastResult().then((t=>i.html`
<table>
<tr>
<td>${(0,o.renderHeader)(this,t)}</td>
</tr>
</table>
<table>
<thead>
<tr>
<th> </th>
<th>${this.translation("driver")}</th>
<th class="text-center">${this.translation("grid")}</th>
<th class="text-center">${this.translation("points")}</th>
<th>${this.translation("status")}</th>
</tr>
</thead>
<tbody>
${(0,o.reduceArray)(t.Results,this.config.row_limit).map((t=>this.renderResultRow(t)))}
</tbody>
</table>`)).catch((()=>i.html`${(0,o.getApiErrorMessage)("last result")}`)),i.html`${(0,o.getApiLoadingMessage)()}`)}`}}e.default=s},1249:(t,e,n)=>{Object.defineProperty(e,"__esModule",{value:!0});const i=n(3692),r=n(7345),o=n(8593),a=n(5243),s=n(3247);class l extends a.BaseCard{constructor(){super(...arguments),this.defaultTranslations={date:"Date",practice1:"Practice 1",practice2:"Practice 2",practice3:"Practice 3",race:"Race",racename:"Race name",circuitname:"Circuit name",location:"Location",city:"City",racetime:"Race",sprint:"Sprint",qualifying:"Qualifying",endofseason:"Season is over. See you next year!"}}cardSize(){return 8}render(){return i.html`${(0,r.until)(this.client.GetSchedule((new Date).getFullYear()).then((t=>{const e=this.config.next_race_delay||0,n=t.filter((t=>{const n=new Date(t.date+"T"+t.time);return n.setHours(n.getHours()+e),n>=new Date}))[0];return n?i.html`<table>
<tbody>
<tr>
<td colspan="5">${(0,o.renderHeader)(this,n)}</td>
</tr>
${this.config.show_raceinfo?(0,o.renderRaceInfo)(this,n):this.config.only_show_date?i.html`<tr>
<td class="text-center">
<h1 class="${this.config.f1_font?"formulaone-font":""}">${(0,s.formatDateNumeric)(new Date(n.date+"T"+n.time),this.hass.locale,this.config.date_locale)}</h1>
</td>
</tr>`:null}
</tbody>
</table>`:(0,o.getEndOfSeasonMessage)(this.translation("endofseason"))})).catch((()=>i.html`${(0,o.getApiErrorMessage)("next race")}`)),i.html`${(0,o.getApiLoadingMessage)()}`)}`}}e.default=l},5903:(t,e,n)=>{Object.defineProperty(e,"__esModule",{value:!0});const i=n(3692),r=n(7345),o=n(8593),a=n(5243);class s extends a.BaseCard{constructor(t){super(t),this.defaultTranslations={driver:"Driver",grid:"Grid",team:"Team",points:"Points",status:"Status",raceheader:"Race",seasonheader:"Season",selectseason:"Select season",selectrace:"Select race",noresults:"Please select a race thats already been run.",q1:"Q1",q2:"Q2",q3:"Q3"},this.icons={sprint:"mdi:flag-checkered",qualifying:"mdi:timer-outline",results:"mdi:trophy"},this.renderTabsHtml=(t,e,n)=>n?i.html`<table>
<tr><td colspan="2">${this.renderHeader(n)}</td></tr>
${t.filter((t=>t.content)).length>0?i.html`<tr class="transparent">
<td colspan="2">
<mwc-tab-bar
@MDCTabBar:activated=${t=>this.setSelectedTabIndex(t.detail.index)}
>
${t.filter((t=>!t.hide)).map((t=>i.html`
<mwc-tab
?hasImageIcon=${t.icon}
><ha-icon
slot="icon"
icon="${t.icon}"
></ha-icon>
</mwc-tab>
`))}
</mwc-tab-bar>
<section>
<article>
${t.filter((t=>!t.hide)).find(((t,n)=>n==e)).content}
</article>
</section>
</td>
</tr>`:i.html`<tr><td colspan="2">${this.translation("noresults")}</td></tr>`}
</table>`:i.html``}cardSize(){return 12}renderTabs(t){return[{title:"Results",icon:this.icon("results"),content:this.renderResults(t),order:this.tabOrder("results")},{title:"Qualifying",icon:this.icon("qualifying"),content:this.renderQualifying(t),order:this.tabOrder("qualifying")},{title:"Sprint",icon:this.icon("sprint"),content:this.renderSprint(t),hide:!(null==t?void 0:t.SprintResults),order:this.tabOrder("sprint")}].sort(((t,e)=>t.order-e.order))}renderSprint(t){var e;return(null==t?void 0:t.SprintResults)?i.html`<table class="nopadding">
<thead>
<tr>
<th> </th>
<th>${this.translation("driver")}</th>
${(null===(e=this.config.standings)||void 0===e?void 0:e.show_team)?i.html`<th>${this.translation("team")}</th>`:""}
<th class="text-center">${this.translation("grid")}</th>
<th class="text-center">${this.translation("points")}</th>
<th class="text-center">${this.translation("status")}</th>
</tr>
</thead>
<tbody>
${(0,o.reduceArray)(t.SprintResults,this.config.row_limit).map((t=>this.renderResultRow(t,!1)))}
</tbody>
</table>`:null}renderQualifying(t){var e;return(null==t?void 0:t.QualifyingResults)?i.html`<table class="nopadding">
<thead>
<tr>
<th> </th>
<th>${this.translation("driver")}</th>
${(null===(e=this.config.standings)||void 0===e?void 0:e.show_team)?i.html`<th>${this.translation("team")}</th>`:""}
<th class="text-center">${this.translation("q1")}</th>
<th class="text-center">${this.translation("q2")}</th>
<th class="text-center">${this.translation("q3")}</th>
</tr>
</thead>
<tbody>
${(0,o.reduceArray)(t.QualifyingResults,this.config.row_limit).map((t=>this.renderQualifyingResultRow(t)))}
</tbody>
</table>`:null}renderResults(t){var e,n;const r=null===(e=null==t?void 0:t.Results)||void 0===e?void 0:e.filter((t=>{var e;return"1"===(null===(e=t.FastestLap)||void 0===e?void 0:e.rank)}))[0];return(null==t?void 0:t.Results)?i.html`<table class="nopadding">
<thead>
<tr>
<th> </th>
<th>${this.translation("driver")}</th>
${(null===(n=this.config.standings)||void 0===n?void 0:n.show_team)?i.html`<th>${this.translation("team")}</th>`:""}
<th class="text-center">${this.translation("grid")}</th>
<th class="text-center">${this.translation("points")}</th>
<th>${this.translation("status")}</th>
</tr>
</thead>
<tbody>
${(0,o.reduceArray)(t.Results,this.config.row_limit).map((t=>this.renderResultRow(t,t.position===(null==r?void 0:r.position))))}
</tbody>
${r?i.html`<tfoot>
<tfoot>
<tr>
<td colspan="6" class="text-right"><small>* Fastest lap: ${r.FastestLap.Time.time}</small></td>
</tfoot>`:""}
</table>`:null}renderResultRow(t,e){var n,r;return i.html`
<tr>
<td class="width-50 text-center">${t.position}</td>
<td>${(null===(n=this.config.standings)||void 0===n?void 0:n.show_flag)?i.html`<img height="10" width="20" src="${(0,o.getCountryFlagByNationality)(this,t.Driver.nationality)}"> `:""}${(0,o.getDriverName)(t.Driver,this.config)}${e?" *":""}</td>
${(null===(r=this.config.standings)||void 0===r?void 0:r.show_team)?i.html`${(0,o.renderConstructorColumn)(this,t.Constructor)}`:""}
<td>${t.grid}</td>
<td class="width-60 text-center">${t.points}</td>
<td class="width-50 text-center">${t.status}</td>
</tr>`}renderQualifyingResultRow(t){var e,n;return i.html`
<tr>
<td class="width-50 text-center">${t.position}</td>
<td>${(null===(e=this.config.standings)||void 0===e?void 0:e.show_flag)?i.html`<img height="10" width="20" src="${(0,o.getCountryFlagByNationality)(this,t.Driver.nationality)}"> `:""}${(0,o.getDriverName)(t.Driver,this.config)}</td>
${(null===(n=this.config.standings)||void 0===n?void 0:n.show_team)?i.html`${(0,o.renderConstructorColumn)(this,t.Constructor)}`:""}
<td>${t.Q1}</td>
<td>${t.Q2}</td>
<td>${t.Q3}</td>
</tr>`}renderHeader(t){return null==t||parseInt(t.season)<2018?null:(0,o.renderHeader)(this,t)}render(){const{races:t,selectedRace:e,selectedSeason:n,selectedTabIndex:a}=this.getProperties();void 0===n&&this.getLastResult();const s=t=>{this.setRaces(t)},l=this.renderTabs(e);return i.html`
<table>
<tr>
<td>
${this.translation("seasonheader")}<br />
${(0,r.until)(this.client.GetSeasons().then((t=>{const e=t.reverse();return i.html`<select name="selectedSeason" @change="${s}">
<option value="0">${this.translation("selectseason")}</option>
${e.map((t=>i.html`<option value="${t.season}" ?selected=${n===t.season}>${t.season}</option>`))}
</select>`})).catch((()=>i.html`${(0,o.getApiErrorMessage)("seasons")}`)),i.html`${(0,o.getApiLoadingMessage)()}`)}
</td>
<td>
${this.translation("raceheader")}<br />
<select name="selectedRace" @change="${t=>{this.setSelectedRace(t)}}">
<option value="0" ?selected=${void 0===e}>${this.translation("selectrace")}</option>
${null==t?void 0:t.map((t=>i.html`<option value="${t.round}" ?selected=${(null==e?void 0:e.round)==t.round}>${t.raceName}</option>`))}
</select>
</td>
</tr>
</table>
${this.renderTabsHtml(l,a,e)}`}setSelectedRace(t){const e=parseInt(t.target.value),{properties:n,cardValues:i}=this.getParentCardValues();n.selectedRound=e;const r=n.selectedSeason;Promise.all([this.client.GetResults(r,e),this.client.GetQualifyingResults(r,e),this.client.GetSprintResults(r,e),this.client.GetSchedule(r)]).then((([t,r,o,a])=>{var s;let l=t.Races[0];l?(l.QualifyingResults=r.Races[0].QualifyingResults,l.SprintResults=null===(s=null==o?void 0:o.Races[0])||void 0===s?void 0:s.SprintResults,n.selectedSeason=l.season):l=a.filter((t=>parseInt(t.round)==e))[0],n.selectedRace=l,i.set("cardValues",n),this.parent.properties=i}))}setRaces(t){const e=t.target.value,{properties:n,cardValues:i}=this.getParentCardValues();this.client.GetSeasonRaces(parseInt(e)).then((t=>{n.selectedSeason=e,n.selectedRace=void 0,n.races=t,i.set("cardValues",n),this.parent.properties=i}))}getUpcomingRace(t,e){const n=e.filter((e=>{const n=new Date(e.date+"T"+e.time),i=new Date(e.Qualifying.date+"T"+e.Qualifying.time),r=e.Sprint?new Date(e.Sprint.date+"T"+e.Sprint.time):null;return n>=t&&i<t&&(null===r||r<t)}));return n.length>0?n[0]:null}getLastResult(){const t=new Date;Promise.all([this.client.GetSchedule(t.getFullYear()),this.client.GetLastResult()]).then((([e,n])=>{const i=this.getUpcomingRace(t,e);let r=(new Date).getFullYear(),o=null!==i?parseInt(i.round):0,a={};null!==i?(a=i,o=parseInt(a.round),r=parseInt(a.season)):(a=n,o=parseInt(n.round),r=parseInt(n.season)),Promise.all([this.client.GetQualifyingResults(r,o),this.client.GetSprintResults(r,o),this.client.GetSeasonRaces(r)]).then((([t,e,n])=>{var i;const{properties:o,cardValues:s}=this.getParentCardValues();a.QualifyingResults=t.Races[0].QualifyingResults,a.SprintResults=null===(i=e.Races[0])||void 0===i?void 0:i.SprintResults,o.races=n,o.selectedRace=a,o.selectedSeason=r.toString(),s.set("cardValues",o),this.parent.properties=s}))}))}setSelectedTabIndex(t){const{properties:e,cardValues:n}=this.getParentCardValues();e.selectedTabIndex=t,n.set("cardValues",e),this.parent.properties=n}icon(t){return!this.config.icons||Object.keys(this.config.icons).indexOf(t)<0?this.icons[t]:this.config.icons[t]}tabOrder(t){var e,n;const i=null!==(n=null===(e=this.config.tabs_order)||void 0===e?void 0:e.map((t=>t.toLowerCase())))&&void 0!==n?n:["results","qualifying","sprint"];return i.indexOf(t)}}e.default=s},6496:(t,e,n)=>{Object.defineProperty(e,"__esModule",{value:!0});const i=n(6197),r=n(3692),o=n(7345),a=n(3247),s=n(9098),l=n(8593),c=n(5243);class d extends c.BaseCard{constructor(t){super(t),this.defaultTranslations={date:"Date",race:"Race",time:"Time",location:"Location",endofseason:"Season is over. See you next year!"}}cardSize(){return 12}renderLocation(t){var e;const n=r.html`${(null===(e=this.config.standings)||void 0===e?void 0:e.show_flag)?r.html`<img height="10" width="20" src="${(0,l.getCountryFlagByName)(this,t.Location.country)}"> `:""}${t.Location.locality}, ${t.Location.country}`;return this.config.location_clickable?r.html`<a href="${t.url}" target="_blank">${n}</a>`:n}renderScheduleRow(t){const e=new Date(t.date+"T"+t.time),n=this.config.previous_race&&e<new Date?this.config.previous_race:"";return r.html`
<tr class="${n}">
<td class="width-50 text-center">${t.round}</td>
<td>${t.Circuit.circuitName}</td>
<td>${this.renderLocation(t.Circuit)}</td>
<td class="width-60 text-center">${(0,a.formatDate)(e,this.hass.locale,this.config.date_locale)}</td>
<td class="width-50 text-center">${(0,i.formatTime)(e,this.hass.locale)}</td>
</tr>`}render(){return r.html`${(0,o.until)(this.client.GetSchedule((new Date).getFullYear()).then((t=>{const e=this.config.previous_race===s.PreviousRaceDisplay.Hide?t.filter((t=>new Date(t.date+"T"+t.time)>=new Date)):t;return e.filter((t=>new Date(t.date+"T"+t.time)>=new Date))[0]?r.html`<table>
<thead>
<tr>
<th> </th>
<th>${this.translation("race")}</th>
<th>${this.translation("location")}</th>
<th class="text-center">${this.translation("date")}</th>
<th class="text-center">${this.translation("time")}</th>
</tr>
</thead>
<tbody>
${(0,l.reduceArray)(e,this.config.row_limit).map((t=>this.renderScheduleRow(t)))}
</tbody>
</table>`:(0,l.getEndOfSeasonMessage)(this.translation("endofseason"))})).catch((()=>r.html`${(0,l.getApiErrorMessage)("schedule")}`)),r.html`${(0,l.getApiLoadingMessage)()}`)}`}}e.default=d},4312:(t,e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.CARD_EDITOR_NAME=e.CARD_NAME=void 0,e.CARD_NAME="formulaone-card",e.CARD_EDITOR_NAME=`${e.CARD_NAME}-editor`},8342:(t,e,n)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.actionHandler=e.actionHandlerBind=void 0;const i=n(6370),r=n(8082),o=n(6197),a="ontouchstart"in window||navigator.maxTouchPoints>0||navigator.maxTouchPoints>0;class s extends HTMLElement{constructor(){super(),this.holdTime=500,this.held=!1,this.ripple=document.createElement("mwc-ripple")}connectedCallback(){Object.assign(this.style,{position:"absolute",width:a?"100px":"50px",height:a?"100px":"50px",transform:"translate(-50%, -50%)",pointerEvents:"none",zIndex:"999"}),this.appendChild(this.ripple),this.ripple.primary=!0,["touchcancel","mouseout","mouseup","touchmove","mousewheel","wheel","scroll"].forEach((t=>{document.addEventListener(t,(()=>{clearTimeout(this.timer),this.stopAnimation(),this.timer=void 0}),{passive:!0})}))}bind(t,e){if(t.actionHandler)return;t.actionHandler=!0,t.addEventListener("contextmenu",(t=>{const e=t||window.event;return e.preventDefault&&e.preventDefault(),e.stopPropagation&&e.stopPropagation(),e.cancelBubble=!0,e.returnValue=!1,!1}));const n=t=>{let e,n;this.held=!1,t.touches?(e=t.touches[0].pageX,n=t.touches[0].pageY):(e=t.pageX,n=t.pageY),this.timer=window.setTimeout((()=>{this.startAnimation(e,n),this.held=!0}),this.holdTime)},i=n=>{n.preventDefault(),["touchend","touchcancel"].includes(n.type)&&void 0===this.timer||(clearTimeout(this.timer),this.stopAnimation(),this.timer=void 0,this.held?(0,o.fireEvent)(t,"action",{action:"hold"}):e.hasDoubleClick?"click"===n.type&&n.detail<2||!this.dblClickTimeout?this.dblClickTimeout=window.setTimeout((()=>{this.dblClickTimeout=void 0,(0,o.fireEvent)(t,"action",{action:"tap"})}),250):(clearTimeout(this.dblClickTimeout),this.dblClickTimeout=void 0,(0,o.fireEvent)(t,"action",{action:"double_tap"})):(0,o.fireEvent)(t,"action",{action:"tap"}))};t.addEventListener("touchstart",n,{passive:!0}),t.addEventListener("touchend",i),t.addEventListener("touchcancel",i),t.addEventListener("mousedown",n,{passive:!0}),t.addEventListener("click",i),t.addEventListener("keyup",(t=>{13===t.keyCode&&i(t)}))}startAnimation(t,e){Object.assign(this.style,{left:`${t}px`,top:`${e}px`,display:null}),this.ripple.disabled=!1,this.ripple.active=!0,this.ripple.unbounded=!0}stopAnimation(){this.ripple.active=!1,this.ripple.disabled=!0,this.style.display="none"}}customElements.define("action-handler-formulaonecard",s),e.actionHandlerBind=(t,e)=>{const n=(()=>{const t=document.body;if(t.querySelector("action-handler-formulaonecard"))return t.querySelector("action-handler-formulaonecard");const e=document.createElement("action-handler-formulaonecard");return t.appendChild(e),e})();n&&n.bind(t,e)},e.actionHandler=(0,r.directive)(class extends r.Directive{update(t,[n]){return(0,e.actionHandlerBind)(t.element,n),i.noChange}render(t){}})},1384:function(t,e,n){var i=this&&this.__decorate||function(t,e,n,i){var r,o=arguments.length,a=o<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,n,i);else for(var s=t.length-1;s>=0;s--)(r=t[s])&&(a=(o<3?r(a):o>3?r(e,n,a):r(e,n))||a);return o>3&&a&&Object.defineProperty(e,n,a),a};Object.defineProperty(e,"__esModule",{value:!0}),e.FormulaOneCardEditor=void 0;const r=n(6370),o=n(3692),a=n(9662),s=n(4312),l=n(9098),c=n(8455),d=n(7399),u=n(9049);let h=class extends c.default{render(){return this._hass&&this._config?this.renderForm([{controls:[{label:"Card Type (Required)",configValue:"card_type",type:d.FormControlType.Dropdown,items:(0,u.getDropdownOptionsFromEnum)(l.FormulaOneCardType)}]},{controls:[{label:"Title",configValue:"title",type:d.FormControlType.Textbox}]},{label:"Basic configuration",cssClass:"side-by-side",controls:[{label:"Use F1 font",configValue:"f1_font",type:d.FormControlType.Switch},{label:"Image clickable",configValue:"image_clickable",type:d.FormControlType.Switch},{label:"Show carnumber",configValue:"show_carnumber",type:d.FormControlType.Switch},{label:"Location clickable",configValue:"location_clickable",type:d.FormControlType.Switch},{label:"Show race information",configValue:"show_raceinfo",type:d.FormControlType.Switch},{label:"Hide track layout",configValue:"hide_tracklayout",type:d.FormControlType.Switch},{label:"Hide race dates and times",configValue:"hide_racedatetimes",type:d.FormControlType.Switch},{label:"Show last years result",configValue:"show_lastyears_result",type:d.FormControlType.Switch},{label:"Only show date",configValue:"only_show_date",type:d.FormControlType.Switch},{type:d.FormControlType.Filler},{label:"Row limit",configValue:"row_limit",type:d.FormControlType.Textbox},{label:"Date locale",configValue:"date_locale",type:d.FormControlType.Textbox}]},{label:"Countdown Type",hidden:this._config.card_type!==l.FormulaOneCardType.Countdown,cssClass:"side-by-side",controls:[{configValue:"countdown_type",type:d.FormControlType.Checkboxes,items:(0,u.getDropdownOptionsFromEnum)(l.CountdownType)}]},{hidden:this._config.card_type!==l.FormulaOneCardType.NextRace,controls:[{label:"Next race delay",configValue:"next_race_delay",type:d.FormControlType.Textbox}]},{hidden:this._config.card_type!==l.FormulaOneCardType.Schedule,controls:[{label:"Previous race",configValue:"previous_race",type:d.FormControlType.Dropdown,items:(0,u.getDropdownOptionsFromEnum)(l.PreviousRaceDisplay)}]},{label:"Standings",hidden:this._config.card_type!==l.FormulaOneCardType.ConstructorStandings&&this._config.card_type!==l.FormulaOneCardType.DriverStandings,cssClass:"side-by-side",controls:[{label:"Show team",configValue:"standings.show_team",type:d.FormControlType.Switch},{label:"Show flag",configValue:"standings.show_flag",type:d.FormControlType.Switch},{label:"Show teamlogo",configValue:"standings.show_teamlogo",type:d.FormControlType.Switch}]},{label:"Weather",hidden:this._config.card_type!==l.FormulaOneCardType.NextRace&&this._config.card_type!==l.FormulaOneCardType.Countdown,controls:[{label:"Show weather",configValue:"show_weather",type:d.FormControlType.Switch}]},{cssClass:"side-by-side",hidden:this._config.card_type!==l.FormulaOneCardType.NextRace&&this._config.card_type!==l.FormulaOneCardType.Countdown||!this._config.show_weather,controls:[{label:"API key",configValue:"weather_options.api_key",type:d.FormControlType.Textbox},{label:"Unit",configValue:"weather_options.unit",type:d.FormControlType.Dropdown,items:(0,u.getDropdownOptionsFromEnum)(l.WeatherUnit)},{label:"Show icon",configValue:"weather_options.show_icon",type:d.FormControlType.Switch},{label:"Show precipitation",configValue:"weather_options.show_precipitation",type:d.FormControlType.Switch},{label:"Show wind",configValue:"weather_options.show_wind",type:d.FormControlType.Switch},{label:"Show temperature",configValue:"weather_options.show_temperature",type:d.FormControlType.Switch},{label:"Show cloud coverage",configValue:"weather_options.show_cloud_cover",type:d.FormControlType.Switch},{label:"Show visibility",configValue:"weather_options.show_visibility",type:d.FormControlType.Switch}]},{label:"Tabs",hidden:this._config.card_type!==l.FormulaOneCardType.Results,controls:[{label:"Tabs order",configValue:"tabs_order",type:d.FormControlType.Textbox}]}]):o.html``}static get styles(){return r.css`
.form-row {
margin-bottom: 10px;
}
.form-control {
display: flex;
align-items: center;
}
ha-switch {
padding: 16px 6px;
}
.side-by-side {
display: flex;
flex-flow: row wrap;
}
.side-by-side > label {
width: 100%;
}
.side-by-side > .form-control {
width: 49%;
padding: 2px;
}
ha-textfield {
width: 100%;
}
.hidden {
display: none;
}
@media (max-width: 600px) {
.side-by-side > .form-control {
width: 48%;
}
}
`}};h=i([(0,a.customElement)(s.CARD_EDITOR_NAME)],h),e.FormulaOneCardEditor=h},2169:(t,e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.loadCustomFonts=void 0,e.loadCustomFonts=()=>{if(window&&document.fonts){const t=new FontFace("F1Bold","url(https://www.formula1.com/etc/designs/fom-website/fonts/F1Bold/Formula1-Bold.woff)");document.fonts.add(t),t.load()}}},3607:function(t,e,n){var i=this&&this.__decorate||function(t,e,n,i){var r,o=arguments.length,a=o<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,n,i);else for(var s=t.length-1;s>=0;s--)(r=t[s])&&(a=(o<3?r(a):o>3?r(e,n,a):r(e,n))||a);return o>3&&a&&Object.defineProperty(e,n,a),a},r=this&&this.__awaiter||function(t,e,n,i){return new(n||(n=Promise))((function(r,o){function a(t){try{l(i.next(t))}catch(t){o(t)}}function s(t){try{l(i.throw(t))}catch(t){o(t)}}function l(t){var e;t.done?r(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(a,s)}l((i=i.apply(t,e||[])).next())}))};Object.defineProperty(e,"__esModule",{value:!0});const o=n(4147),a=n(9662),s=n(9098),l=n(6370),c=n(8593),d=n(2169),u=n(4299),h=n(6521),m=n(9412),p=n(6496),f=n(1249),g=n(1958),v=n(2765),y=n(5903),_=n(2930),b=n(4312);console.info(`%c ${b.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:"formulaone-card",name:"FormulaOne card",preview:!1,description:"Present the data of Formula One in a pretty way"});let w=class extends l.LitElement{set properties(t){this._cardValues=t,this.update(t)}get properties(){return this._cardValues}constructor(){super(),this.setCountryCache()}static getConfigElement(){return r(this,void 0,void 0,(function*(){return yield Promise.resolve().then((()=>n(1384))),document.createElement(b.CARD_EDITOR_NAME)}))}setConfig(t){(0,c.checkConfig)(t),this.config=Object.assign({},t)}setCountryCache(){(new _.default).GetAll().catch((()=>{this.warning="Country API is down, so flags are not available at the moment!",this.update(this._cardValues)}))}shouldUpdate(t){return(0,c.hasConfigOrCardValuesChanged)(this,t)}set hass(t){switch(this._hass=t,this.config.hass=t,this.config.card_type){case s.FormulaOneCardType.ConstructorStandings:this.card=new h.default(this);break;case s.FormulaOneCardType.DriverStandings:this.card=new m.default(this);break;case s.FormulaOneCardType.Schedule:this.card=new p.default(this);break;case s.FormulaOneCardType.NextRace:this.card=new f.default(this);break;case s.FormulaOneCardType.LastResult:this.card=new g.default(this);break;case s.FormulaOneCardType.Countdown:this.card=new v.default(this);break;case s.FormulaOneCardType.Results:this.card=new y.default(this)}}static get styles(){return(0,d.loadCustomFonts)(),u.styles}render(){if(!this._hass||!this.config)return l.html``;try{return l.html`
<ha-card elevation="2">
${this.warning?l.html`<hui-warning>${this.warning}</hui-warning>`:""}
${this.config.title?l.html`<h1 class="card-header${this.config.f1_font?" formulaone-font":""}">${this.config.title}</h1>`:""}
${this.card.render()}
</ha-card>
`}catch(t){return l.html`<hui-warning>${t.toString()}</hui-warning>`}}getCardSize(){return this.card.cardSize()}};i([(0,a.property)()],w.prototype,"_hass",void 0),i([(0,a.property)()],w.prototype,"config",void 0),i([(0,a.property)()],w.prototype,"card",void 0),i([(0,a.property)()],w.prototype,"warning",void 0),i([(0,a.property)()],w.prototype,"properties",null),w=i([(0,a.customElement)(b.CARD_NAME)],w),e.default=w},5623:(t,e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.TimeFormat=e.NumberFormat=e.SECONDARY_INFO_VALUES=e.TIMESTAMP_FORMATS=e.ImageConstants=void 0,e.ImageConstants={FlagCDN:"https://flagcdn.com/w320/",TeamLogoCDN:"https://www.formula1.com/content/dam/fom-website/teams/",F1CDN:"https://www.formula1.com/content/dam/fom-website/2018-redesign-assets/"},e.TIMESTAMP_FORMATS=["relative","total","date","time","datetime"],e.SECONDARY_INFO_VALUES=["entity-id","last-changed","last-updated","last-triggered","position","tilt-position","brightness"],e.NumberFormat={language:"language",system:"system",comma_decimal:"comma_decimal",decimal_comma:"decimal_comma",space_comma:"space_comma",none:"none"},e.TimeFormat={language:"language",system:"system",am_pm:"12",twenty_four:"24"}},3247:(t,e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.formatDateNumeric=e.formatDate=void 0,e.formatDate=(t,e,n)=>new Intl.DateTimeFormat(null!=n?n:e.language,{month:"2-digit",day:"2-digit"}).format(t),e.formatDateNumeric=(t,e,n)=>new Intl.DateTimeFormat(null!=n?n:e.language,{year:"2-digit",month:"2-digit",day:"2-digit"}).format(t)},4347:(t,e,n)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.formatDateTimeRaceInfo=e.formatDateTime=void 0;const i=n(2269);e.formatDateTime=(t,e)=>new Intl.DateTimeFormat(e.language,{year:"numeric",month:"long",day:"numeric",hour:(0,i.useAmPm)(e)?"numeric":"2-digit",minute:"2-digit",hour12:(0,i.useAmPm)(e)}).format(t),e.formatDateTimeRaceInfo=(t,e)=>new Intl.DateTimeFormat(e.language,{weekday:"short",hour:"2-digit",minute:"2-digit",hour12:(0,i.useAmPm)(e)}).format(t)},2269:(t,e,n)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.useAmPm=void 0;const i=n(5623);e.useAmPm=t=>{if(t.time_format===i.TimeFormat.language||t.time_format===i.TimeFormat.system){const e=t.time_format===i.TimeFormat.language?t.language:void 0,n=(new Date).toLocaleString(e);return n.includes("AM")||n.includes("PM")}return t.time_format===i.TimeFormat.am_pm}},4299:(t,e,n)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.styles=void 0;const i=n(6370);e.styles=i.css`
table {
width: 100%;
border-spacing: 0;
border-collapse: separate;
padding: 0px 16px 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);
}
.constructor-logo {
width: 20px;
margin: auto;
display: block;
float: left;
background-color: white;
border-radius: 50%;
margin-right: 3px;
}
.clickable {
cursor: pointer;
}
.formulaone-font {
font-family: 'F1Bold';
}
ha-icon {
color: var(--secondary-text-color);
}
.transparent {
background-color: transparent !important;
}
.weather-info {
padding: 10px;
}
.weather-info td {
width: 33%;
}
`},9098:(t,e)=>{var n,i,r,o;Object.defineProperty(e,"__esModule",{value:!0}),e.FormulaOneCardType=e.PreviousRaceDisplay=e.CountdownType=e.WeatherUnit=void 0,(o=e.WeatherUnit||(e.WeatherUnit={})).Metric="metric",o.MilesCelsius="uk",o.MilesFahrenheit="us",(r=e.CountdownType||(e.CountdownType={})).Race="race",r.Qualifying="qualifying",r.Practice1="practice1",r.Practice2="practice2",r.Practice3="practice3",r.Sprint="sprint",(i=e.PreviousRaceDisplay||(e.PreviousRaceDisplay={})).Strikethrough="strikethrough",i.Italic="italic",i.Hide="hide",(n=e.FormulaOneCardType||(e.FormulaOneCardType={})).DriverStandings="driver_standings",n.ConstructorStandings="constructor_standings",n.NextRace="next_race",n.Schedule="schedule",n.LastResult="last_result",n.Results="results",n.Countdown="countdown"},8593:(t,e,n)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.renderConstructorColumn=e.reduceArray=e.getRefreshTime=e.calculateWindDirection=e.renderWeatherInfo=e.renderLastYearsResults=e.renderRaceInfo=e.renderHeader=e.clickHandler=e.getEndOfSeasonMessage=e.getApiLoadingMessage=e.getApiErrorMessage=e.getDriverName=e.getCircuitName=e.getTeamImage=e.checkConfig=e.getCountryFlagByName=e.getCountryFlagByNationality=e.getCountries=e.hasConfigOrCardValuesChanged=void 0;const i=n(6370),r=n(9098),o=n(4347),a=n(6197),s=n(3247),l=n(5623),c=n(8342),d=n(2930),u=n(7345);e.hasConfigOrCardValuesChanged=(t,e)=>{if(e.has("config"))return!0;const n=e.get("card");if(n&&n.parent)return n.parent.properties!==t.properties;const i=e.get("cardValues");return!!i&&i!=t.properties},e.getCountries=()=>(new d.default).GetCountriesFromLocalStorage(),e.getCountryFlagByNationality=(t,n)=>{const i=(0,e.getCountries)().filter((t=>t.demonym==n));return i.length>1?t.imageClient.GetImage(i.sort(((t,e)=>t.population>e.population?-1:1))[0].flags.png):t.imageClient.GetImage(i[0].flags.png)},e.getCountryFlagByName=(t,n)=>{const i=(0,e.getCountries)().filter((t=>{var e;return t.name==n||t.nativeName==n||(null===(e=t.altSpellings)||void 0===e?void 0:e.includes(n))}))[0];return t.imageClient.GetImage(i.flags.png)},e.checkConfig=t=>{if(void 0===t.card_type)throw new Error("Please define FormulaOne card type (card_type).")},e.getTeamImage=(t,e)=>{e=e.toLocaleLowerCase().replace("_","-");const n=[{teamName:"red-bull",corrected:"red-bull-racing"},{teamName:"alfa",corrected:"alfa-romeo"},{teamName:"haas",corrected:"haas-f1-team"}].filter((t=>t.teamName==e));return n.length>0&&(e=n[0].corrected),t.imageClient.GetImage(`${l.ImageConstants.TeamLogoCDN}/2023/${e.toLowerCase()}-logo.png.transform/2col-retina/image.png`)},e.getCircuitName=t=>{let e=t.country.replace(" ","-");const n=[{countryDashed:"UAE",name:"Abu_Dhabi"},{countryDashed:"UK",name:"Great_Britain"},{countryDashed:"Monaco",name:"Monoco"},{countryDashed:"Azerbaijan",name:"Baku"},{countryDashed:"Saudi-Arabia",name:"Saudi_Arabia"}].filter((t=>t.countryDashed==e));return n.length>0&&(e=n[0].name),"USA"==t.country&&"Austin"!=t.locality&&(e=t.locality),"Italy"==t.country&&"Imola"==t.locality&&(e="Emilia_Romagna"),e},e.getDriverName=(t,e)=>{const n="VER"==t.code?1:t.permanentNumber;return`${t.givenName} ${t.familyName}${e.show_carnumber?` #${n}`:""}`},e.getApiErrorMessage=t=>i.html`<table><tr><td class="text-center"><ha-icon icon="mdi:alert-circle"></ha-icon> Error getting ${t} <ha-icon icon="mdi:alert-circle"></ha-icon></td></tr></table>`,e.getApiLoadingMessage=()=>i.html`<table><tr><td class="text-center"><ha-icon icon="mdi:car-speed-limiter"></ha-icon> Loading... <ha-icon icon="mdi:car-speed-limiter"></ha-icon></td></tr></table>`,e.getEndOfSeasonMessage=t=>i.html`<table><tr><td class="text-center"><ha-icon icon="mdi:flag-checkered"></ha-icon><strong>${t}</strong><ha-icon icon="mdi:flag-checkered"></ha-icon></td></tr></table>`,e.clickHandler=(t,e,n,i)=>{(0,a.handleAction)(t,n,e.actions,i.detail.action)},e.renderHeader=(t,n,o=!1)=>{var s,d;const u=(0,e.getCircuitName)(n.Circuit.Location),h=t.config.image_clickable||void 0!==t.config.actions,m=n.Circuit.url;t.config.image_clickable&&!t.config.actions&&(t.config.actions={tap_action:{action:"url",url_path:m}});const p=i.html`<img width="100%" src="${t.imageClient.GetImage(`${l.ImageConstants.F1CDN}Circuit%20maps%2016x9/${u}_Circuit.png.transform/7col/image.png`)}" @action=${n=>{t.hass&&t.config.actions&&n.detail.action&&!o&&(0,e.clickHandler)(t.parent,t.config,t.hass,n)}}
.actionHandler=${(0,c.actionHandler)({hasHold:(0,a.hasAction)(null===(s=t.config.actions)||void 0===s?void 0:s.hold_action),hasDoubleClick:(0,a.hasAction)(null===(d=t.config.actions)||void 0===d?void 0:d.double_tap_action)})} class="${h?" clickable":null}" />`,f=i.html`<h2 class="${t.config.f1_font?"formulaone-font":""}"><img height="25" src="${(0,e.getCountryFlagByName)(t,n.Circuit.Location.country)}"> ${n.round} : ${n.raceName}</h2>`;return i.html`${t.config.card_type==r.FormulaOneCardType.Countdown?i.html``:f} ${t.config.hide_tracklayout?i.html``:p}<br>`},e.renderRaceInfo=(t,n,r)=>{var a;const l=t.config,c=t.hass;if(l.hide_racedatetimes)return i.html``;const d=l.show_weather&&void 0!==(null===(a=l.weather_options)||void 0===a?void 0:a.api_key)?t.weatherClient.getWeatherData(n.Circuit.Location.lat,n.Circuit.Location.long,`${n.date}T${n.time}`):Promise.resolve(null),h=l.show_lastyears_result?t.client.GetLastYearsResults(n.Circuit.circuitName):Promise.resolve(null),m=Promise.all([d,h]);return i.html`${(0,u.until)(m.then((([a,d])=>{const u=null==a?void 0:a.days[0],h=new Date(n.date+"T"+n.time),m=(0,e.renderWeatherInfo)(u,l,null!=r?r:h),p=(0,e.renderLastYearsResults)(l,d),f=(0,o.formatDateTimeRaceInfo)(new Date(n.FirstPractice.date+"T"+n.FirstPractice.time),c.locale),g=(0,o.formatDateTimeRaceInfo)(new Date(n.SecondPractice.date+"T"+n.SecondPractice.time),c.locale),v=void 0!==n.ThirdPractice?(0,o.formatDateTimeRaceInfo)(new Date(n.ThirdPractice.date+"T"+n.ThirdPractice.time),c.locale):"-",y=(0,o.formatDateTimeRaceInfo)(h,c.locale),_=(0,o.formatDateTimeRaceInfo)(new Date(n.Qualifying.date+"T"+n.Qualifying.time),c.locale),b=void 0!==n.Sprint?(0,o.formatDateTimeRaceInfo)(new Date(n.Sprint.date+"T"+n.Sprint.time),c.locale):"-";return i.html`${p}${m}<tr><td>${t.translation("date")}</td><td>${(0,s.formatDateNumeric)(h,c.locale,l.date_locale)}</td><td> </td><td>${t.translation("practice1")}</td><td align="right">${f}</td></tr>
<tr><td>${t.translation("race")}</td><td>${n.round}</td><td> </td><td>${t.translation("practice2")}</td><td align="right">${g}</td></tr>
<tr><td>${t.translation("racename")}</td><td>${n.raceName}</td><td> </td><td>${t.translation("practice3")}</td><td align="right">${v}</td></tr>
<tr><td>${t.translation("circuitname")}</td><td>${n.Circuit.circuitName}</td><td> </td><td>${t.translation("qualifying")}</td><td align="right">${_}</td></tr>
<tr><td>${t.translation("location")}</td><td>${n.Circuit.Location.country}</td><td> </td><td>${t.translation("sprint")}</td><td align="right">${b}</td></tr>
<tr><td>${t.translation("city")}</td><td>${n.Circuit.Location.locality}</td><td> </td><td>${t.translation("racetime")}</td><td align="right">${y}</td></tr>`})))}`},e.renderLastYearsResults=(t,e)=>{var n,r;if(!e)return i.html``;const o=e.Results?e.Results[0]:null,a=null===(n=e.Results)||void 0===n?void 0:n.filter((t=>{var e;return"1"===(null===(e=t.FastestLap)||void 0===e?void 0:e.rank)}))[0];return i.html`<tr>
<td colspan="5">
<table class="weather-info">
<tr>
<td class="text-center">
<h1 class="${t.f1_font?"formulaone-font":""}">${new Date(e.date).getFullYear()}</h1>
<h2 class="${t.f1_font?"formulaone-font":""}">
<ha-icon slot="icon" icon="mdi:trophy-outline"></ha-icon> ${null==o?void 0:o.Driver.givenName} ${null==o?void 0:o.Driver.familyName} (${null==o?void 0:o.Constructor.name})
</h2>
<h3 class="${t.f1_font?"formulaone-font":""}">
<ha-icon slot="icon" icon="mdi:timer-outline"></ha-icon> ${null==a?void 0:a.Driver.givenName} ${null==a?void 0:a.Driver.familyName} (${null===(r=null==a?void 0:a.FastestLap)||void 0===r?void 0:r.Time.time})
</h3>
</td>
</tr>
</table>
</td>
<tr><td colspan="5"> </td></tr>`},e.renderWeatherInfo=(t,n,o)=>{var a,s;if(!t)return i.html``;const l=(null===(a=n.weather_options)||void 0===a?void 0:a.unit)===r.WeatherUnit.Metric?"km/h":"mph",c=(null===(s=n.weather_options)||void 0===s?void 0:s.unit)===r.WeatherUnit.MilesFahrenheit?"°F":"°C",d=t.hours?t.hours[o.getHours()]:t;return i.html`<tr>
<td colspan="5">
<table class="weather-info">
<tr>
<td><ha-icon slot="icon" icon="mdi:weather-windy"></ha-icon> ${(0,e.calculateWindDirection)(d.winddir)} ${d.windspeed} ${l}</td>
<td><ha-icon slot="icon" icon="mdi:weather-pouring"></ha-icon> ${d.precip} mm</td>
<td><ha-icon slot="icon" icon="mdi:cloud-percent-outline"></ha-icon> ${d.precipprob}%</td>
</tr>
<tr>
<td><ha-icon slot="icon" icon="mdi:clouds"></ha-icon> ${d.cloudcover} %</td>
<td><ha-icon slot="icon" icon="mdi:thermometer-lines"></ha-icon> ${d.temp} ${c}</td>
<td><ha-icon slot="icon" icon="mdi:sun-thermometer"></ha-icon> ${d.feelslike} ${c}</td>
</tr>
</table>
</td>
</tr>
<tr><td colspan="5"> </td></tr>`},e.calculateWindDirection=t=>{const e=[{label:"N",range:[0,11.25]},{label:"NNE",range:[11.25,33.75]},{label:"NE",range:[33.75,56.25]},{label:"ENE",range:[56.25,78.75]},{label:"E",range:[78.75,101.25]},{label:"ESE",range:[101.25,123.75]},{label:"SE",range:[123.75,146.25]},{label:"SSE",range:[146.25,168.75]},{label:"S",range:[168.75,191.25]},{label:"SSW",range:[191.25,213.75]},{label:"SW",range:[213.75,236.25]},{label:"WSW",range:[236.25,258.75]},{label:"W",range:[258.75,281.25]},{label:"WNW",range:[281.25,303.75]},{label:"NW",range:[303.75,326.25]},{label:"NNW",range:[326.25,348.75]},{label:"N",range:[348.75,360]}];for(const{label:n,range:i}of e)if(t>=i[0]&&t<=i[1])return n},e.getRefreshTime=t=>{let e=24;const n=new Date,i=localStorage.getItem(`${n.getFullYear()}.json`);if(i){const r=JSON.parse(i),o=JSON.parse(r.data).MRData.RaceTable.Races.filter((t=>new Date(t.date).toLocaleDateString==n.toLocaleDateString));if(o.length>0){const n=o[0],i=new Date(n.date+"T"+n.time),r=localStorage.getItem(t);if(r){const t=JSON.parse(r);new Date(t.created)<i&&(e=1)}}}return e},e.reduceArray=(t,e)=>void 0===t?[]:e?t.slice(0,e):t,e.renderConstructorColumn=(t,n)=>i.html`<td>${t.config.standings.show_teamlogo?i.html`<img class="constructor-logo" height="20" width="20" src="${(0,e.getTeamImage)(t,n.constructorId)}"> `:""}${n.name}</td>`},5674:(t,e,n)=>{n.d(e,{Nz:()=>r,Oi:()=>i,eZ:()=>o});const i=(t,e,n)=>{Object.defineProperty(e,n,t)},r=(t,e)=>({kind:"method",placement:"prototype",key:e.key,descriptor:t}),o=({finisher:t,descriptor:e})=>(n,i)=>{var r;if(void 0===i){const i=null!==(r=n.originalKey)&&void 0!==r?r:n.key,o=null!=e?{kind:"method",placement:"prototype",key:i,descriptor:e(n.key)}:{...n,key:i};return null!=t&&(o.finisher=function(e){t(e,i)}),o}{const r=n.constructor;void 0!==e&&Object.defineProperty(n,i,e(i)),null==t||t(r,i)}}},5713:(t,e,n)=>{n.d(e,{M:()=>i});const i=t=>e=>"function"==typeof e?((t,e)=>(customElements.define(t,e),e))(t,e):((t,e)=>{const{kind:n,elements:i}=e;return{kind:n,elements:i,finisher(e){customElements.define(t,e)}}})(t,e)},8829:(t,e,n)=>{n.d(e,{h:()=>r});var i=n(5674);function r(t){return(0,i.eZ)({finisher:(e,n)=>{Object.assign(e.prototype[n],t)}})}},760:(t,e,n)=>{n.d(e,{C:()=>r});const i=(t,e)=>"method"===e.kind&&e.descriptor&&!("value"in e.descriptor)?{...e,finisher(n){n.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(n){n.createProperty(e.key,t)}};function r(t){return(e,n)=>void 0!==n?((t,e,n)=>{e.constructor.createProperty(n,t)})(t,e,n):i(t,e)}},3711:(t,e,n)=>{n.d(e,{K:()=>r});var i=n(5674);function r(t){return(0,i.eZ)({descriptor:e=>({get(){var e,n;return null!==(n=null===(e=this.renderRoot)||void 0===e?void 0:e.querySelectorAll(t))&&void 0!==n?n:[]},enumerable:!0,configurable:!0})})}},7935:(t,e,n)=>{n.d(e,{N:()=>a});var i,r=n(5674);const o=null!=(null===(i=window.HTMLSlotElement)||void 0===i?void 0:i.prototype.assignedElements)?(t,e)=>t.assignedElements(e):(t,e)=>t.assignedNodes(e).filter((t=>t.nodeType===Node.ELEMENT_NODE));function a(t){const{slot:e,selector:n}=null!=t?t:{};return(0,r.eZ)({descriptor:i=>({get(){var i;const r="slot"+(e?`[name=${e}]`:":not([name])"),a=null===(i=this.renderRoot)||void 0===i?void 0:i.querySelector(r),s=null!=a?o(a,t):[];return n?s.filter((t=>t.matches(n))):s},enumerable:!0,configurable:!0})})}},43:(t,e,n)=>{n.d(e,{v:()=>o});var i=n(5674),r=n(7935);function o(t,e,n){let o,a=t;return"object"==typeof t?(a=t.slot,o=t):o={flatten:e},n?(0,r.N)({slot:a,flatten:e,selector:n}):(0,i.eZ)({descriptor:t=>({get(){var t,e;const n="slot"+(a?`[name=${a}]`:":not([name])"),i=null===(t=this.renderRoot)||void 0===t?void 0:t.querySelector(n);return null!==(e=null==i?void 0:i.assignedNodes(o))&&void 0!==e?e:[]},enumerable:!0,configurable:!0})})}},8602:(t,e,n)=>{n.d(e,{G:()=>r});var i=n(5674);function r(t){return(0,i.eZ)({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})})}},2669:(t,e,n)=>{n.d(e,{I:()=>r});var i=n(5674);function r(t,e){return(0,i.eZ)({descriptor:n=>{const i={get(){var e,n;return null!==(n=null===(e=this.renderRoot)||void 0===e?void 0:e.querySelector(t))&&void 0!==n?n:null},enumerable:!0,configurable:!0};if(e){const e="symbol"==typeof n?Symbol():"__"+n;i.get=function(){var n,i;return void 0===this[e]&&(this[e]=null!==(i=null===(n=this.renderRoot)||void 0===n?void 0:n.querySelector(t))&&void 0!==i?i:null),this[e]}}return i}})}},9158:(t,e,n)=>{n.d(e,{S:()=>r});var i=n(760);function r(t){return(0,i.C)({...t,state:!0})}},7898:(t,e,n)=>{n.d(e,{c3:()=>s,fl:()=>b,ec:()=>d,iv:()=>c,Ts:()=>v,i1:()=>u,Qu:()=>y,FV:()=>r,$m:()=>l});const i=window,r=i.ShadowRoot&&(void 0===i.ShadyCSS||i.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,o=Symbol(),a=new WeakMap;class s{constructor(t,e,n){if(this._$cssResult$=!0,n!==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 n=void 0!==e&&1===e.length;n&&(t=a.get(e)),void 0===t&&((this.o=t=new CSSStyleSheet).replaceSync(this.cssText),n&&a.set(e,t))}return t}toString(){return this.cssText}}const l=t=>new s("string"==typeof t?t:t+"",void 0,o),c=(t,...e)=>{const n=1===t.length?t[0]:e.reduce(((e,n,i)=>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.")})(n)+t[i+1]),t[0]);return new s(n,t,o)},d=(t,e)=>{r?t.adoptedStyleSheets=e.map((t=>t instanceof CSSStyleSheet?t:t.styleSheet)):e.forEach((e=>{const n=document.createElement("style"),r=i.litNonce;void 0!==r&&n.setAttribute("nonce",r),n.textContent=e.cssText,t.appendChild(n)}))},u=r?t=>t:t=>t instanceof CSSStyleSheet?(t=>{let e="";for(const n of t.cssRules)e+=n.cssText;return l(e)})(t):t;var h;const m=window,p=m.trustedTypes,f=p?p.emptyScript:"",g=m.reactiveElementPolyfillSupport,v={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 n=t;switch(e){case Boolean:n=null!==t;break;case Number:n=null===t?null:Number(t);break;case Object:case Array:try{n=JSON.parse(t)}catch(t){n=null}}return n}},y=(t,e)=>e!==t&&(e==e||t==t),_={attribute:!0,type:String,converter:v,reflect:!1,hasChanged:y};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,n)=>{const i=this._$Ep(n,e);void 0!==i&&(this._$Ev.set(i,n),t.push(i))})),t}static createProperty(t,e=_){if(e.state&&(e.attribute=!1),this.finalize(),this.elementProperties.set(t,e),!e.noAccessor&&!this.prototype.hasOwnProperty(t)){const n="symbol"==typeof t?Symbol():"__"+t,i=this.getPropertyDescriptor(t,n,e);void 0!==i&&Object.defineProperty(this.prototype,t,i)}}static getPropertyDescriptor(t,e,n){return{get(){return this[e]},set(i){const r=this[t];this[e]=i,this.requestUpdate(t,r,n)},configurable:!0,enumerable:!0}}static getPropertyOptions(t){return this.elementProperties.get(t)||_}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 n of e)this.createProperty(n,t[n])}return this.elementStyles=this.finalizeStyles(this.styles),!0}static finalizeStyles(t){const e=[];if(Array.isArray(t)){const n=new Set(t.flat(1/0).reverse());for(const t of n)e.unshift(u(t))}else void 0!==t&&e.push(u(t));return e}static _$Ep(t,e){const n=e.attribute;return!1===n?void 0:"string"==typeof n?n:"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,n;(null!==(e=this._$ES)&&void 0!==e?e:this._$ES=[]).push(t),void 0!==this.renderRoot&&this.isConnected&&(null===(n=t.hostConnected)||void 0===n||n.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 d(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,n){this._$AK(t,n)}_$EO(t,e,n=_){var i;const r=this.constructor._$Ep(t,n);if(void 0!==r&&!0===n.reflect){const o=(void 0!==(null===(i=n.converter)||void 0===i?void 0:i.toAttribute)?n.converter:v).toAttribute(e,n.type);this._$El=t,null==o?this.removeAttribute(r):this.setAttribute(r,o),this._$El=null}}_$AK(t,e){var n;const i=this.constructor,r=i._$Ev.get(t);if(void 0!==r&&this._$El!==r){const t=i.getPropertyOptions(r),o="function"==typeof t.converter?{fromAttribute:t.converter}:void 0!==(null===(n=t.converter)||void 0===n?void 0:n.fromAttribute)?t.converter:v;this._$El=r,this[r]=o.fromAttribute(e,t.type),this._$El=null}}requestUpdate(t,e,n){let i=!0;void 0!==t&&(((n=n||this.constructor.getPropertyOptions(t)).hasChanged||y)(this[t],e)?(this._$AL.has(t)||this._$AL.set(t,e),!0===n.reflect&&this._$El!==t&&(void 0===this._$EC&&(this._$EC=new Map),this._$EC.set(t,n))):i=!1),!this.isUpdatePending&&i&&(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 n=this._$AL;try{e=this.shouldUpdate(n),e?(this.willUpdate(n),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(n)):this._$Ek()}catch(t){throw e=!1,this._$Ek(),t}e&&this._$AE(n)}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==g||g({ReactiveElement:b}),(null!==(h=m.reactiveElementVersions)&&void 0!==h?h:m.reactiveElementVersions=[]).push("1.6.1")},936:(t,e,n)=>{n.r(e),n.d(e,{CSSResult:()=>i.c3,LitElement:()=>o.oi,ReactiveElement:()=>i.fl,UpdatingElement:()=>o.f4,_$LE:()=>o.uD,_$LH:()=>r._$LH,adoptStyles:()=>i.ec,css:()=>i.iv,customElement:()=>s.M,decorateProperty:()=>a.eZ,defaultConverter:()=>i.Ts,eventOptions:()=>d.h,getCompatibleStyle:()=>i.i1,html:()=>r.html,legacyPrototypeMethod:()=>a.Oi,noChange:()=>r.noChange,notEqual:()=>i.Qu,nothing:()=>r.nothing,property:()=>l.C,query:()=>u.I,queryAll:()=>h.K,queryAssignedElements:()=>p.N,queryAssignedNodes:()=>f.v,queryAsync:()=>m.G,render:()=>r.render,standardPrototypeMethod:()=>a.Nz,state:()=>c.S,supportsAdoptingStyleSheets:()=>i.FV,svg:()=>r.svg,unsafeCSS:()=>i.$m});var i=n(7898),r=n(3692),o=n(8922),a=n(5674),s=n(5713),l=n(760),c=n(9158),d=n(8829),u=n(2669),h=n(3711),m=n(8602),p=n(7935),f=n(43);console.warn("The main 'lit-element' module entrypoint is deprecated. Please update your imports to use the 'lit' package: 'lit' and 'lit/decorators.ts' or import from 'lit-element/lit-element.ts'. See https://lit.dev/msg/deprecated-import-path for more information.")},8922:(t,e,n)=>{n.d(e,{$m:()=>o.$m,Al:()=>a._$LH,FV:()=>o.FV,Jb:()=>a.noChange,Ld:()=>a.nothing,Qu:()=>o.Qu,Ts:()=>o.Ts,YP:()=>a.svg,c3:()=>o.c3,dy:()=>a.html,ec:()=>o.ec,f4:()=>s,fl:()=>o.fl,i1:()=>o.i1,iv:()=>o.iv,oi:()=>l,sY:()=>a.render,uD:()=>d});var i,r,o=n(7898),a=n(3692);const s=o.fl;class l extends o.fl{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){var t,e;const n=super.createRenderRoot();return null!==(t=(e=this.renderOptions).renderBefore)&&void 0!==t||(e.renderBefore=n.firstChild),n}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}}l.finalized=!0,l._$litElement$=!0,null===(i=globalThis.litElementHydrateSupport)||void 0===i||i.call(globalThis,{LitElement:l});const c=globalThis.litElementPolyfillSupport;null==c||c({LitElement:l});const d={_$AK:(t,e,n)=>{t._$AK(e,n)},_$AL:t=>t._$AL};(null!==(r=globalThis.litElementVersions)&&void 0!==r?r:globalThis.litElementVersions=[]).push("3.3.3")},5206:(t,e,n)=>{n.d(e,{sR:()=>u});var i=n(4232),r=n(875);const o=(t,e)=>{var n,i;const r=t._$AN;if(void 0===r)return!1;for(const t of r)null===(i=(n=t)._$AO)||void 0===i||i.call(n,e,!1),o(t,e);return!0},a=t=>{let e,n;do{if(void 0===(e=t._$AM))break;n=e._$AN,n.delete(t),t=e}while(0===(null==n?void 0:n.size))},s=t=>{for(let e;e=t._$AM;t=e){let n=e._$AN;if(void 0===n)e._$AN=n=new Set;else if(n.has(t))break;n.add(t),d(e)}};function l(t){void 0!==this._$AN?(a(this),this._$AM=t,s(this)):this._$AM=t}function c(t,e=!1,n=0){const i=this._$AH,r=this._$AN;if(void 0!==r&&0!==r.size)if(e)if(Array.isArray(i))for(let t=n;t<i.length;t++)o(i[t],!1),a(i[t]);else null!=i&&(o(i,!1),a(i));else o(this,t)}const d=t=>{var e,n,i,o;t.type==r.pX.CHILD&&(null!==(e=(i=t)._$AP)&&void 0!==e||(i._$AP=c),null!==(n=(o=t)._$AQ)&&void 0!==n||(o._$AQ=l))};class u extends r.Xe{constructor(){super(...arguments),this._$AN=void 0}_$AT(t,e,n){super._$AT(t,e,n),s(this),this.isConnected=t._$AU}_$AO(t,e=!0){var n,i;t!==this.isConnected&&(this.isConnected=t,t?null===(n=this.reconnected)||void 0===n||n.call(this):null===(i=this.disconnected)||void 0===i||i.call(this)),e&&(o(this,t),a(this))}setValue(t){if((0,i.OR)(this._$Ct))this._$Ct._$AI(t,this);else{const e=[...this._$Ct._$AH];e[this._$Ci]=t,this._$Ct._$AI(e,this,0)}}disconnected(){}reconnected(){}}},4232:(t,e,n)=>{n.d(e,{OR:()=>a,pt:()=>o});var i=n(3692);const{I:r}=i._$LH,o=t=>null===t||"object"!=typeof t&&"function"!=typeof t,a=t=>void 0===t.strings},875:(t,e,n)=>{n.d(e,{XM:()=>r,Xe:()=>o,pX:()=>i});const i={ATTRIBUTE:1,CHILD:2,PROPERTY:3,BOOLEAN_ATTRIBUTE:4,EVENT:5,ELEMENT:6},r=t=>(...e)=>({_$litDirective$:t,values:e});class o{constructor(t){}get _$AU(){return this._$AM._$AU}_$AT(t,e,n){this._$Ct=t,this._$AM=e,this._$Ci=n}_$AS(t,e){return this.update(t,e)}update(t,e){return this.render(...e)}}},2069:(t,e,n)=>{n.d(e,{dS:()=>o,gw:()=>i,nX:()=>r});const i=async(t,e)=>{for await(const n of t)if(!1===await e(n))return};class r{constructor(t){this.G=t}disconnect(){this.G=void 0}reconnect(t){this.G=t}deref(){return this.G}}class o{constructor(){this.Y=void 0,this.Z=void 0}get(){return this.Y}pause(){var t;null!==(t=this.Y)&&void 0!==t||(this.Y=new Promise((t=>this.Z=t)))}resume(){var t;null===(t=this.Z)||void 0===t||t.call(this),this.Y=this.Z=void 0}}},7345:(t,e,n)=>{n.r(e),n.d(e,{UntilDirective:()=>d,until:()=>u});var i=n(3692),r=n(4232),o=n(5206),a=n(2069),s=n(875);const l=t=>!(0,r.pt)(t)&&"function"==typeof t.then,c=1073741823;class d extends o.sR{constructor(){super(...arguments),this._$C_t=c,this._$Cwt=[],this._$Cq=new a.nX(this),this._$CK=new a.dS}render(...t){var e;return null!==(e=t.find((t=>!l(t))))&&void 0!==e?e:i.noChange}update(t,e){const n=this._$Cwt;let r=n.length;this._$Cwt=e;const o=this._$Cq,a=this._$CK;this.isConnected||this.disconnected();for(let t=0;t<e.length&&!(t>this._$C_t);t++){const i=e[t];if(!l(i))return this._$C_t=t,i;t<r&&i===n[t]||(this._$C_t=c,r=0,Promise.resolve(i).then((async t=>{for(;a.get();)await a.get();const e=o.deref();if(void 0!==e){const n=e._$Cwt.indexOf(i);n>-1&&n<e._$C_t&&(e._$C_t=n,e.setValue(t))}})))}return i.noChange}disconnected(){this._$Cq.disconnect(),this._$CK.pause()}reconnected(){this._$Cq.reconnect(this),this._$CK.resume()}}const u=(0,s.XM)(d)},3692:(t,e,n)=>{var i;n.r(e),n.d(e,{_$LH:()=>G,html:()=>T,noChange:()=>A,nothing:()=>x,render:()=>q,svg:()=>D});const r=window,o=r.trustedTypes,a=o?o.createPolicy("lit-html",{createHTML:t=>t}):void 0,s="$lit$",l=`lit$${(Math.random()+"").slice(9)}$`,c="?"+l,d=`<${c}>`,u=document,h=()=>u.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]),g="[ \t\n\f\r]",v=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,y=/-->/g,_=/>/g,b=RegExp(`>|${g}(?:([^\\s"'>=/]+)(${g}*=${g}*(?:[^ \t\n\f\r"'\`<>=]|("|')|))|$)`,"g"),w=/'/g,$=/"/g,C=/^(?:script|style|textarea|title)$/i,S=t=>(e,...n)=>({_$litType$:t,strings:e,values:n}),T=S(1),D=S(2),A=Symbol.for("lit-noChange"),x=Symbol.for("lit-nothing"),R=new WeakMap,E=u.createTreeWalker(u,129,null,!1);function k(t,e){if(!Array.isArray(t)||!t.hasOwnProperty("raw"))throw Error("invalid template strings array");return void 0!==a?a.createHTML(e):e}const O=(t,e)=>{const n=t.length-1,i=[];let r,o=2===e?"<svg>":"",a=v;for(let e=0;e<n;e++){const n=t[e];let c,u,h=-1,m=0;for(;m<n.length&&(a.lastIndex=m,u=a.exec(n),null!==u);)m=a.lastIndex,a===v?"!--"===u[1]?a=y:void 0!==u[1]?a=_:void 0!==u[2]?(C.test(u[2])&&(r=RegExp("</"+u[2],"g")),a=b):void 0!==u[3]&&(a=b):a===b?">"===u[0]?(a=null!=r?r:v,h=-1):void 0===u[1]?h=-2:(h=a.lastIndex-u[2].length,c=u[1],a=void 0===u[3]?b:'"'===u[3]?$:w):a===$||a===w?a=b:a===y||a===_?a=v:(a=b,r=void 0);const p=a===b&&t[e+1].startsWith("/>")?" ":"";o+=a===v?n+d:h>=0?(i.push(c),n.slice(0,h)+s+n.slice(h)+l+p):n+l+(-2===h?(i.push(void 0),e):p)}return[k(t,o+(t[n]||"<?>")+(2===e?"</svg>":"")),i]};class F{constructor({strings:t,_$litType$:e},n){let i;this.parts=[];let r=0,a=0;const d=t.length-1,u=this.parts,[m,p]=O(t,e);if(this.el=F.createElement(m,n),E.currentNode=this.el.content,2===e){const t=this.el.content,e=t.firstChild;e.remove(),t.append(...e.childNodes)}for(;null!==(i=E.nextNode())&&u.length<d;){if(1===i.nodeType){if(i.hasAttributes()){const t=[];for(const e of i.getAttributeNames())if(e.endsWith(s)||e.startsWith(l)){const n=p[a++];if(t.push(e),void 0!==n){const t=i.getAttribute(n.toLowerCase()+s).split(l),e=/([.?@])?(.*)/.exec(n);u.push({type:1,index:r,name:e[2],strings:t,ctor:"."===e[1]?L:"?"===e[1]?j:"@"===e[1]?H:I})}else u.push({type:6,index:r})}for(const e of t)i.removeAttribute(e)}if(C.test(i.tagName)){const t=i.textContent.split(l),e=t.length-1;if(e>0){i.textContent=o?o.emptyScript:"";for(let n=0;n<e;n++)i.append(t[n],h()),E.nextNode(),u.push({type:2,index:++r});i.append(t[e],h())}}}else if(8===i.nodeType)if(i.data===c)u.push({type:2,index:r});else{let t=-1;for(;-1!==(t=i.data.indexOf(l,t+1));)u.push({type:7,index:r}),t+=l.length-1}r++}}static createElement(t,e){const n=u.createElement("template");return n.innerHTML=t,n}}function N(t,e,n=t,i){var r,o,a,s;if(e===A)return e;let l=void 0!==i?null===(r=n._$Co)||void 0===r?void 0:r[i]:n._$Cl;const c=m(e)?void 0:e._$litDirective$;return(null==l?void 0:l.constructor)!==c&&(null===(o=null==l?void 0:l._$AO)||void 0===o||o.call(l,!1),void 0===c?l=void 0:(l=new c(t),l._$AT(t,n,i)),void 0!==i?(null!==(a=(s=n)._$Co)&&void 0!==a?a:s._$Co=[])[i]=l:n._$Cl=l),void 0!==l&&(e=N(t,l._$AS(t,e.values),l,i)),e}class M{constructor(t,e){this._$AV=[],this._$AN=void 0,this._$AD=t,this._$AM=e}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(t){var e;const{el:{content:n},parts:i}=this._$AD,r=(null!==(e=null==t?void 0:t.creationScope)&&void 0!==e?e:u).importNode(n,!0);E.currentNode=r;let o=E.nextNode(),a=0,s=0,l=i[0];for(;void 0!==l;){if(a===l.index){let e;2===l.type?e=new P(o,o.nextSibling,this,t):1===l.type?e=new l.ctor(o,l.name,l.strings,this,t):6===l.type&&(e=new U(o,this,t)),this._$AV.push(e),l=i[++s]}a!==(null==l?void 0:l.index)&&(o=E.nextNode(),a++)}return E.currentNode=u,r}v(t){let e=0;for(const n of this._$AV)void 0!==n&&(void 0!==n.strings?(n._$AI(t,n,e),e+=n.strings.length-2):n._$AI(t[e])),e++}}class P{constructor(t,e,n,i){var r;this.type=2,this._$AH=x,this._$AN=void 0,this._$AA=t,this._$AB=e,this._$AM=n,this.options=i,this._$Cp=null===(r=null==i?void 0:i.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._$Cp}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=N(this,t,e),m(t)?t===x||null==t||""===t?(this._$AH!==x&&this._$AR(),this._$AH=x):t!==this._$AH&&t!==A&&this._(t):void 0!==t._$litType$?this.g(t):void 0!==t.nodeType?this.$(t):f(t)?this.T(t):this._(t)}k(t){return this._$AA.parentNode.insertBefore(t,this._$AB)}$(t){this._$AH!==t&&(this._$AR(),this._$AH=this.k(t))}_(t){this._$AH!==x&&m(this._$AH)?this._$AA.nextSibling.data=t:this.$(u.createTextNode(t)),this._$AH=t}g(t){var e;const{values:n,_$litType$:i}=t,r="number"==typeof i?this._$AC(t):(void 0===i.el&&(i.el=F.createElement(k(i.h,i.h[0]),this.options)),i);if((null===(e=this._$AH)||void 0===e?void 0:e._$AD)===r)this._$AH.v(n);else{const t=new M(r,this),e=t.u(this.options);t.v(n),this.$(e),this._$AH=t}}_$AC(t){let e=R.get(t.strings);return void 0===e&&R.set(t.strings,e=new F(t)),e}T(t){p(this._$AH)||(this._$AH=[],this._$AR());const e=this._$AH;let n,i=0;for(const r of t)i===e.length?e.push(n=new P(this.k(h()),this.k(h()),this,this.options)):n=e[i],n._$AI(r),i++;i<e.length&&(this._$AR(n&&n._$AB.nextSibling,i),e.length=i)}_$AR(t=this._$AA.nextSibling,e){var n;for(null===(n=this._$AP)||void 0===n||n.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._$Cp=t,null===(e=this._$AP)||void 0===e||e.call(this,t))}}class I{constructor(t,e,n,i,r){this.type=1,this._$AH=x,this._$AN=void 0,this.element=t,this.name=e,this._$AM=i,this.options=r,n.length>2||""!==n[0]||""!==n[1]?(this._$AH=Array(n.length-1).fill(new String),this.strings=n):this._$AH=x}get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}_$AI(t,e=this,n,i){const r=this.strings;let o=!1;if(void 0===r)t=N(this,t,e,0),o=!m(t)||t!==this._$AH&&t!==A,o&&(this._$AH=t);else{const i=t;let a,s;for(t=r[0],a=0;a<r.length-1;a++)s=N(this,i[n+a],e,a),s===A&&(s=this._$AH[a]),o||(o=!m(s)||s!==this._$AH[a]),s===x?t=x:t!==x&&(t+=(null!=s?s:"")+r[a+1]),this._$AH[a]=s}o&&!i&&this.j(t)}j(t){t===x?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,null!=t?t:"")}}class L extends I{constructor(){super(...arguments),this.type=3}j(t){this.element[this.name]=t===x?void 0:t}}const V=o?o.emptyScript:"";class j extends I{constructor(){super(...arguments),this.type=4}j(t){t&&t!==x?this.element.setAttribute(this.name,V):this.element.removeAttribute(this.name)}}class H extends I{constructor(t,e,n,i,r){super(t,e,n,i,r),this.type=5}_$AI(t,e=this){var n;if((t=null!==(n=N(this,t,e,0))&&void 0!==n?n:x)===A)return;const i=this._$AH,r=t===x&&i!==x||t.capture!==i.capture||t.once!==i.once||t.passive!==i.passive,o=t!==x&&(i===x||r);r&&this.element.removeEventListener(this.name,this,i),o&&this.element.addEventListener(this.name,this,t),this._$AH=t}handleEvent(t){var e,n;"function"==typeof this._$AH?this._$AH.call(null!==(n=null===(e=this.options)||void 0===e?void 0:e.host)&&void 0!==n?n:this.element,t):this._$AH.handleEvent(t)}}class U{constructor(t,e,n){this.element=t,this.type=6,this._$AN=void 0,this._$AM=e,this.options=n}get _$AU(){return this._$AM._$AU}_$AI(t){N(this,t)}}const G={O:s,P:l,A:c,C:1,M:O,L:M,R:f,D:N,I:P,V:I,H:j,N:H,U:L,F:U},B=r.litHtmlPolyfillSupport;null==B||B(F,P),(null!==(i=r.litHtmlVersions)&&void 0!==i?i:r.litHtmlVersions=[]).push("2.8.0");const q=(t,e,n)=>{var i,r;const o=null!==(i=null==n?void 0:n.renderBefore)&&void 0!==i?i:e;let a=o._$litPart$;if(void 0===a){const t=null!==(r=null==n?void 0:n.renderBefore)&&void 0!==r?r:null;o._$litPart$=a=new P(e.insertBefore(h(),t),t,void 0,null!=n?n:{})}return a._$AI(t),a}},9662:(t,e,n)=>{n.r(e),n.d(e,{customElement:()=>i.M,eventOptions:()=>a.h,property:()=>r.C,query:()=>s.I,queryAll:()=>l.K,queryAssignedElements:()=>d.N,queryAssignedNodes:()=>u.v,queryAsync:()=>c.G,state:()=>o.S});var i=n(5713),r=n(760),o=n(9158),a=n(8829),s=n(2669),l=n(3711),c=n(8602),d=n(7935),u=n(43)},8082:(t,e,n)=>{n.r(e),n.d(e,{Directive:()=>i.Xe,PartType:()=>i.pX,directive:()=>i.XM});var i=n(875)},530:(t,e,n)=>{n.r(e),n.d(e,{AsyncReplaceDirective:()=>s,asyncReplace:()=>l});var i=n(3692),r=n(5206),o=n(2069),a=n(875);class s extends r.sR{constructor(){super(...arguments),this._$Cq=new o.nX(this),this._$CK=new o.dS}render(t,e){return i.noChange}update(t,[e,n]){if(this.isConnected||this.disconnected(),e===this._$CX)return;this._$CX=e;let r=0;const{_$Cq:a,_$CK:s}=this;return(0,o.gw)(e,(async t=>{for(;s.get();)await s.get();const i=a.deref();if(void 0!==i){if(i._$CX!==e)return!1;void 0!==n&&(t=n(t,r)),i.commitValue(t,r),r++}return!0})),i.noChange}commitValue(t,e){this.setValue(t)}disconnected(){this._$Cq.disconnect(),this._$CK.pause()}reconnected(){this._$Cq.reconnect(this),this._$CK.resume()}}const l=(0,a.XM)(s)},6370:(t,e,n)=>{n.r(e),n.d(e,{CSSResult:()=>i.c3,LitElement:()=>i.oi,ReactiveElement:()=>i.fl,UpdatingElement:()=>i.f4,_$LE:()=>i.uD,_$LH:()=>i.Al,adoptStyles:()=>i.ec,css:()=>i.iv,defaultConverter:()=>i.Ts,getCompatibleStyle:()=>i.i1,html:()=>i.dy,isServer:()=>r,noChange:()=>i.Jb,notEqual:()=>i.Qu,nothing:()=>i.Ld,render:()=>i.sY,supportsAdoptingStyleSheets:()=>i.FV,svg:()=>i.YP,unsafeCSS:()=>i.$m}),n(7898),n(3692);var i=n(8922);const r=!1},4147:t=>{t.exports=JSON.parse('{"name":"formulaone-card","version":"1.8.8","description":"Frontend card for Home Assistant to display Formula One data","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/formulaone-card/formulaone-card/jest.results.json","prebuild":"copy git-hooks\\\\pre-commit .git\\\\hooks\\\\ && echo \'hook copied\'"},"repository":{"type":"git","url":"git+https://github.com/marcokreeft87/formulaone-card.git"},"keywords":[],"author":"","license":"ISC","bugs":{"url":"https://github.com/marcokreeft87/formulaone-card/issues"},"homepage":"https://github.com/marcokreeft87/formulaone-card#readme","devDependencies":{"@types/jest":"^29.5.3","@typescript-eslint/eslint-plugin":"^5.59.8","@typescript-eslint/parser":"^5.62.0","codecov":"^3.8.3","eslint":"^8.50.0","home-assistant-js-websocket":"^8.2.0","lit":"^2.8.0","typescript":"^4.9.5","webpack":"^5.89.0","webpack-cli":"^5.1.4"},"dependencies":{"@babel/plugin-transform-runtime":"^7.22.5","@babel/preset-env":"^7.22.14","@lit-labs/scoped-registry-mixin":"^1.0.1","@marcokreeft/ha-editor-formbuilder":"^2023.10.9","babel-jest":"^29.7.0","compression-webpack-plugin":"^10.0.0","custom-card-helpers":"^1.9.0","isomorphic-fetch":"^3.0.0","jest-environment-jsdom":"^29.6.2","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.4","ttypescript":"^1.5.15","yarn":"^1.22.19"},"directories":{"test":"tests"}}')}},e={};function n(i){var r=e[i];if(void 0!==r)return r.exports;var o=e[i]={exports:{}};return t[i].call(o.exports,o,o.exports,n),o.exports}n.d=(t,e)=>{for(var i in e)n.o(e,i)&&!n.o(t,i)&&Object.defineProperty(t,i,{enumerable:!0,get:e[i]})},n.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),n.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n(3607)})();