export const __rspack_esm_id=93520;export const __rspack_esm_ids=[93520];export const __webpack_modules__={34955(a,t,e){e.d(t,{L3:()=>p,uG:()=>c,QI:()=>u,bQ:()=>_,WT:()=>h,ft:()=>o,gs:()=>d});e(44114);var i=e(34883),s=e(57230);const r=a=>a.sendMessagePromise({type:"config/area_registry/list"}),n=(a,t)=>a.subscribeEvents((0,s.s)(()=>r(a).then(a=>t.setState(a,!0)),500,!0),"area_registry_updated"),o=(a,t)=>(0,i.N)("_areaRegistry",r,n,a,t),p=(a,t)=>a.callWS({type:"config/area_registry/create",...t}),d=(a,t,e)=>a.callWS({type:"config/area_registry/update",area_id:t,...e}),c=(a,t)=>a.callWS({type:"config/area_registry/delete",area_id:t}),h=(a,t)=>a.callWS({type:"config/area_registry/reorder",area_ids:t}),_=a=>{const t={};for(const e of a)e.area_id&&(e.area_id in t||(t[e.area_id]=[]),t[e.area_id].push(e));return t},u=a=>{const t={};for(const e of a)e.area_id&&(e.area_id in t||(t[e.area_id]=[]),t[e.area_id].push(e));return t}},46273(a,t,e){e.a(a,async function(a,i){try{e.r(t);var s=e(15697),r=e(358),n=e(57527),o=e(79224),p=e(148),d=e(98747),c=e(15466),h=e(34228),_=e(55705),u=e(45706),g=a([d,c,h]);[d,c,h]=g.then?(await g)():g;class l extends n.WF{firstUpdated(){this._loadCurrentMapping()}async _loadCurrentMapping(){if(!this.params.entityId)return;this._entry=await(0,u.v)(this.hass,this.params.entityId);const a=this._entry?.options?.vacuum?.area_mapping||{};this._areaMapping=a,this._dirtyState?.setState(a,"vacuum-segment-mapping")}_valueChanged(a){this._areaMapping=a.detail.value,this._dirtyState?.setState(a.detail.value,"vacuum-segment-mapping")}async _save(){if(!this.params.entityId||!this._areaMapping)return;this._error=void 0,this._submitting=!0;const a=this.shadowRoot.querySelector("ha-vacuum-segment-area-mapper"),t={...this._entry?.options?.vacuum??{},area_mapping:this._areaMapping,last_seen_segments:a.lastSeenSegments};try{await(0,u.G_)(this.hass,this.params.entityId,{options_domain:"vacuum",options:t}),this._dirtyState?.markClean(),(0,p.r)(this,"close-child-view")}catch(a){this._error=a.message}finally{this._submitting=!1}}render(){return this._areaMapping?n.qy` <div class="content"> ${this._error?n.qy`<ha-alert alert-type="error">${this._error}</ha-alert>`:n.s6} <ha-vacuum-segment-area-mapper .hass=${this.hass} .entityId=${this.params.entityId} .value=${this._areaMapping} @value-changed=${this._valueChanged}></ha-vacuum-segment-area-mapper> <div class="footer"> <ha-button @click=${this._save} .disabled=${!this._dirtyState?.isDirty||this._submitting}> ${this.hass.localize("ui.common.save")} </ha-button> </div> </div> `:n.qy`<ha-spinner active></ha-spinner>`}constructor(...a){super(...a),this._submitting=!1}}l.styles=n.AH`:host{display:block}.content{flex-direction:column;display:flex}ha-spinner{margin:var(--ha-space-8);justify-self:center;display:flex}ha-vacuum-segment-area-mapper{flex:1;padding-inline-start:var(--ha-space-2)}.footer{padding:var(--ha-space-4);border-top:1px solid var(--divider-color);background:var(--ha-dialog-surface-background,var(--mdc-theme-surface,#fff));z-index:10;justify-content:flex-end;display:flex;position:sticky;bottom:0}`,(0,s.Cg)([(0,o.MZ)({attribute:!1})],l.prototype,"hass",void 0),(0,s.Cg)([(0,o.MZ)({attribute:!1})],l.prototype,"params",void 0),(0,s.Cg)([(0,r.Fg)({context:_.f,subscribe:!0}),(0,o.wk)()],l.prototype,"_dirtyState",void 0),(0,s.Cg)([(0,o.wk)()],l.prototype,"_areaMapping",void 0),(0,s.Cg)([(0,o.wk)()],l.prototype,"_submitting",void 0),(0,s.Cg)([(0,o.wk)()],l.prototype,"_error",void 0),l=(0,s.Cg)([(0,o.EM)("ha-more-info-view-vacuum-segment-mapping")],l),e.d(t,{HaMoreInfoViewVacuumSegmentMapping:()=>l}),i()}catch(a){i(a)}})}};
//# sourceMappingURL=93520.62e322ed1b22d836.js.map