UNPKG

iobroker.lovelace

Version:

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

1 lines 8.5 kB
"use strict";(self.rspackChunkhome_assistant_frontend=self.rspackChunkhome_assistant_frontend||[]).push([[84],{2846:function(t,e,s){s.d(e,{G:function(){return u},J:function(){return h}});var i=s(40445),a=s(58168),r=s(82553),n=s(5124),o=s(67576);s(54276);let l,c,d=t=>t;const h=[r.R,(0,n.AH)(l||(l=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?n.s6:(0,n.qy)(c||(c=d`<ha-ripple part="ripple" for="item" ?disabled="${0}"></ha-ripple>`),this.disabled&&"link"!==this.type)}}u.styles=h,u=(0,i.Cg)([(0,o.EM)("ha-md-list-item")],u)},17308:function(t,e,s){var i=s(40445),a=s(49838),r=s(11245),n=s(5124),o=s(67576);let l;class c extends a.B{}c.styles=[r.R,(0,n.AH)(l||(l=(t=>t)`:host{--md-sys-color-surface:var(--card-background-color)}`))],c=(0,i.Cg)([(0,o.EM)("ha-md-list")],c)},49847:function(t,e,s){s.d(e,{PM:function(){return a},_w:function(){return o},aj:function(){return r},fO:function(){return n},zV:function(){return i}});s(3362);const i=async(t,e)=>(await t.callService("matter","get_lock_info",{},{entity_id:e},!0,!0)).response[e],a=async(t,e)=>(await t.callService("matter","get_lock_users",{},{entity_id:e},!0,!0)).response[e],r=(t,e,s)=>t.callService("matter","set_lock_user",s,{entity_id:e}),n=(t,e,s)=>t.callService("matter","clear_lock_user",{user_index:s},{entity_id:e}),o=async(t,e,s)=>(await t.callService("matter","set_lock_credential",s,{entity_id:e},!0,!0)).response[e]},50591:function(t,e,s){s.a(t,async function(t,i){try{s.r(e);s(74423),s(18111),s(22489),s(61701),s(13579),s(3362),s(62953);var a=s(40445),r=s(5124),n=s(67576),o=s(1087),l=s(38962),c=s(18350),d=(s(93444),s(26300)),h=(s(17308),s(2846),s(65829)),u=(s(67094),s(72554)),p=s(49847),_=s(65063),g=s(14503),y=s(3732),m=t([l,c,d,h,u]);[l,c,d,h,u]=m.then?(await m)():m;let f,v,k,$,w,x,C,I,b,H,A,V,z,D=t=>t;const U="M19,4H15.5L14.5,3H9.5L8.5,4H5V6H19M6,19A2,2 0 0,0 8,21H16A2,2 0 0,0 18,19V7H6V19Z",q="M12,17A2,2 0 0,0 14,15C14,13.89 13.1,13 12,13A2,2 0 0,0 10,15A2,2 0 0,0 12,17M18,8A2,2 0 0,1 20,10V20A2,2 0 0,1 18,22H6A2,2 0 0,1 4,20V10C4,8.89 4.9,8 6,8H7V6A5,5 0 0,1 12,1A5,5 0 0,1 17,6V8H18M12,3A3,3 0 0,0 9,6V8H15V6A3,3 0 0,0 12,3Z",M="M19,13H13V19H11V13H5V11H11V5H13V11H19V13Z";class P extends r.WF{async showDialog(t){this._entityId=t.entity_id,this._loading=!0,this._open=!0,await this._fetchData()}async _fetchData(){if(this._entityId)try{if(this._lockInfo=await(0,p.zV)(this.hass,this._entityId),this._lockInfo.supports_user_management){const t=await(0,p.PM)(this.hass,this._entityId);this._users=t.users}}catch(t){(0,_.showAlertDialog)(this,{title:this.hass.localize("ui.panel.config.matter.lock.errors.load_failed"),text:t.message})}finally{this._loading=!1}}render(){return this._entityId?(0,r.qy)(f||(f=D` <ha-dialog .open="${0}" header-title="${0}" @closed="${0}"> ${0} </ha-dialog> `),this._open,this.hass.localize("ui.panel.config.matter.lock.dialog_title"),this._dialogClosed,this._loading?(0,r.qy)(v||(v=D`<div class="center"> <ha-spinner></ha-spinner> </div>`)):this._lockInfo&&!this._lockInfo.supports_user_management?(0,r.qy)(k||(k=D`<div class="content"> <ha-alert alert-type="warning"> ${0} </ha-alert> ${0} </div>`),this.hass.localize("ui.panel.config.matter.lock.errors.no_user_management"),this._renderDocsLink()):(0,r.qy)($||($=D`<div class="content">${0}</div>`),this._renderUsers())):r.s6}_renderDocsLink(){return(0,r.qy)(w||(w=D`<a class="docs-link" href="https://www.home-assistant.io/integrations/matter/#lock-user-and-credential-management" target="_blank" rel="noopener noreferrer"> ${0} </a>`),this.hass.localize("ui.panel.config.matter.lock.errors.learn_more"))}get _supportsPinCredential(){var t,e;return null!==(t=null===(e=this._lockInfo)||void 0===e||null===(e=e.supported_credential_types)||void 0===e?void 0:e.includes("pin"))&&void 0!==t&&t}_renderUsers(){var t;const e=this._users.filter(t=>"available"!==t.user_status),s=!(null!==(t=this._lockInfo)&&void 0!==t&&null!==(t=t.supported_credential_types)&&void 0!==t&&t.length);return(0,r.qy)(x||(x=D` <div class="users-content"> ${0} ${0} ${0} </div> `),s?(0,r.qy)(C||(C=D`<ha-alert alert-type="warning"> ${0} </ha-alert> ${0}`),this.hass.localize("ui.panel.config.matter.lock.errors.no_credential_types_supported"),this._renderDocsLink()):this._supportsPinCredential?r.s6:(0,r.qy)(I||(I=D`<ha-alert alert-type="info"> ${0} </ha-alert> ${0}`),this.hass.localize("ui.panel.config.matter.lock.errors.pin_not_supported"),this._renderDocsLink()),0===e.length?(0,r.qy)(b||(b=D`<p class="empty"> ${0} </p>`),this.hass.localize("ui.panel.config.matter.lock.users.no_users")):(0,r.qy)(H||(H=D` <ha-md-list> ${0} </ha-md-list> `),e.map(t=>(0,r.qy)(A||(A=D` <ha-md-list-item type="button" .user="${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"> ${0} ${0} </div> <ha-icon-button slot="end" .path="${0}" .user="${0}" @click="${0}"></ha-icon-button> </ha-md-list-item> `),t,this._handleUserClick,q,t.user_name||`User ${t.user_index}`,this.hass.localize(`ui.panel.config.matter.lock.users.user_type.${t.user_type}`),t.credentials.length>0?` - ${t.credentials.length} ${this.hass.localize("ui.panel.config.matter.lock.users.credentials").toLowerCase()}`:"",U,t,this._handleDeleteUserClick))),this._supportsPinCredential?(0,r.qy)(V||(V=D`<div class="actions"> <ha-button @click="${0}"> <ha-svg-icon slot="icon" .path="${0}"></ha-svg-icon> ${0} </ha-button> </div>`),this._addUser,M,this.hass.localize("ui.panel.config.matter.lock.users.add")):r.s6)}_handleUserClick(t){if(t.composedPath().some(t=>"HA-ICON-BUTTON"===t.tagName))return;const e=t.currentTarget.user;this._editUser(e)}_handleDeleteUserClick(t){t.preventDefault(),t.stopPropagation();const e=t.currentTarget.user;this._deleteUser(e)}_addUser(){(0,y.h)(this,{entity_id:this._entityId,lockInfo:this._lockInfo,onSaved:()=>this._fetchData()})}_editUser(t){(0,y.h)(this,{entity_id:this._entityId,lockInfo:this._lockInfo,user:t,onSaved:()=>this._fetchData()})}async _deleteUser(t){if(await(0,_.dk)(this,{title:this.hass.localize("ui.panel.config.matter.lock.users.delete"),text:this.hass.localize("ui.panel.config.matter.lock.confirm_delete_user",{name:t.user_name||`User ${t.user_index}`}),destructive:!0})){try{await(0,p.fO)(this.hass,this._entityId,t.user_index)}catch(e){console.debug("Failed to clear lock user:",e)}await this._fetchData()}}closeDialog(){this._open=!1}_dialogClosed(){this._entityId=void 0,this._lockInfo=void 0,this._users=[],this._loading=!0,(0,o.r)(this,"dialog-closed",{dialog:this.localName})}static get styles(){return[g.nA,(0,r.AH)(z||(z=D`ha-dialog{--dialog-content-padding:0}.center{display:flex;align-items:center;justify-content:center;padding:var(--ha-space-6)}.content{min-height:300px}.content>ha-alert{margin:var(--ha-space-4)}.docs-link{display:block;padding:0 var(--ha-space-4);color:var(--primary-color);font-size:14px}.users-content{padding:var(--ha-space-4) 0}.empty{text-align:center;color:var(--secondary-text-color);padding:var(--ha-space-6)}.actions{padding:var(--ha-space-2) var(--ha-space-6);display:flex;justify-content:flex-end}.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}`))]}constructor(...t){super(...t),this._users=[],this._loading=!0,this._open=!1}}(0,a.Cg)([(0,n.MZ)({attribute:!1})],P.prototype,"hass",void 0),(0,a.Cg)([(0,n.wk)()],P.prototype,"_entityId",void 0),(0,a.Cg)([(0,n.wk)()],P.prototype,"_lockInfo",void 0),(0,a.Cg)([(0,n.wk)()],P.prototype,"_users",void 0),(0,a.Cg)([(0,n.wk)()],P.prototype,"_loading",void 0),(0,a.Cg)([(0,n.wk)()],P.prototype,"_open",void 0),P=(0,a.Cg)([(0,n.EM)("dialog-matter-lock-manage")],P),i()}catch(f){i(f)}})},3732:function(t,e,s){s.d(e,{h:function(){return r}});s(3362),s(62953);var i=s(1087);const a=()=>Promise.all([s.e(81034),s.e(7241)]).then(s.bind(s,78896)),r=(t,e)=>{(0,i.r)(t,"show-dialog",{dialogTag:"dialog-matter-lock-user-edit",dialogImport:a,dialogParams:e})}}}]);