-
Notifications
You must be signed in to change notification settings - Fork 22
Expand file tree
/
Copy pathformulaone-card.js
More file actions
2 lines (2 loc) · 120 KB
/
formulaone-card.js
File metadata and controls
2 lines (2 loc) · 120 KB
1
2
/*! For license information please see formulaone-card.js.LICENSE.txt */
(()=>{"use strict";var t={898:(t,e,n)=>{Object.defineProperty(e,"__esModule",{value:!0});const i=n(313),r=n(110),a=n(194),o=n(382);class s extends r.LitElement{constructor(){super(...arguments),this.controlRenderers={[a.FormControlType.Dropdown]:o.renderDropdown,[a.FormControlType.Radio]:o.renderRadio,[a.FormControlType.Checkboxes]:o.renderCheckboxes,[a.FormControlType.EntityDropdown]:o.renderDropdown,[a.FormControlType.Switch]:o.renderSwitch,[a.FormControlType.Textbox]:o.renderTextbox,[a.FormControlType.Filler]:o.renderFiller}}setConfig(t){this._config=t,this.requestUpdate("_config")}set hass(t){this._hass=t}renderForm(t){return r.html`<div class="card-config">${t.map((t=>{const e=t.cssClass?`form-row ${t.cssClass}`:"form-row";return t.hidden?"":r.html`<div class="${e}"><label>${t.label}</label> ${t.controls.map((t=>this.renderControl(t)))}</div>`}))}</div>`}renderControl(t){const e=this.controlRenderers[t.type];if(!e)throw new Error(`Unsupported control type: ${t.type}`);return e(this,t)}_valueChanged(t){if(!this._config||!this._hass)return;const e=t.target,n=t.detail;if("HA-CHECKBOX"===e.tagName){const t=this._config[e.configValue].indexOf(e.value);let n;n=e.checked&&t<0?[...this._config[e.configValue],e.value]:!e.checked&&t>-1?[...this._config[e.configValue].slice(0,t),...this._config[e.configValue].slice(t+1)]:this._config[e.configValue],this._config={...this._config,[e.configValue]:n}}else if(e.configValue)if(e.configValue.indexOf(".")>-1){const[t,n]=e.configValue.split(".");this._config={...this._config,[t]:{...this._config[t],[n]:e.checked}}}else this._config={...this._config,[e.configValue]:void 0===e.checked&&(null==n?void 0:n.value)?e.checked||n.value:e.value||e.checked};(0,i.fireEvent)(this,"config-changed",{config:this._config},{bubbles:!0,composed:!0}),this.requestUpdate("_config")}static get styles(){return r.css`.form-row{margin-bottom:10px}.form-control{display:flex;align-items:center}ha-switch{padding:16px 6px}.side-by-side{display:flex;flex-flow:row wrap}.side-by-side>label{width:100%}.side-by-side>.form-control{width:49%;padding:2px}ha-textfield{width:100%}`}}e.default=s},194:(t,e)=>{var n;Object.defineProperty(e,"__esModule",{value:!0}),e.FormControlType=void 0,function(t){t.Dropdown="dropdown",t.Checkbox="checkbox",t.Checkboxes="checkboxes",t.Radio="radio",t.Switch="switch",t.Textbox="textbox",t.Filler="filler",t.EntityDropdown="entity-dropdown"}(n||(e.FormControlType=n={}))},382:(t,e,n)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.renderCheckboxes=e.renderRadio=e.renderDropdown=e.renderSwitch=e.renderTextbox=e.renderEntityDropdown=e.renderFiller=void 0;const i=n(110),r=n(429);e.renderFiller=()=>i.html`<div class="form-control"></div>`,e.renderEntityDropdown=(t,e)=>{var n;return i.html`<div class="form-control"><ha-entity-picker label="${e.label}" .value="${null!==(n=t._config[e.configValue])&&void 0!==n?n:""}" .configValue="${e.configValue}" .hass="${t._hass}" domain-filter="${e.domain}" @change="${t._valueChanged}"></ha-entity-picker></div>`},e.renderTextbox=(t,e)=>{var n;return i.html`<div class="form-control"><ha-textfield label="${e.label}" .value="${null!==(n=t._config[e.configValue])&&void 0!==n?n:""}" .configValue="${e.configValue}" @change="${t._valueChanged}"></ha-textfield></div>`},e.renderSwitch=(t,e)=>i.html`<div class="form-control"><ha-switch id="${e.configValue}" name="${e.configValue}" .checked="${t._config[e.configValue]}" .configValue="${e.configValue}" @change="${t._valueChanged}"></ha-switch><label for="${e.configValue}">${e.label}</label></div>`,e.renderDropdown=(t,e)=>{var n;const a=null!==(n=e.items)&&void 0!==n?n:(0,r.getEntitiesByDomain)(t._hass,e.domain);return i.html`<div class="form-control"><ha-combo-box label="${e.label}" .value="${t._config[e.configValue]}" .configValue="${e.configValue}" .items="${a}" @value-changed="${t._valueChanged}" @change="${t._valueChanged}"></ha-combo-box></div>`},e.renderRadio=(t,e)=>i.html`<div class="form-control"><label>${e.label}</label> ${e.items.map((n=>i.html`<ha-radio id="${e.configValue}_${n.value}" name="${e.configValue}" .checked="${t._config[e.configValue]===n.value}" .configValue="${e.configValue}" .value="${n.value}" @change="${t._valueChanged}"></ha-radio><label for="${e.configValue}_${n.value}">${n.label}</label>`))}</div>`,e.renderCheckboxes=(t,e)=>i.html`<label>${e.label}</label> ${e.items.map((n=>{var r;return i.html`<div class="form-control"><ha-checkbox id="${e.configValue}_${n.value}" name="${e.configValue}[]" .checked="${(null===(r=t._config[e.configValue])||void 0===r?void 0:r.indexOf(n.value))>-1}" .configValue="${e.configValue}" .value="${n.value}" @change="${t._valueChanged}"></ha-checkbox><label for="${e.configValue}_${n.value}">${n.label}</label></div>`}))}`},429:(t,e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.getDropdownOptionsFromEnum=e.formatList=e.getEntitiesByDeviceClass=e.getEntitiesByDomain=void 0,e.getEntitiesByDomain=(t,n)=>Object.keys(t.states).filter((t=>t.substr(0,t.indexOf("."))===n)).map((n=>(0,e.formatList)(n,t))),e.getEntitiesByDeviceClass=(t,n,i)=>Object.keys(t.states).filter((e=>e.substr(0,e.indexOf("."))===n&&t.states[e].attributes.device_class===i)).map((n=>(0,e.formatList)(n,t))),e.formatList=(t,e)=>({label:e.states[t].attributes.friendly_name,value:t}),e.getDropdownOptionsFromEnum=t=>{const e=[];for(const[n,i]of Object.entries(t))e.push({value:i,label:n});return e}},313:(t,e,n)=>{n.r(e),n.d(e,{DEFAULT_DOMAIN_ICON:()=>K,DEFAULT_PANEL:()=>X,DEFAULT_VIEW_ENTITY_ID:()=>st,DOMAINS_HIDE_MORE_INFO:()=>et,DOMAINS_MORE_INFO_NO_HISTORY:()=>nt,DOMAINS_TOGGLE:()=>rt,DOMAINS_WITH_CARD:()=>Z,DOMAINS_WITH_MORE_INFO:()=>tt,NumberFormat:()=>i,STATES_OFF:()=>it,TimeFormat:()=>r,UNIT_C:()=>at,UNIT_F:()=>ot,applyThemesOnElement:()=>L,computeCardSize:()=>H,computeDomain:()=>j,computeEntity:()=>V,computeRTL:()=>G,computeRTLDirection:()=>U,computeStateDisplay:()=>J,computeStateDomain:()=>B,createThing:()=>ut,debounce:()=>ht,domainIcon:()=>pt,evaluateFilter:()=>ft,fireEvent:()=>lt,fixedIcons:()=>mt,formatDate:()=>d,formatDateMonth:()=>_,formatDateMonthYear:()=>g,formatDateNumeric:()=>h,formatDateShort:()=>p,formatDateTime:()=>C,formatDateTimeNumeric:()=>D,formatDateTimeWithSeconds:()=>A,formatDateWeekday:()=>l,formatDateYear:()=>$,formatNumber:()=>Y,formatTime:()=>R,formatTimeWeekday:()=>k,formatTimeWithSeconds:()=>N,forwardHaptic:()=>gt,getLovelace:()=>Dt,handleAction:()=>wt,handleActionConfig:()=>$t,handleClick:()=>bt,hasAction:()=>Ct,hasConfigOrEntityChanged:()=>St,hasDoubleClick:()=>At,isNumericState:()=>q,navigate:()=>vt,numberFormatToLocale:()=>W,relativeTime:()=>M,round:()=>Q,stateIcon:()=>Et,timerTimeRemaining:()=>P,toggleEntity:()=>yt,turnOnOffEntities:()=>Tt,turnOnOffEntity:()=>_t});var i,r,a,o=function(){return o=Object.assign||function(t){for(var e,n=1,i=arguments.length;n<i;n++)for(var r in e=arguments[n])Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t},o.apply(this,arguments)},s={second:45,minute:45,hour:22,day:5},l=function(t,e){return c(e).format(t)},c=function(t){return new Intl.DateTimeFormat(t.language,{weekday:"long",month:"long",day:"numeric"})},d=function(t,e){return u(e).format(t)},u=function(t){return new Intl.DateTimeFormat(t.language,{year:"numeric",month:"long",day:"numeric"})},h=function(t,e){return m(e).format(t)},m=function(t){return new Intl.DateTimeFormat(t.language,{year:"numeric",month:"numeric",day:"numeric"})},p=function(t,e){return f(e).format(t)},f=function(t){return new Intl.DateTimeFormat(t.language,{day:"numeric",month:"short"})},g=function(t,e){return v(e).format(t)},v=function(t){return new Intl.DateTimeFormat(t.language,{month:"long",year:"numeric"})},_=function(t,e){return y(e).format(t)},y=function(t){return new Intl.DateTimeFormat(t.language,{month:"long"})},$=function(t,e){return w(e).format(t)},w=function(t){return new Intl.DateTimeFormat(t.language,{year:"numeric"})};(a=i||(i={})).language="language",a.system="system",a.comma_decimal="comma_decimal",a.decimal_comma="decimal_comma",a.space_comma="space_comma",a.none="none",function(t){t.language="language",t.system="system",t.am_pm="12",t.twenty_four="24"}(r||(r={}));var b=function(t){if(t.time_format===r.language||t.time_format===r.system){var e=t.time_format===r.language?t.language:void 0,n=(new Date).toLocaleString(e);return n.includes("AM")||n.includes("PM")}return t.time_format===r.am_pm},C=function(t,e){return S(e).format(t)},S=function(t){return new Intl.DateTimeFormat(t.language,{year:"numeric",month:"long",day:"numeric",hour:b(t)?"numeric":"2-digit",minute:"2-digit",hour12:b(t)})},A=function(t,e){return T(e).format(t)},T=function(t){return new Intl.DateTimeFormat(t.language,{year:"numeric",month:"long",day:"numeric",hour:b(t)?"numeric":"2-digit",minute:"2-digit",second:"2-digit",hour12:b(t)})},D=function(t,e){return x(e).format(t)},x=function(t){return new Intl.DateTimeFormat(t.language,{year:"numeric",month:"numeric",day:"numeric",hour:"numeric",minute:"2-digit",hour12:b(t)})},R=function(t,e){return E(e).format(t)},E=function(t){return new Intl.DateTimeFormat(t.language,{hour:"numeric",minute:"2-digit",hour12:b(t)})},N=function(t,e){return O(e).format(t)},O=function(t){return new Intl.DateTimeFormat(t.language,{hour:b(t)?"numeric":"2-digit",minute:"2-digit",second:"2-digit",hour12:b(t)})},k=function(t,e){return F(e).format(t)},F=function(t){return new Intl.DateTimeFormat(t.language,{hour:b(t)?"numeric":"2-digit",minute:"2-digit",second:"2-digit",hour12:b(t)})},M=function(t,e,n,i){void 0===i&&(i=!0);var r=function(t,e,n){void 0===e&&(e=Date.now()),void 0===n&&(n={});var i=o(o({},s),n||{}),r=(+t-+e)/1e3;if(Math.abs(r)<i.second)return{value:Math.round(r),unit:"second"};var a=r/60;if(Math.abs(a)<i.minute)return{value:Math.round(a),unit:"minute"};var l=r/3600;if(Math.abs(l)<i.hour)return{value:Math.round(l),unit:"hour"};var c=r/86400;if(Math.abs(c)<i.day)return{value:Math.round(c),unit:"day"};var d=new Date(t),u=new Date(e),h=d.getFullYear()-u.getFullYear();if(Math.round(Math.abs(h))>0)return{value:Math.round(h),unit:"year"};var m=12*h+d.getMonth()-u.getMonth();if(Math.round(Math.abs(m))>0)return{value:Math.round(m),unit:"month"};var p=r/604800;return{value:Math.round(p),unit:"week"}}(t,n);return i?function(t){return new Intl.RelativeTimeFormat(t.language,{numeric:"auto"})}(e).format(r.value,r.unit):Intl.NumberFormat(e.language,{style:"unit",unit:r.unit,unitDisplay:"long"}).format(Math.abs(r.value))};function P(t){var e,n=3600*(e=t.attributes.remaining.split(":").map(Number))[0]+60*e[1]+e[2];if("active"===t.state){var i=(new Date).getTime(),r=new Date(t.last_changed).getTime();n=Math.max(n-(i-r)/1e3,0)}return n}function I(){return(I=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(t[i]=n[i])}return t}).apply(this,arguments)}var L=function(t,e,n,i){void 0===i&&(i=!1),t._themes||(t._themes={});var r=e.default_theme;("default"===n||n&&e.themes[n])&&(r=n);var a=I({},t._themes);if("default"!==r){var o=e.themes[r];Object.keys(o).forEach((function(e){var n="--"+e;t._themes[n]="",a[n]=o[e]}))}if(t.updateStyles?t.updateStyles(a):window.ShadyCSS&&window.ShadyCSS.styleSubtree(t,a),i){var s=document.querySelector("meta[name=theme-color]");if(s){s.hasAttribute("default-content")||s.setAttribute("default-content",s.getAttribute("content"));var l=a["--primary-color"]||s.getAttribute("default-content");s.setAttribute("content",l)}}},H=function(t){return"function"==typeof t.getCardSize?t.getCardSize():4};function j(t){return t.substr(0,t.indexOf("."))}function V(t){return t.substr(t.indexOf(".")+1)}function G(t){var e,n=(null==t||null==(e=t.locale)?void 0:e.language)||"en";return t.translationMetadata.translations[n]&&t.translationMetadata.translations[n].isRTL||!1}function U(t){return G(t)?"rtl":"ltr"}function B(t){return j(t.entity_id)}var q=function(t){return!!t.attributes.unit_of_measurement||!!t.attributes.state_class},W=function(t){switch(t.number_format){case i.comma_decimal:return["en-US","en"];case i.decimal_comma:return["de","es","it"];case i.space_comma:return["fr","sv","cs"];case i.system:return;default:return t.language}},Q=function(t,e){return void 0===e&&(e=2),Math.round(t*Math.pow(10,e))/Math.pow(10,e)},Y=function(t,e,n){var r=e?W(e):void 0;if(Number.isNaN=Number.isNaN||function t(e){return"number"==typeof e&&t(e)},(null==e?void 0:e.number_format)!==i.none&&!Number.isNaN(Number(t))&&Intl)try{return new Intl.NumberFormat(r,z(t,n)).format(Number(t))}catch(e){return console.error(e),new Intl.NumberFormat(void 0,z(t,n)).format(Number(t))}return"string"==typeof t?t:Q(t,null==n?void 0:n.maximumFractionDigits).toString()+("currency"===(null==n?void 0:n.style)?" "+n.currency:"")},z=function(t,e){var n=I({maximumFractionDigits:2},e);if("string"!=typeof t)return n;if(!e||!e.minimumFractionDigits&&!e.maximumFractionDigits){var i=t.indexOf(".")>-1?t.split(".")[1].length:0;n.minimumFractionDigits=i,n.maximumFractionDigits=i}return n},J=function(t,e,n,i){var r=void 0!==i?i:e.state;if("unknown"===r||"unavailable"===r)return t("state.default."+r);if(q(e)){if("monetary"===e.attributes.device_class)try{return Y(r,n,{style:"currency",currency:e.attributes.unit_of_measurement})}catch(t){}return Y(r,n)+(e.attributes.unit_of_measurement?" "+e.attributes.unit_of_measurement:"")}var a=B(e);if("input_datetime"===a){var o;if(void 0===i)return e.attributes.has_date&&e.attributes.has_time?(o=new Date(e.attributes.year,e.attributes.month-1,e.attributes.day,e.attributes.hour,e.attributes.minute),C(o,n)):e.attributes.has_date?(o=new Date(e.attributes.year,e.attributes.month-1,e.attributes.day),d(o,n)):e.attributes.has_time?((o=new Date).setHours(e.attributes.hour,e.attributes.minute),R(o,n)):e.state;try{var s=i.split(" ");if(2===s.length)return C(new Date(s.join("T")),n);if(1===s.length){if(i.includes("-"))return d(new Date(i+"T00:00"),n);if(i.includes(":")){var l=new Date;return R(new Date(l.toISOString().split("T")[0]+"T"+i),n)}}return i}catch(t){return i}}return"humidifier"===a&&"on"===r&&e.attributes.humidity?e.attributes.humidity+" %":"counter"===a||"number"===a||"input_number"===a?Y(r,n):e.attributes.device_class&&t("component."+a+".state."+e.attributes.device_class+"."+r)||t("component."+a+".state._."+r)||r},K="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"],nt=["camera","configurator","history_graph","scene"],it=["closed","locked","off"],rt=new Set(["fan","input_boolean","light","switch","group","automation"]),at="°C",ot="°F",st="group.default_view",lt=function(t,e,n,i){i=i||{},n=null==n?{}:n;var r=new Event(e,{bubbles:void 0===i.bubbles||i.bubbles,cancelable:Boolean(i.cancelable),composed:void 0===i.composed||i.composed});return r.detail=n,t.dispatchEvent(r),r},ct=new Set(["call-service","divider","section","weblink","cast","select"]),dt={alert:"toggle",automation:"toggle",climate:"climate",cover:"cover",fan:"toggle",group:"group",input_boolean:"toggle",input_number:"input-number",input_select:"input-select",input_text:"input-text",light:"toggle",lock:"lock",media_player:"media-player",remote:"toggle",scene:"scene",script:"script",sensor:"sensor",timer:"timer",switch:"toggle",vacuum:"toggle",water_heater:"climate",input_datetime:"input-datetime"},ut=function(t,e){void 0===e&&(e=!1);var n=function(t,e){return i("hui-error-card",{type:"error",error:t,config:e})},i=function(t,e){var i=window.document.createElement(t);try{if(!i.setConfig)return;i.setConfig(e)}catch(i){return console.error(t,i),n(i.message,e)}return i};if(!t||"object"!=typeof t||!e&&!t.type)return n("No type defined",t);var r=t.type;if(r&&r.startsWith("custom:"))r=r.substr(7);else if(e)if(ct.has(r))r="hui-"+r+"-row";else{if(!t.entity)return n("Invalid config given.",t);var a=t.entity.split(".",1)[0];r="hui-"+(dt[a]||"text")+"-entity-row"}else r="hui-"+r+"-card";if(customElements.get(r))return i(r,t);var o=n("Custom element doesn't exist: "+t.type+".",t);o.style.display="None";var s=setTimeout((function(){o.style.display=""}),2e3);return customElements.whenDefined(t.type).then((function(){clearTimeout(s),lt(o,"ll-rebuild",{},o)})),o},ht=function(t,e,n){var i;return void 0===n&&(n=!1),function(){var r=[].slice.call(arguments),a=this,o=n&&!i;clearTimeout(i),i=setTimeout((function(){i=null,n||t.apply(a,r)}),e),o&&t.apply(a,r)}},mt={alert:"mdi:alert",automation:"mdi:playlist-play",calendar:"mdi:calendar",camera:"mdi:video",climate:"mdi:thermostat",configurator:"mdi:settings",conversation:"mdi:text-to-speech",device_tracker:"mdi:account",fan:"mdi:fan",group:"mdi:google-circles-communities",history_graph:"mdi:chart-line",homeassistant:"mdi:home-assistant",homekit:"mdi:home-automation",image_processing:"mdi:image-filter-frames",input_boolean:"mdi:drawing",input_datetime:"mdi:calendar-clock",input_number:"mdi:ray-vertex",input_select:"mdi:format-list-bulleted",input_text:"mdi:textbox",light:"mdi:lightbulb",mailbox:"mdi:mailbox",notify:"mdi:comment-alert",person:"mdi:account",plant:"mdi:flower",proximity:"mdi:apple-safari",remote:"mdi:remote",scene:"mdi:google-pages",script:"mdi:file-document",sensor:"mdi:eye",simple_alarm:"mdi:bell",sun:"mdi:white-balance-sunny",switch:"mdi:flash",timer:"mdi:timer",updater:"mdi:cloud-upload",vacuum:"mdi:robot-vacuum",water_heater:"mdi:thermometer",weblink:"mdi:open-in-new"};function pt(t,e){if(t in mt)return mt[t];switch(t){case"alarm_control_panel":switch(e){case"armed_home":return"mdi:bell-plus";case"armed_night":return"mdi:bell-sleep";case"disarmed":return"mdi:bell-outline";case"triggered":return"mdi:bell-ring";default:return"mdi:bell"}case"binary_sensor":return e&&"off"===e?"mdi:radiobox-blank":"mdi:checkbox-marked-circle";case"cover":return"closed"===e?"mdi:window-closed":"mdi:window-open";case"lock":return e&&"unlocked"===e?"mdi:lock-open":"mdi:lock";case"media_player":return e&&"off"!==e&&"idle"!==e?"mdi:cast-connected":"mdi:cast";case"zwave":switch(e){case"dead":return"mdi:emoticon-dead";case"sleeping":return"mdi:sleep";case"initializing":return"mdi:timer-sand";default:return"mdi:z-wave"}default:return console.warn("Unable to find icon for domain "+t+" ("+e+")"),"mdi:bookmark"}}var ft=function(t,e){var n=e.value||e,i=e.attribute?t.attributes[e.attribute]:t.state;switch(e.operator||"=="){case"==":return i===n;case"<=":return i<=n;case"<":return i<n;case">=":return i>=n;case">":return i>n;case"!=":return i!==n;case"regex":return i.match(n);default:return!1}},gt=function(t){lt(window,"haptic",t)},vt=function(t,e,n){void 0===n&&(n=!1),n?history.replaceState(null,"",e):history.pushState(null,"",e),lt(window,"location-changed",{replace:n})},_t=function(t,e,n){void 0===n&&(n=!0);var i,r=j(e),a="group"===r?"homeassistant":r;switch(r){case"lock":i=n?"unlock":"lock";break;case"cover":i=n?"open_cover":"close_cover";break;default:i=n?"turn_on":"turn_off"}return t.callService(a,i,{entity_id:e})},yt=function(t,e){var n=it.includes(t.states[e].state);return _t(t,e,n)},$t=function(t,e,n,i){if(i||(i={action:"more-info"}),!i.confirmation||i.confirmation.exemptions&&i.confirmation.exemptions.some((function(t){return t.user===e.user.id}))||(gt("warning"),confirm(i.confirmation.text||"Are you sure you want to "+i.action+"?")))switch(i.action){case"more-info":(n.entity||n.camera_image)&<(t,"hass-more-info",{entityId:n.entity?n.entity:n.camera_image});break;case"navigate":i.navigation_path&&vt(0,i.navigation_path);break;case"url":i.url_path&&window.open(i.url_path);break;case"toggle":n.entity&&(yt(e,n.entity),gt("success"));break;case"call-service":if(!i.service)return void gt("failure");var r=i.service.split(".",2);e.callService(r[0],r[1],i.service_data,i.target),gt("success");break;case"fire-dom-event":lt(t,"ll-custom",i)}},wt=function(t,e,n,i){var r;"double_tap"===i&&n.double_tap_action?r=n.double_tap_action:"hold"===i&&n.hold_action?r=n.hold_action:"tap"===i&&n.tap_action&&(r=n.tap_action),$t(t,e,n,r)},bt=function(t,e,n,i,r){var a;if(r&&n.double_tap_action?a=n.double_tap_action:i&&n.hold_action?a=n.hold_action:!i&&n.tap_action&&(a=n.tap_action),a||(a={action:"more-info"}),!a.confirmation||a.confirmation.exemptions&&a.confirmation.exemptions.some((function(t){return t.user===e.user.id}))||confirm(a.confirmation.text||"Are you sure you want to "+a.action+"?"))switch(a.action){case"more-info":(a.entity||n.entity||n.camera_image)&&(lt(t,"hass-more-info",{entityId:a.entity?a.entity:n.entity?n.entity:n.camera_image}),a.haptic&>(a.haptic));break;case"navigate":a.navigation_path&&(vt(0,a.navigation_path),a.haptic&>(a.haptic));break;case"url":a.url_path&&window.open(a.url_path),a.haptic&>(a.haptic);break;case"toggle":n.entity&&(yt(e,n.entity),a.haptic&>(a.haptic));break;case"call-service":if(!a.service)return;var o=a.service.split(".",2),s=o[0],l=o[1],c=I({},a.service_data);"entity"===c.entity_id&&(c.entity_id=n.entity),e.callService(s,l,c,a.target),a.haptic&>(a.haptic);break;case"fire-dom-event":lt(t,"ll-custom",a),a.haptic&>(a.haptic)}};function Ct(t){return void 0!==t&&"none"!==t.action}function St(t,e,n){if(e.has("config")||n)return!0;if(t.config.entity){var i=e.get("hass");return!i||i.states[t.config.entity]!==t.hass.states[t.config.entity]}return!1}function At(t){return void 0!==t&&"none"!==t.action}var Tt=function(t,e,n){void 0===n&&(n=!0);var i={};e.forEach((function(e){if(it.includes(t.states[e].state)===n){var r=j(e),a=["cover","lock"].includes(r)?r:"homeassistant";a in i||(i[a]=[]),i[a].push(e)}})),Object.keys(i).forEach((function(e){var r;switch(e){case"lock":r=n?"unlock":"lock";break;case"cover":r=n?"open_cover":"close_cover";break;default:r=n?"turn_on":"turn_off"}t.callService(e,r,{entity_id:i[e]})}))},Dt=function(){var t=document.querySelector("home-assistant");if(t=(t=(t=(t=(t=(t=(t=(t=t&&t.shadowRoot)&&t.querySelector("home-assistant-main"))&&t.shadowRoot)&&t.querySelector("app-drawer-layout partial-panel-resolver"))&&t.shadowRoot||t)&&t.querySelector("ha-panel-lovelace"))&&t.shadowRoot)&&t.querySelector("hui-root")){var e=t.lovelace;return e.current_view=t.___curView,e}return null},xt={humidity:"mdi:water-percent",illuminance:"mdi:brightness-5",temperature:"mdi:thermometer",pressure:"mdi:gauge",power:"mdi:flash",signal_strength:"mdi:wifi"},Rt={binary_sensor:function(t,e){var n="off"===t;switch(null==e?void 0:e.attributes.device_class){case"battery":return n?"mdi:battery":"mdi:battery-outline";case"battery_charging":return n?"mdi:battery":"mdi:battery-charging";case"cold":return n?"mdi:thermometer":"mdi:snowflake";case"connectivity":return n?"mdi:server-network-off":"mdi:server-network";case"door":return n?"mdi:door-closed":"mdi:door-open";case"garage_door":return n?"mdi:garage":"mdi:garage-open";case"power":case"plug":return n?"mdi:power-plug-off":"mdi:power-plug";case"gas":case"problem":case"safety":case"tamper":return n?"mdi:check-circle":"mdi:alert-circle";case"smoke":return n?"mdi:check-circle":"mdi:smoke";case"heat":return n?"mdi:thermometer":"mdi:fire";case"light":return n?"mdi:brightness-5":"mdi:brightness-7";case"lock":return n?"mdi:lock":"mdi:lock-open";case"moisture":return n?"mdi:water-off":"mdi:water";case"motion":return n?"mdi:walk":"mdi:run";case"occupancy":case"presence":return n?"mdi:home-outline":"mdi:home";case"opening":return n?"mdi:square":"mdi:square-outline";case"running":return n?"mdi:stop":"mdi:play";case"sound":return n?"mdi:music-note-off":"mdi:music-note";case"update":return n?"mdi:package":"mdi:package-up";case"vibration":return n?"mdi:crop-portrait":"mdi:vibrate";case"window":return n?"mdi:window-closed":"mdi:window-open";default:return n?"mdi:radiobox-blank":"mdi:checkbox-marked-circle"}},cover:function(t){var e="closed"!==t.state;switch(t.attributes.device_class){case"garage":return e?"mdi:garage-open":"mdi:garage";case"door":return e?"mdi:door-open":"mdi:door-closed";case"shutter":return e?"mdi:window-shutter-open":"mdi:window-shutter";case"blind":return e?"mdi:blinds-open":"mdi:blinds";case"window":return e?"mdi:window-open":"mdi:window-closed";default:return pt("cover",t.state)}},sensor:function(t){var e=t.attributes.device_class;if(e&&e in xt)return xt[e];if("battery"===e){var n=Number(t.state);if(isNaN(n))return"mdi:battery-unknown";var i=10*Math.round(n/10);return i>=100?"mdi:battery":i<=0?"mdi:battery-alert":"hass:battery-"+i}var r=t.attributes.unit_of_measurement;return"°C"===r||"°F"===r?"mdi:thermometer":pt("sensor")},input_datetime:function(t){return t.attributes.has_date?t.attributes.has_time?pt("input_datetime"):"mdi:calendar":"mdi:clock"}},Et=function(t){if(!t)return"mdi:bookmark";if(t.attributes.icon)return t.attributes.icon;var e=j(t.entity_id);return e in Rt?Rt[e](t):pt(e,t.state)}},694:function(t,e){var n=this&&this.__awaiter||function(t,e,n,i){return new(n||(n=Promise))((function(r,a){function o(t){try{l(i.next(t))}catch(t){a(t)}}function s(t){try{l(i.throw(t))}catch(t){a(t)}}function l(t){var e;t.done?r(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(o,s)}l((i=i.apply(t,e||[])).next())}))};Object.defineProperty(e,"__esModule",{value:!0}),e.ClientBase=void 0,e.ClientBase=class{GetData(t,e,i){return n(this,void 0,void 0,(function*(){const n=localStorage.getItem(t);if(n&&e){const t=JSON.parse(n),e=new Date;if(e.setHours(e.getHours()-i),new Date(t.created)>e)return JSON.parse(t.data)}const r=yield fetch(`${this.baseUrl}/${t}`,{headers:{Accept:"application/json"}});if(!r||!r.ok)return Promise.reject(r);const a=yield r.json(),o={data:JSON.stringify(a),created:new Date};return e&&localStorage.setItem(t,JSON.stringify(o)),a}))}}},470:function(t,e,n){var i=this&&this.__awaiter||function(t,e,n,i){return new(n||(n=Promise))((function(r,a){function o(t){try{l(i.next(t))}catch(t){a(t)}}function s(t){try{l(i.throw(t))}catch(t){a(t)}}function l(t){var e;t.done?r(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(o,s)}l((i=i.apply(t,e||[])).next())}))};Object.defineProperty(e,"__esModule",{value:!0});const r=n(438),a=n(694);class o extends a.ClientBase{constructor(){super(...arguments),this.baseUrl="https://api.jolpi.ca/ergast/f1"}GetSchedule(t){return i(this,void 0,void 0,(function*(){return(yield this.GetData(`${t}.json`,!0,72)).MRData.RaceTable.Races}))}GetLastResult(){return i(this,void 0,void 0,(function*(){const t=(0,r.getRefreshTime)("current/last/results.json");return(yield this.GetData("current/last/results.json",!0,t)).MRData.RaceTable.Races[0]}))}GetDriverStandings(){return i(this,void 0,void 0,(function*(){const t=(0,r.getRefreshTime)("current/driverStandings.json"),e=(yield this.GetData("current/driverStandings.json",!0,t)).MRData.StandingsTable.StandingsLists;return e&&e.length>0?e[0].DriverStandings:[]}))}GetDriverStandingsForSeason(t){return i(this,void 0,void 0,(function*(){if(!t||0===t)return this.GetDriverStandings();const e=(0,r.getRefreshTime)(`${t}/driverStandings.json`),n=(yield this.GetData(`${t}/driverStandings.json`,!0,e)).MRData.StandingsTable.StandingsLists;return n&&n.length>0?n[0].DriverStandings:[]}))}GetConstructorStandings(){return i(this,void 0,void 0,(function*(){const t=(0,r.getRefreshTime)("current/constructorStandings.json"),e=(yield this.GetData("current/constructorStandings.json",!0,t)).MRData.StandingsTable.StandingsLists;return e&&e.length>0?e[0].ConstructorStandings:[]}))}GetConstructorStandingsForSeason(t){return i(this,void 0,void 0,(function*(){if(!t||0===t)return this.GetConstructorStandings();const e=(0,r.getRefreshTime)(`${t}/constructorStandings.json`),n=(yield this.GetData(`${t}/constructorStandings.json`,!0,e)).MRData.StandingsTable.StandingsLists;return n&&n.length>0?n[0].ConstructorStandings:[]}))}GetSprintResults(t,e){return i(this,void 0,void 0,(function*(){return(yield this.GetData(`${t}/${e}/sprint.json`,!1,0)).MRData.RaceTable}))}GetQualifyingResults(t,e){return i(this,void 0,void 0,(function*(){return(yield this.GetData(`${t}/${e}/qualifying.json`,!1,0)).MRData.RaceTable}))}GetResults(t,e){return i(this,void 0,void 0,(function*(){return(yield this.GetData(`${t}/${e}/results.json`,!1,0)).MRData.RaceTable}))}GetSeasons(){return i(this,void 0,void 0,(function*(){return(yield this.GetData("seasons.json?limit=200",!0,72)).MRData.SeasonTable.Seasons}))}GetSeasonRaces(t){return i(this,void 0,void 0,(function*(){return(yield this.GetData(`${t}.json`,!0,72)).MRData.RaceTable.Races}))}GetLastYearsResults(t){return i(this,void 0,void 0,(function*(){const e=(new Date).getFullYear()-1,n=(yield this.GetData(`${e}.json`,!0,72)).MRData.RaceTable.Races.findIndex((e=>e.Circuit.circuitName===t))+1;return(yield this.GetData(`${e}/${n}/results.json`,!1,0)).MRData.RaceTable.Races[0]}))}RefreshCache(){return i(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=o},107:function(t,e,n){var i=this&&this.__awaiter||function(t,e,n,i){return new(n||(n=Promise))((function(r,a){function o(t){try{l(i.next(t))}catch(t){a(t)}}function s(t){try{l(i.throw(t))}catch(t){a(t)}}function l(t){var e;t.done?r(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(o,s)}l((i=i.apply(t,e||[])).next())}))};Object.defineProperty(e,"__esModule",{value:!0});const r=n(694);class a extends r.ClientBase{constructor(t,e){super(),this.hass=t,this.entity=e}getRaceWeatherData(t,e){var n;return i(this,void 0,void 0,(function*(){const e=null===(n=this.hass.states[t.entity])||void 0===n?void 0:n.attributes;if(!e)throw new Error("Weather data not found for the specified entity.");return e}))}GetConstructorStandings(){var t,e,n;return i(this,void 0,void 0,(function*(){return null!==(n=null===(e=null===(t=this.hass.states[this.entity])||void 0===t?void 0:t.attributes)||void 0===e?void 0:e.constructor_standings)&&void 0!==n?n:[]}))}GetConstructorStandingsForSeason(t){var e,n;return i(this,void 0,void 0,(function*(){const i=null===(e=this.hass.states[this.entity])||void 0===e?void 0:e.attributes;if(t&&t!==parseFloat(null==i?void 0:i.season))throw new Error("This entity is only valid for the current season. Please use source: jolpi for other seasons.");return null!==(n=null==i?void 0:i.constructor_standings)&&void 0!==n?n:[]}))}GetDriverStandings(){var t,e,n;return i(this,void 0,void 0,(function*(){return null!==(n=null===(e=null===(t=this.hass.states[this.entity])||void 0===t?void 0:t.attributes)||void 0===e?void 0:e.driver_standings)&&void 0!==n?n:[]}))}GetDriverStandingsForSeason(t){var e,n;return i(this,void 0,void 0,(function*(){const i=null===(e=this.hass.states[this.entity])||void 0===e?void 0:e.attributes;if(t&&t!==parseFloat(null==i?void 0:i.season))throw new Error("This entity is only valid for the current season. Please use source: jolpi for other seasons.");return null!==(n=null==i?void 0:i.driver_standings)&&void 0!==n?n:[]}))}GetSchedule(t){var e,n;return i(this,void 0,void 0,(function*(){const i=null===(e=this.hass.states[this.entity])||void 0===e?void 0:e.attributes;if(t!==parseFloat(null==i?void 0:i.season))throw new Error("This entity is only valid for the current season. Please use source: jolpi for other seasons.");return null!==(n=null==i?void 0:i.races)&&void 0!==n?n:[]}))}GetLastResult(){throw new Error("Method not implemented.")}GetSprintResults(t,e){throw new Error("Method not implemented.")}GetQualifyingResults(t,e){throw new Error("Method not implemented.")}GetResults(t,e){throw new Error("Method not implemented.")}GetSeasons(){throw new Error("Method not implemented.")}GetSeasonRaces(t){throw new Error("Method not implemented.")}RefreshCache(){throw new Error("Method not implemented.")}}e.default=a},661:(t,e,n)=>{Object.defineProperty(e,"__esModule",{value:!0});const i=n(198),r=n(438);e.default=class{GetImage(t){const e=localStorage.getItem(t);if(e){const t=JSON.parse(e),n=new Date;if(n.setHours(n.getHours()-672),new Date(t.created)>n)return t.data}return fetch(t).then((t=>t.blob())).then((e=>{const n=new FileReader;n.readAsDataURL(e),n.onloadend=function(){const e={data:n.result,created:new Date};return localStorage.setItem(t,JSON.stringify(e)),e.data}})),t}GetTeamLogoImage(t,e){if(t=t.toLocaleLowerCase().replace("_","-"),e<2026){const e=[{teamName:"red-bull",corrected:"red-bull-racing"},{teamName:"alfa",corrected:"alfa-romeo"},{teamName:"haas",corrected:"haas-f1-team"},{teamName:"sauber",corrected:"kick-sauber"}].filter((e=>e.teamName==t));return e.length>0&&(t=e[0].corrected),this.GetImage(`${i.ImageConstants.TeamLogoCDNLegacy}/2024/${t.toLowerCase()}-logo.png.transform/2col-retina/image.png`)}const n=[{teamName:"red-bull",corrected:"redbullracing"},{teamName:"rb",corrected:"racingbulls"},{teamName:"haas",corrected:"haasf1team"},{teamName:"aston-martin",corrected:"astonmartin"}].filter((e=>e.teamName==t));return n.length>0&&(t=n[0].corrected),this.GetImage(`${i.ImageConstants.TeamLogoCDN}2026/${t.toLowerCase()}/2026${t.toLowerCase()}logo.webp`)}GetTrackLayoutImage(t){const e=(0,r.getCircuitNameLegacy)(t.Circuit.Location);return parseInt(t.season)<2026?this.GetImage(`${i.ImageConstants.F1CDNLegacy}/${e}_Circuit`):this.GetImage(`${i.ImageConstants.F1CDN}${(0,r.getCircuitName)(t).toLowerCase()}detailed.webp`)}}},959:function(t,e,n){var i=this&&this.__awaiter||function(t,e,n,i){return new(n||(n=Promise))((function(r,a){function o(t){try{l(i.next(t))}catch(t){a(t)}}function s(t){try{l(i.throw(t))}catch(t){a(t)}}function l(t){var e;t.done?r(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(o,s)}l((i=i.apply(t,e||[])).next())}))};Object.defineProperty(e,"__esModule",{value:!0});const r=n(694);class a extends r.ClientBase{constructor(){super(...arguments),this.baseUrl="https://restcountries.com/v2",this.allEndpoint="all?fields=name,flag,flags,nativeName,demonym,population,altSpellings"}GetAll(){return i(this,void 0,void 0,(function*(){return yield this.GetData(this.allEndpoint,!0,730)}))}GetCountriesFromLocalStorage(){const t=localStorage.getItem(this.allEndpoint);if(t){const e=JSON.parse(t);return JSON.parse(e.data)}return[]}}e.default=a},338:function(t,e,n){var i=this&&this.__awaiter||function(t,e,n,i){return new(n||(n=Promise))((function(r,a){function o(t){try{l(i.next(t))}catch(t){a(t)}}function s(t){try{l(i.throw(t))}catch(t){a(t)}}function l(t){var e;t.done?r(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(o,s)}l((i=i.apply(t,e||[])).next())}))};Object.defineProperty(e,"__esModule",{value:!0});const r=n(241),a=n(694);class o extends a.ClientBase{constructor(t,e){super(),this.unitGroup="metric",this.baseUrl="https://weather.visualcrossing.com/VisualCrossingWebServices/rest/services/timeline",this.calculateWindDirection=t=>{const e=[{label:"N",range:[0,11.25]},{label:"NNE",range:[11.25,33.75]},{label:"NE",range:[33.75,56.25]},{label:"ENE",range:[56.25,78.75]},{label:"E",range:[78.75,101.25]},{label:"ESE",range:[101.25,123.75]},{label:"SE",range:[123.75,146.25]},{label:"SSE",range:[146.25,168.75]},{label:"S",range:[168.75,191.25]},{label:"SSW",range:[191.25,213.75]},{label:"SW",range:[213.75,236.25]},{label:"WSW",range:[236.25,258.75]},{label:"W",range:[258.75,281.25]},{label:"WNW",range:[281.25,303.75]},{label:"NW",range:[303.75,326.25]},{label:"NNW",range:[326.25,348.75]},{label:"N",range:[348.75,360]}];for(const{label:n,range:i}of e)if(t>=i[0]&&t<=i[1])return n},this.apiKey=t,this.unitGroup=null!=e?e:this.unitGroup}getRaceWeatherData(t,e){return i(this,void 0,void 0,(function*(){const n=`${e.Circuit.Location.lat}, ${e.Circuit.Location.long}/${e.date}T${e.time}?unitGroup=${this.unitGroup}&key=${this.apiKey}&contentType=json`,i=yield this.GetData(n,!0,1),a=null==i?void 0:i.days[0];return{race_temperature:a.temp,race_temperature_unit:t.unit===r.WeatherUnit.Metric?"celsius":"fahrenheit",race_humidity:a.humidity,race_humidity_unit:"%",race_cloud_cover:a.cloudcover,race_cloud_cover_unit:"%",race_precipitation:a.precip,race_precipitation_unit:"mm",race_wind_speed:a.windspeed,race_wind_speed_unit:"m/s",race_wind_direction:this.calculateWindDirection(a.winddir),race_wind_from_direction_degrees:a.winddir,race_wind_from_direction_unit:"degrees",race_feelslike:a.feelslike,race_feelslike_unit:t.unit===r.WeatherUnit.Metric?"celsius":"fahrenheit",race_precipitation_prob:a.precipprob,icon:"",friendly_name:"visualcrossing"}}))}}e.default=o},366:(t,e,n)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.BaseCard=void 0;const i=n(470),r=n(661),a=n(338),o=n(241),s=n(107);e.BaseCard=class{constructor(t){var e,n,l;this.config=t.config,this.hass=t._hass,this.client=this.config.source===o.F1DataSource.F1Sensor?new s.default(this.hass,this.config.entity):new i.default,this.resultsClient=new i.default,this.parent=t,this.weatherClient=(null===(e=this.config.weather_options)||void 0===e?void 0:e.source)?new s.default(this.hass,this.config.entity):new a.default(null!==(l=null===(n=this.config.weather_options)||void 0===n?void 0:n.api_key)&&void 0!==l?l:""),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,n;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!==(e=null==i?void 0:i.selectedSeason)&&void 0!==e?e:(new Date).getFullYear(),selectedTabIndex:null!==(n=null==i?void 0:i.selectedTabIndex)&&void 0!==n?n:0}}getParentCardValues(){var t,e,n;const i=null!==(t=this.parent.properties)&&void 0!==t?t:new Map,r=null!==(e=i.get("cardValues"))&&void 0!==e?e:{};return r.selectedSeason=null!==(n=r.selectedSeason)&&void 0!==n?n:(new Date).getFullYear(),{properties:r,cardValues:i}}}},169:(t,e,n)=>{Object.defineProperty(e,"__esModule",{value:!0});const i=n(639),r=n(557),a=n(438),o=n(366);class s extends o.BaseCard{constructor(t){super(t),this.defaultTranslations={constructor:"Constructor",points:"Pts",wins:"Wins",no_standings:"No standings available yet",selectseason:"Select season"}}cardSize(){return 11}renderStandingRow(t,e){var n;return i.html`<tr><td class="width-40 text-center">${t.position}</td><td>${(null===(n=this.config.standings)||void 0===n?void 0:n.show_teamlogo)?i.html`<img class="constructor-logo" height="20" width="20" src="${(0,a.getTeamImage)(this,t.Constructor.constructorId,e)}"> `:""} ${t.Constructor.name}</td><td class="width-60 text-center">${t.points}</td><td class="text-center">${t.wins}</td></tr>`}render(){var t;const{selectedSeason:e}=this.getProperties?this.getProperties():{selectedSeason:(new Date).getFullYear()},n=t=>{this.setSeason(t)};return i.html`${(null===(t=this.config.standings)||void 0===t?void 0:t.hide_season_selector)?"":i.html`<table><tr><td>Season<br>${(0,r.until)(this.resultsClient.GetSeasons().then((t=>{const r=t.reverse();return i.html`<select name="selectedSeason" @change="${n}"><option value="0">${this.translation("selectseason")}</option>${r.map((t=>i.html`<option value="${t.season}" ?selected="${e===parseInt(t.season)}">${t.season}</option>`))}</select>`})).catch((()=>i.html`${(0,a.getApiErrorMessage)("seasons")}`)),i.html`${(0,a.getApiLoadingMessage)()}`)}</td></tr></table>`} ${(0,r.until)(this.resultsClient.GetConstructorStandingsForSeason(e).then((t=>0===t.length?i.html`${(0,a.getEndOfSeasonMessage)(this.translation("no_standings"))}`:i.html`<table><thead><tr><th class="width-50"> </th><th>${this.translation("constructor")}</th><th class="width-60 text-center">${this.translation("points")}</th><th class="text-center">${this.translation("wins")}</th></tr></thead><tbody>${(0,a.reduceArray)(t,this.config.row_limit).map((t=>this.renderStandingRow(t,e)))}</tbody></table>`)).catch((()=>i.html`${(0,a.getApiErrorMessage)("standings")}`)),i.html`${(0,a.getApiLoadingMessage)()}`)}`}setSeason(t){const e=t.target.value,{properties:n,cardValues:i}=this.getParentCardValues();n.selectedSeason=e,i.set("cardValues",n),this.parent.properties=i}}e.default=s},849:function(t,e,n){var i=this&&this.__await||function(t){return this instanceof i?(this.v=t,this):new i(t)},r=this&&this.__asyncGenerator||function(t,e,n){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var r,a=n.apply(t,e||[]),o=[];return r={},s("next"),s("throw"),s("return"),r[Symbol.asyncIterator]=function(){return this},r;function s(t){a[t]&&(r[t]=function(e){return new Promise((function(n,i){o.push([t,e,n,i])>1||l(t,e)}))})}function l(t,e){try{(n=a[t](e)).value instanceof i?Promise.resolve(n.value.v).then(c,d):u(o[0][2],n)}catch(t){u(o[0][3],t)}var n}function c(t){l("next",t)}function d(t){l("throw",t)}function u(t,e){t(e),o.shift(),o.length&&l(o[0][0],o[0][1])}};Object.defineProperty(e,"__esModule",{value:!0});const a=n(313),o=n(639),s=n(557),l=n(810),c=n(22),d=n(241),u=n(438),h=n(366);class m extends h.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",round:"Round",racename:"Race name",circuitname:"Circuit name",location:"Location",city:"City",racetime:"Race",sprint:"Sprint",qualifying:"Qualifying",sprint_qualifying:"Sprint Qualifying",until:"Until"},this.config.countdown_type=null!==(e=this.config.countdown_type)&&void 0!==e?e:d.CountdownType.Race}cardSize(){return this.config.show_raceinfo?12:6}renderHeader(t){return this.config.show_raceinfo?o.html`<table><tr><td colspan="5">${(0,u.renderHeader)(this,t)}</td></tr>${(0,u.renderRaceInfo)(this,t)}</table>`:null}countDownTillDate(t){var e;return r(this,arguments,(function*(){for(;t>new Date;){const n=(new Date).getTime(),r=t.getTime()-n,a=Math.floor(r/864e5),o=Math.floor(r%864e5/36e5),s=Math.floor(r%36e5/6e4),l=Math.floor(r%6e4/1e3),c=null!==(e=this.config.countdown_format)&&void 0!==e?e:"d h m s";let d="";c.includes("d")&&(d+=`${a}${this.translation("days")} `),c.includes("h")&&(d+=`${o}${this.translation("hours")} `),c.includes("m")&&(d+=`${s}${this.translation("minutes")} `),c.includes("s")&&(d+=`${l}${this.translation("seconds")} `),yield yield i(d),yield i(new Promise((t=>setTimeout(t,1e3))))}yield yield i(this.translation("racenow"))}))}render(){const t=t=>{this.hass&&this.config.actions&&t.detail.action&&(0,u.clickHandler)(this.parent,this.config,this.hass,t)};return o.html`${(0,s.until)(this.client.GetSchedule((new Date).getFullYear()).then((e=>{var n,i;const{nextRace:r,raceDateTime:s,countdownType:d}=this.getNextEvent(e);if(!r)return(0,u.getEndOfSeasonMessage)(this.translation("endofseason"));const h=this.countDownTillDate(s),m=void 0!==this.config.actions;return o.html`<table @action="${t}" .actionHandler="${(0,c.actionHandler)({hasHold:(0,a.hasAction)(null===(n=this.config.actions)||void 0===n?void 0:n.hold_action),hasDoubleClick:(0,a.hasAction)(null===(i=this.config.actions)||void 0===i?void 0:i.double_tap_action)})}" class="${m?"clickable":null}"><tr><td><h2 class="${this.config.f1_font?"formulaone-font":""}"><img height="25" src="${(0,u.getCountryFlagByName)(this,r.Circuit.Location.country)}"> ${r.round} : ${r.raceName}</h2></td></tr><tr><td class="text-center"><h1 class="${this.config.f1_font?"formulaone-font":""}">${(0,l.asyncReplace)(h)}</h1></td></tr>${Array.isArray(this.config.countdown_type)&&this.config.countdown_type.length>1?o.html`<tr><td class="text-center"><h1 class="${this.config.f1_font?"formulaone-font":""}">${this.translation("until")} ${this.translation(d.toLowerCase())}</h1><h3 class="${this.config.f1_font?"formulaone-font":""}">${this.config.show_event_details?(0,a.formatDateTime)(s,this.hass.locale):""}</h3></td></tr>`:null}</table>${this.renderHeader(r)}`})).catch((()=>o.html`${(0,u.getApiErrorMessage)("next race")}`)),o.html`${(0,u.getApiLoadingMessage)()}`)}`}getNextEvent(t){var e;const n=t.filter((t=>{const e=new Date(t.date+"T"+t.time);return e.setHours(e.getHours()+3),e>=new Date}))[0];let i=null,r=this.config.countdown_type;if(n){const t=this.config.countdown_type,a=[{Date:n.FirstPractice?new Date(n.FirstPractice.date+"T"+n.FirstPractice.time):null,Type:d.CountdownType.Practice1},{Date:n.SecondPractice?new Date(n.SecondPractice.date+"T"+n.SecondPractice.time):null,Type:d.CountdownType.Practice2},{Date:n.ThirdPractice?new Date(n.ThirdPractice.date+"T"+n.ThirdPractice.time):null,Type:d.CountdownType.Practice3},{Date:n.Sprint?new Date(n.Sprint.date+"T"+n.Sprint.time):null,Type:d.CountdownType.Sprint},{Date:n.SprintQualifying?new Date(n.SprintQualifying.date+"T"+n.SprintQualifying.time):null,Type:d.CountdownType.SprintQualifying},{Date:n.Qualifying?new Date(n.Qualifying.date+"T"+n.Qualifying.time):null,Type:d.CountdownType.Qualifying},{Date:new Date(n.date+"T"+n.time),Type:d.CountdownType.Race}].filter((t=>t.Date)).filter((t=>t.Date>new Date)).sort(((t,e)=>t.Date.getTime()-e.Date.getTime())).filter((e=>null==t?void 0:t.includes(e.Type)))[0];i=null==a?void 0:a.Date,r=null!==(e=null==a?void 0:a.Type)&&void 0!==e?e:r}return{nextRace:n,raceDateTime:i,countdownType:r}}}e.default=m},138:(t,e,n)=>{Object.defineProperty(e,"__esModule",{value:!0});const i=n(639),r=n(557),a=n(438),o=n(366);class s extends o.BaseCard{constructor(t){super(t),this.defaultTranslations={driver:"Driver",team:"Team",points:"Pts",wins:"Wins",no_standings:"No standings available yet",selectseason:"Select season"}}cardSize(){return 12}renderStandingRow(t,e){var n,r;return i.html`<tr><td class="width-40 text-center">${t.position}</td><td>${(null===(n=this.config.standings)||void 0===n?void 0:n.show_flag)?i.html`<img height="10" width="20" src="${(0,a.getCountryFlagByNationality)(this,t.Driver.nationality)}"> `:""}${t.Driver.code}</td><td>${(0,a.getDriverName)(t.Driver,this.config)}</td>${(null===(r=this.config.standings)||void 0===r?void 0:r.show_team)?i.html`${(0,a.renderConstructorColumn)(this,t.Constructors[t.Constructors.length-1],e)}`:""}<td class="width-60 text-center">${t.points}</td><td class="text-center">${t.wins}</td></tr>`}render(){var t;const{selectedSeason:e}=this.getProperties?this.getProperties():{selectedSeason:(new Date).getFullYear()},n=t=>{this.setSeason(t)};return i.html`${(null===(t=this.config.standings)||void 0===t?void 0:t.hide_season_selector)?"":i.html`<table><tr><td>Season<br>${(0,r.until)(this.resultsClient.GetSeasons().then((t=>{var r;const a=t.reverse();return(null===(r=this.config.standings)||void 0===r?void 0:r.hide_season_selector)?"":i.html`<select name="selectedSeason" @change="${n}"><option value="0">${this.translation("selectseason")}</option>${a.map((t=>i.html`<option value="${t.season}" ?selected="${e===parseInt(t.season)}">${t.season}</option>`))}</select>`})).catch((()=>i.html`${(0,a.getApiErrorMessage)("seasons")}`)),i.html`${(0,a.getApiLoadingMessage)()}`)}</td></tr></table>`} ${(0,r.until)(this.resultsClient.GetDriverStandingsForSeason(e).then((t=>{var n;return 0===t.length?i.html`${(0,a.getEndOfSeasonMessage)(this.translation("no_standings"))}`:i.html`<table><thead><tr><th class="width-50" colspan="2"> </th><th>${this.translation("driver")}</th>${(null===(n=this.config.standings)||void 0===n?void 0:n.show_team)?i.html`<th>${this.translation("team")}</th>`:""}<th class="width-60 text-center">${this.translation("points")}</th><th class="text-center">${this.translation("wins")}</th></tr></thead><tbody>${(0,a.reduceArray)(t,this.config.row_limit).map((t=>this.renderStandingRow(t,e)))}</tbody></table>`})).catch((()=>i.html`${(0,a.getApiErrorMessage)("standings")}`)),i.html`${(0,a.getApiLoadingMessage)()}`)}`}setSeason(t){const e=t.target.value,{properties:n,cardValues:i}=this.getParentCardValues();n.selectedSeason=e,i.set("cardValues",n),this.parent.properties=i}}e.default=s},507:(t,e,n)=>{Object.defineProperty(e,"__esModule",{value:!0});const i=n(639),r=n(557),a=n(438),o=n(366);class s extends o.BaseCard{constructor(t){super(t),this.defaultTranslations={driver:"Driver",grid:"Grid",points:"Points",status:"Status",no_result:"No result available yet"}}cardSize(){return 11}renderResultRow(t){return i.html`<tr><td class="width-50 text-center">${t.position}</td><td>${(0,a.getDriverName)(t.Driver,this.config)}</td><td>${t.grid}</td><td class="width-60 text-center">${t.points}</td><td class="width-50 text-center">${(0,a.translateStatus)(t.status,this.config)}</td></tr>`}render(){return i.html`${(0,r.until)(this.client.GetLastResult().then((t=>t?i.html`<table><tr><td>${(0,a.renderHeader)(this,t)}</td></tr></table><table><thead><tr><th> </th><th>${this.translation("driver")}</th><th class="text-center">${this.translation("grid")}</th><th class="text-center">${this.translation("points")}</th><th>${this.translation("status")}</th></tr></thead><tbody>${(0,a.reduceArray)(t.Results,this.config.row_limit).map((t=>this.renderResultRow(t)))}</tbody></table>`:i.html`${(0,a.getEndOfSeasonMessage)(this.translation("no_result"))}`)).catch((()=>i.html`${(0,a.getApiErrorMessage)("last result")}`)),i.html`${(0,a.getApiLoadingMessage)()}`)}`}}e.default=s},840:(t,e,n)=>{Object.defineProperty(e,"__esModule",{value:!0});const i=n(639),r=n(557),a=n(438),o=n(366),s=n(300),l=n(241);class c extends o.BaseCard{constructor(){super(...arguments),this.defaultTranslations={date:"Date",practice1:"Practice 1",practice2:"Practice 2",practice3:"Practice 3",race:"Race",round:"Round",racename:"Race name",circuitname:"Circuit name",location:"Location",city:"City",racetime:"Race",sprint:"Sprint",qualifying:"Qualifying",sprint_qualifying:"Sprint Qualifying",endofseason:"Season is over. See you next year!"}}cardSize(){return 8}render(){return i.html`${(0,r.until)(this.client.GetSchedule((new Date).getFullYear()).then((t=>{const e=this.config.next_race_delay||0,n=t.filter((t=>{const n=new Date(t.date+"T"+t.time);return n.setHours(n.getHours()+e),n>=new Date}))[0];return n?i.html`<table><tbody><tr><td colspan="5">${(0,a.renderHeader)(this,n)}</td></tr>${this.config.show_raceinfo?(0,a.renderRaceInfo)(this,n):this.config.only_show_date?i.html`<tr><td class="text-center"><h1 class="${this.config.f1_font?"formulaone-font":""}">${this.renderDateTime(n)}</h1></td></tr>`:null}</tbody></table>`:(0,a.getEndOfSeasonMessage)(this.translation("endofseason"))})).catch((()=>i.html`${(0,a.getApiErrorMessage)("next race")}`)),i.html`${(0,a.getApiLoadingMessage)()}`)}`}renderDateTime(t){switch(this.config.next_race_display){case l.NextRaceDisplay.DateOnly:return(0,s.formatDateNumeric)(new Date(t.date+"T"+t.time),this.hass.locale,this.config.date_locale);case l.NextRaceDisplay.TimeOnly:return new Date(t.date+"T"+t.time).toLocaleTimeString(this.hass.locale.language,{hour:"2-digit",minute:"2-digit"});case l.NextRaceDisplay.DateAndTime:return(0,s.formatDateNumeric)(new Date(t.date+"T"+t.time),this.hass.locale,this.config.date_locale)+" "+new Date(t.date+"T"+t.time).toLocaleTimeString(this.hass.locale.language,{hour:"2-digit",minute:"2-digit"});default:return(0,s.formatDateNumeric)(new Date(t.date+"T"+t.time),this.hass.locale,this.config.date_locale)}return null}}e.default=c},74:(t,e,n)=>{Object.defineProperty(e,"__esModule",{value:!0});const i=n(639),r=n(557),a=n(241),o=n(438),s=n(366);class l extends s.BaseCard{constructor(t){if(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",finished:"Finished",retired:"Retired",disqualified:"Disqualified",notclassified:"Not classified"},this.icons={sprint:"mdi:flag-checkered",qualifying:"mdi:timer-outline",results:"mdi:trophy"},this.renderTabsHtml=(t,e,n)=>n?i.html`<table><tr><td colspan="2">${this.renderHeader(n)}</td></tr>${t.filter((t=>t.content)).length>0?i.html`<tr class="transparent"><td colspan="2"><mwc-tab-bar @MDCTabBar:activated="${t=>this.setSelectedTabIndex(t.detail.index)}">${t.filter((t=>!t.hide)).map((t=>i.html`<mwc-tab ?hasImageIcon="${t.icon}"><ha-icon slot="icon" icon="${t.icon}"></ha-icon></mwc-tab>`))}</mwc-tab-bar><section><article>${t.filter((t=>!t.hide)).find(((t,n)=>n==e)).content}</article></section></td></tr>`:i.html`<tr><td colspan="2">${this.translation("noresults")}</td></tr>`}</table>`:i.html``,this.config.source===a.F1DataSource.F1Sensor)throw new Error("F1Sensor is not supported for this card type. Please use source: jolpi.")}cardSize(){return 12}renderTabs(t){return[{title:"Results",icon:this.icon("results"),content:this.renderResults(t),order:this.tabOrder("results")},{title:"Qualifying",icon:this.icon("qualifying"),content:this.renderQualifying(t),order:this.tabOrder("qualifying")},{title:"Sprint",icon:this.icon("sprint"),content:this.renderSprint(t),hide:!(null==t?void 0:t.SprintResults),order:this.tabOrder("sprint")}].sort(((t,e)=>t.order-e.order))}renderSprint(t){var e;return(null==t?void 0:t.SprintResults)?i.html`<table class="nopadding"><thead><tr><th> </th><th>${this.translation("driver")}</th>${(null===(e=this.config.standings)||void 0===e?void 0:e.show_team)?i.html`<th>${this.translation("team")}</th>`:""}<th class="text-center">${this.translation("grid")}</th><th class="text-center">${this.translation("points")}</th><th class="text-center">${this.translation("status")}</th></tr></thead><tbody>${(0,o.reduceArray)(t.SprintResults,this.config.row_limit).map((e=>this.renderResultRow(e,!1,t.season)))}</tbody></table>`:null}renderQualifying(t){var e;return(null==t?void 0:t.QualifyingResults)?i.html`<table class="nopadding"><thead><tr><th> </th><th>${this.translation("driver")}</th>${(null===(e=this.config.standings)||void 0===e?void 0:e.show_team)?i.html`<th>${this.translation("team")}</th>`:""}<th class="text-center">${this.translation("q1")}</th><th class="text-center">${this.translation("q2")}</th><th class="text-center">${this.translation("q3")}</th></tr></thead><tbody>${(0,o.reduceArray)(t.QualifyingResults,this.config.row_limit).map((e=>this.renderQualifyingResultRow(e,t.season)))}</tbody></table>`:null}renderResults(t){var e,n;const r=null===(e=null==t?void 0:t.Results)||void 0===e?void 0:e.filter((t=>{var e;return"1"===(null===(e=t.FastestLap)||void 0===e?void 0:e.rank)}))[0];return(null==t?void 0:t.Results)?i.html`<table class="nopadding"><thead><tr><th> </th><th>${this.translation("driver")}</th>${(null===(n=this.config.standings)||void 0===n?void 0:n.show_team)?i.html`<th>${this.translation("team")}</th>`:""}<th class="text-center">${this.translation("grid")}</th><th class="text-center">${this.translation("points")}</th><th>${this.translation("status")}</th></tr></thead><tbody>${(0,o.reduceArray)(t.Results,this.config.row_limit).map((e=>this.renderResultRow(e,e.position===(null==r?void 0:r.position),t.season)))}</tbody>${r?i.html`<tfoot><tr><td colspan="6" class="text-right"><small>* Fastest lap: ${r.FastestLap.Time.time}</small></td></tr></tfoot>`:""}</table>`:null}renderResultRow(t,e,n){var r,a;return i.html`<tr><td class="width-50 text-center">${t.position}</td><td>${(null===(r=this.config.standings)||void 0===r?void 0:r.show_flag)?i.html`<img height="10" width="20" src="${(0,o.getCountryFlagByNationality)(this,t.Driver.nationality)}"> `:""}${(0,o.getDriverName)(t.Driver,this.config)}${e?" *":""}</td>${(null===(a=this.config.standings)||void 0===a?void 0:a.show_team)?i.html`${(0,o.renderConstructorColumn)(this,t.Constructor,parseInt(n))}`:""}<td>${t.grid}</td><td class="width-60 text-center">${t.points}</td><td class="width-50 text-center">${(0,o.translateStatus)(t.status,this.config)}</td></tr>`}renderQualifyingResultRow(t,e){var n,r;return i.html`<tr><td class="width-50 text-center">${t.position}</td><td>${(null===(n=this.config.standings)||void 0===n?void 0:n.show_flag)?i.html`<img height="10" width="20" src="${(0,o.getCountryFlagByNationality)(this,t.Driver.nationality)}"> `:""}${(0,o.getDriverName)(t.Driver,this.config)}</td>${(null===(r=this.config.standings)||void 0===r?void 0:r.show_team)?i.html`${(0,o.renderConstructorColumn)(this,t.Constructor,parseInt(e))}`:""}<td>${t.Q1}</td><td>${t.Q2}</td><td>${t.Q3}</td></tr>`}renderHeader(t){return null==t||parseInt(t.season)<2018?null:(0,o.renderHeader)(this,t)}render(){const{races:t,selectedRace:e,selectedSeason:n,selectedTabIndex:a}=this.getProperties();n!==(new Date).getFullYear()||e||this.getLastResult();const s=t=>{this.setRaces(t)},l=this.renderTabs(e);return i.html`<table><tr><td>${this.translation("seasonheader")}<br>${(0,r.until)(this.resultsClient.GetSeasons().then((t=>{const e=t.reverse();return i.html`<select name="selectedSeason" @change="${s}"><option value="0">${this.translation("selectseason")}</option>${e.map((t=>i.html`<option value="${t.season}" ?selected="${n===parseInt(t.season)}">${t.season}</option>`))}</select>`})).catch((()=>i.html`${(0,o.getApiErrorMessage)("seasons")}`)),i.html`${(0,o.getApiLoadingMessage)()}`)}</td><td>${this.translation("raceheader")}<br><select name="selectedRace" @change="${t=>{this.setSelectedRace(t)}}"><option value="0" ?selected="${void 0===e}">${this.translation("selectrace")}</option>${null==t?void 0:t.map((t=>i.html`<option value="${t.round}" ?selected="${(null==e?void 0:e.round)==t.round}">${t.raceName}</option>`))}</select></td></tr></table>${this.renderTabsHtml(l,a,e)}`}setSelectedRace(t){const e=parseInt(t.target.value),{properties:n,cardValues:i}=this.getParentCardValues();n.selectedRound=e;const r=n.selectedSeason;Promise.all([this.resultsClient.GetResults(r,e),this.resultsClient.GetQualifyingResults(r,e),this.resultsClient.GetSprintResults(r,e),this.resultsClient.GetSchedule(r)]).then((([t,r,a,o])=>{var s;let l=t.Races[0];l?(l.QualifyingResults=r.Races[0].QualifyingResults,l.SprintResults=null===(s=null==a?void 0:a.Races[0])||void 0===s?void 0:s.SprintResults,n.selectedSeason=l.season):l=o.filter((t=>parseInt(t.round)==e))[0],n.selectedRace=l,i.set("cardValues",n),this.parent.properties=i}))}setRaces(t){const e=t.target.value,{properties:n,cardValues:i}=this.getParentCardValues();this.resultsClient.GetSeasonRaces(parseInt(e)).then((t=>{n.selectedSeason=e,n.selectedRace=void 0,n.races=t,i.set("cardValues",n),this.parent.properties=i}))}getUpcomingRace(t,e){const n=e.filter((e=>{const n=new Date(e.date+"T"+e.time),i=new Date(e.Qualifying.date+"T"+e.Qualifying.time),r=e.Sprint?new Date(e.Sprint.date+"T"+e.Sprint.time):null;return n>=t&&i<t&&(null===r||r<t)}));return n.length>0?n[0]:null}getLastResult(){const t=new Date;console.log("Getting last result, schedule and season"),Promise.all([this.client.GetSchedule(t.getFullYear()),this.client.GetLastResult()]).then((([e,n])=>{const i=this.getUpcomingRace(t,e);let r=(new Date).getFullYear(),a=null!==i?parseInt(i.round):0,o={};null!==i?(o=i,a=parseInt(o.round),r=parseInt(o.season)):null!==n&&(o=n,a=parseInt(n.round),r=parseInt(n.season)),Promise.all([this.resultsClient.GetQualifyingResults(r,a),this.resultsClient.GetSprintResults(r,a),this.resultsClient.GetSeasonRaces(r)]).then((([t,e,n])=>{var i;const{properties:a,cardValues:s}=this.getParentCardValues();o.QualifyingResults=t.Races[0].QualifyingResults,o.SprintResults=null===(i=e.Races[0])||void 0===i?void 0:i.SprintResults,a.races=n,a.selectedRace=o,a.selectedSeason=r.toString(),console.log("Selected race: "+o.raceName),s.set("cardValues",a),this.parent.properties=s}))}))}setSelectedTabIndex(t){const{properties:e,cardValues:n}=this.getParentCardValues();e.selectedTabIndex=t,n.set("cardValues",e),this.parent.properties=n}icon(t){return!this.config.icons||Object.keys(this.config.icons).indexOf(t)<0?this.icons[t]:this.config.icons[t]}tabOrder(t){var e,n;const i=null!==(n=null===(e=this.config.tabs_order)||void 0===e?void 0:e.map((t=>t.toLowerCase())))&&void 0!==n?n:["results","qualifying","sprint"];return i.indexOf(t)}}e.default=l},465:(t,e,n)=>{Object.defineProperty(e,"__esModule",{value:!0});const i=n(313),r=n(639),a=n(557),o=n(300),s=n(241),l=n(438),c=n(366);class d extends c.BaseCard{constructor(t){super(t),this.defaultTranslations={date:"Date",round:"Race",time:"Time",location:"Location",endofseason:"Season is over. See you next year!"}}cardSize(){return 12}renderLocation(t){var e;const n=r.html`${(null===(e=this.config.standings)||void 0===e?void 0:e.show_flag)?r.html`<img height="10" width="20" src="${(0,l.getCountryFlagByName)(this,t.Location.country)}"> `:""}${t.Location.locality}, ${t.Location.country}`;return this.config.location_clickable?r.html`<a href="${t.url}" target="_blank">${n}</a>`:n}renderScheduleRow(t){const e=new Date(t.date+"T"+t.time),n=this.config.previous_race&&e<new Date?this.config.previous_race:"";return r.html`<tr class="${n}"><td class="width-50 text-center">${t.round}</td><td>${t.Circuit.circuitName}</td><td>${this.renderLocation(t.Circuit)}</td><td class="width-60 text-center">${(0,o.formatDate)(e,this.hass.locale,this.config.date_locale)}</td><td class="width-50 text-center">${(0,i.formatTime)(e,this.hass.locale)}</td></tr>`}render(){return r.html`${(0,a.until)(this.client.GetSchedule((new Date).getFullYear()).then((t=>{const e=this.config.previous_race===s.PreviousRaceDisplay.Hide?t.filter((t=>new Date(t.date+"T"+t.time)>=new Date)):t;return e.filter((t=>new Date(t.date+"T"+t.time)>=new Date))[0]?r.html`<table><thead><tr><th> </th><th>${this.translation("round")}</th><th>${this.translation("location")}</th><th class="text-center">${this.translation("date")}</th><th class="text-center">${this.translation("time")}</th></tr></thead><tbody>${(0,l.reduceArray)(e,this.config.row_limit).map((t=>this.renderScheduleRow(t)))}</tbody></table>`:(0,l.getEndOfSeasonMessage)(this.translation("endofseason"))})).catch((()=>r.html`${(0,l.getApiErrorMessage)("schedule")}`)),r.html`${(0,l.getApiLoadingMessage)()}`)}`}}e.default=d},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,n)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.actionHandler=e.actionHandlerBind=void 0;const i=n(395),r=n(313),a=n(110),o="ontouchstart"in window||navigator.maxTouchPoints>0||navigator.maxTouchPoints>0;class s extends HTMLElement{constructor(){super(),this.holdTime=500,this.held=!1,this.ripple=document.createElement("mwc-ripple")}connectedCallback(){Object.assign(this.style,{position:"absolute",width:o?"100px":"50px",height:o?"100px":"50px",transform:"translate(-50%, -50%)",pointerEvents:"none",zIndex:"999"}),this.appendChild(this.ripple),this.ripple.primary=!0,["touchcancel","mouseout","mouseup","touchmove","mousewheel","wheel","scroll"].forEach((t=>{document.addEventListener(t,(()=>{clearTimeout(this.timer),this.stopAnimation(),this.timer=void 0}),{passive:!0})}))}bind(t,e){if(t.actionHandler)return;t.actionHandler=!0,t.addEventListener("contextmenu",(t=>{const e=t||window.event;return e.preventDefault&&e.preventDefault(),e.stopPropagation&&e.stopPropagation(),e.cancelBubble=!0,e.returnValue=!1,!1}));const n=t=>{let e,n;this.held=!1,t.touches?(e=t.touches[0].pageX,n=t.touches[0].pageY):(e=t.pageX,n=t.pageY),this.timer=window.setTimeout((()=>{this.startAnimation(e,n),this.held=!0}),this.holdTime)},i=n=>{n.preventDefault(),["touchend","touchcancel"].includes(n.type)&&void 0===this.timer||(clearTimeout(this.timer),this.stopAnimation(),this.timer=void 0,this.held?(0,r.fireEvent)(t,"action",{action:"hold"}):e.hasDoubleClick?"click"===n.type&&n.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",n,{passive:!0}),t.addEventListener("touchend",i),t.addEventListener("touchcancel",i),t.addEventListener("mousedown",n,{passive:!0}),t.addEventListener("click",i),t.addEventListener("keyup",(t=>{13===t.keyCode&&i(t)}))}startAnimation(t,e){Object.assign(this.style,{left:`${t}px`,top:`${e}px`,display:null}),this.ripple.disabled=!1,this.ripple.active=!0,this.ripple.unbounded=!0}stopAnimation(){this.ripple.active=!1,this.ripple.disabled=!0,this.style.display="none"}}customElements.define("action-handler-formulaonecard",s),e.actionHandlerBind=(t,e)=>{const n=(()=>{const t=document.body;if(t.querySelector("action-handler-formulaonecard"))return t.querySelector("action-handler-formulaonecard");const e=document.createElement("action-handler-formulaonecard");return t.appendChild(e),e})();n&&n.bind(t,e)},e.actionHandler=(0,i.directive)(class extends i.Directive{update(t,[n]){return(0,e.actionHandlerBind)(t.element,n),a.noChange}render(t){}})},750:function(t,e,n){var i=this&&this.__decorate||function(t,e,n,i){var r,a=arguments.length,o=a<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,e,n,i);else for(var s=t.length-1;s>=0;s--)(r=t[s])&&(o=(a<3?r(o):a>3?r(e,n,o):r(e,n))||o);return a>3&&o&&Object.defineProperty(e,n,o),o};Object.defineProperty(e,"__esModule",{value:!0}),e.FormulaOneCardEditor=void 0;const r=n(898),a=n(194),o=n(429),s=n(110),l=n(639),c=n(15),d=n(851),u=n(241);let h=class extends r.default{render(){return this._hass&&this._config?this.renderForm([{controls:[{label:"Card Type (Required)",configValue:"card_type",type:a.FormControlType.Dropdown,items:(0,o.getDropdownOptionsFromEnum)(u.FormulaOneCardType)}]},{controls:[{label:"Title",configValue:"title",type:a.FormControlType.Textbox}]},{label:"Basic configuration",cssClass:"side-by-side",controls:[{label:"Use F1 font",configValue:"f1_font",type:a.FormControlType.Switch},{label:"Image clickable",configValue:"image_clickable",type:a.FormControlType.Switch},{label:"Show carnumber",configValue:"show_carnumber",type:a.FormControlType.Switch},{label:"Location clickable",configValue:"location_clickable",type:a.FormControlType.Switch},{label:"Show race information",configValue:"show_raceinfo",type:a.FormControlType.Switch},{label:"Hide track layout",configValue:"hide_tracklayout",type:a.FormControlType.Switch},{label:"Hide race dates and times",configValue:"hide_racedatetimes",type:a.FormControlType.Switch},{label:"Show last years result",configValue:"show_lastyears_result",type:a.FormControlType.Switch},{label:"Only show date",configValue:"only_show_date",type:a.FormControlType.Switch},{type:a.FormControlType.Filler},{label:"Row limit",configValue:"row_limit",type:a.FormControlType.Textbox},{label:"Date locale",configValue:"date_locale",type:a.FormControlType.Textbox}]},{label:"Countdown Type",hidden:this._config.card_type!==u.FormulaOneCardType.Countdown,cssClass:"side-by-side",controls:[{configValue:"countdown_type",type:a.FormControlType.Checkboxes,items:(0,o.getDropdownOptionsFromEnum)(u.CountdownType)}]},{hidden:this._config.card_type!==u.FormulaOneCardType.NextRace,controls:[{label:"Next race delay",configValue:"next_race_delay",type:a.FormControlType.Textbox}]},{hidden:this._config.card_type!==u.FormulaOneCardType.Schedule,controls:[{label:"Previous race",configValue:"previous_race",type:a.FormControlType.Dropdown,items:(0,o.getDropdownOptionsFromEnum)(u.PreviousRaceDisplay)}]},{label:"Standings",hidden:this._config.card_type!==u.FormulaOneCardType.ConstructorStandings&&this._config.card_type!==u.FormulaOneCardType.DriverStandings,cssClass:"side-by-side",controls:[{label:"Show team",configValue:"standings.show_team",type:a.FormControlType.Switch},{label:"Show flag",configValue:"standings.show_flag",type:a.FormControlType.Switch},{label:"Show teamlogo",configValue:"standings.show_teamlogo",type:a.FormControlType.Switch}]},{label:"Weather",hidden:this._config.card_type!==u.FormulaOneCardType.NextRace&&this._config.card_type!==u.FormulaOneCardType.Countdown,controls:[{label:"Show weather",configValue:"show_weather",type:a.FormControlType.Switch}]},{cssClass:"side-by-side",hidden:this._config.card_type!==u.FormulaOneCardType.NextRace&&this._config.card_type!==u.FormulaOneCardType.Countdown||!this._config.show_weather,controls:[{label:"API key",configValue:"weather_options.api_key",type:a.FormControlType.Textbox},{label:"Unit",configValue:"weather_options.unit",type:a.FormControlType.Dropdown,items:(0,o.getDropdownOptionsFromEnum)(u.WeatherUnit)},{label:"Show icon",configValue:"weather_options.show_icon",type:a.FormControlType.Switch},{label:"Show precipitation",configValue:"weather_options.show_precipitation",type:a.FormControlType.Switch},{label:"Show wind",configValue:"weather_options.show_wind",type:a.FormControlType.Switch},{label:"Show temperature",configValue:"weather_options.show_temperature",type:a.FormControlType.Switch},{label:"Show cloud coverage",configValue:"weather_options.show_cloud_cover",type:a.FormControlType.Switch},{label:"Show visibility",configValue:"weather_options.show_visibility",type:a.FormControlType.Switch}]},{label:"Tabs",hidden:this._config.card_type!==u.FormulaOneCardType.Results,controls:[{label:"Tabs order",configValue:"tabs_order",type:a.FormControlType.Textbox}]}]):l.html``}static get styles(){return s.css`.form-row{margin-bottom:10px}.form-control{display:flex;align-items:center}ha-switch{padding:16px 6px}.side-by-side{display:flex;flex-flow:row wrap}.side-by-side>label{width:100%}.side-by-side>.form-control{width:49%;padding:2px}ha-textfield{width:100%}.hidden{display:none}@media (max-width:600px){.side-by-side>.form-control{width:48%}}`}};h=i([(0,c.customElement)(d.CARD_EDITOR_NAME)],h),e.FormulaOneCardEditor=h},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,n){var i=this&&this.__decorate||function(t,e,n,i){var r,a=arguments.length,o=a<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,e,n,i);else for(var s=t.length-1;s>=0;s--)(r=t[s])&&(o=(a<3?r(o):a>3?r(e,n,o):r(e,n))||o);return a>3&&o&&Object.defineProperty(e,n,o),o},r=this&&this.__awaiter||function(t,e,n,i){return new(n||(n=Promise))((function(r,a){function o(t){try{l(i.next(t))}catch(t){a(t)}}function s(t){try{l(i.throw(t))}catch(t){a(t)}}function l(t){var e;t.done?r(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(o,s)}l((i=i.apply(t,e||[])).next())}))};Object.defineProperty(e,"__esModule",{value:!0});const a=n(147),o=n(15),s=n(241),l=n(110),c=n(438),d=n(657),u=n(278),h=n(169),m=n(138),p=n(465),f=n(840),g=n(507),v=n(849),_=n(74),y=n(959),$=n(851);console.info(`%c ${$.CARD_NAME.toUpperCase()} %c ${a.version}`,"color: cyan; background: black; font-weight: bold;","color: darkblue; background: white; font-weight: bold;"),window.customCards=window.customCards||[],window.customCards.push({type:"formulaone-card",name:"FormulaOne card",preview:!1,description:"Present the data of Formula One in a pretty way"});let w=class extends l.LitElement{set properties(t){this._cardValues=t,this.update(t)}get properties(){return this._cardValues}constructor(){super(),this.setCountryCache()}static getConfigElement(){return r(this,void 0,void 0,(function*(){return yield Promise.resolve().then((()=>n(750))),document.createElement($.CARD_EDITOR_NAME)}))}setConfig(t){(0,c.checkConfig)(t),this.config=Object.assign({},t)}setCountryCache(){(new y.default).GetAll().catch((()=>{this.warning="Country API is down, so flags are not available at the moment!",this.update(this._cardValues)}))}shouldUpdate(t){return(0,c.hasConfigOrCardValuesChanged)(this,t)}set hass(t){switch(this._hass=t,this.config.hass=t,this.config.card_type){case s.FormulaOneCardType.ConstructorStandings:this.card=new h.default(this);break;case s.FormulaOneCardType.DriverStandings:this.card=new m.default(this);break;case s.FormulaOneCardType.Schedule:this.card=new p.default(this);break;case s.FormulaOneCardType.NextRace:this.card=new f.default(this);break;case s.FormulaOneCardType.LastResult:this.card=new g.default(this);break;case s.FormulaOneCardType.Countdown:this.card=new v.default(this);break;case s.FormulaOneCardType.Results:this.card=new _.default(this)}}static get styles(){return(0,d.loadCustomFonts)(),u.styles}render(){if(!this._hass||!this.config)return l.html``;try{return l.html`<ha-card elevation="2">${this.renderRefreshButton()} ${this.warning?l.html`<hui-warning>${this.warning}</hui-warning>`:""} ${this.config.title?l.html`<h1 class="card-header${this.config.f1_font?" formulaone-font":""}">${this.config.title}</h1>`:""} ${this.card.render()}</ha-card>`}catch(t){return l.html`<hui-warning>${t.toString()}</hui-warning>`}}getCardSize(){return this.card.cardSize()}renderRefreshButton(){return this.config.show_refresh?l.html`<div class="refresh-cache" @click="${t=>this.refreshCache(t)}"><ha-icon slot="icon" icon="mdi:refresh"></ha-icon></div>`:null}refreshCache(t){console.log("Refreshing cache..."),this.card.client.RefreshCache()}};i([(0,o.property)()],w.prototype,"_hass",void 0),i([(0,o.property)()],w.prototype,"config",void 0),i([(0,o.property)()],w.prototype,"card",void 0),i([(0,o.property)()],w.prototype,"warning",void 0),i([(0,o.property)()],w.prototype,"properties",null),w=i([(0,o.customElement)($.CARD_NAME)],w),e.default=w},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/",TeamLogoCDNLegacy:"https://www.formula1.com/content/dam/fom-website/teams/",TeamLogoCDN:"https://media.formula1.com/image/upload/c_lfill,w_48/q_auto/v1740000000/common/f1/",F1CDNLegacy:"https://media.formula1.com/image/upload/f_auto,c_limit,q_auto,w_1320/content/dam/fom-website/2018-redesign-assets/Circuit%20maps%2016x9",F1CDN:"https://media.formula1.com/image/upload/c_fit,h_704/q_auto/v1740000001/common/f1/2026/track/2026track"},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,n)=>new Intl.DateTimeFormat(null!=n?n:e.language,{month:"2-digit",day:"2-digit"}).format(t),e.formatDateNumeric=(t,e,n)=>new Intl.DateTimeFormat(null!=n?n:e.language,{year:"2-digit",month:"2-digit",day:"2-digit"}).format(t)},141:(t,e,n)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.formatDateTimeRaceInfo=e.formatDateTime=void 0;const i=n(975);e.formatDateTime=(t,e)=>new Intl.DateTimeFormat(e.language,{year:"numeric",month:"long",day:"numeric",hour:(0,i.useAmPm)(e)?"numeric":"2-digit",minute:"2-digit",hour12:(0,i.useAmPm)(e)}).format(t),e.formatDateTimeRaceInfo=(t,e)=>new Intl.DateTimeFormat(e.language,{weekday:"short",hour:"2-digit",minute:"2-digit",hour12:(0,i.useAmPm)(e)}).format(t)},975:(t,e,n)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.useAmPm=void 0;const i=n(198);e.useAmPm=t=>{if(t.time_format===i.TimeFormat.language||t.time_format===i.TimeFormat.system){const e=t.time_format===i.TimeFormat.language?t.language:void 0,n=(new Date).toLocaleString(e);return n.includes("AM")||n.includes("PM")}return t.time_format===i.TimeFormat.am_pm}},278:(t,e,n)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.styles=void 0;const i=n(110);e.styles=i.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 n,i,r,a,o,s,l;Object.defineProperty(e,"__esModule",{value:!0}),e.FormulaOneCardType=e.PreviousRaceDisplay=e.CountdownType=e.WeatherUnit=e.NextRaceDisplay=e.WeatherSource=e.F1DataSource=void 0,(l=e.F1DataSource||(e.F1DataSource={})).Jolpi="jolpi",l.F1Sensor="f1sensor",(s=e.WeatherSource||(e.WeatherSource={})).VisualCrossing="visualcrossing",s.F1Sensor="f1sensor",(o=e.NextRaceDisplay||(e.NextRaceDisplay={})).DateOnly="date",o.TimeOnly="time",o.DateAndTime="datetime",(a=e.WeatherUnit||(e.WeatherUnit={})).Metric="metric",a.MilesCelsius="uk",a.MilesFahrenheit="us",(r=e.CountdownType||(e.CountdownType={})).Race="race",r.Qualifying="qualifying",r.Practice1="practice1",r.Practice2="practice2",r.Practice3="practice3",r.Sprint="sprint",r.SprintQualifying="sprint_qualifying",(i=e.PreviousRaceDisplay||(e.PreviousRaceDisplay={})).Strikethrough="strikethrough",i.Italic="italic",i.Hide="hide",(n=e.FormulaOneCardType||(e.FormulaOneCardType={})).DriverStandings="driver_standings",n.ConstructorStandings="constructor_standings",n.NextRace="next_race",n.Schedule="schedule",n.LastResult="last_result",n.Results="results",n.Countdown="countdown"},438:(t,e,n)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.translateStatus=e.renderConstructorColumn=e.reduceArray=e.getRefreshTime=e.renderWeatherInfo=e.renderLastYearsResults=e.renderEventColumn=e.renderRaceInfo=e.renderHeader=e.clickHandler=e.getEndOfSeasonMessage=e.getApiLoadingMessage=e.getApiErrorMessage=e.getDriverName=e.getCircuitNameLegacy=e.getCircuitName=e.getTeamImage=e.checkConfig=e.getCountryFlagByName=e.getCountryFlagByNationality=e.getCountries=e.hasConfigOrCardValuesChanged=void 0;const i=n(313),r=n(110),a=n(557),o=n(959),s=n(22),l=n(300),c=n(141),d=n(241);e.hasConfigOrCardValuesChanged=(t,e)=>{if(e.has("config"))return!0;const n=e.get("card");if(n&&n.parent)return n.parent.properties!==t.properties;const i=e.get("cardValues");return!!i&&i!=t.properties},e.getCountries=()=>(new o.default).GetCountriesFromLocalStorage(),e.getCountryFlagByNationality=(t,n)=>{const i=(0,e.getCountries)();n=n.trim();const r=[{demonym:"Argentinian",corrected:"Argentinean"},{demonym:"Argentine",corrected:"Argentinean"}].filter((t=>t.demonym==n));r.length>0&&(n=r[0].corrected);const a=i.filter((t=>t.demonym==n));return a.length>1?t.imageClient.GetImage(a.sort(((t,e)=>t.population>e.population?-1:1))[0].flags.png):t.imageClient.GetImage(a[0].flags.png)},e.getCountryFlagByName=(t,n)=>{const i=(0,e.getCountries)().filter((t=>{var e;return t.name==n||t.nativeName==n||(null===(e=t.altSpellings)||void 0===e?void 0:e.includes(n))}))[0];return t.imageClient.GetImage(i.flags.png)},e.checkConfig=t=>{if(void 0===t.card_type)throw new Error("Please define FormulaOne card type (card_type).")},e.getTeamImage=(t,e,n)=>t.imageClient.GetTeamLogoImage(e,n),e.getCircuitName=t=>{const e=[{countryDashed:"Spain",name:"Catalunya"},{countryDashed:"Belgium",name:"SpaFrancorchamps"},{countryDashed:"Hungary",name:"Hungaroring"},{countryDashed:"Brazil",name:"Interlagos"},{countryDashed:"USA",name:"LasVegas"},{countryDashed:"UAE",name:"YasMarina"},{countryDashed:"Singapore",name:"singapore"}].filter((e=>e.countryDashed==t.Circuit.Location.country));return e.length>0?e[0].name:t.Circuit.Location.locality.replace(" ","")},e.getCircuitNameLegacy=t=>{let e=t.country.replace(" ","-");const n=[{countryDashed:"UAE",name:"Abu_Dhabi"},{countryDashed:"UK",name:"Great_Britain"},{countryDashed:"Azerbaijan",name:"Baku"},{countryDashed:"Saudi-Arabia",name:"Saudi_Arabia"}].filter((t=>t.countryDashed==e));return n.length>0&&(e=n[0].name),"USA"!=t.country&&"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 n="VER"==t.code?1:t.permanentNumber;return`${t.givenName} ${t.familyName}${e.show_carnumber?` #${n}`:""}`},e.getApiErrorMessage=t=>r.html`<table><tr><td class="text-center"><ha-icon icon="mdi:alert-circle"></ha-icon>Error getting ${t}<ha-icon icon="mdi:alert-circle"></ha-icon></td></tr></table>`,e.getApiLoadingMessage=()=>r.html`<table><tr><td class="text-center"><ha-icon icon="mdi:car-speed-limiter"></ha-icon>Loading...<ha-icon icon="mdi:car-speed-limiter"></ha-icon></td></tr></table>`,e.getEndOfSeasonMessage=t=>r.html`<table><tr><td class="text-center"><ha-icon icon="mdi:flag-checkered"></ha-icon><strong>${t}</strong><ha-icon icon="mdi:flag-checkered"></ha-icon></td></tr></table>`,e.clickHandler=(t,e,n,r)=>{(0,i.handleAction)(t,n,e.actions,r.detail.action)},e.renderHeader=(t,n)=>{var a,o;const l=t.config.image_clickable||void 0!==t.config.actions,c=n.Circuit.url;t.config.image_clickable&&!t.config.actions&&(t.config.actions={tap_action:{action:"url",url_path:c}});const u=r.html`<img width="100%" src="${t.imageClient.GetTrackLayoutImage(n)}" @action="${n=>{t.hass&&t.config.actions&&n.detail.action&&t.config.image_clickable&&(0,e.clickHandler)(t.parent,t.config,t.hass,n)}}" .actionHandler="${(0,s.actionHandler)({hasHold:(0,i.hasAction)(null===(a=t.config.actions)||void 0===a?void 0:a.hold_action),hasDoubleClick:(0,i.hasAction)(null===(o=t.config.actions)||void 0===o?void 0:o.double_tap_action)})}" class="${l?" clickable":null}">`,h=r.html`<h2 class="${t.config.f1_font?"formulaone-font":""}"><img height="25" src="${(0,e.getCountryFlagByName)(t,n.Circuit.Location.country)}"> ${n.round} : ${n.raceName}</h2>`;return r.html`${t.config.card_type==d.FormulaOneCardType.Countdown?r.html``:h} ${t.config.hide_tracklayout?r.html``:u}<br>`},e.renderRaceInfo=(t,n)=>{const i=t.config,o=t.hass,s=i.show_weather?t.weatherClient.getRaceWeatherData(t.config.weather_options,n):Promise.resolve(null),d=i.show_lastyears_result?t.resultsClient.GetLastYearsResults(n.Circuit.circuitName):Promise.resolve(null),u=Promise.all([s,d]);return r.html`${(0,a.until)(u.then((([a,s])=>{const d=(0,e.renderWeatherInfo)(a),u=(0,e.renderLastYearsResults)(i,s);if(i.hide_racedatetimes&&(i.show_weather||i.show_lastyears_result))return r.html`${d}${u}`;const h=new Date(n.date+"T"+n.time),m=void 0!==n.FirstPractice?new Date(n.FirstPractice.date+"T"+n.FirstPractice.time):null,p=void 0!==n.SecondPractice?new Date(n.SecondPractice.date+"T"+n.SecondPractice.time):null,f=void 0!==n.ThirdPractice?new Date(n.ThirdPractice.date+"T"+n.ThirdPractice.time):null,g=void 0!==n.Qualifying?new Date(n.Qualifying.date+"T"+n.Qualifying.time):null,v=void 0!==n.SprintQualifying?new Date(n.SprintQualifying.date+"T"+n.SprintQualifying.time):null,_=void 0!==n.Sprint?new Date(n.Sprint.date+"T"+n.Sprint.time):null,y=void 0!==n.FirstPractice?(0,c.formatDateTimeRaceInfo)(m,o.locale):"-",$=void 0!==n.SecondPractice?(0,c.formatDateTimeRaceInfo)(p,o.locale):"-",w=void 0!==n.ThirdPractice?(0,c.formatDateTimeRaceInfo)(f,o.locale):"-",b=(0,c.formatDateTimeRaceInfo)(h,o.locale),C=(0,c.formatDateTimeRaceInfo)(g,o.locale),S=void 0!==n.Sprint?(0,c.formatDateTimeRaceInfo)(_,o.locale):"-",A=void 0!==n.SprintQualifying?(0,c.formatDateTimeRaceInfo)(v,o.locale):"-",T=[];T.push({date:m,name:t.translation("practice1"),value:y}),T.push({date:p,name:t.translation("practice2"),value:$}),T.push({date:f,name:t.translation("practice3"),value:w}),T.push({date:g,name:t.translation("qualifying"),value:C}),T.push({date:v,name:t.translation("sprint_qualifying"),value:A}),T.push({date:_,name:t.translation("sprint"),value:S}),T.push({date:h,name:t.translation("racetime"),value:b});const D=T.filter((t=>null!==t.date)).sort(((t,e)=>t.date.getTime()-e.date.getTime()));return r.html`${u}${d}<tr><td>${t.translation("date")}</td><td>${(0,l.formatDateNumeric)(h,o.locale,i.date_locale)}</td><td> </td><td>${(0,e.renderEventColumn)(0,"name",D)}</td><td align="right">${(0,e.renderEventColumn)(0,"value",D)}</td></tr><tr><td>${t.translation("round")}</td><td>${n.round}</td><td> </td><td>${(0,e.renderEventColumn)(1,"name",D)}</td><td align="right">${(0,e.renderEventColumn)(1,"value",D)}</td></tr><tr><td>${t.translation("racename")}</td><td>${n.raceName}</td><td> </td><td>${(0,e.renderEventColumn)(2,"name",D)}</td><td align="right">${(0,e.renderEventColumn)(2,"value",D)}</td></tr><tr><td>${t.translation("circuitname")}</td><td>${n.Circuit.circuitName}</td><td> </td><td>${(0,e.renderEventColumn)(3,"name",D)}</td><td align="right">${(0,e.renderEventColumn)(3,"value",D)}</td></tr><tr><td>${t.translation("location")}</td><td>${n.Circuit.Location.country}</td><td> </td><td>${(0,e.renderEventColumn)(4,"name",D)}</td><td align="right">${(0,e.renderEventColumn)(4,"value",D)}</td></tr><tr><td>${t.translation("city")}</td><td>${n.Circuit.Location.locality}</td><td> </td><td>${(0,e.renderEventColumn)(5,"name",D)}</td><td align="right">${(0,e.renderEventColumn)(5,"value",D)}</td></tr>`})))}`},e.renderEventColumn=(t,e,n)=>{if(n.length>t){if("name"===e)return n[t].name;if("value"===e)return n[t].value}return"-"},e.renderLastYearsResults=(t,e)=>{var n,i;if(!e)return r.html``;const a=e.Results?e.Results[0]:null,o=null===(n=e.Results)||void 0===n?void 0:n.filter((t=>{var e;return"1"===(null===(e=t.FastestLap)||void 0===e?void 0:e.rank)}))[0];return r.html`<tr><td colspan="5"><table class="weather-info"><tr><td class="text-center"><h1 class="${t.f1_font?"formulaone-font":""}">${new Date(e.date).getFullYear()}</h1><h2 class="${t.f1_font?"formulaone-font":""}"><ha-icon slot="icon" icon="mdi:trophy-outline"></ha-icon>${null==a?void 0:a.Driver.givenName} ${null==a?void 0:a.Driver.familyName} (${null==a?void 0:a.Constructor.name})</h2><h3 class="${t.f1_font?"formulaone-font":""}"><ha-icon slot="icon" icon="mdi:timer-outline"></ha-icon>${null==o?void 0:o.Driver.givenName} ${null==o?void 0:o.Driver.familyName} (${null===(i=null==o?void 0:o.FastestLap)||void 0===i?void 0:i.Time.time})</h3></td></tr></table></td></tr><tr><td colspan="5"> </td></tr>`},e.renderWeatherInfo=t=>{if(!t)return r.html``;const e="fahrenheit"===t.race_temperature_unit?"°F":"°C";return r.html`<tr><td colspan="5"><table class="weather-info"><tr><td><ha-icon slot="icon" icon="mdi:clouds"></ha-icon> ${t.race_cloud_cover} ${t.race_cloud_cover_unit}</td><td><ha-icon slot="icon" icon="mdi:thermometer-lines"></ha-icon> ${t.race_temperature} ${e}</td><td><ha-icon slot="icon" icon="mdi:water-percent"></ha-icon> ${t.race_humidity} ${t.race_humidity_unit}</td></tr><tr><td><ha-icon slot="icon" icon="mdi:weather-windy"></ha-icon> ${t.race_wind_direction} ${t.race_wind_speed} ${t.race_wind_speed_unit}</td><td><ha-icon slot="icon" icon="mdi:weather-pouring"></ha-icon> ${t.race_precipitation} ${t.race_precipitation_unit}</td><td>${t.race_precipitation_prob?r.html`<ha-icon slot="icon" icon="mdi:cloud-percent-outline"></ha-icon> ${t.race_precipitation_prob} %`:r.html``}</td></tr></table></td></tr><tr><td colspan="5"> </td></tr>`},e.getRefreshTime=t=>{let e=24;const n=new Date,i=localStorage.getItem(`${n.getFullYear()}.json`);if(i){const r=JSON.parse(i),a=JSON.parse(r.data).MRData.RaceTable.Races.filter((t=>new Date(t.date).toLocaleDateString==n.toLocaleDateString));if(a.length>0){const n=a[0],i=new Date(n.date+"T"+n.time),r=localStorage.getItem(t);if(r){const t=JSON.parse(r);new Date(t.created)<i&&(e=1)}}}return e},e.reduceArray=(t,e)=>void 0===t?[]:e?t.slice(0,e):t,e.renderConstructorColumn=(t,n,i)=>r.html`<td>${t.config.standings.show_teamlogo?r.html`<img class="constructor-logo" height="20" width="20" src="${(0,e.getTeamImage)(t,n.constructorId,i)}"> `:""}${n.name}</td>`,e.translateStatus=(t,e)=>!e.translations||Object.keys(e.translations).indexOf(t)<0?{Finished:"Finished","+1 Lap":"+1 Lap",Engine:"Engine","+2 Laps":"+2 Laps",Accident:"Accident",Collision:"Collision",Gearbox:"Gearbox","Spun off":"Spun off","+3 Laps":"+3 Laps",Suspension:"Suspension","+4 Laps":"+4 Laps",Transmission:"Transmission",Electrical:"Electrical",Brakes:"Brakes",Withdrew:"Withdrew","+5 Laps":"+5 Laps",Clutch:"Clutch",Lapped:"Lapped",Retired:"Retired","Not classified":"Not classified","Fuel system":"Fuel system","+6 Laps":"+6 Laps",Disqualified:"Disqualified",Turbo:"Turbo",Hydraulics:"Hydraulics",Overheating:"Overheating",Ignition:"Ignition","Oil leak":"Oil leak",Throttle:"Throttle","Out of fuel":"Out of fuel"}[t]:e.translations[t]},557:(t,e,n)=>{n.r(e),n.d(e,{UntilDirective:()=>v,until:()=>_});var i=n(639);const{I:r}=i._$LH;class a{constructor(t){}get _$AU(){return this._$AM._$AU}_$AT(t,e,n){this._$Ct=t,this._$AM=e,this._$Ci=n}_$AS(t,e){return this.update(t,e)}update(t,e){return this.render(...e)}}const o=(t,e)=>{var n,i;const r=t._$AN;if(void 0===r)return!1;for(const t of r)null===(i=(n=t)._$AO)||void 0===i||i.call(n,e,!1),o(t,e);return!0},s=t=>{let e,n;do{if(void 0===(e=t._$AM))break;n=e._$AN,n.delete(t),t=e}while(0===(null==n?void 0:n.size))},l=t=>{for(let e;e=t._$AM;t=e){let n=e._$AN;if(void 0===n)e._$AN=n=new Set;else if(n.has(t))break;n.add(t),u(e)}};function c(t){void 0!==this._$AN?(s(this),this._$AM=t,l(this)):this._$AM=t}function d(t,e=!1,n=0){const i=this._$AH,r=this._$AN;if(void 0!==r&&0!==r.size)if(e)if(Array.isArray(i))for(let t=n;t<i.length;t++)o(i[t],!1),s(i[t]);else null!=i&&(o(i,!1),s(i));else o(this,t)}const u=t=>{var e,n,i,r;2==t.type&&(null!==(e=(i=t)._$AP)&&void 0!==e||(i._$AP=d),null!==(n=(r=t)._$AQ)&&void 0!==n||(r._$AQ=c))};class h extends a{constructor(){super(...arguments),this._$AN=void 0}_$AT(t,e,n){super._$AT(t,e,n),l(this),this.isConnected=t._$AU}_$AO(t,e=!0){var n,i;t!==this.isConnected&&(this.isConnected=t,t?null===(n=this.reconnected)||void 0===n||n.call(this):null===(i=this.disconnected)||void 0===i||i.call(this)),e&&(o(this,t),s(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:i.noChange}update(t,e){const n=this._$Cwt;let r=n.length;this._$Cwt=e;const a=this._$Cq,o=this._$CK;this.isConnected||this.disconnected();for(let t=0;t<e.length&&!(t>this._$C_t);t++){const i=e[t];if(!f(i))return this._$C_t=t,i;t<r&&i===n[t]||(this._$C_t=g,r=0,Promise.resolve(i).then((async t=>{for(;o.get();)await o.get();const e=a.deref();if(void 0!==e){const n=e._$Cwt.indexOf(i);n>-1&&n<e._$C_t&&(e._$C_t=n,e.setValue(t))}})))}return i.noChange}disconnected(){this._$Cq.disconnect(),this._$CK.pause()}reconnected(){this._$Cq.reconnect(this),this._$CK.resume()}}const _=(y=v,(...t)=>({_$litDirective$:y,values:t}));var y},639:(t,e,n)=>{var i;n.r(e),n.d(e,{_$LH:()=>U,html:()=>A,noChange:()=>D,nothing:()=>x,render:()=>q,svg:()=>T});const r=window,a=r.trustedTypes,o=a?a.createPolicy("lit-html",{createHTML:t=>t}):void 0,s="$lit$",l=`lit$${(Math.random()+"").slice(9)}$`,c="?"+l,d=`<${c}>`,u=document,h=()=>u.createComment(""),m=t=>null===t||"object"!=typeof t&&"function"!=typeof t,p=Array.isArray,f=t=>p(t)||"function"==typeof(null==t?void 0:t[Symbol.iterator]),g="[ \t\n\f\r]",v=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,_=/-->/g,y=/>/g,$=RegExp(`>|${g}(?:([^\\s"'>=/]+)(${g}*=${g}*(?:[^ \t\n\f\r"'\`<>=]|("|')|))|$)`,"g"),w=/'/g,b=/"/g,C=/^(?:script|style|textarea|title)$/i,S=t=>(e,...n)=>({_$litType$:t,strings:e,values:n}),A=S(1),T=S(2),D=Symbol.for("lit-noChange"),x=Symbol.for("lit-nothing"),R=new WeakMap,E=u.createTreeWalker(u,129,null,!1);function N(t,e){if(!Array.isArray(t)||!t.hasOwnProperty("raw"))throw Error("invalid template strings array");return void 0!==o?o.createHTML(e):e}const O=(t,e)=>{const n=t.length-1,i=[];let r,a=2===e?"<svg>":"",o=v;for(let e=0;e<n;e++){const n=t[e];let c,u,h=-1,m=0;for(;m<n.length&&(o.lastIndex=m,u=o.exec(n),null!==u);)m=o.lastIndex,o===v?"!--"===u[1]?o=_:void 0!==u[1]?o=y:void 0!==u[2]?(C.test(u[2])&&(r=RegExp("</"+u[2],"g")),o=$):void 0!==u[3]&&(o=$):o===$?">"===u[0]?(o=null!=r?r:v,h=-1):void 0===u[1]?h=-2:(h=o.lastIndex-u[2].length,c=u[1],o=void 0===u[3]?$:'"'===u[3]?b:w):o===b||o===w?o=$:o===_||o===y?o=v:(o=$,r=void 0);const p=o===$&&t[e+1].startsWith("/>")?" ":"";a+=o===v?n+d:h>=0?(i.push(c),n.slice(0,h)+s+n.slice(h)+l+p):n+l+(-2===h?(i.push(void 0),e):p)}return[N(t,a+(t[n]||"<?>")+(2===e?"</svg>":"")),i]};class k{constructor({strings:t,_$litType$:e},n){let i;this.parts=[];let r=0,o=0;const d=t.length-1,u=this.parts,[m,p]=O(t,e);if(this.el=k.createElement(m,n),E.currentNode=this.el.content,2===e){const t=this.el.content,e=t.firstChild;e.remove(),t.append(...e.childNodes)}for(;null!==(i=E.nextNode())&&u.length<d;){if(1===i.nodeType){if(i.hasAttributes()){const t=[];for(const e of i.getAttributeNames())if(e.endsWith(s)||e.startsWith(l)){const n=p[o++];if(t.push(e),void 0!==n){const t=i.getAttribute(n.toLowerCase()+s).split(l),e=/([.?@])?(.*)/.exec(n);u.push({type:1,index:r,name:e[2],strings:t,ctor:"."===e[1]?L:"?"===e[1]?j:"@"===e[1]?V:I})}else u.push({type:6,index:r})}for(const e of t)i.removeAttribute(e)}if(C.test(i.tagName)){const t=i.textContent.split(l),e=t.length-1;if(e>0){i.textContent=a?a.emptyScript:"";for(let n=0;n<e;n++)i.append(t[n],h()),E.nextNode(),u.push({type:2,index:++r});i.append(t[e],h())}}}else if(8===i.nodeType)if(i.data===c)u.push({type:2,index:r});else{let t=-1;for(;-1!==(t=i.data.indexOf(l,t+1));)u.push({type:7,index:r}),t+=l.length-1}r++}}static createElement(t,e){const n=u.createElement("template");return n.innerHTML=t,n}}function F(t,e,n=t,i){var r,a,o,s;if(e===D)return e;let l=void 0!==i?null===(r=n._$Co)||void 0===r?void 0:r[i]:n._$Cl;const c=m(e)?void 0:e._$litDirective$;return(null==l?void 0:l.constructor)!==c&&(null===(a=null==l?void 0:l._$AO)||void 0===a||a.call(l,!1),void 0===c?l=void 0:(l=new c(t),l._$AT(t,n,i)),void 0!==i?(null!==(o=(s=n)._$Co)&&void 0!==o?o:s._$Co=[])[i]=l:n._$Cl=l),void 0!==l&&(e=F(t,l._$AS(t,e.values),l,i)),e}class M{constructor(t,e){this._$AV=[],this._$AN=void 0,this._$AD=t,this._$AM=e}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(t){var e;const{el:{content:n},parts:i}=this._$AD,r=(null!==(e=null==t?void 0:t.creationScope)&&void 0!==e?e:u).importNode(n,!0);E.currentNode=r;let a=E.nextNode(),o=0,s=0,l=i[0];for(;void 0!==l;){if(o===l.index){let e;2===l.type?e=new P(a,a.nextSibling,this,t):1===l.type?e=new l.ctor(a,l.name,l.strings,this,t):6===l.type&&(e=new G(a,this,t)),this._$AV.push(e),l=i[++s]}o!==(null==l?void 0:l.index)&&(a=E.nextNode(),o++)}return E.currentNode=u,r}v(t){let e=0;for(const n of this._$AV)void 0!==n&&(void 0!==n.strings?(n._$AI(t,n,e),e+=n.strings.length-2):n._$AI(t[e])),e++}}class P{constructor(t,e,n,i){var r;this.type=2,this._$AH=x,this._$AN=void 0,this._$AA=t,this._$AB=e,this._$AM=n,this.options=i,this._$Cp=null===(r=null==i?void 0:i.isConnected)||void 0===r||r}get _$AU(){var t,e;return null!==(e=null===(t=this._$AM)||void 0===t?void 0:t._$AU)&&void 0!==e?e:this._$Cp}get parentNode(){let t=this._$AA.parentNode;const e=this._$AM;return void 0!==e&&11===(null==t?void 0:t.nodeType)&&(t=e.parentNode),t}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(t,e=this){t=F(this,t,e),m(t)?t===x||null==t||""===t?(this._$AH!==x&&this._$AR(),this._$AH=x):t!==this._$AH&&t!==D&&this._(t):void 0!==t._$litType$?this.g(t):void 0!==t.nodeType?this.$(t):f(t)?this.T(t):this._(t)}k(t){return this._$AA.parentNode.insertBefore(t,this._$AB)}$(t){this._$AH!==t&&(this._$AR(),this._$AH=this.k(t))}_(t){this._$AH!==x&&m(this._$AH)?this._$AA.nextSibling.data=t:this.$(u.createTextNode(t)),this._$AH=t}g(t){var e;const{values:n,_$litType$:i}=t,r="number"==typeof i?this._$AC(t):(void 0===i.el&&(i.el=k.createElement(N(i.h,i.h[0]),this.options)),i);if((null===(e=this._$AH)||void 0===e?void 0:e._$AD)===r)this._$AH.v(n);else{const t=new M(r,this),e=t.u(this.options);t.v(n),this.$(e),this._$AH=t}}_$AC(t){let e=R.get(t.strings);return void 0===e&&R.set(t.strings,e=new k(t)),e}T(t){p(this._$AH)||(this._$AH=[],this._$AR());const e=this._$AH;let n,i=0;for(const r of t)i===e.length?e.push(n=new P(this.k(h()),this.k(h()),this,this.options)):n=e[i],n._$AI(r),i++;i<e.length&&(this._$AR(n&&n._$AB.nextSibling,i),e.length=i)}_$AR(t=this._$AA.nextSibling,e){var n;for(null===(n=this._$AP)||void 0===n||n.call(this,!1,!0,e);t&&t!==this._$AB;){const e=t.nextSibling;t.remove(),t=e}}setConnected(t){var e;void 0===this._$AM&&(this._$Cp=t,null===(e=this._$AP)||void 0===e||e.call(this,t))}}class I{constructor(t,e,n,i,r){this.type=1,this._$AH=x,this._$AN=void 0,this.element=t,this.name=e,this._$AM=i,this.options=r,n.length>2||""!==n[0]||""!==n[1]?(this._$AH=Array(n.length-1).fill(new String),this.strings=n):this._$AH=x}get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}_$AI(t,e=this,n,i){const r=this.strings;let a=!1;if(void 0===r)t=F(this,t,e,0),a=!m(t)||t!==this._$AH&&t!==D,a&&(this._$AH=t);else{const i=t;let o,s;for(t=r[0],o=0;o<r.length-1;o++)s=F(this,i[n+o],e,o),s===D&&(s=this._$AH[o]),a||(a=!m(s)||s!==this._$AH[o]),s===x?t=x:t!==x&&(t+=(null!=s?s:"")+r[o+1]),this._$AH[o]=s}a&&!i&&this.j(t)}j(t){t===x?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,null!=t?t:"")}}class L extends I{constructor(){super(...arguments),this.type=3}j(t){this.element[this.name]=t===x?void 0:t}}const H=a?a.emptyScript:"";class j extends I{constructor(){super(...arguments),this.type=4}j(t){t&&t!==x?this.element.setAttribute(this.name,H):this.element.removeAttribute(this.name)}}class V extends I{constructor(t,e,n,i,r){super(t,e,n,i,r),this.type=5}_$AI(t,e=this){var n;if((t=null!==(n=F(this,t,e,0))&&void 0!==n?n:x)===D)return;const i=this._$AH,r=t===x&&i!==x||t.capture!==i.capture||t.once!==i.once||t.passive!==i.passive,a=t!==x&&(i===x||r);r&&this.element.removeEventListener(this.name,this,i),a&&this.element.addEventListener(this.name,this,t),this._$AH=t}handleEvent(t){var e,n;"function"==typeof this._$AH?this._$AH.call(null!==(n=null===(e=this.options)||void 0===e?void 0:e.host)&&void 0!==n?n:this.element,t):this._$AH.handleEvent(t)}}class G{constructor(t,e,n){this.element=t,this.type=6,this._$AN=void 0,this._$AM=e,this.options=n}get _$AU(){return this._$AM._$AU}_$AI(t){F(this,t)}}const U={O:s,P:l,A:c,C:1,M:O,L:M,R:f,D:F,I:P,V:I,H:j,N:V,U:L,F:G},B=r.litHtmlPolyfillSupport;null==B||B(k,P),(null!==(i=r.litHtmlVersions)&&void 0!==i?i:r.litHtmlVersions=[]).push("2.8.0");const q=(t,e,n)=>{var i,r;const a=null!==(i=null==n?void 0:n.renderBefore)&&void 0!==i?i:e;let o=a._$litPart$;if(void 0===o){const t=null!==(r=null==n?void 0:n.renderBefore)&&void 0!==r?r:null;a._$litPart$=o=new P(e.insertBefore(h(),t),t,void 0,null!=n?n:{})}return o._$AI(t),o}},15:(t,e,n)=>{n.r(e),n.d(e,{customElement:()=>i,eventOptions:()=>c,property:()=>s,query:()=>u,queryAll:()=>m,queryAssignedElements:()=>f,queryAssignedNodes:()=>g,queryAsync:()=>p,standardProperty:()=>o,state:()=>l});const i=t=>(e,n)=>{void 0!==n?n.addInitializer((()=>{customElements.define(t,e)})):customElements.define(t,e)};var r=n(548);const a={attribute:!0,type:String,converter:r.Ts,reflect:!1,hasChanged:r.Qu},o=(t=a,e,n)=>{const{kind:i,metadata:r}=n;let o=globalThis.litPropertyMetadata.get(r);if(void 0===o&&globalThis.litPropertyMetadata.set(r,o=new Map),"setter"===i&&((t=Object.create(t)).wrapped=!0),o.set(n.name,t),"accessor"===i){const{name:i}=n;return{set(n){const r=e.get.call(this);e.set.call(this,n),this.requestUpdate(i,r,t)},init(e){return void 0!==e&&this.C(i,void 0,t,e),e}}}if("setter"===i){const{name:i}=n;return function(n){const r=this[i];e.call(this,n),this.requestUpdate(i,r,t)}}throw Error("Unsupported decorator location: "+i)};function s(t){return(e,n)=>"object"==typeof n?o(t,e,n):((t,e,n)=>{const i=e.hasOwnProperty(n);return e.constructor.createProperty(n,t),i?Object.getOwnPropertyDescriptor(e,n):void 0})(t,e,n)}function l(t){return s({...t,state:!0,attribute:!1})}function c(t){return(e,n)=>{const i="function"==typeof e?e:e[n];Object.assign(i,t)}}const d=(t,e,n)=>(n.configurable=!0,n.enumerable=!0,Reflect.decorate&&"object"!=typeof e&&Object.defineProperty(t,e,n),n);function u(t,e){return(n,i,r)=>{const a=e=>e.renderRoot?.querySelector(t)??null;if(e){const{get:t,set:e}="object"==typeof i?n:r??(()=>{const t=Symbol();return{get(){return this[t]},set(e){this[t]=e}}})();return d(n,i,{get(){let n=t.call(this);return void 0===n&&(n=a(this),(null!==n||this.hasUpdated)&&e.call(this,n)),n}})}return d(n,i,{get(){return a(this)}})}}let h;function m(t){return(e,n)=>d(e,n,{get(){return(this.renderRoot??(h??=document.createDocumentFragment())).querySelectorAll(t)}})}function p(t){return(e,n)=>d(e,n,{async get(){return await this.updateComplete,this.renderRoot?.querySelector(t)??null}})}function f(t){return(e,n)=>{const{slot:i,selector:r}=t??{},a="slot"+(i?`[name=${i}]`:":not([name])");return d(e,n,{get(){const e=this.renderRoot?.querySelector(a),n=e?.assignedElements(t)??[];return void 0===r?n:n.filter((t=>t.matches(r)))}})}}function g(t){return(e,n)=>{const{slot:i}=t??{},r="slot"+(i?`[name=${i}]`:":not([name])");return d(e,n,{get(){const e=this.renderRoot?.querySelector(r);return e?.assignedNodes(t)??[]}})}}},395:(t,e,n)=>{n.r(e),n.d(e,{Directive:()=>i.Xe,PartType:()=>i.pX,directive:()=>i.XM});var i=n(126)},810:(t,e,n)=>{n.r(e),n.d(e,{AsyncReplaceDirective:()=>f,asyncReplace:()=>g});var i=n(605);const{I:r}=i._$LH;var a=n(126);const o=(t,e)=>{const n=t._$AN;if(void 0===n)return!1;for(const t of n)t._$AO?.(e,!1),o(t,e);return!0},s=t=>{let e,n;do{if(void 0===(e=t._$AM))break;n=e._$AN,n.delete(t),t=e}while(0===n?.size)},l=t=>{for(let e;e=t._$AM;t=e){let n=e._$AN;if(void 0===n)e._$AN=n=new Set;else if(n.has(t))break;n.add(t),u(e)}};function c(t){void 0!==this._$AN?(s(this),this._$AM=t,l(this)):this._$AM=t}function d(t,e=!1,n=0){const i=this._$AH,r=this._$AN;if(void 0!==r&&0!==r.size)if(e)if(Array.isArray(i))for(let t=n;t<i.length;t++)o(i[t],!1),s(i[t]);else null!=i&&(o(i,!1),s(i));else o(this,t)}const u=t=>{t.type==a.pX.CHILD&&(t._$AP??=d,t._$AQ??=c)};class h extends a.Xe{constructor(){super(...arguments),this._$AN=void 0}_$AT(t,e,n){super._$AT(t,e,n),l(this),this.isConnected=t._$AU}_$AO(t,e=!0){t!==this.isConnected&&(this.isConnected=t,t?this.reconnected?.():this.disconnected?.()),e&&(o(this,t),s(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._$CK=new m(this),this._$CX=new p}render(t,e){return i.Jb}update(t,[e,n]){if(this.isConnected||this.disconnected(),e===this._$CJ)return i.Jb;this._$CJ=e;let r=0;const{_$CK:a,_$CX:o}=this;return(async(t,e)=>{for await(const n of t)if(!1===await e(n))return})(e,(async t=>{for(;o.get();)await o.get();const i=a.deref();if(void 0!==i){if(i._$CJ!==e)return!1;void 0!==n&&(t=n(t,r)),i.commitValue(t,r),r++}return!0})),i.Jb}commitValue(t,e){this.setValue(t)}disconnected(){this._$CK.disconnect(),this._$CX.pause()}reconnected(){this._$CK.reconnect(this),this._$CX.resume()}}const g=(0,a.XM)(f)},110:(t,e,n)=>{n.r(e),n.d(e,{CSSResult:()=>i.c3,LitElement:()=>o,ReactiveElement:()=>i.fl,_$LE:()=>l,_$LH:()=>r._$LH,adoptStyles:()=>i.ec,css:()=>i.iv,defaultConverter:()=>i.Ts,getCompatibleStyle:()=>i.i1,html:()=>r.dy,isServer:()=>c,mathml:()=>r.cV,noChange:()=>r.Jb,notEqual:()=>i.Qu,nothing:()=>r.Ld,render:()=>r.sY,supportsAdoptingStyleSheets:()=>i.FV,svg:()=>r.YP,unsafeCSS:()=>i.$m});var i=n(548),r=n(605);const a=globalThis;class o extends i.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,a.litElementHydrateSupport?.({LitElement:o});const s=a.litElementPolyfillSupport;s?.({LitElement:o});const l={_$AK:(t,e,n)=>{t._$AK(e,n)},_$AL:t=>t._$AL};(a.litElementVersions??=[]).push("4.2.1");const c=!1},548:(t,e,n)=>{n.d(e,{c3:()=>s,fl:()=>T,ec:()=>d,iv:()=>c,Ts:()=>C,i1:()=>u,Qu:()=>S,FV:()=>r,$m:()=>l});const i=globalThis,r=i.ShadowRoot&&(void 0===i.ShadyCSS||i.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,a=Symbol(),o=new WeakMap;class s{constructor(t,e,n){if(this._$cssResult$=!0,n!==a)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=t,this.t=e}get styleSheet(){let t=this.o;const e=this.t;if(r&&void 0===t){const n=void 0!==e&&1===e.length;n&&(t=o.get(e)),void 0===t&&((this.o=t=new CSSStyleSheet).replaceSync(this.cssText),n&&o.set(e,t))}return t}toString(){return this.cssText}}const l=t=>new s("string"==typeof t?t:t+"",void 0,a),c=(t,...e)=>{const n=1===t.length?t[0]:e.reduce(((e,n,i)=>e+(t=>{if(!0===t._$cssResult$)return t.cssText;if("number"==typeof t)return t;throw Error("Value passed to 'css' function must be a 'css' function result: "+t+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(n)+t[i+1]),t[0]);return new s(n,t,a)},d=(t,e)=>{if(r)t.adoptedStyleSheets=e.map((t=>t instanceof CSSStyleSheet?t:t.styleSheet));else for(const n of e){const e=document.createElement("style"),r=i.litNonce;void 0!==r&&e.setAttribute("nonce",r),e.textContent=n.cssText,t.appendChild(e)}},u=r?t=>t:t=>t instanceof CSSStyleSheet?(t=>{let e="";for(const n of t.cssRules)e+=n.cssText;return l(e)})(t):t,{is:h,defineProperty:m,getOwnPropertyDescriptor:p,getOwnPropertyNames:f,getOwnPropertySymbols:g,getPrototypeOf:v}=Object,_=globalThis,y=_.trustedTypes,$=y?y.emptyScript:"",w=_.reactiveElementPolyfillSupport,b=(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 n=t;switch(e){case Boolean:n=null!==t;break;case Number:n=null===t?null:Number(t);break;case Object:case Array:try{n=JSON.parse(t)}catch(t){n=null}}return n}},S=(t,e)=>!h(t,e),A={attribute:!0,type:String,converter:C,reflect:!1,useDefault:!1,hasChanged:S};Symbol.metadata??=Symbol("metadata"),_.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=A){if(e.state&&(e.attribute=!1),this._$Ei(),this.prototype.hasOwnProperty(t)&&((e=Object.create(e)).wrapped=!0),this.elementProperties.set(t,e),!e.noAccessor){const n=Symbol(),i=this.getPropertyDescriptor(t,n,e);void 0!==i&&m(this.prototype,t,i)}}static getPropertyDescriptor(t,e,n){const{get:i,set:r}=p(this.prototype,t)??{get(){return this[e]},set(t){this[e]=t}};return{get:i,set(e){const a=i?.call(this);r?.call(this,e),this.requestUpdate(t,a,n)},configurable:!0,enumerable:!0}}static getPropertyOptions(t){return this.elementProperties.get(t)??A}static _$Ei(){if(this.hasOwnProperty(b("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(b("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(b("properties"))){const t=this.properties,e=[...f(t),...g(t)];for(const n of e)this.createProperty(n,t[n])}const t=this[Symbol.metadata];if(null!==t){const e=litPropertyMetadata.get(t);if(void 0!==e)for(const[t,n]of e)this.elementProperties.set(t,n)}this._$Eh=new Map;for(const[t,e]of this.elementProperties){const n=this._$Eu(t,e);void 0!==n&&this._$Eh.set(n,t)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(t){const e=[];if(Array.isArray(t)){const n=new Set(t.flat(1/0).reverse());for(const t of n)e.unshift(u(t))}else void 0!==t&&e.push(u(t));return e}static _$Eu(t,e){const n=e.attribute;return!1===n?void 0:"string"==typeof n?n:"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._$ES=new Promise((t=>this.enableUpdating=t)),this._$AL=new Map,this._$E_(),this.requestUpdate(),this.constructor.l?.forEach((t=>t(this)))}addController(t){(this._$EO??=new Set).add(t),void 0!==this.renderRoot&&this.isConnected&&t.hostConnected?.()}removeController(t){this._$EO?.delete(t)}_$E_(){const t=new Map,e=this.constructor.elementProperties;for(const n of e.keys())this.hasOwnProperty(n)&&(t.set(n,this[n]),delete this[n]);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._$EO?.forEach((t=>t.hostConnected?.()))}enableUpdating(t){}disconnectedCallback(){this._$EO?.forEach((t=>t.hostDisconnected?.()))}attributeChangedCallback(t,e,n){this._$AK(t,n)}_$ET(t,e){const n=this.constructor.elementProperties.get(t),i=this.constructor._$Eu(t,n);if(void 0!==i&&!0===n.reflect){const r=(void 0!==n.converter?.toAttribute?n.converter:C).toAttribute(e,n.type);this._$Em=t,null==r?this.removeAttribute(i):this.setAttribute(i,r),this._$Em=null}}_$AK(t,e){const n=this.constructor,i=n._$Eh.get(t);if(void 0!==i&&this._$Em!==i){const t=n.getPropertyOptions(i),r="function"==typeof t.converter?{fromAttribute:t.converter}:void 0!==t.converter?.fromAttribute?t.converter:C;this._$Em=i;const a=r.fromAttribute(e,t.type);this[i]=a??this._$Ej?.get(i)??a,this._$Em=null}}requestUpdate(t,e,n){if(void 0!==t){const i=this.constructor,r=this[t];if(n??=i.getPropertyOptions(t),!((n.hasChanged??S)(r,e)||n.useDefault&&n.reflect&&r===this._$Ej?.get(t)&&!this.hasAttribute(i._$Eu(t,n))))return;this.C(t,e,n)}!1===this.isUpdatePending&&(this._$ES=this._$EP())}C(t,e,{useDefault:n,reflect:i,wrapped:r},a){n&&!(this._$Ej??=new Map).has(t)&&(this._$Ej.set(t,a??e??this[t]),!0!==r||void 0!==a)||(this._$AL.has(t)||(this.hasUpdated||n||(e=void 0),this._$AL.set(t,e)),!0===i&&this._$Em!==t&&(this._$Eq??=new Set).add(t))}async _$EP(){this.isUpdatePending=!0;try{await this._$ES}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,n]of t){const{wrapped:t}=n,i=this[e];!0!==t||this._$AL.has(e)||void 0===i||this.C(e,void 0,n,i)}}let t=!1;const e=this._$AL;try{t=this.shouldUpdate(e),t?(this.willUpdate(e),this._$EO?.forEach((t=>t.hostUpdate?.())),this.update(e)):this._$EM()}catch(e){throw t=!1,this._$EM(),e}t&&this._$AE(e)}willUpdate(t){}_$AE(t){this._$EO?.forEach((t=>t.hostUpdated?.())),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(t)),this.updated(t)}_$EM(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(t){return!0}update(t){this._$Eq&&=this._$Eq.forEach((t=>this._$ET(t,this[t]))),this._$EM()}updated(t){}firstUpdated(t){}}T.elementStyles=[],T.shadowRootOptions={mode:"open"},T[b("elementProperties")]=new Map,T[b("finalized")]=new Map,w?.({ReactiveElement:T}),(_.reactiveElementVersions??=[]).push("2.1.1")},126:(t,e,n)=>{n.d(e,{XM:()=>r,Xe:()=>a,pX:()=>i});const i={ATTRIBUTE:1,CHILD:2,PROPERTY:3,BOOLEAN_ATTRIBUTE:4,EVENT:5,ELEMENT:6},r=t=>(...e)=>({_$litDirective$:t,values:e});class a{constructor(t){}get _$AU(){return this._$AM._$AU}_$AT(t,e,n){this._$Ct=t,this._$AM=e,this._$Ci=n}_$AS(t,e){return this.update(t,e)}update(t,e){return this.render(...e)}}},605:(t,e,n)=>{n.d(e,{Jb:()=>D,Ld:()=>x,YP:()=>A,_$LH:()=>G,cV:()=>T,dy:()=>S,sY:()=>B});const i=globalThis,r=i.trustedTypes,a=r?r.createPolicy("lit-html",{createHTML:t=>t}):void 0,o="$lit$",s=`lit$${Math.random().toFixed(9).slice(2)}$`,l="?"+s,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,_=/>/g,y=RegExp(`>|${f}(?:([^\\s"'>=/]+)(${f}*=${f}*(?:[^ \t\n\f\r"'\`<>=]|("|')|))|$)`,"g"),$=/'/g,w=/"/g,b=/^(?:script|style|textarea|title)$/i,C=t=>(e,...n)=>({_$litType$:t,strings:e,values:n}),S=C(1),A=C(2),T=C(3),D=Symbol.for("lit-noChange"),x=Symbol.for("lit-nothing"),R=new WeakMap,E=d.createTreeWalker(d,129);function N(t,e){if(!m(t)||!t.hasOwnProperty("raw"))throw Error("invalid template strings array");return void 0!==a?a.createHTML(e):e}const O=(t,e)=>{const n=t.length-1,i=[];let r,a=2===e?"<svg>":3===e?"<math>":"",l=g;for(let e=0;e<n;e++){const n=t[e];let d,u,h=-1,m=0;for(;m<n.length&&(l.lastIndex=m,u=l.exec(n),null!==u);)m=l.lastIndex,l===g?"!--"===u[1]?l=v:void 0!==u[1]?l=_:void 0!==u[2]?(b.test(u[2])&&(r=RegExp("</"+u[2],"g")),l=y):void 0!==u[3]&&(l=y):l===y?">"===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]?y:'"'===u[3]?w:$):l===w||l===$?l=y:l===v||l===_?l=g:(l=y,r=void 0);const p=l===y&&t[e+1].startsWith("/>")?" ":"";a+=l===g?n+c:h>=0?(i.push(d),n.slice(0,h)+o+n.slice(h)+s+p):n+s+(-2===h?e:p)}return[N(t,a+(t[n]||"<?>")+(2===e?"</svg>":3===e?"</math>":"")),i]};class k{constructor({strings:t,_$litType$:e},n){let i;this.parts=[];let a=0,c=0;const d=t.length-1,h=this.parts,[m,p]=O(t,e);if(this.el=k.createElement(m,n),E.currentNode=this.el.content,2===e||3===e){const t=this.el.content.firstChild;t.replaceWith(...t.childNodes)}for(;null!==(i=E.nextNode())&&h.length<d;){if(1===i.nodeType){if(i.hasAttributes())for(const t of i.getAttributeNames())if(t.endsWith(o)){const e=p[c++],n=i.getAttribute(t).split(s),r=/([.?@])?(.*)/.exec(e);h.push({type:1,index:a,name:r[2],strings:n,ctor:"."===r[1]?L:"?"===r[1]?H:"@"===r[1]?j:I}),i.removeAttribute(t)}else t.startsWith(s)&&(h.push({type:6,index:a}),i.removeAttribute(t));if(b.test(i.tagName)){const t=i.textContent.split(s),e=t.length-1;if(e>0){i.textContent=r?r.emptyScript:"";for(let n=0;n<e;n++)i.append(t[n],u()),E.nextNode(),h.push({type:2,index:++a});i.append(t[e],u())}}}else if(8===i.nodeType)if(i.data===l)h.push({type:2,index:a});else{let t=-1;for(;-1!==(t=i.data.indexOf(s,t+1));)h.push({type:7,index:a}),t+=s.length-1}a++}}static createElement(t,e){const n=d.createElement("template");return n.innerHTML=t,n}}function F(t,e,n=t,i){if(e===D)return e;let r=void 0!==i?n._$Co?.[i]:n._$Cl;const a=h(e)?void 0:e._$litDirective$;return r?.constructor!==a&&(r?._$AO?.(!1),void 0===a?r=void 0:(r=new a(t),r._$AT(t,n,i)),void 0!==i?(n._$Co??=[])[i]=r:n._$Cl=r),void 0!==r&&(e=F(t,r._$AS(t,e.values),r,i)),e}class M{constructor(t,e){this._$AV=[],this._$AN=void 0,this._$AD=t,this._$AM=e}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(t){const{el:{content:e},parts:n}=this._$AD,i=(t?.creationScope??d).importNode(e,!0);E.currentNode=i;let r=E.nextNode(),a=0,o=0,s=n[0];for(;void 0!==s;){if(a===s.index){let e;2===s.type?e=new P(r,r.nextSibling,this,t):1===s.type?e=new s.ctor(r,s.name,s.strings,this,t):6===s.type&&(e=new V(r,this,t)),this._$AV.push(e),s=n[++o]}a!==s?.index&&(r=E.nextNode(),a++)}return E.currentNode=d,i}p(t){let e=0;for(const n of this._$AV)void 0!==n&&(void 0!==n.strings?(n._$AI(t,n,e),e+=n.strings.length-2):n._$AI(t[e])),e++}}class P{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(t,e,n,i){this.type=2,this._$AH=x,this._$AN=void 0,this._$AA=t,this._$AB=e,this._$AM=n,this.options=i,this._$Cv=i?.isConnected??!0}get parentNode(){let t=this._$AA.parentNode;const e=this._$AM;return void 0!==e&&11===t?.nodeType&&(t=e.parentNode),t}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(t,e=this){t=F(this,t,e),h(t)?t===x||null==t||""===t?(this._$AH!==x&&this._$AR(),this._$AH=x):t!==this._$AH&&t!==D&&this._(t):void 0!==t._$litType$?this.$(t):void 0!==t.nodeType?this.T(t):p(t)?this.k(t):this._(t)}O(t){return this._$AA.parentNode.insertBefore(t,this._$AB)}T(t){this._$AH!==t&&(this._$AR(),this._$AH=this.O(t))}_(t){this._$AH!==x&&h(this._$AH)?this._$AA.nextSibling.data=t:this.T(d.createTextNode(t)),this._$AH=t}$(t){const{values:e,_$litType$:n}=t,i="number"==typeof n?this._$AC(t):(void 0===n.el&&(n.el=k.createElement(N(n.h,n.h[0]),this.options)),n);if(this._$AH?._$AD===i)this._$AH.p(e);else{const t=new M(i,this),n=t.u(this.options);t.p(e),this.T(n),this._$AH=t}}_$AC(t){let e=R.get(t.strings);return void 0===e&&R.set(t.strings,e=new k(t)),e}k(t){m(this._$AH)||(this._$AH=[],this._$AR());const e=this._$AH;let n,i=0;for(const r of t)i===e.length?e.push(n=new P(this.O(u()),this.O(u()),this,this.options)):n=e[i],n._$AI(r),i++;i<e.length&&(this._$AR(n&&n._$AB.nextSibling,i),e.length=i)}_$AR(t=this._$AA.nextSibling,e){for(this._$AP?.(!1,!0,e);t!==this._$AB;){const e=t.nextSibling;t.remove(),t=e}}setConnected(t){void 0===this._$AM&&(this._$Cv=t,this._$AP?.(t))}}class I{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(t,e,n,i,r){this.type=1,this._$AH=x,this._$AN=void 0,this.element=t,this.name=e,this._$AM=i,this.options=r,n.length>2||""!==n[0]||""!==n[1]?(this._$AH=Array(n.length-1).fill(new String),this.strings=n):this._$AH=x}_$AI(t,e=this,n,i){const r=this.strings;let a=!1;if(void 0===r)t=F(this,t,e,0),a=!h(t)||t!==this._$AH&&t!==D,a&&(this._$AH=t);else{const i=t;let o,s;for(t=r[0],o=0;o<r.length-1;o++)s=F(this,i[n+o],e,o),s===D&&(s=this._$AH[o]),a||=!h(s)||s!==this._$AH[o],s===x?t=x:t!==x&&(t+=(s??"")+r[o+1]),this._$AH[o]=s}a&&!i&&this.j(t)}j(t){t===x?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,t??"")}}class L extends I{constructor(){super(...arguments),this.type=3}j(t){this.element[this.name]=t===x?void 0:t}}class H extends I{constructor(){super(...arguments),this.type=4}j(t){this.element.toggleAttribute(this.name,!!t&&t!==x)}}class j extends I{constructor(t,e,n,i,r){super(t,e,n,i,r),this.type=5}_$AI(t,e=this){if((t=F(this,t,e,0)??x)===D)return;const n=this._$AH,i=t===x&&n!==x||t.capture!==n.capture||t.once!==n.once||t.passive!==n.passive,r=t!==x&&(n===x||i);i&&this.element.removeEventListener(this.name,this,n),r&&this.element.addEventListener(this.name,this,t),this._$AH=t}handleEvent(t){"function"==typeof this._$AH?this._$AH.call(this.options?.host??this.element,t):this._$AH.handleEvent(t)}}class V{constructor(t,e,n){this.element=t,this.type=6,this._$AN=void 0,this._$AM=e,this.options=n}get _$AU(){return this._$AM._$AU}_$AI(t){F(this,t)}}const G={M:o,P:s,A:l,C:1,L:O,R:M,D:p,V:F,I:P,H:I,N:H,U:j,B:L,F:V},U=i.litHtmlPolyfillSupport;U?.(k,P),(i.litHtmlVersions??=[]).push("3.3.1");const B=(t,e,n)=>{const i=n?.renderBefore??e;let r=i._$litPart$;if(void 0===r){const t=n?.renderBefore??null;i._$litPart$=r=new P(e.insertBefore(u(),t),t,void 0,n??{})}return r._$AI(t),r}},147:t=>{t.exports=JSON.parse('{"name":"formulaone-card","version":"1.14.5","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"},"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":"^2024.9.1","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 n(i){var r=e[i];if(void 0!==r)return r.exports;var a=e[i]={exports:{}};return t[i].call(a.exports,a,a.exports,n),a.exports}n.d=(t,e)=>{for(var i in e)n.o(e,i)&&!n.o(t,i)&&Object.defineProperty(t,i,{enumerable:!0,get:e[i]})},n.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),n.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n(148)})();