UNPKG

iobroker.lovelace

Version:

With this adapter you can build visualization for ioBroker with Home Assistant Lovelace UI

1 lines 11.5 kB
"use strict";(self.rspackChunkhome_assistant_frontend=self.rspackChunkhome_assistant_frontend||[]).push([[97278],{2846:function(e,t,i){i.d(t,{G:function(){return u},J:function(){return h}});var s=i(40445),a=i(58168),n=i(82553),r=i(5124),l=i(67576);i(54276);let o,c,d=e=>e;const h=[n.R,(0,r.AH)(o||(o=d`:host{--ha-icon-display:block;--md-sys-color-primary:var(--primary-text-color);--md-sys-color-secondary:var(--secondary-text-color);--md-sys-color-surface:var(--card-background-color);--md-sys-color-on-surface:var(--primary-text-color);--md-sys-color-on-surface-variant:var(--secondary-text-color)}md-item{overflow:var(--md-item-overflow,hidden);align-items:var(--md-item-align-items,center);gap:var(--ha-md-list-item-gap,16px)}`))];class u extends a.n{renderRipple(){return"text"===this.type?r.s6:(0,r.qy)(c||(c=d`<ha-ripple part="ripple" for="item" ?disabled="${0}"></ha-ripple>`),this.disabled&&"link"!==this.type)}}u.styles=h,u=(0,s.Cg)([(0,l.EM)("ha-md-list-item")],u)},17308:function(e,t,i){var s=i(40445),a=i(49838),n=i(11245),r=i(5124),l=i(67576);let o;class c extends a.B{}c.styles=[n.R,(0,r.AH)(o||(o=(e=>e)`:host{--md-sys-color-surface:var(--card-background-color)}`))],c=(0,s.Cg)([(0,l.EM)("ha-md-list")],c)},40910:function(e,t,i){i.d(t,{Af:function(){return g},FU:function(){return r},Fk:function(){return h},QR:function(){return y},Yr:function(){return o},b7:function(){return n},mj:function(){return u},tl:function(){return v},uo:function(){return l},xi:function(){return _},yR:function(){return p},zL:function(){return s}});i(16280),i(74423),i(3362),i(27495);const s=["pin_code","password"],a=["general","disposable"],n=e=>e.supported_credential_types?s.filter(t=>t in e.supported_credential_types):[],r=e=>{var t;const i=null!==(t=e.supported_user_types)&&void 0!==t?t:[];return a.filter(e=>i.includes(e))},l=e=>n(e).length>0&&r(e).length>0,o=(e,t,i)=>{var s,a;if(!e)return"required";const n=null!==(s=null==i?void 0:i.min_length)&&void 0!==s?s:4,r=null!==(a=null==i?void 0:i.max_length)&&void 0!==a?a:10;return e.length<n||e.length>r?"length":"pin_code"!==t||/^\d+$/.test(e)?"":"pin_digits_only"},c=(e,t,i)=>{const s=null==t?void 0:t[i];if(void 0===s)throw new Error(e.localize("ui.panel.config.zwave_js.credentials.errors.empty_response"));return s},d=async(e,t,i,s={})=>{const a=await e.callService("zwave_js",t,s,{entity_id:i},!1,!0);return c(e,a.response,i)},h=(e,t)=>d(e,"get_credential_capabilities",t),u=(e,t)=>d(e,"get_users",t),_=async(e,t,i)=>{const s=await e.callService("zwave_js","set_user",i,{entity_id:t},!1,!0);return c(e,s.response,t)},p=(e,t,i)=>e.callService("zwave_js","delete_user",{user_id:i},{entity_id:t},!1),g=(e,t)=>e.callService("zwave_js","delete_all_users",{},{entity_id:t},!1),v=async(e,t,i)=>{const s=await e.callService("zwave_js","set_credential",i,{entity_id:t},!1,!0);return c(e,s.response,t)},y=(e,t,i)=>e.callService("zwave_js","delete_credential",i,{entity_id:t},!1)},69645:function(e,t,i){i.a(e,async function(e,s){try{i.r(t);i(18111),i(22489),i(20116),i(61701),i(3362),i(62953);var a=i(40445),n=i(5124),r=i(67576),l=i(57237),o=i(1087),c=i(38962),d=i(18350),h=(i(93444),i(29823)),u=(i(70947),i(26300)),_=(i(17308),i(2846),i(65829)),p=(i(67094),i(72554)),g=i(40910),v=i(65063),y=i(14503),f=i(1998),m=e([c,d,h,u,_,p]);[c,d,h,u,_,p]=m.then?(await m)():m;let w,b,z,$,j,k,A,x,C,H,D,M,U,q=e=>e;const I="M11 10V12H9V14H7V12H5.8C5.4 13.2 4.3 14 3 14C1.3 14 0 12.7 0 11S1.3 8 3 8C4.3 8 5.4 8.8 5.8 10H11M3 10C2.4 10 2 10.4 2 11S2.4 12 3 12 4 11.6 4 11 3.6 10 3 10M16 14C18.7 14 24 15.3 24 18V20H8V18C8 15.3 13.3 14 16 14M16 12C13.8 12 12 10.2 12 8S13.8 4 16 4 20 5.8 20 8 18.2 12 16 12Z",V="M19,4H15.5L14.5,3H9.5L8.5,4H5V6H19M6,19A2,2 0 0,0 8,21H16A2,2 0 0,0 18,19V7H6V19Z",S="M12,16A2,2 0 0,1 14,18A2,2 0 0,1 12,20A2,2 0 0,1 10,18A2,2 0 0,1 12,16M12,10A2,2 0 0,1 14,12A2,2 0 0,1 12,14A2,2 0 0,1 10,12A2,2 0 0,1 12,10M12,4A2,2 0 0,1 14,6A2,2 0 0,1 12,8A2,2 0 0,1 10,6A2,2 0 0,1 12,4Z",F="M19,13H13V19H11V13H5V11H11V5H13V11H19V13Z";class E extends n.WF{async showDialog(e){this._entityId=e.entity_id,this._loading=!0,this._open=!0,await this._fetchData()}async _fetchData(){if(this._entityId)try{if(this._capabilities=await(0,g.Fk)(this.hass,this._entityId),this._capabilities.supports_user_management){const e=await(0,g.mj)(this.hass,this._entityId);this._users=e.users}}catch(e){this.closeDialog(),(0,v.showAlertDialog)(this,{title:this.hass.localize("ui.panel.config.zwave_js.credentials.errors.load_failed"),text:e.message})}finally{this._loading=!1}}render(){var e;if(!this._entityId)return n.s6;const t=this._users.filter(e=>e.active),i=!this._loading&&void 0!==this._capabilities&&this._capabilities.supports_user_management&&(0,g.uo)(this._capabilities),s=!this._loading&&(null===(e=this._capabilities)||void 0===e?void 0:e.supports_user_management)&&t.length>0;return(0,n.qy)(w||(w=q` <ha-dialog .hass="${0}" .open="${0}" header-title="${0}" @closed="${0}"> ${0} ${0} ${0} </ha-dialog> `),this.hass,this._open,this.hass.localize("ui.panel.config.zwave_js.credentials.dialog_title"),this._dialogClosed,s?(0,n.qy)(b||(b=q`<ha-dropdown slot="headerActionItems" @closed="${0}" @wa-select="${0}" placement="bottom-end"> <ha-icon-button slot="trigger" .label="${0}" .path="${0}" ?disabled="${0}"></ha-icon-button> <ha-dropdown-item value="delete_all" variant="danger"> ${0} </ha-dropdown-item> </ha-dropdown>`),l.d,this._handleMenuAction,this.hass.localize("ui.common.menu"),S,this._busy,this.hass.localize("ui.panel.config.zwave_js.credentials.users.delete_all")):n.s6,this._loading?(0,n.qy)(z||(z=q`<div class="center"> <ha-spinner></ha-spinner> </div>`)):this._capabilities&&!this._capabilities.supports_user_management?(0,n.qy)($||($=q`<div class="content"> <ha-alert alert-type="warning"> ${0} </ha-alert> </div>`),this.hass.localize("ui.panel.config.zwave_js.credentials.errors.no_user_management")):(0,n.qy)(j||(j=q`<div class="content"> ${0} </div>`),this._renderUsers(t)),i?(0,n.qy)(k||(k=q`<ha-dialog-footer slot="footer"> <ha-button slot="primaryAction" @click="${0}" ?disabled="${0}"> <ha-svg-icon slot="start" .path="${0}"></ha-svg-icon> ${0} </ha-button> </ha-dialog-footer>`),this._addUser,this._busy,F,this.hass.localize("ui.panel.config.zwave_js.credentials.users.add")):n.s6)}_handleMenuAction(e){"delete_all"===e.detail.item.value&&this._deleteAllUsers()}_renderUsers(e){var t;const i=!(null!==(t=this._capabilities)&&void 0!==t&&t.supported_credential_types)||0===Object.keys(this._capabilities.supported_credential_types).length,s=!this._capabilities||0===(0,g.FU)(this._capabilities).length;return(0,n.qy)(A||(A=q` <div class="users-content"> ${0} ${0} </div> `),i?(0,n.qy)(x||(x=q`<ha-alert alert-type="warning"> ${0} </ha-alert>`),this.hass.localize("ui.panel.config.zwave_js.credentials.errors.no_compatible_credential_types")):s?(0,n.qy)(C||(C=q`<ha-alert alert-type="warning"> ${0} </ha-alert>`),this.hass.localize("ui.panel.config.zwave_js.credentials.errors.no_compatible_user_types")):n.s6,0===e.length?(0,n.qy)(H||(H=q`<p class="empty"> ${0} </p>`),this.hass.localize("ui.panel.config.zwave_js.credentials.users.no_users")):(0,n.qy)(D||(D=q` <ha-md-list> ${0} </ha-md-list> `),e.map(e=>(0,n.qy)(M||(M=q` <ha-md-list-item type="button" data-user-id="${0}" @click="${0}"> <div slot="start" class="icon-background"> <ha-svg-icon .path="${0}"></ha-svg-icon> </div> <div slot="headline"> ${0} </div> <div slot="supporting-text"> <span> ${0} </span> <span class="credential-count"> ${0} </span> </div> <ha-icon-button slot="end" .path="${0}" .label="${0}" data-user-id="${0}" ?disabled="${0}" @click="${0}"></ha-icon-button> </ha-md-list-item> `),e.user_id,this._handleUserClick,I,e.user_name||this.hass.localize("ui.panel.config.zwave_js.credentials.users.unnamed_user",{index:e.user_id}),this.hass.localize(`ui.panel.config.zwave_js.credentials.users.user_types.${e.user_type}.label`)||e.user_type,this.hass.localize("ui.panel.config.zwave_js.credentials.users.credential_count",{count:e.credentials.length}),V,this.hass.localize("ui.panel.config.zwave_js.credentials.users.delete"),e.user_id,this._busy,this._handleDeleteUserClick))))}_userFromEvent(e){var t;const i=Number(null!==(t=e.currentTarget.dataset.userId)&&void 0!==t?t:"");return this._users.find(e=>e.user_id===i)}_handleUserClick(e){if(this._busy)return;const t=this._userFromEvent(e);t&&this._editUser(t)}_handleDeleteUserClick(e){e.preventDefault(),e.stopPropagation();const t=this._userFromEvent(e);t&&this._deleteUser(t)}_addUser(){(0,f.D)(this,{entity_id:this._entityId,capabilities:this._capabilities,onSaved:()=>this._fetchData()})}_editUser(e){(0,f.D)(this,{entity_id:this._entityId,capabilities:this._capabilities,user:e,onSaved:()=>this._fetchData()})}async _deleteUser(e){if(await(0,v.dk)(this,{title:this.hass.localize("ui.panel.config.zwave_js.credentials.users.delete"),text:this.hass.localize("ui.panel.config.zwave_js.credentials.confirm_delete_user",{name:e.user_name||this.hass.localize("ui.panel.config.zwave_js.credentials.users.unnamed_user",{index:e.user_id})}),confirmText:this.hass.localize("ui.common.delete"),destructive:!0})){this._busy=!0;try{await(0,g.yR)(this.hass,this._entityId,e.user_id)}catch(t){(0,v.showAlertDialog)(this,{title:this.hass.localize("ui.panel.config.zwave_js.credentials.errors.save_failed"),text:t.message})}try{await this._fetchData()}finally{this._busy=!1}}}async _deleteAllUsers(){if(await(0,v.dk)(this,{title:this.hass.localize("ui.panel.config.zwave_js.credentials.users.delete_all"),text:this.hass.localize("ui.panel.config.zwave_js.credentials.confirm_delete_all_users"),confirmText:this.hass.localize("ui.common.delete"),destructive:!0})){this._busy=!0;try{await(0,g.Af)(this.hass,this._entityId)}catch(e){(0,v.showAlertDialog)(this,{title:this.hass.localize("ui.panel.config.zwave_js.credentials.errors.save_failed"),text:e.message})}try{await this._fetchData()}finally{this._busy=!1}}}closeDialog(){this._open=!1}_dialogClosed(){this._entityId=void 0,this._capabilities=void 0,this._users=[],this._loading=!0,this._busy=!1,(0,o.r)(this,"dialog-closed",{dialog:this.localName})}static get styles(){return[y.nA,(0,n.AH)(U||(U=q`ha-dialog{--dialog-content-padding:0}.center{display:flex;align-items:center;justify-content:center;padding:var(--ha-space-6)}.content>ha-alert{margin:var(--ha-space-4)}.empty{text-align:center;color:var(--secondary-text-color);padding:var(--ha-space-6)}.icon-background{border-radius:var(--ha-border-radius-circle);background-color:var(--primary-color);color:#fff;display:flex;width:40px;height:40px;align-items:center;justify-content:center}.credential-count{margin-inline-start:var(--ha-space-2)}`))]}constructor(...e){super(...e),this._users=[],this._loading=!0,this._busy=!1,this._open=!1}}(0,a.Cg)([(0,r.MZ)({attribute:!1})],E.prototype,"hass",void 0),(0,a.Cg)([(0,r.wk)()],E.prototype,"_entityId",void 0),(0,a.Cg)([(0,r.wk)()],E.prototype,"_capabilities",void 0),(0,a.Cg)([(0,r.wk)()],E.prototype,"_users",void 0),(0,a.Cg)([(0,r.wk)()],E.prototype,"_loading",void 0),(0,a.Cg)([(0,r.wk)()],E.prototype,"_busy",void 0),(0,a.Cg)([(0,r.wk)()],E.prototype,"_open",void 0),E=(0,a.Cg)([(0,r.EM)("dialog-zwave_js-credential-manage")],E),s()}catch(w){s(w)}})},1998:function(e,t,i){i.d(t,{D:function(){return n}});i(3362),i(62953);var s=i(1087);const a=()=>Promise.all([i.e(81034),i.e(49575)]).then(i.bind(i,54618)),n=(e,t)=>{(0,s.r)(e,"show-dialog",{dialogTag:"dialog-zwave_js-credential-user-edit",dialogImport:a,dialogParams:t})}}}]);