export const __rspack_esm_id="11966";export const __rspack_esm_ids=["11966"];export const __webpack_modules__={50157(t,e,i){i.a(t,async function(t,o){try{i.r(e);var s=i(62826),a=i(96196),n=i(97735),c=i(1087),r=i(63130),p=i(18350),l=(i(93444),i(26300)),h=i(72554),d=(i(17308),i(2846),i(71418)),y=i(31420),_=i(14503),g=i(81619),m=t([p,l,h,d,y]);[p,l,h,d,y]=m.then?(await m)():m;const u="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z",k="M5,20H19V18H5M19,9H15V3H9V9H5L12,16L19,9Z",b=["key","done"];class v extends a.WF{showDialog(t){this._params=t,this._step=b[0],this._open=!0,this._newEncryptionKey=(0,y.cq)()}closeDialog(){return this._open=!1,!0}_dialogClosed(){this._params?.cancel&&this._params.cancel(),this._step=void 0,this._params=void 0,this._newEncryptionKey=void 0,this._open=!1,(0,c.r)(this,"dialog-closed",{dialog:this.localName})}_done(){this._params?.submit(!0),this.closeDialog()}_nextStep(){const t=b.indexOf(this._step);t!==b.length-1&&(this._step=b[t+1])}render(){if(!this._params||!this._step)return a.s6;const t="key"===this._step?this.hass.localize("ui.panel.config.backup.dialogs.set_encryption_key.key.title"):"";return a.qy` <ha-dialog .hass="${this.hass}" .open="${this._open}" header-title="${t}" prevent-scrim-close @closed="${this._dialogClosed}"> ${this._renderStepContent()} <ha-dialog-footer slot="footer"> ${"key"===this._step?a.qy` <ha-button slot="primaryAction" @click="${this._submit}" .disabled="${!this._newEncryptionKey}"> ${this.hass.localize("ui.panel.config.backup.dialogs.set_encryption_key.actions.set")} </ha-button> `:a.qy` <ha-button slot="primaryAction" @click="${this._done}"> ${this.hass.localize("ui.panel.config.backup.dialogs.set_encryption_key.actions.done")} </ha-button> `} </ha-dialog-footer> </ha-dialog> `}_renderStepContent(){switch(this._step){case"key":return a.qy` <p> ${this.hass.localize("ui.panel.config.backup.dialogs.set_encryption_key.new.description")} </p> <div class="encryption-key"> <p>${this._newEncryptionKey}</p> <ha-icon-button .path="${u}" @click="${this._copyKeyToClipboard}"></ha-icon-button> </div> <ha-md-list> <ha-md-list-item> <span slot="headline"> ${this.hass.localize("ui.panel.config.backup.encryption_key.download_emergency_kit")} </span> <span slot="supporting-text"> ${this.hass.localize("ui.panel.config.backup.encryption_key.download_emergency_kit_description")} </span> <ha-button size="small" appearance="plain" slot="end" @click="${this._download}"> <ha-svg-icon .path="${k}" slot="start"></ha-svg-icon> ${this.hass.localize("ui.panel.config.backup.encryption_key.download_emergency_kit_action")} </ha-button> </ha-md-list-item> </ha-md-list> `;case"done":return a.qy` <div class="done"> <img src="/static/images/voice-assistant/hi.png" alt="Casita Home Assistant logo"> <h1> ${this.hass.localize("ui.panel.config.backup.dialogs.set_encryption_key.done.title")} </h1> </div> `}return a.s6}async _copyKeyToClipboard(){await(0,r.l)(this._newEncryptionKey,this.renderRoot.querySelector("div")),(0,g.P)(this,{message:this.hass.localize("ui.common.copied_clipboard")})}_download(){this._newEncryptionKey&&(0,y.Sx)(this.hass,this._newEncryptionKey)}async _submit(){this._newEncryptionKey&&(this._params.saveKey(this._newEncryptionKey),this._nextStep())}static get styles(){return[_.RF,_.nA,a.AH`ha-dialog{--dialog-content-padding:var(--ha-space-2) var(--ha-space-6)}ha-md-list{background:0 0;--md-list-item-leading-space:0;--md-list-item-trailing-space:0}.encryption-key{border:1px solid var(--divider-color);background-color:var(--primary-background-color);border-radius:var(--ha-border-radius-md);padding:16px;display:flex;flex-direction:row;align-items:center;gap:var(--ha-space-6)}.encryption-key p{margin:0;flex:1;font-size:var(--ha-font-size-xl);font-family:var(--ha-font-family-code);font-style:normal;font-weight:var(--ha-font-weight-normal);line-height:var(--ha-line-height-condensed);text-align:center}.encryption-key ha-icon-button{flex:none;margin:-16px}p{margin-top:0}.done{text-align:center}`]}constructor(...t){super(...t),this._open=!1}}(0,s.Cg)([(0,n.MZ)({attribute:!1})],v.prototype,"hass",void 0),(0,s.Cg)([(0,n.wk)()],v.prototype,"_open",void 0),(0,s.Cg)([(0,n.wk)()],v.prototype,"_step",void 0),(0,s.Cg)([(0,n.wk)()],v.prototype,"_params",void 0),(0,s.Cg)([(0,n.wk)()],v.prototype,"_newEncryptionKey",void 0),v=(0,s.Cg)([(0,n.EM)("ha-dialog-set-backup-encryption-key")],v),o()}catch(t){o(t)}})}};
//# sourceMappingURL=11966.d22fb9db5efb8c88.js.map