"use strict";(self.webpackChunkhome_assistant_frontend=self.webpackChunkhome_assistant_frontend||[]).push([["81135"],{90322:function(e,t,a){a.a(e,async function(e,i){try{a.r(t),a.d(t,{ZHAAddGroupPage:function(){return b}});var n,o,s=a(61397),r=a(50264),h=a(72153),d=a(44734),c=a(43080),l=a(69683),p=a(6454),u=a(25460),g=(a(28706),a(62062),a(18111),a(61701),a(26099),a(58940),a(40445)),f=a(96196),v=a(77845),_=a(91926),y=a(18350),m=a(84621),A=(a(81310),a(20820),a(75709),a(10879),e([y]));y=(A.then?(await A)():A)[0];var b=function(e){function t(){var e;(0,d.A)(this,t);for(var a=arguments.length,i=new Array(a),n=0;n<a;n++)i[n]=arguments[n];return(e=(0,l.A)(this,t,[].concat(i))).narrow=!1,e.deviceEndpoints=[],e._processingAdd=!1,e._groupName="",e._firstUpdatedCalled=!1,e._selectedDevicesToAdd=[],e}return(0,p.A)(t,e),(0,c.A)(t,[{key:"connectedCallback",value:function(){(0,u.A)(t,"connectedCallback",this,3)([]),this.hass&&this._firstUpdatedCalled&&this._fetchData()}},{key:"firstUpdated",value:function(e){(0,u.A)(t,"firstUpdated",this,3)([e]),this.hass&&this._fetchData(),this._firstUpdatedCalled=!0}},{key:"render",value:function(){return(0,f.qy)(n||(n=(0,h.A)([' <hass-subpage .hass="','" .narrow="','" .header="','"> <ha-config-section .isWide="','"> <p slot="introduction"> ',' </p> <ha-textfield type="string" .value="','" @change="','" .placeholder="','"></ha-textfield> <ha-textfield type="number" .value="','" @change="','" .placeholder="','"></ha-textfield> <div class="header"> ',' </div> <zha-device-endpoint-data-table .hass="','" .deviceEndpoints="','" .narrow="','" selectable @selection-changed="','"> </zha-device-endpoint-data-table> <div class="buttons"> <ha-button .disabled="','" @click="','" class="button" .loading="','"> ',"</ha-button> </div> </ha-config-section> </hass-subpage> "])),this.hass,this.narrow,this.hass.localize("ui.panel.config.zha.groups.create_group"),!this.narrow,this.hass.localize("ui.panel.config.zha.groups.create_group_details"),this._groupName,this._handleNameChange,this.hass.localize("ui.panel.config.zha.groups.group_name_placeholder"),this._groupId,this._handleGroupIdChange,this.hass.localize("ui.panel.config.zha.groups.group_id_placeholder"),this.hass.localize("ui.panel.config.zha.groups.add_members"),this.hass,this.deviceEndpoints,this.narrow,this._handleAddSelectionChanged,!this._groupName||""===this._groupName||this._processingAdd,this._createGroup,this._processingAdd,this.hass.localize("ui.panel.config.zha.groups.create"))}},{key:"_fetchData",value:(i=(0,r.A)((0,s.A)().m(function e(){return(0,s.A)().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,(0,m.zt)(this.hass);case 1:this.deviceEndpoints=e.v;case 2:return e.a(2)}},e,this)})),function(){return i.apply(this,arguments)})},{key:"_handleAddSelectionChanged",value:function(e){this._selectedDevicesToAdd=e.detail.value}},{key:"_createGroup",value:(a=(0,r.A)((0,s.A)().m(function e(){var t,a,i;return(0,s.A)().w(function(e){for(;;)switch(e.n){case 0:return this._processingAdd=!0,t=this._selectedDevicesToAdd.map(function(e){var t=e.split("_");return{ieee:t[0],endpoint_id:t[1]}}),a=this._groupId?parseInt(this._groupId,10):void 0,e.n=1,(0,m.$)(this.hass,this._groupName,a,t);case 1:i=e.v,this._selectedDevicesToAdd=[],this._processingAdd=!1,this._groupName="",this._zhaDevicesDataTable.clearSelection(),(0,_.o)("/config/zha/group/".concat(i.group_id),{replace:!0});case 2:return e.a(2)}},e,this)})),function(){return a.apply(this,arguments)})},{key:"_handleGroupIdChange",value:function(e){this._groupId=e.target.value}},{key:"_handleNameChange",value:function(e){this._groupName=e.target.value||""}}],[{key:"styles",get:function(){return[(0,f.AH)(o||(o=(0,h.A)([".header{font-family:var(--ha-font-family-body);-webkit-font-smoothing:var(--ha-font-smoothing);-moz-osx-font-smoothing:var(--ha-moz-osx-font-smoothing);font-size:var(--ha-font-size-4xl);font-weight:var(--ha-font-weight-normal);line-height:var(--ha-line-height-condensed);opacity:var(--dark-primary-opacity)}.button{float:right}ha-config-section :last-child{padding-bottom:24px}.buttons{align-items:flex-end;padding:16px}.buttons .warning{--mdc-theme-primary:var(--error-color)}"])))]}}]);var a,i}(f.WF);(0,g.Cg)([(0,v.MZ)({attribute:!1})],b.prototype,"hass",void 0),(0,g.Cg)([(0,v.MZ)({type:Boolean})],b.prototype,"narrow",void 0),(0,g.Cg)([(0,v.MZ)({attribute:!1,type:Array})],b.prototype,"deviceEndpoints",void 0),(0,g.Cg)([(0,v.wk)()],b.prototype,"_processingAdd",void 0),(0,g.Cg)([(0,v.wk)()],b.prototype,"_groupName",void 0),(0,g.Cg)([(0,v.wk)()],b.prototype,"_groupId",void 0),(0,g.Cg)([(0,v.P)("zha-device-endpoint-data-table",!0)],b.prototype,"_zhaDevicesDataTable",void 0),b=(0,g.Cg)([(0,v.EM)("zha-add-group-page")],b),i()}catch(z){i(z)}})}}]);
//# sourceMappingURL=81135.9d7ca89b3586b563.js.map