UNPKG

iobroker.lovelace

Version:

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

10 lines 13.2 kB
/*! For license information please see 44727.4859a499025017e3.js.LICENSE.txt */ "use strict";(self.webpackChunkhome_assistant_frontend=self.webpackChunkhome_assistant_frontend||[]).push([["44727"],{27323:function(t,e,i){i.d(e,{O:()=>g});i(71695),i(47021);var a=i(9065),o=i(1105),l=i(57243),n=i(50778),s=i(35359),d=i(20552),r=i(91928);let c,h,u=t=>t;const p={fromAttribute(t){return null!==t&&(""===t||t)},toAttribute(t){return"boolean"==typeof t?t?"":null:t}};class g extends o.P{constructor(){super(...arguments),this.rows=2,this.cols=20,this.charCounter=!1}render(){const t=this.charCounter&&-1!==this.maxLength,e=t&&"internal"===this.charCounter,i=t&&!e,a=!!this.helper||!!this.validationMessage||i,o={"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":e};return(0,l.dy)(c||(c=u` <label class="mdc-text-field mdc-text-field--textarea ${0}"> ${0} ${0} ${0} ${0} ${0} </label> ${0} `),(0,s.$)(o),this.renderRipple(),this.outlined?this.renderOutline():this.renderLabel(),this.renderInput(),this.renderCharCounter(e),this.renderLineRipple(),this.renderHelperText(a,i))}renderInput(){const t=this.label?"label":void 0,e=-1===this.minLength?void 0:this.minLength,i=-1===this.maxLength?void 0:this.maxLength,a=this.autocapitalize?this.autocapitalize:void 0;return(0,l.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,d.o)(t),(0,r.a)(this.value),this.rows,this.cols,this.disabled,this.placeholder,this.required,this.readOnly,(0,d.o)(e),(0,d.o)(i),(0,d.o)(""===this.name?void 0:this.name),(0,d.o)(this.inputMode),(0,d.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(t,e,i){i.d(e,{W:()=>o});let a;const o=(0,i(57243).iv)(a||(a=(t=>t)`.mdc-text-field{height:100%}.mdc-text-field__input{resize:none}`))},73729:function(t,e,i){i.d(e,{i:()=>m});var a=i(61701),o=i(72621),l=(i(22152),i(71695),i(47021),i(74966)),n=i(51408),s=i(57243),d=i(50778),r=i(76525);i(23334);let c,h,u,p=t=>t;const g=["button","ha-list-item"],m=(t,e)=>{var i;return(0,s.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==t?void 0:t.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",e)};(0,a.Z)([(0,d.Mo)("ha-dialog")],(function(t,e){class i extends e{constructor(...e){super(...e),t(this)}}return{F:i,d:[{kind:"field",key:r.gA,value:void 0},{kind:"method",key:"scrollToPos",value:function(t,e){var i;null===(i=this.contentElement)||void 0===i||i.scrollTo(t,e)}},{kind:"method",key:"renderHeading",value:function(){return(0,s.dy)(h||(h=p`<slot name="heading"> ${0} </slot>`),(0,o.Z)(i,"renderHeading",this,3)([]))}},{kind:"method",key:"firstUpdated",value:function(){var t;(0,o.Z)(i,"firstUpdated",this,3)([]),this.suppressDefaultPressSelector=[this.suppressDefaultPressSelector,g].join(", "),this._updateScrolledAttribute(),null===(t=this.contentElement)||void 0===t||t.addEventListener("scroll",this._onScroll,{passive:!0})}},{kind:"method",key:"disconnectedCallback",value:function(){(0,o.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,s.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)}`))]}}]}}),l.M)},40917:function(t,e,i){var a=i(61701),o=i(72621),l=(i(71695),i(47021),i(27323)),n=i(33990),s=i(88540),d=i(57243),r=i(50778);let c,h=t=>t;(0,a.Z)([(0,r.Mo)("ha-textarea")],(function(t,e){class i extends e{constructor(...e){super(...e),t(this)}}return{F:i,d:[{kind:"field",decorators:[(0,r.Cb)({type:Boolean,reflect:!0})],key:"autogrow",value(){return!1}},{kind:"method",key:"updated",value:function(t){(0,o.Z)(i,"updated",this,3)([t]),this.autogrow&&t.has("value")&&(this.mdcRoot.dataset.value=this.value+'=​"')}},{kind:"field",static:!0,key:"styles",value(){return[n.W,s.W,(0,d.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}}`))]}}]}}),l.O)},88529:function(t,e,i){i.r(e),i.d(e,{DialogTryTts:()=>k});var a=i(61701),o=(i(71695),i(9359),i(56475),i(70104),i(40251),i(47021),i(31622),i(87319),i(57243)),l=i(50778),n=i(68958),s=i(36522),d=i(49976),r=i(59847),c=i(47194),h=i(75278),u=i(73729),p=(i(92824),i(40917),i(14473)),g=i(89890),m=i(58968),v=i(76131),f=i(28008);let x,b,_,y=t=>t;let k=(0,a.Z)([(0,l.Mo)("dialog-cloud-try-tts")],(function(t,e){return{F:class extends e{constructor(...e){super(...e),t(this)}},d:[{kind:"field",decorators:[(0,l.Cb)({attribute:!1})],key:"hass",value:void 0},{kind:"field",decorators:[(0,l.SB)()],key:"_loadingExample",value(){return!1}},{kind:"field",decorators:[(0,l.SB)()],key:"_params",value:void 0},{kind:"field",decorators:[(0,l.IO)("#message")],key:"_messageInput",value:void 0},{kind:"field",decorators:[(0,n.t)({key:"cloudTtsTryMessage",state:!1,subscribe:!1})],key:"_message",value:void 0},{kind:"field",decorators:[(0,n.t)({key:"cloudTtsTryTarget",state:!1,subscribe:!1})],key:"_target",value:void 0},{kind:"method",key:"showDialog",value:function(t){this._params=t}},{kind:"method",key:"closeDialog",value:function(){this._params=void 0,(0,s.B)(this,"dialog-closed",{dialog:this.localName})}},{kind:"method",key:"render",value:function(){if(!this._params)return o.Ld;const t=this._target||"browser";return(0,o.dy)(x||(x=y` <ha-dialog open @closed="${0}" scrimClickAction escapeKeyAction .heading="${0}"> <div> <ha-textarea autogrow id="message" .label="${0}" .value="${0}"> </ha-textarea> <ha-select .label="${0}" id="target" .value="${0}" @selected="${0}" fixedMenuPosition naturalMenuWidth @closed="${0}"> <mwc-list-item value="browser"> ${0} </mwc-list-item> ${0} </ha-select> </div> <mwc-button slot="primaryAction" .label="${0}" @click="${0}" .disabled="${0}"> <ha-svg-icon slot="icon" .path="${0}"></ha-svg-icon> </mwc-button> <mwc-button slot="secondaryAction" .disabled="${0}" .label="${0}" @click="${0}"> <ha-svg-icon slot="icon" .path="${0}"></ha-svg-icon> </mwc-button> </ha-dialog> `),this.closeDialog,(0,u.i)(this.hass,this.hass.localize("ui.panel.config.cloud.account.tts.dialog.header")),this.hass.localize("ui.panel.config.cloud.account.tts.dialog.message"),this._message||this.hass.localize("ui.panel.config.cloud.account.tts.dialog.example_message",{name:this.hass.user.name}),this.hass.localize("ui.panel.config.cloud.account.tts.dialog.target"),t,this._handleTargetChanged,d.U,this.hass.localize("ui.panel.config.cloud.account.tts.dialog.target_browser"),Object.values(this.hass.states).filter((t=>"media_player"===(0,r.N)(t)&&(0,h.e)(t,g.yZ.PLAY_MEDIA))).map((t=>(0,o.dy)(b||(b=y` <mwc-list-item .value="${0}"> ${0} </mwc-list-item> `),t.entity_id,(0,c.C)(t)))),this.hass.localize("ui.panel.config.cloud.account.tts.dialog.play"),this._playExample,this._loadingExample,"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","browser"===t,this.hass.localize("ui.panel.config.cloud.account.tts.dialog.create_automation"),this._createAutomation,"M12,2A2,2 0 0,1 14,4C14,4.74 13.6,5.39 13,5.73V7H14A7,7 0 0,1 21,14H22A1,1 0 0,1 23,15V18A1,1 0 0,1 22,19H21V20A2,2 0 0,1 19,22H5A2,2 0 0,1 3,20V19H2A1,1 0 0,1 1,18V15A1,1 0 0,1 2,14H3A7,7 0 0,1 10,7H11V5.73C10.4,5.39 10,4.74 10,4A2,2 0 0,1 12,2M7.5,13A2.5,2.5 0 0,0 5,15.5A2.5,2.5 0 0,0 7.5,18A2.5,2.5 0 0,0 10,15.5A2.5,2.5 0 0,0 7.5,13M16.5,13A2.5,2.5 0 0,0 14,15.5A2.5,2.5 0 0,0 16.5,18A2.5,2.5 0 0,0 19,15.5A2.5,2.5 0 0,0 16.5,13Z")}},{kind:"method",key:"_handleTargetChanged",value:function(t){this._target=t.target.value,this.requestUpdate("_target")}},{kind:"method",key:"_playExample",value:async function(){var t;const e=null===(t=this._messageInput)||void 0===t?void 0:t.value;if(e)if(this._message=e,"browser"===this._target){const t=new Audio;t.play(),this._playBrowser(e,t)}else this.hass.callService("tts","cloud_say",{entity_id:this._target,message:e})}},{kind:"method",key:"_createAutomation",value:function(){const t=this._messageInput.value;this._message=t,(0,p.Ip)({action:[{service:"tts.cloud_say",data:{entity_id:this._target,message:t}}]}),this.closeDialog()}},{kind:"method",key:"_playBrowser",value:async function(t,e){this._loadingExample=!0;const i=this._params.defaultVoice[0],a=this._params.defaultVoice[1];let o;try{o=(await(0,m.aT)(this.hass,{platform:"cloud",message:t,language:i,options:{voice:a}})).path}catch(l){return this._loadingExample=!1,void(0,v.showAlertDialog)(this,{text:`Unable to load example. ${l.error||l.body||l}`,warning:!0})}e.src=o,e.addEventListener("canplaythrough",(()=>{e.play()})),e.addEventListener("playing",(()=>{this._loadingExample=!1})),e.addEventListener("error",(()=>{(0,v.showAlertDialog)(this,{title:"Error playing audio."}),this._loadingExample=!1}))}},{kind:"get",static:!0,key:"styles",value:function(){return[f.yu,(0,o.iv)(_||(_=y`ha-dialog{--mdc-dialog-max-width:500px}ha-select,ha-textarea{width:100%}ha-select{margin-top:8px}`))]}}]}}),o.oi)}}]); //# sourceMappingURL=44727.4859a499025017e3.js.map