From 25af44f259d5c33661e29836e37c427f4f10c059 Mon Sep 17 00:00:00 2001 From: neliss Date: Sun, 5 Jun 2022 20:30:19 +0200 Subject: [PATCH] release v1.4.1 --- dist/alarmo-card.js | 302 ++++++++++++++++++++++---------------------- src/const.ts | 2 +- 2 files changed, 152 insertions(+), 152 deletions(-) diff --git a/dist/alarmo-card.js b/dist/alarmo-card.js index 2a4573b..6f3bf77 100644 --- a/dist/alarmo-card.js +++ b/dist/alarmo-card.js @@ -1,4 +1,4 @@ -!function(t){"use strict"; +!function(e){"use strict"; /*! ***************************************************************************** Copyright (c) Microsoft Corporation. @@ -12,47 +12,47 @@ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - ***************************************************************************** */function e(t,e,i,s){var a,r=arguments.length,n=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)n=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(a=t[o])&&(n=(r<3?a(n):r>3?a(e,i,n):a(e,i))||n);return r>3&&n&&Object.defineProperty(e,i,n),n + ***************************************************************************** */function t(e,t,i,a){var s,r=arguments.length,n=r<3?t:null===a?a=Object.getOwnPropertyDescriptor(t,i):a;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)n=Reflect.decorate(e,t,i,a);else for(var o=e.length-1;o>=0;o--)(s=e[o])&&(n=(r<3?s(n):r>3?s(t,i,n):s(t,i))||n);return r>3&&n&&Object.defineProperty(t,i,n),n /** * @license * Copyright 2019 Google LLC * SPDX-License-Identifier: BSD-3-Clause - */}const i=window.ShadowRoot&&(void 0===window.ShadyCSS||window.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,s=Symbol(),a=new Map;class r{constructor(t,e){if(this._$cssResult$=!0,e!==s)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=t}get styleSheet(){let t=a.get(this.cssText);return i&&void 0===t&&(a.set(this.cssText,t=new CSSStyleSheet),t.replaceSync(this.cssText)),t}toString(){return this.cssText}}const n=t=>new r("string"==typeof t?t:t+"",s),o=(t,...e)=>{const i=1===t.length?t[0]:e.reduce((e,i,s)=>e+(t=>{if(!0===t._$cssResult$)return t.cssText;if("number"==typeof t)return t;throw Error("Value passed to 'css' function must be a 'css' function result: "+t+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(i)+t[s+1],t[0]);return new r(i,s)},l=(t,e)=>{i?t.adoptedStyleSheets=e.map(t=>t instanceof CSSStyleSheet?t:t.styleSheet):e.forEach(e=>{const i=document.createElement("style");i.textContent=e.cssText,t.appendChild(i)})},c=i?t=>t:t=>t instanceof CSSStyleSheet?(t=>{let e="";for(const i of t.cssRules)e+=i.cssText;return n(e)})(t):t + */}const i=window.ShadowRoot&&(void 0===window.ShadyCSS||window.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,a=Symbol(),s=new Map;class r{constructor(e,t){if(this._$cssResult$=!0,t!==a)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=e}get styleSheet(){let e=s.get(this.cssText);return i&&void 0===e&&(s.set(this.cssText,e=new CSSStyleSheet),e.replaceSync(this.cssText)),e}toString(){return this.cssText}}const n=e=>new r("string"==typeof e?e:e+"",a),o=(e,...t)=>{const i=1===e.length?e[0]:t.reduce((t,i,a)=>t+(e=>{if(!0===e._$cssResult$)return e.cssText;if("number"==typeof e)return e;throw Error("Value passed to 'css' function must be a 'css' function result: "+e+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(i)+e[a+1],e[0]);return new r(i,a)},l=(e,t)=>{i?e.adoptedStyleSheets=t.map(e=>e instanceof CSSStyleSheet?e:e.styleSheet):t.forEach(t=>{const i=document.createElement("style");i.textContent=t.cssText,e.appendChild(i)})},c=i?e=>e:e=>e instanceof CSSStyleSheet?(e=>{let t="";for(const i of e.cssRules)t+=i.cssText;return n(t)})(e):e /** * @license * Copyright 2017 Google LLC * SPDX-License-Identifier: BSD-3-Clause - */;var d,h;const u={toAttribute(t,e){switch(e){case Boolean:t=t?"":null;break;case Object:case Array:t=null==t?t:JSON.stringify(t)}return t},fromAttribute(t,e){let i=t;switch(e){case Boolean:i=null!==t;break;case Number:i=null===t?null:Number(t);break;case Object:case Array:try{i=JSON.parse(t)}catch(t){i=null}}return i}},m=(t,e)=>e!==t&&(e==e||t==t),p={attribute:!0,type:String,converter:u,reflect:!1,hasChanged:m};class g extends HTMLElement{constructor(){super(),this._$Et=new Map,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Ei=null,this.o()}static addInitializer(t){var e;null!==(e=this.l)&&void 0!==e||(this.l=[]),this.l.push(t)}static get observedAttributes(){this.finalize();const t=[];return this.elementProperties.forEach((e,i)=>{const s=this._$Eh(i,e);void 0!==s&&(this._$Eu.set(s,i),t.push(s))}),t}static createProperty(t,e=p){if(e.state&&(e.attribute=!1),this.finalize(),this.elementProperties.set(t,e),!e.noAccessor&&!this.prototype.hasOwnProperty(t)){const i="symbol"==typeof t?Symbol():"__"+t,s=this.getPropertyDescriptor(t,i,e);void 0!==s&&Object.defineProperty(this.prototype,t,s)}}static getPropertyDescriptor(t,e,i){return{get(){return this[e]},set(s){const a=this[t];this[e]=s,this.requestUpdate(t,a,i)},configurable:!0,enumerable:!0}}static getPropertyOptions(t){return this.elementProperties.get(t)||p}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._$Eu=new Map,this.hasOwnProperty("properties")){const t=this.properties,e=[...Object.getOwnPropertyNames(t),...Object.getOwnPropertySymbols(t)];for(const i of e)this.createProperty(i,t[i])}return this.elementStyles=this.finalizeStyles(this.styles),!0}static finalizeStyles(t){const e=[];if(Array.isArray(t)){const i=new Set(t.flat(1/0).reverse());for(const t of i)e.unshift(c(t))}else void 0!==t&&e.push(c(t));return e}static _$Eh(t,e){const i=e.attribute;return!1===i?void 0:"string"==typeof i?i:"string"==typeof t?t.toLowerCase():void 0}o(){var t;this._$Ev=new Promise(t=>this.enableUpdating=t),this._$AL=new Map,this._$Ep(),this.requestUpdate(),null===(t=this.constructor.l)||void 0===t||t.forEach(t=>t(this))}addController(t){var e,i;(null!==(e=this._$Em)&&void 0!==e?e:this._$Em=[]).push(t),void 0!==this.renderRoot&&this.isConnected&&(null===(i=t.hostConnected)||void 0===i||i.call(t))}removeController(t){var e;null===(e=this._$Em)||void 0===e||e.splice(this._$Em.indexOf(t)>>>0,1)}_$Ep(){this.constructor.elementProperties.forEach((t,e)=>{this.hasOwnProperty(e)&&(this._$Et.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 l(e,this.constructor.elementStyles),e}connectedCallback(){var t;void 0===this.renderRoot&&(this.renderRoot=this.createRenderRoot()),this.enableUpdating(!0),null===(t=this._$Em)||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._$Em)||void 0===t||t.forEach(t=>{var e;return null===(e=t.hostDisconnected)||void 0===e?void 0:e.call(t)})}attributeChangedCallback(t,e,i){this._$AK(t,i)}_$Eg(t,e,i=p){var s,a;const r=this.constructor._$Eh(t,i);if(void 0!==r&&!0===i.reflect){const n=(null!==(a=null===(s=i.converter)||void 0===s?void 0:s.toAttribute)&&void 0!==a?a:u.toAttribute)(e,i.type);this._$Ei=t,null==n?this.removeAttribute(r):this.setAttribute(r,n),this._$Ei=null}}_$AK(t,e){var i,s,a;const r=this.constructor,n=r._$Eu.get(t);if(void 0!==n&&this._$Ei!==n){const t=r.getPropertyOptions(n),o=t.converter,l=null!==(a=null!==(s=null===(i=o)||void 0===i?void 0:i.fromAttribute)&&void 0!==s?s:"function"==typeof o?o:null)&&void 0!==a?a:u.fromAttribute;this._$Ei=n,this[n]=l(e,t.type),this._$Ei=null}}requestUpdate(t,e,i){let s=!0;void 0!==t&&(((i=i||this.constructor.getPropertyOptions(t)).hasChanged||m)(this[t],e)?(this._$AL.has(t)||this._$AL.set(t,e),!0===i.reflect&&this._$Ei!==t&&(void 0===this._$ES&&(this._$ES=new Map),this._$ES.set(t,i))):s=!1),!this.isUpdatePending&&s&&(this._$Ev=this._$EC())}async _$EC(){this.isUpdatePending=!0;try{await this._$Ev}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._$Et&&(this._$Et.forEach((t,e)=>this[e]=t),this._$Et=void 0);let e=!1;const i=this._$AL;try{e=this.shouldUpdate(i),e?(this.willUpdate(i),null===(t=this._$Em)||void 0===t||t.forEach(t=>{var e;return null===(e=t.hostUpdate)||void 0===e?void 0:e.call(t)}),this.update(i)):this._$ET()}catch(t){throw e=!1,this._$ET(),t}e&&this._$AE(i)}willUpdate(t){}_$AE(t){var e;null===(e=this._$Em)||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)}_$ET(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$Ev}shouldUpdate(t){return!0}update(t){void 0!==this._$ES&&(this._$ES.forEach((t,e)=>this._$Eg(e,this[e],t)),this._$ES=void 0),this._$ET()}updated(t){}firstUpdated(t){}} + */;var d,h;const u={toAttribute(e,t){switch(t){case Boolean:e=e?"":null;break;case Object:case Array:e=null==e?e:JSON.stringify(e)}return e},fromAttribute(e,t){let i=e;switch(t){case Boolean:i=null!==e;break;case Number:i=null===e?null:Number(e);break;case Object:case Array:try{i=JSON.parse(e)}catch(e){i=null}}return i}},m=(e,t)=>t!==e&&(t==t||e==e),p={attribute:!0,type:String,converter:u,reflect:!1,hasChanged:m};class g extends HTMLElement{constructor(){super(),this._$Et=new Map,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Ei=null,this.o()}static addInitializer(e){var t;null!==(t=this.l)&&void 0!==t||(this.l=[]),this.l.push(e)}static get observedAttributes(){this.finalize();const e=[];return this.elementProperties.forEach((t,i)=>{const a=this._$Eh(i,t);void 0!==a&&(this._$Eu.set(a,i),e.push(a))}),e}static createProperty(e,t=p){if(t.state&&(t.attribute=!1),this.finalize(),this.elementProperties.set(e,t),!t.noAccessor&&!this.prototype.hasOwnProperty(e)){const i="symbol"==typeof e?Symbol():"__"+e,a=this.getPropertyDescriptor(e,i,t);void 0!==a&&Object.defineProperty(this.prototype,e,a)}}static getPropertyDescriptor(e,t,i){return{get(){return this[t]},set(a){const s=this[e];this[t]=a,this.requestUpdate(e,s,i)},configurable:!0,enumerable:!0}}static getPropertyOptions(e){return this.elementProperties.get(e)||p}static finalize(){if(this.hasOwnProperty("finalized"))return!1;this.finalized=!0;const e=Object.getPrototypeOf(this);if(e.finalize(),this.elementProperties=new Map(e.elementProperties),this._$Eu=new Map,this.hasOwnProperty("properties")){const e=this.properties,t=[...Object.getOwnPropertyNames(e),...Object.getOwnPropertySymbols(e)];for(const i of t)this.createProperty(i,e[i])}return this.elementStyles=this.finalizeStyles(this.styles),!0}static finalizeStyles(e){const t=[];if(Array.isArray(e)){const i=new Set(e.flat(1/0).reverse());for(const e of i)t.unshift(c(e))}else void 0!==e&&t.push(c(e));return t}static _$Eh(e,t){const i=t.attribute;return!1===i?void 0:"string"==typeof i?i:"string"==typeof e?e.toLowerCase():void 0}o(){var e;this._$Ev=new Promise(e=>this.enableUpdating=e),this._$AL=new Map,this._$Ep(),this.requestUpdate(),null===(e=this.constructor.l)||void 0===e||e.forEach(e=>e(this))}addController(e){var t,i;(null!==(t=this._$Em)&&void 0!==t?t:this._$Em=[]).push(e),void 0!==this.renderRoot&&this.isConnected&&(null===(i=e.hostConnected)||void 0===i||i.call(e))}removeController(e){var t;null===(t=this._$Em)||void 0===t||t.splice(this._$Em.indexOf(e)>>>0,1)}_$Ep(){this.constructor.elementProperties.forEach((e,t)=>{this.hasOwnProperty(t)&&(this._$Et.set(t,this[t]),delete this[t])})}createRenderRoot(){var e;const t=null!==(e=this.shadowRoot)&&void 0!==e?e:this.attachShadow(this.constructor.shadowRootOptions);return l(t,this.constructor.elementStyles),t}connectedCallback(){var e;void 0===this.renderRoot&&(this.renderRoot=this.createRenderRoot()),this.enableUpdating(!0),null===(e=this._$Em)||void 0===e||e.forEach(e=>{var t;return null===(t=e.hostConnected)||void 0===t?void 0:t.call(e)})}enableUpdating(e){}disconnectedCallback(){var e;null===(e=this._$Em)||void 0===e||e.forEach(e=>{var t;return null===(t=e.hostDisconnected)||void 0===t?void 0:t.call(e)})}attributeChangedCallback(e,t,i){this._$AK(e,i)}_$Eg(e,t,i=p){var a,s;const r=this.constructor._$Eh(e,i);if(void 0!==r&&!0===i.reflect){const n=(null!==(s=null===(a=i.converter)||void 0===a?void 0:a.toAttribute)&&void 0!==s?s:u.toAttribute)(t,i.type);this._$Ei=e,null==n?this.removeAttribute(r):this.setAttribute(r,n),this._$Ei=null}}_$AK(e,t){var i,a,s;const r=this.constructor,n=r._$Eu.get(e);if(void 0!==n&&this._$Ei!==n){const e=r.getPropertyOptions(n),o=e.converter,l=null!==(s=null!==(a=null===(i=o)||void 0===i?void 0:i.fromAttribute)&&void 0!==a?a:"function"==typeof o?o:null)&&void 0!==s?s:u.fromAttribute;this._$Ei=n,this[n]=l(t,e.type),this._$Ei=null}}requestUpdate(e,t,i){let a=!0;void 0!==e&&(((i=i||this.constructor.getPropertyOptions(e)).hasChanged||m)(this[e],t)?(this._$AL.has(e)||this._$AL.set(e,t),!0===i.reflect&&this._$Ei!==e&&(void 0===this._$ES&&(this._$ES=new Map),this._$ES.set(e,i))):a=!1),!this.isUpdatePending&&a&&(this._$Ev=this._$EC())}async _$EC(){this.isUpdatePending=!0;try{await this._$Ev}catch(e){Promise.reject(e)}const e=this.scheduleUpdate();return null!=e&&await e,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){var e;if(!this.isUpdatePending)return;this.hasUpdated,this._$Et&&(this._$Et.forEach((e,t)=>this[t]=e),this._$Et=void 0);let t=!1;const i=this._$AL;try{t=this.shouldUpdate(i),t?(this.willUpdate(i),null===(e=this._$Em)||void 0===e||e.forEach(e=>{var t;return null===(t=e.hostUpdate)||void 0===t?void 0:t.call(e)}),this.update(i)):this._$ET()}catch(e){throw t=!1,this._$ET(),e}t&&this._$AE(i)}willUpdate(e){}_$AE(e){var t;null===(t=this._$Em)||void 0===t||t.forEach(e=>{var t;return null===(t=e.hostUpdated)||void 0===t?void 0:t.call(e)}),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(e)),this.updated(e)}_$ET(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$Ev}shouldUpdate(e){return!0}update(e){void 0!==this._$ES&&(this._$ES.forEach((e,t)=>this._$Eg(t,this[t],e)),this._$ES=void 0),this._$ET()}updated(e){}firstUpdated(e){}} /** * @license * Copyright 2017 Google LLC * SPDX-License-Identifier: BSD-3-Clause */ -var f,b;g.finalized=!0,g.elementProperties=new Map,g.elementStyles=[],g.shadowRootOptions={mode:"open"},null===(d=globalThis.reactiveElementPlatformSupport)||void 0===d||d.call(globalThis,{ReactiveElement:g}),(null!==(h=globalThis.reactiveElementVersions)&&void 0!==h?h:globalThis.reactiveElementVersions=[]).push("1.0.0-rc.4");const _=globalThis.trustedTypes,v=_?_.createPolicy("lit-html",{createHTML:t=>t}):void 0,y=`lit$${(Math.random()+"").slice(9)}$`,w="?"+y,$=`<${w}>`,x=document,A=(t="")=>x.createComment(t),k=t=>null===t||"object"!=typeof t&&"function"!=typeof t,C=Array.isArray,S=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,E=/-->/g,O=/>/g,T=/>|[ \n \r](?:([^\s"'>=/]+)([ \n \r]*=[ \n \r]*(?:[^ \n \r"'`<>=]|("|')|))|$)/g,M=/'/g,D=/"/g,z=/^(?:script|style|textarea)$/i,N=(t=>(e,...i)=>({_$litType$:t,strings:e,values:i}))(1),P=Symbol.for("lit-noChange"),j=Symbol.for("lit-nothing"),H=new WeakMap,U=x.createTreeWalker(x,129,null,!1),L=(t,e)=>{const i=t.length-1,s=[];let a,r=2===e?"":"",n=S;for(let e=0;e"===l[0]?(n=null!=a?a:S,c=-1):void 0===l[1]?c=-2:(c=n.lastIndex-l[2].length,o=l[1],n=void 0===l[3]?T:'"'===l[3]?D:M):n===D||n===M?n=T:n===E||n===O?n=S:(n=T,a=void 0);const h=n===T&&t[e+1].startsWith("/>")?" ":"";r+=n===S?i+$:c>=0?(s.push(o),i.slice(0,c)+"$lit$"+i.slice(c)+y+h):i+y+(-2===c?(s.push(void 0),e):h)}const o=r+(t[i]||"")+(2===e?"":"");return[void 0!==v?v.createHTML(o):o,s]};class R{constructor({strings:t,_$litType$:e},i){let s;this.parts=[];let a=0,r=0;const n=t.length-1,o=this.parts,[l,c]=L(t,e);if(this.el=R.createElement(l,i),U.currentNode=this.el.content,2===e){const t=this.el.content,e=t.firstChild;e.remove(),t.append(...e.childNodes)}for(;null!==(s=U.nextNode())&&o.length0){s.textContent=_?_.emptyScript:"";for(let i=0;i{var e;return C(t)||"function"==typeof(null===(e=t)||void 0===e?void 0:e[Symbol.iterator])})(t)?this.M(t):this.$(t)}A(t,e=this._$AB){return this._$AA.parentNode.insertBefore(t,e)}S(t){this._$AH!==t&&(this._$AR(),this._$AH=this.A(t))}$(t){this._$AH!==j&&k(this._$AH)?this._$AA.nextSibling.data=t:this.S(x.createTextNode(t)),this._$AH=t}T(t){var e;const{values:i,_$litType$:s}=t,a="number"==typeof s?this._$AC(t):(void 0===s.el&&(s.el=R.createElement(s.h,this.options)),s);if((null===(e=this._$AH)||void 0===e?void 0:e._$AD)===a)this._$AH.m(i);else{const t=new I(a,this),e=t.p(this.options);t.m(i),this.S(e),this._$AH=t}}_$AC(t){let e=H.get(t.strings);return void 0===e&&H.set(t.strings,e=new R(t)),e}M(t){C(this._$AH)||(this._$AH=[],this._$AR());const e=this._$AH;let i,s=0;for(const a of t)s===e.length?e.push(i=new B(this.A(A()),this.A(A()),this,this.options)):i=e[s],i._$AI(a),s++;s2||""!==i[0]||""!==i[1]?(this._$AH=Array(i.length-1).fill(new String),this.strings=i):this._$AH=j}get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}_$AI(t,e=this,i,s){const a=this.strings;let r=!1;if(void 0===a)t=Y(this,t,e,0),r=!k(t)||t!==this._$AH&&t!==P,r&&(this._$AH=t);else{const s=t;let n,o;for(t=a[0],n=0;ne}):void 0,y=`lit$${(Math.random()+"").slice(9)}$`,w="?"+y,$=`<${w}>`,x=document,k=(e="")=>x.createComment(e),A=e=>null===e||"object"!=typeof e&&"function"!=typeof e,C=Array.isArray,S=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,E=/-->/g,O=/>/g,T=/>|[ \n \r](?:([^\s"'>=/]+)([ \n \r]*=[ \n \r]*(?:[^ \n \r"'`<>=]|("|')|))|$)/g,M=/'/g,D=/"/g,z=/^(?:script|style|textarea)$/i,N=(e=>(t,...i)=>({_$litType$:e,strings:t,values:i}))(1),P=Symbol.for("lit-noChange"),j=Symbol.for("lit-nothing"),H=new WeakMap,U=x.createTreeWalker(x,129,null,!1),L=(e,t)=>{const i=e.length-1,a=[];let s,r=2===t?"":"",n=S;for(let t=0;t"===l[0]?(n=null!=s?s:S,c=-1):void 0===l[1]?c=-2:(c=n.lastIndex-l[2].length,o=l[1],n=void 0===l[3]?T:'"'===l[3]?D:M):n===D||n===M?n=T:n===E||n===O?n=S:(n=T,s=void 0);const h=n===T&&e[t+1].startsWith("/>")?" ":"";r+=n===S?i+$:c>=0?(a.push(o),i.slice(0,c)+"$lit$"+i.slice(c)+y+h):i+y+(-2===c?(a.push(void 0),t):h)}const o=r+(e[i]||"")+(2===t?"":"");return[void 0!==v?v.createHTML(o):o,a]};class R{constructor({strings:e,_$litType$:t},i){let a;this.parts=[];let s=0,r=0;const n=e.length-1,o=this.parts,[l,c]=L(e,t);if(this.el=R.createElement(l,i),U.currentNode=this.el.content,2===t){const e=this.el.content,t=e.firstChild;t.remove(),e.append(...t.childNodes)}for(;null!==(a=U.nextNode())&&o.length0){a.textContent=_?_.emptyScript:"";for(let i=0;i{var t;return C(e)||"function"==typeof(null===(t=e)||void 0===t?void 0:t[Symbol.iterator])})(e)?this.M(e):this.$(e)}A(e,t=this._$AB){return this._$AA.parentNode.insertBefore(e,t)}S(e){this._$AH!==e&&(this._$AR(),this._$AH=this.A(e))}$(e){this._$AH!==j&&A(this._$AH)?this._$AA.nextSibling.data=e:this.S(x.createTextNode(e)),this._$AH=e}T(e){var t;const{values:i,_$litType$:a}=e,s="number"==typeof a?this._$AC(e):(void 0===a.el&&(a.el=R.createElement(a.h,this.options)),a);if((null===(t=this._$AH)||void 0===t?void 0:t._$AD)===s)this._$AH.m(i);else{const e=new I(s,this),t=e.p(this.options);e.m(i),this.S(t),this._$AH=e}}_$AC(e){let t=H.get(e.strings);return void 0===t&&H.set(e.strings,t=new R(e)),t}M(e){C(this._$AH)||(this._$AH=[],this._$AR());const t=this._$AH;let i,a=0;for(const s of e)a===t.length?t.push(i=new B(this.A(k()),this.A(k()),this,this.options)):i=t[a],i._$AI(s),a++;a2||""!==i[0]||""!==i[1]?(this._$AH=Array(i.length-1).fill(new String),this.strings=i):this._$AH=j}get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}_$AI(e,t=this,i,a){const s=this.strings;let r=!1;if(void 0===s)e=Y(this,e,t,0),r=!A(e)||e!==this._$AH&&e!==P,r&&(this._$AH=e);else{const a=e;let n,o;for(e=s[0],n=0;n{var s,a;const r=null!==(s=null==i?void 0:i.renderBefore)&&void 0!==s?s:e;let n=r._$litPart$;if(void 0===n){const t=null!==(a=null==i?void 0:i.renderBefore)&&void 0!==a?a:null;r._$litPart$=n=new B(e.insertBefore(A(),t),t,void 0,null!=i?i:{})}return n._$AI(t),n})(e,this.renderRoot,this.renderOptions)}connectedCallback(){var t;super.connectedCallback(),null===(t=this._$Dt)||void 0===t||t.setConnected(!0)}disconnectedCallback(){var t;super.disconnectedCallback(),null===(t=this._$Dt)||void 0===t||t.setConnected(!1)}render(){return P}}Q.finalized=!0,Q._$litElement$=!0,null===(K=globalThis.litElementHydrateSupport)||void 0===K||K.call(globalThis,{LitElement:Q}),null===(J=globalThis.litElementPlatformSupport)||void 0===J||J.call(globalThis,{LitElement:Q}),(null!==(G=globalThis.litElementVersions)&&void 0!==G?G:globalThis.litElementVersions=[]).push("3.0.0-rc.4"); +var K,J,G;null===(b=globalThis.litHtmlPlatformSupport)||void 0===b||b.call(globalThis,R,B),(null!==(f=globalThis.litHtmlVersions)&&void 0!==f?f:globalThis.litHtmlVersions=[]).push("2.0.0-rc.5");class Q extends g{constructor(){super(...arguments),this.renderOptions={host:this},this._$Dt=void 0}createRenderRoot(){var e,t;const i=super.createRenderRoot();return null!==(e=(t=this.renderOptions).renderBefore)&&void 0!==e||(t.renderBefore=i.firstChild),i}update(e){const t=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(e),this._$Dt=((e,t,i)=>{var a,s;const r=null!==(a=null==i?void 0:i.renderBefore)&&void 0!==a?a:t;let n=r._$litPart$;if(void 0===n){const e=null!==(s=null==i?void 0:i.renderBefore)&&void 0!==s?s:null;r._$litPart$=n=new B(t.insertBefore(k(),e),e,void 0,null!=i?i:{})}return n._$AI(e),n})(t,this.renderRoot,this.renderOptions)}connectedCallback(){var e;super.connectedCallback(),null===(e=this._$Dt)||void 0===e||e.setConnected(!0)}disconnectedCallback(){var e;super.disconnectedCallback(),null===(e=this._$Dt)||void 0===e||e.setConnected(!1)}render(){return P}}Q.finalized=!0,Q._$litElement$=!0,null===(K=globalThis.litElementHydrateSupport)||void 0===K||K.call(globalThis,{LitElement:Q}),null===(J=globalThis.litElementPlatformSupport)||void 0===J||J.call(globalThis,{LitElement:Q}),(null!==(G=globalThis.litElementVersions)&&void 0!==G?G:globalThis.litElementVersions=[]).push("3.0.0-rc.4"); /** * @license * Copyright 2017 Google LLC * SPDX-License-Identifier: BSD-3-Clause */ -const X=t=>e=>"function"==typeof e?((t,e)=>(window.customElements.define(t,e),e))(t,e):((t,e)=>{const{kind:i,elements:s}=e;return{kind:i,elements:s,finisher(e){window.customElements.define(t,e)}}})(t,e) +const X=e=>t=>"function"==typeof t?((e,t)=>(window.customElements.define(e,t),t))(e,t):((e,t)=>{const{kind:i,elements:a}=t;return{kind:i,elements:a,finisher(t){window.customElements.define(e,t)}}})(e,t) /** * @license * Copyright 2017 Google LLC * SPDX-License-Identifier: BSD-3-Clause - */,tt=(t,e)=>"method"===e.kind&&e.descriptor&&!("value"in e.descriptor)?{...e,finisher(i){i.createProperty(e.key,t)}}:{kind:"field",key:Symbol(),placement:"own",descriptor:{},originalKey:e.key,initializer(){"function"==typeof e.initializer&&(this[e.key]=e.initializer.call(this))},finisher(i){i.createProperty(e.key,t)}};function et(t){return(e,i)=>void 0!==i?((t,e,i)=>{e.constructor.createProperty(i,t)})(t,e,i):tt(t,e)} + */,ee=(e,t)=>"method"===t.kind&&t.descriptor&&!("value"in t.descriptor)?{...t,finisher(i){i.createProperty(t.key,e)}}:{kind:"field",key:Symbol(),placement:"own",descriptor:{},originalKey:t.key,initializer(){"function"==typeof t.initializer&&(this[t.key]=t.initializer.call(this))},finisher(i){i.createProperty(t.key,e)}};function te(e){return(t,i)=>void 0!==i?((e,t,i)=>{t.constructor.createProperty(i,e)})(e,t,i):ee(e,t)} /** * @license * Copyright 2017 Google LLC * SPDX-License-Identifier: BSD-3-Clause - */function it(t){return et({...t,state:!0})}var st=/d{1,4}|M{1,4}|YY(?:YY)?|S{1,3}|Do|ZZ|Z|([HhMsDm])\1?|[aA]|"[^"]*"|'[^']*'/g,at="[^\\s]+",rt=/\[([^]*?)\]/gm;function nt(t,e){for(var i=[],s=0,a=t.length;s-1?s:null}};function lt(t){for(var e=[],i=1;i3?0:(t-t%10!=10?1:0)*t%10]}},mt=lt({},ut),pt=function(t,e){for(void 0===e&&(e=2),t=String(t);t.length0?"-":"+")+pt(100*Math.floor(Math.abs(e)/60)+Math.abs(e)%60,4)},Z:function(t){var e=t.getTimezoneOffset();return(e>0?"-":"+")+pt(Math.floor(Math.abs(e)/60),2)+":"+pt(Math.abs(e)%60,2)}},ft=function(t){return+t-1},bt=[null,"[1-9]\\d?"],_t=[null,at],vt=["isPm",at,function(t,e){var i=t.toLowerCase();return i===e.amPm[0]?0:i===e.amPm[1]?1:null}],yt=["timezoneOffset","[^\\s]*?[\\+\\-]\\d\\d:?\\d\\d|[^\\s]*?Z?",function(t){var e=(t+"").match(/([+-]|\d\d)/gi);if(e){var i=60*+e[1]+parseInt(e[2],10);return"+"===e[0]?i:-i}return 0}],wt=(ot("monthNamesShort"),ot("monthNames"),{default:"ddd MMM DD YYYY HH:mm:ss",shortDate:"M/D/YY",mediumDate:"MMM D, YYYY",longDate:"MMMM D, YYYY",fullDate:"dddd, MMMM D, YYYY",isoDate:"YYYY-MM-DD",isoDateTime:"YYYY-MM-DDTHH:mm:ssZ",shortTime:"HH:mm",mediumTime:"HH:mm:ss",longTime:"HH:mm:ss.SSS"});var $t,xt,At=function(t,e,i){if(void 0===e&&(e=wt.default),void 0===i&&(i={}),"number"==typeof t&&(t=new Date(t)),"[object Date]"!==Object.prototype.toString.call(t)||isNaN(t.getTime()))throw new Error("Invalid Date pass to format");var s=[];e=(e=wt[e]||e).replace(rt,(function(t,e){return s.push(e),"@@@"}));var a=lt(lt({},mt),i);return(e=e.replace(st,(function(e){return gt[e](t,a)}))).replace(/@@@/g,(function(){return s.shift()}))},kt=function(){try{(new Date).toLocaleDateString("i")}catch(t){return"RangeError"===t.name}return!1}()?function(t,e){return t.toLocaleDateString(e.language,{year:"numeric",month:"long",day:"numeric"})}:function(t){return At(t,"mediumDate")},Ct=function(){try{(new Date).toLocaleString("i")}catch(t){return"RangeError"===t.name}return!1}()?function(t,e){return t.toLocaleString(e.language,{year:"numeric",month:"long",day:"numeric",hour:"numeric",minute:"2-digit"})}:function(t){return At(t,"haDateTime")},St=function(){try{(new Date).toLocaleTimeString("i")}catch(t){return"RangeError"===t.name}return!1}()?function(t,e){return t.toLocaleTimeString(e.language,{hour:"numeric",minute:"2-digit"})}:function(t){return At(t,"shortTime")};function Et(t){return t.substr(0,t.indexOf("."))}!function(t){t.language="language",t.system="system",t.comma_decimal="comma_decimal",t.decimal_comma="decimal_comma",t.space_comma="space_comma",t.none="none"}($t||($t={})),function(t){t.language="language",t.system="system",t.am_pm="12",t.twenty_four="24"}(xt||(xt={}));var Ot=function(t,e,i){var s;switch(null==e?void 0:e.number_format){case $t.comma_decimal:s=["en-US","en"];break;case $t.decimal_comma:s=["de","es","it"];break;case $t.space_comma:s=["fr","sv","cs"];break;case $t.system:s=void 0;break;default:s=null==e?void 0:e.language}if(Number.isNaN=Number.isNaN||function t(e){return"number"==typeof e&&t(e)},!Number.isNaN(Number(t))&&Intl&&(null==e?void 0:e.number_format)!==$t.none)try{return new Intl.NumberFormat(s,Tt(t,i)).format(Number(t))}catch(e){return console.error(e),new Intl.NumberFormat(void 0,Tt(t,i)).format(Number(t))}return t?t.toString():""},Tt=function(t,e){var i=e||{};if("string"!=typeof t)return i;if(!e||!e.minimumFractionDigits&&!e.maximumFractionDigits){var s=t.indexOf(".")>-1?t.split(".")[1].length:0;i.minimumFractionDigits=s,i.maximumFractionDigits=s}return i};function Mt(t,e,i,s){var a=void 0!==s?s:e.state;if("unknown"===a||"unavailable"===a)return t("state.default."+a);if(e.attributes.unit_of_measurement)return Ot(a,i)+" "+e.attributes.unit_of_measurement;var r=function(t){return Et(t.entity_id)}(e);if("input_datetime"===r){var n;if(!e.attributes.has_time)return n=new Date(e.attributes.year,e.attributes.month-1,e.attributes.day),kt(n,i);if(!e.attributes.has_date){var o=new Date;return n=new Date(o.getFullYear(),o.getMonth(),o.getDay(),e.attributes.hour,e.attributes.minute),St(n,i)}return n=new Date(e.attributes.year,e.attributes.month-1,e.attributes.day,e.attributes.hour,e.attributes.minute),Ct(n,i)}return"humidifier"===r&&"on"===a&&e.attributes.humidity?e.attributes.humidity+" %":"counter"===r||"number"===r?Ot(a,i):e.attributes.device_class&&t("component."+r+".state."+e.attributes.device_class+"."+e.state)||t("component."+r+".state._."+e.state)||e.state}var Dt=function(t,e,i,s){s=s||{},i=null==i?{}:i;var a=new Event(e,{bubbles:void 0===s.bubbles||s.bubbles,cancelable:Boolean(s.cancelable),composed:void 0===s.composed||s.composed});return a.detail=i,t.dispatchEvent(a),a},zt={alert:"hass:alert",automation:"hass:playlist-play",calendar:"hass:calendar",camera:"hass:video",climate:"hass:thermostat",configurator:"hass:settings",conversation:"hass:text-to-speech",device_tracker:"hass:account",fan:"hass:fan",group:"hass:google-circles-communities",history_graph:"hass:chart-line",homeassistant:"hass:home-assistant",homekit:"hass:home-automation",image_processing:"hass:image-filter-frames",input_boolean:"hass:drawing",input_datetime:"hass:calendar-clock",input_number:"hass:ray-vertex",input_select:"hass:format-list-bulleted",input_text:"hass:textbox",light:"hass:lightbulb",mailbox:"hass:mailbox",notify:"hass:comment-alert",person:"hass:account",plant:"hass:flower",proximity:"hass:apple-safari",remote:"hass:remote",scene:"hass:google-pages",script:"hass:file-document",sensor:"hass:eye",simple_alarm:"hass:bell",sun:"hass:white-balance-sunny",switch:"hass:flash",timer:"hass:timer",updater:"hass:cloud-upload",vacuum:"hass:robot-vacuum",water_heater:"hass:thermometer",weblink:"hass:open-in-new"};function Nt(t,e){if(t in zt)return zt[t];switch(t){case"alarm_control_panel":switch(e){case"armed_home":return"hass:bell-plus";case"armed_night":return"hass:bell-sleep";case"disarmed":return"hass:bell-outline";case"triggered":return"hass:bell-ring";default:return"hass:bell"}case"binary_sensor":return e&&"off"===e?"hass:radiobox-blank":"hass:checkbox-marked-circle";case"cover":return"closed"===e?"hass:window-closed":"hass:window-open";case"lock":return e&&"unlocked"===e?"hass:lock-open":"hass:lock";case"media_player":return e&&"off"!==e&&"idle"!==e?"hass:cast-connected":"hass:cast";case"zwave":switch(e){case"dead":return"hass:emoticon-dead";case"sleeping":return"hass:sleep";case"initializing":return"hass:timer-sand";default:return"hass:z-wave"}default:return console.warn("Unable to find icon for domain "+t+" ("+e+")"),"hass:bookmark"}}var Pt={humidity:"hass:water-percent",illuminance:"hass:brightness-5",temperature:"hass:thermometer",pressure:"hass:gauge",power:"hass:flash",signal_strength:"hass:wifi"},jt={binary_sensor:function(t){var e=t.state&&"off"===t.state;switch(t.attributes.device_class){case"battery":return e?"hass:battery":"hass:battery-outline";case"cold":return e?"hass:thermometer":"hass:snowflake";case"connectivity":return e?"hass:server-network-off":"hass:server-network";case"door":return e?"hass:door-closed":"hass:door-open";case"garage_door":return e?"hass:garage":"hass:garage-open";case"gas":case"power":case"problem":case"safety":case"smoke":return e?"hass:shield-check":"hass:alert";case"heat":return e?"hass:thermometer":"hass:fire";case"light":return e?"hass:brightness-5":"hass:brightness-7";case"lock":return e?"hass:lock":"hass:lock-open";case"moisture":return e?"hass:water-off":"hass:water";case"motion":return e?"hass:walk":"hass:run";case"occupancy":return e?"hass:home-outline":"hass:home";case"opening":return e?"hass:square":"hass:square-outline";case"plug":return e?"hass:power-plug-off":"hass:power-plug";case"presence":return e?"hass:home-outline":"hass:home";case"sound":return e?"hass:music-note-off":"hass:music-note";case"vibration":return e?"hass:crop-portrait":"hass:vibrate";case"window":return e?"hass:window-closed":"hass:window-open";default:return e?"hass:radiobox-blank":"hass:checkbox-marked-circle"}},cover:function(t){var e="closed"!==t.state;switch(t.attributes.device_class){case"garage":return e?"hass:garage-open":"hass:garage";case"door":return e?"hass:door-open":"hass:door-closed";case"shutter":return e?"hass:window-shutter-open":"hass:window-shutter";case"blind":return e?"hass:blinds-open":"hass:blinds";case"window":return e?"hass:window-open":"hass:window-closed";default:return Nt("cover",t.state)}},sensor:function(t){var e=t.attributes.device_class;if(e&&e in Pt)return Pt[e];if("battery"===e){var i=Number(t.state);if(isNaN(i))return"hass:battery-unknown";var s=10*Math.round(i/10);return s>=100?"hass:battery":s<=0?"hass:battery-alert":"hass:battery-"+s}var a=t.attributes.unit_of_measurement;return"°C"===a||"°F"===a?"hass:thermometer":Nt("sensor")},input_datetime:function(t){return t.attributes.has_date?t.attributes.has_time?Nt("input_datetime"):"hass:calendar":"hass:clock"}};const Ht=["1","2","3","4","5","6","7","8","9","","0","clear"];var Ut;!function(t){t.Disarmed="disarmed",t.Arming="arming",t.Pending="pending",t.Triggered="triggered",t.ArmedAway="armed_away",t.ArmedHome="armed_home",t.ArmedNight="armed_night",t.ArmedVacation="armed_vacation",t.ArmedCustomBypass="armed_custom_bypass"}(Ut||(Ut={}));const Lt={[Ut.ArmedAway]:"hass:shield-lock",[Ut.ArmedHome]:"hass:shield-home",[Ut.ArmedNight]:"hass:shield-moon",[Ut.ArmedVacation]:"hass:shield-airplane",[Ut.ArmedCustomBypass]:"hass:security",[Ut.Disarmed]:"hass:shield-off",[Ut.Arming]:"hass:shield-outline",[Ut.Pending]:"hass:shield-outline",[Ut.Triggered]:"hass:bell-ring"};var Rt;!function(t){t.ArmAway="arm_away",t.ArmHome="arm_home",t.ArmNight="arm_night",t.ArmVacation="arm_vacation",t.ArmCustomBypass="arm_custom_bypass",t.Disarm="disarm"}(Rt||(Rt={}));const Yt={[Rt.ArmAway]:Ut.ArmedAway,[Rt.ArmHome]:Ut.ArmedHome,[Rt.ArmNight]:Ut.ArmedNight,[Rt.ArmVacation]:Ut.ArmedVacation,[Rt.ArmCustomBypass]:Ut.ArmedCustomBypass,[Rt.Disarm]:Ut.Disarmed};var It;!function(t){t.Arm="arm",t.Trigger="trigger",t.FailedToArm="failed_to_arm",t.CommandNotAllowed="command_not_allowed",t.NoCodeProvided="no_code_provided",t.InvalidCodeProvided="invalid_code_provided",t.TriggerTimeExpired="trigger_time_expired"}(It||(It={}));const Bt=["arming","pending"],Ft={type:"",entity:"",name:"",keep_keypad_visible:!1,use_clear_icon:!1,button_scale_actions:1,button_scale_keypad:1,states:{},show_messages:!0},qt={skip_delay:!1,force:!1};var Vt={heading:"Options for arming",skip_delay:"Skip exit delay",force:"Bypass open sensors"},Zt={keep_keypad_visible:"Keep the keypad always visible, also when no code input is required.",button_scale_actions:"Scaling factor to apply for resizing the action buttons.",button_scale_keypad:"Scaling factor to apply for resizing the keypad buttons.",use_clear_icon:"Show icon (instead of text) in keypad for clearing code input.",show_messages:"Display diagnostic messages when alarm is triggered or cannot be armed.",available_actions:"Available actions:",action_dialog:{title:"Customize display of action '{action}'",button_label:"Override button label",state_label:"Override state label"}},Wt={blocking_sensors:"Could not arm due to the following sensors",triggered_sensors:"Alarm was triggered by the following sensors"},Kt={arm_options:Vt,editor:Zt,errors:Wt},Jt={heading:"Options pour l'armement",skip_delay:"Ignorer le délai de sortie",force:"Bypasser les capteurs ouverts"},Gt={keep_keypad_visible:"Gardez le clavier toujours visible, même lorsqu'aucune saisie de code n'est requise.",button_scale_actions:"Facteur d'échelle à appliquer pour le redimensionnement des boutons des actions.",button_scale_keypad:"Facteur d'échelle à appliquer pour le redimensionnement des boutons du clavier.",use_clear_icon:"Afficher l'icône (au lieu du texte) sur le clavier pour effacer la saisie du code.",show_messages:"Afficher les messages de diagnostic lorsque l'alarme est déclenchée ou ne peut pas être armée.",available_actions:"Actions disponibles:",action_dialog:{title:"Personnaliser l'affichage de l'action '{action}'",button_label:"Remplacer le libellé du bouton",state_label:"Remplacer l'étiquette d'état"}},Qt={blocking_sensors:"Impossible d'armer en raison du(es) capteur(s) suivant(s)",triggered_sensors:"L'alarme a été déclenchée par le(s) capteur(s) suivant(s)"},Xt={arm_options:Jt,editor:Gt,errors:Qt},te={en:Object.freeze({__proto__:null,arm_options:Vt,editor:Zt,errors:Wt,default:Kt}),fr:Object.freeze({__proto__:null,arm_options:Jt,editor:Gt,errors:Qt,default:Xt})};function ee(t,e,i="",s=""){const a=e.replace(/['"]+/g,"").replace("-","_");var r;try{r=t.split(".").reduce((t,e)=>t[e],te[a])}catch(e){r=t.split(".").reduce((t,e)=>t[e],te.en)}if(void 0===r&&(r=t.split(".").reduce((t,e)=>t[e],te.en)),""!==i&&""!==s){Array.isArray(i)||(i=[i]),Array.isArray(s)||(s=[s]);for(let t=0;t{let i={hide:!1,button_label:"",state_label:""};return(e.states||{}).hasOwnProperty(t)&&(i=Object.assign(Object.assign({},i),e.states[t])),i},re=t=>{if(!t)return[];const e=t.attributes.supported_features||0;let i=[];return 2&e&&i.push(Rt.ArmAway),1&e&&i.push(Rt.ArmHome),4&e&&i.push(Rt.ArmNight),32&e&&i.push(Rt.ArmVacation),16&e&&i.push(Rt.ArmCustomBypass),i},ne=t=>null!==t.attributes.code_format;let oe=class extends Q{async showDialog(t){this._params=t}closeDialog(){return this._params=void 0,!0}_createCloseHeading(){return N` + */function ie(e){return te({...e,state:!0})}var ae=/d{1,4}|M{1,4}|YY(?:YY)?|S{1,3}|Do|ZZ|Z|([HhMsDm])\1?|[aA]|"[^"]*"|'[^']*'/g,se="[^\\s]+",re=/\[([^]*?)\]/gm;function ne(e,t){for(var i=[],a=0,s=e.length;a-1?a:null}};function le(e){for(var t=[],i=1;i3?0:(e-e%10!=10?1:0)*e%10]}},me=le({},ue),pe=function(e,t){for(void 0===t&&(t=2),e=String(e);e.length0?"-":"+")+pe(100*Math.floor(Math.abs(t)/60)+Math.abs(t)%60,4)},Z:function(e){var t=e.getTimezoneOffset();return(t>0?"-":"+")+pe(Math.floor(Math.abs(t)/60),2)+":"+pe(Math.abs(t)%60,2)}},be=function(e){return+e-1},fe=[null,"[1-9]\\d?"],_e=[null,se],ve=["isPm",se,function(e,t){var i=e.toLowerCase();return i===t.amPm[0]?0:i===t.amPm[1]?1:null}],ye=["timezoneOffset","[^\\s]*?[\\+\\-]\\d\\d:?\\d\\d|[^\\s]*?Z?",function(e){var t=(e+"").match(/([+-]|\d\d)/gi);if(t){var i=60*+t[1]+parseInt(t[2],10);return"+"===t[0]?i:-i}return 0}],we=(oe("monthNamesShort"),oe("monthNames"),{default:"ddd MMM DD YYYY HH:mm:ss",shortDate:"M/D/YY",mediumDate:"MMM D, YYYY",longDate:"MMMM D, YYYY",fullDate:"dddd, MMMM D, YYYY",isoDate:"YYYY-MM-DD",isoDateTime:"YYYY-MM-DDTHH:mm:ssZ",shortTime:"HH:mm",mediumTime:"HH:mm:ss",longTime:"HH:mm:ss.SSS"});var $e,xe,ke=function(e,t,i){if(void 0===t&&(t=we.default),void 0===i&&(i={}),"number"==typeof e&&(e=new Date(e)),"[object Date]"!==Object.prototype.toString.call(e)||isNaN(e.getTime()))throw new Error("Invalid Date pass to format");var a=[];t=(t=we[t]||t).replace(re,(function(e,t){return a.push(t),"@@@"}));var s=le(le({},me),i);return(t=t.replace(ae,(function(t){return ge[t](e,s)}))).replace(/@@@/g,(function(){return a.shift()}))},Ae=function(){try{(new Date).toLocaleDateString("i")}catch(e){return"RangeError"===e.name}return!1}()?function(e,t){return e.toLocaleDateString(t.language,{year:"numeric",month:"long",day:"numeric"})}:function(e){return ke(e,"mediumDate")},Ce=function(){try{(new Date).toLocaleString("i")}catch(e){return"RangeError"===e.name}return!1}()?function(e,t){return e.toLocaleString(t.language,{year:"numeric",month:"long",day:"numeric",hour:"numeric",minute:"2-digit"})}:function(e){return ke(e,"haDateTime")},Se=function(){try{(new Date).toLocaleTimeString("i")}catch(e){return"RangeError"===e.name}return!1}()?function(e,t){return e.toLocaleTimeString(t.language,{hour:"numeric",minute:"2-digit"})}:function(e){return ke(e,"shortTime")};function Ee(e){return e.substr(0,e.indexOf("."))}!function(e){e.language="language",e.system="system",e.comma_decimal="comma_decimal",e.decimal_comma="decimal_comma",e.space_comma="space_comma",e.none="none"}($e||($e={})),function(e){e.language="language",e.system="system",e.am_pm="12",e.twenty_four="24"}(xe||(xe={}));var Oe=function(e,t,i){var a;switch(null==t?void 0:t.number_format){case $e.comma_decimal:a=["en-US","en"];break;case $e.decimal_comma:a=["de","es","it"];break;case $e.space_comma:a=["fr","sv","cs"];break;case $e.system:a=void 0;break;default:a=null==t?void 0:t.language}if(Number.isNaN=Number.isNaN||function e(t){return"number"==typeof t&&e(t)},!Number.isNaN(Number(e))&&Intl&&(null==t?void 0:t.number_format)!==$e.none)try{return new Intl.NumberFormat(a,Te(e,i)).format(Number(e))}catch(t){return console.error(t),new Intl.NumberFormat(void 0,Te(e,i)).format(Number(e))}return e?e.toString():""},Te=function(e,t){var i=t||{};if("string"!=typeof e)return i;if(!t||!t.minimumFractionDigits&&!t.maximumFractionDigits){var a=e.indexOf(".")>-1?e.split(".")[1].length:0;i.minimumFractionDigits=a,i.maximumFractionDigits=a}return i};function Me(e,t,i,a){var s=void 0!==a?a:t.state;if("unknown"===s||"unavailable"===s)return e("state.default."+s);if(t.attributes.unit_of_measurement)return Oe(s,i)+" "+t.attributes.unit_of_measurement;var r=function(e){return Ee(e.entity_id)}(t);if("input_datetime"===r){var n;if(!t.attributes.has_time)return n=new Date(t.attributes.year,t.attributes.month-1,t.attributes.day),Ae(n,i);if(!t.attributes.has_date){var o=new Date;return n=new Date(o.getFullYear(),o.getMonth(),o.getDay(),t.attributes.hour,t.attributes.minute),Se(n,i)}return n=new Date(t.attributes.year,t.attributes.month-1,t.attributes.day,t.attributes.hour,t.attributes.minute),Ce(n,i)}return"humidifier"===r&&"on"===s&&t.attributes.humidity?t.attributes.humidity+" %":"counter"===r||"number"===r?Oe(s,i):t.attributes.device_class&&e("component."+r+".state."+t.attributes.device_class+"."+t.state)||e("component."+r+".state._."+t.state)||t.state}var De=function(e,t,i,a){a=a||{},i=null==i?{}:i;var s=new Event(t,{bubbles:void 0===a.bubbles||a.bubbles,cancelable:Boolean(a.cancelable),composed:void 0===a.composed||a.composed});return s.detail=i,e.dispatchEvent(s),s},ze={alert:"hass:alert",automation:"hass:playlist-play",calendar:"hass:calendar",camera:"hass:video",climate:"hass:thermostat",configurator:"hass:settings",conversation:"hass:text-to-speech",device_tracker:"hass:account",fan:"hass:fan",group:"hass:google-circles-communities",history_graph:"hass:chart-line",homeassistant:"hass:home-assistant",homekit:"hass:home-automation",image_processing:"hass:image-filter-frames",input_boolean:"hass:drawing",input_datetime:"hass:calendar-clock",input_number:"hass:ray-vertex",input_select:"hass:format-list-bulleted",input_text:"hass:textbox",light:"hass:lightbulb",mailbox:"hass:mailbox",notify:"hass:comment-alert",person:"hass:account",plant:"hass:flower",proximity:"hass:apple-safari",remote:"hass:remote",scene:"hass:google-pages",script:"hass:file-document",sensor:"hass:eye",simple_alarm:"hass:bell",sun:"hass:white-balance-sunny",switch:"hass:flash",timer:"hass:timer",updater:"hass:cloud-upload",vacuum:"hass:robot-vacuum",water_heater:"hass:thermometer",weblink:"hass:open-in-new"};function Ne(e,t){if(e in ze)return ze[e];switch(e){case"alarm_control_panel":switch(t){case"armed_home":return"hass:bell-plus";case"armed_night":return"hass:bell-sleep";case"disarmed":return"hass:bell-outline";case"triggered":return"hass:bell-ring";default:return"hass:bell"}case"binary_sensor":return t&&"off"===t?"hass:radiobox-blank":"hass:checkbox-marked-circle";case"cover":return"closed"===t?"hass:window-closed":"hass:window-open";case"lock":return t&&"unlocked"===t?"hass:lock-open":"hass:lock";case"media_player":return t&&"off"!==t&&"idle"!==t?"hass:cast-connected":"hass:cast";case"zwave":switch(t){case"dead":return"hass:emoticon-dead";case"sleeping":return"hass:sleep";case"initializing":return"hass:timer-sand";default:return"hass:z-wave"}default:return console.warn("Unable to find icon for domain "+e+" ("+t+")"),"hass:bookmark"}}var Pe={humidity:"hass:water-percent",illuminance:"hass:brightness-5",temperature:"hass:thermometer",pressure:"hass:gauge",power:"hass:flash",signal_strength:"hass:wifi"},je={binary_sensor:function(e){var t=e.state&&"off"===e.state;switch(e.attributes.device_class){case"battery":return t?"hass:battery":"hass:battery-outline";case"cold":return t?"hass:thermometer":"hass:snowflake";case"connectivity":return t?"hass:server-network-off":"hass:server-network";case"door":return t?"hass:door-closed":"hass:door-open";case"garage_door":return t?"hass:garage":"hass:garage-open";case"gas":case"power":case"problem":case"safety":case"smoke":return t?"hass:shield-check":"hass:alert";case"heat":return t?"hass:thermometer":"hass:fire";case"light":return t?"hass:brightness-5":"hass:brightness-7";case"lock":return t?"hass:lock":"hass:lock-open";case"moisture":return t?"hass:water-off":"hass:water";case"motion":return t?"hass:walk":"hass:run";case"occupancy":return t?"hass:home-outline":"hass:home";case"opening":return t?"hass:square":"hass:square-outline";case"plug":return t?"hass:power-plug-off":"hass:power-plug";case"presence":return t?"hass:home-outline":"hass:home";case"sound":return t?"hass:music-note-off":"hass:music-note";case"vibration":return t?"hass:crop-portrait":"hass:vibrate";case"window":return t?"hass:window-closed":"hass:window-open";default:return t?"hass:radiobox-blank":"hass:checkbox-marked-circle"}},cover:function(e){var t="closed"!==e.state;switch(e.attributes.device_class){case"garage":return t?"hass:garage-open":"hass:garage";case"door":return t?"hass:door-open":"hass:door-closed";case"shutter":return t?"hass:window-shutter-open":"hass:window-shutter";case"blind":return t?"hass:blinds-open":"hass:blinds";case"window":return t?"hass:window-open":"hass:window-closed";default:return Ne("cover",e.state)}},sensor:function(e){var t=e.attributes.device_class;if(t&&t in Pe)return Pe[t];if("battery"===t){var i=Number(e.state);if(isNaN(i))return"hass:battery-unknown";var a=10*Math.round(i/10);return a>=100?"hass:battery":a<=0?"hass:battery-alert":"hass:battery-"+a}var s=e.attributes.unit_of_measurement;return"°C"===s||"°F"===s?"hass:thermometer":Ne("sensor")},input_datetime:function(e){return e.attributes.has_date?e.attributes.has_time?Ne("input_datetime"):"hass:calendar":"hass:clock"}};const He=["1","2","3","4","5","6","7","8","9","","0","clear"];var Ue;!function(e){e.Disarmed="disarmed",e.Arming="arming",e.Pending="pending",e.Triggered="triggered",e.ArmedAway="armed_away",e.ArmedHome="armed_home",e.ArmedNight="armed_night",e.ArmedVacation="armed_vacation",e.ArmedCustomBypass="armed_custom_bypass"}(Ue||(Ue={}));const Le={[Ue.ArmedAway]:"hass:shield-lock",[Ue.ArmedHome]:"hass:shield-home",[Ue.ArmedNight]:"hass:shield-moon",[Ue.ArmedVacation]:"hass:shield-airplane",[Ue.ArmedCustomBypass]:"hass:security",[Ue.Disarmed]:"hass:shield-off",[Ue.Arming]:"hass:shield-outline",[Ue.Pending]:"hass:shield-outline",[Ue.Triggered]:"hass:bell-ring"};var Re;!function(e){e.ArmAway="arm_away",e.ArmHome="arm_home",e.ArmNight="arm_night",e.ArmVacation="arm_vacation",e.ArmCustomBypass="arm_custom_bypass",e.Disarm="disarm"}(Re||(Re={}));const Ye={[Re.ArmAway]:Ue.ArmedAway,[Re.ArmHome]:Ue.ArmedHome,[Re.ArmNight]:Ue.ArmedNight,[Re.ArmVacation]:Ue.ArmedVacation,[Re.ArmCustomBypass]:Ue.ArmedCustomBypass,[Re.Disarm]:Ue.Disarmed};var Ie;!function(e){e.Arm="arm",e.Trigger="trigger",e.FailedToArm="failed_to_arm",e.CommandNotAllowed="command_not_allowed",e.NoCodeProvided="no_code_provided",e.InvalidCodeProvided="invalid_code_provided",e.TriggerTimeExpired="trigger_time_expired"}(Ie||(Ie={}));const Be=["arming","pending"],Fe={type:"",entity:"",name:"",keep_keypad_visible:!1,use_clear_icon:!1,button_scale_actions:1,button_scale_keypad:1,states:{},show_messages:!0},qe={skip_delay:!1,force:!1};var Ve={heading:"Options for arming",skip_delay:"Skip exit delay",force:"Bypass open sensors"},Ze={keep_keypad_visible:"Keep the keypad always visible, also when no code input is required.",button_scale_actions:"Scaling factor to apply for resizing the action buttons.",button_scale_keypad:"Scaling factor to apply for resizing the keypad buttons.",use_clear_icon:"Show icon (instead of text) in keypad for clearing code input.",show_messages:"Display diagnostic messages when alarm is triggered or cannot be armed.",available_actions:"Available actions:",action_dialog:{title:"Customize display of action '{action}'",button_label:"Override button label",state_label:"Override state label"}},We={blocking_sensors:"Could not arm due to the following sensors",triggered_sensors:"Alarm was triggered by the following sensors"},Ke={arm_options:Ve,editor:Ze,errors:We},Je=Object.freeze({__proto__:null,arm_options:Ve,editor:Ze,errors:We,default:Ke}),Ge={heading:"Options pour l'armement",skip_delay:"Ignorer le délai de sortie",force:"Bypasser les capteurs ouverts"},Qe={keep_keypad_visible:"Gardez le clavier toujours visible, même lorsqu'aucune saisie de code n'est requise.",button_scale_actions:"Facteur d'échelle à appliquer pour le redimensionnement des boutons des actions.",button_scale_keypad:"Facteur d'échelle à appliquer pour le redimensionnement des boutons du clavier.",use_clear_icon:"Afficher l'icône (au lieu du texte) sur le clavier pour effacer la saisie du code.",show_messages:"Afficher les messages de diagnostic lorsque l'alarme est déclenchée ou ne peut pas être armée.",available_actions:"Actions disponibles:",action_dialog:{title:"Personnaliser l'affichage de l'action '{action}'",button_label:"Remplacer le libellé du bouton",state_label:"Remplacer l'étiquette d'état"}},Xe={blocking_sensors:"Impossible d'armer en raison du(es) capteur(s) suivant(s)",triggered_sensors:"L'alarme a été déclenchée par le(s) capteur(s) suivant(s)"},et={arm_options:Ge,editor:Qe,errors:Xe},tt={heading:"Opciones de armado",skip_delay:"Omitir el retardo de salida",force:"Pasar por alto los sensores abiertos"},it={keep_keypad_visible:"Mantener el teclado siempre visible, también cuando no se requiere ninguna entrada de código.",button_scale_actions:"Factor de escalado para cambiar el tamaño de los botones de acción.",button_scale_keypad:"Factor de escalado para cambiar el tamaño de los botones del teclado.",use_clear_icon:"Mostrar icono (en lugar de texto) en el teclado para borrar la entrada de código.",show_messages:"Mostrar mensajes de diagnóstico cuando se activa la alarma o no se puede activar.",available_actions:"Acciones disponibles:",action_dialog:{title:"Personalizar la visualización de la acción '{action}'",button_label:"Sobrescribir el texto del botón",state_label:"Sobrescribir el texto de estado"}},at={blocking_sensors:"No se pudo armar debido a los siguientes sensores",triggered_sensors:"La alarma fue disparada por los siguientes sensores"},st={arm_options:tt,editor:it,errors:at},rt={fr:Object.freeze({__proto__:null,arm_options:Ge,editor:Qe,errors:Xe,default:et}),en:Je,es:Object.freeze({__proto__:null,arm_options:tt,editor:it,errors:at,default:st})};function nt(e,t,i="",a=""){const s=t.replace(/['"]+/g,"").replace("-","_");var r;try{r=e.split(".").reduce((e,t)=>e[t],rt[s])}catch(t){r=e.split(".").reduce((e,t)=>e[t],rt.en)}if(void 0===r&&(r=e.split(".").reduce((e,t)=>e[t],rt.en)),""!==i&&""!==a){Array.isArray(i)||(i=[i]),Array.isArray(a)||(a=[a]);for(let e=0;e{let i={hide:!1,button_label:"",state_label:""};return(t.states||{}).hasOwnProperty(e)&&(i=Object.assign(Object.assign({},i),t.states[e])),i},dt=e=>{if(!e)return[];const t=e.attributes.supported_features||0;let i=[];return 2&t&&i.push(Re.ArmAway),1&t&&i.push(Re.ArmHome),4&t&&i.push(Re.ArmNight),32&t&&i.push(Re.ArmVacation),16&t&&i.push(Re.ArmCustomBypass),i},ht=e=>null!==e.attributes.code_format;let ut=class extends Q{async showDialog(e){this._params=e}closeDialog(){return this._params=void 0,!0}_createCloseHeading(){return N` ${ee("editor.action_dialog.title",this.hass.language,"{action}",this.hass.localize("ui.card.alarm_control_panel."+this._params.action))}${nt("editor.action_dialog.title",this.hass.language,"{action}",this.hass.localize("ui.card.alarm_control_panel."+this._params.action))} e=>"function"==typeof e?((t,e)=>(window.customElements.define(t,e),e) @closed=${this._cancel} > this._updateConfig({button_label:String(t.target.value).trim()})} + @change=${e=>this._updateConfig({button_label:String(e.target.value).trim()})} > this._updateConfig({state_label:String(t.target.value).trim()})} + placeholder="${this.hass.localize("component.alarm_control_panel.state._."+Ye[this._params.action])}" + @change=${e=>this._updateConfig({state_label:String(e.target.value).trim()})} >
@@ -94,7 +94,7 @@ const X=t=>e=>"function"==typeof e?((t,e)=>(window.customElements.define(t,e),e)
- `:N``}_ignoreKeydown(t){t.stopPropagation()}_cancel(t){t&&t.stopPropagation(),this.closeDialog()}_save(t){var e;t&&t.stopPropagation(),null===(e=this._params)||void 0===e||e.confirm(this._params.config),this.closeDialog()}_updateConfig(t){this._params&&(this._params=Object.assign(Object.assign({},this._params),{config:Object.assign(Object.assign({},this._params.config),t)}))}static get styles(){return o` + `:N``}_ignoreKeydown(e){e.stopPropagation()}_cancel(e){e&&e.stopPropagation(),this.closeDialog()}_save(e){var t;e&&e.stopPropagation(),null===(t=this._params)||void 0===t||t.confirm(this._params.config),this.closeDialog()}_updateConfig(e){this._params&&(this._params=Object.assign(Object.assign({},this._params),{config:Object.assign(Object.assign({},this._params.config),e)}))}static get styles(){return o` paper-dialog-scrollable { --paper-dialog-scrollable: { -webkit-overflow-scrolling: auto; @@ -202,11 +202,11 @@ const X=t=>e=>"function"==typeof e?((t,e)=>(window.customElements.define(t,e),e) span.header { font-weight: 600; } - `}};e([et({attribute:!1})],oe.prototype,"hass",void 0),e([it()],oe.prototype,"_params",void 0),oe=e([X("alarmo-action-config-dialog")],oe);var le=Object.freeze({__proto__:null,get AlarmoActionConfigDialog(){return oe}});const ce=t=>t.callWS({type:"alarmo/entities"}),de=t=>t.callWS({type:"alarmo/config"});let he=class extends Q{constructor(){super(...arguments),this._entities=null}async firstUpdated(){ce(this.hass).then(t=>{this._entities=t.map(t=>t.entity_id)}).catch(t=>{}),this._alarmoConfig=await de(this.hass)}setConfig(t){!(null==t?void 0:t.button_scale_actions)&&(null==t?void 0:t.button_scale)&&(t=Object.assign(Object.assign({},t),{button_scale_actions:null==t?void 0:t.button_scale})),!(null==t?void 0:t.button_scale_keypad)&&(null==t?void 0:t.button_scale)&&(t=Object.assign(Object.assign({},t),{button_scale_keypad:null==t?void 0:t.button_scale})),this._config=Object.assign({},t)}render(){var t,e,i;if(!this._config||!this.hass||!this._entities)return N``;if(!this._entities.length)return N` + `}};t([te({attribute:!1})],ut.prototype,"hass",void 0),t([ie()],ut.prototype,"_params",void 0),ut=t([X("alarmo-action-config-dialog")],ut);var mt=Object.freeze({__proto__:null,get AlarmoActionConfigDialog(){return ut}});const pt=e=>e.callWS({type:"alarmo/entities"}),gt=e=>e.callWS({type:"alarmo/config"});let bt=class extends Q{constructor(){super(...arguments),this._entities=null}async firstUpdated(){pt(this.hass).then(e=>{this._entities=e.map(e=>e.entity_id)}).catch(e=>{}),this._alarmoConfig=await gt(this.hass)}setConfig(e){!(null==e?void 0:e.button_scale_actions)&&(null==e?void 0:e.button_scale)&&(e=Object.assign(Object.assign({},e),{button_scale_actions:null==e?void 0:e.button_scale})),!(null==e?void 0:e.button_scale_keypad)&&(null==e?void 0:e.button_scale)&&(e=Object.assign(Object.assign({},e),{button_scale_keypad:null==e?void 0:e.button_scale})),this._config=Object.assign({},e)}render(){var e,t,i;if(!this._config||!this.hass||!this._entities)return N``;if(!this._entities.length)return N` Could not establish a connection with the alarmo integration. Please check if it is installed and running. - `;const s=this._config.entity?this.hass.states[this._config.entity]:void 0,a="number"===(null===(t=this._alarmoConfig)||void 0===t?void 0:t.code_format)&&(this._alarmoConfig.code_arm_required||this._alarmoConfig.code_disarm_required);return N` + `;const a=this._config.entity?this.hass.states[this._config.entity]:void 0,s="number"===(null===(e=this._alarmoConfig)||void 0===e?void 0:e.code_format)&&(this._alarmoConfig.code_arm_required||this._alarmoConfig.code_disarm_required);return N`
e=>"function"==typeof e?((t,e)=>(window.customElements.define(t,e),e) .hass=${this.hass} .value="${this._config.entity||""}" .includeDomains=${["alarm_control_panel"]} - .entityFilter=${t=>this._entities.includes(t.entity_id)} - @change=${t=>this._updateConfig("entity",t.target.value)} + .entityFilter=${e=>this._entities.includes(e.entity_id)} + @change=${e=>this._updateConfig("entity",e.target.value)} allow-custom-entity > this._updateConfig("name",String(t.target.value).trim())} + @input=${e=>this._updateConfig("name",String(e.target.value).trim())} > -
- ${s?N` -
- ${ee("editor.available_actions",this.hass.language)} -
-
- ${[...re(s),Rt.Disarm].map(t=>{const e=re(s).map(t=>Yt[t]),i=ae(Yt[t],this._config).hide;return N` -
- !ae(t,this._config).hide).length||t==Rt.Disarm} - @change=${e=>this._updateStateConfig(Yt[t],e.target.checked?{hide:void 0}:{hide:!0})} - > - - {const e=t.target.previousElementSibling;e.click(),e.blur()}} - > - ${this.hass.localize("ui.card.alarm_control_panel."+t)} - - this._openActionLabelDialog(e,t)} - > - - - `})} +
+ + ${a?N` +
+ ${nt("editor.available_actions",this.hass.language)} +
+
+ ${[...dt(a),Re.Disarm].map(e=>{const t=dt(a).map(e=>Ye[e]),i=ct(Ye[e],this._config).hide;return N` +
+ !ct(e,this._config).hide).length||e==Re.Disarm} + @change=${t=>this._updateStateConfig(Ye[e],t.target.checked?{hide:void 0}:{hide:!0})} + > + + {const t=e.target.previousElementSibling;t.click(),t.blur()}} + > + ${this.hass.localize("ui.card.alarm_control_panel."+e)} + + this._openActionLabelDialog(t,e)} + > +
- `:""} + `})} +
+ `:""} -
- - this._updateConfig("button_scale_actions",Number(t.target.value))} - min="${1}" - max="${2.5}" - step="0.1" - pin - > - +
+ + this._updateConfig("button_scale_actions",Number(e.target.value))} + min="${1}" + max="${2.5}" + step="0.1" + pin + > + - - this._updateConfig("button_scale_keypad",Number(t.target.value))} - min="${1}" - max="${2.5}" - step="0.1" - pin - ?disabled=${!s||!a} - > - -
+ + this._updateConfig("button_scale_keypad",Number(e.target.value))} + min="${1}" + max="${2.5}" + step="0.1" + pin + ?disabled=${!a||!s} + > + -
- - this._updateConfig("use_clear_icon",t.target.checked)} - ?disabled=${!s||!a} - > + + this._updateConfig("use_clear_icon",e.target.checked)} + ?disabled=${!a||!s} + > - - this._updateConfig("show_messages",t.target.checked)} - > -
+ + this._updateConfig("show_messages",e.target.checked)} + > - - this._updateConfig("keep_keypad_visible",t.target.checked)} - ?disabled=${!s||!a||(null===(e=this._alarmoConfig)||void 0===e?void 0:e.code_arm_required)==(null===(i=this._alarmoConfig)||void 0===i?void 0:i.code_disarm_required)} - > -
+ + this._updateConfig("keep_keypad_visible",e.target.checked)} + ?disabled=${!a||!s||(null===(t=this._alarmoConfig)||void 0===t?void 0:t.code_arm_required)==(null===(i=this._alarmoConfig)||void 0===i?void 0:i.code_disarm_required)} + >
- `}_updateConfig(t,e){if(this.hass){if(this._config=Object.assign(Object.assign({},this._config),{[t]:e}),"entity"==t){const t=this._config.entity?this.hass.states[this._config.entity]:void 0;t&&t.attributes.code_arm_required!=t.attributes.code_disarm_required||(this._config=Object.assign(Object.assign({},this._config),{keep_keypad_visible:!1}))}Dt(this,"config-changed",{config:this._config})}}_updateStateConfig(t,e){var i;const s=t=>function(t,e){return t?Object.entries(t).filter(([t])=>e.includes(t)).reduce((t,[e,i])=>Object.assign(t,{[e]:i}),{}):{}}(t,Object.keys(t).filter(e=>!se(t[e])));let a=(null===(i=this._config)||void 0===i?void 0:i.states)||{};const r=s(Object.assign(Object.assign({},a[t]),e));a=s(Object.assign(Object.assign({},a),{[t]:r})),this._updateConfig("states",a)}_openActionLabelDialog(t,e){const i={action:e,config:ae(Yt[e],this._config),confirm:t=>{this._updateStateConfig(Yt[e],t)}};Dt(t.target,"show-dialog",{dialogTag:"alarmo-action-config-dialog",dialogImport:()=>Promise.resolve().then((function(){return le})),dialogParams:i})}static get styles(){return o` - ha-formfield { - padding: 20px 0px; - } + `}_updateConfig(e,t){if(this.hass){if(this._config=Object.assign(Object.assign({},this._config),{[e]:t}),"entity"==e){const e=this._config.entity?this.hass.states[this._config.entity]:void 0;e&&e.attributes.code_arm_required!=e.attributes.code_disarm_required||(this._config=Object.assign(Object.assign({},this._config),{keep_keypad_visible:!1}))}De(this,"config-changed",{config:this._config})}}_updateStateConfig(e,t){var i;const a=e=>function(e,t){return e?Object.entries(e).filter(([e])=>t.includes(e)).reduce((e,[t,i])=>Object.assign(e,{[t]:i}),{}):{}}(e,Object.keys(e).filter(t=>!lt(e[t])));let s=(null===(i=this._config)||void 0===i?void 0:i.states)||{};const r=a(Object.assign(Object.assign({},s[e]),t));s=a(Object.assign(Object.assign({},s),{[e]:r})),this._updateConfig("states",s)}_openActionLabelDialog(e,t){const i={action:t,config:ct(Ye[t],this._config),confirm:e=>{this._updateStateConfig(Ye[t],e)}};De(e.target,"show-dialog",{dialogTag:"alarmo-action-config-dialog",dialogImport:()=>Promise.resolve().then((function(){return mt})),dialogParams:i})}static get styles(){return o` div.config-row { font-size: 16px; display: flex; @@ -330,9 +324,15 @@ const X=t=>e=>"function"==typeof e?((t,e)=>(window.customElements.define(t,e),e) width: 100%; } div.grid { - display: grid !important; - grid-template-columns: 1fr 1fr; - grid-gap: 8px; + display: flex; + flex-direction: row; + flex-wrap: wrap; + gap: 20px 8px; + } + div.grid > * { + display: flex; + flex-direction: column; + flex: 1 0 300px; } div.checkbox-item { font-size: 0.875rem; @@ -340,27 +340,27 @@ const X=t=>e=>"function"==typeof e?((t,e)=>(window.customElements.define(t,e),e) div.checkbox-item.disabled { color: var(--disabled-text-color); } - `}};e([et({attribute:!1})],he.prototype,"hass",void 0),e([it()],he.prototype,"_config",void 0),e([it()],he.prototype,"_alarmoConfig",void 0),e([it()],he.prototype,"_entities",void 0),he=e([X("alarmo-card-editor")],he);var ue=Object.freeze({__proto__:null,get AlarmoCardEditor(){return he}});class me extends Q{constructor(){super(...arguments),this.duration=0,this.datetime=null,this.timer=0}shouldUpdate(t){if(!t.size)return!0;const e=t.get("hass");if(!e||e.themes!==this.hass.themes||e.language!==this.hass.language)return!0;if(e.states[this.entity].state!==this.hass.states[this.entity].state){const t=e.states[this.entity].state,i=this.hass.states[this.entity].state;return Bt.includes(i)?this.startTimer():Bt.includes(t)&&this.stopTimer(),!0}return!1}firstUpdated(){const t=this.hass.states[this.entity].state;Bt.includes(t)&&this.startTimer()}async startTimer(){var t,e;clearInterval(this.timer),(t=this.hass,e=this.entity,t.callWS({type:"alarmo/countdown",entity_id:e})).then(t=>{this.duration=t.delay,this.datetime=new Date((new Date).getTime()+1e3*t.remaining)}).catch(t=>{}),this.timer=window.setInterval(()=>{this.requestUpdate()},1e3)}stopTimer(){clearInterval(this.timer),this.datetime=null,this.duration=0}getRemaining(){if(!this.datetime)return 0;const t=(this.datetime.getTime()-(new Date).getTime())/1e3;return t<0?(clearInterval(this.timer),0):t}getFraction(){return this.duration?(Math.round(this.getRemaining())-1)/this.duration:1}_stateValue(t){return this.datetime&&this.duration?N` + `}};t([te({attribute:!1})],bt.prototype,"hass",void 0),t([ie()],bt.prototype,"_config",void 0),t([ie()],bt.prototype,"_alarmoConfig",void 0),t([ie()],bt.prototype,"_entities",void 0),bt=t([X("alarmo-card-editor")],bt);var ft=Object.freeze({__proto__:null,get AlarmoCardEditor(){return bt}});class _t extends Q{constructor(){super(...arguments),this.duration=0,this.datetime=null,this.timer=0}shouldUpdate(e){if(!e.size)return!0;const t=e.get("hass");if(!t||t.themes!==this.hass.themes||t.language!==this.hass.language)return!0;if(t.states[this.entity].state!==this.hass.states[this.entity].state||t.states[this.entity].attributes.delay!==this.hass.states[this.entity].attributes.delay){const e=t.states[this.entity].state,i=this.hass.states[this.entity].state;return Be.includes(i)?this.startTimer():Be.includes(e)&&this.stopTimer(),!0}return!1}firstUpdated(){const e=this.hass.states[this.entity].state;Be.includes(e)&&this.startTimer()}async startTimer(){var e,t;clearInterval(this.timer),(e=this.hass,t=this.entity,e.callWS({type:"alarmo/countdown",entity_id:t})).then(e=>{this.duration=e.delay,this.datetime=new Date((new Date).getTime()+1e3*e.remaining)}).catch(e=>{}),this.timer=window.setInterval(()=>{this.requestUpdate()},1e3)}stopTimer(){clearInterval(this.timer),this.datetime=null,this.duration=0}getRemaining(){if(!this.datetime)return 0;const e=(this.datetime.getTime()-(new Date).getTime())/1e3;return e<0?(clearInterval(this.timer),0):e}getFraction(){return this.duration?(Math.round(this.getRemaining())-1)/this.duration:1}_stateValue(e){return this.datetime&&this.duration?N` ${Math.max(Math.round(this.getRemaining()),0)} `:N` - - `}render(){let t=45,e=2*Math.PI*t;const i=this.hass.states[this.entity],s=this.datetime&&this.duration;return N` + + `}render(){let e=45,t=2*Math.PI*e;const i=this.hass.states[this.entity],a=this.datetime&&this.duration;return N` - - + + -
+
${this._stateValue(i.state)}
@@ -453,17 +453,17 @@ const X=t=>e=>"function"==typeof e?((t,e)=>(window.customElements.define(t,e),e) opacity: 1; } } - `}}e([et()],me.prototype,"hass",void 0),e([et()],me.prototype,"entity",void 0),customElements.define("alarmo-state-badge",me);class pe extends Q{shouldUpdate(t){const e=t.get("hass");return!e||!(!this.entity||e.states[this.entity]===this.hass.states[this.entity])}render(){if(!this.hass||!this.entity)return N``;let t=Object.assign({},this.hass.states[this.entity]);void 0!==this.state&&(t=Object.assign(Object.assign({},t),{state:this.state}));const e=function(t){if(!t)return"hass:bookmark";if(t.attributes.icon)return t.attributes.icon;var e=Et(t.entity_id);return e in jt?jt[e](t):Nt(e,t.state)}(t),i=Mt(this.hass.localize,t,this.hass.locale||{language:this.hass.language,number_format:$t.language}),s=t.attributes.friendly_name||function(t){return t.substr(t.indexOf(".")+1)}(t.entity_id);let a=!!this.state||"on"==t.state;return N` -
Dt(this,"hass-more-info",{entityId:this.entity})}> -
+ `}}t([te()],_t.prototype,"hass",void 0),t([te()],_t.prototype,"entity",void 0),customElements.define("alarmo-state-badge",_t);class vt extends Q{shouldUpdate(e){const t=e.get("hass");return!t||!(!this.entity||t.states[this.entity]===this.hass.states[this.entity])}render(){if(!this.hass||!this.entity)return N``;let e=Object.assign({},this.hass.states[this.entity]);void 0!==this.state&&(e=Object.assign(Object.assign({},e),{state:this.state}));const t=function(e){if(!e)return"hass:bookmark";if(e.attributes.icon)return e.attributes.icon;var t=Ee(e.entity_id);return t in je?je[t](e):Ne(t,e.state)}(e),i=Me(this.hass.localize,e,this.hass.locale||{language:this.hass.language,number_format:$e.language}),a=e.attributes.friendly_name||function(e){return e.substr(e.indexOf(".")+1)}(e.entity_id);let s=!!this.state||"on"==e.state;return N` +
De(this,"hass-more-info",{entityId:this.entity})}> +
- +
${i}
-
${s}
+
${a}
`}static get styles(){return o` .badge-container { @@ -533,7 +533,7 @@ const X=t=>e=>"function"==typeof e?((t,e)=>(window.customElements.define(t,e),e) text-overflow: ellipsis; line-height: normal; } - `}}e([et()],pe.prototype,"hass",void 0),e([et()],pe.prototype,"entity",void 0),e([et()],pe.prototype,"state",void 0),customElements.define("alarmo-sensor-badge",pe);class ge extends Q{constructor(){super(...arguments),this.disabled=!1,this.scaled=!1}render(){return N` + `}}t([te()],vt.prototype,"hass",void 0),t([te()],vt.prototype,"entity",void 0),t([te()],vt.prototype,"state",void 0),customElements.define("alarmo-sensor-badge",vt);class yt extends Q{constructor(){super(...arguments),this.disabled=!1,this.scaled=!1}render(){return N` ${this.scaled?N`
- ${((t,e)=>se(e.name)?t.attributes.friendly_name:e.name)(i,this._config)} + ${((e,t)=>lt(t.name)?e.attributes.friendly_name:t.name)(i,this._config)}
- ${((t,e,i)=>{const s=t.state;if(Object.values(Ut).includes(s)){const t=ae(s,i);if(!se(t.state_label))return t.state_label}return e("component.alarm_control_panel.state._."+t.state)})(i,this.hass.localize,this._config)} + ${((e,t,i)=>{const a=e.state;if(Object.values(Ue).includes(a)){const e=ct(a,i);if(!lt(e.state_label))return e.state_label}return t("component.alarm_control_panel.state._."+e.state)})(i,this.hass.localize,this._config)}
@@ -650,21 +650,21 @@ const X=t=>e=>"function"==typeof e?((t,e)=>(window.customElements.define(t,e),e) ${this._renderActions()}
- ${ne(i)||this._config.keep_keypad_visible?N` + ${ht(i)||this._config.keep_keypad_visible?N` {this._clearCodeError(),this._input=t.target.value,this._setCodeClearTimer()}} + ?disabled=${!ht(i)} + @input=${e=>{this._clearCodeError(),this._input=e.target.value,this._setCodeClearTimer()}} @focus=${this._clearCodeError} type="password" id="code_input" - .inputmode=${"number"===(null===(t=this._alarmoConfig)||void 0===t?void 0:t.code_format)?"numeric":"text"} + .inputmode=${"number"===(null===(e=this._alarmoConfig)||void 0===e?void 0:e.code_format)?"numeric":"text"} > `:N``} - ${!ne(i)&&!this._config.keep_keypad_visible||"number"!==(null===(e=this._alarmoConfig)||void 0===e?void 0:e.code_format)?N``:N` + ${!ht(i)&&!this._config.keep_keypad_visible||"number"!==(null===(t=this._alarmoConfig)||void 0===t?void 0:t.code_format)?N``:N`
- ${Ht.map(t=>""===t?N` + ${He.map(e=>""===e?N` e=>"function"==typeof e?((t,e)=>(window.customElements.define(t,e),e) > `:N` - ${"clear"===t?this._config.use_clear_icon?N` + ${"clear"===e?this._config.use_clear_icon?N` - `:this.hass.localize("ui.card.alarm_control_panel.clear_code"):t} + `:this.hass.localize("ui.card.alarm_control_panel.clear_code"):e} `)}
@@ -691,15 +691,15 @@ const X=t=>e=>"function"==typeof e?((t,e)=>(window.customElements.define(t,e),e) ${"NOT_RUNNING"!==this.hass.config.state?this.hass.localize("ui.panel.lovelace.warning.entity_not_found","entity",this._config.entity||"[empty]"):this.hass.localize("ui.panel.lovelace.warning.starting")} - `}_renderActions(){if(!this.hass||!this._config)return N``;const t=this.hass.states[this._config.entity];return(t.state===Ut.Disarmed?re(t).filter(t=>!ae(Yt[t],this._config).hide):[Rt.Disarm]).map(t=>{const e=ae(Yt[t],this._config);return N` + `}_renderActions(){if(!this.hass||!this._config)return N``;const e=this.hass.states[this._config.entity];return(e.state===Ue.Disarmed?dt(e).filter(e=>!ct(Ye[e],this._config).hide):[Re.Disarm]).map(e=>{const t=ct(Ye[e],this._config);return N` this._handleActionClick(e,t)} + @click=${t=>this._handleActionClick(t,e)} style="--content-scale: ${this._config.button_scale_actions}" ?scaled=${1!=this._config.button_scale_actions} > - ${se(e.button_label)?this.hass.localize("ui.card.alarm_control_panel."+t):e.button_label} + ${lt(t.button_label)?this.hass.localize("ui.card.alarm_control_panel."+e):t.button_label} - `})}_renderWarning(){if(!this.hass||!this._config||!this._config.show_messages)return N``;const t=this.hass.states[this._config.entity];return t.attributes.open_sensors&&t.state==Ut.Triggered||"blocking_sensors"==this.warning&&t.attributes.open_sensors?N` + `})}_renderWarning(){if(!this.hass||!this._config||!this._config.show_messages)return N``;const e=this.hass.states[this._config.entity];return e.attributes.open_sensors&&e.state==Ue.Triggered||"blocking_sensors"==this.warning&&e.attributes.open_sensors?N`
@@ -707,21 +707,21 @@ const X=t=>e=>"function"==typeof e?((t,e)=>(window.customElements.define(t,e),e)
- ${"blocking_sensors"==this.warning?ee("errors.blocking_sensors",this.hass.language):ee("errors.triggered_sensors",this.hass.language)} + ${"blocking_sensors"==this.warning?nt("errors.blocking_sensors",this.hass.language):nt("errors.triggered_sensors",this.hass.language)}
- ${Object.entries(t.attributes.open_sensors).map(([t])=>(this.subscribedEntities.includes(t)||this.subscribedEntities.push(t),N` + ${Object.entries(e.attributes.open_sensors).map(([e])=>(this.subscribedEntities.includes(e)||this.subscribedEntities.push(e),N`
- +
`))}
- `:N``}_handlePadClick(t){const e=t.currentTarget.value;this._clearCodeError(),this._input="clear"===e?"":this._input+e}_handleActionClick(t,e){t.target.blur(),this._clearCodeError(),e==Rt.Disarm?this.hass.callService("alarmo","disarm",{entity_id:this._config.entity,code:this._input}):this.hass.callService("alarmo","arm",Object.assign(Object.assign({},this.armOptions),{entity_id:this._config.entity,mode:Yt[e],code:this._input})),this.warning="",this.armOptions=Object.assign({},qt)}_showCodeError(){var t;const e=null===(t=this.shadowRoot)||void 0===t?void 0:t.querySelector("#code_input");e&&(e.classList.remove("error"),e.classList.add("error"),e.invalid=!0)}_clearCodeError(){var t;const e=null===(t=this.shadowRoot)||void 0===t?void 0:t.querySelector("#code_input");e&&e.classList.contains("error")&&(e.classList.remove("error"),e.invalid=!1,this._input="",this._cancelCodeClearTimer())}_clearCode(){this._input="",this._clearCodeError(),this._cancelCodeClearTimer()}_setCodeClearTimer(){this._cancelCodeClearTimer(),this._input.length&&(this._codeClearTimer=window.setTimeout(()=>{this._clearCode()},12e4))}_cancelCodeClearTimer(){this._codeClearTimer&&clearTimeout(this._codeClearTimer)}_toggleArmOptions(t){switch(t.detail.index){case 0:this.armOptions=Object.assign(Object.assign({},this.armOptions),{skip_delay:!this.armOptions.skip_delay});break;case 1:this.armOptions=Object.assign(Object.assign({},this.armOptions),{force:!this.armOptions.force})}t.preventDefault();const e=t.target;setTimeout(()=>{e.firstElementChild.blur()},50)}static get styles(){return o` + `:N``}_handlePadClick(e){const t=e.currentTarget.value;this._clearCodeError(),this._input="clear"===t?"":this._input+t}_handleActionClick(e,t){e.target.blur(),this._clearCodeError(),t==Re.Disarm?this.hass.callService("alarmo","disarm",{entity_id:this._config.entity,code:this._input}):this.hass.callService("alarmo","arm",Object.assign(Object.assign({},this.armOptions),{entity_id:this._config.entity,mode:Ye[t],code:this._input})),this.warning="",this.armOptions=Object.assign({},qe)}_showCodeError(){var e;const t=null===(e=this.shadowRoot)||void 0===e?void 0:e.querySelector("#code_input");t&&(t.classList.remove("error"),t.classList.add("error"),t.invalid=!0)}_clearCodeError(){var e;const t=null===(e=this.shadowRoot)||void 0===e?void 0:e.querySelector("#code_input");t&&t.classList.contains("error")&&(t.classList.remove("error"),t.invalid=!1,this._input="",this._cancelCodeClearTimer())}_clearCode(){this._input="",this._clearCodeError(),this._cancelCodeClearTimer()}_setCodeClearTimer(){this._cancelCodeClearTimer(),this._input.length&&(this._codeClearTimer=window.setTimeout(()=>{this._clearCode()},12e4))}_cancelCodeClearTimer(){this._codeClearTimer&&clearTimeout(this._codeClearTimer)}_toggleArmOptions(e){switch(e.detail.index){case 0:this.armOptions=Object.assign(Object.assign({},this.armOptions),{skip_delay:!this.armOptions.skip_delay});break;case 1:this.armOptions=Object.assign(Object.assign({},this.armOptions),{force:!this.armOptions.force})}e.preventDefault();const t=e.target;setTimeout(()=>{t.firstElementChild.blur()},50)}static get styles(){return o` ha-card { padding-bottom: 16px; position: relative; @@ -877,4 +877,4 @@ const X=t=>e=>"function"==typeof e?((t,e)=>(window.customElements.define(t,e),e) font-weight: 500; font-size: 1.1em; } - `}},e([et({attribute:!1})],t.AlarmoCard.prototype,"hass",void 0),e([it()],t.AlarmoCard.prototype,"_config",void 0),e([it()],t.AlarmoCard.prototype,"_alarmoConfig",void 0),e([it()],t.AlarmoCard.prototype,"_input",void 0),e([it()],t.AlarmoCard.prototype,"warning",void 0),e([it()],t.AlarmoCard.prototype,"area_id",void 0),e([it()],t.AlarmoCard.prototype,"armOptions",void 0),e([it()],t.AlarmoCard.prototype,"backendConnection",void 0),t.AlarmoCard=e([X("alarmo-card")],t.AlarmoCard),window.customCards=window.customCards||[],window.customCards.push({type:"alarmo-card",name:"Alarmo Card",description:"Card for operating Alarmo through Lovelace."}),console.info("%c ALARMO-CARD \n%c Version: "+"v1.4.0".padEnd(7," "),"color: orange; font-weight: bold; background: black","color: white; font-weight: bold; background: dimgray")}({}); + `}},t([te({attribute:!1})],e.AlarmoCard.prototype,"hass",void 0),t([ie()],e.AlarmoCard.prototype,"_config",void 0),t([ie()],e.AlarmoCard.prototype,"_alarmoConfig",void 0),t([ie()],e.AlarmoCard.prototype,"_input",void 0),t([ie()],e.AlarmoCard.prototype,"warning",void 0),t([ie()],e.AlarmoCard.prototype,"area_id",void 0),t([ie()],e.AlarmoCard.prototype,"armOptions",void 0),t([ie()],e.AlarmoCard.prototype,"backendConnection",void 0),e.AlarmoCard=t([X("alarmo-card")],e.AlarmoCard),window.customCards=window.customCards||[],window.customCards.push({type:"alarmo-card",name:"Alarmo Card",description:"Card for operating Alarmo through Lovelace."}),console.info("%c ALARMO-CARD \n%c Version: "+"v1.4.1".padEnd(7," "),"color: orange; font-weight: bold; background: black","color: white; font-weight: bold; background: dimgray")}({}); diff --git a/src/const.ts b/src/const.ts index e7d2c0d..a616a95 100755 --- a/src/const.ts +++ b/src/const.ts @@ -1,6 +1,6 @@ import { CardConfig } from './types'; -export const CARD_VERSION = 'v1.4.0'; +export const CARD_VERSION = 'v1.4.1'; export const BUTTONS = ['1', '2', '3', '4', '5', '6', '7', '8', '9', '', '0', 'clear'];