UNPKG

iobroker.lovelace

Version:

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

10 lines 16.6 kB
/*! For license information please see 40003.0f6bd93deca85835.js.LICENSE.txt */ export const __webpack_ids__=["40003"];export const __webpack_modules__={27323:function(e,t,i){i.d(t,{O:()=>h});var a=i(9065),s=i(1105),o=i(57243),n=i(15093),r=i(35359),l=i(20552),d=i(91928);const c={fromAttribute:e=>null!==e&&(""===e||e),toAttribute:e=>"boolean"==typeof e?e?"":null:e};class h 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 o.dy` <label class="mdc-text-field mdc-text-field--textarea ${(0,r.$)(s)}"> ${this.renderRipple()} ${this.outlined?this.renderOutline():this.renderLabel()} ${this.renderInput()} ${this.renderCharCounter(t)} ${this.renderLineRipple()} </label> ${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 o.dy` <textarea aria-labelledby="${(0,l.o)(e)}" class="mdc-text-field__input" .value="${(0,d.a)(this.value)}" rows="${this.rows}" cols="${this.cols}" ?disabled="${this.disabled}" placeholder="${this.placeholder}" ?required="${this.required}" ?readonly="${this.readOnly}" minlength="${(0,l.o)(t)}" maxlength="${(0,l.o)(i)}" name="${(0,l.o)(""===this.name?void 0:this.name)}" inputmode="${(0,l.o)(this.inputMode)}" autocapitalize="${(0,l.o)(a)}" @input="${this.handleInputChange}" @blur="${this.onInputBlur}"> </textarea>`}}(0,a.__decorate)([(0,n.IO)("textarea")],h.prototype,"formElement",void 0),(0,a.__decorate)([(0,n.Cb)({type:Number})],h.prototype,"rows",void 0),(0,a.__decorate)([(0,n.Cb)({type:Number})],h.prototype,"cols",void 0),(0,a.__decorate)([(0,n.Cb)({converter:c})],h.prototype,"charCounter",void 0)},88540:function(e,t,i){i.d(t,{W:()=>a});const a=i(57243).iv`.mdc-text-field{height:100%}.mdc-text-field__input{resize:none}`},68958:function(e,t,i){i.d(t,{t:()=>o});i(92745),i(9359),i(31526),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(e){}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:()=>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}`]=d?.(this)},i.prototype.disconnectedCallback=function(){t.call(this),this[`__unbsubLocalStorage${n}`]?.(),this[`__unbsubLocalStorage${n}`]=void 0}}e.state&&i.createProperty(t.key,{noAccessor:!0,...e.stateOptions})}}}},29095:function(e,t,i){i.a(e,(async function(e,t){try{var a=i(44249),s=i(57243),o=i(15093),n=(i(59826),i(17170)),r=(i(37583),e([n]));n=(r.then?(await r)():r)[0];const l="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",d="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:()=>!1},{kind:"field",decorators:[(0,o.Cb)({type:Boolean})],key:"progress",value:()=>!1},{kind:"field",decorators:[(0,o.Cb)({type:Boolean})],key:"raised",value:()=>!1},{kind:"field",decorators:[(0,o.Cb)({type:Boolean})],key:"unelevated",value:()=>!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 s.dy` <ha-button .raised="${this.raised}" .label="${this.label}" .unelevated="${this.unelevated}" .disabled="${this.disabled||this.progress}" class="${this._result||""}"> <slot name="icon" slot="icon"></slot> <slot></slot> </ha-button> ${e?s.dy` <div class="progress"> ${"success"===this._result?s.dy`<ha-svg-icon .path="${d}"></ha-svg-icon>`:"error"===this._result?s.dy`<ha-svg-icon .path="${l}"></ha-svg-icon>`:this.progress?s.dy`<ha-spinner size="small"></ha-spinner>`:s.Ld} </div> `: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:()=>s.iv`: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(e){t(e)}}))},73729:function(e,t,i){i.d(t,{i:()=>h});var a=i(44249),s=i(72621),o=i(74966),n=i(51408),r=i(57243),l=i(15093),d=i(76525);i(23334);const c=["button","ha-list-item"],h=(e,t)=>r.dy` <div class="header_title"> <ha-icon-button .label="${e?.localize("ui.common.close")??"Close"}" .path="${"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"}" dialogAction="close" class="header_button"></ha-icon-button> <span>${t}</span> </div> `;(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){this.contentElement?.scrollTo(e,t)}},{kind:"method",key:"renderHeading",value:function(){return r.dy`<slot name="heading"> ${(0,s.Z)(i,"renderHeading",this,3)([])} </slot>`}},{kind:"method",key:"firstUpdated",value:function(){(0,s.Z)(i,"firstUpdated",this,3)([]),this.suppressDefaultPressSelector=[this.suppressDefaultPressSelector,c].join(", "),this._updateScrolledAttribute(),this.contentElement?.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:()=>[n.W,r.iv`: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){var a=i(44249),s=i(72621),o=i(27323),n=i(33990),r=i(88540),l=i(57243),d=i(15093);(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:()=>!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:()=>[n.W,r.W,l.iv`: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){i.d(t,{MV:()=>d,Wg:()=>r,Xk:()=>n,aT:()=>a,b_:()=>o,yP:()=>l});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){i.a(e,(async function(e,a){try{i.r(t),i.d(t,{TTSTryDialog:()=>m});var s=i(44249),o=i(57243),n=i(15093),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];const g="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 m=(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:()=>!1},{kind:"field",decorators:[(0,n.SB)()],key:"_params",value:void 0},{kind:"field",decorators:[(0,n.SB)()],key:"_valid",value:()=>!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(){const e=this._params.language?.substring(0,2),t=this.hass.locale.language.substring(0,2);return e&&this._messages?.[e]?this._messages[e]:e===t?this.hass.localize("ui.dialogs.tts-try.message_example"):""}},{kind:"method",key:"render",value:function(){return this._params?o.dy` <ha-dialog open @closed="${this.closeDialog}" .heading="${(0,d.i)(this.hass,this.hass.localize("ui.dialogs.tts-try.header"))}"> <ha-textarea autogrow id="message" .label="${this.hass.localize("ui.dialogs.tts-try.message")}" .placeholder="${this.hass.localize("ui.dialogs.tts-try.message_placeholder")}" .value="${this._defaultMessage}" @input="${this._inputChanged}" ?dialogInitialFocus="${!this._defaultMessage}"> </ha-textarea> <ha-progress-button .progress="${this._loadingExample}" ?dialogInitialFocus="${Boolean(this._defaultMessage)}" slot="primaryAction" .label="${this.hass.localize("ui.dialogs.tts-try.play")}" @click="${this._playExample}" .disabled="${!this._valid}"> <ha-svg-icon slot="icon" .path="${g}"></ha-svg-icon> </ha-progress-button> </ha-dialog> `:o.Ld}},{kind:"method",key:"_inputChanged",value:async function(){this._valid=Boolean(this._messageInput?.value)}},{kind:"method",key:"_playExample",value:async function(){const e=this._messageInput?.value;if(!e)return;const t=this._params.engine,i=this._params.language,a=this._params.voice;i&&(this._messages={...this._messages,[i.substring(0,2)]:e}),this._loadingExample=!0;const s=new Audio;let o;s.play();try{o=(await(0,c.aT)(this.hass,{platform:t,message:e,language:i,options:{voice:a}})).path}catch(e){return this._loadingExample=!1,void(0,h.showAlertDialog)(this,{text:`Unable to load example. ${e.error||e.body||e}`,warning:!0})}s.src=o,s.addEventListener("canplaythrough",(()=>s.play())),s.addEventListener("playing",(()=>{this._loadingExample=!1})),s.addEventListener("error",(()=>{(0,h.showAlertDialog)(this,{title:"Error playing audio."}),this._loadingExample=!1}))}},{kind:"field",static:!0,key:"styles",value:()=>o.iv`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(e){a(e)}}))}}; //# sourceMappingURL=40003.0f6bd93deca85835.js.map