diff --git a/formulaone-card.js b/formulaone-card.js index 3517cf2..c56b696 100644 --- a/formulaone-card.js +++ b/formulaone-card.js @@ -155,4 +155,4 @@ text-decoration: none; color: var(--secondary-text-color); } -`},98:(t,e)=>{var r,i;Object.defineProperty(e,"__esModule",{value:!0}),e.FormulaOneCardType=e.PreviousRaceDisplay=void 0,(i=e.PreviousRaceDisplay||(e.PreviousRaceDisplay={})).Strikethrough="strikethrough",i.Italic="italic",i.Hide="hide",(r=e.FormulaOneCardType||(e.FormulaOneCardType={})).DriverStandings="driver_standings",r.ConstructorStandings="constructor_standings",r.NextRace="next_race",r.Schedule="schedule",r.LastResult="last_result"},593:(t,e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.getDriverName=e.getCountryFlagUrl=e.checkConfig=e.hasConfigOrEntitiesChanged=void 0,e.hasConfigOrEntitiesChanged=(t,e)=>{if(e.has("config"))return!0;const r=e.get("_hass");return!!r&&r.states[t.sensor]!==t.hass.states[t.sensor]},e.checkConfig=t=>{if(void 0===t.card_type)throw new Error("Please define FormulaOne card type (card_type).");if(void 0===t.sensor)throw new Error("Please define FormulaOne sensor.")},e.getCountryFlagUrl=t=>{const e=[{countryDashed:"USA",name:"United-States-of-America"}].filter((e=>e.countryDashed==t));return e.length>0&&(t=e[0].name),`https://www.countries-ofthe-world.com/flags-normal/flag-of-${t}.png`},e.getDriverName=(t,e)=>{const r="VER"==t.code?1:t.permanentNumber;return`${t.givenName} ${t.familyName}${e.show_carnumber?` #${r}`:""}`}},692:(t,e,r)=>{var i;r.r(e),r.d(e,{_$LH:()=>H,html:()=>A,noChange:()=>E,nothing:()=>x,render:()=>k,svg:()=>S});const n=window,a=n.trustedTypes,o=a?a.createPolicy("lit-html",{createHTML:t=>t}):void 0,s=`lit$${(Math.random()+"").slice(9)}$`,c="?"+s,l=`<${c}>`,u=document,d=(t="")=>u.createComment(t),h=t=>null===t||"object"!=typeof t&&"function"!=typeof t,m=Array.isArray,p=t=>m(t)||"function"==typeof(null==t?void 0:t[Symbol.iterator]),f=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,g=/-->/g,v=/>/g,_=RegExp(">|[ \t\n\f\r](?:([^\\s\"'>=/]+)([ \t\n\f\r]*=[ \t\n\f\r]*(?:[^ \t\n\f\r\"'`<>=]|(\"|')|))|$)","g"),y=/'/g,b=/"/g,w=/^(?:script|style|textarea|title)$/i,$=t=>(e,...r)=>({_$litType$:t,strings:e,values:r}),A=$(1),S=$(2),E=Symbol.for("lit-noChange"),x=Symbol.for("lit-nothing"),C=new WeakMap,k=(t,e,r)=>{var i,n;const a=null!==(i=null==r?void 0:r.renderBefore)&&void 0!==i?i:e;let o=a._$litPart$;if(void 0===o){const t=null!==(n=null==r?void 0:r.renderBefore)&&void 0!==n?n:null;a._$litPart$=o=new M(e.insertBefore(d(),t),t,void 0,null!=r?r:{})}return o._$AI(t),o},T=u.createTreeWalker(u,129,null,!1),D=(t,e)=>{const r=t.length-1,i=[];let n,a=2===e?"":"",c=f;for(let e=0;e"===u[0]?(c=null!=n?n:f,d=-1):void 0===u[1]?d=-2:(d=c.lastIndex-u[2].length,o=u[1],c=void 0===u[3]?_:'"'===u[3]?b:y):c===b||c===y?c=_:c===g||c===v?c=f:(c=_,n=void 0);const m=c===_&&t[e+1].startsWith("/>")?" ":"";a+=c===f?r+l:d>=0?(i.push(o),r.slice(0,d)+"$lit$"+r.slice(d)+s+m):r+s+(-2===d?(i.push(void 0),e):m)}const u=a+(t[r]||"")+(2===e?"":"");if(!Array.isArray(t)||!t.hasOwnProperty("raw"))throw Error("invalid template strings array");return[void 0!==o?o.createHTML(u):u,i]};class N{constructor({strings:t,_$litType$:e},r){let i;this.parts=[];let n=0,o=0;const l=t.length-1,u=this.parts,[h,m]=D(t,e);if(this.el=N.createElement(h,r),T.currentNode=this.el.content,2===e){const t=this.el.content,e=t.firstChild;e.remove(),t.append(...e.childNodes)}for(;null!==(i=T.nextNode())&&u.length0){i.textContent=a?a.emptyScript:"";for(let r=0;r2||""!==r[0]||""!==r[1]?(this._$AH=Array(r.length-1).fill(new String),this.strings=r):this._$AH=x}get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}_$AI(t,e=this,r,i){const n=this.strings;let a=!1;if(void 0===n)t=O(this,t,e,0),a=!h(t)||t!==this._$AH&&t!==E,a&&(this._$AH=t);else{const i=t;let o,s;for(t=n[0],o=0;o{r.r(e),r.d(e,{customElement:()=>i,eventOptions:()=>c,property:()=>a,query:()=>l,queryAll:()=>u,queryAssignedElements:()=>p,queryAssignedNodes:()=>f,queryAsync:()=>d,state:()=>o});const i=t=>e=>"function"==typeof e?((t,e)=>(customElements.define(t,e),e))(t,e):((t,e)=>{const{kind:r,elements:i}=e;return{kind:r,elements:i,finisher(e){customElements.define(t,e)}}})(t,e),n=(t,e)=>"method"===e.kind&&e.descriptor&&!("value"in e.descriptor)?{...e,finisher(r){r.createProperty(e.key,t)}}:{kind:"field",key:Symbol(),placement:"own",descriptor:{},originalKey:e.key,initializer(){"function"==typeof e.initializer&&(this[e.key]=e.initializer.call(this))},finisher(r){r.createProperty(e.key,t)}};function a(t){return(e,r)=>void 0!==r?((t,e,r)=>{e.constructor.createProperty(r,t)})(t,e,r):n(t,e)}function o(t){return a({...t,state:!0})}const s=({finisher:t,descriptor:e})=>(r,i)=>{var n;if(void 0===i){const i=null!==(n=r.originalKey)&&void 0!==n?n:r.key,a=null!=e?{kind:"method",placement:"prototype",key:i,descriptor:e(r.key)}:{...r,key:i};return null!=t&&(a.finisher=function(e){t(e,i)}),a}{const n=r.constructor;void 0!==e&&Object.defineProperty(r,i,e(i)),null==t||t(n,i)}};function c(t){return s({finisher:(e,r)=>{Object.assign(e.prototype[r],t)}})}function l(t,e){return s({descriptor:r=>{const i={get(){var e,r;return null!==(r=null===(e=this.renderRoot)||void 0===e?void 0:e.querySelector(t))&&void 0!==r?r:null},enumerable:!0,configurable:!0};if(e){const e="symbol"==typeof r?Symbol():"__"+r;i.get=function(){var r,i;return void 0===this[e]&&(this[e]=null!==(i=null===(r=this.renderRoot)||void 0===r?void 0:r.querySelector(t))&&void 0!==i?i:null),this[e]}}return i}})}function u(t){return s({descriptor:e=>({get(){var e,r;return null!==(r=null===(e=this.renderRoot)||void 0===e?void 0:e.querySelectorAll(t))&&void 0!==r?r:[]},enumerable:!0,configurable:!0})})}function d(t){return s({descriptor:e=>({async get(){var e;return await this.updateComplete,null===(e=this.renderRoot)||void 0===e?void 0:e.querySelector(t)},enumerable:!0,configurable:!0})})}var h;const m=null!=(null===(h=window.HTMLSlotElement)||void 0===h?void 0:h.prototype.assignedElements)?(t,e)=>t.assignedElements(e):(t,e)=>t.assignedNodes(e).filter((t=>t.nodeType===Node.ELEMENT_NODE));function p(t){const{slot:e,selector:r}=null!=t?t:{};return s({descriptor:i=>({get(){var i;const n="slot"+(e?`[name=${e}]`:":not([name])"),a=null===(i=this.renderRoot)||void 0===i?void 0:i.querySelector(n),o=null!=a?m(a,t):[];return r?o.filter((t=>t.matches(r))):o},enumerable:!0,configurable:!0})})}function f(t,e,r){let i,n=t;return"object"==typeof t?(n=t.slot,i=t):i={flatten:e},r?p({slot:n,flatten:e,selector:r}):s({descriptor:t=>({get(){var t,e;const r="slot"+(n?`[name=${n}]`:":not([name])"),a=null===(t=this.renderRoot)||void 0===t?void 0:t.querySelector(r);return null!==(e=null==a?void 0:a.assignedNodes(i))&&void 0!==e?e:[]},enumerable:!0,configurable:!0})})}},392:(t,e,r)=>{r.r(e),r.d(e,{CSSResult:()=>s,LitElement:()=>E,ReactiveElement:()=>b,UpdatingElement:()=>S,_$LE:()=>C,_$LH:()=>A._$LH,adoptStyles:()=>u,css:()=>l,defaultConverter:()=>v,getCompatibleStyle:()=>d,html:()=>A.html,noChange:()=>A.noChange,notEqual:()=>_,nothing:()=>A.nothing,render:()=>A.render,supportsAdoptingStyleSheets:()=>n,svg:()=>A.svg,unsafeCSS:()=>c});const i=window,n=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,r){if(this._$cssResult$=!0,r!==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(n&&void 0===t){const r=void 0!==e&&1===e.length;r&&(t=o.get(e)),void 0===t&&((this.o=t=new CSSStyleSheet).replaceSync(this.cssText),r&&o.set(e,t))}return t}toString(){return this.cssText}}const c=t=>new s("string"==typeof t?t:t+"",void 0,a),l=(t,...e)=>{const r=1===t.length?t[0]:e.reduce(((e,r,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.")})(r)+t[i+1]),t[0]);return new s(r,t,a)},u=(t,e)=>{n?t.adoptedStyleSheets=e.map((t=>t instanceof CSSStyleSheet?t:t.styleSheet)):e.forEach((e=>{const r=document.createElement("style"),n=i.litNonce;void 0!==n&&r.setAttribute("nonce",n),r.textContent=e.cssText,t.appendChild(r)}))},d=n?t=>t:t=>t instanceof CSSStyleSheet?(t=>{let e="";for(const r of t.cssRules)e+=r.cssText;return c(e)})(t):t;var h;const m=window,p=m.trustedTypes,f=p?p.emptyScript:"",g=m.reactiveElementPolyfillSupport,v={toAttribute(t,e){switch(e){case Boolean:t=t?f:null;break;case Object:case Array:t=null==t?t:JSON.stringify(t)}return t},fromAttribute(t,e){let r=t;switch(e){case Boolean:r=null!==t;break;case Number:r=null===t?null:Number(t);break;case Object:case Array:try{r=JSON.parse(t)}catch(t){r=null}}return r}},_=(t,e)=>e!==t&&(e==e||t==t),y={attribute:!0,type:String,converter:v,reflect:!1,hasChanged:_};class b extends HTMLElement{constructor(){super(),this._$Ei=new Map,this.isUpdatePending=!1,this.hasUpdated=!1,this._$El=null,this.u()}static addInitializer(t){var e;null!==(e=this.h)&&void 0!==e||(this.h=[]),this.h.push(t)}static get observedAttributes(){this.finalize();const t=[];return this.elementProperties.forEach(((e,r)=>{const i=this._$Ep(r,e);void 0!==i&&(this._$Ev.set(i,r),t.push(i))})),t}static createProperty(t,e=y){if(e.state&&(e.attribute=!1),this.finalize(),this.elementProperties.set(t,e),!e.noAccessor&&!this.prototype.hasOwnProperty(t)){const r="symbol"==typeof t?Symbol():"__"+t,i=this.getPropertyDescriptor(t,r,e);void 0!==i&&Object.defineProperty(this.prototype,t,i)}}static getPropertyDescriptor(t,e,r){return{get(){return this[e]},set(i){const n=this[t];this[e]=i,this.requestUpdate(t,n,r)},configurable:!0,enumerable:!0}}static getPropertyOptions(t){return this.elementProperties.get(t)||y}static finalize(){if(this.hasOwnProperty("finalized"))return!1;this.finalized=!0;const t=Object.getPrototypeOf(this);if(t.finalize(),this.elementProperties=new Map(t.elementProperties),this._$Ev=new Map,this.hasOwnProperty("properties")){const t=this.properties,e=[...Object.getOwnPropertyNames(t),...Object.getOwnPropertySymbols(t)];for(const r of e)this.createProperty(r,t[r])}return this.elementStyles=this.finalizeStyles(this.styles),!0}static finalizeStyles(t){const e=[];if(Array.isArray(t)){const r=new Set(t.flat(1/0).reverse());for(const t of r)e.unshift(d(t))}else void 0!==t&&e.push(d(t));return e}static _$Ep(t,e){const r=e.attribute;return!1===r?void 0:"string"==typeof r?r:"string"==typeof t?t.toLowerCase():void 0}u(){var t;this._$E_=new Promise((t=>this.enableUpdating=t)),this._$AL=new Map,this._$Eg(),this.requestUpdate(),null===(t=this.constructor.h)||void 0===t||t.forEach((t=>t(this)))}addController(t){var e,r;(null!==(e=this._$ES)&&void 0!==e?e:this._$ES=[]).push(t),void 0!==this.renderRoot&&this.isConnected&&(null===(r=t.hostConnected)||void 0===r||r.call(t))}removeController(t){var e;null===(e=this._$ES)||void 0===e||e.splice(this._$ES.indexOf(t)>>>0,1)}_$Eg(){this.constructor.elementProperties.forEach(((t,e)=>{this.hasOwnProperty(e)&&(this._$Ei.set(e,this[e]),delete this[e])}))}createRenderRoot(){var t;const e=null!==(t=this.shadowRoot)&&void 0!==t?t:this.attachShadow(this.constructor.shadowRootOptions);return u(e,this.constructor.elementStyles),e}connectedCallback(){var t;void 0===this.renderRoot&&(this.renderRoot=this.createRenderRoot()),this.enableUpdating(!0),null===(t=this._$ES)||void 0===t||t.forEach((t=>{var e;return null===(e=t.hostConnected)||void 0===e?void 0:e.call(t)}))}enableUpdating(t){}disconnectedCallback(){var t;null===(t=this._$ES)||void 0===t||t.forEach((t=>{var e;return null===(e=t.hostDisconnected)||void 0===e?void 0:e.call(t)}))}attributeChangedCallback(t,e,r){this._$AK(t,r)}_$EO(t,e,r=y){var i;const n=this.constructor._$Ep(t,r);if(void 0!==n&&!0===r.reflect){const a=(void 0!==(null===(i=r.converter)||void 0===i?void 0:i.toAttribute)?r.converter:v).toAttribute(e,r.type);this._$El=t,null==a?this.removeAttribute(n):this.setAttribute(n,a),this._$El=null}}_$AK(t,e){var r;const i=this.constructor,n=i._$Ev.get(t);if(void 0!==n&&this._$El!==n){const t=i.getPropertyOptions(n),a="function"==typeof t.converter?{fromAttribute:t.converter}:void 0!==(null===(r=t.converter)||void 0===r?void 0:r.fromAttribute)?t.converter:v;this._$El=n,this[n]=a.fromAttribute(e,t.type),this._$El=null}}requestUpdate(t,e,r){let i=!0;void 0!==t&&(((r=r||this.constructor.getPropertyOptions(t)).hasChanged||_)(this[t],e)?(this._$AL.has(t)||this._$AL.set(t,e),!0===r.reflect&&this._$El!==t&&(void 0===this._$EC&&(this._$EC=new Map),this._$EC.set(t,r))):i=!1),!this.isUpdatePending&&i&&(this._$E_=this._$Ej())}async _$Ej(){this.isUpdatePending=!0;try{await this._$E_}catch(t){Promise.reject(t)}const t=this.scheduleUpdate();return null!=t&&await t,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){var t;if(!this.isUpdatePending)return;this.hasUpdated,this._$Ei&&(this._$Ei.forEach(((t,e)=>this[e]=t)),this._$Ei=void 0);let e=!1;const r=this._$AL;try{e=this.shouldUpdate(r),e?(this.willUpdate(r),null===(t=this._$ES)||void 0===t||t.forEach((t=>{var e;return null===(e=t.hostUpdate)||void 0===e?void 0:e.call(t)})),this.update(r)):this._$Ek()}catch(t){throw e=!1,this._$Ek(),t}e&&this._$AE(r)}willUpdate(t){}_$AE(t){var e;null===(e=this._$ES)||void 0===e||e.forEach((t=>{var e;return null===(e=t.hostUpdated)||void 0===e?void 0:e.call(t)})),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(t)),this.updated(t)}_$Ek(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$E_}shouldUpdate(t){return!0}update(t){void 0!==this._$EC&&(this._$EC.forEach(((t,e)=>this._$EO(e,this[e],t))),this._$EC=void 0),this._$Ek()}updated(t){}firstUpdated(t){}}b.finalized=!0,b.elementProperties=new Map,b.elementStyles=[],b.shadowRootOptions={mode:"open"},null==g||g({ReactiveElement:b}),(null!==(h=m.reactiveElementVersions)&&void 0!==h?h:m.reactiveElementVersions=[]).push("1.4.1");var w,$,A=r(692);const S=b;class E extends b{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){var t,e;const r=super.createRenderRoot();return null!==(t=(e=this.renderOptions).renderBefore)&&void 0!==t||(e.renderBefore=r.firstChild),r}update(t){const e=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(t),this._$Do=(0,A.render)(e,this.renderRoot,this.renderOptions)}connectedCallback(){var t;super.connectedCallback(),null===(t=this._$Do)||void 0===t||t.setConnected(!0)}disconnectedCallback(){var t;super.disconnectedCallback(),null===(t=this._$Do)||void 0===t||t.setConnected(!1)}render(){return A.noChange}}E.finalized=!0,E._$litElement$=!0,null===(w=globalThis.litElementHydrateSupport)||void 0===w||w.call(globalThis,{LitElement:E});const x=globalThis.litElementPolyfillSupport;null==x||x({LitElement:E});const C={_$AK:(t,e,r)=>{t._$AK(e,r)},_$AL:t=>t._$AL};(null!==($=globalThis.litElementVersions)&&void 0!==$?$:globalThis.litElementVersions=[]).push("3.2.2")},147:t=>{t.exports=JSON.parse('{"name":"formulaone-card","version":"0.1.1","description":"Frontend card for hass-formulaoneapi","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.1.1","@typescript-eslint/eslint-plugin":"^5.39.0","@typescript-eslint/parser":"^5.39.0","eslint":"^8.24.0","home-assistant-js-websocket":"^8.0.0","lit":"^2.3.1","typescript":"^4.8.4","webpack":"^5.74.0","webpack-cli":"^4.10.0"},"dependencies":{"@babel/plugin-transform-runtime":"^7.19.1","@babel/preset-env":"^7.19.3","@lit-labs/scoped-registry-mixin":"^1.0.1","babel-jest":"^29.1.2","compression-webpack-plugin":"^10.0.0","custom-card-helpers":"^1.9.0","jest-environment-jsdom":"^29.1.2","jest-ts-auto-mock":"^2.1.0","ts-auto-mock":"^3.6.2","ts-jest":"^29.0.3","ts-loader":"^9.4.1","ttypescript":"^1.5.13","yarn":"^1.22.19"}}')}},e={};function r(i){var n=e[i];if(void 0!==n)return n.exports;var a=e[i]={exports:{}};return t[i].call(a.exports,a,a.exports,r),a.exports}r.d=(t,e)=>{for(var i in e)r.o(e,i)&&!r.o(t,i)&&Object.defineProperty(t,i,{enumerable:!0,get:e[i]})},r.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),r.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},r(607)})(); \ No newline at end of file +`},98:(t,e)=>{var r,i;Object.defineProperty(e,"__esModule",{value:!0}),e.FormulaOneCardType=e.PreviousRaceDisplay=void 0,(i=e.PreviousRaceDisplay||(e.PreviousRaceDisplay={})).Strikethrough="strikethrough",i.Italic="italic",i.Hide="hide",(r=e.FormulaOneCardType||(e.FormulaOneCardType={})).DriverStandings="driver_standings",r.ConstructorStandings="constructor_standings",r.NextRace="next_race",r.Schedule="schedule",r.LastResult="last_result"},593:(t,e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.getDriverName=e.getCountryFlagUrl=e.checkConfig=e.hasConfigOrEntitiesChanged=void 0,e.hasConfigOrEntitiesChanged=(t,e)=>{if(e.has("config"))return!0;const r=e.get("_hass");return!!r&&r.states[t.sensor]!==t.hass.states[t.sensor]},e.checkConfig=t=>{if(void 0===t.card_type)throw new Error("Please define FormulaOne card type (card_type).");if(void 0===t.sensor)throw new Error("Please define FormulaOne sensor.")},e.getCountryFlagUrl=t=>{const e=[{countryDashed:"USA",name:"United-States-of-America"}].filter((e=>e.countryDashed==t));return e.length>0&&(t=e[0].name),`https://www.countries-ofthe-world.com/flags-normal/flag-of-${t}.png`},e.getDriverName=(t,e)=>{const r="VER"==t.code?1:t.permanentNumber;return`${t.givenName} ${t.familyName}${e.show_carnumber?` #${r}`:""}`}},692:(t,e,r)=>{var i;r.r(e),r.d(e,{_$LH:()=>H,html:()=>A,noChange:()=>E,nothing:()=>x,render:()=>k,svg:()=>S});const n=window,a=n.trustedTypes,o=a?a.createPolicy("lit-html",{createHTML:t=>t}):void 0,s=`lit$${(Math.random()+"").slice(9)}$`,c="?"+s,l=`<${c}>`,u=document,d=(t="")=>u.createComment(t),h=t=>null===t||"object"!=typeof t&&"function"!=typeof t,m=Array.isArray,p=t=>m(t)||"function"==typeof(null==t?void 0:t[Symbol.iterator]),f=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,g=/-->/g,v=/>/g,_=RegExp(">|[ \t\n\f\r](?:([^\\s\"'>=/]+)([ \t\n\f\r]*=[ \t\n\f\r]*(?:[^ \t\n\f\r\"'`<>=]|(\"|')|))|$)","g"),y=/'/g,b=/"/g,w=/^(?:script|style|textarea|title)$/i,$=t=>(e,...r)=>({_$litType$:t,strings:e,values:r}),A=$(1),S=$(2),E=Symbol.for("lit-noChange"),x=Symbol.for("lit-nothing"),C=new WeakMap,k=(t,e,r)=>{var i,n;const a=null!==(i=null==r?void 0:r.renderBefore)&&void 0!==i?i:e;let o=a._$litPart$;if(void 0===o){const t=null!==(n=null==r?void 0:r.renderBefore)&&void 0!==n?n:null;a._$litPart$=o=new M(e.insertBefore(d(),t),t,void 0,null!=r?r:{})}return o._$AI(t),o},T=u.createTreeWalker(u,129,null,!1),D=(t,e)=>{const r=t.length-1,i=[];let n,a=2===e?"":"",c=f;for(let e=0;e"===u[0]?(c=null!=n?n:f,d=-1):void 0===u[1]?d=-2:(d=c.lastIndex-u[2].length,o=u[1],c=void 0===u[3]?_:'"'===u[3]?b:y):c===b||c===y?c=_:c===g||c===v?c=f:(c=_,n=void 0);const m=c===_&&t[e+1].startsWith("/>")?" ":"";a+=c===f?r+l:d>=0?(i.push(o),r.slice(0,d)+"$lit$"+r.slice(d)+s+m):r+s+(-2===d?(i.push(void 0),e):m)}const u=a+(t[r]||"")+(2===e?"":"");if(!Array.isArray(t)||!t.hasOwnProperty("raw"))throw Error("invalid template strings array");return[void 0!==o?o.createHTML(u):u,i]};class N{constructor({strings:t,_$litType$:e},r){let i;this.parts=[];let n=0,o=0;const l=t.length-1,u=this.parts,[h,m]=D(t,e);if(this.el=N.createElement(h,r),T.currentNode=this.el.content,2===e){const t=this.el.content,e=t.firstChild;e.remove(),t.append(...e.childNodes)}for(;null!==(i=T.nextNode())&&u.length0){i.textContent=a?a.emptyScript:"";for(let r=0;r2||""!==r[0]||""!==r[1]?(this._$AH=Array(r.length-1).fill(new String),this.strings=r):this._$AH=x}get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}_$AI(t,e=this,r,i){const n=this.strings;let a=!1;if(void 0===n)t=O(this,t,e,0),a=!h(t)||t!==this._$AH&&t!==E,a&&(this._$AH=t);else{const i=t;let o,s;for(t=n[0],o=0;o{r.r(e),r.d(e,{customElement:()=>i,eventOptions:()=>c,property:()=>a,query:()=>l,queryAll:()=>u,queryAssignedElements:()=>p,queryAssignedNodes:()=>f,queryAsync:()=>d,state:()=>o});const i=t=>e=>"function"==typeof e?((t,e)=>(customElements.define(t,e),e))(t,e):((t,e)=>{const{kind:r,elements:i}=e;return{kind:r,elements:i,finisher(e){customElements.define(t,e)}}})(t,e),n=(t,e)=>"method"===e.kind&&e.descriptor&&!("value"in e.descriptor)?{...e,finisher(r){r.createProperty(e.key,t)}}:{kind:"field",key:Symbol(),placement:"own",descriptor:{},originalKey:e.key,initializer(){"function"==typeof e.initializer&&(this[e.key]=e.initializer.call(this))},finisher(r){r.createProperty(e.key,t)}};function a(t){return(e,r)=>void 0!==r?((t,e,r)=>{e.constructor.createProperty(r,t)})(t,e,r):n(t,e)}function o(t){return a({...t,state:!0})}const s=({finisher:t,descriptor:e})=>(r,i)=>{var n;if(void 0===i){const i=null!==(n=r.originalKey)&&void 0!==n?n:r.key,a=null!=e?{kind:"method",placement:"prototype",key:i,descriptor:e(r.key)}:{...r,key:i};return null!=t&&(a.finisher=function(e){t(e,i)}),a}{const n=r.constructor;void 0!==e&&Object.defineProperty(r,i,e(i)),null==t||t(n,i)}};function c(t){return s({finisher:(e,r)=>{Object.assign(e.prototype[r],t)}})}function l(t,e){return s({descriptor:r=>{const i={get(){var e,r;return null!==(r=null===(e=this.renderRoot)||void 0===e?void 0:e.querySelector(t))&&void 0!==r?r:null},enumerable:!0,configurable:!0};if(e){const e="symbol"==typeof r?Symbol():"__"+r;i.get=function(){var r,i;return void 0===this[e]&&(this[e]=null!==(i=null===(r=this.renderRoot)||void 0===r?void 0:r.querySelector(t))&&void 0!==i?i:null),this[e]}}return i}})}function u(t){return s({descriptor:e=>({get(){var e,r;return null!==(r=null===(e=this.renderRoot)||void 0===e?void 0:e.querySelectorAll(t))&&void 0!==r?r:[]},enumerable:!0,configurable:!0})})}function d(t){return s({descriptor:e=>({async get(){var e;return await this.updateComplete,null===(e=this.renderRoot)||void 0===e?void 0:e.querySelector(t)},enumerable:!0,configurable:!0})})}var h;const m=null!=(null===(h=window.HTMLSlotElement)||void 0===h?void 0:h.prototype.assignedElements)?(t,e)=>t.assignedElements(e):(t,e)=>t.assignedNodes(e).filter((t=>t.nodeType===Node.ELEMENT_NODE));function p(t){const{slot:e,selector:r}=null!=t?t:{};return s({descriptor:i=>({get(){var i;const n="slot"+(e?`[name=${e}]`:":not([name])"),a=null===(i=this.renderRoot)||void 0===i?void 0:i.querySelector(n),o=null!=a?m(a,t):[];return r?o.filter((t=>t.matches(r))):o},enumerable:!0,configurable:!0})})}function f(t,e,r){let i,n=t;return"object"==typeof t?(n=t.slot,i=t):i={flatten:e},r?p({slot:n,flatten:e,selector:r}):s({descriptor:t=>({get(){var t,e;const r="slot"+(n?`[name=${n}]`:":not([name])"),a=null===(t=this.renderRoot)||void 0===t?void 0:t.querySelector(r);return null!==(e=null==a?void 0:a.assignedNodes(i))&&void 0!==e?e:[]},enumerable:!0,configurable:!0})})}},392:(t,e,r)=>{r.r(e),r.d(e,{CSSResult:()=>s,LitElement:()=>E,ReactiveElement:()=>b,UpdatingElement:()=>S,_$LE:()=>C,_$LH:()=>A._$LH,adoptStyles:()=>u,css:()=>l,defaultConverter:()=>v,getCompatibleStyle:()=>d,html:()=>A.html,noChange:()=>A.noChange,notEqual:()=>_,nothing:()=>A.nothing,render:()=>A.render,supportsAdoptingStyleSheets:()=>n,svg:()=>A.svg,unsafeCSS:()=>c});const i=window,n=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,r){if(this._$cssResult$=!0,r!==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(n&&void 0===t){const r=void 0!==e&&1===e.length;r&&(t=o.get(e)),void 0===t&&((this.o=t=new CSSStyleSheet).replaceSync(this.cssText),r&&o.set(e,t))}return t}toString(){return this.cssText}}const c=t=>new s("string"==typeof t?t:t+"",void 0,a),l=(t,...e)=>{const r=1===t.length?t[0]:e.reduce(((e,r,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.")})(r)+t[i+1]),t[0]);return new s(r,t,a)},u=(t,e)=>{n?t.adoptedStyleSheets=e.map((t=>t instanceof CSSStyleSheet?t:t.styleSheet)):e.forEach((e=>{const r=document.createElement("style"),n=i.litNonce;void 0!==n&&r.setAttribute("nonce",n),r.textContent=e.cssText,t.appendChild(r)}))},d=n?t=>t:t=>t instanceof CSSStyleSheet?(t=>{let e="";for(const r of t.cssRules)e+=r.cssText;return c(e)})(t):t;var h;const m=window,p=m.trustedTypes,f=p?p.emptyScript:"",g=m.reactiveElementPolyfillSupport,v={toAttribute(t,e){switch(e){case Boolean:t=t?f:null;break;case Object:case Array:t=null==t?t:JSON.stringify(t)}return t},fromAttribute(t,e){let r=t;switch(e){case Boolean:r=null!==t;break;case Number:r=null===t?null:Number(t);break;case Object:case Array:try{r=JSON.parse(t)}catch(t){r=null}}return r}},_=(t,e)=>e!==t&&(e==e||t==t),y={attribute:!0,type:String,converter:v,reflect:!1,hasChanged:_};class b extends HTMLElement{constructor(){super(),this._$Ei=new Map,this.isUpdatePending=!1,this.hasUpdated=!1,this._$El=null,this.u()}static addInitializer(t){var e;null!==(e=this.h)&&void 0!==e||(this.h=[]),this.h.push(t)}static get observedAttributes(){this.finalize();const t=[];return this.elementProperties.forEach(((e,r)=>{const i=this._$Ep(r,e);void 0!==i&&(this._$Ev.set(i,r),t.push(i))})),t}static createProperty(t,e=y){if(e.state&&(e.attribute=!1),this.finalize(),this.elementProperties.set(t,e),!e.noAccessor&&!this.prototype.hasOwnProperty(t)){const r="symbol"==typeof t?Symbol():"__"+t,i=this.getPropertyDescriptor(t,r,e);void 0!==i&&Object.defineProperty(this.prototype,t,i)}}static getPropertyDescriptor(t,e,r){return{get(){return this[e]},set(i){const n=this[t];this[e]=i,this.requestUpdate(t,n,r)},configurable:!0,enumerable:!0}}static getPropertyOptions(t){return this.elementProperties.get(t)||y}static finalize(){if(this.hasOwnProperty("finalized"))return!1;this.finalized=!0;const t=Object.getPrototypeOf(this);if(t.finalize(),this.elementProperties=new Map(t.elementProperties),this._$Ev=new Map,this.hasOwnProperty("properties")){const t=this.properties,e=[...Object.getOwnPropertyNames(t),...Object.getOwnPropertySymbols(t)];for(const r of e)this.createProperty(r,t[r])}return this.elementStyles=this.finalizeStyles(this.styles),!0}static finalizeStyles(t){const e=[];if(Array.isArray(t)){const r=new Set(t.flat(1/0).reverse());for(const t of r)e.unshift(d(t))}else void 0!==t&&e.push(d(t));return e}static _$Ep(t,e){const r=e.attribute;return!1===r?void 0:"string"==typeof r?r:"string"==typeof t?t.toLowerCase():void 0}u(){var t;this._$E_=new Promise((t=>this.enableUpdating=t)),this._$AL=new Map,this._$Eg(),this.requestUpdate(),null===(t=this.constructor.h)||void 0===t||t.forEach((t=>t(this)))}addController(t){var e,r;(null!==(e=this._$ES)&&void 0!==e?e:this._$ES=[]).push(t),void 0!==this.renderRoot&&this.isConnected&&(null===(r=t.hostConnected)||void 0===r||r.call(t))}removeController(t){var e;null===(e=this._$ES)||void 0===e||e.splice(this._$ES.indexOf(t)>>>0,1)}_$Eg(){this.constructor.elementProperties.forEach(((t,e)=>{this.hasOwnProperty(e)&&(this._$Ei.set(e,this[e]),delete this[e])}))}createRenderRoot(){var t;const e=null!==(t=this.shadowRoot)&&void 0!==t?t:this.attachShadow(this.constructor.shadowRootOptions);return u(e,this.constructor.elementStyles),e}connectedCallback(){var t;void 0===this.renderRoot&&(this.renderRoot=this.createRenderRoot()),this.enableUpdating(!0),null===(t=this._$ES)||void 0===t||t.forEach((t=>{var e;return null===(e=t.hostConnected)||void 0===e?void 0:e.call(t)}))}enableUpdating(t){}disconnectedCallback(){var t;null===(t=this._$ES)||void 0===t||t.forEach((t=>{var e;return null===(e=t.hostDisconnected)||void 0===e?void 0:e.call(t)}))}attributeChangedCallback(t,e,r){this._$AK(t,r)}_$EO(t,e,r=y){var i;const n=this.constructor._$Ep(t,r);if(void 0!==n&&!0===r.reflect){const a=(void 0!==(null===(i=r.converter)||void 0===i?void 0:i.toAttribute)?r.converter:v).toAttribute(e,r.type);this._$El=t,null==a?this.removeAttribute(n):this.setAttribute(n,a),this._$El=null}}_$AK(t,e){var r;const i=this.constructor,n=i._$Ev.get(t);if(void 0!==n&&this._$El!==n){const t=i.getPropertyOptions(n),a="function"==typeof t.converter?{fromAttribute:t.converter}:void 0!==(null===(r=t.converter)||void 0===r?void 0:r.fromAttribute)?t.converter:v;this._$El=n,this[n]=a.fromAttribute(e,t.type),this._$El=null}}requestUpdate(t,e,r){let i=!0;void 0!==t&&(((r=r||this.constructor.getPropertyOptions(t)).hasChanged||_)(this[t],e)?(this._$AL.has(t)||this._$AL.set(t,e),!0===r.reflect&&this._$El!==t&&(void 0===this._$EC&&(this._$EC=new Map),this._$EC.set(t,r))):i=!1),!this.isUpdatePending&&i&&(this._$E_=this._$Ej())}async _$Ej(){this.isUpdatePending=!0;try{await this._$E_}catch(t){Promise.reject(t)}const t=this.scheduleUpdate();return null!=t&&await t,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){var t;if(!this.isUpdatePending)return;this.hasUpdated,this._$Ei&&(this._$Ei.forEach(((t,e)=>this[e]=t)),this._$Ei=void 0);let e=!1;const r=this._$AL;try{e=this.shouldUpdate(r),e?(this.willUpdate(r),null===(t=this._$ES)||void 0===t||t.forEach((t=>{var e;return null===(e=t.hostUpdate)||void 0===e?void 0:e.call(t)})),this.update(r)):this._$Ek()}catch(t){throw e=!1,this._$Ek(),t}e&&this._$AE(r)}willUpdate(t){}_$AE(t){var e;null===(e=this._$ES)||void 0===e||e.forEach((t=>{var e;return null===(e=t.hostUpdated)||void 0===e?void 0:e.call(t)})),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(t)),this.updated(t)}_$Ek(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$E_}shouldUpdate(t){return!0}update(t){void 0!==this._$EC&&(this._$EC.forEach(((t,e)=>this._$EO(e,this[e],t))),this._$EC=void 0),this._$Ek()}updated(t){}firstUpdated(t){}}b.finalized=!0,b.elementProperties=new Map,b.elementStyles=[],b.shadowRootOptions={mode:"open"},null==g||g({ReactiveElement:b}),(null!==(h=m.reactiveElementVersions)&&void 0!==h?h:m.reactiveElementVersions=[]).push("1.4.1");var w,$,A=r(692);const S=b;class E extends b{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){var t,e;const r=super.createRenderRoot();return null!==(t=(e=this.renderOptions).renderBefore)&&void 0!==t||(e.renderBefore=r.firstChild),r}update(t){const e=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(t),this._$Do=(0,A.render)(e,this.renderRoot,this.renderOptions)}connectedCallback(){var t;super.connectedCallback(),null===(t=this._$Do)||void 0===t||t.setConnected(!0)}disconnectedCallback(){var t;super.disconnectedCallback(),null===(t=this._$Do)||void 0===t||t.setConnected(!1)}render(){return A.noChange}}E.finalized=!0,E._$litElement$=!0,null===(w=globalThis.litElementHydrateSupport)||void 0===w||w.call(globalThis,{LitElement:E});const x=globalThis.litElementPolyfillSupport;null==x||x({LitElement:E});const C={_$AK:(t,e,r)=>{t._$AK(e,r)},_$AL:t=>t._$AL};(null!==($=globalThis.litElementVersions)&&void 0!==$?$:globalThis.litElementVersions=[]).push("3.2.2")},147:t=>{t.exports=JSON.parse('{"name":"formulaone-card","version":"0.1.2","description":"Frontend card for hass-formulaoneapi","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.1.1","@typescript-eslint/eslint-plugin":"^5.39.0","@typescript-eslint/parser":"^5.39.0","eslint":"^8.24.0","home-assistant-js-websocket":"^8.0.0","lit":"^2.3.1","typescript":"^4.8.4","webpack":"^5.74.0","webpack-cli":"^4.10.0"},"dependencies":{"@babel/plugin-transform-runtime":"^7.19.1","@babel/preset-env":"^7.19.3","@lit-labs/scoped-registry-mixin":"^1.0.1","babel-jest":"^29.1.2","compression-webpack-plugin":"^10.0.0","custom-card-helpers":"^1.9.0","jest-environment-jsdom":"^29.1.2","jest-ts-auto-mock":"^2.1.0","ts-auto-mock":"^3.6.2","ts-jest":"^29.0.3","ts-loader":"^9.4.1","ttypescript":"^1.5.13","yarn":"^1.22.19"}}')}},e={};function r(i){var n=e[i];if(void 0!==n)return n.exports;var a=e[i]={exports:{}};return t[i].call(a.exports,a,a.exports,r),a.exports}r.d=(t,e)=>{for(var i in e)r.o(e,i)&&!r.o(t,i)&&Object.defineProperty(t,i,{enumerable:!0,get:e[i]})},r.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),r.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},r(607)})(); \ No newline at end of file diff --git a/formulaone-card.js.gz b/formulaone-card.js.gz index 2681e3f..9a2bd78 100644 Binary files a/formulaone-card.js.gz and b/formulaone-card.js.gz differ diff --git a/package.json b/package.json index fd193da..baff108 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "formulaone-card", - "version": "0.1.1", + "version": "0.1.2", "description": "Frontend card for hass-formulaoneapi", "main": "index.js", "scripts": {