export const __rspack_esm_id="34524";export const __rspack_esm_ids=["34524"];export const __webpack_modules__={68348(e,t,a){a.d(t,{u:()=>s});a(18111),a(13579);const s=e=>{if(e.some(e=>"tagName"in e&&("HA-MENU"===e.tagName||"HA-CODE-EDITOR"===e.tagName)))return!1;const t=e[0];if("TEXTAREA"===t.tagName)return!1;if("HA-SELECT"===t.parentElement?.tagName)return!1;if("INPUT"!==t.tagName)return!0;switch(t.type){case"button":case"checkbox":case"hidden":case"radio":case"range":return!0;default:return!1}}},30201(e,t,a){a.a(e,async function(e,t){try{var s=a(62826),i=a(96196),o=a(44457),r=(a(67094),a(34127)),n=e([r]);r=(n.then?(await n)():n)[0];class l extends i.WF{render(){return i.qy` <ha-tooltip for="svg-icon">${this.tooltip}</ha-tooltip> <ha-svg-icon id="svg-icon" .path="${this.path}"></ha-svg-icon> `}}l.styles=i.AH`:host{display:inline-block;position:relative}ha-svg-icon{color:var(--secondary-text-color)}`,(0,s.Cg)([(0,o.MZ)()],l.prototype,"tooltip",void 0),(0,s.Cg)([(0,o.MZ)()],l.prototype,"path",void 0),l=(0,s.Cg)([(0,o.EM)("ha-data-table-icon")],l),t()}catch(e){t(e)}})},27661(e,t,a){var s=a(62826),i=a(51978),o=a(94743),r=a(44457),n=a(96196),l=a(63091);class d extends i.n{firstUpdated(e){super.firstUpdated(e),this.style.setProperty("--mdc-theme-secondary","var(--primary-color)")}}d.styles=[o.R,n.AH`:host{--mdc-typography-button-text-transform:none;--mdc-typography-button-font-size:var(--ha-font-size-l);--mdc-typography-button-font-family:var(--ha-font-family-body);--mdc-typography-button-font-weight:var(--ha-font-weight-medium)}:host .mdc-fab--extended{border-radius:var(--ha-button-border-radius,var(--ha-border-radius-pill))}:host .mdc-fab.mdc-fab--extended .ripple{border-radius:var(--ha-button-border-radius,var(--ha-border-radius-pill))}:host .mdc-fab--extended .mdc-fab__icon{margin-inline-start:-8px;margin-inline-end:12px;direction:var(--direction)}:disabled{--mdc-theme-secondary:var(--disabled-text-color);pointer-events:none}`,"rtl"===l.G.document.dir?n.AH`:host .mdc-fab--extended .mdc-fab__icon{direction:rtl}`:n.AH``],d=(0,s.Cg)([(0,r.EM)("ha-fab")],d)},34127(e,t,a){a.a(e,async function(e,t){try{var s=a(62826),i=a(52630),o=a(96196),r=a(44457),n=e([i]);i=(n.then?(await n)():n)[0];class l extends i.A{static get styles(){return[i.A.styles,o.AH`:host{--wa-tooltip-background-color:var(--secondary-background-color);--wa-tooltip-content-color:var(--primary-text-color);--wa-tooltip-font-family:var(
            --ha-tooltip-font-family,
            var(--ha-font-family-body)
          );--wa-tooltip-font-size:var(
            --ha-tooltip-font-size,
            var(--ha-font-size-s)
          );--wa-tooltip-font-weight:var(
            --ha-tooltip-font-weight,
            var(--ha-font-weight-normal)
          );--wa-tooltip-line-height:var(
            --ha-tooltip-line-height,
            var(--ha-line-height-condensed)
          );--wa-tooltip-padding:8px;--wa-tooltip-border-radius:var(
            --ha-tooltip-border-radius,
            var(--ha-border-radius-sm)
          );--wa-tooltip-arrow-size:var(--ha-tooltip-arrow-size, 8px);--wa-z-index-tooltip:var(--ha-tooltip-z-index, 1000)}`]}constructor(...e){super(...e),this.showDelay=150,this.hideDelay=150}}(0,s.Cg)([(0,r.MZ)({attribute:"show-delay",type:Number})],l.prototype,"showDelay",void 0),(0,s.Cg)([(0,r.MZ)({attribute:"hide-delay",type:Number})],l.prototype,"hideDelay",void 0),l=(0,s.Cg)([(0,r.EM)("ha-tooltip")],l),t()}catch(e){t(e)}})},28669(e,t,a){a.d(t,{TK:()=>n,_2:()=>d,eR:()=>i,hG:()=>l,hU:()=>o,kg:()=>r,wj:()=>s,xg:()=>h});a(44114),a(18111),a(61701);const s="system-admin",i="system-users",o=async e=>e.callWS({type:"config/auth/list"}),r=async(e,t,a,s)=>e.callWS({type:"config/auth/create",name:t,group_ids:a,local_only:s}),n=async(e,t,a)=>e.callWS({...a,type:"config/auth/update",user_id:t}),l=async(e,t)=>e.callWS({type:"config/auth/delete",user_id:t}),d=e=>e?e.trim().split(" ").slice(0,3).map(e=>e.substring(0,1)).join(""):"?",h=(e,t,a)=>{const s=[],i=t=>e.localize(`ui.panel.config.users.${t}`);return t.is_owner&&s.push(["M12 2C6.47 2 2 6.5 2 12C2 17.5 6.5 22 12 22S22 17.5 22 12 17.5 2 12 2M12 20C7.58 20 4 16.42 4 12C4 7.58 7.58 4 12 4S20 7.58 20 12C20 16.42 16.42 20 12 20M8 14L7 8L10 10L12 7L14 10L17 8L16 14H8M8.56 16C8.22 16 8 15.78 8 15.44V15H16V15.44C16 15.78 15.78 16 15.44 16H8.56Z",i("is_owner")]),a&&t.system_generated&&s.push(["M11,7H15V9H11V11H13A2,2 0 0,1 15,13V15A2,2 0 0,1 13,17H9V15H13V13H11A2,2 0 0,1 9,11V9A2,2 0 0,1 11,7M12,2A10,10 0 0,1 22,12A10,10 0 0,1 12,22A10,10 0 0,1 2,12A10,10 0 0,1 12,2M12,4A8,8 0 0,0 4,12A8,8 0 0,0 12,20A8,8 0 0,0 20,12A8,8 0 0,0 12,4Z",i("is_system")]),t.local_only&&s.push(["M12 20C7.6 20 4 16.4 4 12S7.6 4 12 4 20 7.6 20 12 16.4 20 12 20M12 2C6.5 2 2 6.5 2 12S6.5 22 12 22 22 17.5 22 12 17.5 2 12 2M11 14H13V17H16V12H18L12 7L6 12H8V17H11V14",i("is_local")]),t.is_active||s.push(["M12 2C17.5 2 22 6.5 22 12S17.5 22 12 22 2 17.5 2 12 6.5 2 12 2M12 4C10.1 4 8.4 4.6 7.1 5.7L18.3 16.9C19.3 15.5 20 13.8 20 12C20 7.6 16.4 4 12 4M16.9 18.3L5.7 7.1C4.6 8.4 4 10.1 4 12C4 16.4 7.6 20 12 20C13.9 20 15.6 19.4 16.9 18.3Z",i("is_not_active")]),s}},1400(e,t,a){a.a(e,async function(e,s){try{a.r(t),a.d(t,{HaConfigUsers:()=>b});a(18111),a(22489),a(20116),a(7588),a(61701);var i=a(62826),o=a(96196),r=a(44457),n=a(22786),l=a(30201),d=(a(27661),a(67094),a(28669)),h=a(65063),c=(a(72553),a(25635)),p=a(44191),u=a(67575),g=a(93905),m=e([l]);l=(m.then?(await m)():m)[0];const y="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z",_="M19,13H13V19H11V13H5V11H11V5H13V11H19V13Z";class b extends o.WF{firstUpdated(e){super.firstUpdated(e),this._fetchUsers()}render(){return o.qy` <hass-tabs-subpage-data-table .hass="${this.hass}" .narrow="${this.narrow}" .route="${this.route}" back-path="/config" .tabs="${c.configSections.persons}" .columns="${this._columns(this.narrow,this.hass.localize)}" .data="${this._userData(this._users,this.hass.localize)}" .columnOrder="${this._activeColumnOrder}" .hiddenColumns="${this._activeHiddenColumns}" @columns-changed="${this._handleColumnsChanged}" .initialGroupColumn="${this._activeGrouping}" .initialCollapsedGroups="${this._activeCollapsed}" .initialSorting="${this._activeSorting}" @sorting-changed="${this._handleSortingChanged}" @grouping-changed="${this._handleGroupingChanged}" @collapsed-changed="${this._handleCollapseChanged}" .filter="${this._filter}" @search-changed="${this._handleSearchChange}" @row-click="${this._editUser}" has-fab clickable> <ha-fab slot="fab" .label="${this.hass.localize("ui.panel.config.users.picker.add_user")}" extended @click="${this._addUser}"> <ha-svg-icon slot="icon" .path="${_}"></ha-svg-icon> </ha-fab> </hass-tabs-subpage-data-table> `}async _fetchUsers(){this._users=await(0,d.hU)(this.hass),this._users.forEach(e=>{e.is_owner&&e.group_ids.unshift("owner")})}_editUser(e){const t=e.detail.id,a=this._users.find(e=>e.id===t);a&&(0,u.I)(this,{entry:a,replaceEntry:e=>{this._users=this._users.map(t=>t.id===e.id?e:t)},updateEntry:async e=>{const t=await(0,d.TK)(this.hass,a.id,e);this._users=this._users.map(e=>e===a?t.user:e)},removeEntry:async()=>{if(!await(0,h.dk)(this,{title:this.hass.localize("ui.panel.config.users.editor.confirm_user_deletion_title",{name:a.name}),text:this.hass.localize("ui.panel.config.users.editor.confirm_user_deletion_text"),dismissText:this.hass.localize("ui.common.cancel"),confirmText:this.hass.localize("ui.common.delete"),destructive:!0}))return!1;try{return await(0,d.hG)(this.hass,a.id),this._users=this._users.filter(e=>e!==a),!0}catch(e){return!1}}})}_addUser(){(0,p.E)(this,{userAddedCallback:async e=>{e&&(this._users=[...this._users,e])}})}_handleSortingChanged(e){this._activeSorting=e.detail}_handleGroupingChanged(e){this._activeGrouping=e.detail.value}_handleCollapseChanged(e){this._activeCollapsed=e.detail.value}_handleSearchChange(e){this._filter=e.detail.value}_handleColumnsChanged(e){this._activeColumnOrder=e.detail.columnOrder,this._activeHiddenColumns=e.detail.hiddenColumns}constructor(...e){super(...e),this.isWide=!1,this.narrow=!1,this._users=[],this._filter="",this._columns=(0,n.A)((e,t)=>({name:{title:t("ui.panel.config.users.picker.headers.name"),main:!0,sortable:!0,filterable:!0,direction:"asc",flex:2},username:{title:t("ui.panel.config.users.picker.headers.username"),sortable:!0,filterable:!0,template:e=>o.qy`${e.username||"—"}`},group:{title:t("ui.panel.config.users.picker.headers.group"),sortable:!0,filterable:!0,groupable:!0},is_active:{title:this.hass.localize("ui.panel.config.users.picker.headers.is_active"),type:"icon",sortable:!0,filterable:!0,hidden:e,template:e=>e.is_active?o.qy`<ha-svg-icon .path="${y}"></ha-svg-icon>`:""},system_generated:{title:this.hass.localize("ui.panel.config.users.picker.headers.system"),type:"icon",sortable:!0,filterable:!0,hidden:e,template:e=>e.system_generated?o.qy`<ha-svg-icon .path="${y}"></ha-svg-icon>`:""},local_only:{title:this.hass.localize("ui.panel.config.users.picker.headers.local"),type:"icon",sortable:!0,filterable:!0,hidden:e,template:e=>e.local_only?o.qy`<ha-svg-icon .path="${y}"></ha-svg-icon>`:""},icons:{title:"",label:this.hass.localize("ui.panel.config.users.picker.headers.icon"),type:"icon",sortable:!1,filterable:!1,minWidth:"104px",hidden:!e,showNarrow:!0,template:e=>{const t=(0,d.xg)(this.hass,e,!1);return o.qy`${t.map(([e,t])=>o.qy`<ha-data-table-icon .path="${e}" .tooltip="${t}"></ha-data-table-icon>`)}`}}})),this._userData=(0,n.A)((e,t)=>e.map(e=>({...e,name:e.name||t("ui.panel.config.users.editor.unnamed_user"),group:t(`groups.${e.group_ids[0]}`)})))}}(0,i.Cg)([(0,r.MZ)({attribute:!1})],b.prototype,"hass",void 0),(0,i.Cg)([(0,r.MZ)({attribute:"is-wide",type:Boolean})],b.prototype,"isWide",void 0),(0,i.Cg)([(0,r.MZ)({type:Boolean})],b.prototype,"narrow",void 0),(0,i.Cg)([(0,r.MZ)({attribute:!1})],b.prototype,"route",void 0),(0,i.Cg)([(0,r.wk)()],b.prototype,"_users",void 0),(0,i.Cg)([(0,g.I)({key:"users-table-sort",state:!1,subscribe:!1})],b.prototype,"_activeSorting",void 0),(0,i.Cg)([(0,g.I)({key:"users-table-grouping",state:!1,subscribe:!1})],b.prototype,"_activeGrouping",void 0),(0,i.Cg)([(0,g.I)({key:"users-table-column-order",state:!1,subscribe:!1})],b.prototype,"_activeColumnOrder",void 0),(0,i.Cg)([(0,g.I)({key:"users-table-hidden-columns",state:!1,subscribe:!1})],b.prototype,"_activeHiddenColumns",void 0),(0,i.Cg)([(0,g.I)({storage:"sessionStorage",key:"users-table-search",state:!0,subscribe:!1})],b.prototype,"_filter",void 0),(0,i.Cg)([(0,g.I)({key:"users-table-collapsed",state:!1,subscribe:!1})],b.prototype,"_activeCollapsed",void 0),b=(0,i.Cg)([(0,r.EM)("ha-config-users")],b),s()}catch(e){s(e)}})},44191(e,t,a){a.d(t,{E:()=>o});var s=a(1087);const i=()=>a.e("69304").then(a.bind(a,81131)),o=(e,t)=>{(0,s.r)(e,"show-dialog",{dialogTag:"dialog-add-user",dialogImport:i,dialogParams:t})}},67575(e,t,a){a.d(t,{I:()=>o});var s=a(1087);const i=()=>a.e("94296").then(a.bind(a,7915)),o=(e,t)=>{(0,s.r)(e,"show-dialog",{dialogTag:"dialog-user-detail",dialogImport:i,dialogParams:t})}}};
//# sourceMappingURL=34524.3340c8c8b5cccad4.js.map