675 lines
113 KiB
JavaScript
675 lines
113 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)}}}`,o=`\x3c!--${a}--\x3e`,n=new RegExp(`${a}|${o}`);class r{constructor(t,e){this.parts=[],this.element=e;const o=[],r=[],s=document.createTreeWalker(e.content,133,null,!1);let u=0,p=-1,d=0;const{strings:h,values:{length:m}}=t;for(;d<m;){const t=s.nextNode();if(null!==t){if(p++,1===t.nodeType){if(t.hasAttributes()){const e=t.attributes,{length:a}=e;let o=0;for(let t=0;t<a;t++)i(e[t].name,"$lit$")&&o++;for(;o-- >0;){const e=h[d],a=c.exec(e)[2],o=a.toLowerCase()+"$lit$",r=t.getAttribute(o);t.removeAttribute(o);const i=r.split(n);this.parts.push({type:"attribute",index:p,name:a,strings:i}),d+=i.length-1}}"TEMPLATE"===t.tagName&&(r.push(t),s.currentNode=t.content)}else if(3===t.nodeType){const e=t.data;if(e.indexOf(a)>=0){const a=t.parentNode,r=e.split(n),s=r.length-1;for(let e=0;e<s;e++){let o,n=r[e];if(""===n)o=l();else{const t=c.exec(n);null!==t&&i(t[2],"$lit$")&&(n=n.slice(0,t.index)+t[1]+t[2].slice(0,-"$lit$".length)+t[3]),o=document.createTextNode(n)}a.insertBefore(o,t),this.parts.push({type:"node",index:++p})}""===r[s]?(a.insertBefore(l(),t),o.push(t)):t.data=r[s],d+=s}}else if(8===t.nodeType)if(t.data===a){const e=t.parentNode;null!==t.previousSibling&&p!==u||(p++,e.insertBefore(l(),t)),u=p,this.parts.push({type:"node",index:p}),null===t.nextSibling?t.data="":(o.push(t),p--),d++}else{let e=-1;for(;-1!==(e=t.data.indexOf(a,e+1));)this.parts.push({type:"node",index:-1}),d++}}else s.currentNode=r.pop()}for(const t of o)t.parentNode.removeChild(t)}}const i=(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:o}=t,n=document.createTreeWalker(a,133,null,!1);let r=d(o),i=o[r],s=-1,l=0;const c=[];let u=null;for(;n.nextNode();){s++;const t=n.currentNode;for(t.previousSibling===u&&(u=null),e.has(t)&&(c.push(t),null===u&&(u=t)),null!==u&&l++;void 0!==i&&i.index===s;)i.index=null!==u?-1:i.index-l,r=d(o,r),i=o[r]}c.forEach(t=>t.parentNode.removeChild(t))}const p=t=>{let e=11===t.nodeType?0:1;const a=document.createTreeWalker(t,133,null,!1);for(;a.nextNode();)e++;return e},d=(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 h=new WeakMap,m=t=>"function"==typeof t&&h.has(t),f={},g={};
|
||
|
/**
|
||
|
* @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 _{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=[],o=this.template.parts,n=document.createTreeWalker(e,133,null,!1);let r,i=0,l=0,c=n.nextNode();for(;i<o.length;)if(r=o[i],s(r)){for(;l<r.index;)l++,"TEMPLATE"===c.nodeName&&(a.push(c),n.currentNode=c.content),null===(c=n.nextNode())&&(n.currentNode=a.pop(),c=n.nextNode());if("node"===r.type){const t=this.processor.handleTextExpression(this.options);t.insertAfterNode(c.previousSibling),this.__parts.push(t)}else this.__parts.push(...this.processor.handleAttributeExpressions(c,r.name,r.strings,this.options));i++}else this.__parts.push(void 0),i++;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 v=` ${a} `;class b{constructor(t,e,a,o){this.strings=t,this.values=e,this.type=a,this.processor=o}getHTML(){const t=this.strings.length-1;let e="",n=!1;for(let r=0;r<t;r++){const t=this.strings[r],i=t.lastIndexOf("\x3c!--");n=(i>-1||n)&&-1===t.indexOf("--\x3e",i+1);const s=c.exec(t);e+=null===s?t+(n?v:o):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 y=t=>null===t||!("object"==typeof t||"function"==typeof t),S=t=>Array.isArray(t)||!(!t||!t[Symbol.iterator]);class w{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 k(this)}_getValue(){const t=this.strings,e=t.length-1;let a="";for(let o=0;o<e;o++){a+=t[o];const e=this.parts[o];if(void 0!==e){const t=e.value;if(y(t)||!S(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 k{constructor(t){this.value=void 0,this.committer=t}setValue(t){t===f||y(t)&&t===this.value||(this.value=t,m(t)||(this.committer.dirty=!0))}commit(){for(;m(this.value);){const t=this.value;this.value=f,t(this)}this.value!==f&&this.committer.commit()}}class V{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=f,t(this)}const t=this.__pendingValue;t!==f&&(y(t)?t!==this.value&&this.__commitText(t):t instanceof b?this.__commitTemplateResult(t):t instanceof Node?this.__commitNode(t):S(t)?this.__commitIterable(t):t===g?(this.value=g,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 _&&this.value.template===e)this.value.update(t.values);else{const a=new _(e,t.processor,this.options),o=a._clone();a.update(t.values),this.__commitNode(o),this.value=a}}__commitIterable(t){Array.isArray(this.value)||(this.value=[],this.clear());const e=this.value;let a,o=0;for(const n of t)a=e[o],void 0===a&&(a=new V(this.options),e.push(a),0===o?a.appendIntoPart(this):a.insertAfterPart(e[o-1])),a.setValue(n),a.commit(),o++;o<e.length&&(e.length=o,this.clear(a&&a.endNode))}clear(t=this.startNode){e(this.startNode.parentNode,t.nextSibling,this.endNode)}}class N{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=f,t(this)}if(this.__pendingValue===f)return;const t=!!this.__pendingValue;this.value!==t&&(t?this.element.setAttribute(this.name,""):this.element.removeAttribute(this.name),this.value=t),this.__pendingValue=f}}class z extends w{constructor(t,e,a){super(t,e,a),this.single=2===a.length&&""===a[0]&&""===a[1]}_createPart(){return new E(this)}_getValue(){return this.single?this.parts[0].value:super._getValue()}commit(){this.dirty&&(this.dirty=!1,this.element[this.name]=this._getValue())}}class E extends k{}let x=!1;(()=>{try{const t={get capture(){return x=!0,!1}};window.addEventListener("test",t,t),window.removeEventListener("test",t,t)}catch(t){}})();class j{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=f,t(this)}if(this.__pendingValue===f)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 M(t){let e=C.get(t.type);void 0===e&&(e={stringsArray:new WeakMap,keyString:new Map},C.set(t.type,e));let o=e.stringsArray.get(t.strings);if(void 0!==o)return o;const n=t.strings.join(a);return o=e.keyString.get(n),void 0===o&&(o=new r(t,t.getTemplateElement()),e.keyString.set(n,o)),e.stringsArray.set(t.strings,o),o}const C=new Map,P=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 q=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,o){const n=e[0];if("."===n){return new z(t,e.slice(1),a).parts}return"@"===n?[new j(t,e.slice(1),o.eventContext)]:"?"===n?[new N(t,e.slice(1),a)]:new w(t,e,a).parts}handleTextExpression(t){return new V(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 K=(t,...e)=>new b(t,e,"html",q)
|
||
|
/**
|
||
|
* @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
|
||
|
*/,I=(t,e)=>`${t}--${e}`;let U=!0;void 0===window.ShadyCSS?U=!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."),U=!1);const O=t=>e=>{const o=I(e.type,t);let n=C.get(o);void 0===n&&(n={stringsArray:new WeakMap,keyString:new Map},C.set(o,n));let i=n.stringsArray.get(e.strings);if(void 0!==i)return i;const s=e.strings.join(a);if(i=n.keyString.get(s),void 0===i){const a=e.getTemplateElement();U&&window.ShadyCSS.prepareTemplateDom(a,t),i=new r(e,a),n.keyString.set(s,i)}return n.stringsArray.set(e.strings,i),i},Z=["html","svg"],T=new Set,A=(t,e,a)=>{T.add(t);const o=a?a.element:document.createElement("template"),n=e.querySelectorAll("style"),{length:r}=n;if(0===r)return void window.ShadyCSS.prepareTemplateStyles(o,t);const i=document.createElement("style");for(let t=0;t<r;t++){const e=n[t];e.parentNode.removeChild(e),i.textContent+=e.textContent}(t=>{Z.forEach(e=>{const a=C.get(I(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=o.content;a?function(t,e,a=null){const{element:{content:o},parts:n}=t;if(null==a)return void o.appendChild(e);const r=document.createTreeWalker(o,133,null,!1);let i=d(n),s=0,l=-1;for(;r.nextNode();){for(l++,r.currentNode===a&&(s=p(e),a.parentNode.insertBefore(e,a));-1!==i&&n[i].index===l;){if(s>0){for(;-1!==i;)n[i].index+=s,i=d(n,i);return}i=d(n,i)}}}(a,i,s.firstChild):s.insertBefore(i,s.firstChild),window.ShadyCSS.prepareTemplateStyles(o,t);const l=s.querySelector("style");if(window.ShadyCSS.nativeShadow&&null!==l)e.insertBefore(l.cloneNode(!0),e.firstChild);else if(a){s.insertBefore(i,s.firstChild);const t=new Set;t.add(i),u(a,t)}};window.JSCompiler_renameProperty=(t,e)=>t;const R={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}},J=(t,e)=>e!==t&&(e==e||t==t),G={attribute:!0,type:String,converter:R,reflect:!1,hasChanged:J};class Y 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 o=this._attributeNameForProperty(a,e);void 0!==o&&(this._attributeToPropertyMap.set(o,a),t.push(o))}),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=G){if(this._ensureClassProperties(),this._classProperties.set(t,e),e.noAccessor||this.prototype.hasOwnProperty(t))return;const a="symbol"==typeof t?Symbol():"__"+t,o=this.getPropertyDescriptor(t,a,e);void 0!==o&&Object.defineProperty(this.prototype,t,o)}static getPropertyDescriptor(t,e,a){return{get(){return this[e]},set(a){const o=this[t];this[e]=a,this._requestUpdate(t,o)},configurable:!0,enumerable:!0}}static getPropertyOptions(t){return this._classProperties&&this._classProperties.get(t)||G}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 X="adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,D=Symbol();class L{constructor(t,e){if(e!==D)throw new Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=t}get styleSheet(){return void 0===this._styleSheet&&(X?(this._styleSheet=new CSSStyleSheet,this._styleSheet.replaceSync(this.cssText)):this._styleSheet=null),this._styleSheet}toString(){return this.cssText}}const F=(t,...e)=>{const a=e.reduce((e,a,o)=>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[o+1],t[0]);return new L(a,D)};
|
||
|
/**
|
||
|
* @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 Q={};class H extends Y{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),o=[];a.forEach(t=>o.unshift(t)),this._styles=o}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?X?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!==Q&&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 Q}}H.finalized=!0,H.render=(t,a,o)=>{if(!o||"object"!=typeof o||!o.scopeName)throw new Error("The `scopeName` option is required.");const n=o.scopeName,r=P.has(a),i=U&&11===a.nodeType&&!!a.host,s=i&&!T.has(n),l=s?document.createDocumentFragment():a;if(((t,a,o)=>{let n=P.get(a);void 0===n&&(e(a,a.firstChild),P.set(a,n=new V(Object.assign({templateFactory:M},o))),n.appendInto(a)),n.setValue(t),n.commit()})(t,l,Object.assign({templateFactory:O(n)},o)),s){const t=P.get(l);P.delete(l);const o=t.value instanceof _?t.value.template:void 0;A(n,l,o),e(a,a.firstChild),a.appendChild(l),P.set(a,t)}!r&&i&&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=[],o=0,n=t.length;o<n;o++)a.push(t[o].substr(0,e));return a}var at=function(t){return function(e,a){var o=a[t].map((function(t){return t.toLowerCase()})).indexOf(e.toLowerCase());return o>-1?o:null}};function ot(t){for(var e=[],a=1;a<arguments.length;a++)e[a-1]=arguments[a];for(var o=0,n=e;o<n.length;o++){var r=n[o];for(var i in r)t[i]=r[i]}return t}var nt=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],rt=["January","February","March","April","May","June","July","August","September","October","November","December"],it=et(rt,3),st={dayNamesShort:et(nt,3),dayNames:nt,monthNamesShort:it,monthNames:rt,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=ot({},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="${oo("editor.entity")}"
|
||
|
@value-changed=${this._valueChanged}
|
||
|
.configValue=${"entity"}
|
||
|
>
|
||
|
<paper-listbox
|
||
|
slot="dropdown-content"
|
||
|
.selected=${t.indexOf(this._entity)}
|
||
|
>
|
||
|
${t.map(t=>K` <paper-item>${t}</paper-item> `)}
|
||
|
</paper-listbox>
|
||
|
</paper-dropdown-menu>
|
||
|
|
||
|
<paper-dropdown-menu
|
||
|
label="${oo("editor.entity")}"
|
||
|
@value-changed=${this._valueChanged}
|
||
|
.configValue=${"map"}
|
||
|
>
|
||
|
<paper-listbox
|
||
|
slot="dropdown-content"
|
||
|
.selected=${e.indexOf(this._map)}
|
||
|
>
|
||
|
${e.map(t=>K` <paper-item>${t}</paper-item> `)}
|
||
|
</paper-listbox>
|
||
|
</paper-dropdown-menu>
|
||
|
|
||
|
<paper-input
|
||
|
label="${oo("editor.image")}"
|
||
|
.value=${this._image}
|
||
|
.configValue=${"image"}
|
||
|
@value-changed=${this._valueChanged}
|
||
|
></paper-input>
|
||
|
|
||
|
<p class="option">
|
||
|
<ha-switch
|
||
|
aria-label=${oo(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}
|
||
|
>
|
||
|
</ha-switch>
|
||
|
${oo("editor.compact_view")}
|
||
|
</p>
|
||
|
|
||
|
<p class="option">
|
||
|
<ha-switch
|
||
|
aria-label=${oo(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}
|
||
|
>
|
||
|
</ha-switch>
|
||
|
${oo("editor.show_name")}
|
||
|
</p>
|
||
|
|
||
|
<p class="option">
|
||
|
<ha-switch
|
||
|
aria-label=${oo(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}
|
||
|
>
|
||
|
</ha-switch>
|
||
|
${oo("editor.show_status")}
|
||
|
</p>
|
||
|
|
||
|
<p class="option">
|
||
|
<ha-switch
|
||
|
aria-label=${oo(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}
|
||
|
>
|
||
|
</ha-switch>
|
||
|
${oo("editor.show_toolbar")}
|
||
|
</p>
|
||
|
|
||
|
<strong>
|
||
|
${oo("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}),vt(this,"config-changed",{config:this._config}))}static get styles(){return F`
|
||
|
.card-config paper-dropdown-menu {
|
||
|
width: 100%;
|
||
|
}
|
||
|
|
||
|
.option {
|
||
|
display: flex;
|
||
|
align-items: center;
|
||
|
}
|
||
|
|
||
|
.option ha-switch {
|
||
|
margin-right: 10px;
|
||
|
}
|
||
|
`}});var no=F`
|
||
|
: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;
|
||
|
text-align: center;
|
||
|
}
|
||
|
|
||
|
.preview.not-available {
|
||
|
filter: grayscale(1);
|
||
|
}
|
||
|
|
||
|
.map {
|
||
|
max-width: 95%;
|
||
|
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,
|
||
|
.vacuum.on {
|
||
|
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 ha-circular-progress {
|
||
|
--mdc-theme-primary: var(
|
||
|
--card-background-color
|
||
|
); /* hack to override the color */
|
||
|
min-width: 24px;
|
||
|
width: 24px;
|
||
|
height: 24px;
|
||
|
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-value {
|
||
|
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 ro="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAeoAAAHqCAQAAABhZMWxAAAARGVYSWZNTQAqAAAACAACARIAAwAAAAEAAwAAh2kABAAAAAEAAAAmAAAAAAACoAIABAAAAAEAAAHqoAMABAAAAAEAAAHqAAAAAPF6S0EAACAASURBVHja7J13fFRV2se/d2bSCAESCAQIvfciHRQLKIp1batrQ1eKiG1dVt8tst1VV9ZFIWHXjg274opSlN6l905CIJSEkD6Zmfv+MefeTMLMMJl7J8nMnJ8fmXNzZ24753ef5zznKYqKhIREJMEGinwKYYtpceUpMSmuFFcKKWqKJUVNUZvSmDglllg1VhH/4/4Xxa7asSt2VfyPXbVTToFyVslz5Sl55FnyLHkVeXF5s8rlsw1XqCiqJHXY4OnEkrautrR1taMtbWlLcxJDdKpiTnGMYxyzHOWY5ViDYy8Vy+cvSS1hAqY2dfV09aK72k5pR1u1ad1diXKWY+pR5Sh7LDstu147K/tGklqiBkR29KKn2kvpqfaiRT29yFxlp7pL2cku205JcElqCa94pI1zKEPVS5ReavMayM8K5ZztvK04oayBPdGZrCZZmtgax8VbbVabLcYaa7PF2Gy2mJgYW6wtFhx2h72iwlHhcDgq7I4Kp8PhcJY5C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SkHTKVCjg4yiGycQIW0ulOmzodfSvXzeuqp4JWlVdin4mEZa4IIfWknryv6op20pbftkhuWVfXUshe9lEihm1H2iETqVRFhaC2C2hAV7rVoWNN/om/5hZWOidt5e7MXZLU9WEm/XPXfzXjquIYunLCZXWziuLiKHvIQQWS6UaXsAqAq
|
||
|
<paper-menu-button
|
||
|
slot="dropdown-trigger"
|
||
|
.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}>
|
||
|
${oo("source."+t)||t}
|
||
|
</span>
|
||
|
</paper-button>
|
||
|
<paper-listbox
|
||
|
slot="dropdown-content"
|
||
|
selected=${a}
|
||
|
@click="${t=>this.handleSpeed(t)}"
|
||
|
>
|
||
|
${e.map(t=>K`<paper-item value=${t}
|
||
|
>${oo("source."+t)||t}</paper-item
|
||
|
>`)}
|
||
|
</paper-listbox>
|
||
|
</paper-menu-button>
|
||
|
`}renderMapOrImage(t){return this.compactView?K``:this.map?K` <img class="map" src="${this.mapUrl}" /> `:this.image?K` <img class="vacuum ${t}" src="${this.image}" /> `:K``}renderStats(t){const{stats:e={}}=this.config;return(e[t]||e.default||[]).map(({entity_id:t,attribute:e,unit:a,subtitle:o})=>{if(!t&&!e)return K``;const n=t?this.hass.states[t].state:re(this.entity.attributes,e);return K`
|
||
|
<div class="stats-block">
|
||
|
<span class="stats-value">${n}</span>
|
||
|
${a}
|
||
|
<div class="stats-subtitle">${o}</div>
|
||
|
</div>
|
||
|
`})}renderName(){const{friendly_name:t}=this.getAttributes(this.entity);return this.showName?K`
|
||
|
<div class="vacuum-name">
|
||
|
${t}
|
||
|
</div>
|
||
|
`:K``}renderStatus(){const{status:t}=this.getAttributes(this.entity),e=oo("status."+t)||t;return this.showStatus?K`
|
||
|
<div class="status">
|
||
|
<span class="status-text" alt=${e}>
|
||
|
${e}
|
||
|
</span>
|
||
|
<ha-circular-progress
|
||
|
.active=${this.requestInProgress}
|
||
|
size="small"
|
||
|
></ha-circular-progress>
|
||
|
</div>
|
||
|
`:K``}renderToolbar(t){if(!this.showToolbar)return K``;switch(t){case"on":case"cleaning":return K`
|
||
|
<div class="toolbar">
|
||
|
<paper-button @click="${()=>this.callService("pause")}">
|
||
|
<ha-icon icon="hass:pause"></ha-icon>
|
||
|
${oo("common.pause")}
|
||
|
</paper-button>
|
||
|
<paper-button @click="${()=>this.callService("stop")}">
|
||
|
<ha-icon icon="hass:stop"></ha-icon>
|
||
|
${oo("common.stop")}
|
||
|
</paper-button>
|
||
|
<paper-button @click="${()=>this.callService("return_to_base")}">
|
||
|
<ha-icon icon="hass:home-map-marker"></ha-icon>
|
||
|
${oo("common.return_to_base")}
|
||
|
</paper-button>
|
||
|
</div>
|
||
|
`;case"paused":return K`
|
||
|
<div class="toolbar">
|
||
|
<paper-button @click="${()=>this.callService("start")}">
|
||
|
<ha-icon icon="hass:play"></ha-icon>
|
||
|
${oo("common.continue")}
|
||
|
</paper-button>
|
||
|
<paper-button @click="${()=>this.callService("return_to_base")}">
|
||
|
<ha-icon icon="hass:home-map-marker"></ha-icon>
|
||
|
${oo("common.return_to_base")}
|
||
|
</paper-button>
|
||
|
</div>
|
||
|
`;case"returning":return K`
|
||
|
<div class="toolbar">
|
||
|
<paper-button @click="${()=>this.callService("start")}">
|
||
|
<ha-icon icon="hass:play"></ha-icon>
|
||
|
${oo("common.continue")}
|
||
|
</paper-button>
|
||
|
<paper-button @click="${()=>this.callService("pause")}">
|
||
|
<ha-icon icon="hass:pause"></ha-icon>
|
||
|
${oo("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:o})=>K`<ha-icon-button
|
||
|
icon="${a}"
|
||
|
title="${t}"
|
||
|
@click="${()=>{const[t,a]=e.split(".");this.hass.callService(t,a,o)}}"
|
||
|
></ha-icon-button>`),o=K`
|
||
|
<ha-icon-button
|
||
|
icon="hass:home-map-marker"
|
||
|
title="${oo("common.return_to_base")}"
|
||
|
@click="${()=>this.callService("return_to_base")}"
|
||
|
>
|
||
|
</ha-icon-button>
|
||
|
`;return K`
|
||
|
<div class="toolbar">
|
||
|
<ha-icon-button
|
||
|
icon="hass:play"
|
||
|
title="${oo("common.start")}"
|
||
|
@click="${()=>this.callService("start")}"
|
||
|
>
|
||
|
</ha-icon-button>
|
||
|
|
||
|
<ha-icon-button
|
||
|
icon="mdi:map-marker"
|
||
|
title="${oo("common.locate")}"
|
||
|
@click="${()=>this.callService("locate",!1)}"
|
||
|
>
|
||
|
</ha-icon-button>
|
||
|
|
||
|
${"idle"===t?o:""}
|
||
|
<div class="fill-gap"></div>
|
||
|
${a}
|
||
|
</div>
|
||
|
`}}}render(){if(!this.entity)return K`
|
||
|
<ha-card>
|
||
|
<div class="preview not-available">
|
||
|
<div class="metadata">
|
||
|
<div class="not-available">
|
||
|
${oo("common.not_available")}
|
||
|
</div>
|
||
|
<div>
|
||
|
</div>
|
||
|
</ha-card>
|
||
|
`;const{state:t}=this.entity,{battery_level:e,battery_icon:a}=this.getAttributes(this.entity);return K`
|
||
|
<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:oo("common.name"),description:oo("common.description")});
|