UNPKG

iobroker.lovelace

Version:

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

2 lines 19 kB
"use strict";(self.webpackChunkhome_assistant_frontend=self.webpackChunkhome_assistant_frontend||[]).push([["51747"],{51784:function(e,t,i){i.d(t,{dJ:()=>k,zB:()=>y});var a=i(61701),o=i(72621),n=(i(52247),i(71695),i(19423),i(40251),i(47021),i(67840)),s=i(88854),r=i(57243),d=i(50778);let l,c,u=e=>e;n.A.addInitializer((async e=>{await e.updateComplete;const t=e;t.dialog.prepend(t.scrim),t.scrim.style.inset=0,t.scrim.style.zIndex=0;const{getOpenAnimation:i,getCloseAnimation:a}=t;t.getOpenAnimation=()=>{var e,t;const a=i.call(void 0);return a.container=[...null!==(e=a.container)&&void 0!==e?e:[],...null!==(t=a.dialog)&&void 0!==t?t:[]],a.dialog=[],a},t.getCloseAnimation=()=>{var e,t;const i=a.call(void 0);return i.container=[...null!==(e=i.container)&&void 0!==e?e:[],...null!==(t=i.dialog)&&void 0!==t?t:[]],i.dialog=[],i}}));(0,a.Z)([(0,d.Mo)("ha-md-dialog")],(function(e,t){class a extends t{constructor(){super(),e(this),this.addEventListener("cancel",this._handleCancel),"function"!=typeof HTMLDialogElement&&(this.addEventListener("open",this._handleOpen),c||(c=i.e("73854").then(i.bind(i,85893)))),void 0===this.animate&&(this.quick=!0),void 0===this.animate&&(this.quick=!0)}}return{F:a,d:[{kind:"field",decorators:[(0,d.Cb)({attribute:"disable-cancel-action",type:Boolean})],key:"disableCancelAction",value(){return!1}},{kind:"field",key:"_polyfillDialogRegistered",value(){return!1}},{kind:"method",key:"_handleOpen",value:async function(e){var t;if(e.preventDefault(),this._polyfillDialogRegistered)return;this._polyfillDialogRegistered=!0,this._loadPolyfillStylesheet("/static/polyfills/dialog-polyfill.css");const i=null===(t=this.shadowRoot)||void 0===t?void 0:t.querySelector("dialog");(await c).default.registerDialog(i),this.removeEventListener("open",this._handleOpen),this.show()}},{kind:"method",key:"_loadPolyfillStylesheet",value:async function(e){const t=document.createElement("link");return t.rel="stylesheet",t.href=e,new Promise(((i,a)=>{var o;t.onload=()=>i(),t.onerror=()=>a(new Error(`Stylesheet failed to load: ${e}`)),null===(o=this.shadowRoot)||void 0===o||o.appendChild(t)}))}},{kind:"method",key:"_handleCancel",value:function(e){if(this.disableCancelAction){var t;e.preventDefault();const i=null===(t=this.shadowRoot)||void 0===t?void 0:t.querySelector("dialog .container");void 0!==this.animate&&(null==i||i.animate([{transform:"rotate(-1deg)","animation-timing-function":"ease-in"},{transform:"rotate(1.5deg)","animation-timing-function":"ease-out"},{transform:"rotate(0deg)","animation-timing-function":"ease-in"}],{duration:200,iterations:2}))}}},{kind:"field",static:!0,key:"styles",value(){return[...(0,o.Z)(a,"styles",this),(0,r.iv)(l||(l=u`:host{--md-dialog-container-color:var(--card-background-color);--md-dialog-headline-color:var(--primary-text-color);--md-dialog-supporting-text-color:var(--primary-text-color);--md-sys-color-scrim:#000000;--md-dialog-headline-weight:400;--md-dialog-headline-size:1.574rem;--md-dialog-supporting-text-size:1rem;--md-dialog-supporting-text-line-height:1.5rem}:host([type=alert]){min-width:320px}@media all and (max-width:450px),all and (max-height:500px){:host(:not([type=alert])){min-width:calc(100vw - env(safe-area-inset-right) - env(safe-area-inset-left));max-width:calc(100vw - env(safe-area-inset-right) - env(safe-area-inset-left));min-height:100%;max-height:100%;--md-dialog-container-shape:0}}::slotted(ha-dialog-header[slot=headline]){display:contents}.scroller{overflow:var(--dialog-content-overflow,auto)}slot[name=content]::slotted(*){padding:var(--dialog-content-padding,24px)}.scrim{z-index:10}`))]}}]}}),n.A);const h=Object.assign(Object.assign({},s.I),{},{dialog:[[[{transform:"translateY(50px)"},{transform:"translateY(0)"}],{duration:500,easing:"cubic-bezier(.3,0,0,1)"}]],container:[[[{opacity:0},{opacity:1}],{duration:50,easing:"linear",pseudoElement:"::before"}]]}),p=Object.assign(Object.assign({},s.G),{},{dialog:[[[{transform:"translateY(0)"},{transform:"translateY(50px)"}],{duration:150,easing:"cubic-bezier(.3,0,0,1)"}]],container:[[[{opacity:"1"},{opacity:"0"}],{delay:100,duration:50,easing:"linear",pseudoElement:"::before"}]]}),k=()=>window.matchMedia("all and (max-width: 450px), all and (max-height: 500px)").matches?h:s.I,y=()=>window.matchMedia("all and (max-width: 450px), all and (max-height: 500px)").matches?p:s.G},34326:function(e,t,i){var a=i(61701),o=(i(71695),i(47021),i(57243)),n=i(50778);i(23334),i(83166);let s,r,d,l=e=>e;(0,a.Z)([(0,n.Mo)("ha-password-field")],(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.Cb)({type:Boolean})],key:"invalid",value:void 0},{kind:"field",decorators:[(0,n.Cb)({attribute:"error-message"})],key:"errorMessage",value:void 0},{kind:"field",decorators:[(0,n.Cb)({type:Boolean})],key:"icon",value(){return!1}},{kind:"field",decorators:[(0,n.Cb)({type:Boolean})],key:"iconTrailing",value(){return!1}},{kind:"field",decorators:[(0,n.Cb)()],key:"autocomplete",value:void 0},{kind:"field",decorators:[(0,n.Cb)()],key:"autocorrect",value:void 0},{kind:"field",decorators:[(0,n.Cb)({attribute:"input-spellcheck"})],key:"inputSpellcheck",value:void 0},{kind:"field",decorators:[(0,n.Cb)({type:String})],key:"value",value(){return""}},{kind:"field",decorators:[(0,n.Cb)({type:String})],key:"placeholder",value(){return""}},{kind:"field",decorators:[(0,n.Cb)({type:String})],key:"label",value(){return""}},{kind:"field",decorators:[(0,n.Cb)({type:Boolean,reflect:!0})],key:"disabled",value(){return!1}},{kind:"field",decorators:[(0,n.Cb)({type:Boolean})],key:"required",value(){return!1}},{kind:"field",decorators:[(0,n.Cb)({type:Number})],key:"minLength",value(){return-1}},{kind:"field",decorators:[(0,n.Cb)({type:Number})],key:"maxLength",value(){return-1}},{kind:"field",decorators:[(0,n.Cb)({type:Boolean,reflect:!0})],key:"outlined",value(){return!1}},{kind:"field",decorators:[(0,n.Cb)({type:String})],key:"helper",value(){return""}},{kind:"field",decorators:[(0,n.Cb)({type:Boolean})],key:"validateOnInitialRender",value(){return!1}},{kind:"field",decorators:[(0,n.Cb)({type:String})],key:"validationMessage",value(){return""}},{kind:"field",decorators:[(0,n.Cb)({type:Boolean})],key:"autoValidate",value(){return!1}},{kind:"field",decorators:[(0,n.Cb)({type:String})],key:"pattern",value(){return""}},{kind:"field",decorators:[(0,n.Cb)({type:Number})],key:"size",value(){return null}},{kind:"field",decorators:[(0,n.Cb)({type:Boolean})],key:"helperPersistent",value(){return!1}},{kind:"field",decorators:[(0,n.Cb)({type:Boolean})],key:"charCounter",value(){return!1}},{kind:"field",decorators:[(0,n.Cb)({type:Boolean})],key:"endAligned",value(){return!1}},{kind:"field",decorators:[(0,n.Cb)({type:String})],key:"prefix",value(){return""}},{kind:"field",decorators:[(0,n.Cb)({type:String})],key:"suffix",value(){return""}},{kind:"field",decorators:[(0,n.Cb)({type:String})],key:"name",value(){return""}},{kind:"field",decorators:[(0,n.Cb)({type:String,attribute:"input-mode"})],key:"inputMode",value:void 0},{kind:"field",decorators:[(0,n.Cb)({type:Boolean})],key:"readOnly",value(){return!1}},{kind:"field",decorators:[(0,n.Cb)({attribute:!1,type:String})],key:"autocapitalize",value(){return""}},{kind:"field",decorators:[(0,n.SB)()],key:"_unmaskedPassword",value(){return!1}},{kind:"field",decorators:[(0,n.IO)("ha-textfield")],key:"_textField",value:void 0},{kind:"method",key:"render",value:function(){var e;return(0,o.dy)(s||(s=l`<ha-textfield .invalid="${0}" .errorMessage="${0}" .icon="${0}" .iconTrailing="${0}" .autocomplete="${0}" .autocorrect="${0}" .inputSpellcheck="${0}" .value="${0}" .placeholder="${0}" .label="${0}" .disabled="${0}" .required="${0}" .minLength="${0}" .maxLength="${0}" .outlined="${0}" .helper="${0}" .validateOnInitialRender="${0}" .validationMessage="${0}" .autoValidate="${0}" .pattern="${0}" .size="${0}" .helperPersistent="${0}" .charCounter="${0}" .endAligned="${0}" .prefix="${0}" .name="${0}" .inputMode="${0}" .readOnly="${0}" .autocapitalize="${0}" .type="${0}" .suffix="${0}" @input="${0}" @change="${0}"></ha-textfield> <ha-icon-button .label="${0}" @click="${0}" .path="${0}"></ha-icon-button>`),this.invalid,this.errorMessage,this.icon,this.iconTrailing,this.autocomplete,this.autocorrect,this.inputSpellcheck,this.value,this.placeholder,this.label,this.disabled,this.required,this.minLength,this.maxLength,this.outlined,this.helper,this.validateOnInitialRender,this.validationMessage,this.autoValidate,this.pattern,this.size,this.helperPersistent,this.charCounter,this.endAligned,this.prefix,this.name,this.inputMode,this.readOnly,this.autocapitalize,this._unmaskedPassword?"text":"password",(0,o.dy)(r||(r=l`<div style="width:24px"></div>`)),this._handleInputEvent,this._handleChangeEvent,(null===(e=this.hass)||void 0===e?void 0:e.localize(this._unmaskedPassword?"ui.components.selectors.text.hide_password":"ui.components.selectors.text.show_password"))||(this._unmaskedPassword?"Hide password":"Show password"),this._toggleUnmaskedPassword,this._unmaskedPassword?"M11.83,9L15,12.16C15,12.11 15,12.05 15,12A3,3 0 0,0 12,9C11.94,9 11.89,9 11.83,9M7.53,9.8L9.08,11.35C9.03,11.56 9,11.77 9,12A3,3 0 0,0 12,15C12.22,15 12.44,14.97 12.65,14.92L14.2,16.47C13.53,16.8 12.79,17 12,17A5,5 0 0,1 7,12C7,11.21 7.2,10.47 7.53,9.8M2,4.27L4.28,6.55L4.73,7C3.08,8.3 1.78,10 1,12C2.73,16.39 7,19.5 12,19.5C13.55,19.5 15.03,19.2 16.38,18.66L16.81,19.08L19.73,22L21,20.73L3.27,3M12,7A5,5 0 0,1 17,12C17,12.64 16.87,13.26 16.64,13.82L19.57,16.75C21.07,15.5 22.27,13.86 23,12C21.27,7.61 17,4.5 12,4.5C10.6,4.5 9.26,4.75 8,5.2L10.17,7.35C10.74,7.13 11.35,7 12,7Z":"M12,9A3,3 0 0,0 9,12A3,3 0 0,0 12,15A3,3 0 0,0 15,12A3,3 0 0,0 12,9M12,17A5,5 0 0,1 7,12A5,5 0 0,1 12,7A5,5 0 0,1 17,12A5,5 0 0,1 12,17M12,4.5C7,4.5 2.73,7.61 1,12C2.73,16.39 7,19.5 12,19.5C17,19.5 21.27,16.39 23,12C21.27,7.61 17,4.5 12,4.5Z")}},{kind:"method",key:"focus",value:function(){this._textField.focus()}},{kind:"method",key:"checkValidity",value:function(){return this._textField.checkValidity()}},{kind:"method",key:"reportValidity",value:function(){return this._textField.reportValidity()}},{kind:"method",key:"setCustomValidity",value:function(e){return this._textField.setCustomValidity(e)}},{kind:"method",key:"layout",value:function(){return this._textField.layout()}},{kind:"method",key:"_toggleUnmaskedPassword",value:function(){this._unmaskedPassword=!this._unmaskedPassword}},{kind:"method",decorators:[(0,n.hO)({passive:!0})],key:"_handleInputEvent",value:function(e){this.value=e.target.value}},{kind:"method",decorators:[(0,n.hO)({passive:!0})],key:"_handleChangeEvent",value:function(e){this.value=e.target.value,this._reDispatchEvent(e)}},{kind:"method",key:"_reDispatchEvent",value:function(e){const t=new Event(e.type,e);this.dispatchEvent(t)}},{kind:"field",static:!0,key:"styles",value(){return(0,o.iv)(d||(d=l`:host{display:block;position:relative}ha-textfield{width:100%}ha-icon-button{position:absolute;top:8px;right:8px;inset-inline-start:initial;inset-inline-end:8px;--mdc-icon-button-size:40px;--mdc-icon-size:20px;color:var(--secondary-text-color);direction:var(--direction)}`))}}]}}),o.oi)},60906:function(e,t,i){i.a(e,(async function(e,a){try{i.r(t);var o=i(61701),n=(i(71695),i(9359),i(70104),i(40251),i(47021),i(57243)),s=i(50778),r=i(36522),d=(i(59826),i(17170)),l=(i(95198),i(34326),i(72344)),c=(i(99426),i(23334),i(51784),i(37583),i(26779)),u=i(36029),h=i(28008),p=e([d,c]);[d,c]=p.then?(await p)():p;let k,y,v,g,f,m,_,b,C,w,x,$,L=e=>e;const S="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",z={encryption_key_type:"config",custom_encryption_key:""},B=["confirm","encryption","progress"];(0,o.Z)([(0,s.Mo)("ha-dialog-restore-backup")],(function(e,t){return{F:class extends t{constructor(...t){super(...t),e(this)}},d:[{kind:"field",decorators:[(0,s.Cb)({attribute:!1})],key:"hass",value:void 0},{kind:"field",decorators:[(0,s.SB)()],key:"_step",value:void 0},{kind:"field",decorators:[(0,s.SB)()],key:"_params",value:void 0},{kind:"field",decorators:[(0,s.SB)()],key:"_formData",value:void 0},{kind:"field",decorators:[(0,s.SB)()],key:"_backupEncryptionKey",value:void 0},{kind:"field",decorators:[(0,s.SB)()],key:"_userPassword",value:void 0},{kind:"field",decorators:[(0,s.SB)()],key:"_usedUserInput",value(){return!1}},{kind:"field",decorators:[(0,s.SB)()],key:"_error",value:void 0},{kind:"field",decorators:[(0,s.SB)()],key:"_state",value:void 0},{kind:"field",decorators:[(0,s.SB)()],key:"_stage",value:void 0},{kind:"field",decorators:[(0,s.SB)()],key:"_unsub",value:void 0},{kind:"field",decorators:[(0,s.IO)("ha-md-dialog")],key:"_dialog",value:void 0},{kind:"method",key:"showDialog",value:async function(e){var t;this._params=e,this._formData=z,this._userPassword=void 0,this._usedUserInput=!1,this._error=void 0,this._state=void 0,this._stage=void 0;const i=Object.keys(this._params.backup.agents),a=(0,c.OT)(i);(null===(t=this._params.backup.agents[a])||void 0===t?void 0:t.protected)?(this._backupEncryptionKey=await this._fetchEncryptionKey(),this._backupEncryptionKey?this._step=B[0]:this._step=B[1]):this._step=B[0]}},{kind:"method",key:"closeDialog",value:function(){var e;return null===(e=this._dialog)||void 0===e||e.close(),!0}},{kind:"method",key:"_dialogClosed",value:function(){this._formData=void 0,this._params=void 0,this._backupEncryptionKey=void 0,this._userPassword=void 0,this._usedUserInput=!1,this._error=void 0,this._state=void 0,this._stage=void 0,this._step=void 0,this._unsubscribe(),(0,r.B)(this,"dialog-closed",{dialog:this.localName})}},{kind:"method",key:"_fetchEncryptionKey",value:async function(){try{const{config:e}=await(0,c.LG)(this.hass);return e.create_backup.password||void 0}catch(e){return void console.error(e)}}},{kind:"method",key:"render",value:function(){if(!this._step||!this._params||!this._formData)return n.Ld;const e=this.hass.localize("ui.panel.config.backup.dialogs.restore.title");return(0,n.dy)(k||(k=L` <ha-md-dialog open @closed="${0}"> <ha-dialog-header slot="headline"> <ha-icon-button slot="navigationIcon" .label="${0}" .path="${0}" @click="${0}"></ha-icon-button> <span slot="title" .title="${0}">${0}</span> </ha-dialog-header> <div slot="content" class="content"> ${0} </div> <div slot="actions"> ${0} </div> </ha-md-dialog> `),this._dialogClosed,this.hass.localize("ui.common.close"),S,this.closeDialog,e,e,this._error?(0,n.dy)(y||(y=L`<ha-alert alert-type="error">${0}</ha-alert>`),this._error):"confirm"===this._step?this._renderConfirm():"encryption"===this._step?this._renderEncryption():this._renderProgress(),this._error?(0,n.dy)(v||(v=L` <ha-button @click="${0}"> ${0} </ha-button> `),this.closeDialog,this.hass.localize("ui.common.close")):"confirm"===this._step||"encryption"===this._step?this._renderConfirmActions():n.Ld)}},{kind:"method",key:"_renderConfirm",value:function(){return(0,n.dy)(g||(g=L` <p> ${0} </p> `),this.hass.localize("ui.panel.config.backup.dialogs.restore.confirm.description"))}},{kind:"method",key:"_renderEncryptionIntro",value:function(){return this._usedUserInput?(0,n.dy)(f||(f=L` ${0} `),this.hass.localize("ui.panel.config.backup.dialogs.restore.encryption.incorrect_key")):this._backupEncryptionKey?(0,n.dy)(m||(m=L` ${0} ${0} `),this.hass.localize("ui.panel.config.backup.dialogs.restore.encryption.different_key"),this._params.selectedData.homeassistant_included?(0,n.dy)(_||(_=L` <ha-alert alert-type="warning"> ${0} </ha-alert> `),this.hass.localize("ui.panel.config.backup.dialogs.restore.encryption.warning")):n.Ld):(0,n.dy)(b||(b=L` ${0} `),this.hass.localize("ui.panel.config.backup.dialogs.restore.encryption.description"))}},{kind:"method",key:"_renderEncryption",value:function(){return(0,n.dy)(C||(C=L` ${0} <ha-password-field @input="${0}" .label="${0}" .value="${0}"></ha-password-field> `),this._renderEncryptionIntro(),this._passwordChanged,this.hass.localize("ui.panel.config.backup.dialogs.restore.encryption.input_label"),this._userPassword||"")}},{kind:"method",key:"_renderConfirmActions",value:function(){return(0,n.dy)(w||(w=L` <ha-button @click="${0}"> ${0} </ha-button> <ha-button @click="${0}" destructive> ${0} </ha-button> `),this.closeDialog,this.hass.localize("ui.common.cancel"),this._restoreBackup,this.hass.localize("ui.panel.config.backup.dialogs.restore.actions.restore"))}},{kind:"method",key:"_renderProgress",value:function(){return(0,n.dy)(x||(x=L`<div class="centered"> <ha-spinner></ha-spinner> <p> ${0} </p> </div>`),this.hass.connected?this._restoreState():this.hass.localize("ui.panel.config.backup.dialogs.restore.progress.restarting"))}},{kind:"method",key:"_passwordChanged",value:function(e){this._userPassword=e.target.value}},{kind:"method",key:"_restoreBackup",value:async function(){this._unsubscribe(),this._state=void 0,this._stage=void 0,this._error=void 0;try{this._step="progress",this._subscribeBackupEvents(),await this._doRestoreBackup(this._userPassword||this._backupEncryptionKey)}catch(e){await this._unsubscribe(),"password_incorrect"===e.code?(this._error=void 0,this._userPassword&&(this._usedUserInput=!0),this._step="encryption"):this._error=e.message}}},{kind:"method",key:"_subscribeBackupEvents",value:function(){this._unsub=(0,u.q)(this.hass,(e=>{"idle"===e.manager_state&&"in_progress"===this._state&&this.closeDialog(),"restore_backup"===e.manager_state&&(this._state=e.state,"completed"===e.state&&this.closeDialog(),"failed"===e.state&&(this._error=this.hass.localize("ui.panel.config.backup.dialogs.restore.restore_failed")),"in_progress"===e.state&&(this._stage=e.stage))}))}},{kind:"method",key:"_unsubscribe",value:function(){if(this._unsub){const e=this._unsub.then((e=>e()));return this._unsub=void 0,e}}},{kind:"method",key:"_restoreState",value:function(){return this._stage?this.hass.localize(`ui.panel.config.backup.overview.progress.description.restore_backup.${this._stage}`):this.hass.localize("ui.panel.config.backup.dialogs.restore.progress.restoring")}},{kind:"method",key:"_doRestoreBackup",value:async function(e){if(!this._params)return;const t=Object.keys(this._params.backup.agents),i=(0,c.OT)(t),{addons:a,database_included:o,homeassistant_included:n,folders:s}=this._params.selectedData,r={backup_id:this._params.backup.backup_id,agent_id:i,password:e,restore_database:o,restore_homeassistant:n};(0,l.p)(this.hass,"hassio")&&(r.restore_addons=a.map((e=>e.slug)),r.restore_folders=s),await(0,c.pi)(this.hass,r)}},{kind:"get",static:!0,key:"styles",value:function(){return[h.Qx,h.yu,(0,n.iv)($||($=L`ha-md-dialog{max-width:500px;width:100%}.content p{margin:0 0 16px}.centered{display:flex;flex-direction:column;align-items:center}ha-spinner{margin-bottom:16px}ha-alert[alert-type=warning]{display:block;margin-top:16px}ha-password-field{display:block;margin-top:16px}`))]}}]}}),n.oi);a()}catch(k){a(k)}}))}}]); //# sourceMappingURL=51747.27f8aebd554d5193.js.map