PageSourceSearch

https://app.getmika.de/assets/AccountPage-DyJufe52.js

js getmika.de collected 2026-10-04 20:34:08 UTC 21,729 bytes, 1 lines download raw bytes

1import{r as u,G as k,J as Ne,j as e,K as q,f as ae,s as ze,M as W,u as D,av as E,fH as ue,bn as Oe,B as w,T as v,ak as K,c as T,cw as F,D as Y,bF as X,bs as Z,A as M,bH as ee,Y as Ue,I as Ie,S as te,W as we,aB as qe,f6 as Ke,fI as We,R as $,am as Le,H as Qe,e0 as Ve}from"./index-7xGZQarM.js";import{D as Ye}from"./DefaultPageLayout-bbCS046_.js";import{t as Se}from"./zod-CERegKzJ.js";import{L as U}from"./LoadingButton-yCAXRQtY.js";import{u as Ce,C as se}from"./index.esm-DOD_RurM.js";import{c as Be,u as He,g as Je}from"./flagElements-CFTyc_Q3.js";import{p as Ge,P as ie}from"./PasswordTextField-QBbjrwaj.js";import{a as V,l as $e}from"./apiError-Cz_4GWEF.js";import{R as Xe}from"./RefreshRounded-N_hO8K9i.js";import{R as Ze,a as et,A as tt}from"./RecoveryCodeList-pEooAy_F.js";import{G as P}from"./Grid2-CqkvP9PW.js";import"./ArrowBack-Dfl3xaIh.js";import"./Fab-CQzwzmnA.js";import"./InputAdornment-CC073Qcr.js";import"./Visibility-XgqSSj3M.js";import"./VisibilityOff-DhWxHQS9.js";import"./DownloadRounded-5-Qbv_gz.js";import"./download-595V7hF1.js";import"./createGrid-ZBMOdsSe.js";const st=4.5*60*1e3,at=["totp-status"],Ae=u.createContext(null),nt=({children:t})=>{const[s,o]=u.useState(null),a=u.useRef(0),{fetchPrivate:c}=k(),{data:d,isLoading:n}=Ne({queryKey:at,queryFn:()=>c({endpoint:"api/auth/totp/",options:{method:"GET"},base_url:q.ledger_url})}),m=d?.is_active??!1,h=u.useCallback(i=>{o(i),a.current=Date.now()},[]),g=u.useCallback(()=>s!==null&&Date.now()-a.current<st,[s]);return e.jsx(Ae.Provider,{value:{sessionToken:s,saveMFASession:h,hasValidSession:g,isMFAActive:m,isLoading:n},children:t})},de=()=>{const t=u.useContext(Ae);if(!t)throw new Error("useMFASession must be used within a MFASessionProvider");return t},me=()=>{const{fetchPrivate:t}=k(),{data:s}=ae(),{updateAuthResult:o}=ze(),a=W(),{t:c}=D("account"),d=s?.username,n=f=>{if(!d)throw new Error("Not authenticated");return t({endpoint:`api/users/${d}/`,metricKey:"api/users/:username",options:{method:"PATCH",body:JSON.stringify(f)},base_url:q.ledger_url})},{mutateAsync:m,isPending:h}=E({mutationFn:n,onSuccess:()=>a.invalidateQueries({queryKey:ue}),successMessage:c("account.personal_info.update_success"),errorMessage:c("account.personal_info.update_error")}),{mutate:g,isPending:i}=E({mutationFn:n,onSuccess:()=>a.invalidateQueries({queryKey:ue}),successMessage:c("account.notification_preferences.update_success"),errorMessage:c("account.notification_preferences.update_error")}),{mutateAsync:b,isPending:x}=E({mutationFn:({old_password:f,new_password:j,sessionToken:C})=>t({endpoint:"api/auth/change-password/",options:{method:"POST",body:JSON.stringify({...f?{old_password:f}:{},new_password:j}),...C?{headers:{"X-MFA-Session":C}}:{}},base_url:q.ledger_url}),onSuccess:f=>o(Oe(f.auth)),successMessage:c("account.change_password.success"),errorMessage:!1});return{updateAccount:m,isUpdatingAccount:h,updateNotificationLanguage:g,isUpdatingNotificationLanguage:i,changePassword:b,isChangingPassword:x}},ot=F.object({first_name:F.string().optional(),last_name:F.string().optional(),email:F.string().email().or(F.literal("")).optional(),phone_number:F.string().optional()}),rt=({username:t,firstName:s,lastName:o,email:a,phoneNumber:c,onClose:d})=>{const{t:n}=D("account"),{updateAccount:m,isUpdatingAccount:h}=me(),{handleSubmit:g,register:i,control:b,formState:x}=Ce({resolver:Se(ot),defaultValues:{first_name:s,last_name:o,email:a,phone_number:c??""}}),f=g(async j=>{await m({...j,phone_number:j.phone_number?j.phone_number:null}),d()});return e.jsxs(w,{sx:{p:2},component:"form",onSubmit:f,children:[e.jsx(v,{variant:"h6",sx:{mb:3},children:n("account.personal_info.update_title")}),e.jsxs(w,{sx:{display:"flex",flexDirection:"column",gap:2.5},children:[e.jsx(K,{label:n("account.personal_info.first_name"),size:"small",error:!!x.errors.first_name,slotProps:{htmlInput:i("first_name")}}),e.jsx(K,{label:n("account.personal_info.last_name"),size:"small",error:!!x.errors.last_name,slotProps:{htmlInput:i("last_name")}}),e.jsx(se,{name:"phone_number",control:b,render:({field:j})=>e.jsx(Be,{...j,size:"small",fullWidth:!0,defaultCountry:"DE",preferredCountries:["DE","AT","CH"],getFlagElement:Je,unknownFlagElement:He,label:n("account.personal_info.phone_number")})}),e.jsxs(w,{sx:{display:"flex",justifyContent:"flex-end",gap:1,mt:1},children:[e.jsx(T,{color:"inherit",onClick:d,children:n("account.cancel")}),e.jsx(U,{type:"submit",label:n("account.save"),variant:"contained",loading:h,disabled:!x.isDirty})]})]})]})},ct=()=>{const{fetchPrivate:t}=k();return E({mutationFn:({password:s,code:o})=>t({endpoint:"api/auth/mfa-session/",options:{method:"POST",body:JSON.stringify({password:s,...o?{code:o}:{}})},base_url:q.ledger_url}),successMessage:!1,errorMessage:!1})},Pe=({open:t,onClose:s,onSuccess:o})=>{const{t:a}=D("account"),{mutateAsync:c,isPending:d}=ct(),{saveMFASession:n}=de(),m=u.useCallback(l=>{l&&setTimeout(()=>l.focus(),150)},[]),[h,g]=u.useState("password"),[i,b]=u.useState(""),[x,f]=u.useState(""),[j,C]=u.useState(!1),[I,A]=u.useState(null),O=()=>{g("password"),b(""),f(""),C(!1),A(null)},N=()=>{O(),s()},p=async()=>{A(null);try{const l=await c({password:i});if(l.requires_totp){g("totp_code");return}const y=l.session_token??"";n(y),O(),o(y)}catch(l){const y=l;A(y?.description||y?.message||a("account.mfa.invalid_password"))}},_=async()=>{A(null);try{const y=(await c({password:i,code:x})).session_token??"";n(y),O(),o(y)}catch(l){const y=l;A(y?.description||y?.message||a("account.mfa.invalid_code"))}};return e.jsxs(Y,{open:t,onClose:N,maxWidth:"xs",fullWidth:!0,children:[e.jsx(X,{children:a("account.mfa.verify_identity")}),e.jsxs(Z,{children:[h==="password"&&e.jsxs(e.Fragment,{children:[e.jsx(v,{variant:"body2",sx:{mb:2},children:a("account.mfa.password_prompt")}),e.jsx(K,{fullWidth:!0,inputRef:m,type:"password",autoComplete:"current-password",label:a("account.mfa.password_label"),slotProps:{htmlInput:{"data-testid":"account-mfa-auth-password"}},value:i,onChange:l=>b(l.target.value),onKeyDown:l=>l.key==="Enter"&&i&&p()})]}),h==="totp_code"&&e.jsxs(e.Fragment,{children:[e.jsx(v,{variant:"body2",sx:{mb:2},children:a(j?"account.mfa.recovery_code_prompt":"account.mfa.recovery_totp_prompt")}),e.jsx(K,{fullWidth:!0,inputRef:m,autoComplete:"one-time-code",inputMode:"numeric",label:a(j?"account.mfa.recovery_code_label":"account.mfa.code_label"),slotProps:{htmlInput:{"data-testid":"account-mfa-auth-code"}},value:x,onChange:l=>f(l.target.value),onKeyDown:l=>l.key==="Enter"&&x&&_()}),e.jsx(T,{onClick:()=>{C(!j),f("")},size:"small",color:"secondary",sx:{justifyContent:"flex-start",mt:.5},children:e.jsx(v,{component:"span",sx:{fontWeight:600},children:a(j?"account.mfa.use_authenticator":"account.mfa.use_recovery_code")})})]}),I&&e.jsx(M,{severity:"error",sx:{mt:1},"data-testid":"account-mfa-auth-error",children:I})]}),e.jsxs(ee,{children:[e.jsx(T,{onClick:N,children:a("account.cancel")}),h==="password"&&e.jsx(U,{label:a("account.mfa.continue"),variant:"contained",loading:d,onClick:p,disabled:!i,"data-testid":"account-mfa-auth-continue"}),h==="totp_code"&&e.jsx(U,{label:a("account.mfa.continue"),variant:"contained",loading:d,onClick:_,disabled:!x,"data-testid":"account-mfa-auth-continue"})]})]})},it=()=>{const{t}=D("account"),{t:s}=D("authentication"),{changePassword:o,isChangingPassword:a}=me(),{sessionToken:c,hasValidSession:d,isMFAActive:n}=de(),[m,h]=u.useState(!1),g=F.object({old_password:n?F.string().optional():F.str
1ing().min(1),new_password:Ge,confirm_password:F.string()}).refine(p=>p.new_password===p.confirm_password,{message:s("reset_password.passwords_do_not_match"),path:["confirm_password"]}),{handleSubmit:i,control:b,setError:x,formState:f,reset:j,watch:C}=Ce({resolver:Se(g),mode:"onTouched",defaultValues:{old_password:"",new_password:"",confirm_password:""}}),I=C("new_password"),A=async(p,_)=>{try{await o({old_password:p.old_password||void 0,new_password:p.new_password,sessionToken:_||void 0}),j()}catch(l){const y=l;if(y?.statusCode===401)x("old_password",{message:t("account.change_password.incorrect_password")});else{const J=y?.statusCode===400?V(l):void 0;x("root",{message:J??t("account.change_password.error")})}}},O=i(async p=>{n?d()&&c?await A(p,c):h(!0):await A(p)}),N=async p=>{h(!1);const _={new_password:C("new_password"),confirm_password:C("confirm_password")};await A(_,p)};return e.jsxs(e.Fragment,{children:[e.jsxs(w,{component:"form",onSubmit:O,sx:{display:"flex",flexDirection:"column",gap:2.5},children:[!n&&e.jsx(se,{name:"old_password",control:b,render:({field:p,fieldState:_})=>e.jsx(ie,{...p,label:t("account.change_password.current_password"),size:"small",autoComplete:"current-password",error:!!_.error,helperText:_.error?.message})}),e.jsx(se,{name:"new_password",control:b,render:({field:p,fieldState:_})=>e.jsx(ie,{...p,label:t("account.change_password.new_password"),size:"small",autoComplete:"new-password",passwordToValidate:I,error:!!_.error})}),e.jsx(se,{name:"confirm_password",control:b,render:({field:p,fieldState:_})=>e.jsx(ie,{...p,label:t("account.change_password.confirm_password"),size:"small",autoComplete:"new-password",error:!!_.error,helperText:_.error?.message})}),f.errors.root&&e.jsx(M,{severity:"error","data-testid":"account-change-password-error",children:f.errors.root.message}),e.jsx(w,{sx:{display:"flex",justifyContent:"flex-end"},children:e.jsx(U,{type:"submit",label:t("account.change_password.submit"),variant:"contained",loading:a,"data-testid":"account-change-password-submit"})})]}),e.jsx(Pe,{open:m,onClose:()=>h(!1),onSuccess:N})]})},pe=["totp-status"],he=["recovery-codes-status"],B=q.ledger_url,H="X-MFA-Session",lt=()=>{const{fetchPrivate:t}=k(),s=W();return E({mutationFn:({sessionToken:o})=>t({endpoint:"api/auth/totp/setup/",options:{method:"POST",headers:{[H]:o}},base_url:B}),onSuccess:()=>{s.invalidateQueries({queryKey:pe})},successMessage:!1,errorMessage:!1})},ut=()=>{const{fetchPrivate:t}=k(),s=W();return E({mutationFn:({code:o,sessionToken:a})=>t({endpoint:"api/auth/totp/activate/",options:{method:"POST",body:JSON.stringify({code:o}),headers:{[H]:a}},base_url:B}),onSuccess:()=>{s.invalidateQueries({queryKey:pe}),s.invalidateQueries({queryKey:he})},successMessage:!1,errorMessage:!1})},dt=()=>{const{fetchPrivate:t}=k(),s=W();return E({mutationFn:({sessionToken:o})=>t({endpoint:"api/auth/totp/",options:{method:"DELETE",headers:{[H]:o}},base_url:B}),onSuccess:()=>{s.invalidateQueries({queryKey:pe}),s.invalidateQueries({queryKey:he})},successMessage:!1,errorMessage:!1})},mt=()=>{const{fetchPrivate:t}=k();return E({mutationFn:({sessionToken:s})=>t({endpoint:"api/auth/recovery-codes/",options:{method:"GET",headers:{[H]:s}},base_url:B}),successMessage:!1,errorMessage:!1})},pt=()=>{const{fetchPrivate:t}=k(),s=W();return E({mutationFn:({sessionToken:o})=>t({endpoint:"api/auth/recovery-codes/",options:{method:"POST",headers:{[H]:o}},base_url:B}),onSuccess:()=>{s.invalidateQueries({queryKey:he})},successMessage:!1,errorMessage:!1})},ht=()=>{const{t}=D("account"),{sessionToken:s,saveMFASession:o,hasValidSession:a,isMFAActive:c,isLoading:d}=de(),{mutateAsync:n}=lt(),{mutateAsync:m,isPending:h}=ut(),{mutateAsync:g,isPending:i}=dt(),{mutateAsync:b}=mt(),{mutateAsync:x,isPending:f}=pt(),[j,C]=u.useState(!1),[I,A]=u.useState(null),[O,N]=u.useState(!1),[p,_]=u.useState(null),[l,y]=u.useState(""),[J,ne]=u.useState(!1),[fe,oe]=u.useState(!1),[L,Q]=u.useState("view"),[re,G]=u.useState([]),[z,S]=u.useState(null),Te=u.useCallback(r=>{r&&setTimeout(()=>r.focus(),150)},[]);if(d)return null;const ce=r=>{a()&&s?r(s):(A(()=>r),C(!0))},Ee=r=>{C(!1),I?.(r),A(null)},Fe=()=>{S(null),ce(async r=>{try{const R=await n({sessionToken:r});_(R),N(!0)}catch{}})},ge=async()=>
1{if(S(null),!!s)try{const r=await m({code:l,sessionToken:s});o(r.session_token),N(!1),_(null),y("");try{const R=await b({sessionToken:r.session_token});G(R.codes),Q("view"),oe(!0)}catch{}}catch(r){S(V(r)??t("account.mfa.invalid_code"))}},xe=()=>{N(!1),_(null),y(""),S(null)},De=()=>{S(null),ce(()=>{ne(!0)})},_e=()=>{ne(!1),S(null)},Re=async()=>{if(S(null),!!s)try{await g({sessionToken:s}),ne(!1)}catch(r){S($e(r)==="mfa_mandatory"?t("account.mfa.mandatory"):V(r)??t("account.mfa.invalid_code"))}},Me=()=>{S(null),ce(async r=>{try{const R=await b({sessionToken:r});G(R.codes),Q("view"),oe(!0)}catch(R){S(V(R)??t("account.mfa.codes_unavailable"))}})},ke=async()=>{if(S(null),!!s)try{const r=await x({sessionToken:s});G(r.recovery_codes.map(R=>({code:R}))),Q("view")}catch(r){S(V(r)??t("account.mfa.invalid_code"))}},ye=()=>{oe(!1),G([]),S(null)},ve=re.filter(r=>!r.is_used).length,je=e.jsx(Pe,{open:j,onClose:()=>{C(!1),A(null)},onSuccess:Ee});return c?e.jsxs(w,{children:[e.jsx(M,{severity:"success",sx:{mb:2},"data-testid":"account-mfa-enabled",children:t("account.mfa.enabled_status")}),e.jsxs(w,{sx:{display:"flex",gap:1},children:[e.jsx(T,{variant:"outlined",size:"small",onClick:Me,"data-testid":"account-mfa-recovery-codes",children:t("account.mfa.manage_recovery_codes")}),e.jsx(T,{variant:"outlined",size:"small",color:"error",onClick:De,"data-testid":"account-mfa-disable",children:t("account.mfa.disable")})]}),z&&!fe&&!J&&e.jsx(M,{severity:"error",sx:{mt:2},children:z}),je,e.jsxs(Y,{open:fe,onClose:ye,maxWidth:"sm",fullWidth:!0,children:[e.jsx(X,{children:e.jsxs(w,{sx:{display:"flex",alignItems:"center",justifyContent:"space-between"},children:[t("account.mfa.recovery_codes_title"),L==="view"&&e.jsx(Ue,{title:t("account.mfa.regenerate_codes"),children:e.jsx(Ie,{size:"small",onClick:()=>{S(null),Q("regenerate_confirm")},"data-testid":"account-mfa-regenerate",children:e.jsx(Xe,{})})})]})}),e.jsxs(Z,{children:[L==="view"&&e.jsxs(e.Fragment,{children:[e.jsx(v,{variant:"body2",color:"text.secondary",sx:{mb:2},children:t("account.mfa.recovery_help_text")}),e.jsx(w,{sx:{display:"flex",alignItems:"center",justifyContent:"space-between",mb:1},children:e.jsx(v,{variant:"subtitle2","data-testid":"account-mfa-codes-remaining","data-count":ve,children:t("account.mfa.codes_remaining",{count:ve})})}),e.jsx(Ze,{codes:re})]}),L==="regenerate_confirm"&&e.jsx(M,{severity:"warning",children:t("account.mfa.regenerate_confirm")}),z&&e.jsx(M,{severity:"error",sx:{mt:2},children:z})]}),e.jsxs(ee,{children:[L==="view"&&e.jsxs(e.Fragment,{children:[e.jsx(et,{codes:re}),e.jsx(w,{sx:{flex:1}}),e.jsx(T,{variant:"contained",onClick:ye,"data-testid":"account-mfa-recovery-close",children:t("account.mfa.close")})]}),L==="regenerate_confirm"&&e.jsxs(e.Fragment,{children:[e.jsx(T,{onClick:()=>Q("view"),children:t("account.cancel")}),e.jsx(U,{label:t("account.mfa.regenerate_codes"),variant:"contained",loading:f,onClick:ke,"data-testid":"account-mfa-regenerate-confirm"})]})]})]}),e.jsxs(Y,{open:J,onClose:_e,maxWidth:"xs",fullWidth:!0,children:[e.jsx(X,{children:t("account.mfa.disable_title")}),e.jsxs(Z,{children:[e.jsx(M,{severity:"warning",children:t("account.mfa.disable_confirm")}),z&&e.jsx(M,{severity:"error",sx:{mt:1},"data-testid":"account-mfa-disable-error",children:z})]}),e.jsxs(ee,{children:[e.jsx(T,{onClick:_e,children:t("account.cancel")}),e.jsx(U,{label:t("account.mfa.disable"),variant:"contained",color:"error",loading:i,onClick:Re,"data-testid":"account-mfa-disable-confirm"})]})]})]}):e.jsxs(w,{children:[e.jsx(v,{variant:"body2",color:"text.secondary",sx:{mb:2},children:t("account.mfa.description")}),e.jsx(T,{variant:"outlined",onClick:Fe,"data-testid":"account-mfa-enable",children:t("account.mfa.enable")}),je,e.jsxs(Y,{open:O,onClose:xe,maxWidth:"sm",fullWidth:!0,children:[e.jsx(X,{children:t("account.mfa.setup_title")}),e.jsxs(Z,{children:[p&&e.jsxs(e.Fragment,{children:[e.jsx(tt,{totpUrl:p.totp_url,secret:p.secret}),e.jsx(v,{variant:"body2",color:"text.secondary",sx:{mb:2},children:t("account.mfa.verify_setup_prompt")}),e.jsx(K,{fullWidth:!0,inputRef:Te,autoComplete:"one-time-code",inputMode:"numeric",label:t("account.mfa.code_label"),slotProps:{htmlInput:{"data-testid":"account-mfa-setup-code"}}
1,value:l,onChange:r=>y(r.target.value),onKeyDown:r=>r.key==="Enter"&&l&&ge()})]}),z&&e.jsx(M,{severity:"error",sx:{mt:2},children:z})]}),e.jsxs(ee,{children:[e.jsx(T,{onClick:xe,children:t("account.cancel")}),e.jsx(U,{label:t("account.mfa.activate"),variant:"contained",loading:h,onClick:ge,disabled:!l,"data-testid":"account-mfa-activate"})]})]})]})},ft=({highlight:t})=>{const{t:s}=D("account"),{data:o}=ae(),{updateNotificationLanguage:a,isUpdatingNotificationLanguage:c}=me(),d=o?.notificationLanguage??"de";return e.jsxs(te,{spacing:2,children:[e.jsx(v,{variant:"body2",color:"text.secondary",children:s("account.notification_preferences.description")}),e.jsxs(K,{select:!0,size:"small",label:s("account.notification_preferences.language_label"),value:d,disabled:c,onChange:n=>a({notification_language:n.target.value}),slotProps:{htmlInput:{"data-testid":"account-notification-language-select"}},sx:t?{maxWidth:280,transition:"box-shadow 0.3s ease",boxShadow:n=>`0 0 0 2px ${n.palette.primary.main}`,borderRadius:1}:{maxWidth:280,transition:"box-shadow 0.3s ease"},children:[e.jsx(we,{value:"de",children:s("account.notification_preferences.language_de")}),e.jsx(we,{value:"en",children:s("account.notification_preferences.language_en")})]})]})},le=q.ledger_url,gt=()=>{const{fetchPrivate:t}=k(),s=qe(),o=W(),{t:a}=D("account"),c=()=>o.invalidateQueries({queryKey:ue}),d=E({mutationFn:async m=>{const{url:h,headers:g,file_id:i}=await t({endpoint:"api/users/me/profile-picture/upload-url/",base_url:le,options:{method:"POST",body:JSON.stringify({file_name:m.name})}});await s.mutateAsync({file:m,url:h,headers:g}),await t({endpoint:"api/users/me/profile-picture/",base_url:le,options:{method:"PUT",body:JSON.stringify({file_id:i})}})},onSuccess:c,successMessage:a("account.profile_picture.success"),errorMessage:a("account.profile_picture.error")}),n=E({mutationFn:async()=>{await t({endpoint:"api/users/me/profile-picture/",base_url:le,options:{method:"DELETE"}})},onSuccess:c,successMessage:a("account.profile_picture.remove_success"),errorMessage:a("account.profile_picture.error")});return{upload:d,remove:n}},be=["image/png","image/jpeg","image/webp",".png",".jpg",".jpeg",".webp"],xt=2*1024*1024,_t=()=>{const{t}=D("account"),{data:s}=ae(),{upload:o,remove:a}=gt(),c=u.useRef(null),[d,n]=u.useState(null),m=s?.profilePictureUrl,h=[s?.firstName,s?.lastName].filter(Boolean).join(" ").trim(),g=s?.email??"",i=o.isPending||a.isPending,b=x=>{n(null);const f=x.target.files?.[0];if(x.target.value="",!!f){if(!We(f,be)){n(t("account.profile_picture.invalid_type"));return}
1if(f.size>xt){n(t("account.profile_picture.too_large"));return}o.mutate(f)}};return e.jsxs(te,{spacing:2,children:[e.jsx(v,{variant:"body2",color:"text.secondary",children:t("account.profile_picture.description")}),e.jsxs(te,{direction:"row",spacing:2,alignItems:"center",children:[e.jsx(Ke,{email:g,name:h||void 0,src:m,size:"4rem",disableName:!0,disableTitle:!0}),e.jsxs(te,{direction:"row",spacing:1,children:[e.jsx(T,{variant:"outlined",disabled:i,onClick:()=>c.current?.click(),children:t(i?"account.profile_picture.uploading":m?"account.profile_picture.change":"account.profile_picture.upload")}),m&&e.jsx(T,{variant:"text",color:"error",disabled:i,onClick:()=>a.mutate(),children:t("account.profile_picture.remove")})]})]}),d&&e.jsx(v,{variant:"caption",color:"error",children:d}),e.jsx("input",{ref:c,type:"file",accept:be.join(","),hidden:!0,onChange:b})]})},Ut=()=>{const{t}=D("account"),{data:s}=ae(),[o,a]=$.useState(!1),[c,d]=Le(),n=$.useRef(null),m=c.get("highlight")==="notification-language";if($.useEffect(()=>{if(!m)return;n.current?.scrollIntoView({behavior:"smooth",block:"center"});const g=setTimeout(()=>{d(i=>(i.delete("highlight"),i),{replace:!0})},3e3);return()=>clearTimeout(g)},[m]),!s)return null;const h=[{label:t("account.personal_info.username"),value:s.username},{label:t("account.personal_info.first_name"),value:s.firstName},{label:t("account.personal_info.last_name"),value:s.lastName},{label:t("account.personal_info.email"),value:s.email},{label:t("account.personal_info.phone_number"),value:s.phoneNumber||"—"}];return e.jsxs(Ye,{title:t("account.title"),children:[e.jsx(nt,{children:e.jsxs(P,{container:!0,spacing:4,children:[e.jsxs(P,{size:{xs:12,md:6},children:[e.jsxs(w,{sx:{mb:1.5,display:"flex",justifyContent:"space-between",alignItems:"center"},children:[e.jsx(v,{variant:"h2",children:t("account.personal_info.title")}),e.jsx(T,{variant:"text",startIcon:e.jsx(Qe,{icon:Ve,size:18,color:"currentColor",strokeWidth:2}),onClick:()=>a(!0),children:t("account.update")})]}),e.jsx(P,{container:!0,spacing:2,children:h.map((g,i)=>e.jsxs($.Fragment,{children:[e.jsx(P,{size:{xs:6},children:e.jsx(v,{children:g.label})}),e.jsx(P,{size:{xs:6},children:e.jsx(v,{children:g.value})})]},i))})]}),e.jsx(P,{size:{xs:12,md:6}}),e.jsxs(P,{size:{xs:12,md:6},ref:n,children:[e.jsx(w,{sx:{mb:2},children:e.jsx(v,{variant:"h2",children:t("account.notification_preferences.title")})}),e.jsx(ft,{highlight:m})]}),e.jsx(P,{size:{xs:12,md:6}}),e.jsxs(P,{size:{xs:12,md:6},children:[e.jsx(w,{sx:{mb:2},children:e.jsx(v,{variant:"h2",children:t("account.profile_picture.title")})}),e.jsx(_t,{})]}),e.jsx(P,{size:{xs:12,md:6}}),e.jsxs(P,{size:{xs:12,md:6},children:[e.jsx(w,{sx:{mb:2},children:e.jsx(v,{variant:"h2",children:t("account.mfa.title")})}),e.jsx(ht,{})]}),e.jsx(P,{size:{xs:12,md:6}}),e.jsxs(P,{size:{xs:12,md:6},children:[e.jsx(w,{sx:{mb:2},children:e.jsx(v,{variant:"h2",children:t("account.change_password.title")})}),e.jsx(it,{})]})]})}),e.jsx(Y,{fullWidth:!0,maxWidth:"sm",open:o,onClose:()=>a(!1),children:e.jsx(rt,{username:s.username,firstName:s.firstName,lastName:s.lastName,email:s.email,phoneNumber:s.phoneNumber,onClose:()=>a(!1)})})]})};export{Ut as default};

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.