/*! For license information please see formulaone-card.js.LICENSE.txt */ (()=>{"use strict";var t={898:(t,e,i)=>{Object.defineProperty(e,"__esModule",{value:!0});const n=i(313),r=i(11),o=i(194),s=i(382);class a extends r.LitElement{constructor(){super(...arguments),this.controlRenderers={[o.FormControlType.Dropdown]:s.renderDropdown,[o.FormControlType.Radio]:s.renderRadio,[o.FormControlType.Checkboxes]:s.renderCheckboxes,[o.FormControlType.EntityDropdown]:s.renderDropdown,[o.FormControlType.Switch]:s.renderSwitch,[o.FormControlType.Textbox]:s.renderTextbox,[o.FormControlType.Filler]:s.renderFiller}}setConfig(t){this._config=t}set hass(t){this._hass=t}renderForm(t){return r.html`
${t.map((t=>{const e=t.cssClass?`form-row ${t.cssClass}`:"form-row";return t.hidden?"":r.html`
${t.controls.map((t=>this.renderControl(t)))}
`}))}
`}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,i=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,i]=e.configValue.split(".");this._config={...this._config,[t]:{...this._config[t],[i]:e.checked}}}else this._config={...this._config,[e.configValue]:void 0===e.checked&&(null==i?void 0:i.value)?e.checked||i.value:e.value||e.checked};(0,n.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=a},194:(t,e)=>{var i;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"}(i||(e.FormControlType=i={}))},382:(t,e,i)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.renderCheckboxes=e.renderRadio=e.renderDropdown=e.renderSwitch=e.renderTextbox=e.renderEntityDropdown=e.renderFiller=void 0;const n=i(11),r=i(429);e.renderFiller=()=>n.html`
`,e.renderEntityDropdown=(t,e)=>{var i;return n.html`
`},e.renderTextbox=(t,e)=>{var i;return n.html`
`},e.renderSwitch=(t,e)=>n.html`
`,e.renderDropdown=(t,e)=>{var i;const o=null!==(i=e.items)&&void 0!==i?i:(0,r.getEntitiesByDomain)(t._hass,e.domain);return n.html`
`},e.renderRadio=(t,e)=>n.html`
${e.items.map((i=>n.html``))}
`,e.renderCheckboxes=(t,e)=>n.html` ${e.items.map((i=>{var r;return n.html`
`}))}`},429:(t,e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.getDropdownOptionsFromEnum=e.formatList=e.getEntitiesByDeviceClass=e.getEntitiesByDomain=void 0,e.getEntitiesByDomain=(t,i)=>Object.keys(t.states).filter((t=>t.substr(0,t.indexOf("."))===i)).map((i=>(0,e.formatList)(i,t))),e.getEntitiesByDeviceClass=(t,i,n)=>Object.keys(t.states).filter((e=>e.substr(0,e.indexOf("."))===i&&t.states[e].attributes.device_class===n)).map((i=>(0,e.formatList)(i,t))),e.formatList=(t,e)=>({label:e.states[t].attributes.friendly_name,value:t}),e.getDropdownOptionsFromEnum=t=>{const e=[];for(const[i,n]of Object.entries(t))e.push({value:n,label:i});return e}},313:(t,e,i)=>{i.r(e),i.d(e,{DEFAULT_DOMAIN_ICON:()=>J,DEFAULT_PANEL:()=>X,DEFAULT_VIEW_ENTITY_ID:()=>at,DOMAINS_HIDE_MORE_INFO:()=>et,DOMAINS_MORE_INFO_NO_HISTORY:()=>it,DOMAINS_TOGGLE:()=>rt,DOMAINS_WITH_CARD:()=>Z,DOMAINS_WITH_MORE_INFO:()=>tt,NumberFormat:()=>n,STATES_OFF:()=>nt,TimeFormat:()=>r,UNIT_C:()=>ot,UNIT_F:()=>st,applyThemesOnElement:()=>L,computeCardSize:()=>H,computeDomain:()=>U,computeEntity:()=>j,computeRTL:()=>V,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:()=>E,formatDateTimeWithSeconds:()=>S,formatDateWeekday:()=>l,formatDateYear:()=>$,formatNumber:()=>Y,formatTime:()=>x,formatTimeWeekday:()=>P,formatTimeWithSeconds:()=>k,forwardHaptic:()=>gt,getLovelace:()=>Et,handleAction:()=>bt,handleActionConfig:()=>$t,handleClick:()=>wt,hasAction:()=>Ct,hasConfigOrEntityChanged:()=>At,hasDoubleClick:()=>St,isNumericState:()=>q,navigate:()=>vt,numberFormatToLocale:()=>z,relativeTime:()=>M,round:()=>W,stateIcon:()=>Rt,timerTimeRemaining:()=>F,toggleEntity:()=>_t,turnOnOffEntities:()=>Tt,turnOnOffEntity:()=>yt});var n,r,o,s=function(){return s=Object.assign||function(t){for(var e,i=1,n=arguments.length;i0)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,i);return n?function(t){return new Intl.RelativeTimeFormat(t.language,{numeric:"auto"})}(e).format(r.value,r.unit):Intl.NumberFormat(e.language,{style:"unit",unit:r.unit,unitDisplay:"long"}).format(Math.abs(r.value))};function F(t){var e,i=3600*(e=t.attributes.remaining.split(":").map(Number))[0]+60*e[1]+e[2];if("active"===t.state){var n=(new Date).getTime(),r=new Date(t.last_changed).getTime();i=Math.max(i-(n-r)/1e3,0)}return i}function I(){return(I=Object.assign||function(t){for(var e=1;e-1?t.split(".")[1].length:0;i.minimumFractionDigits=n,i.maximumFractionDigits=n}return i},K=function(t,e,i,n){var r=void 0!==n?n:e.state;if("unknown"===r||"unavailable"===r)return t("state.default."+r);if(q(e)){if("monetary"===e.attributes.device_class)try{return Y(r,i,{style:"currency",currency:e.attributes.unit_of_measurement})}catch(t){}return Y(r,i)+(e.attributes.unit_of_measurement?" "+e.attributes.unit_of_measurement:"")}var o=B(e);if("input_datetime"===o){var s;if(void 0===n)return e.attributes.has_date&&e.attributes.has_time?(s=new Date(e.attributes.year,e.attributes.month-1,e.attributes.day,e.attributes.hour,e.attributes.minute),C(s,i)):e.attributes.has_date?(s=new Date(e.attributes.year,e.attributes.month-1,e.attributes.day),d(s,i)):e.attributes.has_time?((s=new Date).setHours(e.attributes.hour,e.attributes.minute),x(s,i)):e.state;try{var a=n.split(" ");if(2===a.length)return C(new Date(a.join("T")),i);if(1===a.length){if(n.includes("-"))return d(new Date(n+"T00:00"),i);if(n.includes(":")){var l=new Date;return x(new Date(l.toISOString().split("T")[0]+"T"+n),i)}}return n}catch(t){return n}}return"humidifier"===o&&"on"===r&&e.attributes.humidity?e.attributes.humidity+" %":"counter"===o||"number"===o||"input_number"===o?Y(r,i):e.attributes.device_class&&t("component."+o+".state."+e.attributes.device_class+"."+r)||t("component."+o+".state._."+r)||r},J="mdi:bookmark",X="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"],it=["camera","configurator","history_graph","scene"],nt=["closed","locked","off"],rt=new Set(["fan","input_boolean","light","switch","group","automation"]),ot="°C",st="°F",at="group.default_view",lt=function(t,e,i,n){n=n||{},i=null==i?{}:i;var r=new Event(e,{bubbles:void 0===n.bubbles||n.bubbles,cancelable:Boolean(n.cancelable),composed:void 0===n.composed||n.composed});return r.detail=i,t.dispatchEvent(r),r},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 i=function(t,e){return n("hui-error-card",{type:"error",error:t,config:e})},n=function(t,e){var n=window.document.createElement(t);try{if(!n.setConfig)return;n.setConfig(e)}catch(n){return console.error(t,n),i(n.message,e)}return n};if(!t||"object"!=typeof t||!e&&!t.type)return i("No type defined",t);var r=t.type;if(r&&r.startsWith("custom:"))r=r.substr(7);else if(e)if(ct.has(r))r="hui-"+r+"-row";else{if(!t.entity)return i("Invalid config given.",t);var o=t.entity.split(".",1)[0];r="hui-"+(dt[o]||"text")+"-entity-row"}else r="hui-"+r+"-card";if(customElements.get(r))return n(r,t);var s=i("Custom element doesn't exist: "+t.type+".",t);s.style.display="None";var a=setTimeout((function(){s.style.display=""}),2e3);return customElements.whenDefined(t.type).then((function(){clearTimeout(a),lt(s,"ll-rebuild",{},s)})),s},ht=function(t,e,i){var n;return void 0===i&&(i=!1),function(){var r=[].slice.call(arguments),o=this,s=i&&!n;clearTimeout(n),n=setTimeout((function(){n=null,i||t.apply(o,r)}),e),s&&t.apply(o,r)}},mt={alert:"mdi:alert",automation:"mdi:playlist-play",calendar:"mdi:calendar",camera:"mdi:video",climate:"mdi:thermostat",configurator:"mdi:settings",conversation:"mdi:text-to-speech",device_tracker:"mdi:account",fan:"mdi:fan",group:"mdi:google-circles-communities",history_graph:"mdi:chart-line",homeassistant:"mdi:home-assistant",homekit:"mdi:home-automation",image_processing:"mdi:image-filter-frames",input_boolean:"mdi:drawing",input_datetime:"mdi:calendar-clock",input_number:"mdi:ray-vertex",input_select:"mdi:format-list-bulleted",input_text:"mdi:textbox",light:"mdi:lightbulb",mailbox:"mdi:mailbox",notify:"mdi:comment-alert",person:"mdi:account",plant:"mdi:flower",proximity:"mdi:apple-safari",remote:"mdi:remote",scene:"mdi:google-pages",script:"mdi:file-document",sensor:"mdi:eye",simple_alarm:"mdi:bell",sun:"mdi:white-balance-sunny",switch:"mdi:flash",timer:"mdi:timer",updater:"mdi:cloud-upload",vacuum:"mdi:robot-vacuum",water_heater:"mdi:thermometer",weblink:"mdi:open-in-new"};function pt(t,e){if(t in mt)return mt[t];switch(t){case"alarm_control_panel":switch(e){case"armed_home":return"mdi:bell-plus";case"armed_night":return"mdi:bell-sleep";case"disarmed":return"mdi:bell-outline";case"triggered":return"mdi:bell-ring";default:return"mdi:bell"}case"binary_sensor":return e&&"off"===e?"mdi:radiobox-blank":"mdi:checkbox-marked-circle";case"cover":return"closed"===e?"mdi:window-closed":"mdi:window-open";case"lock":return e&&"unlocked"===e?"mdi:lock-open":"mdi:lock";case"media_player":return e&&"off"!==e&&"idle"!==e?"mdi:cast-connected":"mdi:cast";case"zwave":switch(e){case"dead":return"mdi:emoticon-dead";case"sleeping":return"mdi:sleep";case"initializing":return"mdi:timer-sand";default:return"mdi:z-wave"}default:return console.warn("Unable to find icon for domain "+t+" ("+e+")"),"mdi:bookmark"}}var ft=function(t,e){var i=e.value||e,n=e.attribute?t.attributes[e.attribute]:t.state;switch(e.operator||"=="){case"==":return n===i;case"<=":return n<=i;case"<":return n=":return n>=i;case">":return n>i;case"!=":return n!==i;case"regex":return n.match(i);default:return!1}},gt=function(t){lt(window,"haptic",t)},vt=function(t,e,i){void 0===i&&(i=!1),i?history.replaceState(null,"",e):history.pushState(null,"",e),lt(window,"location-changed",{replace:i})},yt=function(t,e,i){void 0===i&&(i=!0);var n,r=U(e),o="group"===r?"homeassistant":r;switch(r){case"lock":n=i?"unlock":"lock";break;case"cover":n=i?"open_cover":"close_cover";break;default:n=i?"turn_on":"turn_off"}return t.callService(o,n,{entity_id:e})},_t=function(t,e){var i=nt.includes(t.states[e].state);return yt(t,e,i)},$t=function(t,e,i,n){if(n||(n={action:"more-info"}),!n.confirmation||n.confirmation.exemptions&&n.confirmation.exemptions.some((function(t){return t.user===e.user.id}))||(gt("warning"),confirm(n.confirmation.text||"Are you sure you want to "+n.action+"?")))switch(n.action){case"more-info":(i.entity||i.camera_image)&<(t,"hass-more-info",{entityId:i.entity?i.entity:i.camera_image});break;case"navigate":n.navigation_path&&vt(0,n.navigation_path);break;case"url":n.url_path&&window.open(n.url_path);break;case"toggle":i.entity&&(_t(e,i.entity),gt("success"));break;case"call-service":if(!n.service)return void gt("failure");var r=n.service.split(".",2);e.callService(r[0],r[1],n.service_data,n.target),gt("success");break;case"fire-dom-event":lt(t,"ll-custom",n)}},bt=function(t,e,i,n){var r;"double_tap"===n&&i.double_tap_action?r=i.double_tap_action:"hold"===n&&i.hold_action?r=i.hold_action:"tap"===n&&i.tap_action&&(r=i.tap_action),$t(t,e,i,r)},wt=function(t,e,i,n,r){var o;if(r&&i.double_tap_action?o=i.double_tap_action:n&&i.hold_action?o=i.hold_action:!n&&i.tap_action&&(o=i.tap_action),o||(o={action:"more-info"}),!o.confirmation||o.confirmation.exemptions&&o.confirmation.exemptions.some((function(t){return t.user===e.user.id}))||confirm(o.confirmation.text||"Are you sure you want to "+o.action+"?"))switch(o.action){case"more-info":(o.entity||i.entity||i.camera_image)&&(lt(t,"hass-more-info",{entityId:o.entity?o.entity:i.entity?i.entity:i.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":i.entity&&(_t(e,i.entity),o.haptic&>(o.haptic));break;case"call-service":if(!o.service)return;var s=o.service.split(".",2),a=s[0],l=s[1],c=I({},o.service_data);"entity"===c.entity_id&&(c.entity_id=i.entity),e.callService(a,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 At(t,e,i){if(e.has("config")||i)return!0;if(t.config.entity){var n=e.get("hass");return!n||n.states[t.config.entity]!==t.hass.states[t.config.entity]}return!1}function St(t){return void 0!==t&&"none"!==t.action}var Tt=function(t,e,i){void 0===i&&(i=!0);var n={};e.forEach((function(e){if(nt.includes(t.states[e].state)===i){var r=U(e),o=["cover","lock"].includes(r)?r:"homeassistant";o in n||(n[o]=[]),n[o].push(e)}})),Object.keys(n).forEach((function(e){var r;switch(e){case"lock":r=i?"unlock":"lock";break;case"cover":r=i?"open_cover":"close_cover";break;default:r=i?"turn_on":"turn_off"}t.callService(e,r,{entity_id:n[e]})}))},Et=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},Dt={humidity:"mdi:water-percent",illuminance:"mdi:brightness-5",temperature:"mdi:thermometer",pressure:"mdi:gauge",power:"mdi:flash",signal_strength:"mdi:wifi"},xt={binary_sensor:function(t,e){var i="off"===t;switch(null==e?void 0:e.attributes.device_class){case"battery":return i?"mdi:battery":"mdi:battery-outline";case"battery_charging":return i?"mdi:battery":"mdi:battery-charging";case"cold":return i?"mdi:thermometer":"mdi:snowflake";case"connectivity":return i?"mdi:server-network-off":"mdi:server-network";case"door":return i?"mdi:door-closed":"mdi:door-open";case"garage_door":return i?"mdi:garage":"mdi:garage-open";case"power":case"plug":return i?"mdi:power-plug-off":"mdi:power-plug";case"gas":case"problem":case"safety":case"tamper":return i?"mdi:check-circle":"mdi:alert-circle";case"smoke":return i?"mdi:check-circle":"mdi:smoke";case"heat":return i?"mdi:thermometer":"mdi:fire";case"light":return i?"mdi:brightness-5":"mdi:brightness-7";case"lock":return i?"mdi:lock":"mdi:lock-open";case"moisture":return i?"mdi:water-off":"mdi:water";case"motion":return i?"mdi:walk":"mdi:run";case"occupancy":case"presence":return i?"mdi:home-outline":"mdi:home";case"opening":return i?"mdi:square":"mdi:square-outline";case"running":return i?"mdi:stop":"mdi:play";case"sound":return i?"mdi:music-note-off":"mdi:music-note";case"update":return i?"mdi:package":"mdi:package-up";case"vibration":return i?"mdi:crop-portrait":"mdi:vibrate";case"window":return i?"mdi:window-closed":"mdi:window-open";default:return i?"mdi:radiobox-blank":"mdi:checkbox-marked-circle"}},cover:function(t){var e="closed"!==t.state;switch(t.attributes.device_class){case"garage":return e?"mdi:garage-open":"mdi:garage";case"door":return e?"mdi:door-open":"mdi:door-closed";case"shutter":return e?"mdi:window-shutter-open":"mdi:window-shutter";case"blind":return e?"mdi:blinds-open":"mdi:blinds";case"window":return e?"mdi:window-open":"mdi:window-closed";default:return pt("cover",t.state)}},sensor:function(t){var e=t.attributes.device_class;if(e&&e in Dt)return Dt[e];if("battery"===e){var i=Number(t.state);if(isNaN(i))return"mdi:battery-unknown";var n=10*Math.round(i/10);return n>=100?"mdi:battery":n<=0?"mdi:battery-alert":"hass:battery-"+n}var r=t.attributes.unit_of_measurement;return"°C"===r||"°F"===r?"mdi:thermometer":pt("sensor")},input_datetime:function(t){return t.attributes.has_date?t.attributes.has_time?pt("input_datetime"):"mdi:calendar":"mdi:clock"}},Rt=function(t){if(!t)return"mdi:bookmark";if(t.attributes.icon)return t.attributes.icon;var e=U(t.entity_id);return e in xt?xt[e](t):pt(e,t.state)}},694:function(t,e){var i=this&&this.__awaiter||function(t,e,i,n){return new(i||(i=Promise))((function(r,o){function s(t){try{l(n.next(t))}catch(t){o(t)}}function a(t){try{l(n.throw(t))}catch(t){o(t)}}function l(t){var e;t.done?r(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(s,a)}l((n=n.apply(t,e||[])).next())}))};Object.defineProperty(e,"__esModule",{value:!0}),e.ClientBase=void 0,e.ClientBase=class{GetData(t,e,n){return i(this,void 0,void 0,(function*(){const i=localStorage.getItem(t);if(i&&e){const t=JSON.parse(i),e=new Date;if(e.setHours(e.getHours()-n),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(),s={data:JSON.stringify(o),created:new Date};return e&&localStorage.setItem(t,JSON.stringify(s)),o}))}}},470:function(t,e,i){var n=this&&this.__awaiter||function(t,e,i,n){return new(i||(i=Promise))((function(r,o){function s(t){try{l(n.next(t))}catch(t){o(t)}}function a(t){try{l(n.throw(t))}catch(t){o(t)}}function l(t){var e;t.done?r(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(s,a)}l((n=n.apply(t,e||[])).next())}))};Object.defineProperty(e,"__esModule",{value:!0});const r=i(438),o=i(694);class s extends o.ClientBase{constructor(){super(...arguments),this.baseUrl="https://ergast.com/api/f1"}GetSchedule(t){return n(this,void 0,void 0,(function*(){return(yield this.GetData(`${t}.json`,!0,72)).MRData.RaceTable.Races}))}GetLastResult(){return n(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 n(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 n(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 n(this,void 0,void 0,(function*(){return(yield this.GetData(`${t}/${e}/sprint.json`,!1,0)).MRData.RaceTable}))}GetQualifyingResults(t,e){return n(this,void 0,void 0,(function*(){return(yield this.GetData(`${t}/${e}/qualifying.json`,!1,0)).MRData.RaceTable}))}GetResults(t,e){return n(this,void 0,void 0,(function*(){return(yield this.GetData(`${t}/${e}/results.json`,!1,0)).MRData.RaceTable}))}GetSeasons(){return n(this,void 0,void 0,(function*(){return(yield this.GetData("seasons.json?limit=200",!0,72)).MRData.SeasonTable.Seasons}))}GetSeasonRaces(t){return n(this,void 0,void 0,(function*(){return(yield this.GetData(`${t}.json`,!0,72)).MRData.RaceTable.Races}))}GetLastYearsResults(t){return n(this,void 0,void 0,(function*(){const e=(new Date).getFullYear()-1,i=(yield this.GetData(`${e}.json`,!0,72)).MRData.RaceTable.Races.findIndex((e=>e.Circuit.circuitName===t))+1;return(yield this.GetData(`${e}/${i}/results.json`,!1,0)).MRData.RaceTable.Races[0]}))}RefreshCache(){return n(this,void 0,void 0,(function*(){yield this.GetData("current.json",!0,0),yield this.GetData("current/last/results.json",!0,0),yield this.GetData("current/driverStandings.json",!0,0),yield this.GetData("current/constructorStandings.json",!0,0)}))}}e.default=s},661:(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),i=new Date;if(i.setHours(i.getHours()-672),new Date(t.created)>i)return t.data}return fetch(t).then((t=>t.blob())).then((e=>{const i=new FileReader;i.readAsDataURL(e),i.onloadend=function(){const e={data:i.result,created:new Date};return localStorage.setItem(t,JSON.stringify(e)),e.data}})),t}}},959:function(t,e,i){var n=this&&this.__awaiter||function(t,e,i,n){return new(i||(i=Promise))((function(r,o){function s(t){try{l(n.next(t))}catch(t){o(t)}}function a(t){try{l(n.throw(t))}catch(t){o(t)}}function l(t){var e;t.done?r(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(s,a)}l((n=n.apply(t,e||[])).next())}))};Object.defineProperty(e,"__esModule",{value:!0});const r=i(694);class o extends r.ClientBase{constructor(){super(...arguments),this.baseUrl="https://restcountries.com/v2"}GetAll(){return n(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},267:function(t,e,i){var n=this&&this.__awaiter||function(t,e,i,n){return new(i||(i=Promise))((function(r,o){function s(t){try{l(n.next(t))}catch(t){o(t)}}function a(t){try{l(n.throw(t))}catch(t){o(t)}}function l(t){var e;t.done?r(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(s,a)}l((n=n.apply(t,e||[])).next())}))};Object.defineProperty(e,"__esModule",{value:!0});const r=i(694);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,i){return n(this,void 0,void 0,(function*(){const n=`${t},${e}/${i}?unitGroup=${this.unitGroup}&key=${this.apiKey}&contentType=json`;return yield this.GetData(n,!0,1)}))}}e.default=o},366:(t,e,i)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.BaseCard=void 0;const n=i(470),r=i(661),o=i(267);e.BaseCard=class{constructor(t){var e,i;this.config=t.config,this.client=new n.default,this.hass=t._hass,this.parent=t,this.weatherClient=new o.default(null!==(i=null===(e=this.config.weather_options)||void 0===e?void 0:e.api_key)&&void 0!==i?i:""),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 i=null===(t=this.parent.properties)||void 0===t?void 0:t.get("cardValues");return{races:null==i?void 0:i.races,selectedRace:null==i?void 0:i.selectedRace,selectedSeason:null==i?void 0:i.selectedSeason,selectedTabIndex:null!==(e=null==i?void 0:i.selectedTabIndex)&&void 0!==e?e:0}}getParentCardValues(){var t,e;const i=null!==(t=this.parent.properties)&&void 0!==t?t:new Map;return{properties:null!==(e=i.get("cardValues"))&&void 0!==e?e:{},cardValues:i}}}},169:(t,e,i)=>{Object.defineProperty(e,"__esModule",{value:!0});const n=i(639),r=i(557),o=i(438),s=i(366);class a extends s.BaseCard{constructor(t){super(t),this.defaultTranslations={constructor:"Constructor",points:"Pts",wins:"Wins"}}cardSize(){return 11}renderStandingRow(t){var e;return n.html`${t.position}${(null===(e=this.config.standings)||void 0===e?void 0:e.show_teamlogo)?n.html` `:""}${t.Constructor.name}${t.points}${t.wins}`}render(){return n.html`${(0,r.until)(this.client.GetConstructorStandings().then((t=>n.html`${(0,o.reduceArray)(t,this.config.row_limit).map((t=>this.renderStandingRow(t)))}
 ${this.translation("constructor")}${this.translation("points")}${this.translation("wins")}
`)).catch((()=>n.html`${(0,o.getApiErrorMessage)("standings")}`)),n.html`${(0,o.getApiLoadingMessage)()}`)}`}}e.default=a},849:function(t,e,i){var n=this&&this.__await||function(t){return this instanceof n?(this.v=t,this):new n(t)},r=this&&this.__asyncGenerator||function(t,e,i){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var r,o=i.apply(t,e||[]),s=[];return r={},a("next"),a("throw"),a("return"),r[Symbol.asyncIterator]=function(){return this},r;function a(t){o[t]&&(r[t]=function(e){return new Promise((function(i,n){s.push([t,e,i,n])>1||l(t,e)}))})}function l(t,e){try{(i=o[t](e)).value instanceof n?Promise.resolve(i.value.v).then(c,d):u(s[0][2],i)}catch(t){u(s[0][3],t)}var i}function c(t){l("next",t)}function d(t){l("throw",t)}function u(t,e){t(e),s.shift(),s.length&&l(s[0][0],s[0][1])}};Object.defineProperty(e,"__esModule",{value:!0});const o=i(639),s=i(557),a=i(438),l=i(366),c=i(810),d=i(313),u=i(22),h=i(241);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`${(0,a.renderRaceInfo)(this,t,e)}
${(0,a.renderHeader)(this,t,!0)}
`:null}countDownTillDate(t){return r(this,arguments,(function*(){for(;t>new Date;){const e=(new Date).getTime(),i=t.getTime()-e,r=Math.floor(i/864e5),o=Math.floor(i%864e5/36e5),s=Math.floor(i%36e5/6e4),a=Math.floor(i%6e4/1e3);yield yield n(`${r}${this.translation("days")} ${o}${this.translation("hours")} ${s}${this.translation("minutes")} ${a}${this.translation("seconds")} `),yield n(new Promise((t=>setTimeout(t,1e3))))}yield yield n(this.translation("racenow"))}))}render(){const t=t=>{this.hass&&this.config.actions&&t.detail.action&&(0,a.clickHandler)(this.parent,this.config,this.hass,t)};return o.html`${(0,s.until)(this.client.GetSchedule((new Date).getFullYear()).then((e=>{var i,n;const{nextRace:r,raceDateTime:s,countdownType:l}=this.getNextEvent(e);if(!r)return(0,a.getEndOfSeasonMessage)(this.translation("endofseason"));const h=this.countDownTillDate(s),m=void 0!==this.config.actions;return o.html`${Array.isArray(this.config.countdown_type)&&this.config.countdown_type.length>1?o.html``:null}

   ${r.round} : ${r.raceName}

${(0,c.asyncReplace)(h)}

${this.translation("until")} ${this.translation(l.toLowerCase())}

${this.renderHeader(r,s)}`})).catch((()=>o.html`${(0,a.getApiErrorMessage)("next race")}`)),o.html`${(0,a.getApiLoadingMessage)()}`)}`}getNextEvent(t){var e;const i=t.filter((t=>{const e=new Date(t.date+"T"+t.time);return e.setHours(e.getHours()+3),e>=new Date}))[0];let n=null,r=this.config.countdown_type;if(i){const t=this.config.countdown_type,o=[{Date:new Date(i.FirstPractice.date+"T"+i.FirstPractice.time),Type:h.CountdownType.Practice1},{Date:new Date(i.SecondPractice.date+"T"+i.SecondPractice.time),Type:h.CountdownType.Practice2},{Date:i.ThirdPractice?new Date(i.ThirdPractice.date+"T"+i.ThirdPractice.time):null,Type:h.CountdownType.Practice3},{Date:i.Sprint?new Date(i.Sprint.date+"T"+i.Sprint.time):null,Type:h.CountdownType.Sprint},{Date:new Date(i.Qualifying.date+"T"+i.Qualifying.time),Type:h.CountdownType.Qualifying},{Date:new Date(i.date+"T"+i.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];n=null==o?void 0:o.Date,r=null!==(e=null==o?void 0:o.Type)&&void 0!==e?e:r}return{nextRace:i,raceDateTime:n,countdownType:r}}}e.default=m},138:(t,e,i)=>{Object.defineProperty(e,"__esModule",{value:!0});const n=i(639),r=i(557),o=i(438),s=i(366);class a extends s.BaseCard{constructor(t){super(t),this.defaultTranslations={driver:"Driver",team:"Team",points:"Pts",wins:"Wins"}}cardSize(){return 12}renderStandingRow(t){var e,i;return n.html`${t.position}${(null===(e=this.config.standings)||void 0===e?void 0:e.show_flag)?n.html` `:""}${t.Driver.code}${(0,o.getDriverName)(t.Driver,this.config)}${(null===(i=this.config.standings)||void 0===i?void 0:i.show_team)?n.html`${(0,o.renderConstructorColumn)(this,t.Constructors[0])}`:""}${t.points}${t.wins}`}render(){return n.html`${(0,r.until)(this.client.GetDriverStandings().then((t=>{var e;return n.html`${(null===(e=this.config.standings)||void 0===e?void 0:e.show_team)?n.html``:""}${(0,o.reduceArray)(t,this.config.row_limit).map((t=>this.renderStandingRow(t)))}
 ${this.translation("driver")}${this.translation("team")}${this.translation("points")}${this.translation("wins")}
`})).catch((()=>n.html`${(0,o.getApiErrorMessage)("standings")}`)),n.html`${(0,o.getApiLoadingMessage)()}`)}`}}e.default=a},507:(t,e,i)=>{Object.defineProperty(e,"__esModule",{value:!0});const n=i(639),r=i(557),o=i(438),s=i(366);class a extends s.BaseCard{constructor(t){super(t),this.defaultTranslations={driver:"Driver",grid:"Grid",points:"Points",status:"Status"}}cardSize(){return 11}renderResultRow(t){return n.html`${t.position}${(0,o.getDriverName)(t.Driver,this.config)}${t.grid}${t.points}${t.status}`}render(){return n.html`${(0,r.until)(this.client.GetLastResult().then((t=>n.html`
${(0,o.renderHeader)(this,t)}
${(0,o.reduceArray)(t.Results,this.config.row_limit).map((t=>this.renderResultRow(t)))}
 ${this.translation("driver")}${this.translation("grid")}${this.translation("points")}${this.translation("status")}
`)).catch((()=>n.html`${(0,o.getApiErrorMessage)("last result")}`)),n.html`${(0,o.getApiLoadingMessage)()}`)}`}}e.default=a},840:(t,e,i)=>{Object.defineProperty(e,"__esModule",{value:!0});const n=i(639),r=i(557),o=i(438),s=i(366),a=i(300);class l extends s.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 n.html`${(0,r.until)(this.client.GetSchedule((new Date).getFullYear()).then((t=>{const e=this.config.next_race_delay||0,i=t.filter((t=>{const i=new Date(t.date+"T"+t.time);return i.setHours(i.getHours()+e),i>=new Date}))[0];return i?n.html`${this.config.show_raceinfo?(0,o.renderRaceInfo)(this,i):this.config.only_show_date?n.html``:null}
${(0,o.renderHeader)(this,i)}

${(0,a.formatDateNumeric)(new Date(i.date+"T"+i.time),this.hass.locale,this.config.date_locale)}

`:(0,o.getEndOfSeasonMessage)(this.translation("endofseason"))})).catch((()=>n.html`${(0,o.getApiErrorMessage)("next race")}`)),n.html`${(0,o.getApiLoadingMessage)()}`)}`}}e.default=l},74:(t,e,i)=>{Object.defineProperty(e,"__esModule",{value:!0});const n=i(639),r=i(557),o=i(438),s=i(366);class a extends s.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,i)=>i?n.html`${t.filter((t=>t.content)).length>0?n.html``:n.html``}
${this.renderHeader(i)}
${t.filter((t=>!t.hide)).map((t=>n.html``))}
${t.filter((t=>!t.hide)).find(((t,i)=>i==e)).content}
${this.translation("noresults")}
`:n.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)?n.html`${(null===(e=this.config.standings)||void 0===e?void 0:e.show_team)?n.html``:""}${(0,o.reduceArray)(t.SprintResults,this.config.row_limit).map((t=>this.renderResultRow(t,!1)))}
 ${this.translation("driver")}${this.translation("team")}${this.translation("grid")}${this.translation("points")}${this.translation("status")}
`:null}renderQualifying(t){var e;return(null==t?void 0:t.QualifyingResults)?n.html`${(null===(e=this.config.standings)||void 0===e?void 0:e.show_team)?n.html``:""}${(0,o.reduceArray)(t.QualifyingResults,this.config.row_limit).map((t=>this.renderQualifyingResultRow(t)))}
 ${this.translation("driver")}${this.translation("team")}${this.translation("q1")}${this.translation("q2")}${this.translation("q3")}
`:null}renderResults(t){var e,i;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)?n.html`${(null===(i=this.config.standings)||void 0===i?void 0:i.show_team)?n.html``:""}${(0,o.reduceArray)(t.Results,this.config.row_limit).map((t=>this.renderResultRow(t,t.position===(null==r?void 0:r.position))))}${r?n.html``:""}
 ${this.translation("driver")}${this.translation("team")}${this.translation("grid")}${this.translation("points")}${this.translation("status")}
* Fastest lap: ${r.FastestLap.Time.time}
`:null}renderResultRow(t,e){var i,r;return n.html`${t.position}${(null===(i=this.config.standings)||void 0===i?void 0:i.show_flag)?n.html` `:""}${(0,o.getDriverName)(t.Driver,this.config)}${e?" *":""}${(null===(r=this.config.standings)||void 0===r?void 0:r.show_team)?n.html`${(0,o.renderConstructorColumn)(this,t.Constructor)}`:""}${t.grid}${t.points}${t.status}`}renderQualifyingResultRow(t){var e,i;return n.html`${t.position}${(null===(e=this.config.standings)||void 0===e?void 0:e.show_flag)?n.html` `:""}${(0,o.getDriverName)(t.Driver,this.config)}${(null===(i=this.config.standings)||void 0===i?void 0:i.show_team)?n.html`${(0,o.renderConstructorColumn)(this,t.Constructor)}`:""}${t.Q1}${t.Q2}${t.Q3}`}renderHeader(t){return null==t||parseInt(t.season)<2018?null:(0,o.renderHeader)(this,t)}render(){const{races:t,selectedRace:e,selectedSeason:i,selectedTabIndex:s}=this.getProperties();void 0===i&&this.getLastResult();const a=t=>{this.setRaces(t)},l=this.renderTabs(e);return n.html`
${this.translation("seasonheader")}
${(0,r.until)(this.client.GetSeasons().then((t=>{const e=t.reverse();return n.html``})).catch((()=>n.html`${(0,o.getApiErrorMessage)("seasons")}`)),n.html`${(0,o.getApiLoadingMessage)()}`)}
${this.translation("raceheader")}
${this.renderTabsHtml(l,s,e)}`}setSelectedRace(t){const e=parseInt(t.target.value),{properties:i,cardValues:n}=this.getParentCardValues();i.selectedRound=e;const r=i.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,s])=>{var a;let l=t.Races[0];l?(l.QualifyingResults=r.Races[0].QualifyingResults,l.SprintResults=null===(a=null==o?void 0:o.Races[0])||void 0===a?void 0:a.SprintResults,i.selectedSeason=l.season):l=s.filter((t=>parseInt(t.round)==e))[0],i.selectedRace=l,n.set("cardValues",i),this.parent.properties=n}))}setRaces(t){const e=t.target.value,{properties:i,cardValues:n}=this.getParentCardValues();this.client.GetSeasonRaces(parseInt(e)).then((t=>{i.selectedSeason=e,i.selectedRace=void 0,i.races=t,n.set("cardValues",i),this.parent.properties=n}))}getUpcomingRace(t,e){const i=e.filter((e=>{const i=new Date(e.date+"T"+e.time),n=new Date(e.Qualifying.date+"T"+e.Qualifying.time),r=e.Sprint?new Date(e.Sprint.date+"T"+e.Sprint.time):null;return i>=t&&n0?i[0]:null}getLastResult(){const t=new Date;Promise.all([this.client.GetSchedule(t.getFullYear()),this.client.GetLastResult()]).then((([e,i])=>{const n=this.getUpcomingRace(t,e);let r=(new Date).getFullYear(),o=null!==n?parseInt(n.round):0,s={};null!==n?(s=n,o=parseInt(s.round),r=parseInt(s.season)):(s=i,o=parseInt(i.round),r=parseInt(i.season)),Promise.all([this.client.GetQualifyingResults(r,o),this.client.GetSprintResults(r,o),this.client.GetSeasonRaces(r)]).then((([t,e,i])=>{var n;const{properties:o,cardValues:a}=this.getParentCardValues();s.QualifyingResults=t.Races[0].QualifyingResults,s.SprintResults=null===(n=e.Races[0])||void 0===n?void 0:n.SprintResults,o.races=i,o.selectedRace=s,o.selectedSeason=r.toString(),a.set("cardValues",o),this.parent.properties=a}))}))}setSelectedTabIndex(t){const{properties:e,cardValues:i}=this.getParentCardValues();e.selectedTabIndex=t,i.set("cardValues",e),this.parent.properties=i}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,i;const n=null!==(i=null===(e=this.config.tabs_order)||void 0===e?void 0:e.map((t=>t.toLowerCase())))&&void 0!==i?i:["results","qualifying","sprint"];return n.indexOf(t)}}e.default=a},465:(t,e,i)=>{Object.defineProperty(e,"__esModule",{value:!0});const n=i(313),r=i(639),o=i(557),s=i(300),a=i(241),l=i(438),c=i(366);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 i=r.html`${(null===(e=this.config.standings)||void 0===e?void 0:e.show_flag)?r.html` `:""}${t.Location.locality}, ${t.Location.country}`;return this.config.location_clickable?r.html`${i}`:i}renderScheduleRow(t){const e=new Date(t.date+"T"+t.time),i=this.config.previous_race&&e${t.round}${t.Circuit.circuitName}${this.renderLocation(t.Circuit)}${(0,s.formatDate)(e,this.hass.locale,this.config.date_locale)}${(0,n.formatTime)(e,this.hass.locale)}`}render(){return r.html`${(0,o.until)(this.client.GetSchedule((new Date).getFullYear()).then((t=>{const e=this.config.previous_race===a.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`${(0,l.reduceArray)(e,this.config.row_limit).map((t=>this.renderScheduleRow(t)))}
 ${this.translation("race")}${this.translation("location")}${this.translation("date")}${this.translation("time")}
`:(0,l.getEndOfSeasonMessage)(this.translation("endofseason"))})).catch((()=>r.html`${(0,l.getApiErrorMessage)("schedule")}`)),r.html`${(0,l.getApiLoadingMessage)()}`)}`}}e.default=d},851:(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`},22:(t,e,i)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.actionHandler=e.actionHandlerBind=void 0;const n=i(395),r=i(313),o=i(11),s="ontouchstart"in window||navigator.maxTouchPoints>0||navigator.maxTouchPoints>0;class a extends HTMLElement{constructor(){super(),this.holdTime=500,this.held=!1,this.ripple=document.createElement("mwc-ripple")}connectedCallback(){Object.assign(this.style,{position:"absolute",width:s?"100px":"50px",height:s?"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 i=t=>{let e,i;this.held=!1,t.touches?(e=t.touches[0].pageX,i=t.touches[0].pageY):(e=t.pageX,i=t.pageY),this.timer=window.setTimeout((()=>{this.startAnimation(e,i),this.held=!0}),this.holdTime)},n=i=>{i.preventDefault(),["touchend","touchcancel"].includes(i.type)&&void 0===this.timer||(clearTimeout(this.timer),this.stopAnimation(),this.timer=void 0,this.held?(0,r.fireEvent)(t,"action",{action:"hold"}):e.hasDoubleClick?"click"===i.type&&i.detail<2||!this.dblClickTimeout?this.dblClickTimeout=window.setTimeout((()=>{this.dblClickTimeout=void 0,(0,r.fireEvent)(t,"action",{action:"tap"})}),250):(clearTimeout(this.dblClickTimeout),this.dblClickTimeout=void 0,(0,r.fireEvent)(t,"action",{action:"double_tap"})):(0,r.fireEvent)(t,"action",{action:"tap"}))};t.addEventListener("touchstart",i,{passive:!0}),t.addEventListener("touchend",n),t.addEventListener("touchcancel",n),t.addEventListener("mousedown",i,{passive:!0}),t.addEventListener("click",n),t.addEventListener("keyup",(t=>{13===t.keyCode&&n(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",a),e.actionHandlerBind=(t,e)=>{const i=(()=>{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})();i&&i.bind(t,e)},e.actionHandler=(0,n.directive)(class extends n.Directive{update(t,[i]){return(0,e.actionHandlerBind)(t.element,i),o.noChange}render(t){}})},750:function(t,e,i){var n=this&&this.__decorate||function(t,e,i,n){var r,o=arguments.length,s=o<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,i,n);else for(var a=t.length-1;a>=0;a--)(r=t[a])&&(s=(o<3?r(s):o>3?r(e,i,s):r(e,i))||s);return o>3&&s&&Object.defineProperty(e,i,s),s};Object.defineProperty(e,"__esModule",{value:!0}),e.FormulaOneCardEditor=void 0;const r=i(639),o=i(851),s=i(241),a=i(898),l=i(194),c=i(429),d=i(11);let u=class extends a.default{render(){return this._hass&&this._config?this.renderForm([{controls:[{label:"Card Type (Required)",configValue:"card_type",type:l.FormControlType.Dropdown,items:(0,c.getDropdownOptionsFromEnum)(s.FormulaOneCardType)}]},{controls:[{label:"Title",configValue:"title",type:l.FormControlType.Textbox}]},{label:"Basic configuration",cssClass:"side-by-side",controls:[{label:"Use F1 font",configValue:"f1_font",type:l.FormControlType.Switch},{label:"Image clickable",configValue:"image_clickable",type:l.FormControlType.Switch},{label:"Show carnumber",configValue:"show_carnumber",type:l.FormControlType.Switch},{label:"Location clickable",configValue:"location_clickable",type:l.FormControlType.Switch},{label:"Show race information",configValue:"show_raceinfo",type:l.FormControlType.Switch},{label:"Hide track layout",configValue:"hide_tracklayout",type:l.FormControlType.Switch},{label:"Hide race dates and times",configValue:"hide_racedatetimes",type:l.FormControlType.Switch},{label:"Show last years result",configValue:"show_lastyears_result",type:l.FormControlType.Switch},{label:"Only show date",configValue:"only_show_date",type:l.FormControlType.Switch},{type:l.FormControlType.Filler},{label:"Row limit",configValue:"row_limit",type:l.FormControlType.Textbox},{label:"Date locale",configValue:"date_locale",type:l.FormControlType.Textbox}]},{label:"Countdown Type",hidden:this._config.card_type!==s.FormulaOneCardType.Countdown,cssClass:"side-by-side",controls:[{configValue:"countdown_type",type:l.FormControlType.Checkboxes,items:(0,c.getDropdownOptionsFromEnum)(s.CountdownType)}]},{hidden:this._config.card_type!==s.FormulaOneCardType.NextRace,controls:[{label:"Next race delay",configValue:"next_race_delay",type:l.FormControlType.Textbox}]},{hidden:this._config.card_type!==s.FormulaOneCardType.Schedule,controls:[{label:"Previous race",configValue:"previous_race",type:l.FormControlType.Dropdown,items:(0,c.getDropdownOptionsFromEnum)(s.PreviousRaceDisplay)}]},{label:"Standings",hidden:this._config.card_type!==s.FormulaOneCardType.ConstructorStandings&&this._config.card_type!==s.FormulaOneCardType.DriverStandings,cssClass:"side-by-side",controls:[{label:"Show team",configValue:"standings.show_team",type:l.FormControlType.Switch},{label:"Show flag",configValue:"standings.show_flag",type:l.FormControlType.Switch},{label:"Show teamlogo",configValue:"standings.show_teamlogo",type:l.FormControlType.Switch}]},{label:"Weather",hidden:this._config.card_type!==s.FormulaOneCardType.NextRace&&this._config.card_type!==s.FormulaOneCardType.Countdown,controls:[{label:"Show weather",configValue:"show_weather",type:l.FormControlType.Switch}]},{cssClass:"side-by-side",hidden:this._config.card_type!==s.FormulaOneCardType.NextRace&&this._config.card_type!==s.FormulaOneCardType.Countdown||!this._config.show_weather,controls:[{label:"API key",configValue:"weather_options.api_key",type:l.FormControlType.Textbox},{label:"Unit",configValue:"weather_options.unit",type:l.FormControlType.Dropdown,items:(0,c.getDropdownOptionsFromEnum)(s.WeatherUnit)},{label:"Show icon",configValue:"weather_options.show_icon",type:l.FormControlType.Switch},{label:"Show precipitation",configValue:"weather_options.show_precipitation",type:l.FormControlType.Switch},{label:"Show wind",configValue:"weather_options.show_wind",type:l.FormControlType.Switch},{label:"Show temperature",configValue:"weather_options.show_temperature",type:l.FormControlType.Switch},{label:"Show cloud coverage",configValue:"weather_options.show_cloud_cover",type:l.FormControlType.Switch},{label:"Show visibility",configValue:"weather_options.show_visibility",type:l.FormControlType.Switch}]},{label:"Tabs",hidden:this._config.card_type!==s.FormulaOneCardType.Results,controls:[{label:"Tabs order",configValue:"tabs_order",type:l.FormControlType.Textbox}]}]):r.html``}static get styles(){return d.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%}}`}};u=n([(0,d.customElement)(o.CARD_EDITOR_NAME)],u),e.FormulaOneCardEditor=u},657:(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()}}},148:function(t,e,i){var n=this&&this.__decorate||function(t,e,i,n){var r,o=arguments.length,s=o<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,i,n);else for(var a=t.length-1;a>=0;a--)(r=t[a])&&(s=(o<3?r(s):o>3?r(e,i,s):r(e,i))||s);return o>3&&s&&Object.defineProperty(e,i,s),s},r=this&&this.__awaiter||function(t,e,i,n){return new(i||(i=Promise))((function(r,o){function s(t){try{l(n.next(t))}catch(t){o(t)}}function a(t){try{l(n.throw(t))}catch(t){o(t)}}function l(t){var e;t.done?r(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(s,a)}l((n=n.apply(t,e||[])).next())}))};Object.defineProperty(e,"__esModule",{value:!0});const o=i(147),s=i(15),a=i(241),l=i(110),c=i(438),d=i(657),u=i(278),h=i(169),m=i(138),p=i(465),f=i(840),g=i(507),v=i(849),y=i(74),_=i(959),$=i(851);console.info(`%c ${$.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 b=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((()=>i(750))),document.createElement($.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 a.FormulaOneCardType.ConstructorStandings:this.card=new h.default(this);break;case a.FormulaOneCardType.DriverStandings:this.card=new m.default(this);break;case a.FormulaOneCardType.Schedule:this.card=new p.default(this);break;case a.FormulaOneCardType.NextRace:this.card=new f.default(this);break;case a.FormulaOneCardType.LastResult:this.card=new g.default(this);break;case a.FormulaOneCardType.Countdown:this.card=new v.default(this);break;case a.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`${this.renderRefreshButton()} ${this.warning?l.html`${this.warning}`:""} ${this.config.title?l.html`

${this.config.title}

`:""} ${this.card.render()}
`}catch(t){return l.html`${t.toString()}`}}getCardSize(){return this.card.cardSize()}renderRefreshButton(){return this.config.show_refresh?l.html`
`:null}refreshCache(t){console.log("Refreshing cache..."),this.card.client.RefreshCache()}};n([(0,s.property)()],b.prototype,"_hass",void 0),n([(0,s.property)()],b.prototype,"config",void 0),n([(0,s.property)()],b.prototype,"card",void 0),n([(0,s.property)()],b.prototype,"warning",void 0),n([(0,s.property)()],b.prototype,"properties",null),b=n([(0,s.customElement)($.CARD_NAME)],b),e.default=b},198:(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"}},300:(t,e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.formatDateNumeric=e.formatDate=void 0,e.formatDate=(t,e,i)=>new Intl.DateTimeFormat(null!=i?i:e.language,{month:"2-digit",day:"2-digit"}).format(t),e.formatDateNumeric=(t,e,i)=>new Intl.DateTimeFormat(null!=i?i:e.language,{year:"2-digit",month:"2-digit",day:"2-digit"}).format(t)},141:(t,e,i)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.formatDateTimeRaceInfo=e.formatDateTime=void 0;const n=i(975);e.formatDateTime=(t,e)=>new Intl.DateTimeFormat(e.language,{year:"numeric",month:"long",day:"numeric",hour:(0,n.useAmPm)(e)?"numeric":"2-digit",minute:"2-digit",hour12:(0,n.useAmPm)(e)}).format(t),e.formatDateTimeRaceInfo=(t,e)=>new Intl.DateTimeFormat(e.language,{weekday:"short",hour:"2-digit",minute:"2-digit",hour12:(0,n.useAmPm)(e)}).format(t)},975:(t,e,i)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.useAmPm=void 0;const n=i(198);e.useAmPm=t=>{if(t.time_format===n.TimeFormat.language||t.time_format===n.TimeFormat.system){const e=t.time_format===n.TimeFormat.language?t.language:void 0,i=(new Date).toLocaleString(e);return i.includes("AM")||i.includes("PM")}return t.time_format===n.TimeFormat.am_pm}},278:(t,e,i)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.styles=void 0;const n=i(110);e.styles=n.css`table{width:100%;border-spacing:0;border-collapse:separate;padding:0 16px 16px}table.nopadding{padding:0;width:100%;border-spacing:0;border-collapse:separate}th{background-color:var(--table-row-alternative-background-color,#eee)}td,th{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:#fff;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%}.refresh-cache{position:absolute;right:10px;top:10px}`},241:(t,e)=>{var i,n,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",(n=e.PreviousRaceDisplay||(e.PreviousRaceDisplay={})).Strikethrough="strikethrough",n.Italic="italic",n.Hide="hide",(i=e.FormulaOneCardType||(e.FormulaOneCardType={})).DriverStandings="driver_standings",i.ConstructorStandings="constructor_standings",i.NextRace="next_race",i.Schedule="schedule",i.LastResult="last_result",i.Results="results",i.Countdown="countdown"},438:(t,e,i)=>{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 n=i(110),r=i(241),o=i(141),s=i(313),a=i(300),l=i(198),c=i(22),d=i(959),u=i(557);e.hasConfigOrCardValuesChanged=(t,e)=>{if(e.has("config"))return!0;const i=e.get("card");if(i&&i.parent)return i.parent.properties!==t.properties;const n=e.get("cardValues");return!!n&&n!=t.properties},e.getCountries=()=>(new d.default).GetCountriesFromLocalStorage(),e.getCountryFlagByNationality=(t,i)=>{const n=(0,e.getCountries)().filter((t=>t.demonym==i));return n.length>1?t.imageClient.GetImage(n.sort(((t,e)=>t.population>e.population?-1:1))[0].flags.png):t.imageClient.GetImage(n[0].flags.png)},e.getCountryFlagByName=(t,i)=>{const n=(0,e.getCountries)().filter((t=>{var e;return t.name==i||t.nativeName==i||(null===(e=t.altSpellings)||void 0===e?void 0:e.includes(i))}))[0];return t.imageClient.GetImage(n.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 i=[{teamName:"red-bull",corrected:"red-bull-racing"},{teamName:"alfa",corrected:"alfa-romeo"},{teamName:"haas",corrected:"haas-f1-team"},{teamName:"sauber",corrected:"kick-sauber"}].filter((t=>t.teamName==e));return i.length>0&&(e=i[0].corrected),t.imageClient.GetImage(`${l.ImageConstants.TeamLogoCDN}/2024/${e.toLowerCase()}-logo.png.transform/2col-retina/image.png`)},e.getCircuitName=t=>{let e=t.country.replace(" ","-");const i=[{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 i.length>0&&(e=i[0].name),"USA"!=t.country&&"United States"!=t.country||"Austin"==t.locality||(e=t.locality.replace(" ","_")),"Italy"==t.country&&"Imola"==t.locality&&(e="Emilia_Romagna"),e},e.getDriverName=(t,e)=>{const i="VER"==t.code?1:t.permanentNumber;return`${t.givenName} ${t.familyName}${e.show_carnumber?` #${i}`:""}`},e.getApiErrorMessage=t=>n.html`
Error getting ${t}
`,e.getApiLoadingMessage=()=>n.html`
Loading...
`,e.getEndOfSeasonMessage=t=>n.html`
${t}
`,e.clickHandler=(t,e,i,n)=>{(0,s.handleAction)(t,i,e.actions,n.detail.action)},e.renderHeader=(t,i,o=!1)=>{var a,d;const u=(0,e.getCircuitName)(i.Circuit.Location),h=t.config.image_clickable||void 0!==t.config.actions,m=i.Circuit.url;t.config.image_clickable&&!t.config.actions&&(t.config.actions={tap_action:{action:"url",url_path:m}});const p=n.html``,f=n.html`

  ${i.round} : ${i.raceName}

`;return n.html`${t.config.card_type==r.FormulaOneCardType.Countdown?n.html``:f} ${t.config.hide_tracklayout?n.html``:p}
`},e.renderRaceInfo=(t,i,r)=>{var s;const l=t.config,c=t.hass;if(l.hide_racedatetimes)return n.html``;const d=l.show_weather&&void 0!==(null===(s=l.weather_options)||void 0===s?void 0:s.api_key)?t.weatherClient.getWeatherData(i.Circuit.Location.lat,i.Circuit.Location.long,`${i.date}T${i.time}`):Promise.resolve(null),h=l.show_lastyears_result?t.client.GetLastYearsResults(i.Circuit.circuitName):Promise.resolve(null),m=Promise.all([d,h]);return n.html`${(0,u.until)(m.then((([s,d])=>{const u=null==s?void 0:s.days[0],h=new Date(i.date+"T"+i.time),m=(0,e.renderWeatherInfo)(u,l,null!=r?r:h),p=(0,e.renderLastYearsResults)(l,d),f=(0,o.formatDateTimeRaceInfo)(new Date(i.FirstPractice.date+"T"+i.FirstPractice.time),c.locale),g=(0,o.formatDateTimeRaceInfo)(new Date(i.SecondPractice.date+"T"+i.SecondPractice.time),c.locale),v=void 0!==i.ThirdPractice?(0,o.formatDateTimeRaceInfo)(new Date(i.ThirdPractice.date+"T"+i.ThirdPractice.time),c.locale):"-",y=(0,o.formatDateTimeRaceInfo)(h,c.locale),_=(0,o.formatDateTimeRaceInfo)(new Date(i.Qualifying.date+"T"+i.Qualifying.time),c.locale),$=void 0!==i.Sprint?(0,o.formatDateTimeRaceInfo)(new Date(i.Sprint.date+"T"+i.Sprint.time),c.locale):"-";return n.html`${p}${m}${t.translation("date")}${(0,a.formatDateNumeric)(h,c.locale,l.date_locale)} ${t.translation("practice1")}${f}${t.translation("race")}${i.round} ${t.translation("practice2")}${g}${t.translation("racename")}${i.raceName} ${t.translation("practice3")}${v}${t.translation("circuitname")}${i.Circuit.circuitName} ${t.translation("qualifying")}${_}${t.translation("location")}${i.Circuit.Location.country} ${t.translation("sprint")}${$}${t.translation("city")}${i.Circuit.Location.locality} ${t.translation("racetime")}${y}`})))}`},e.renderLastYearsResults=(t,e)=>{var i,r;if(!e)return n.html``;const o=e.Results?e.Results[0]:null,s=null===(i=e.Results)||void 0===i?void 0:i.filter((t=>{var e;return"1"===(null===(e=t.FastestLap)||void 0===e?void 0:e.rank)}))[0];return n.html`

${new Date(e.date).getFullYear()}

${null==o?void 0:o.Driver.givenName} ${null==o?void 0:o.Driver.familyName} (${null==o?void 0:o.Constructor.name})

${null==s?void 0:s.Driver.givenName} ${null==s?void 0:s.Driver.familyName} (${null===(r=null==s?void 0:s.FastestLap)||void 0===r?void 0:r.Time.time})

 `},e.renderWeatherInfo=(t,i,o)=>{var s,a;if(!t)return n.html``;const l=(null===(s=i.weather_options)||void 0===s?void 0:s.unit)===r.WeatherUnit.Metric?"km/h":"mph",c=(null===(a=i.weather_options)||void 0===a?void 0:a.unit)===r.WeatherUnit.MilesFahrenheit?"°F":"°C",d=t.hours?t.hours[o.getHours()]:t;return n.html`
${(0,e.calculateWindDirection)(d.winddir)} ${d.windspeed} ${l}${d.precip} mm${d.precipprob}%
${d.cloudcover} %${d.temp} ${c}${d.feelslike} ${c}
 `},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:i,range:n}of e)if(t>=n[0]&&t<=n[1])return i},e.getRefreshTime=t=>{let e=24;const i=new Date,n=localStorage.getItem(`${i.getFullYear()}.json`);if(n){const r=JSON.parse(n),o=JSON.parse(r.data).MRData.RaceTable.Races.filter((t=>new Date(t.date).toLocaleDateString==i.toLocaleDateString));if(o.length>0){const i=o[0],n=new Date(i.date+"T"+i.time),r=localStorage.getItem(t);if(r){const t=JSON.parse(r);new Date(t.created)void 0===t?[]:e?t.slice(0,e):t,e.renderConstructorColumn=(t,i)=>n.html`${t.config.standings.show_teamlogo?n.html` `:""}${i.name}`},11:(t,e,i)=>{i.r(e),i.d(e,{CSSResult:()=>a,LitElement:()=>S,ReactiveElement:()=>$,UpdatingElement:()=>A,_$LE:()=>E,_$LH:()=>C._$LH,adoptStyles:()=>d,css:()=>c,customElement:()=>k,decorateProperty:()=>R,defaultConverter:()=>v,eventOptions:()=>M,getCompatibleStyle:()=>u,html:()=>C.html,legacyPrototypeMethod:()=>D,noChange:()=>C.noChange,notEqual:()=>y,nothing:()=>C.nothing,property:()=>P,query:()=>F,queryAll:()=>I,queryAssignedElements:()=>j,queryAssignedNodes:()=>V,queryAsync:()=>L,render:()=>C.render,standardPrototypeMethod:()=>x,state:()=>N,supportsAdoptingStyleSheets:()=>r,svg:()=>C.svg,unsafeCSS:()=>l});const n=window,r=n.ShadowRoot&&(void 0===n.ShadyCSS||n.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,o=Symbol(),s=new WeakMap;class a{constructor(t,e,i){if(this._$cssResult$=!0,i!==o)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=t,this.t=e}get styleSheet(){let t=this.o;const e=this.t;if(r&&void 0===t){const i=void 0!==e&&1===e.length;i&&(t=s.get(e)),void 0===t&&((this.o=t=new CSSStyleSheet).replaceSync(this.cssText),i&&s.set(e,t))}return t}toString(){return this.cssText}}const l=t=>new a("string"==typeof t?t:t+"",void 0,o),c=(t,...e)=>{const i=1===t.length?t[0]:e.reduce(((e,i,n)=>e+(t=>{if(!0===t._$cssResult$)return t.cssText;if("number"==typeof t)return t;throw Error("Value passed to 'css' function must be a 'css' function result: "+t+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(i)+t[n+1]),t[0]);return new a(i,t,o)},d=(t,e)=>{r?t.adoptedStyleSheets=e.map((t=>t instanceof CSSStyleSheet?t:t.styleSheet)):e.forEach((e=>{const i=document.createElement("style"),r=n.litNonce;void 0!==r&&i.setAttribute("nonce",r),i.textContent=e.cssText,t.appendChild(i)}))},u=r?t=>t:t=>t instanceof CSSStyleSheet?(t=>{let e="";for(const i of t.cssRules)e+=i.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 i=t;switch(e){case Boolean:i=null!==t;break;case Number:i=null===t?null:Number(t);break;case Object:case Array:try{i=JSON.parse(t)}catch(t){i=null}}return i}},y=(t,e)=>e!==t&&(e==e||t==t),_={attribute:!0,type:String,converter:v,reflect:!1,hasChanged:y};class $ extends HTMLElement{constructor(){super(),this._$Ei=new Map,this.isUpdatePending=!1,this.hasUpdated=!1,this._$El=null,this.u()}static addInitializer(t){var e;this.finalize(),(null!==(e=this.h)&&void 0!==e?e:this.h=[]).push(t)}static get observedAttributes(){this.finalize();const t=[];return this.elementProperties.forEach(((e,i)=>{const n=this._$Ep(i,e);void 0!==n&&(this._$Ev.set(n,i),t.push(n))})),t}static createProperty(t,e=_){if(e.state&&(e.attribute=!1),this.finalize(),this.elementProperties.set(t,e),!e.noAccessor&&!this.prototype.hasOwnProperty(t)){const i="symbol"==typeof t?Symbol():"__"+t,n=this.getPropertyDescriptor(t,i,e);void 0!==n&&Object.defineProperty(this.prototype,t,n)}}static getPropertyDescriptor(t,e,i){return{get(){return this[e]},set(n){const r=this[t];this[e]=n,this.requestUpdate(t,r,i)},configurable:!0,enumerable:!0}}static getPropertyOptions(t){return this.elementProperties.get(t)||_}static finalize(){if(this.hasOwnProperty("finalized"))return!1;this.finalized=!0;const t=Object.getPrototypeOf(this);if(t.finalize(),void 0!==t.h&&(this.h=[...t.h]),this.elementProperties=new Map(t.elementProperties),this._$Ev=new Map,this.hasOwnProperty("properties")){const t=this.properties,e=[...Object.getOwnPropertyNames(t),...Object.getOwnPropertySymbols(t)];for(const i of e)this.createProperty(i,t[i])}return this.elementStyles=this.finalizeStyles(this.styles),!0}static finalizeStyles(t){const e=[];if(Array.isArray(t)){const i=new Set(t.flat(1/0).reverse());for(const t of i)e.unshift(u(t))}else void 0!==t&&e.push(u(t));return e}static _$Ep(t,e){const i=e.attribute;return!1===i?void 0:"string"==typeof i?i:"string"==typeof t?t.toLowerCase():void 0}u(){var t;this._$E_=new Promise((t=>this.enableUpdating=t)),this._$AL=new Map,this._$Eg(),this.requestUpdate(),null===(t=this.constructor.h)||void 0===t||t.forEach((t=>t(this)))}addController(t){var e,i;(null!==(e=this._$ES)&&void 0!==e?e:this._$ES=[]).push(t),void 0!==this.renderRoot&&this.isConnected&&(null===(i=t.hostConnected)||void 0===i||i.call(t))}removeController(t){var e;null===(e=this._$ES)||void 0===e||e.splice(this._$ES.indexOf(t)>>>0,1)}_$Eg(){this.constructor.elementProperties.forEach(((t,e)=>{this.hasOwnProperty(e)&&(this._$Ei.set(e,this[e]),delete this[e])}))}createRenderRoot(){var t;const e=null!==(t=this.shadowRoot)&&void 0!==t?t:this.attachShadow(this.constructor.shadowRootOptions);return 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,i){this._$AK(t,i)}_$EO(t,e,i=_){var n;const r=this.constructor._$Ep(t,i);if(void 0!==r&&!0===i.reflect){const o=(void 0!==(null===(n=i.converter)||void 0===n?void 0:n.toAttribute)?i.converter:v).toAttribute(e,i.type);this._$El=t,null==o?this.removeAttribute(r):this.setAttribute(r,o),this._$El=null}}_$AK(t,e){var i;const n=this.constructor,r=n._$Ev.get(t);if(void 0!==r&&this._$El!==r){const t=n.getPropertyOptions(r),o="function"==typeof t.converter?{fromAttribute:t.converter}:void 0!==(null===(i=t.converter)||void 0===i?void 0:i.fromAttribute)?t.converter:v;this._$El=r,this[r]=o.fromAttribute(e,t.type),this._$El=null}}requestUpdate(t,e,i){let n=!0;void 0!==t&&(((i=i||this.constructor.getPropertyOptions(t)).hasChanged||y)(this[t],e)?(this._$AL.has(t)||this._$AL.set(t,e),!0===i.reflect&&this._$El!==t&&(void 0===this._$EC&&(this._$EC=new Map),this._$EC.set(t,i))):n=!1),!this.isUpdatePending&&n&&(this._$E_=this._$Ej())}async _$Ej(){this.isUpdatePending=!0;try{await this._$E_}catch(t){Promise.reject(t)}const t=this.scheduleUpdate();return null!=t&&await t,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){var t;if(!this.isUpdatePending)return;this.hasUpdated,this._$Ei&&(this._$Ei.forEach(((t,e)=>this[e]=t)),this._$Ei=void 0);let e=!1;const i=this._$AL;try{e=this.shouldUpdate(i),e?(this.willUpdate(i),null===(t=this._$ES)||void 0===t||t.forEach((t=>{var e;return null===(e=t.hostUpdate)||void 0===e?void 0:e.call(t)})),this.update(i)):this._$Ek()}catch(t){throw e=!1,this._$Ek(),t}e&&this._$AE(i)}willUpdate(t){}_$AE(t){var e;null===(e=this._$ES)||void 0===e||e.forEach((t=>{var e;return null===(e=t.hostUpdated)||void 0===e?void 0:e.call(t)})),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(t)),this.updated(t)}_$Ek(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$E_}shouldUpdate(t){return!0}update(t){void 0!==this._$EC&&(this._$EC.forEach(((t,e)=>this._$EO(e,this[e],t))),this._$EC=void 0),this._$Ek()}updated(t){}firstUpdated(t){}}$.finalized=!0,$.elementProperties=new Map,$.elementStyles=[],$.shadowRootOptions={mode:"open"},null==g||g({ReactiveElement:$}),(null!==(h=m.reactiveElementVersions)&&void 0!==h?h:m.reactiveElementVersions=[]).push("1.6.1");var b,w,C=i(639);const A=$;class S extends ${constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){var t,e;const i=super.createRenderRoot();return null!==(t=(e=this.renderOptions).renderBefore)&&void 0!==t||(e.renderBefore=i.firstChild),i}update(t){const e=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(t),this._$Do=(0,C.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 C.noChange}}S.finalized=!0,S._$litElement$=!0,null===(b=globalThis.litElementHydrateSupport)||void 0===b||b.call(globalThis,{LitElement:S});const T=globalThis.litElementPolyfillSupport;null==T||T({LitElement:S});const E={_$AK:(t,e,i)=>{t._$AK(e,i)},_$AL:t=>t._$AL};(null!==(w=globalThis.litElementVersions)&&void 0!==w?w:globalThis.litElementVersions=[]).push("3.3.3");const D=(t,e,i)=>{Object.defineProperty(e,i,t)},x=(t,e)=>({kind:"method",placement:"prototype",key:e.key,descriptor:t}),R=({finisher:t,descriptor:e})=>(i,n)=>{var r;if(void 0===n){const n=null!==(r=i.originalKey)&&void 0!==r?r:i.key,o=null!=e?{kind:"method",placement:"prototype",key:n,descriptor:e(i.key)}:{...i,key:n};return null!=t&&(o.finisher=function(e){t(e,n)}),o}{const r=i.constructor;void 0!==e&&Object.defineProperty(i,n,e(n)),null==t||t(r,n)}},k=t=>e=>"function"==typeof e?((t,e)=>(customElements.define(t,e),e))(t,e):((t,e)=>{const{kind:i,elements:n}=e;return{kind:i,elements:n,finisher(e){customElements.define(t,e)}}})(t,e),O=(t,e)=>"method"===e.kind&&e.descriptor&&!("value"in e.descriptor)?{...e,finisher(i){i.createProperty(e.key,t)}}:{kind:"field",key:Symbol(),placement:"own",descriptor:{},originalKey:e.key,initializer(){"function"==typeof e.initializer&&(this[e.key]=e.initializer.call(this))},finisher(i){i.createProperty(e.key,t)}};function P(t){return(e,i)=>void 0!==i?((t,e,i)=>{e.constructor.createProperty(i,t)})(t,e,i):O(t,e)}function N(t){return P({...t,state:!0})}function M(t){return R({finisher:(e,i)=>{Object.assign(e.prototype[i],t)}})}function F(t,e){return R({descriptor:i=>{const n={get(){var e,i;return null!==(i=null===(e=this.renderRoot)||void 0===e?void 0:e.querySelector(t))&&void 0!==i?i:null},enumerable:!0,configurable:!0};if(e){const e="symbol"==typeof i?Symbol():"__"+i;n.get=function(){var i,n;return void 0===this[e]&&(this[e]=null!==(n=null===(i=this.renderRoot)||void 0===i?void 0:i.querySelector(t))&&void 0!==n?n:null),this[e]}}return n}})}function I(t){return R({descriptor:e=>({get(){var e,i;return null!==(i=null===(e=this.renderRoot)||void 0===e?void 0:e.querySelectorAll(t))&&void 0!==i?i:[]},enumerable:!0,configurable:!0})})}function L(t){return R({descriptor:e=>({async get(){var e;return await this.updateComplete,null===(e=this.renderRoot)||void 0===e?void 0:e.querySelector(t)},enumerable:!0,configurable:!0})})}var H;const U=null!=(null===(H=window.HTMLSlotElement)||void 0===H?void 0:H.prototype.assignedElements)?(t,e)=>t.assignedElements(e):(t,e)=>t.assignedNodes(e).filter((t=>t.nodeType===Node.ELEMENT_NODE));function j(t){const{slot:e,selector:i}=null!=t?t:{};return R({descriptor:n=>({get(){var n;const r="slot"+(e?`[name=${e}]`:":not([name])"),o=null===(n=this.renderRoot)||void 0===n?void 0:n.querySelector(r),s=null!=o?U(o,t):[];return i?s.filter((t=>t.matches(i))):s},enumerable:!0,configurable:!0})})}function V(t,e,i){let n,r=t;return"object"==typeof t?(r=t.slot,n=t):n={flatten:e},i?j({slot:r,flatten:e,selector:i}):R({descriptor:t=>({get(){var t,e;const i="slot"+(r?`[name=${r}]`:":not([name])"),o=null===(t=this.renderRoot)||void 0===t?void 0:t.querySelector(i);return null!==(e=null==o?void 0:o.assignedNodes(n))&&void 0!==e?e:[]},enumerable:!0,configurable:!0})})}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.")},557:(t,e,i)=>{i.r(e),i.d(e,{UntilDirective:()=>v,until:()=>y});var n=i(639);const{I:r}=n._$LH;class o{constructor(t){}get _$AU(){return this._$AM._$AU}_$AT(t,e,i){this._$Ct=t,this._$AM=e,this._$Ci=i}_$AS(t,e){return this.update(t,e)}update(t,e){return this.render(...e)}}const s=(t,e)=>{var i,n;const r=t._$AN;if(void 0===r)return!1;for(const t of r)null===(n=(i=t)._$AO)||void 0===n||n.call(i,e,!1),s(t,e);return!0},a=t=>{let e,i;do{if(void 0===(e=t._$AM))break;i=e._$AN,i.delete(t),t=e}while(0===(null==i?void 0:i.size))},l=t=>{for(let e;e=t._$AM;t=e){let i=e._$AN;if(void 0===i)e._$AN=i=new Set;else if(i.has(t))break;i.add(t),u(e)}};function c(t){void 0!==this._$AN?(a(this),this._$AM=t,l(this)):this._$AM=t}function d(t,e=!1,i=0){const n=this._$AH,r=this._$AN;if(void 0!==r&&0!==r.size)if(e)if(Array.isArray(n))for(let t=i;t{var e,i,n,r;2==t.type&&(null!==(e=(n=t)._$AP)&&void 0!==e||(n._$AP=d),null!==(i=(r=t)._$AQ)&&void 0!==i||(r._$AQ=c))};class h extends o{constructor(){super(...arguments),this._$AN=void 0}_$AT(t,e,i){super._$AT(t,e,i),l(this),this.isConnected=t._$AU}_$AO(t,e=!0){var i,n;t!==this.isConnected&&(this.isConnected=t,t?null===(i=this.reconnected)||void 0===i||i.call(this):null===(n=this.disconnected)||void 0===n||n.call(this)),e&&(s(this,t),a(this))}setValue(t){if((t=>void 0===this._$Ct.strings)())this._$Ct._$AI(t,this);else{const e=[...this._$Ct._$AH];e[this._$Ci]=t,this._$Ct._$AI(e,this,0)}}disconnected(){}reconnected(){}}class m{constructor(t){this.G=t}disconnect(){this.G=void 0}reconnect(t){this.G=t}deref(){return this.G}}class p{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}}const f=t=>!(t=>null===t||"object"!=typeof t&&"function"!=typeof t)(t)&&"function"==typeof t.then,g=1073741823;class v extends h{constructor(){super(...arguments),this._$C_t=g,this._$Cwt=[],this._$Cq=new m(this),this._$CK=new p}render(...t){var e;return null!==(e=t.find((t=>!f(t))))&&void 0!==e?e:n.noChange}update(t,e){const i=this._$Cwt;let r=i.length;this._$Cwt=e;const o=this._$Cq,s=this._$CK;this.isConnected||this.disconnected();for(let t=0;tthis._$C_t);t++){const n=e[t];if(!f(n))return this._$C_t=t,n;t{for(;s.get();)await s.get();const e=o.deref();if(void 0!==e){const i=e._$Cwt.indexOf(n);i>-1&&i({_$litDirective$:_,values:t}));var _},639:(t,e,i)=>{var n;i.r(e),i.d(e,{_$LH:()=>G,html:()=>S,noChange:()=>E,nothing:()=>D,render:()=>q,svg:()=>T});const r=window,o=r.trustedTypes,s=o?o.createPolicy("lit-html",{createHTML:t=>t}):void 0,a="$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,$=RegExp(`>|${g}(?:([^\\s"'>=/]+)(${g}*=${g}*(?:[^ \t\n\f\r"'\`<>=]|("|')|))|$)`,"g"),b=/'/g,w=/"/g,C=/^(?:script|style|textarea|title)$/i,A=t=>(e,...i)=>({_$litType$:t,strings:e,values:i}),S=A(1),T=A(2),E=Symbol.for("lit-noChange"),D=Symbol.for("lit-nothing"),x=new WeakMap,R=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!==s?s.createHTML(e):e}const O=(t,e)=>{const i=t.length-1,n=[];let r,o=2===e?"":"",s=v;for(let e=0;e"===u[0]?(s=null!=r?r:v,h=-1):void 0===u[1]?h=-2:(h=s.lastIndex-u[2].length,c=u[1],s=void 0===u[3]?$:'"'===u[3]?w:b):s===w||s===b?s=$:s===y||s===_?s=v:(s=$,r=void 0);const p=s===$&&t[e+1].startsWith("/>")?" ":"";o+=s===v?i+d:h>=0?(n.push(c),i.slice(0,h)+a+i.slice(h)+l+p):i+l+(-2===h?(n.push(void 0),e):p)}return[k(t,o+(t[i]||"")+(2===e?"":"")),n]};class P{constructor({strings:t,_$litType$:e},i){let n;this.parts=[];let r=0,s=0;const d=t.length-1,u=this.parts,[m,p]=O(t,e);if(this.el=P.createElement(m,i),R.currentNode=this.el.content,2===e){const t=this.el.content,e=t.firstChild;e.remove(),t.append(...e.childNodes)}for(;null!==(n=R.nextNode())&&u.length0){n.textContent=o?o.emptyScript:"";for(let i=0;i2||""!==i[0]||""!==i[1]?(this._$AH=Array(i.length-1).fill(new String),this.strings=i):this._$AH=D}get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}_$AI(t,e=this,i,n){const r=this.strings;let o=!1;if(void 0===r)t=N(this,t,e,0),o=!m(t)||t!==this._$AH&&t!==E,o&&(this._$AH=t);else{const n=t;let s,a;for(t=r[0],s=0;s{var n,r;const o=null!==(n=null==i?void 0:i.renderBefore)&&void 0!==n?n:e;let s=o._$litPart$;if(void 0===s){const t=null!==(r=null==i?void 0:i.renderBefore)&&void 0!==r?r:null;o._$litPart$=s=new F(e.insertBefore(h(),t),t,void 0,null!=i?i:{})}return s._$AI(t),s}},15:(t,e,i)=>{i.r(e),i.d(e,{customElement:()=>n,eventOptions:()=>c,property:()=>a,query:()=>u,queryAll:()=>m,queryAssignedElements:()=>f,queryAssignedNodes:()=>g,queryAsync:()=>p,standardProperty:()=>s,state:()=>l});const n=t=>(e,i)=>{void 0!==i?i.addInitializer((()=>{customElements.define(t,e)})):customElements.define(t,e)};var r=i(548);const o={attribute:!0,type:String,converter:r.Ts,reflect:!1,hasChanged:r.Qu},s=(t=o,e,i)=>{const{kind:n,metadata:r}=i;let s=globalThis.litPropertyMetadata.get(r);if(void 0===s&&globalThis.litPropertyMetadata.set(r,s=new Map),s.set(i.name,t),"accessor"===n){const{name:n}=i;return{set(i){const r=e.get.call(this);e.set.call(this,i),this.requestUpdate(n,r,t)},init(e){return void 0!==e&&this.C(n,void 0,t),e}}}if("setter"===n){const{name:n}=i;return function(i){const r=this[n];e.call(this,i),this.requestUpdate(n,r,t)}}throw Error("Unsupported decorator location: "+n)};function a(t){return(e,i)=>"object"==typeof i?s(t,e,i):((t,e,i)=>{const n=e.hasOwnProperty(i);return e.constructor.createProperty(i,n?{...t,wrapped:!0}:t),n?Object.getOwnPropertyDescriptor(e,i):void 0})(t,e,i)}function l(t){return a({...t,state:!0,attribute:!1})}function c(t){return(e,i)=>{const n="function"==typeof e?e:e[i];Object.assign(n,t)}}const d=(t,e,i)=>(i.configurable=!0,i.enumerable=!0,Reflect.decorate&&"object"!=typeof e&&Object.defineProperty(t,e,i),i);function u(t,e){return(i,n,r)=>{const o=e=>e.renderRoot?.querySelector(t)??null;if(e){const{get:t,set:e}="object"==typeof n?i:r??(()=>{const t=Symbol();return{get(){return this[t]},set(e){this[t]=e}}})();return d(i,n,{get(){let i=t.call(this);return void 0===i&&(i=o(this),(null!==i||this.hasUpdated)&&e.call(this,i)),i}})}return d(i,n,{get(){return o(this)}})}}let h;function m(t){return(e,i)=>d(e,i,{get(){return(this.renderRoot??(h??=document.createDocumentFragment())).querySelectorAll(t)}})}function p(t){return(e,i)=>d(e,i,{async get(){return await this.updateComplete,this.renderRoot?.querySelector(t)??null}})}function f(t){return(e,i)=>{const{slot:n,selector:r}=t??{},o="slot"+(n?`[name=${n}]`:":not([name])");return d(e,i,{get(){const e=this.renderRoot?.querySelector(o),i=e?.assignedElements(t)??[];return void 0===r?i:i.filter((t=>t.matches(r)))}})}}function g(t){return(e,i)=>{const{slot:n}=t??{},r="slot"+(n?`[name=${n}]`:":not([name])");return d(e,i,{get(){const e=this.renderRoot?.querySelector(r);return e?.assignedNodes(t)??[]}})}}},395:(t,e,i)=>{i.r(e),i.d(e,{Directive:()=>n.Xe,PartType:()=>n.pX,directive:()=>n.XM});var n=i(126)},810:(t,e,i)=>{i.r(e),i.d(e,{AsyncReplaceDirective:()=>f,asyncReplace:()=>g});var n=i(605);const{D:r}=n._$LH;var o=i(126);const s=(t,e)=>{const i=t._$AN;if(void 0===i)return!1;for(const t of i)t._$AO?.(e,!1),s(t,e);return!0},a=t=>{let e,i;do{if(void 0===(e=t._$AM))break;i=e._$AN,i.delete(t),t=e}while(0===i?.size)},l=t=>{for(let e;e=t._$AM;t=e){let i=e._$AN;if(void 0===i)e._$AN=i=new Set;else if(i.has(t))break;i.add(t),u(e)}};function c(t){void 0!==this._$AN?(a(this),this._$AM=t,l(this)):this._$AM=t}function d(t,e=!1,i=0){const n=this._$AH,r=this._$AN;if(void 0!==r&&0!==r.size)if(e)if(Array.isArray(n))for(let t=i;t{t.type==o.pX.CHILD&&(t._$AP??=d,t._$AQ??=c)};class h extends o.Xe{constructor(){super(...arguments),this._$AN=void 0}_$AT(t,e,i){super._$AT(t,e,i),l(this),this.isConnected=t._$AU}_$AO(t,e=!0){t!==this.isConnected&&(this.isConnected=t,t?this.reconnected?.():this.disconnected?.()),e&&(s(this,t),a(this))}setValue(t){if((t=>void 0===this._$Ct.strings)())this._$Ct._$AI(t,this);else{const e=[...this._$Ct._$AH];e[this._$Ci]=t,this._$Ct._$AI(e,this,0)}}disconnected(){}reconnected(){}}class m{constructor(t){this.G=t}disconnect(){this.G=void 0}reconnect(t){this.G=t}deref(){return this.G}}class p{constructor(){this.Y=void 0,this.Z=void 0}get(){return this.Y}pause(){this.Y??=new Promise((t=>this.Z=t))}resume(){this.Z?.(),this.Y=this.Z=void 0}}class f extends h{constructor(){super(...arguments),this._$Cq=new m(this),this._$CK=new p}render(t,e){return n.Jb}update(t,[e,i]){if(this.isConnected||this.disconnected(),e===this._$CX)return;this._$CX=e;let r=0;const{_$Cq:o,_$CK:s}=this;return(async(t,e)=>{for await(const i of t)if(!1===await e(i))return})(e,(async t=>{for(;s.get();)await s.get();const n=o.deref();if(void 0!==n){if(n._$CX!==e)return!1;void 0!==i&&(t=i(t,r)),n.commitValue(t,r),r++}return!0})),n.Jb}commitValue(t,e){this.setValue(t)}disconnected(){this._$Cq.disconnect(),this._$CK.pause()}reconnected(){this._$Cq.reconnect(this),this._$CK.resume()}}const g=(0,o.XM)(f)},110:(t,e,i)=>{i.r(e),i.d(e,{CSSResult:()=>n.c3,LitElement:()=>o,ReactiveElement:()=>n.fl,_$LE:()=>a,_$LH:()=>r._$LH,adoptStyles:()=>n.ec,css:()=>n.iv,defaultConverter:()=>n.Ts,getCompatibleStyle:()=>n.i1,html:()=>r.dy,isServer:()=>l,noChange:()=>r.Jb,notEqual:()=>n.Qu,nothing:()=>r.Ld,render:()=>r.sY,supportsAdoptingStyleSheets:()=>n.FV,svg:()=>r.YP,unsafeCSS:()=>n.$m});var n=i(548),r=i(605);class o extends n.fl{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){const t=super.createRenderRoot();return this.renderOptions.renderBefore??=t.firstChild,t}update(t){const e=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(t),this._$Do=(0,r.sY)(e,this.renderRoot,this.renderOptions)}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(!1)}render(){return r.Jb}}o._$litElement$=!0,o.finalized=!0,globalThis.litElementHydrateSupport?.({LitElement:o});const s=globalThis.litElementPolyfillSupport;s?.({LitElement:o});const a={_$AK:(t,e,i)=>{t._$AK(e,i)},_$AL:t=>t._$AL};(globalThis.litElementVersions??=[]).push("4.0.2");const l=!1},548:(t,e,i)=>{i.d(e,{c3:()=>a,fl:()=>T,ec:()=>d,iv:()=>c,Ts:()=>C,i1:()=>u,Qu:()=>A,FV:()=>r,$m:()=>l});const n=globalThis,r=n.ShadowRoot&&(void 0===n.ShadyCSS||n.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,o=Symbol(),s=new WeakMap;class a{constructor(t,e,i){if(this._$cssResult$=!0,i!==o)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=t,this.t=e}get styleSheet(){let t=this.o;const e=this.t;if(r&&void 0===t){const i=void 0!==e&&1===e.length;i&&(t=s.get(e)),void 0===t&&((this.o=t=new CSSStyleSheet).replaceSync(this.cssText),i&&s.set(e,t))}return t}toString(){return this.cssText}}const l=t=>new a("string"==typeof t?t:t+"",void 0,o),c=(t,...e)=>{const i=1===t.length?t[0]:e.reduce(((e,i,n)=>e+(t=>{if(!0===t._$cssResult$)return t.cssText;if("number"==typeof t)return t;throw Error("Value passed to 'css' function must be a 'css' function result: "+t+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(i)+t[n+1]),t[0]);return new a(i,t,o)},d=(t,e)=>{if(r)t.adoptedStyleSheets=e.map((t=>t instanceof CSSStyleSheet?t:t.styleSheet));else for(const i of e){const e=document.createElement("style"),r=n.litNonce;void 0!==r&&e.setAttribute("nonce",r),e.textContent=i.cssText,t.appendChild(e)}},u=r?t=>t:t=>t instanceof CSSStyleSheet?(t=>{let e="";for(const i of t.cssRules)e+=i.cssText;return l(e)})(t):t,{is:h,defineProperty:m,getOwnPropertyDescriptor:p,getOwnPropertyNames:f,getOwnPropertySymbols:g,getPrototypeOf:v}=Object,y=globalThis,_=y.trustedTypes,$=_?_.emptyScript:"",b=y.reactiveElementPolyfillSupport,w=(t,e)=>t,C={toAttribute(t,e){switch(e){case Boolean:t=t?$:null;break;case Object:case Array:t=null==t?t:JSON.stringify(t)}return t},fromAttribute(t,e){let i=t;switch(e){case Boolean:i=null!==t;break;case Number:i=null===t?null:Number(t);break;case Object:case Array:try{i=JSON.parse(t)}catch(t){i=null}}return i}},A=(t,e)=>!h(t,e),S={attribute:!0,type:String,converter:C,reflect:!1,hasChanged:A};Symbol.metadata??=Symbol("metadata"),y.litPropertyMetadata??=new WeakMap;class T extends HTMLElement{static addInitializer(t){this._$Ei(),(this.l??=[]).push(t)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(t,e=S){if(e.state&&(e.attribute=!1),this._$Ei(),this.elementProperties.set(t,e),!e.noAccessor){const i=Symbol(),n=this.getPropertyDescriptor(t,i,e);void 0!==n&&m(this.prototype,t,n)}}static getPropertyDescriptor(t,e,i){const{get:n,set:r}=p(this.prototype,t)??{get(){return this[e]},set(t){this[e]=t}};return{get(){return n?.call(this)},set(e){const o=n?.call(this);r.call(this,e),this.requestUpdate(t,o,i)},configurable:!0,enumerable:!0}}static getPropertyOptions(t){return this.elementProperties.get(t)??S}static _$Ei(){if(this.hasOwnProperty(w("elementProperties")))return;const t=v(this);t.finalize(),void 0!==t.l&&(this.l=[...t.l]),this.elementProperties=new Map(t.elementProperties)}static finalize(){if(this.hasOwnProperty(w("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(w("properties"))){const t=this.properties,e=[...f(t),...g(t)];for(const i of e)this.createProperty(i,t[i])}const t=this[Symbol.metadata];if(null!==t){const e=litPropertyMetadata.get(t);if(void 0!==e)for(const[t,i]of e)this.elementProperties.set(t,i)}this._$Eh=new Map;for(const[t,e]of this.elementProperties){const i=this._$Eu(t,e);void 0!==i&&this._$Eh.set(i,t)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(t){const e=[];if(Array.isArray(t)){const i=new Set(t.flat(1/0).reverse());for(const t of i)e.unshift(u(t))}else void 0!==t&&e.push(u(t));return e}static _$Eu(t,e){const i=e.attribute;return!1===i?void 0:"string"==typeof i?i:"string"==typeof t?t.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){this._$Eg=new Promise((t=>this.enableUpdating=t)),this._$AL=new Map,this._$ES(),this.requestUpdate(),this.constructor.l?.forEach((t=>t(this)))}addController(t){(this._$E_??=new Set).add(t),void 0!==this.renderRoot&&this.isConnected&&t.hostConnected?.()}removeController(t){this._$E_?.delete(t)}_$ES(){const t=new Map,e=this.constructor.elementProperties;for(const i of e.keys())this.hasOwnProperty(i)&&(t.set(i,this[i]),delete this[i]);t.size>0&&(this._$Ep=t)}createRenderRoot(){const t=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return d(t,this.constructor.elementStyles),t}connectedCallback(){this.renderRoot??=this.createRenderRoot(),this.enableUpdating(!0),this._$E_?.forEach((t=>t.hostConnected?.()))}enableUpdating(t){}disconnectedCallback(){this._$E_?.forEach((t=>t.hostDisconnected?.()))}attributeChangedCallback(t,e,i){this._$AK(t,i)}_$EO(t,e){const i=this.constructor.elementProperties.get(t),n=this.constructor._$Eu(t,i);if(void 0!==n&&!0===i.reflect){const r=(void 0!==i.converter?.toAttribute?i.converter:C).toAttribute(e,i.type);this._$Em=t,null==r?this.removeAttribute(n):this.setAttribute(n,r),this._$Em=null}}_$AK(t,e){const i=this.constructor,n=i._$Eh.get(t);if(void 0!==n&&this._$Em!==n){const t=i.getPropertyOptions(n),r="function"==typeof t.converter?{fromAttribute:t.converter}:void 0!==t.converter?.fromAttribute?t.converter:C;this._$Em=n,this[n]=r.fromAttribute(e,t.type),this._$Em=null}}requestUpdate(t,e,i,n=!1,r){if(void 0!==t){if(i??=this.constructor.getPropertyOptions(t),!(i.hasChanged??A)(n?r:this[t],e))return;this.C(t,e,i)}!1===this.isUpdatePending&&(this._$Eg=this._$EP())}C(t,e,i){this._$AL.has(t)||this._$AL.set(t,e),!0===i.reflect&&this._$Em!==t&&(this._$Ej??=new Set).add(t)}async _$EP(){this.isUpdatePending=!0;try{await this._$Eg}catch(t){Promise.reject(t)}const t=this.scheduleUpdate();return null!=t&&await t,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??=this.createRenderRoot(),this._$Ep){for(const[t,e]of this._$Ep)this[t]=e;this._$Ep=void 0}const t=this.constructor.elementProperties;if(t.size>0)for(const[e,i]of t)!0!==i.wrapped||this._$AL.has(e)||void 0===this[e]||this.C(e,this[e],i)}let t=!1;const e=this._$AL;try{t=this.shouldUpdate(e),t?(this.willUpdate(e),this._$E_?.forEach((t=>t.hostUpdate?.())),this.update(e)):this._$ET()}catch(e){throw t=!1,this._$ET(),e}t&&this._$AE(e)}willUpdate(t){}_$AE(t){this._$E_?.forEach((t=>t.hostUpdated?.())),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(t)),this.updated(t)}_$ET(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$Eg}shouldUpdate(t){return!0}update(t){this._$Ej&&=this._$Ej.forEach((t=>this._$EO(t,this[t]))),this._$ET()}updated(t){}firstUpdated(t){}}T.elementStyles=[],T.shadowRootOptions={mode:"open"},T[w("elementProperties")]=new Map,T[w("finalized")]=new Map,b?.({ReactiveElement:T}),(y.reactiveElementVersions??=[]).push("2.0.2")},126:(t,e,i)=>{i.d(e,{XM:()=>r,Xe:()=>o,pX:()=>n});const n={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,i){this._$Ct=t,this._$AM=e,this._$Ci=i}_$AS(t,e){return this.update(t,e)}update(t,e){return this.render(...e)}}},605:(t,e,i)=>{i.d(e,{Jb:()=>T,Ld:()=>E,YP:()=>S,_$LH:()=>j,dy:()=>A,sY:()=>G});const n=globalThis,r=n.trustedTypes,o=r?r.createPolicy("lit-html",{createHTML:t=>t}):void 0,s="$lit$",a=`lit$${(Math.random()+"").slice(9)}$`,l="?"+a,c=`<${l}>`,d=document,u=()=>d.createComment(""),h=t=>null===t||"object"!=typeof t&&"function"!=typeof t,m=Array.isArray,p=t=>m(t)||"function"==typeof t?.[Symbol.iterator],f="[ \t\n\f\r]",g=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,v=/-->/g,y=/>/g,_=RegExp(`>|${f}(?:([^\\s"'>=/]+)(${f}*=${f}*(?:[^ \t\n\f\r"'\`<>=]|("|')|))|$)`,"g"),$=/'/g,b=/"/g,w=/^(?:script|style|textarea|title)$/i,C=t=>(e,...i)=>({_$litType$:t,strings:e,values:i}),A=C(1),S=C(2),T=Symbol.for("lit-noChange"),E=Symbol.for("lit-nothing"),D=new WeakMap,x=d.createTreeWalker(d,129);function R(t,e){if(!Array.isArray(t)||!t.hasOwnProperty("raw"))throw Error("invalid template strings array");return void 0!==o?o.createHTML(e):e}const k=(t,e)=>{const i=t.length-1,n=[];let r,o=2===e?"":"",l=g;for(let e=0;e"===u[0]?(l=r??g,h=-1):void 0===u[1]?h=-2:(h=l.lastIndex-u[2].length,d=u[1],l=void 0===u[3]?_:'"'===u[3]?b:$):l===b||l===$?l=_:l===v||l===y?l=g:(l=_,r=void 0);const p=l===_&&t[e+1].startsWith("/>")?" ":"";o+=l===g?i+c:h>=0?(n.push(d),i.slice(0,h)+s+i.slice(h)+a+p):i+a+(-2===h?e:p)}return[R(t,o+(t[i]||"")+(2===e?"":"")),n]};class O{constructor({strings:t,_$litType$:e},i){let n;this.parts=[];let o=0,c=0;const d=t.length-1,h=this.parts,[m,p]=k(t,e);if(this.el=O.createElement(m,i),x.currentNode=this.el.content,2===e){const t=this.el.content.firstChild;t.replaceWith(...t.childNodes)}for(;null!==(n=x.nextNode())&&h.length0){n.textContent=r?r.emptyScript:"";for(let i=0;i2||""!==i[0]||""!==i[1]?(this._$AH=Array(i.length-1).fill(new String),this.strings=i):this._$AH=E}_$AI(t,e=this,i,n){const r=this.strings;let o=!1;if(void 0===r)t=P(this,t,e,0),o=!h(t)||t!==this._$AH&&t!==T,o&&(this._$AH=t);else{const n=t;let s,a;for(t=r[0],s=0;s{const n=i?.renderBefore??e;let r=n._$litPart$;if(void 0===r){const t=i?.renderBefore??null;n._$litPart$=r=new M(e.insertBefore(u(),t),t,void 0,i??{})}return r._$AI(t),r}},147:t=>{t.exports=JSON.parse('{"name":"formulaone-card","version":"1.9.2","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.52.0","home-assistant-js-websocket":"^9.1.0","lit":"^3.0.2","lit-element":"^3.3.3","minify-html-literals-loader":"^1.1.1","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.23.8","@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","minify-html-literals-loader":"^1.1.1","ts-auto-mock":"^3.6.4","ts-jest":"^29.1.1","ts-loader":"^9.5.1","ttypescript":"^1.5.15","yarn":"^1.22.21"}}')}},e={};function i(n){var r=e[n];if(void 0!==r)return r.exports;var o=e[n]={exports:{}};return t[n].call(o.exports,o,o.exports,i),o.exports}i.d=(t,e)=>{for(var n in e)i.o(e,n)&&!i.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:e[n]})},i.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),i.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},i(148)})();