UNPKG

iobroker.lovelace

Version:

With this adapter you can build visualization for ioBroker with Home Assistant Lovelace UI

10 lines 18 kB
/*! For license information please see 40003.cb9885d593ea1f68.js.LICENSE.txt */ (self.webpackChunkhome_assistant_frontend=self.webpackChunkhome_assistant_frontend||[]).push([["40003"],{27323:function(e,t,i){"use strict";i.d(t,{O:()=>g});i(71695),i(47021);var a=i(9065),s=i(1105),o=i(57243),n=i(50778),r=i(35359),l=i(20552),d=i(91928);let c,h,u=e=>e;const p={fromAttribute(e){return null!==e&&(""===e||e)},toAttribute(e){return"boolean"==typeof e?e?"":null:e}};class g extends s.P{constructor(){super(...arguments),this.rows=2,this.cols=20,this.charCounter=!1}render(){const e=this.charCounter&&-1!==this.maxLength,t=e&&"internal"===this.charCounter,i=e&&!t,a=!!this.helper||!!this.validationMessage||i,s={"mdc-text-field--disabled":this.disabled,"mdc-text-field--no-label":!this.label,"mdc-text-field--filled":!this.outlined,"mdc-text-field--outlined":this.outlined,"mdc-text-field--end-aligned":this.endAligned,"mdc-text-field--with-internal-counter":t};return(0,o.dy)(c||(c=u` <label class="mdc-text-field mdc-text-field--textarea ${0}"> ${0} ${0} ${0} ${0} ${0} </label> ${0} `),(0,r.$)(s),this.renderRipple(),this.outlined?this.renderOutline():this.renderLabel(),this.renderInput(),this.renderCharCounter(t),this.renderLineRipple(),this.renderHelperText(a,i))}renderInput(){const e=this.label?"label":void 0,t=-1===this.minLength?void 0:this.minLength,i=-1===this.maxLength?void 0:this.maxLength,a=this.autocapitalize?this.autocapitalize:void 0;return(0,o.dy)(h||(h=u` <textarea aria-labelledby="${0}" class="mdc-text-field__input" .value="${0}" rows="${0}" cols="${0}" ?disabled="${0}" placeholder="${0}" ?required="${0}" ?readonly="${0}" minlength="${0}" maxlength="${0}" name="${0}" inputmode="${0}" autocapitalize="${0}" @input="${0}" @blur="${0}"> </textarea>`),(0,l.o)(e),(0,d.a)(this.value),this.rows,this.cols,this.disabled,this.placeholder,this.required,this.readOnly,(0,l.o)(t),(0,l.o)(i),(0,l.o)(""===this.name?void 0:this.name),(0,l.o)(this.inputMode),(0,l.o)(a),this.handleInputChange,this.onInputBlur)}}(0,a.__decorate)([(0,n.IO)("textarea")],g.prototype,"formElement",void 0),(0,a.__decorate)([(0,n.Cb)({type:Number})],g.prototype,"rows",void 0),(0,a.__decorate)([(0,n.Cb)({type:Number})],g.prototype,"cols",void 0),(0,a.__decorate)([(0,n.Cb)({converter:p})],g.prototype,"charCounter",void 0)},88540:function(e,t,i){"use strict";i.d(t,{W:()=>s});let a;const s=(0,i(57243).iv)(a||(a=(e=>e)`.mdc-text-field{height:100%}.mdc-text-field__input{resize:none}`))},68958:function(e,t,i){"use strict";i.d(t,{t:()=>o});i(92745),i(9359),i(31526),i(77439),i(19423),i(88972);class a{constructor(e=window.localStorage){this.storage=void 0,this._storage={},this._listeners={},this.storage=e,e===window.localStorage&&window.addEventListener("storage",(e=>{e.key&&this.hasKey(e.key)&&(this._storage[e.key]=e.newValue?JSON.parse(e.newValue):e.newValue,this._listeners[e.key]&&this._listeners[e.key].forEach((t=>t(e.oldValue?JSON.parse(e.oldValue):e.oldValue,this._storage[e.key]))))}))}addFromStorage(e){if(!this._storage[e]){const t=this.storage.getItem(e);t&&(this._storage[e]=JSON.parse(t))}}subscribeChanges(e,t){return this._listeners[e]?this._listeners[e].push(t):this._listeners[e]=[t],()=>{this.unsubscribeChanges(e,t)}}unsubscribeChanges(e,t){if(!(e in this._listeners))return;const i=this._listeners[e].indexOf(t);-1!==i&&this._listeners[e].splice(i,1)}hasKey(e){return e in this._storage}getValue(e){return this._storage[e]}setValue(e,t){const i=this._storage[e];this._storage[e]=t;try{void 0===t?this.storage.removeItem(e):this.storage.setItem(e,JSON.stringify(t))}catch(a){}finally{this._listeners[e]&&this._listeners[e].forEach((e=>e(i,t)))}}}const s={},o=e=>t=>{const i=e.storage||"localStorage";let o;i&&i in s?o=s[i]:(o=new a(window[i]),s[i]=o);const n=String(t.key),r=e.key||String(t.key),l=t.initializer?t.initializer():void 0;o.addFromStorage(r);const d=!1!==e.subscribe?e=>o.subscribeChanges(r,((i,a)=>{e.requestUpdate(t.key,i)})):void 0,c=()=>o.hasKey(r)?e.deserializer?e.deserializer(o.getValue(r)):o.getValue(r):l;return{kind:"method",placement:"prototype",key:t.key,descriptor:{set(i){((i,a)=>{let s;e.state&&(s=c()),o.setValue(r,e.serializer?e.serializer(a):a),e.state&&i.requestUpdate(t.key,s)})(this,i)},get(){return c()},enumerable:!0,configurable:!0},finisher(i){if(e.state&&e.subscribe){const e=i.prototype.connectedCallback,t=i.prototype.disconnectedCallback;i.prototype.connectedCallback=function(){e.call(this),this[`__unbsubLocalStorage${n}`]=null==d?void 0:d(this)},i.prototype.disconnectedCallback=function(){var e;t.call(this),null===(e=this[`__unbsubLocalStorage${n}`])||void 0===e||e.call(this),this[`__unbsubLocalStorage${n}`]=void 0}}e.state&&i.createProperty(t.key,Object.assign({noAccessor:!0},e.stateOptions))}}}},29095:function(e,t,i){"use strict";i.a(e,(async function(e,t){try{var a=i(61701),s=(i(71695),i(47021),i(57243)),o=i(50778),n=(i(59826),i(17170)),r=(i(37583),e([n]));n=(r.then?(await r)():r)[0];let l,d,c,h,u,p,g=e=>e;const m="M2.2,16.06L3.88,12L2.2,7.94L6.26,6.26L7.94,2.2L12,3.88L16.06,2.2L17.74,6.26L21.8,7.94L20.12,12L21.8,16.06L17.74,17.74L16.06,21.8L12,20.12L7.94,21.8L6.26,17.74L2.2,16.06M13,17V15H11V17H13M13,13V7H11V13H13Z",v="M9,20.42L2.79,14.21L5.62,11.38L9,14.77L18.88,4.88L21.71,7.71L9,20.42Z";(0,a.Z)([(0,o.Mo)("ha-progress-button")],(function(e,t){return{F:class extends t{constructor(...t){super(...t),e(this)}},d:[{kind:"field",decorators:[(0,o.Cb)()],key:"label",value:void 0},{kind:"field",decorators:[(0,o.Cb)({type:Boolean})],key:"disabled",value(){return!1}},{kind:"field",decorators:[(0,o.Cb)({type:Boolean})],key:"progress",value(){return!1}},{kind:"field",decorators:[(0,o.Cb)({type:Boolean})],key:"raised",value(){return!1}},{kind:"field",decorators:[(0,o.Cb)({type:Boolean})],key:"unelevated",value(){return!1}},{kind:"field",decorators:[(0,o.SB)()],key:"_result",value:void 0},{kind:"method",key:"render",value:function(){const e=this._result||this.progress;return(0,s.dy)(l||(l=g` <ha-button .raised="${0}" .label="${0}" .unelevated="${0}" .disabled="${0}" class="${0}"> <slot name="icon" slot="icon"></slot> <slot></slot> </ha-button> ${0} `),this.raised,this.label,this.unelevated,this.disabled||this.progress,this._result||"",e?(0,s.dy)(d||(d=g` <div class="progress"> ${0} </div> `),"success"===this._result?(0,s.dy)(c||(c=g`<ha-svg-icon .path="${0}"></ha-svg-icon>`),v):"error"===this._result?(0,s.dy)(h||(h=g`<ha-svg-icon .path="${0}"></ha-svg-icon>`),m):this.progress?(0,s.dy)(u||(u=g`<ha-spinner size="small"></ha-spinner>`)):s.Ld):s.Ld)}},{kind:"method",key:"actionSuccess",value:function(){this._setResult("success")}},{kind:"method",key:"actionError",value:function(){this._setResult("error")}},{kind:"method",key:"_setResult",value:function(e){this._result=e,setTimeout((()=>{this._result=void 0}),2e3)}},{kind:"field",static:!0,key:"styles",value(){return(0,s.iv)(p||(p=g`:host{outline:0;display:inline-block;position:relative;pointer-events:none}ha-button{transition:all 1s;pointer-events:initial}ha-button.success{--mdc-theme-primary:white;background-color:var(--success-color);transition:none;border-radius:4px;pointer-events:none}ha-button[raised].success,ha-button[unelevated].success{--mdc-theme-primary:var(--success-color);--mdc-theme-on-primary:white}ha-button.error{--mdc-theme-primary:white;background-color:var(--error-color);transition:none;border-radius:4px;pointer-events:none}ha-button[raised].error,ha-button[unelevated].error{--mdc-theme-primary:var(--error-color);--mdc-theme-on-primary:white}.progress{bottom:4px;position:absolute;text-align:center;top:4px;width:100%}ha-svg-icon{color:#fff}ha-button.error slot,ha-button.success slot{visibility:hidden}:host([destructive]){--mdc-theme-primary:var(--error-color)}`))}}]}}),s.oi);t()}catch(l){t(l)}}))},73729:function(e,t,i){"use strict";i.d(t,{i:()=>m});var a=i(61701),s=i(72621),o=(i(22152),i(71695),i(47021),i(74966)),n=i(51408),r=i(57243),l=i(50778),d=i(76525);i(23334);let c,h,u,p=e=>e;const g=["button","ha-list-item"],m=(e,t)=>{var i;return(0,r.dy)(c||(c=p` <div class="header_title"> <ha-icon-button .label="${0}" .path="${0}" dialogAction="close" class="header_button"></ha-icon-button> <span>${0}</span> </div> `),null!==(i=null==e?void 0:e.localize("ui.common.close"))&&void 0!==i?i:"Close","M19,6.41L17.59,5L12,10.59L6.41,5L5,6.41L10.59,12L5,17.59L6.41,19L12,13.41L17.59,19L19,17.59L13.41,12L19,6.41Z",t)};(0,a.Z)([(0,l.Mo)("ha-dialog")],(function(e,t){class i extends t{constructor(...t){super(...t),e(this)}}return{F:i,d:[{kind:"field",key:d.gA,value:void 0},{kind:"method",key:"scrollToPos",value:function(e,t){var i;null===(i=this.contentElement)||void 0===i||i.scrollTo(e,t)}},{kind:"method",key:"renderHeading",value:function(){return(0,r.dy)(h||(h=p`<slot name="heading"> ${0} </slot>`),(0,s.Z)(i,"renderHeading",this,3)([]))}},{kind:"method",key:"firstUpdated",value:function(){var e;(0,s.Z)(i,"firstUpdated",this,3)([]),this.suppressDefaultPressSelector=[this.suppressDefaultPressSelector,g].join(", "),this._updateScrolledAttribute(),null===(e=this.contentElement)||void 0===e||e.addEventListener("scroll",this._onScroll,{passive:!0})}},{kind:"method",key:"disconnectedCallback",value:function(){(0,s.Z)(i,"disconnectedCallback",this,3)([]),this.contentElement.removeEventListener("scroll",this._onScroll)}},{kind:"field",key:"_onScroll",value(){return()=>{this._updateScrolledAttribute()}}},{kind:"method",key:"_updateScrolledAttribute",value:function(){this.contentElement&&this.toggleAttribute("scrolled",0!==this.contentElement.scrollTop)}},{kind:"field",static:!0,key:"styles",value(){return[n.W,(0,r.iv)(u||(u=p`:host([scrolled]) ::slotted(ha-dialog-header){border-bottom:1px solid var(--mdc-dialog-scroll-divider-color,rgba(0,0,0,.12))}.mdc-dialog{--mdc-dialog-scroll-divider-color:var( --dialog-scroll-divider-color, var(--divider-color) );z-index:var(--dialog-z-index,8);-webkit-backdrop-filter:var(--ha-dialog-scrim-backdrop-filter,var(--dialog-backdrop-filter,none));backdrop-filter:var(--ha-dialog-scrim-backdrop-filter,var(--dialog-backdrop-filter,none));--mdc-dialog-box-shadow:var(--dialog-box-shadow, none);--mdc-typography-headline6-font-weight:400;--mdc-typography-headline6-font-size:1.574rem}.mdc-dialog__actions{justify-content:var(--justify-action-buttons,flex-end);padding-bottom:max(env(safe-area-inset-bottom),24px)}.mdc-dialog__actions span:first-child{flex:var(--secondary-action-button-flex,unset)}.mdc-dialog__actions span:nth-child(2){flex:var(--primary-action-button-flex,unset)}.mdc-dialog__container{align-items:var(--vertical-align-dialog,center)}.mdc-dialog__title{padding:24px 24px 0 24px}.mdc-dialog__title:has(span){padding:12px 12px 0}.mdc-dialog__actions{padding:12px 24px 12px 24px}.mdc-dialog__title::before{content:unset}.mdc-dialog .mdc-dialog__content{position:var(--dialog-content-position,relative);padding:var(--dialog-content-padding,24px)}:host([hideactions]) .mdc-dialog .mdc-dialog__content{padding-bottom:max(var(--dialog-content-padding,24px),env(safe-area-inset-bottom))}.mdc-dialog .mdc-dialog__surface{position:var(--dialog-surface-position,relative);top:var(--dialog-surface-top);margin-top:var(--dialog-surface-margin-top);min-height:var(--mdc-dialog-min-height,auto);border-radius:var(--ha-dialog-border-radius,28px);-webkit-backdrop-filter:var(--ha-dialog-surface-backdrop-filter,none);backdrop-filter:var(--ha-dialog-surface-backdrop-filter,none);background:var(--ha-dialog-surface-background,var(--mdc-theme-surface,#fff))}:host([flexContent]) .mdc-dialog .mdc-dialog__content{display:flex;flex-direction:column}.header_title{display:flex;align-items:center;direction:var(--direction)}.header_title span{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;display:block;padding-left:4px}.header_button{text-decoration:none;color:inherit;inset-inline-start:initial;inset-inline-end:-12px;direction:var(--direction)}.dialog-actions{inset-inline-start:initial!important;inset-inline-end:0px!important;direction:var(--direction)}`))]}}]}}),o.M)},40917:function(e,t,i){"use strict";var a=i(61701),s=i(72621),o=(i(71695),i(47021),i(27323)),n=i(33990),r=i(88540),l=i(57243),d=i(50778);let c,h=e=>e;(0,a.Z)([(0,d.Mo)("ha-textarea")],(function(e,t){class i extends t{constructor(...t){super(...t),e(this)}}return{F:i,d:[{kind:"field",decorators:[(0,d.Cb)({type:Boolean,reflect:!0})],key:"autogrow",value(){return!1}},{kind:"method",key:"updated",value:function(e){(0,s.Z)(i,"updated",this,3)([e]),this.autogrow&&e.has("value")&&(this.mdcRoot.dataset.value=this.value+'=​"')}},{kind:"field",static:!0,key:"styles",value(){return[n.W,r.W,(0,l.iv)(c||(c=h`:host([autogrow]) .mdc-text-field{position:relative;min-height:74px;min-width:178px;max-height:200px}:host([autogrow]) .mdc-text-field:after{content:attr(data-value);margin-top:23px;margin-bottom:9px;line-height:1.5rem;min-height:42px;padding:0px 32px 0 16px;letter-spacing:var( --mdc-typography-subtitle1-letter-spacing, .009375em );visibility:hidden;white-space:pre-wrap}:host([autogrow]) .mdc-text-field__input{position:absolute;height:calc(100% - 32px)}:host([autogrow]) .mdc-text-field.mdc-text-field--no-label:after{margin-top:16px;margin-bottom:16px}.mdc-floating-label{inset-inline-start:16px!important;inset-inline-end:initial!important;transform-origin:var(--float-start) top}@media only screen and (min-width:459px){:host([mobile-multiline]) .mdc-text-field__input{white-space:nowrap;max-height:16px}}`))]}}]}}),o.O)},58968:function(e,t,i){"use strict";i.d(t,{MV:()=>d,Wg:()=>r,Xk:()=>n,aT:()=>a,b_:()=>o,yP:()=>l});i(88044);const a=(e,t)=>e.callApi("POST","tts_get_url",t),s="media-source://tts/",o=e=>e.startsWith(s),n=e=>e.substring(19),r=(e,t,i)=>e.callWS({type:"tts/engine/list",language:t,country:i}),l=(e,t)=>e.callWS({type:"tts/engine/get",engine_id:t}),d=(e,t,i)=>e.callWS({type:"tts/engine/voices",engine_id:t,language:i})},33774:function(e,t,i){"use strict";i.a(e,(async function(e,a){try{i.r(t),i.d(t,{TTSTryDialog:()=>f});var s=i(61701),o=(i(71695),i(19423),i(40251),i(47021),i(57243)),n=i(50778),r=i(68958),l=i(36522),d=i(73729),c=(i(40917),i(58968)),h=i(76131),u=i(29095),p=e([u]);u=(p.then?(await p)():p)[0];let g,m,v=e=>e;const b="M12,20C7.59,20 4,16.41 4,12C4,7.59 7.59,4 12,4C16.41,4 20,7.59 20,12C20,16.41 16.41,20 12,20M12,2A10,10 0 0,0 2,12A10,10 0 0,0 12,22A10,10 0 0,0 22,12A10,10 0 0,0 12,2M10,16.5L16,12L10,7.5V16.5Z";let f=(0,s.Z)([(0,n.Mo)("dialog-tts-try")],(function(e,t){return{F:class extends t{constructor(...t){super(...t),e(this)}},d:[{kind:"field",decorators:[(0,n.Cb)({attribute:!1})],key:"hass",value:void 0},{kind:"field",decorators:[(0,n.SB)()],key:"_loadingExample",value(){return!1}},{kind:"field",decorators:[(0,n.SB)()],key:"_params",value:void 0},{kind:"field",decorators:[(0,n.SB)()],key:"_valid",value(){return!1}},{kind:"field",decorators:[(0,n.IO)("#message")],key:"_messageInput",value:void 0},{kind:"field",decorators:[(0,r.t)({key:"ttsTryMessages",state:!1,subscribe:!1})],key:"_messages",value:void 0},{kind:"method",key:"showDialog",value:function(e){this._params=e,this._valid=Boolean(this._defaultMessage)}},{kind:"method",key:"closeDialog",value:function(){this._params=void 0,(0,l.B)(this,"dialog-closed",{dialog:this.localName})}},{kind:"get",key:"_defaultMessage",value:function(){var e,t;const i=null===(e=this._params.language)||void 0===e?void 0:e.substring(0,2),a=this.hass.locale.language.substring(0,2);return i&&null!==(t=this._messages)&&void 0!==t&&t[i]?this._messages[i]:i===a?this.hass.localize("ui.dialogs.tts-try.message_example"):""}},{kind:"method",key:"render",value:function(){return this._params?(0,o.dy)(g||(g=v` <ha-dialog open @closed="${0}" .heading="${0}"> <ha-textarea autogrow id="message" .label="${0}" .placeholder="${0}" .value="${0}" @input="${0}" ?dialogInitialFocus="${0}"> </ha-textarea> <ha-progress-button .progress="${0}" ?dialogInitialFocus="${0}" slot="primaryAction" .label="${0}" @click="${0}" .disabled="${0}"> <ha-svg-icon slot="icon" .path="${0}"></ha-svg-icon> </ha-progress-button> </ha-dialog> `),this.closeDialog,(0,d.i)(this.hass,this.hass.localize("ui.dialogs.tts-try.header")),this.hass.localize("ui.dialogs.tts-try.message"),this.hass.localize("ui.dialogs.tts-try.message_placeholder"),this._defaultMessage,this._inputChanged,!this._defaultMessage,this._loadingExample,Boolean(this._defaultMessage),this.hass.localize("ui.dialogs.tts-try.play"),this._playExample,!this._valid,b):o.Ld}},{kind:"method",key:"_inputChanged",value:async function(){var e;this._valid=Boolean(null===(e=this._messageInput)||void 0===e?void 0:e.value)}},{kind:"method",key:"_playExample",value:async function(){var e;const t=null===(e=this._messageInput)||void 0===e?void 0:e.value;if(!t)return;const i=this._params.engine,a=this._params.language,s=this._params.voice;a&&(this._messages=Object.assign(Object.assign({},this._messages),{},{[a.substring(0,2)]:t})),this._loadingExample=!0;const o=new Audio;let n;o.play();try{n=(await(0,c.aT)(this.hass,{platform:i,message:t,language:a,options:{voice:s}})).path}catch(r){return this._loadingExample=!1,void(0,h.showAlertDialog)(this,{text:`Unable to load example. ${r.error||r.body||r}`,warning:!0})}o.src=n,o.addEventListener("canplaythrough",(()=>o.play())),o.addEventListener("playing",(()=>{this._loadingExample=!1})),o.addEventListener("error",(()=>{(0,h.showAlertDialog)(this,{title:"Error playing audio."}),this._loadingExample=!1}))}},{kind:"field",static:!0,key:"styles",value(){return(0,o.iv)(m||(m=v`ha-dialog{--mdc-dialog-max-width:500px}ha-select,ha-textarea{width:100%}ha-select{margin-top:8px}.loading{height:36px}`))}}]}}),o.oi);a()}catch(g){a(g)}}))},22152:function(){Element.prototype.toggleAttribute||(Element.prototype.toggleAttribute=function(e,t){return void 0!==t&&(t=!!t),this.hasAttribute(e)?!!t||(this.removeAttribute(e),!1):!1!==t&&(this.setAttribute(e,""),!0)})}}]); //# sourceMappingURL=40003.cb9885d593ea1f68.js.map