655 lines
94 KiB
JavaScript
655 lines
94 KiB
JavaScript
|
/**
|
||
|
* @license
|
||
|
* Copyright (c) 2017 The Polymer Project Authors. All rights reserved.
|
||
|
* This code may only be used under the BSD style license found at
|
||
|
* http://polymer.github.io/LICENSE.txt
|
||
|
* The complete set of authors may be found at
|
||
|
* http://polymer.github.io/AUTHORS.txt
|
||
|
* The complete set of contributors may be found at
|
||
|
* http://polymer.github.io/CONTRIBUTORS.txt
|
||
|
* Code distributed by Google as part of the polymer project is also
|
||
|
* subject to an additional IP rights grant found at
|
||
|
* http://polymer.github.io/PATENTS.txt
|
||
|
*/
|
||
|
const t="undefined"!=typeof window&&null!=window.customElements&&void 0!==window.customElements.polyfillWrapFlushCallback,e=(t,e,a=null)=>{for(;e!==a;){const a=e.nextSibling;t.removeChild(e),e=a}},a=`{{lit-${String(Math.random()).slice(2)}}}`,r=`\x3c!--${a}--\x3e`,i=new RegExp(`${a}|${r}`);class n{constructor(t,e){this.parts=[],this.element=e;const r=[],n=[],s=document.createTreeWalker(e.content,133,null,!1);let u=0,d=-1,h=0;const{strings:p,values:{length:m}}=t;for(;h<m;){const t=s.nextNode();if(null!==t){if(d++,1===t.nodeType){if(t.hasAttributes()){const e=t.attributes,{length:a}=e;let r=0;for(let t=0;t<a;t++)o(e[t].name,"$lit$")&&r++;for(;r-- >0;){const e=p[h],a=c.exec(e)[2],r=a.toLowerCase()+"$lit$",n=t.getAttribute(r);t.removeAttribute(r);const o=n.split(i);this.parts.push({type:"attribute",index:d,name:a,strings:o}),h+=o.length-1}}"TEMPLATE"===t.tagName&&(n.push(t),s.currentNode=t.content)}else if(3===t.nodeType){const e=t.data;if(e.indexOf(a)>=0){const a=t.parentNode,n=e.split(i),s=n.length-1;for(let e=0;e<s;e++){let r,i=n[e];if(""===i)r=l();else{const t=c.exec(i);null!==t&&o(t[2],"$lit$")&&(i=i.slice(0,t.index)+t[1]+t[2].slice(0,-"$lit$".length)+t[3]),r=document.createTextNode(i)}a.insertBefore(r,t),this.parts.push({type:"node",index:++d})}""===n[s]?(a.insertBefore(l(),t),r.push(t)):t.data=n[s],h+=s}}else if(8===t.nodeType)if(t.data===a){const e=t.parentNode;null!==t.previousSibling&&d!==u||(d++,e.insertBefore(l(),t)),u=d,this.parts.push({type:"node",index:d}),null===t.nextSibling?t.data="":(r.push(t),d--),h++}else{let e=-1;for(;-1!==(e=t.data.indexOf(a,e+1));)this.parts.push({type:"node",index:-1}),h++}}else s.currentNode=n.pop()}for(const t of r)t.parentNode.removeChild(t)}}const o=(t,e)=>{const a=t.length-e.length;return a>=0&&t.slice(a)===e},s=t=>-1!==t.index,l=()=>document.createComment(""),c=/([ \x09\x0a\x0c\x0d])([^\0-\x1F\x7F-\x9F "'>=/]+)([ \x09\x0a\x0c\x0d]*=[ \x09\x0a\x0c\x0d]*(?:[^ \x09\x0a\x0c\x0d"'`<>=]*|"[^"]*|'[^']*))$/;function u(t,e){const{element:{content:a},parts:r}=t,i=document.createTreeWalker(a,133,null,!1);let n=h(r),o=r[n],s=-1,l=0;const c=[];let u=null;for(;i.nextNode();){s++;const t=i.currentNode;for(t.previousSibling===u&&(u=null),e.has(t)&&(c.push(t),null===u&&(u=t)),null!==u&&l++;void 0!==o&&o.index===s;)o.index=null!==u?-1:o.index-l,n=h(r,n),o=r[n]}c.forEach(t=>t.parentNode.removeChild(t))}const d=t=>{let e=11===t.nodeType?0:1;const a=document.createTreeWalker(t,133,null,!1);for(;a.nextNode();)e++;return e},h=(t,e=-1)=>{for(let a=e+1;a<t.length;a++){const e=t[a];if(s(e))return a}return-1};
|
||
|
/**
|
||
|
* @license
|
||
|
* Copyright (c) 2017 The Polymer Project Authors. All rights reserved.
|
||
|
* This code may only be used under the BSD style license found at
|
||
|
* http://polymer.github.io/LICENSE.txt
|
||
|
* The complete set of authors may be found at
|
||
|
* http://polymer.github.io/AUTHORS.txt
|
||
|
* The complete set of contributors may be found at
|
||
|
* http://polymer.github.io/CONTRIBUTORS.txt
|
||
|
* Code distributed by Google as part of the polymer project is also
|
||
|
* subject to an additional IP rights grant found at
|
||
|
* http://polymer.github.io/PATENTS.txt
|
||
|
*/
|
||
|
const p=new WeakMap,m=t=>"function"==typeof t&&p.has(t),g={},f={};
|
||
|
/**
|
||
|
* @license
|
||
|
* Copyright (c) 2017 The Polymer Project Authors. All rights reserved.
|
||
|
* This code may only be used under the BSD style license found at
|
||
|
* http://polymer.github.io/LICENSE.txt
|
||
|
* The complete set of authors may be found at
|
||
|
* http://polymer.github.io/AUTHORS.txt
|
||
|
* The complete set of contributors may be found at
|
||
|
* http://polymer.github.io/CONTRIBUTORS.txt
|
||
|
* Code distributed by Google as part of the polymer project is also
|
||
|
* subject to an additional IP rights grant found at
|
||
|
* http://polymer.github.io/PATENTS.txt
|
||
|
*/
|
||
|
class b{constructor(t,e,a){this.__parts=[],this.template=t,this.processor=e,this.options=a}update(t){let e=0;for(const a of this.__parts)void 0!==a&&a.setValue(t[e]),e++;for(const t of this.__parts)void 0!==t&&t.commit()}_clone(){const e=t?this.template.element.content.cloneNode(!0):document.importNode(this.template.element.content,!0),a=[],r=this.template.parts,i=document.createTreeWalker(e,133,null,!1);let n,o=0,l=0,c=i.nextNode();for(;o<r.length;)if(n=r[o],s(n)){for(;l<n.index;)l++,"TEMPLATE"===c.nodeName&&(a.push(c),i.currentNode=c.content),null===(c=i.nextNode())&&(i.currentNode=a.pop(),c=i.nextNode());if("node"===n.type){const t=this.processor.handleTextExpression(this.options);t.insertAfterNode(c.previousSibling),this.__parts.push(t)}else this.__parts.push(...this.processor.handleAttributeExpressions(c,n.name,n.strings,this.options));o++}else this.__parts.push(void 0),o++;return t&&(document.adoptNode(e),customElements.upgrade(e)),e}}
|
||
|
/**
|
||
|
* @license
|
||
|
* Copyright (c) 2017 The Polymer Project Authors. All rights reserved.
|
||
|
* This code may only be used under the BSD style license found at
|
||
|
* http://polymer.github.io/LICENSE.txt
|
||
|
* The complete set of authors may be found at
|
||
|
* http://polymer.github.io/AUTHORS.txt
|
||
|
* The complete set of contributors may be found at
|
||
|
* http://polymer.github.io/CONTRIBUTORS.txt
|
||
|
* Code distributed by Google as part of the polymer project is also
|
||
|
* subject to an additional IP rights grant found at
|
||
|
* http://polymer.github.io/PATENTS.txt
|
||
|
*/const y=` ${a} `;class v{constructor(t,e,a,r){this.strings=t,this.values=e,this.type=a,this.processor=r}getHTML(){const t=this.strings.length-1;let e="",i=!1;for(let n=0;n<t;n++){const t=this.strings[n],o=t.lastIndexOf("\x3c!--");i=(o>-1||i)&&-1===t.indexOf("--\x3e",o+1);const s=c.exec(t);e+=null===s?t+(i?y:r):t.substr(0,s.index)+s[1]+s[2]+"$lit$"+s[3]+a}return e+=this.strings[t],e}getTemplateElement(){const t=document.createElement("template");return t.innerHTML=this.getHTML(),t}}
|
||
|
/**
|
||
|
* @license
|
||
|
* Copyright (c) 2017 The Polymer Project Authors. All rights reserved.
|
||
|
* This code may only be used under the BSD style license found at
|
||
|
* http://polymer.github.io/LICENSE.txt
|
||
|
* The complete set of authors may be found at
|
||
|
* http://polymer.github.io/AUTHORS.txt
|
||
|
* The complete set of contributors may be found at
|
||
|
* http://polymer.github.io/CONTRIBUTORS.txt
|
||
|
* Code distributed by Google as part of the polymer project is also
|
||
|
* subject to an additional IP rights grant found at
|
||
|
* http://polymer.github.io/PATENTS.txt
|
||
|
*/const S=t=>null===t||!("object"==typeof t||"function"==typeof t),w=t=>Array.isArray(t)||!(!t||!t[Symbol.iterator]);class k{constructor(t,e,a){this.dirty=!0,this.element=t,this.name=e,this.strings=a,this.parts=[];for(let t=0;t<a.length-1;t++)this.parts[t]=this._createPart()}_createPart(){return new _(this)}_getValue(){const t=this.strings,e=t.length-1;let a="";for(let r=0;r<e;r++){a+=t[r];const e=this.parts[r];if(void 0!==e){const t=e.value;if(S(t)||!w(t))a+="string"==typeof t?t:String(t);else for(const e of t)a+="string"==typeof e?e:String(e)}}return a+=t[e],a}commit(){this.dirty&&(this.dirty=!1,this.element.setAttribute(this.name,this._getValue()))}}class _{constructor(t){this.value=void 0,this.committer=t}setValue(t){t===g||S(t)&&t===this.value||(this.value=t,m(t)||(this.committer.dirty=!0))}commit(){for(;m(this.value);){const t=this.value;this.value=g,t(this)}this.value!==g&&this.committer.commit()}}class x{constructor(t){this.value=void 0,this.__pendingValue=void 0,this.options=t}appendInto(t){this.startNode=t.appendChild(l()),this.endNode=t.appendChild(l())}insertAfterNode(t){this.startNode=t,this.endNode=t.nextSibling}appendIntoPart(t){t.__insert(this.startNode=l()),t.__insert(this.endNode=l())}insertAfterPart(t){t.__insert(this.startNode=l()),this.endNode=t.endNode,t.endNode=this.startNode}setValue(t){this.__pendingValue=t}commit(){if(null===this.startNode.parentNode)return;for(;m(this.__pendingValue);){const t=this.__pendingValue;this.__pendingValue=g,t(this)}const t=this.__pendingValue;t!==g&&(S(t)?t!==this.value&&this.__commitText(t):t instanceof v?this.__commitTemplateResult(t):t instanceof Node?this.__commitNode(t):w(t)?this.__commitIterable(t):t===f?(this.value=f,this.clear()):this.__commitText(t))}__insert(t){this.endNode.parentNode.insertBefore(t,this.endNode)}__commitNode(t){this.value!==t&&(this.clear(),this.__insert(t),this.value=t)}__commitText(t){const e=this.startNode.nextSibling,a="string"==typeof(t=null==t?"":t)?t:String(t);e===this.endNode.previousSibling&&3===e.nodeType?e.data=a:this.__commitNode(document.createTextNode(a)),this.value=t}__commitTemplateResult(t){const e=this.options.templateFactory(t);if(this.value instanceof b&&this.value.template===e)this.value.update(t.values);else{const a=new b(e,t.processor,this.options),r=a._clone();a.update(t.values),this.__commitNode(r),this.value=a}}__commitIterable(t){Array.isArray(this.value)||(this.value=[],this.clear());const e=this.value;let a,r=0;for(const i of t)a=e[r],void 0===a&&(a=new x(this.options),e.push(a),0===r?a.appendIntoPart(this):a.insertAfterPart(e[r-1])),a.setValue(i),a.commit(),r++;r<e.length&&(e.length=r,this.clear(a&&a.endNode))}clear(t=this.startNode){e(this.startNode.parentNode,t.nextSibling,this.endNode)}}class V{constructor(t,e,a){if(this.value=void 0,this.__pendingValue=void 0,2!==a.length||""!==a[0]||""!==a[1])throw new Error("Boolean attributes can only contain a single expression");this.element=t,this.name=e,this.strings=a}setValue(t){this.__pendingValue=t}commit(){for(;m(this.__pendingValue);){const t=this.__pendingValue;this.__pendingValue=g,t(this)}if(this.__pendingValue===g)return;const t=!!this.__pendingValue;this.value!==t&&(t?this.element.setAttribute(this.name,""):this.element.removeAttribute(this.name),this.value=t),this.__pendingValue=g}}class U extends k{constructor(t,e,a){super(t,e,a),this.single=2===a.length&&""===a[0]&&""===a[1]}_createPart(){return new R(this)}_getValue(){return this.single?this.parts[0].value:super._getValue()}commit(){this.dirty&&(this.dirty=!1,this.element[this.name]=this._getValue())}}class R extends _{}let O=!1;(()=>{try{const t={get capture(){return O=!0,!1}};window.addEventListener("test",t,t),window.removeEventListener("test",t,t)}catch(t){}})();class N{constructor(t,e,a){this.value=void 0,this.__pendingValue=void 0,this.element=t,this.eventName=e,this.eventContext=a,this.__boundHandleEvent=t=>this.handleEvent(t)}setValue(t){this.__pendingValue=t}commit(){for(;m(this.__pendingValue);){const t=this.__pendingValue;this.__pendingValue=g,t(this)}if(this.__pendingValue===g)return;cons
|
||
|
/**
|
||
|
* @license
|
||
|
* Copyright (c) 2017 The Polymer Project Authors. All rights reserved.
|
||
|
* This code may only be used under the BSD style license found at
|
||
|
* http://polymer.github.io/LICENSE.txt
|
||
|
* The complete set of authors may be found at
|
||
|
* http://polymer.github.io/AUTHORS.txt
|
||
|
* The complete set of contributors may be found at
|
||
|
* http://polymer.github.io/CONTRIBUTORS.txt
|
||
|
* Code distributed by Google as part of the polymer project is also
|
||
|
* subject to an additional IP rights grant found at
|
||
|
* http://polymer.github.io/PATENTS.txt
|
||
|
*/;function z(t){let e=P.get(t.type);void 0===e&&(e={stringsArray:new WeakMap,keyString:new Map},P.set(t.type,e));let r=e.stringsArray.get(t.strings);if(void 0!==r)return r;const i=t.strings.join(a);return r=e.keyString.get(i),void 0===r&&(r=new n(t,t.getTemplateElement()),e.keyString.set(i,r)),e.stringsArray.set(t.strings,r),r}const P=new Map,q=new WeakMap;
|
||
|
/**
|
||
|
* @license
|
||
|
* Copyright (c) 2017 The Polymer Project Authors. All rights reserved.
|
||
|
* This code may only be used under the BSD style license found at
|
||
|
* http://polymer.github.io/LICENSE.txt
|
||
|
* The complete set of authors may be found at
|
||
|
* http://polymer.github.io/AUTHORS.txt
|
||
|
* The complete set of contributors may be found at
|
||
|
* http://polymer.github.io/CONTRIBUTORS.txt
|
||
|
* Code distributed by Google as part of the polymer project is also
|
||
|
* subject to an additional IP rights grant found at
|
||
|
* http://polymer.github.io/PATENTS.txt
|
||
|
*/const W=new
|
||
|
/**
|
||
|
* @license
|
||
|
* Copyright (c) 2017 The Polymer Project Authors. All rights reserved.
|
||
|
* This code may only be used under the BSD style license found at
|
||
|
* http://polymer.github.io/LICENSE.txt
|
||
|
* The complete set of authors may be found at
|
||
|
* http://polymer.github.io/AUTHORS.txt
|
||
|
* The complete set of contributors may be found at
|
||
|
* http://polymer.github.io/CONTRIBUTORS.txt
|
||
|
* Code distributed by Google as part of the polymer project is also
|
||
|
* subject to an additional IP rights grant found at
|
||
|
* http://polymer.github.io/PATENTS.txt
|
||
|
*/
|
||
|
class{handleAttributeExpressions(t,e,a,r){const i=e[0];if("."===i){return new U(t,e.slice(1),a).parts}return"@"===i?[new N(t,e.slice(1),r.eventContext)]:"?"===i?[new V(t,e.slice(1),a)]:new k(t,e,a).parts}handleTextExpression(t){return new x(t)}};
|
||
|
/**
|
||
|
* @license
|
||
|
* Copyright (c) 2017 The Polymer Project Authors. All rights reserved.
|
||
|
* This code may only be used under the BSD style license found at
|
||
|
* http://polymer.github.io/LICENSE.txt
|
||
|
* The complete set of authors may be found at
|
||
|
* http://polymer.github.io/AUTHORS.txt
|
||
|
* The complete set of contributors may be found at
|
||
|
* http://polymer.github.io/CONTRIBUTORS.txt
|
||
|
* Code distributed by Google as part of the polymer project is also
|
||
|
* subject to an additional IP rights grant found at
|
||
|
* http://polymer.github.io/PATENTS.txt
|
||
|
*/"undefined"!=typeof window&&(window.litHtmlVersions||(window.litHtmlVersions=[])).push("1.2.1");const E=(t,...e)=>new v(t,e,"html",W)
|
||
|
/**
|
||
|
* @license
|
||
|
* Copyright (c) 2017 The Polymer Project Authors. All rights reserved.
|
||
|
* This code may only be used under the BSD style license found at
|
||
|
* http://polymer.github.io/LICENSE.txt
|
||
|
* The complete set of authors may be found at
|
||
|
* http://polymer.github.io/AUTHORS.txt
|
||
|
* The complete set of contributors may be found at
|
||
|
* http://polymer.github.io/CONTRIBUTORS.txt
|
||
|
* Code distributed by Google as part of the polymer project is also
|
||
|
* subject to an additional IP rights grant found at
|
||
|
* http://polymer.github.io/PATENTS.txt
|
||
|
*/,M=(t,e)=>`${t}--${e}`;let j=!0;void 0===window.ShadyCSS?j=!1:void 0===window.ShadyCSS.prepareTemplateDom&&(console.warn("Incompatible ShadyCSS version detected. Please update to at least @webcomponents/webcomponentsjs@2.0.2 and @webcomponents/shadycss@1.3.1."),j=!1);const X=t=>e=>{const r=M(e.type,t);let i=P.get(r);void 0===i&&(i={stringsArray:new WeakMap,keyString:new Map},P.set(r,i));let o=i.stringsArray.get(e.strings);if(void 0!==o)return o;const s=e.strings.join(a);if(o=i.keyString.get(s),void 0===o){const a=e.getTemplateElement();j&&window.ShadyCSS.prepareTemplateDom(a,t),o=new n(e,a),i.keyString.set(s,o)}return i.stringsArray.set(e.strings,o),o},K=["html","svg"],C=new Set,F=(t,e,a)=>{C.add(t);const r=a?a.element:document.createElement("template"),i=e.querySelectorAll("style"),{length:n}=i;if(0===n)return void window.ShadyCSS.prepareTemplateStyles(r,t);const o=document.createElement("style");for(let t=0;t<n;t++){const e=i[t];e.parentNode.removeChild(e),o.textContent+=e.textContent}(t=>{K.forEach(e=>{const a=P.get(M(e,t));void 0!==a&&a.keyString.forEach(t=>{const{element:{content:e}}=t,a=new Set;Array.from(e.querySelectorAll("style")).forEach(t=>{a.add(t)}),u(t,a)})})})(t);const s=r.content;a?function(t,e,a=null){const{element:{content:r},parts:i}=t;if(null==a)return void r.appendChild(e);const n=document.createTreeWalker(r,133,null,!1);let o=h(i),s=0,l=-1;for(;n.nextNode();){for(l++,n.currentNode===a&&(s=d(e),a.parentNode.insertBefore(e,a));-1!==o&&i[o].index===l;){if(s>0){for(;-1!==o;)i[o].index+=s,o=h(i,o);return}o=h(i,o)}}}(a,o,s.firstChild):s.insertBefore(o,s.firstChild),window.ShadyCSS.prepareTemplateStyles(r,t);const l=s.querySelector("style");if(window.ShadyCSS.nativeShadow&&null!==l)e.insertBefore(l.cloneNode(!0),e.firstChild);else if(a){s.insertBefore(o,s.firstChild);const t=new Set;t.add(o),u(a,t)}};window.JSCompiler_renameProperty=(t,e)=>t;const Y={toAttribute(t,e){switch(e){case Boolean:return t?"":null;case Object:case Array:return null==t?t:JSON.stringify(t)}return t},fromAttribute(t,e){switch(e){case Boolean:return null!==t;case Number:return null===t?null:Number(t);case Object:case Array:return JSON.parse(t)}return t}},Z=(t,e)=>e!==t&&(e==e||t==t),A={attribute:!0,type:String,converter:Y,reflect:!1,hasChanged:Z};class D extends HTMLElement{constructor(){super(),this._updateState=0,this._instanceProperties=void 0,this._updatePromise=new Promise(t=>this._enableUpdatingResolver=t),this._changedProperties=new Map,this._reflectingProperties=void 0,this.initialize()}static get observedAttributes(){this.finalize();const t=[];return this._classProperties.forEach((e,a)=>{const r=this._attributeNameForProperty(a,e);void 0!==r&&(this._attributeToPropertyMap.set(r,a),t.push(r))}),t}static _ensureClassProperties(){if(!this.hasOwnProperty(JSCompiler_renameProperty("_classProperties",this))){this._classProperties=new Map;const t=Object.getPrototypeOf(this)._classProperties;void 0!==t&&t.forEach((t,e)=>this._classProperties.set(e,t))}}static createProperty(t,e=A){if(this._ensureClassProperties(),this._classProperties.set(t,e),e.noAccessor||this.prototype.hasOwnProperty(t))return;const a="symbol"==typeof t?Symbol():"__"+t,r=this.getPropertyDescriptor(t,a,e);void 0!==r&&Object.defineProperty(this.prototype,t,r)}static getPropertyDescriptor(t,e,a){return{get(){return this[e]},set(a){const r=this[t];this[e]=a,this._requestUpdate(t,r)},configurable:!0,enumerable:!0}}static getPropertyOptions(t){return this._classProperties&&this._classProperties.get(t)||A}static finalize(){const t=Object.getPrototypeOf(this);if(t.hasOwnProperty("finalized")||t.finalize(),this.finalized=!0,this._ensureClassProperties(),this._attributeToPropertyMap=new Map,this.hasOwnProperty(JSCompiler_renameProperty("properties",this))){const t=this.properties,e=[...Object.getOwnPropertyNames(t),..."function"==typeof Object.getOwnPropertySymbols?Object.getOwnPropertySymbols(t):[]];for(const a of e)this.createProperty(a,t[a])}}static _attributeNameForProperty(t,e){const a=e.attribute;return!1===a?void 0:"string"==typeof a?a:"string"==typeof t?t.toLowe
|
||
|
/**
|
||
|
@license
|
||
|
Copyright (c) 2019 The Polymer Project Authors. All rights reserved.
|
||
|
This code may only be used under the BSD style license found at
|
||
|
http://polymer.github.io/LICENSE.txt The complete set of authors may be found at
|
||
|
http://polymer.github.io/AUTHORS.txt The complete set of contributors may be
|
||
|
found at http://polymer.github.io/CONTRIBUTORS.txt Code distributed by Google as
|
||
|
part of the polymer project is also subject to an additional IP rights grant
|
||
|
found at http://polymer.github.io/PATENTS.txt
|
||
|
*/
|
||
|
const J="adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,I=Symbol();class L{constructor(t,e){if(e!==I)throw new Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=t}get styleSheet(){return void 0===this._styleSheet&&(J?(this._styleSheet=new CSSStyleSheet,this._styleSheet.replaceSync(this.cssText)):this._styleSheet=null),this._styleSheet}toString(){return this.cssText}}const H=(t,...e)=>{const a=e.reduce((e,a,r)=>e+(t=>{if(t instanceof L)return t.cssText;if("number"==typeof t)return t;throw new Error(`Value passed to 'css' function must be a 'css' function result: ${t}. Use 'unsafeCSS' to pass non-literal values, but\n take care to ensure page security.`)})(a)+t[r+1],t[0]);return new L(a,I)};
|
||
|
/**
|
||
|
* @license
|
||
|
* Copyright (c) 2017 The Polymer Project Authors. All rights reserved.
|
||
|
* This code may only be used under the BSD style license found at
|
||
|
* http://polymer.github.io/LICENSE.txt
|
||
|
* The complete set of authors may be found at
|
||
|
* http://polymer.github.io/AUTHORS.txt
|
||
|
* The complete set of contributors may be found at
|
||
|
* http://polymer.github.io/CONTRIBUTORS.txt
|
||
|
* Code distributed by Google as part of the polymer project is also
|
||
|
* subject to an additional IP rights grant found at
|
||
|
* http://polymer.github.io/PATENTS.txt
|
||
|
*/
|
||
|
(window.litElementVersions||(window.litElementVersions=[])).push("2.3.1");const G={};class Q extends D{static getStyles(){return this.styles}static _getUniqueStyles(){if(this.hasOwnProperty(JSCompiler_renameProperty("_styles",this)))return;const t=this.getStyles();if(void 0===t)this._styles=[];else if(Array.isArray(t)){const e=(t,a)=>t.reduceRight((t,a)=>Array.isArray(a)?e(a,t):(t.add(a),t),a),a=e(t,new Set),r=[];a.forEach(t=>r.unshift(t)),this._styles=r}else this._styles=[t]}initialize(){super.initialize(),this.constructor._getUniqueStyles(),this.renderRoot=this.createRenderRoot(),window.ShadowRoot&&this.renderRoot instanceof window.ShadowRoot&&this.adoptStyles()}createRenderRoot(){return this.attachShadow({mode:"open"})}adoptStyles(){const t=this.constructor._styles;0!==t.length&&(void 0===window.ShadyCSS||window.ShadyCSS.nativeShadow?J?this.renderRoot.adoptedStyleSheets=t.map(t=>t.styleSheet):this._needsShimAdoptedStyleSheets=!0:window.ShadyCSS.ScopingShim.prepareAdoptedCssText(t.map(t=>t.cssText),this.localName))}connectedCallback(){super.connectedCallback(),this.hasUpdated&&void 0!==window.ShadyCSS&&window.ShadyCSS.styleElement(this)}update(t){const e=this.render();super.update(t),e!==G&&this.constructor.render(e,this.renderRoot,{scopeName:this.localName,eventContext:this}),this._needsShimAdoptedStyleSheets&&(this._needsShimAdoptedStyleSheets=!1,this.constructor._styles.forEach(t=>{const e=document.createElement("style");e.textContent=t.cssText,this.renderRoot.appendChild(e)}))}render(){return G}}Q.finalized=!0,Q.render=(t,a,r)=>{if(!r||"object"!=typeof r||!r.scopeName)throw new Error("The `scopeName` option is required.");const i=r.scopeName,n=q.has(a),o=j&&11===a.nodeType&&!!a.host,s=o&&!C.has(i),l=s?document.createDocumentFragment():a;if(((t,a,r)=>{let i=q.get(a);void 0===i&&(e(a,a.firstChild),q.set(a,i=new x(Object.assign({templateFactory:z},r))),i.appendInto(a)),i.setValue(t),i.commit()})(t,l,Object.assign({templateFactory:X(i)},r)),s){const t=q.get(l);q.delete(l);const r=t.value instanceof b?t.value.template:void 0;F(i,l,r),e(a,a.firstChild),a.appendChild(l),q.set(a,t)}!n&&o&&window.ShadyCSS.styleElement(a.host)};var B=/d{1,4}|M{1,4}|YY(?:YY)?|S{1,3}|Do|ZZ|Z|([HhMsDm])\1?|[aA]|"[^"]*"|'[^']*'/g,$="[^\\s]+",tt=/\[([^]*?)\]/gm;function et(t,e){for(var a=[],r=0,i=t.length;r<i;r++)a.push(t[r].substr(0,e));return a}var at=function(t){return function(e,a){var r=a[t].map((function(t){return t.toLowerCase()})).indexOf(e.toLowerCase());return r>-1?r:null}};function rt(t){for(var e=[],a=1;a<arguments.length;a++)e[a-1]=arguments[a];for(var r=0,i=e;r<i.length;r++){var n=i[r];for(var o in n)t[o]=n[o]}return t}var it=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],nt=["January","February","March","April","May","June","July","August","September","October","November","December"],ot=et(nt,3),st={dayNamesShort:et(it,3),dayNames:it,monthNamesShort:ot,monthNames:nt,amPm:["am","pm"],DoFn:function(t){return t+["th","st","nd","rd"][t%10>3?0:(t-t%10!=10?1:0)*t%10]}},lt=rt({},st),ct=function(t,e){for(void 0===e&&(e=2),t=String(t);t.length<e;)t="0"+t;return t},ut={D:function(t){return String(t.getDate())},DD:function(t){return ct(t.getDate())},Do:function(t,e){return e.DoFn(t.getDate())},d:function(t){return String(t.getDay())},dd:function(t){return ct(t.getDay())},ddd:function(t,e){return e.dayNamesShort[t.getDay()]},dddd:function(t,e){return e.dayNames[t.getDay()]},M:function(t){return String(t.getMonth()+1)},MM:function(t){return ct(t.getMonth()+1)},MMM:function(t,e){return e.monthNamesShort[t.getMonth()]},MMMM:function(t,e){return e.monthNames[t.getMonth()]},YY:function(t){return ct(String(t.getFullYear()),4).substr(2)},YYYY:function(t){return ct(t.getFullYear(),4)},h:function(t){return String(t.getHours()%12||12)},hh:function(t){return ct(t.getHours()%12||12)},H:function(t){return String(t.getHours())},HH:function(t){return ct(t.getHours())},m:function(t){return String(t.getMinutes())},mm:function(t){return ct(t.getMinutes())},s:function(t){return String(t.getSeconds())},ss:function(t){return ct(t.getSeco
|
||
|
<div class="card-config">
|
||
|
<paper-dropdown-menu
|
||
|
label="${ge("editor.entity")}"
|
||
|
@value-changed=${this._valueChanged}
|
||
|
.configValue=${"entity"}
|
||
|
>
|
||
|
<paper-listbox
|
||
|
slot="dropdown-content"
|
||
|
.selected=${t.indexOf(this._entity)}
|
||
|
>
|
||
|
${t.map(t=>E` <paper-item>${t}</paper-item> `)}
|
||
|
</paper-listbox>
|
||
|
</paper-dropdown-menu>
|
||
|
|
||
|
<paper-dropdown-menu
|
||
|
label="${ge("editor.entity")}"
|
||
|
@value-changed=${this._valueChanged}
|
||
|
.configValue=${"map"}
|
||
|
>
|
||
|
<paper-listbox
|
||
|
slot="dropdown-content"
|
||
|
.selected=${e.indexOf(this._map)}
|
||
|
>
|
||
|
${e.map(t=>E` <paper-item>${t}</paper-item> `)}
|
||
|
</paper-listbox>
|
||
|
</paper-dropdown-menu>
|
||
|
|
||
|
<paper-input
|
||
|
label="${ge("editor.image")}"
|
||
|
.value=${this._image}
|
||
|
.configValue=${"image"}
|
||
|
@value-changed=${this._valueChanged}
|
||
|
></paper-input>
|
||
|
|
||
|
<ha-switch
|
||
|
style="margin: 10px auto;"
|
||
|
aria-label=${ge(this._compact_view?"editor.compact_view_aria_label_off":"editor.compact_view_aria_label_on")}
|
||
|
.checked=${!1!==this._compact_view}
|
||
|
.configValue=${"compact_view"}
|
||
|
@change=${this._valueChanged}
|
||
|
>
|
||
|
${ge("editor.compact_view")}
|
||
|
</ha-switch>
|
||
|
|
||
|
<ha-switch
|
||
|
style="margin: 10px auto;"
|
||
|
aria-label=${ge(this._show_name?"editor.show_name_aria_label_off":"editor.show_name_aria_label_on")}
|
||
|
.checked=${!1!==this._show_name}
|
||
|
.configValue=${"show_name"}
|
||
|
@change=${this._valueChanged}
|
||
|
>
|
||
|
${ge("editor.show_name")}
|
||
|
</ha-switch>
|
||
|
|
||
|
<ha-switch
|
||
|
style="margin: 10px auto;"
|
||
|
aria-label=${ge(this._show_status?"editor.show_status_aria_label_off":"editor.show_status_aria_label_on")}
|
||
|
.checked=${!1!==this._show_status}
|
||
|
.configValue=${"show_status"}
|
||
|
@change=${this._valueChanged}
|
||
|
>
|
||
|
${ge("editor.show_status")}
|
||
|
</ha-switch>
|
||
|
|
||
|
<ha-switch
|
||
|
style="margin: 10px auto;"
|
||
|
aria-label=${ge(this._show_name?"editor.show_toolbar_aria_label_off":"editor.show_toolbar_aria_label_on")}
|
||
|
.checked=${!1!==this._show_toolbar}
|
||
|
.configValue=${"show_toolbar"}
|
||
|
@change=${this._valueChanged}
|
||
|
>
|
||
|
${ge("editor.show_toolbar")}
|
||
|
</ha-switch>
|
||
|
|
||
|
<strong>
|
||
|
${ge("editor.code_only_note")}
|
||
|
</strong>
|
||
|
</div>
|
||
|
`}_valueChanged(t){if(!this._config||!this.hass)return;const e=t.target;this["_"+e.configValue]!==e.value&&(e.configValue&&(""===e.value?delete this._config[e.configValue]:this._config={...this._config,[e.configValue]:void 0!==e.checked?e.checked:e.value}),yt(this,"config-changed",{config:this._config}))}static get styles(){return H`
|
||
|
.card-config paper-dropdown-menu {
|
||
|
width: 100%;
|
||
|
}
|
||
|
`}});var fe=H`
|
||
|
:host {
|
||
|
display: flex;
|
||
|
flex: 1;
|
||
|
flex-direction: column;
|
||
|
}
|
||
|
|
||
|
ha-card {
|
||
|
flex-direction: column;
|
||
|
flex: 1;
|
||
|
position: relative;
|
||
|
padding: 0px;
|
||
|
border-radius: 4px;
|
||
|
overflow: hidden;
|
||
|
}
|
||
|
|
||
|
.preview {
|
||
|
background: var(--primary-color);
|
||
|
cursor: pointer;
|
||
|
overflow: hidden;
|
||
|
position: relative;
|
||
|
}
|
||
|
|
||
|
.preview.not-available {
|
||
|
filter: grayscale(1);
|
||
|
}
|
||
|
|
||
|
.map {
|
||
|
display: block;
|
||
|
max-width: 90%;
|
||
|
image-rendering: crisp-edges;
|
||
|
}
|
||
|
|
||
|
@keyframes cleaning {
|
||
|
0% {
|
||
|
transform: rotate(0) translate(0);
|
||
|
}
|
||
|
5% {
|
||
|
transform: rotate(0) translate(0, -10px);
|
||
|
}
|
||
|
10% {
|
||
|
transform: rotate(0) translate(0, 5px);
|
||
|
}
|
||
|
15% {
|
||
|
transform: rotate(0) translate(0);
|
||
|
}
|
||
|
/* Turn left */
|
||
|
20% {
|
||
|
transform: rotate(30deg) translate(0);
|
||
|
}
|
||
|
25% {
|
||
|
transform: rotate(30deg) translate(0, -10px);
|
||
|
}
|
||
|
30% {
|
||
|
transform: rotate(30deg) translate(0, 5px);
|
||
|
}
|
||
|
35% {
|
||
|
transform: rotate(30deg) translate(0);
|
||
|
}
|
||
|
40% {
|
||
|
transform: rotate(0) translate(0);
|
||
|
}
|
||
|
/* Turn right */
|
||
|
45% {
|
||
|
transform: rotate(-30deg) translate(0);
|
||
|
}
|
||
|
50% {
|
||
|
transform: rotate(-30deg) translate(0, -10px);
|
||
|
}
|
||
|
55% {
|
||
|
transform: rotate(-30deg) translate(0, 5px);
|
||
|
}
|
||
|
60% {
|
||
|
transform: rotate(-30deg) translate(0);
|
||
|
}
|
||
|
70% {
|
||
|
transform: rotate(0deg) translate(0);
|
||
|
}
|
||
|
/* Staying still */
|
||
|
100% {
|
||
|
transform: rotate(0deg);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
@keyframes returning {
|
||
|
0% {
|
||
|
transform: rotate(0);
|
||
|
}
|
||
|
25% {
|
||
|
transform: rotate(10deg);
|
||
|
}
|
||
|
50% {
|
||
|
transform: rotate(0);
|
||
|
}
|
||
|
75% {
|
||
|
transform: rotate(-10deg);
|
||
|
}
|
||
|
100% {
|
||
|
transform: rotate(0);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
.vacuum {
|
||
|
display: block;
|
||
|
max-width: 90%;
|
||
|
max-height: 200px;
|
||
|
image-rendering: crisp-edges;
|
||
|
margin: 30px auto 20px auto;
|
||
|
}
|
||
|
|
||
|
.vacuum.cleaning {
|
||
|
animation: cleaning 5s linear infinite;
|
||
|
}
|
||
|
|
||
|
.vacuum.returning {
|
||
|
animation: returning 2s linear infinite;
|
||
|
}
|
||
|
|
||
|
.vacuum.paused {
|
||
|
opacity: 100%;
|
||
|
}
|
||
|
|
||
|
.vacuum.docked {
|
||
|
opacity: 50%;
|
||
|
}
|
||
|
|
||
|
.fill-gap {
|
||
|
flex-grow: 1;
|
||
|
}
|
||
|
|
||
|
.header {
|
||
|
height: 40px;
|
||
|
display: flex;
|
||
|
flex-direction: row;
|
||
|
justify-content: space-between;
|
||
|
align-items: center;
|
||
|
color: var(--text-primary-color);
|
||
|
}
|
||
|
|
||
|
.battery {
|
||
|
text-align: right;
|
||
|
font-weight: bold;
|
||
|
padding: 8px;
|
||
|
}
|
||
|
|
||
|
.source {
|
||
|
text-align: center;
|
||
|
}
|
||
|
|
||
|
.status {
|
||
|
display: flex;
|
||
|
align-items: center;
|
||
|
justify-content: center;
|
||
|
}
|
||
|
|
||
|
.status-text {
|
||
|
color: var(--text-primary-color);
|
||
|
white-space: nowrap;
|
||
|
text-overflow: ellipsis;
|
||
|
overflow: hidden;
|
||
|
margin-left: calc(20px + 9px); /* size + margin of spinner */
|
||
|
}
|
||
|
|
||
|
.status paper-spinner {
|
||
|
min-width: 20px;
|
||
|
width: 20px;
|
||
|
height: 20px;
|
||
|
margin-left: 9px;
|
||
|
}
|
||
|
|
||
|
.vacuum-name {
|
||
|
text-align: center;
|
||
|
font-weight: bold;
|
||
|
color: var(--text-primary-color);
|
||
|
font-size: 16px;
|
||
|
}
|
||
|
|
||
|
.not-available {
|
||
|
text-align: center;
|
||
|
color: var(--text-primary-color);
|
||
|
font-size: 16px;
|
||
|
}
|
||
|
|
||
|
.metadata {
|
||
|
margin: 10px auto;
|
||
|
}
|
||
|
|
||
|
.stats {
|
||
|
border-top: 1px solid rgba(255, 255, 255, 0.2);
|
||
|
display: flex;
|
||
|
flex-direction: row;
|
||
|
justify-content: space-evenly;
|
||
|
color: var(--text-primary-color);
|
||
|
}
|
||
|
|
||
|
.stats-block {
|
||
|
margin: 10px 0px;
|
||
|
text-align: center;
|
||
|
border-right: 1px solid rgba(255, 255, 255, 0.2);
|
||
|
flex-grow: 1;
|
||
|
}
|
||
|
|
||
|
.stats-block:last-child {
|
||
|
border: 0px;
|
||
|
}
|
||
|
|
||
|
.stats-hours {
|
||
|
font-size: 20px;
|
||
|
font-weight: bold;
|
||
|
}
|
||
|
|
||
|
ha-icon {
|
||
|
color: #fff;
|
||
|
}
|
||
|
|
||
|
.toolbar {
|
||
|
background: var(--lovelace-background, var(--primary-background-color));
|
||
|
min-height: 30px;
|
||
|
display: flex;
|
||
|
flex-direction: row;
|
||
|
justify-content: space-evenly;
|
||
|
}
|
||
|
|
||
|
.toolbar ha-icon-button {
|
||
|
color: var(--primary-color);
|
||
|
flex-direction: column;
|
||
|
width: 44px;
|
||
|
height: 44px;
|
||
|
--mdc-icon-button-size: 44px;
|
||
|
margin: 5px 0;
|
||
|
}
|
||
|
|
||
|
.toolbar ha-icon-button:first-child {
|
||
|
margin-left: 5px;
|
||
|
}
|
||
|
|
||
|
.toolbar ha-icon-button:last-child {
|
||
|
margin-right: 5px;
|
||
|
}
|
||
|
|
||
|
.toolbar paper-button {
|
||
|
color: var(--primary-color);
|
||
|
flex-direction: column;
|
||
|
margin-right: 10px;
|
||
|
padding: 15px 10px;
|
||
|
cursor: pointer;
|
||
|
}
|
||
|
|
||
|
.toolbar ha-icon-button:active,
|
||
|
.toolbar paper-button:active {
|
||
|
opacity: 0.4;
|
||
|
background: rgba(0, 0, 0, 0.1);
|
||
|
}
|
||
|
|
||
|
.toolbar paper-button {
|
||
|
color: var(--primary-color);
|
||
|
flex-direction: row;
|
||
|
}
|
||
|
|
||
|
.toolbar ha-icon {
|
||
|
color: var(--primary-color);
|
||
|
padding-right: 15px;
|
||
|
}
|
||
|
`;const be="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAeoAAAHqCAQAAABhZMWxAAAgAElEQVR42uydd3xUVdrHv3dm0ggBEggECL33Ih0UCyiKdW2ra0NXiohtXVbfLbLdVVfWRSFh144Nu+KKUpTepfdOQiCUhJA+mZn7/jHn3kzCzDCZeyfJzJyfH5lzc2duO+d3n+c85ymKioSERCTBBop8CmGLaXHlKTEprhRXCilqiiVFTVGb0pg4JZZYNVYR/+P+F8Wu2rErdlX8j121U06BclbJc+UpeeRZ8ix5FXlxebPK5bMNV6goqiR12ODpxJK2rra0dbWjLW1pS3MSQ3SqYk5xjGMcsxzlmOVYg2MvFcvnL0ktYQKmNnX1dPWiu9pOaUdbtWndXYlylmPqUeUoeyw7LbteOyv7RpJaogZEdvSip9pL6an2okU9vchcZae6S9nJLttOSXBJagmveKSNcyhD1UuUXmrzGsjPCuWc7bytOKGsgT3RmawmWZrYGsfFW21Wmy3GGmuzxdhstpiYGFusLRYcdoe9osJR4XA4KuyOCqfD4XCWOQvKzzkKXflKsbUktjTekehopDZRY2pwDafUncom1lnXzc6S/ShJHfWYnnRuEEMZylBaBvB1u/VEQl5ycaqjpTU9sVVySrPYpNBcl70w70xOfnbxCedpW35iaYqzJbEB/OwE61jHuiYbXyiUfStJHWWY0k29TB3KUHqqFr9SsCTmaOrZto62ca2TWqQ2aV5nnaWeO5V7+njhsfJjttNNK9qpDfxetYtdrFPWKcvn7JV9LUkd4ZjYUrlKHcNVpPuhRGnMkeZ5bSq6NuiU1iIdSz28DVdu9sGT+0qyYk6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
||
|
.horizontalAlign=${"right"}
|
||
|
.verticalAlign=${"top"}
|
||
|
.verticalOffset=${40}
|
||
|
.noAnimations=${!0}
|
||
|
@click="${t=>t.stopPropagation()}"
|
||
|
>
|
||
|
<paper-button slot="dropdown-trigger">
|
||
|
<ha-icon icon="mdi:fan"></ha-icon>
|
||
|
<span show=${!0}>
|
||
|
${ge("source."+t)||t}
|
||
|
</span>
|
||
|
</paper-button>
|
||
|
<paper-listbox
|
||
|
slot="dropdown-content"
|
||
|
selected=${a}
|
||
|
@click="${t=>this.handleSpeed(t)}"
|
||
|
>
|
||
|
${e.map(t=>E`<paper-item value=${t}
|
||
|
>${ge("source."+t)||t}</paper-item
|
||
|
>`)}
|
||
|
</paper-listbox>
|
||
|
</paper-menu-button>
|
||
|
`}renderMapOrImage(t){return this.compactView?E``:this.map?E` <img class="map" src="${this.mapUrl}" /> `:this.image?E` <img class="vacuum ${t}" src="${this.image}" /> `:E``}renderStats(t){const{stats:e={}}=this.config;return(e[t]||e.default||[]).map(({attribute:t,unit:e,subtitle:a})=>E`
|
||
|
<div class="stats-block">
|
||
|
<span class="stats-hours">${this.entity.attributes[t]}</span>
|
||
|
${e}
|
||
|
<div class="stats-subtitle">${a}</div>
|
||
|
</div>
|
||
|
`)}renderName(){const{friendly_name:t}=this.getAttributes(this.entity);return this.showName?E`
|
||
|
<div class="vacuum-name">
|
||
|
${t}
|
||
|
</div>
|
||
|
`:E``}renderStatus(){const{status:t}=this.getAttributes(this.entity),e=ge("status."+t)||t;return this.showStatus?E`
|
||
|
<div class="status">
|
||
|
<span class="status-text" alt=${e}>
|
||
|
${e}
|
||
|
</span>
|
||
|
<paper-spinner ?active=${this.requestInProgress}></paper-spinner>
|
||
|
</div>
|
||
|
`:E``}renderToolbar(t){if(!this.showToolbar)return E``;switch(t){case"cleaning":return E`
|
||
|
<div class="toolbar">
|
||
|
<paper-button @click="${()=>this.callService("pause")}">
|
||
|
<ha-icon icon="hass:pause"></ha-icon>
|
||
|
${ge("common.pause")}
|
||
|
</paper-button>
|
||
|
<paper-button @click="${()=>this.callService("stop")}">
|
||
|
<ha-icon icon="hass:stop"></ha-icon>
|
||
|
${ge("common.stop")}
|
||
|
</paper-button>
|
||
|
<paper-button @click="${()=>this.callService("return_to_base")}">
|
||
|
<ha-icon icon="hass:home-map-marker"></ha-icon>
|
||
|
${ge("common.return_to_base")}
|
||
|
</paper-button>
|
||
|
</div>
|
||
|
`;case"paused":return E`
|
||
|
<div class="toolbar">
|
||
|
<paper-button @click="${()=>this.callService("start")}">
|
||
|
<ha-icon icon="hass:play"></ha-icon>
|
||
|
${ge("common.continue")}
|
||
|
</paper-button>
|
||
|
<paper-button @click="${()=>this.callService("return_to_base")}">
|
||
|
<ha-icon icon="hass:home-map-marker"></ha-icon>
|
||
|
${ge("common.return_to_base")}
|
||
|
</paper-button>
|
||
|
</div>
|
||
|
`;case"returning":return E`
|
||
|
<div class="toolbar">
|
||
|
<paper-button @click="${()=>this.callService("start")}">
|
||
|
<ha-icon icon="hass:play"></ha-icon>
|
||
|
${ge("common.continue")}
|
||
|
</paper-button>
|
||
|
<paper-button @click="${()=>this.callService("pause")}">
|
||
|
<ha-icon icon="hass:pause"></ha-icon>
|
||
|
${ge("common.pause")}
|
||
|
</paper-button>
|
||
|
</div>
|
||
|
`;case"docked":case"idle":default:{const{actions:e=[]}=this.config,a=e.map(({name:t,service:e,icon:a,service_data:r})=>E`<ha-icon-button
|
||
|
icon="${a}"
|
||
|
title="${t}"
|
||
|
@click="${()=>{const[t,a]=e.split(".");this.hass.callService(t,a,r)}}"
|
||
|
></ha-icon-button>`),r=E`
|
||
|
<ha-icon-button
|
||
|
icon="hass:home-map-marker"
|
||
|
title="${ge("common.return_to_base")}"
|
||
|
@click="${()=>this.callService("return_to_base")}"
|
||
|
>
|
||
|
</ha-icon-button>
|
||
|
`;return E`
|
||
|
<div class="toolbar">
|
||
|
<ha-icon-button
|
||
|
icon="hass:play"
|
||
|
title="${ge("common.start")}"
|
||
|
@click="${()=>this.callService("start")}"
|
||
|
>
|
||
|
</ha-icon-button>
|
||
|
|
||
|
<ha-icon-button
|
||
|
icon="mdi:crosshairs-gps"
|
||
|
title="${ge("common.locate")}"
|
||
|
@click="${()=>this.callService("locate",!1)}"
|
||
|
>
|
||
|
</ha-icon-button>
|
||
|
|
||
|
${"idle"===t?r:""}
|
||
|
<div class="fill-gap"></div>
|
||
|
${a}
|
||
|
</div>
|
||
|
`}}}render(){if(!this.entity)return E`
|
||
|
<ha-card>
|
||
|
<div class="preview not-available">
|
||
|
<div class="metadata">
|
||
|
<div class="not-available">
|
||
|
${ge("common.not_available")}
|
||
|
</div>
|
||
|
<div>
|
||
|
</div>
|
||
|
</ha-card>
|
||
|
`;const{state:t}=this.entity,{battery_level:e,battery_icon:a}=this.getAttributes(this.entity);return E`
|
||
|
<ha-card>
|
||
|
<div
|
||
|
class="preview"
|
||
|
@click="${()=>this.handleMore()}"
|
||
|
?more-info="true"
|
||
|
>
|
||
|
<div class="header">
|
||
|
<div class="source">
|
||
|
${this.renderSource()}
|
||
|
</div>
|
||
|
<div class="battery">
|
||
|
${e}% <ha-icon icon="${a}"></ha-icon>
|
||
|
</div>
|
||
|
</div>
|
||
|
|
||
|
${this.renderMapOrImage(t)}
|
||
|
|
||
|
<div class="metadata">
|
||
|
${this.renderName()} ${this.renderStatus()}
|
||
|
</div>
|
||
|
|
||
|
<div class="stats">
|
||
|
${this.renderStats(t)}
|
||
|
</div>
|
||
|
</div>
|
||
|
|
||
|
${this.renderToolbar(t)}
|
||
|
</ha-card>
|
||
|
`}}),window.customCards=window.customCards||[],window.customCards.push({preview:!0,type:"vacuum-card",name:ge("common.name"),description:ge("common.description")});
|