import{d as r}from"./vendor-CB_mu4eO.js";import{f as a,j as n,E as e}from"./souav-BTAG2baT.js";import{i as o,j as s}from"./vendor-BJZ6tUoe.js";import{r as t}from"./vendor-BXdGExd0.js";const c=r("accountSecurity",()=>{const r=t(!1),c=a();return{showNicknameDialog:r,avatarList:Array.from({length:20},(r,a)=>`/avatars/${a+1}.png`),modifyUserInfo:async function(r){const a=c.userInfo;if(!a)return!1;let{avatar:t="",nickname:i="",gender:f=-1}=r;t=t||a.avatar||"",i=i||a.nickname||"昵称未设置";const m=a.gender??0;if(f=-1===f?m:f,t===(a.avatar||"")&&i===(a.nickname||"")&&f===m)return!1;let u={avatar:t,nickname:i,gender:f};const d=o({message:"加载中...",forbidClick:!0,duration:0});try{const r=await n.modifyUserInfo(u);return d.close(),r.code===e.Success?(s("修改成功"),c.userInfo&&(c.userInfo={...c.userInfo,avatar:t,nickname:i,gender:f},localStorage.setItem("user_info",JSON.stringify(c.userInfo))),!0):(s(r.msg||"修改失败"),!1)}catch(g){return d.close(),s("网络异常，请稍后重试"),!1}}}});export{c as u};
