"use strict";(self.webpackChunkunifiNetworkUi=self.webpackChunkunifiNetworkUi||[]).push([[11673],{17724:(e,t,a)=>{a.r(t),a.d(t,{default:()=>M});var r=a(469733),n=a(296540),s=a(927099),i=a(832914),c=a(758649),l=a(566198),o=a(256126),A=a(451919),E=a(510497),d=a(801081),u=a(139587),O=a(276907),m=a(919952);const _=(0,d.Mz)(e=>e[m.U.SHARED][O.N.LOADER_ADAPTER],e=>e[u.V.REASONS]);var p=a(294303),N=a(183989),T=a(699784),I=a(602021),R=a(968906),h=a(227598),f=a(633620),g=a(427463),C=a(71479),S=a(566723);const k=(0,C.A)(f.A)`
  margin-right: ${S.Ln};
  height: 24px;
  width: 24px;
`,D=(0,C.A)(g.A)`
  margin-right: ${S.kc};
  height: 16px;
  width: 16px;
`,U=(0,C.A)(h.A)`
  left: 50px;
`,M=()=>{const e=(0,r.useDispatch)(),t=(0,r.useSelector)(_),a=(0,r.useSelector)(I.AF),d=(0,r.useSelector)(I.LF),u=(0,n.useCallback)(()=>{a&&E.u.setItem(A.lP.HOTSPOT_LOGOUT_SITE_NAME,d),e((0,N.bB)())},[e,a,d]),O=(0,n.useCallback)(()=>n.createElement(p.A,{...R.A.addDataTestId(R.A.TestId.HEADER_USERICON)},n.createElement(k,{actionable:!0})),[]);return n.createElement(l.A,{size:"classic",title:n.createElement(s.A,{size:"header-s",weight:"normal",color:"tertiary"},n.createElement(T.sA,{id:"COMMON_NETWORK"})),icon:n.createElement(o.A,{size:"full"})},t.length?n.createElement(U,{isLoading:!0,placement:"bottom"}):null,n.createElement(p.A,null,n.createElement(i.A,{renderToggle:O,size:"small",align:"bottomCenter",toggleOffset:8},n.createElement(p.A,{alignContent:"center"},n.createElement(D,{isActive:!0}),n.createElement(c.A,{type:"button",variant:"inline",onClick:u,...R.A.addDataTestId(R.A.TestId.HEADER_SIGNOUT_BUTTON)},n.createElement(T.sA,{id:"COMMON_HEADER_USER_PROFILE_SIGN_OUT"}))))))}},183989:(e,t,a)=>{a.d(t,{aQ:()=>o,bB:()=>l});var r=a(489050),n=a(789768),s=a(953141),i=a(16795);const c=e=>({error:e,type:i.ID}),l=()=>e=>{r.K.post("/api/logout").then(()=>e((0,n.oX)()))},o=e=>async t=>{await t({type:i.V8});try{return await r.K.post("/api/login",{strict:!0,...e}),t(async e=>e({type:i.FE}))}catch(e){const{response:a}=e;if(400===a?.status&&a?.data)switch(a.data?.meta?.msg){case s.U.apiErrUbic2faTokenRequired:return t(((e=!1)=>({type:i.HH,payload:{require2Fa:e}}))(!0));case s.U.apiErrInvalid2FAToken:return t(c("COMMON_VALIDATION_INVALID_2FA_TOKEN"))}return t(c(400===a?.status?"COMMON_VALIDATION_INVALID_USERNAME_OR_PASSWORD":"COMMON_NOTICE_REQUEST_ERROR"))}}},489050:(e,t,a)=>{a.d(t,{K:()=>c,o:()=>i});var r=a(272505),n=a.n(r);const s=n().create({baseURL:"/",withCredentials:!0,xsrfCookieName:"csrf_token",xsrfHeaderName:"X-Csrf-Token"}),i=n().create();s.interceptors.response.use(e=>e.data&&e.data instanceof ArrayBuffer?e:{...e,data:e.data.data,meta:e.data.meta});const c=s}}]);