import{x as le,y as ce,z as G,r as i,A as de,C as H,D as pe,E as me,F as ue,G as fe,H as ge,I as ye,J as he,K as be,M as xe,_ as F,N as Ce,O as je,P as Ie,Q as ve,U as $e,u as we,j as o,V as Se,R as Pe,T as Ee,B as M,W as Ne,X as Be,a as Re,Y as Te,c as _e,Z as L,e as Me,$ as Oe,a0 as He,s as O,k as ke,a1 as ze}from"./index-CYM97J2V.js";import{P as Ae}from"./index-B7x062Ky.js";import{F as h}from"./index-CacOxAQN.js";import{R as De,C as U}from"./row-DNGQ3hV2.js";import{C as W,T as Fe}from"./index-Bcf8yIZZ.js";import{T as N}from"./index-DqftVe8j.js";import{I as w}from"./index-DV4zjsPW.js";import{D as Le}from"./index-CXEbfSHV.js";import"./useForm-B5uILH8t.js";const B=(e,t,s,n,a)=>({background:e,border:`${G(n.lineWidth)} ${n.lineType} ${t}`,[`${a}-icon`]:{color:s}}),Ue=e=>{const{componentCls:t,motionDurationSlow:s,marginXS:n,marginSM:a,fontSize:d,fontSizeLG:m,lineHeight:f,borderRadiusLG:g,motionEaseInOutCirc:l,withDescriptionIconSize:b,colorText:r,colorTextHeading:x,withDescriptionPadding:y,defaultPadding:c}=e;return{[t]:Object.assign(Object.assign({},ce(e)),{position:"relative",display:"flex",alignItems:"center",padding:c,wordWrap:"break-word",borderRadius:g,[`&${t}-rtl`]:{direction:"rtl"},[`${t}-content`]:{flex:1,minWidth:0},[`${t}-icon`]:{marginInlineEnd:n,lineHeight:0},"&-description":{display:"none",fontSize:d,lineHeight:f},"&-message":{color:x},[`&${t}-motion-leave`]:{overflow:"hidden",opacity:1,transition:`max-height ${s} ${l}, opacity ${s} ${l}, padding-top ${s} ${l}, padding-bottom ${s} ${l}, margin-bottom ${s} ${l}`},[`&${t}-motion-leave-active`]:{maxHeight:0,marginBottom:"0 !important",paddingTop:0,paddingBottom:0,opacity:0}}),[`${t}-with-description`]:{alignItems:"flex-start",padding:y,[`${t}-icon`]:{marginInlineEnd:a,fontSize:b,lineHeight:0},[`${t}-message`]:{display:"block",marginBottom:n,color:x,fontSize:m},[`${t}-description`]:{display:"block",color:r}},[`${t}-banner`]:{marginBottom:0,border:"0 !important",borderRadius:0}}},We=e=>{const{componentCls:t,colorSuccess:s,colorSuccessBorder:n,colorSuccessBg:a,colorWarning:d,colorWarningBorder:m,colorWarningBg:f,colorError:g,colorErrorBorder:l,colorErrorBg:b,colorInfo:r,colorInfoBorder:x,colorInfoBg:y}=e;return{[t]:{"&-success":B(a,n,s,e,t),"&-info":B(y,x,r,e,t),"&-warning":B(f,m,d,e,t),"&-error":Object.assign(Object.assign({},B(b,l,g,e,t)),{[`${t}-description > pre`]:{margin:0,padding:0}})}}},Ve=e=>{const{componentCls:t,iconCls:s,motionDurationMid:n,marginXS:a,fontSizeIcon:d,colorIcon:m,colorIconHover:f}=e;return{[t]:{"&-action":{marginInlineStart:a},[`${t}-close-icon`]:{marginInlineStart:a,padding:0,overflow:"hidden",fontSize:d,lineHeight:G(d),backgroundColor:"transparent",border:"none",outline:"none",cursor:"pointer",[`${s}-close`]:{color:m,transition:`color ${n}`,"&:hover":{color:f}}},"&-close-text":{color:m,transition:`color ${n}`,"&:hover":{color:f}}}}},Xe=e=>({withDescriptionIconSize:e.fontSizeHeading3,defaultPadding:`${e.paddingContentVerticalSM}px 12px`,withDescriptionPadding:`${e.paddingMD}px ${e.paddingContentHorizontalLG}px`}),Ge=le("Alert",e=>[Ue(e),We(e),Ve(e)],Xe);var V=function(e,t){var s={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(s[n]=e[n]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var a=0,n=Object.getOwnPropertySymbols(e);a{const{icon:t,prefixCls:s,type:n}=e,a=qe[n]||null;return t?fe(t,i.createElement("span",{className:`${s}-icon`},t),()=>({className:H(`${s}-icon`,t.props.className)})):i.createElement(a,{className:`${s}-icon`})},Je=e=>{const{isClosable:t,prefixCls:s,closeIcon:n,handleClose:a,ariaProps:d}=e,m=n===!0||n===void 0?i.createElement(xe,null):n;return t?i.createElement("button",Object.assign({type:"button",onClick:a,className:`${s}-close-icon`,tabIndex:0},d),m):null},q=i.forwardRef((e,t)=>{const{description:s,prefixCls:n,message:a,banner:d,className:m,rootClassName:f,style:g,onMouseEnter:l,onMouseLeave:b,onClick:r,afterClose:x,showIcon:y,closable:c,closeText:I,closeIcon:C,action:P,id:R}=e,T=V(e,["description","prefixCls","message","banner","className","rootClassName","style","onMouseEnter","onMouseLeave","onClick","afterClose","showIcon","closable","closeText","closeIcon","action","id"]),[S,p]=i.useState(!1),_=i.useRef(null);i.useImperativeHandle(t,()=>({nativeElement:_.current}));const{getPrefixCls:E,direction:J,closable:v,closeIcon:k,className:Q,style:Y}=de("alert"),u=E("alert",n),[Z,ee,oe]=Ge(u),te=j=>{var $;p(!0),($=e.onClose)===null||$===void 0||$.call(e,j)},z=i.useMemo(()=>e.type!==void 0?e.type:d?"warning":"info",[e.type,d]),se=i.useMemo(()=>typeof c=="object"&&c.closeIcon||I?!0:typeof c=="boolean"?c:C!==!1&&C!==null&&C!==void 0?!0:!!v,[I,C,c,v]),A=d&&y===void 0?!0:y,ne=H(u,`${u}-${z}`,{[`${u}-with-description`]:!!s,[`${u}-no-icon`]:!A,[`${u}-banner`]:!!d,[`${u}-rtl`]:J==="rtl"},Q,m,f,oe,ee),re=pe(T,{aria:!0,data:!0}),ae=i.useMemo(()=>typeof c=="object"&&c.closeIcon?c.closeIcon:I||(C!==void 0?C:typeof v=="object"&&v.closeIcon?v.closeIcon:k),[C,c,v,I,k]),ie=i.useMemo(()=>{const j=c??v;if(typeof j=="object"){const{closeIcon:$}=j;return V(j,["closeIcon"])}return{}},[c,v]);return Z(i.createElement(me,{visible:!S,motionName:`${u}-motion`,motionAppear:!1,motionEnter:!1,onLeaveStart:j=>({maxHeight:j.offsetHeight}),onLeaveEnd:x},({className:j,style:$},D)=>i.createElement("div",Object.assign({id:R,ref:ue(_,D),"data-show":!S,className:H(ne,j),style:Object.assign(Object.assign(Object.assign({},Y),g),$),onMouseEnter:l,onMouseLeave:b,onClick:r,role:"alert"},re),A?i.createElement(Ke,{description:s,icon:e.icon,prefixCls:u,type:z}):null,i.createElement("div",{className:`${u}-content`},a?i.createElement("div",{className:`${u}-message`},a):null,s?i.createElement("div",{className:`${u}-description`},s):null),P?i.createElement("div",{className:`${u}-action`},P):null,i.createElement(Je,{isClosable:se,prefixCls:u,closeIcon:ae,handleClose:te,ariaProps:ie}))))});function Qe(e,t,s){return t=F(t),Ce(e,je()?Reflect.construct(t,s||[],F(e).constructor):t.apply(e,s))}let Ye=function(e){function t(){var s;return $e(this,t),s=Qe(this,t,arguments),s.state={error:void 0,info:{componentStack:""}},s}return Ie(t,e),ve(t,[{key:"componentDidCatch",value:function(n,a){this.setState({error:n,info:a})}},{key:"render",value:function(){const{message:n,description:a,id:d,children:m}=this.props,{error:f,info:g}=this.state,l=(g==null?void 0:g.componentStack)||null,b=typeof n>"u"?(f||"").toString():n,r=typeof a>"u"?l:a;return f?i.createElement(q,{id:d,type:"error",message:b,description:i.createElement("pre",{style:{fontSize:"0.9em",overflowX:"auto"}},r)}):m}}])}(i.Component);const K=q;K.ErrorBoundary=Ye;const{Paragraph:X,Title:Ze,Text:eo}=Ee;function po(){const{t:e}=we(),[t,s]=i.useState(!1),[n,a]=i.useState(!1),[d,m]=i.useState(!1),[f,g]=i.useState(!1),[l,b]=i.useState(null),[r,x]=i.useState(null),[y]=h.useForm(),[c]=h.useForm(),I=async()=>{s(!0);try{const p=await Me();b(p),y.setFieldsValue(p)}finally{s(!1)}},C=async()=>{m(!0);try{const p=await Oe();x(p)}finally{m(!1)}};i.useEffect(()=>{I(),C()},[]);const P=async()=>{try{const p=await y.validateFields();a(!0),await He(p),O.success(e("common.success")),I()}finally{a(!1)}},R=async()=>{try{const p=await c.validateFields();a(!0),await ke(p),O.success(e("common.success")),c.resetFields()}finally{a(!1)}},T=async()=>{try{g(!0);const p=await ze();x(p),O.success(e("common.success"))}finally{g(!1)}},S=p=>p||"-";return o.jsxs("div",{className:"app-page app-page--contained",style:{maxWidth:1024,width:"100%",margin:"0 auto"},children:[o.jsx(Ae,{title:e("profile.title"),subtitle:e("profile.subtitle")}),o.jsxs(De,{gutter:24,children:[o.jsx(U,{xs:24,lg:8,children:o.jsxs(W,{className:"app-page__content-card text-center",loading:t,children:[o.jsx(Se,{size:80,icon:o.jsx(Pe,{}),style:{backgroundColor:"#1677ff",marginBottom:16}}),o.jsx(Ze,{level:5,style:{margin:0},children:l==null?void 0:l.displayName}),o.jsxs(eo,{type:"secondary",children:["@",l==null?void 0:l.username]}),o.jsx("div",{className:"mt-4",children:l!=null&&l.isPlatformAdmin?o.jsx(N,{color:"gold",children:e("users.platformAdmin")}):o.jsx(N,{color:"blue",children:e("profile.standardUser")})})]})}),o.jsx(U,{xs:24,lg:16,children:o.jsx(W,{className:"app-page__content-card",children:o.jsx(Fe,{defaultActiveKey:"basic",items:[{key:"basic",label:o.jsxs("span",{children:[o.jsx(Be,{})," ",e("profile.basicInfo")]}),children:o.jsxs(h,{form:y,layout:"vertical",onFinish:P,style:{marginTop:16},children:[o.jsx(h.Item,{label:e("users.displayName"),name:"displayName",rules:[{required:!0}],children:o.jsx(w,{})}),o.jsx(h.Item,{label:e("users.email"),name:"email",children:o.jsx(w,{})}),o.jsx(h.Item,{label:e("users.phone"),name:"phone",children:o.jsx(w,{})}),o.jsx("div",{className:"app-page__page-actions",style:{margin:"8px 0 0"},children:o.jsx(M,{type:"primary",icon:o.jsx(Ne,{}),loading:n,onClick:()=>y.submit(),children:e("profile.saveChanges")})})]})},{key:"password",label:o.jsxs("span",{children:[o.jsx(Re,{})," ",e("profile.security")]}),children:o.jsxs(h,{form:c,layout:"vertical",onFinish:R,style:{marginTop:16},children:[o.jsx(h.Item,{label:e("profile.currentPassword"),name:"oldPassword",rules:[{required:!0}],children:o.jsx(w.Password,{})}),o.jsx(h.Item,{label:e("profile.newPassword"),name:"newPassword",rules:[{required:!0,min:6}],children:o.jsx(w.Password,{})}),o.jsx(h.Item,{label:e("profile.confirmNewPassword"),name:"confirmPassword",dependencies:["newPassword"],rules:[{required:!0},({getFieldValue:p})=>({validator(_,E){return!E||p("newPassword")===E?Promise.resolve():Promise.reject(new Error(e("profile.passwordsDoNotMatch")))}})],children:o.jsx(w.Password,{})}),o.jsx("div",{className:"app-page__page-actions",style:{margin:"8px 0 0"},children:o.jsx(M,{type:"primary",danger:!0,loading:n,onClick:()=>c.submit(),children:e("profile.updatePassword")})})]})},{key:"bot-credential",label:o.jsxs("span",{children:[o.jsx(L,{})," ",e("profile.botCredentialTab")]}),children:o.jsx("div",{style:{marginTop:16},children:o.jsxs(Te,{direction:"vertical",size:16,style:{width:"100%"},children:[o.jsx(K,{type:"info",showIcon:!0,message:e("profile.botCredentialHint"),description:e("profile.botCredentialHintDesc")}),o.jsx(Le,{bordered:!0,size:"middle",column:1,items:[{key:"bind-status",label:e("profile.botBindStatus"),children:r!=null&&r.bound?o.jsx(N,{color:"success",children:e("profile.botBound")}):o.jsx(N,{children:e("profile.botUnbound")})},{key:"bot-id",label:"X-Bot-Id",children:r!=null&&r.botId?o.jsx(X,{copyable:{text:r.botId},style:{marginBottom:0},children:r.botId}):"-"},{key:"bot-secret",label:"X-Bot-Secret",children:r!=null&&r.botSecret?o.jsx(X,{copyable:{text:r.botSecret},style:{marginBottom:0},children:r.botSecret}):e("profile.botSecretHidden")},{key:"last-access-time",label:e("profile.botLastAccessTime"),children:S(r==null?void 0:r.lastAccessTime)},{key:"last-access-ip",label:e("profile.botLastAccessIp"),children:S(r==null?void 0:r.lastAccessIp)}]}),o.jsx("div",{className:"app-page__page-actions",style:{margin:"8px 0 0"},children:o.jsx(M,{type:"primary",icon:r!=null&&r.bound?o.jsx(_e,{}):o.jsx(L,{}),loading:f,onClick:T,children:r!=null&&r.bound?e("profile.regenerateBotCredential"):e("profile.generateBotCredential")})})]})})}]})})})]})]})}export{po as default};