export const __rspack_esm_id=22450;export const __rspack_esm_ids=[22450];export const __webpack_modules__={46729(a,t,s){s.a(a,async function(a,o){try{s.r(t);s(18111),s(61701);var e=s(15697),i=s(57527),l=s(79224),h=s(148),r=s(98747),d=(s(90507),s(54939)),c=s(15466),_=s(73651),n=s(2869),p=s(69779),g=s(13288),v=s(76730),b=a([r,d,c,_]);[r,d,c,_]=b.then?(await b)():b;class u extends i.WF{showDialog(a){this._config=a.lovelaceConfig,this._fromUrlPath=a.urlPath,this._params=a,this._open=!0,this._getDashboards()}closeDialog(){this._open&&(0,h.r)(this,"dialog-closed",{dialog:this.localName}),this._saving=!1,this._dashboards=void 0,this._toUrlPath=void 0,this._open=!1,this._params=void 0}_dialogClosed(){this.closeDialog()}render(){if(!this._params)return i.s6;const a=this._params.header||this.hass.localize("ui.panel.lovelace.editor.select_dashboard.header");return i.qy` <ha-dialog .open=${this._open} header-title=${a} .preventScrimClose=${this._saving} @closed=${this._dialogClosed}> ${this._dashboards&&!this._saving?i.qy` <ha-select .label=${this.hass.localize("ui.panel.lovelace.editor.select_view.dashboard_label")} @selected=${this._dashboardChanged} .value=${this._toUrlPath||""} .options=${this._dashboards.map(a=>({value:a.url_path,label:a.title,disabled:"storage"!==a.mode||a.url_path===this._fromUrlPath||"lovelace"===a.url_path&&null===this._fromUrlPath}))}></ha-select> `:i.qy`<div class="loading"> <ha-spinner size="medium"></ha-spinner> </div>`} <ha-dialog-footer slot="footer"> <ha-button slot="secondaryAction" appearance="plain" @click=${this.closeDialog} .disabled=${this._saving}> ${this.hass.localize("ui.common.cancel")} </ha-button> <ha-button slot="primaryAction" @click=${this._selectDashboard} .disabled=${!this._config||this._fromUrlPath===this._toUrlPath||this._saving}> ${this._params.actionLabel||this.hass.localize("ui.common.move")} </ha-button> </ha-dialog-footer> </ha-dialog> `}async _getDashboards(){let a=this._params.dashboards;if(!a)try{a=await(0,n.SJ)(this.hass)}catch(a){console.error("Error fetching dashboards:",a),(0,g.showAlertDialog)(this,{title:this.hass.localize("ui.panel.lovelace.editor.select_dashboard.error_title"),text:this.hass.localize("ui.panel.lovelace.editor.select_dashboard.error_text")})}this._dashboards=[{id:"lovelace",url_path:"lovelace",require_admin:!1,show_in_sidebar:!0,title:this.hass.localize("ui.common.default"),mode:this.hass.panels.lovelace?.config?.mode},...a??[]];const t=(0,p.EN)(this.hass),s=this._fromUrlPath||t;for(const a of this._dashboards)if(a.url_path!==s){this._toUrlPath=a.url_path;break}}async _dashboardChanged(a){const t=a.detail.value;t!==this._toUrlPath&&(this._toUrlPath=t)}async _selectDashboard(){this._saving=!0,"lovelace"===this._toUrlPath&&(this._toUrlPath=null),this._params.dashboardSelectedCallback(this._toUrlPath),this.closeDialog()}static get styles(){return[v.nA,i.AH`ha-select{width:100%}.loading{justify-content:center;display:flex}`]}constructor(...a){super(...a),this._saving=!1,this._open=!1}}(0,e.Cg)([(0,l.wk)()],u.prototype,"_params",void 0),(0,e.Cg)([(0,l.wk)()],u.prototype,"_dashboards",void 0),(0,e.Cg)([(0,l.wk)()],u.prototype,"_fromUrlPath",void 0),(0,e.Cg)([(0,l.wk)()],u.prototype,"_toUrlPath",void 0),(0,e.Cg)([(0,l.wk)()],u.prototype,"_config",void 0),(0,e.Cg)([(0,l.wk)()],u.prototype,"_saving",void 0),(0,e.Cg)([(0,l.wk)()],u.prototype,"_open",void 0),u=(0,e.Cg)([(0,l.EM)("hui-dialog-select-dashboard")],u),s.d(t,{HuiDialogSelectDashboard:()=>u}),o()}catch(a){o(a)}})}};
//# sourceMappingURL=22450.d4e5c10dd2985510.js.map