"use strict";(self.webpackChunkunifiNetworkUi=self.webpackChunkunifiNetworkUi||[]).push([[3405,9810],{695415:(e,t,a)=>{a.d(t,{I:()=>l});const l={HEADER_HEIGHT:49,ROW_HEIGHT:32,EDIT_FIELD_HEIGHT:84,getHeight(e,t,a,l){return Math.min((l||this.ROW_HEIGHT)*e+(a??this.HEADER_HEIGHT),(l||this.ROW_HEIGHT)*t+(a??this.HEADER_HEIGHT))},getEditContainerHeight(e,t,a){return Math.min((a||this.EDIT_FIELD_HEIGHT)*e,(a||this.EDIT_FIELD_HEIGHT)*t)}}},615509:(e,t,a)=>{a.r(t),a.d(t,{default:()=>kt});var l=a(296540),n=a(956347),i=a(133337),r=a(530864),s=a(860923),o=a(582724),d=a(627440),m=a(596731),c=a(616009);const _={[c.h.CURRENT_SITE]:`${m.Si[d.VO.ADMINS]}/${c.h.CURRENT_SITE}`,[c.h.ALL_SITES]:`${m.Si[d.VO.ADMINS]}/${c.h.ALL_SITES}`};var E,A=a(469733),u=a(415331),p=a(801081),S=a(666638),I=a(459449),h=a(740244),g=a(566723),M=a(905410),N=a(249304),O=a(197562),b=a(71479),C=a(927099),T=a(271856),f=a(538205),R=a(822336),D=a(396660),v=a(294303),L=a(362156);!function(e){e.NAME="name",e.STATUS="is_verified",e.EMAIL="email",e.SITES="sites",e.ROLE="role",e.LAST_LOGIN="last_login",e.LAST_SITE="last_site_name"}(E||(E={}));const w={[E.NAME]:312,[E.STATUS]:132,[E.EMAIL]:312,[E.SITES]:126,[E.ROLE]:394,[E.LAST_SITE]:126,[E.LAST_LOGIN]:312},y={[E.NAME]:l.createElement(I.sA,{id:"COMMON_NAME"}),[E.STATUS]:l.createElement(I.sA,{id:"COMMON_STATUS"}),[E.EMAIL]:l.createElement(I.sA,{id:"COMMON_EMAIL"}),[E.SITES]:l.createElement(I.sA,{id:"COMMON_SITES"}),[E.ROLE]:l.createElement(I.sA,{id:"ADMINS_ROLE_LABEL"}),[E.LAST_SITE]:l.createElement(I.sA,{id:"ADMINS_LAST_SITE"}),[E.LAST_LOGIN]:l.createElement(I.sA,{id:"ADMINS_LAST_LOGIN"})};var P=a(175886);const x=({verified:e,verifiedMessage:t})=>l.createElement(C.A,{color:e?"success":"warning",size:"body"},e&&t||l.createElement(I.sA,{id:e?"COMMON_ACTIVE":"ADMINS_PENDING"}));var k=a(758649),H=a(489949),z=a(602021);const U=({siteName:e})=>{const t=(0,A.useDispatch)(),a=(0,A.useSelector)(z.Gd),n=(0,A.useSelector)(z.n),i=(0,l.useMemo)(()=>n.reduce((e,{name:t,desc:a})=>(e[t]=a,e),{}),[n]);return l.createElement(k.A,{variant:"inline",onClick:l=>{l.stopPropagation(),t((0,H.h)(e)).then(()=>{window.location.href=`${window.location.href.substring(0,window.location.href.indexOf(a.name))}${e}/dashboard${window.location.search}`})}},l.createElement(C.A,{color:"inherit",size:"body"},i[e]||e))},B=({header:{id:e}})=>y[e],F=(0,b.A)(v.A)`
  margin-left: ${g.YC}; // align with the header label padding
`,$=({sites:e})=>l.createElement(v.A,{flexDirection:"column",gap:g.YC},e.map(e=>l.createElement("div",{key:e},e))),V=(0,b.A)(v.A)`
  background: ${({theme:{motifPalette:{uBlue01:e}}})=>e};
  color: ${({theme:{motifPalette:{uBlue06:e}}})=>e};
  border-radius: ${R.Ay["desktop-radius-base"]};
  text-transform: uppercase;
  padding: 0 ${g.kc};
  height: 16px;
`,G=()=>l.createElement(V,{justifyContent:"center",alignItems:"center"},l.createElement(C.A,{weight:"bold",size:"label",color:"info"},l.createElement(I.sA,{id:"COMMON_YOU"})));var W=a(951272),Y=a(87485),q=a(25553),K=a(563715);const j=(0,q.uh)((0,K.Hq)()),X=(0,p.Mz)(j,Y.kh);var J=a(675359),Z=a(742920),Q=a(847883),ee=a(81126),te=a(776309),ae=a(126457),le=a(388151),ne=a(705426),ie=a(55896);const re=(0,b.A)(ne.A)`
  background-color: ${({theme:{motifPalette:{neutral01:e}}})=>e};
  > div {
    overflow: hidden !important;
  }
`,se=({hotspotOperatorId:e,closeModal:t})=>{const a=(0,A.useDispatch)(),{isSubmitting:n,handleSubmit:i,values:{name:r}}=(0,W.j7)(),s=(0,l.useCallback)(()=>a((0,K.gH)(e)).then(()=>{t()}).catch(()=>a((0,J.ox)({icon:Z.C.danger,message:"COMMON_NOTICE_REMOVE_ERROR",values:{name:r}}))),[a,t,r,e]),o=(0,l.useCallback)(()=>a((0,ae.to)({modalType:te.A.CONFIRM_HOTSPOT_OPERATOR_REMOVE,modalProps:{name:r,onConfirm:s}})),[a,s,r]),d=(0,l.useMemo)(()=>[{disabled:n,text:l.createElement(I.sA,{id:"COMMON_ACTION_REMOVE"}),type:"button",variant:"default",onClick:o},{disabled:n,text:l.createElement(I.sA,{id:"COMMON_ACTION_CANCEL"}),type:"button",variant:"default",onClick:t},{disabled:n,text:l.createElement(I.sA,{id:"COMMON_ACTION_SAVE_CHANGES"}),type:"button",variant:"primary",onClick:()=>i()}].filter(Boolean),[t,o,i,n]);return l.createElement(re,{size:"small",isOpen:Boolean(e),onRequestClose:t,title:l.createElement(I.sA,{id:"ADMINS_EDIT_ACCOUNT"}),actions:d},l.createElement(Q.A,null,l.createElement(ee.A,{column:!0,unlimitedWidth:!0},l.createElement(le.A,{full:!0,name:"name",variant:"secondary",label:"COMMON_NAME"}))),l.createElement(Q.A,null,l.createElement(ee.A,{column:!0,unlimitedWidth:!0},l.createElement(le.A,{full:!0,name:"x_password",type:"password",variant:"secondary",label:"COMMON_PASSWORD",autoComplete:"new-password",passwordToggle:!0}))),l.createElement(ie.A,null))};var oe=a(546391),de=a(870443);const me=de.A.object().shape({name:de.A.string().label("COMMON_LABEL_USERNAME").required().matches(oe.mJ,{message:l.createElement(I.sA,{id:"ADMINS_ADMIN_USERNAME_REGEX"})}),x_password:de.A.string().label("COMMON_PASSWORD").required()}),ce=({hotspotOperatorId:e,closeModal:t})=>{const a=(0,A.useDispatch)(),{_id:n,name:i,x_password:r}=(0,A.useSelector)((0,l.useMemo)(()=>{return t=e,(0,p.Mz)(X,e=>e.find(({_id:e})=>t===e)||{});var t},[e])),s=(0,l.useCallback)(({name:e,x_password:l},{resetForm:i,setSubmitting:r})=>a((0,K.dt)(n,{data:{name:e,x_password:l}})).then(()=>{a((0,K.Hq)()),t(),i()}).catch(({msg:t})=>a((0,J.ox)({icon:Z.C.danger,message:"ADMINS_EDIT_ADMIN_ERROR",values:{name:e},errorMessage:t}))).finally(()=>{r(!1)}),[n,a,t]),o=(0,l.useMemo)(()=>({name:i,x_password:r}),[i,r]);return l.createElement(W.l1,{enableReinitialize:!0,initialValues:o,validationSchema:me,onSubmit:s},l.createElement(se,{closeModal:t,hotspotOperatorId:e}))};var _e=a(921243),Ee=a(314714),Ae=a(162420),ue=a(967431),pe=a(689965),Se=a(414523),Ie=a(526075),he=a(775699),ge=a(198494);const Me=(0,q.uh)((0,Ie.VF)()),Ne=(0,p.Mz)(Me,Y.kh);var Oe=a(186745),be=a(151360),Ce=a(695415),Te=a(947089),fe=a(963070),Re=a(617147),De=a(121e3),ve=a(616093);const Le=(0,b.A)("footer")`
  padding: 0 ${g.Er} ${g.Er} ${g.Er};
`,we=({children:e})=>l.createElement(Le,null,e),ye=(0,b.A)("div")`
  margin-right: auto;
`,Pe=(0,b.A)(ee.A)`
  align-items: center;
  gap: ${g.Ln};
`,xe=(0,b.A)(k.A)`
  margin-top: ${g.Ln};
`,ke=({siteRole:e,closeModal:t,onRemoveSiteAdmin:a,invite:n})=>{const{formatMessage:r}=(0,I.tz)(),s=(0,A.useDispatch)(),[o,d]=(0,l.useState)(!1),{values:{role:m,permissions:c},isSubmitting:_,handleSubmit:E}=(0,W.j7)(),u=()=>{n&&!o&&(d(!0),s((0,Ie.t7)({name:n.name,email:n.email,for_sso:n.for_sso,super_site_permissions:n.super_site_permissions,role:m,permissions:c})).catch(({msg:e})=>s((0,J.ox)({icon:Z.C.danger,message:"ADMINS_INVITE_ERROR",values:{name:n.name},errorMessage:e}))).then(()=>{s((0,i.w)()),s((0,Ie.VF)()),t()}).finally(()=>d(!1)))},p=_||o;return l.createElement(Re.A,{isOpen:!0,size:"small",allowOverflow:!0,onRequestClose:t,title:`${e.site_desc} ${r({id:"ADMINS_PERMISSIONS_LABEL"})}`,footer:l.createElement(we,null,l.createElement(v.A,{alignItems:"center",justifyContent:"flex-end",gap:g.kc},l.createElement(ye,null,l.createElement(k.A,{type:"button",disabled:p,variant:"tertiary",onClick:a},l.createElement(C.A,{size:"inherit",color:"danger"},l.createElement(I.sA,{id:"COMMON_ACTION_REMOVE"})))),l.createElement(k.A,{type:"button",disabled:p,variant:"default",onClick:t},l.createElement(I.sA,{id:"COMMON_ACTION_CANCEL"})),l.createElement(k.A,{type:"button",disabled:p,variant:"primary",onClick:()=>n?u():E()},l.createElement(I.sA,{id:"COMMON_ACTION_APPLY_CHANGES"}))))},l.createElement(v.A,{paddingLeft:g.xO,flexDirection:"column"},l.createElement(De.A,{role:m,permissions:c,disabled:p}),l.createElement(Q.A,null,l.createElement(Pe,{column:!1,unlimitedWidth:!0},l.createElement(le.A,{type:"dropdown",sortedDropdown:!0,variant:"secondary",name:"role",options:(S=!!n,ve.A.filter(({value:e})=>e!==h.e.HOTSPOT&&(!S||e!==h.e.SUPER_ADMIN))),translateOptions:!0,validated:!0,full:!0,label:"ADMINS_ROLE_LABEL",translateLabel:!0,placeholder:"COMMON_CHOOSE_AN_OPTION",translatePlaceholder:!0,disabled:p}),n?l.createElement(xe,{disabled:p,variant:"inline",onClick:u},l.createElement(I.sA,{id:"ADMINS_RE_INVITE"})):null))));var S},He=({adminId:e,adminName:t,invite:a,siteRole:n,closeModal:r})=>{const s=(0,A.useDispatch)(),o=(0,A.useSelector)(ge.fR),d=(0,l.useMemo)(()=>({role:n.is_super&&n.role===h.e.ADMIN?h.e.SUPER_ADMIN:n.role,permissions:n.permissions}),[n]),m=()=>{s((0,i.w)()),s((0,Ie.VF)()),r()};return l.createElement(W.l1,{enableReinitialize:!0,initialValues:d,onSubmit:({role:t,permissions:a},{setSubmitting:l,resetForm:i})=>{s((0,Ie.Rr)({admin:e,role:t,permissions:a,is_super:t===h.e.SUPER_ADMIN},{admin:e,role:n.role,permissions:n.permissions,is_super:n.is_super},n.site_name)).then(m).finally(()=>{l(!1),i()})}},l.createElement(ke,{siteRole:n,onRemoveSiteAdmin:()=>{r(),s((0,Ie.Ag)({name:t,withRemoveGlobalPermissions:o&&n.is_super,onConfirm:a=>s((0,Ie.qg)(e,a,n.site_name)).then(m).catch(()=>s((0,J.ox)({icon:Z.C.danger,message:"COMMON_NOTICE_REMOVE_ERROR",values:{name:t}})))}))},invite:a,closeModal:r}))},ze=(0,b.A)("div")`
  margin-right: ${g.YC};
  pointer-events: none;
`,Ue=[{id:"site_desc",label:l.createElement(I.sA,{id:"COMMON_SITE"}),sortable:!0,minWidth:100,renderCell:({site_desc:e})=>l.createElement(C.A,{size:"body",color:"secondary"},e)},{id:"role",label:l.createElement(I.sA,{id:"ADMINS_ROLE_LABEL"}),sortable:!0,minWidth:150,renderCell:({role:e,is_super:t},a,n,{rowHovered:i})=>l.createElement(v.A,{width:"100%",justifyContent:"space-between"},l.createElement(C.A,{size:"body",color:"secondary"},l.createElement(I.sA,{id:(0,P.c)({role:e,is_super:t})})),i?l.createElement(ze,null,l.createElement(C.A,{size:"inherit",color:"info"},l.createElement(I.sA,{id:"COMMON_ACTION_EDIT"}))):null)}],Be=({adminId:e,adminName:t,invite:a,roles:n,isSuper:i})=>{const r=(0,A.useDispatch)(),s=(0,A.useSelector)(z.n),o=(0,l.useMemo)(()=>s.every(({name:e})=>n.some(({site_name:t})=>t===e)),[s,n]),[d,m]=(0,l.useState)(null),c=(0,l.useCallback)(()=>{r((0,ae.to)({modalType:te.A.ADD_ADMIN_MODAL,modalProps:{adminId:e}}))},[r,e]),_=(0,l.useMemo)(()=>n.map(e=>({...e,is_super:i})),[n,i]),E=(0,l.useCallback)(()=>{m(null)},[]);return l.createElement(v.A,{alignItems:"flex-start",flexDirection:"column",gap:g.kc},o||a?null:l.createElement(k.A,{variant:"link",type:"submit",onClick:c},l.createElement(C.A,{size:"body",color:"inherit"},l.createElement(I.sA,{id:"ADMINS_ADD_SITE_PERMISSION"}))),l.createElement(fe.A,{truncateHeaderCells:!0,columns:Ue,items:_,idField:"site_id",onRowClick:m,disableColumnFilters:!0,disableTextPointer:!0,disableSelection:!0}),d?l.createElement(He,{siteRole:d,invite:a,adminId:e,adminName:t,closeModal:E}):null)},Fe=de.A.object().shape({name:de.A.string().label("COMMON_LABEL_USERNAME").required().matches(oe.mJ,{message:l.createElement(I.sA,{id:"ADMINS_ADMIN_USERNAME_REGEX"})}),email:de.A.string().when("requires_new_password",{is:!1,then:de.A.string().label("COMMON_EMAIL").email().required()}),email_alert_grouping_enabled:de.A.boolean().label("COMMON_GROUP_SIMILAR_NOTIFICATIONS"),email_alert_grouping_delay:de.A.number().when("email_alert_grouping_enabled",{is:!0,then:de.A.number().label("COMMON_GROUP_WITHIN").required().min(1).max(60)}),x_password:de.A.string().when(["isSelf","requires_new_password"],{is:(e,t)=>e&&t,then:de.A.string().label("ADMINS_CURRENT_PASSWORD_LABEL").required()}),x_oldpassword:de.A.string().when(["isSelf"],{is:!0,then:de.A.string().when(["requires_new_password"],{is:!1,then:de.A.string().label("ADMINS_CURRENT_PASSWORD_LABEL").required()})})});var $e=a(649810);const Ve=({onConfirm:e,isValid:t,...a})=>{const n=(0,A.useDispatch)();return l.createElement($e.default,{message:"ADMINS_CONFIRM_CHANGES_PASSWORD_DESCRIPTION",title:"ADMINS_CONFIRM_CHANGES",confirmButtonProps:{disabled:!t},onConfirm:()=>{e(),n((0,ae.AS)())},...a})};var Ge=a(734707);const We=({siteAdmin:{name:e,_id:t,super_roles:a},onRemove:n})=>{const i=(0,A.useDispatch)(),[r,s]=(0,l.useState)(!1);return l.createElement(Ge.Ay,{variant:"link",onClick:()=>{i((0,Ie.Ag)({name:e,withRemoveGlobalPermissions:!1,onConfirm:()=>(s(!0),i(a?.length?(0,Ie.rz)(t):(0,Ie.T7)(t)).then(n).catch(()=>i((0,J.ox)({icon:Z.C.danger,message:"COMMON_NOTICE_REMOVE_ERROR",values:{name:e}}))).finally(()=>s(!1)))}))},loader:r?"spinner":null,type:"button"},l.createElement(v.A,{alignItems:"center",justifyContent:"flex-start"},l.createElement(C.A,{size:"inherit",color:"danger"},l.createElement(I.sA,{id:"COMMON_ACTION_REMOVE"}))))};var Ye;!function(e){e.HTML="html_email_enabled",e.PROF="is_professional_installer"}(Ye||(Ye={}));const qe=[{value:Ye.HTML,label:"COMMON_ENABLE_HTML_EMAIL_TEMPLATE"},{value:Ye.PROF,label:"COMMON_ENABLE_OPTIONS_FOR_PROF_INST"}],Ke=({id:e,value:t,children:a})=>t||a?l.createElement(v.A,{justifyContent:"space-between"},l.createElement(C.A,{size:"body"},l.createElement(I.sA,{id:e})),t?l.createElement(C.A,{color:"tertiary",size:"body"},t):null,a):null,je=({labelId:e,field:t,tooltipMessageId:a,children:n,disabled:i,allowReadOnly:r})=>l.createElement(v.A,{alignItems:"center",height:Ce.I.ROW_HEIGHT},n??l.createElement(le.A,{name:t,type:"realCheckbox",disabled:i,allowReadOnly:r}),l.createElement(C.A,{size:"body",color:i?"disabled":"inherit"},l.createElement(v.A,{alignContent:"center",gap:g.YC},l.createElement(I.sA,{id:e}),a?l.createElement(T.A,{description:l.createElement(I.sA,{id:a}),portal:!0},l.createElement(Ae.A,{style:{marginBottom:"2px"},isActive:!0,size:"original"})):null))),Xe=({labelId:e,field:t,permission:a,disabled:n})=>{const{values:i,setFieldValue:r}=(0,W.j7)(),s=i[t];return s?l.createElement(je,{labelId:e,field:t,disabled:n},l.createElement(Ee.A,{id:"adoption",checked:s.includes(a),disabled:n,onChange:({target:{checked:e}})=>r(t,e?[...s,a].sort():s.filter(e=>e!==a))})):null},Je=({headingId:e,children:t,...a})=>l.createElement(pe.A,{flex:"1 1 100%"},e&&l.createElement(C.A,{size:"header-xs",weight:"bold"},l.createElement(I.sA,{id:e})),l.createElement(v.A,{gap:g.kc,marginTop:e?g.Ln:void 0,flexDirection:"column",...a},t)),Ze=(e,t,a,l)=>{if(a){const{email_alert_grouping_delay:e}=l||{};return{...l||{},x_oldpassword:"",x_password:"",isSelf:a,...e?{email_alert_grouping_delay:(0,ue.A)(e/60,2)}:{}}}return{push_alert_enabled:t?.push_alert_enabled,email_alert_enabled:t?.email_alert_enabled,super_site_permissions:[],...e||{},x_password:"",role:e?.is_super?h.e.SUPER_ADMIN:e?.role,isSelf:a,email_alert_grouping_delay:e?.email_alert_grouping_delay?(0,ue.A)(e.email_alert_grouping_delay/60,2):1}},Qe=({adminId:e,adminName:t,close:a})=>{const n=(0,A.useDispatch)(),r=(0,A.useSelector)(ge.fR),s=(0,A.useSelector)(ge.rK),o=(0,A.useSelector)(ge.lt),d=(0,A.useSelector)((0,l.useMemo)(()=>{return t=e,(0,p.Mz)(Ne,e=>e.find(({_id:e})=>e===t));var t},[e])),m=(0,A.useSelector)((0,l.useMemo)(()=>(0,Oe.p)(e),[e])),c=(0,A.useSelector)(z.Gd),_=d&&!d.is_verified&&c?.name,[E,u]=(0,l.useState)(!1),S=s===e,g=(0,A.useSelector)(z.EL),M=!d||!d.is_verified,N=!M&&(S||!g),O=!(r||s===e),b=(0,l.useCallback)(()=>{n((0,Ie.VF)()),n((0,i.w)())},[n]),C=(0,l.useCallback)((e,{resetForm:t,setSubmitting:a})=>{const{name:l,email:i,x_password:r,x_oldpassword:s,email_alert_enabled:o,push_alert_enabled:m,html_email_enabled:c,is_professional_installer:_,email_alert_grouping_enabled:E,email_alert_grouping_delay:A,_id:u,is_super:p,is_verified:I,role:g,super_site_permissions:M,super_site_role:N,permissions:O}=e,C=o&&E?(0,ue.A)(60*A):0,T=o&&E;if(S){const e={email:i,name:l,x_oldpassword:s,x_password:r,email_alert_enabled:o,email_alert_grouping_enabled:T,email_alert_grouping_delay:C,push_alert_enabled:m,html_email_enabled:c,is_professional_installer:_};n((0,he.yf)(e)).then(b).catch(({msg:e})=>n((0,J.ox)({icon:Z.C.danger,message:"ADMINS_EDIT_SELF_ERROR",errorMessage:e}))).finally(()=>{a(!1),t()})}else{let e=[];g===h.e.ADMIN?e=M:g===h.e.SUPER_ADMIN&&(e=Te.CY.map(({value:e})=>e));const s={admin:u,email:i,email_alert_enabled:o,email_alert_grouping_enabled:T,email_alert_grouping_delay:C,html_email_enabled:c,is_professional_installer:_,is_super:p,is_verified:I,name:l,permissions:g!==h.e.READ_ONLY?Te.zi.map(({value:e})=>e):O,push_alert_enabled:m,role:g,super_site_permissions:e,super_site_role:N,x_password:r};n((0,Ie.Rr)(s,d)).then(b).catch(({msg:e})=>n((0,J.ox)({icon:Z.C.danger,message:"ADMINS_EDIT_ADMIN_ERROR",values:{name:l},errorMessage:e}))).finally(()=>{a(!1),t()})}},[S,d,b,n]);return l.createElement(W.l1,{initialValues:Ze(d,m,S,o),enableReinitialize:!0,onSubmit:C,validationSchema:Fe},({values:n,handleSubmit:i,handleReset:r,dirty:s,isValid:o})=>l.createElement(l.Fragment,null,l.createElement(v.A,{flexDirection:"column"},l.createElement(Je,null,l.createElement(Ke,{id:"COMMON_EMAIL",value:n.email}),l.createElement(Ke,{id:"COMMON_STATUS"},l.createElement(x,{verified:!!(d?.is_verified??m?.is_verified),verifiedMessage:l.createElement(I.sA,{id:"ADMINS_VERIFIED"})})),m?.last_site_name?l.createElement(Ke,{id:"ADMINS_LAST_SITE"},l.createElement(U,{siteName:m.last_site_name})):null,l.createElement(Ke,{id:"ADMINS_LAST_LOGIN_IP",value:d?.last_login_ip})),O?null:l.createElement(l.Fragment,null,l.createElement(Je,null,l.createElement(le.A,{full:!0,name:"name",variant:"secondary",label:"COMMON_LABEL_USERNAME",allowReadOnly:N,disabled:M}),l.createElement(le.A,{full:!0,name:"x_password",type:"password",variant:"secondary",label:"ADMINS_EDIT_PASSWORD_LABEL",autoComplete:"new-password",passwordToggle:!0,allowReadOnly:N,disabled:M})),l.createElement(Je,null,l.createElement(je,{labelId:"COMMON_ACTIONS_REMOTE_ACCESS",tooltipMessageId:"ADMINS_ADMIN_REMOTE_DESCRIPTION",disabled:!0},l.createElement(Ee.A,{id:"remoteAccess",readOnly:!0,disabled:!0,checked:!!(m?.ubic_uuid??d?.for_sso)})),n.role!==h.e.READ_ONLY||S?null:l.createElement(l.Fragment,null,l.createElement(Xe,{labelId:"ADMINS_PERMISSION_DEVICE_ADOPTION",field:"permissions",disabled:M,permission:Te.aX.ADOPT_DEVICES}),l.createElement(Xe,{labelId:"ADMINS_PERMISSION_DEVICE_RESTART",field:"permissions",disabled:M,permission:Te.aX.RESTART_DEVICES})),n.role===h.e.ADMIN?l.createElement(l.Fragment,null,l.createElement(Xe,{labelId:"ADMINS_PERMISSION_DASHBOARD_EDITING",field:"super_site_permissions",disabled:M,permission:Te.pl.EDIT_DASHBOARD}),l.createElement(Xe,{labelId:"ADMINS_PERMISSION_SYSTEM_STATS",field:"super_site_permissions",disabled:M,permission:Te.pl.ACCESS_SYSTEM_STATS}),l.createElement(Xe,{labelId:"ADMINS_PERMISSION_READ_ONLY_ACCESS_TO_ALL_SITES",field:"super_site_permissions",disabled:M,permission:Te.pl.READ_ONLY_ALL_SITES}),l.createElement(Xe,{labelId:"ADMINS_PERMISSION_SHOW_PENDING_DEVICES",field:"super_site_permissions",disabled:M,permission:Te.pl.SHOW_PENDING_DEVICES})):null),m?.roles?.length||_?l.createElement(Je,{headingId:"ADMINS_ADMIN_SITE_PERMISSIONS"},l.createElement(Be,{roles:[...m?.roles||[],..._?[{site_id:c._id,site_name:c.name,site_desc:c.desc,permissions:d.permissions,role:d.role}]:[]],isSuper:d?.is_super??m?.is_super,invite:_?{name:n.name,email:n.email,super_site_permissions:n.super_site_permissions,for_sso:d.for_sso}:null,adminId:e,adminName:t})):null,l.createElement(Je,{headingId:"ADMINS_PUSH_NOTIFICATION_SETTINGS"},l.createElement(je,{labelId:"COMMON_MOBILE",disabled:M,field:"push_alert_enabled"}),l.createElement(je,{labelId:"COMMON_EMAIL",disabled:M,field:"email_alert_enabled"}),l.createElement(be.A,{hidden:!n.email_alert_enabled,height:Ce.I.ROW_HEIGHT},l.createElement(v.A,{justifyContent:"space-between",alignItems:"center"},l.createElement(le.A,{type:"realCheckbox",name:"email_alert_grouping_enabled",allowReadOnly:N,disabled:M},l.createElement(I.sA,{id:"COMMON_GROUP_SIMILAR_NOTIFICATIONS"})),n.email_alert_grouping_enabled&&l.createElement(v.A,{width:120},l.createElement(le.A,{name:"email_alert_grouping_delay",type:"number",variant:"secondary",allowReadOnly:N,disabled:M,min:1,full:!0}))))),n.role!==h.e.READ_ONLY&&S?l.createElement(Je,{headingId:"ADMINS_ADMIN_ADVANCED_OPTIONS"},qe.map(({label:e,value:t})=>l.createElement(je,{field:t,labelId:e,allowReadOnly:N,key:t}))):null)),!m||m.roles?.length||_?null:l.createElement(Je,{alignItems:"flex-start"},l.createElement(We,{siteAdmin:m,onRemove:()=>{b(),a()}})),l.createElement(Ve,{isOpen:E,isValid:o,onConfirm:()=>{u(!1),i()},onCancel:()=>{r(),u(!1)}},l.createElement(le.A,{full:!0,name:"x_oldpassword",type:"password",autoComplete:"new-password",variant:"secondary",passwordToggle:!0,allowReadOnly:N})),l.createElement(Se.A,{isDirty:s,onFormSubmit:o?i:()=>u(!0),onFormCancel:r})))},et=({adminId:e,adminName:t,close:a,...n})=>l.createElement(_e.A,{in:!!e,side:"right",header:l.createElement(C.A,{weight:"bold",size:"body"},t),onClose:a},e?l.createElement(Qe,{adminId:e,adminName:t,close:a,...n}):null);var tt=a(59308),at=a(269672);const lt=e=>(0,p.Mz)(Ne,Oe.f,X,ge.rK,(t,a,l,n)=>e===c.h.CURRENT_SITE?[...t.map(({_id:e,avatar_url:t,name:a,role:l,email:i,is_super:r,is_verified:s,last_login_timestamp:o})=>({_id:e,name:a,avatar_url:t,isSelf:e===n,role:l,email:i,is_super:r,is_verified:s,last_login_timestamp:1e3*o})),...l.map(e=>({_id:e._id,isSelf:e._id===n,name:e.name,role:h.e.HOTSPOT,email:void 0,is_super:!1,is_verified:!0}))]:[...a.map(({_id:e,avatar_url:t,name:a,email:l,is_super:i,is_verified:r,roles:s,last_site_name:o,last_login_timestamp:d})=>({_id:e,avatar_url:t,name:a,isSelf:e===n,email:l,is_super:i,is_verified:r,last_site_name:o,last_login_timestamp:1e3*d,role:s.every(e=>e.role===s[0]?.role)?s[0]?.role:h.e.MULTIPLE,sites:s.map(({site_desc:e})=>e)}))]),nt=e=>(0,p.Mz)(lt(e),e=>e.map(({_id:e,name:t,email:a})=>({id:e,name:t,email:a}))),it=({section:e})=>{const{formatMessage:t}=(0,I.tz)(),a=(0,A.useSelector)((e=>(0,p.Mz)(lt(e),(0,tt.U)(at.U4.ADMINS),(e,t)=>e.filter(({_id:e})=>!t||t.has(e))))(e)),{editAdminModalId:i=null}=(0,n.g)(),[r,s]=(0,l.useState)(i),[o,d]=(0,l.useState)(null),[m,_]=(0,l.useState)(0),u=(0,l.useMemo)(()=>((e,t)=>[{id:E.NAME,header:B,size:w[E.NAME],cell:({row:{original:{avatar_url:e,name:t,isSelf:a}}})=>l.createElement(F,{alignItems:"center",gap:g.YC},l.createElement(f.A,{image:e}),l.createElement(C.A,{size:"body",color:"secondary"},t),a?l.createElement(G,null):null)},{id:E.STATUS,header:B,size:w[E.STATUS],cell:({row:{original:{is_verified:e}}})=>l.createElement(x,{verified:e})},{id:E.EMAIL,header:B,size:w[E.EMAIL],cell:({row:{original:{email:e}}})=>l.createElement(C.A,{size:"body",color:"secondary"},e||l.createElement(I.sA,{id:"COMMON_FALLBACK"}))},...e===c.h.ALL_SITES?[{id:E.SITES,header:B,size:w[E.SITES],cell:({row:{original:{sites:e=[]}}})=>e.length?l.createElement(v.A,null,l.createElement(T.A,{description:l.createElement($,{sites:e}),portal:!0},e.length)):0}]:[],{compare:(0,D.l0)(({role:e,is_super:a})=>t({id:(0,P.c)({is_super:a,role:e})})),id:E.ROLE,header:B,size:w[E.ROLE],cell:({row:{original:{is_super:e,role:t}}})=>l.createElement(I.sA,{id:(0,P.c)({is_super:e,role:t})})},...e===c.h.ALL_SITES?[{id:E.LAST_SITE,header:B,size:w[E.LAST_SITE],cell:({row:{original:{last_site_name:e}}})=>e?l.createElement(U,{siteName:e}):l.createElement(I.sA,{id:"COMMON_FALLBACK"})}]:[],{id:E.LAST_LOGIN,header:B,size:w[E.LAST_LOGIN],cell:({row:{original:{last_login_timestamp:e}}})=>e?l.createElement(C.A,{size:"body",color:"secondary",truncate:!0},l.createElement(L.A,{timestamp:e})):l.createElement(I.sA,{id:"COMMON_FALLBACK"})}])(e,t),[e,t]),b=(0,l.useCallback)(({_id:e,role:t,name:a})=>{t!==h.e.HOTSPOT?d({adminId:e,adminName:a}):s(e)},[d]),R=(0,l.useCallback)(()=>s(void 0),[]),y=(0,l.useCallback)(({rowsPerPage:e,pageNumber:t})=>l.createElement(S.A,{columns:u,data:a,rowStyle:g.gc,width:"100%",onRowClick:b,pageIndex:t,pageSize:e}),[u,a,b]);return l.createElement(O.A,null,l.createElement(M.A,{itemCount:a.length,tableType:N.l.ADMINS,onRenderTable:y,onPageChanged:_,pageNumber:m}),r?l.createElement(ce,{closeModal:R,hotspotOperatorId:r}):null,l.createElement(et,{...o,close:()=>d(null)}))};const rt=(0,a(189601).WY)()((0,p.Mz)(()=>({[c.h.CURRENT_SITE]:{[d.o9.ROUTE_COMPONENT]:it,[d.o9.SIDE_NAVIGATION]:void 0,[d.o9.ROUTE]:{[d.Fm.AVAILABLE]:!0},[d.o9.NAVIGATION]:{[d.mx.AVAILABLE]:!0},[d.o9.DEPENDENCIES]:void 0},[c.h.ALL_SITES]:{[d.o9.ROUTE_COMPONENT]:it,[d.o9.SIDE_NAVIGATION]:void 0,[d.o9.ROUTE]:{[d.Fm.AVAILABLE]:!0},[d.o9.NAVIGATION]:{[d.mx.AVAILABLE]:!0},[d.o9.DEPENDENCIES]:void 0}})),e=>e),st=e=>{const t=(0,A.useSelector)(rt);return l.createElement(u.A,{routes:t,...e})};var ot=a(834959),dt=a(413357),mt=a(592510),ct=a(457311),_t=a(75585),Et=a(572112),At=a(366702),ut=a(874807),pt=a(979106);const St=(0,b.A)(pt.A,{shouldForwardProp:e=>"height"!==e})`
  position: absolute;
  left: 0;
  right: 0;
  ${({height:e})=>e?`height: ${e};`:""}
`,It=({routes:e,currentRoute:t,handleSectionChange:a,variant:n,className:i})=>{const{formatMessage:r}=(0,I.tz)(),s=(0,l.useMemo)(()=>e.map(({id:e,intlKey:t,disabled:a,badge:l})=>({id:e,label:r({id:t,defaultMessage:void 0}),disabled:"function"==typeof a?a():a,badge:l})),[e,r]),o=(0,l.useCallback)(({id:e})=>a(e),[a]);return l.createElement(St,{tabs:s,fullHeightTabs:!0,selectedTab:t,onSelectTab:o,variant:n,height:"capsule"===n?"":"100%",className:i})};var ht=a(362412);const gt=(0,b.A)(ht.A)`
  white-space: nowrap;
  margin-right: auto;
  > div > div {
    box-shadow: none !important;
    padding-left: ${g.xO};
  }
  z-index: 2;
`;const Mt=a(132196).AH`
  height: 32px;
`,Nt=({routes:e,currentRoute:t,handleSectionChange:a,className:n})=>{const{formatMessage:i}=(0,I.tz)(),r=(0,l.useMemo)(()=>e.map(({id:e,intlKey:t="COMMON_UNKNOWN",disabled:a})=>({value:e,label:i({id:t,defaultMessage:void 0}),disabled:"function"==typeof a?a():a})),[e,i]),s=(0,l.useCallback)(({value:e})=>{a(e)},[a]);return l.createElement(gt,{options:r,value:t,onChange:s,inputContainerClassName:Mt,width:180,arrowSize:"small",portal:!0,className:n})},Ot=(0,b.A)(C.A)`
  position: absolute;
  transform: translateX(-50%);
  left: 50%;
`,bt=({currentRoute:e,breakPointWidth:t,routes:a,paramKey:i,variant:r,handleSectionChangePath:s=ut.Ay,className:o,dropdownClassName:d})=>{const{path:m,params:c}=(0,n.W5)(),_=(0,n.W6)(),{width:E}=(0,At.A)(),A=(0,l.useCallback)(e=>_.push(s({id:e,path:m,params:c})||(0,n.tW)(m,{...c,[i]:e})),[m,c,i,_,s]);return E>=t?l.createElement(It,{routes:a,currentRoute:e,handleSectionChange:A,variant:r,className:o}):l.createElement(Nt,{routes:a,currentRoute:e,handleSectionChange:A,className:d})},Ct=({routes:e,...t})=>1===e.length?l.createElement(Ot,{size:"body",weight:"bold"},l.createElement(I.sA,{id:e[0].intlKey,defaultMessage:void 0})):l.createElement(bt,{routes:e,...t});var Tt=a(852182),ft=a(974546),Rt=a(879077),Dt=a(639775),vt=a(451919);const Lt=["id","name","email"],wt=new ft.A.Document({tokenize:"forward",cache:500,encode:Dt.Rd,document:{store:Lt,id:"id",index:Lt}}),yt=({section:e})=>l.createElement(Rt.A,{lsKey:vt.UZ.ADMIN_SEARCH,searchModelName:at.U4.ADMINS,searchIndex:wt,enabledColumns:Lt,records:(0,A.useSelector)(nt(e)),recordIdKey:"id"}),Pt=[{id:c.h.CURRENT_SITE,intlKey:"ADMINS_CURRENT_SITE",label:l.createElement(I.sA,{id:"ADMINS_CURRENT_SITE"})},{id:c.h.ALL_SITES,intlKey:"ADMINS_ALL_SITES",label:l.createElement(I.sA,{id:"ADMINS_ALL_SITES"})}],xt=({section:e})=>{const t=(0,A.useDispatch)(),a=(0,A.useSelector)(z.EL),n=(0,A.useSelector)(ge.fR);return l.createElement(Tt.A,{showBorderBottom:!1,hideFilterButton:!0,rightContent:a?null:l.createElement(k.A,{type:"button",name:"add-new-admin",variant:"inline",size:"medium",onClick:()=>{t((0,ae.to)({modalType:te.A.ADD_ADMIN_MODAL}))},Icon:l.createElement(_t.A,null)}),leftContent:l.createElement(yt,{section:e})},n?l.createElement(Ct,{routes:Pt,currentRoute:e,breakPointWidth:Et.A.ML.TO,paramKey:m.On,variant:"capsule"}):null)},kt=(0,n.y)(({match:{params:e}})=>(0,o.A)([(0,dt.Zi)(ot.B.ADMINS),(0,Ie.VF)(void 0,{crudCacheStrategy:{type:mt.e.CACHE}}),(0,i.w)(void 0,{crudCacheStrategy:{type:mt.e.CACHE}}),(0,K.Hq)(void 0,{crudCacheStrategy:{type:mt.e.CACHE}}),(0,ct.Uc)(void 0,{crudCacheStrategy:{type:mt.e.CACHE}})],l.createElement(s.A,null,l.createElement(xt,{section:e.section}),l.createElement(l.Suspense,{fallback:null},l.createElement(n.dO,null,l.createElement(r.F,{path:_[c.h.CURRENT_SITE],render:t=>l.createElement(st,{id:c.h.CURRENT_SITE,section:e.section,...t})}),l.createElement(r.F,{path:_[c.h.ALL_SITES],render:t=>l.createElement(st,{id:c.h.ALL_SITES,section:e.section,...t})})))),{trackingName:d.VO.ADMINS}))},197562:(e,t,a)=>{a.d(t,{A:()=>i});var l=a(71479),n=a(566723);const i=(0,l.A)("div")`
  height: 100%;
  flex: 1;
  overflow: scroll;
  margin-left: ${n.Ln};
  padding: ${n.Ln} 0 0 0;
`},151360:(e,t,a)=>{a.d(t,{A:()=>l});const l=(0,a(71479).A)("div",{shouldForwardProp:e=>"hidden"!==e&&"height"!==e})`
  /* Height animation from UIC <Accordion/> */
  transition:
    height 300ms cubic-bezier(0.7, 0, 0.3, 1),
    opacity 100ms ease-in;
  height: ${e=>e.height}px; // cannot animate to height: auto
  opacity: 1;
  ${e=>e.hidden&&"\n    visibility: hidden;\n    height: 0;\n    min-height: unset;\n    opacity: 0;\n  "}
`},852182:(e,t,a)=>{a.d(t,{A:()=>D});var l=a(296540),n=a(927099),i=a(271856),r=a(71479),s=a(459449),o=a(294303),d=a(955161),m=a(566723),c=a(968906),_=a(311785);const E=(0,r.A)(o.A,(0,_.A)("showBorderBottom","noPadding"))`
  border-bottom: ${({showBorderBottom:e,theme:{motifPalette:{neutral03:t}}})=>e?`1px solid ${t}`:"none"};
  box-sizing: border-box;
  padding: ${({noPadding:e})=>e?0:`${m.Ln} ${m.Ln} 0 ${m.Ln}`};
  z-index: 1;
`,A=({showBorderBottom:e=!0,height:t=48,children:a,noPadding:n})=>l.createElement(E,{...c.A.addDataTestId(c.A.TestId.CONTROL_PANEL_HEADER),flex:"none",className:"base-control-panel-classname",position:"relative",alignItems:"center",justifyContent:"space-between",height:t,showBorderBottom:e,noPadding:n},a);var u=a(956347),p=a(979106);const S=({items:e,...t})=>{const{params:a,path:n}=(0,u.W5)(),i=(0,u.zy)(),r=(0,u.W6)(),s=e.find(({path:e})=>e===n)||((e,{pathname:t})=>e.find(({path:e})=>new RegExp(e.replace(/\/:\w+\?.*/g,"/?.*").replace(/:\w+/g,"\\w+").replace(/\//g,"\\$&")).test(t)))(e,i);return l.createElement(p.A,{tabs:e,selectedTab:s?.id,onSelectTab:({path:e,params:t={}})=>r.push((0,u.tW)(e,{...a,...t})),...t})},I=(0,r.A)(S)`
  height: 100%;
  position: absolute;
  left: 0;
  right: 0;
  div,
  button {
    height: 100% !important;
  }
`,h=({routes:e})=>{const t=(0,l.useMemo)(()=>e&&e.map(({id:e,label:t,disabled:a,path:l,...n})=>({id:e,label:t,disabled:"function"==typeof a?a(n):a,path:l})),[e]);return t?l.createElement(I,{selectedTabBold:!0,items:t}):null};var g=a(469733),M=a(889954),N=a(601021);const O=(0,r.A)(M.A,{shouldForwardProp:e=>"disabled"!==e})`
  pointer-events: ${({disabled:e})=>e?"none":"auto"};
  opacity: ${({disabled:e})=>e?.45:1};
  cursor: ${({disabled:e})=>e?"default":"pointer"};
  & button {
    width: ${m.fS};
    height: ${m.fS};
  }
`,b=({filtersActive:e,disabled:t})=>{const a=(0,g.useDispatch)();return l.createElement(O,{disabled:t,onClick:()=>{!t&&a((0,N.p)(!0))},filtersActive:e,...c.A.addDataTestId(c.A.TestId.CONTROL_PANEL_HEADER_FILTER_BUTTON)})},C=(0,r.A)("div")`
  padding: 0 ${({theme:{spacing:e}})=>e["spacing-m"]};
  white-space: normal;
`,T=(0,r.A)(o.A)`
  svg {
    color: ${({theme:{motifPalette:{neutral08:e}}})=>e};
  }
`,f=(0,r.A)(n.A,{shouldForwardProp:e=>"addMargin"!==e})`
  ${({addMargin:e})=>e&&"margin-left: 50%;"}
  position: absolute;
  transform: translateX(-50%);
  left: 50%;
`,R=e=>l.createElement(i.A,{position:"bottom",width:"208px",portal:!0,description:l.createElement(C,null,l.createElement(s.sA,{id:"COMMON_DISPLAY_OPTS_DISABLED"}))},e),D=({routes:e=[],hideFilterButton:t=!1,children:a,filtersActive:n,leftContent:i,rightContent:r,areDisplayOptionsDisabled:s,showDisabledTooltip:o,showBorderBottom:m,height:c,noPadding:_})=>{const E=e?.length>1,u=!E&&1===e.length;return l.createElement(A,{showBorderBottom:m,height:c,noPadding:_},i||null,E?l.createElement(h,{routes:e}):null,u?l.createElement(f,{size:"body",weight:"bold"},e[0].label):null,l.createElement(T,{height:"100%",flex:E||u?"none":1,alignItems:"center",justifyContent:"flex-end",marginLeft:"auto",className:"base-control-panel-right-content-classname"},a,r||null,t?null:l.createElement(d.A,{condition:s&&o,wrapper:R},l.createElement(b,{disabled:s,filtersActive:n}))))}},649810:(e,t,a)=>{a.r(t),a.d(t,{default:()=>E});var l=a(296540),n=a(469733),i=a(927099),r=a(71479),s=a(459449),o=a(126457),d=a(372737),m=a(705426);const c=(0,r.A)("div")`
  line-height: 1.5;
  word-break: break-word;
`,_=(0,r.A)(i.A)`
  color: ${({theme:{motifPalette:{text01:e}}})=>e} !important;
  padding-right: ${({theme:{spacing:e}})=>e["spacing-xl"]};
`,E=({message:e,title:t,onConfirm:a,children:r=null,messageValues:E={},size:A="small",titleValues:u={},onCancel:p=null,confirmButtonProps:S={},confirmButtonText:I,...h})=>{const g=(0,n.useDispatch)(),M=(0,l.useCallback)(()=>{p?p():g((0,o.AS)())},[p,g]);return(0,l.useEffect)(()=>{function e(e){e.stopPropagation(),e.key===d.U.ENTER?a():e.key===d.U.ESCAPE&&M()}return window.addEventListener("keydown",e,!0),()=>{window.removeEventListener("keydown",e,!0)}},[M,a]),l.createElement(m.A,{actions:[{text:l.createElement(s.sA,{id:"COMMON_ACTION_CANCEL"}),type:"button",onClick:M},{text:l.createElement(s.sA,{id:I??"COMMON_ACTION_CONFIRM"}),type:"button",variant:"primary",onClick:()=>a(),...S}],size:A,title:l.createElement(_,{size:"header-xs",truncate:!0},l.createElement(s.sA,{id:t,values:u})),...h},l.createElement(c,null,l.createElement(i.A,{size:"body"},l.createElement(s.sA,{id:e,values:E}))),r)}}}]);