import{a as e}from"./rolldown-runtime-B0Z9INg1.js";import{$ as t}from"./vendor-charts-iXlq6Rne.js";import{c as n,t as r}from"./api-CqQWIBIg.js";import{t as i}from"./createLucideIcon-CPi6oOk3.js";import{_ as a}from"./vendor-flow-IzlrcDx6.js";import{i as o,nn as s,xn as c}from"./index-HkVQGc9M.js";import{t as l}from"./Input-DAV_OJ97.js";import{t as u}from"./AccountLayout-ldo7Yvd1.js";import{a as d,i as f,n as p,r as m,t as h}from"./Card-BkFO4RUr.js";var g=i(`camera`,[[`path`,{d:`M13.997 4a2 2 0 0 1 1.76 1.05l.486.9A2 2 0 0 0 18.003 7H20a2 2 0 0 1 2 2v9a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V9a2 2 0 0 1 2-2h1.997a2 2 0 0 0 1.759-1.048l.489-.904A2 2 0 0 1 10.004 4z`,key:`18u6gg`}],[`circle`,{cx:`12`,cy:`13`,r:`3`,key:`1vg3eu`}]]),_=e(t(),1),v=a();function y(){let e=c(e=>e.auth.user),[t,i]=(0,_.useState)(e?.full_name||``),[a,u]=(0,_.useState)(e?.email||``),[y,b]=(0,_.useState)(!1);return(0,_.useEffect)(()=>{r.get(`/auth/me/`).then(e=>{e.data.full_name&&i(e.data.full_name),e.data.email&&u(e.data.email)}).catch(()=>{})},[]),(0,v.jsx)(`div`,{children:(0,v.jsxs)(`div`,{className:`space-y-6`,children:[(0,v.jsxs)(h,{children:[(0,v.jsxs)(f,{children:[(0,v.jsx)(d,{children:`Profile Photo`}),(0,v.jsx)(m,{children:`This image is displayed across the platform next to your name.`})]}),(0,v.jsx)(p,{children:(0,v.jsxs)(`div`,{className:`flex items-center gap-5`,children:[(0,v.jsxs)(`div`,{className:`relative group`,children:[(0,v.jsx)(s,{fallback:e?.full_name||`Admin`,size:`xl`}),(0,v.jsx)(`div`,{className:`absolute inset-0 rounded-full bg-black/40 opacity-0 group-hover:opacity-100 flex items-center justify-center transition-opacity cursor-pointer`,children:(0,v.jsx)(g,{className:`w-5 h-5 text-white`})})]}),(0,v.jsxs)(`div`,{className:`space-y-2`,children:[(0,v.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,v.jsx)(o,{variant:`outline`,size:`sm`,children:`Upload photo`}),(0,v.jsx)(o,{variant:`ghost`,size:`sm`,children:`Remove`})]}),(0,v.jsx)(`p`,{className:`text-[12px] text-[var(--color-text-muted)]`,children:`JPG, PNG or GIF. Recommended size 256x256px. Max 2MB.`})]})]})})]}),(0,v.jsxs)(h,{children:[(0,v.jsxs)(f,{children:[(0,v.jsx)(d,{children:`Personal Information`}),(0,v.jsx)(m,{children:`Update your name and contact details.`})]}),(0,v.jsxs)(p,{children:[(0,v.jsxs)(`div`,{className:`grid grid-cols-1 md:grid-cols-2 gap-x-5 gap-y-4 max-w-2xl`,children:[(0,v.jsx)(l,{label:`Full Name`,value:t,onChange:e=>i(e.target.value),placeholder:`Enter your full name`}),(0,v.jsx)(l,{label:`Email Address`,type:`email`,value:a,onChange:e=>u(e.target.value),placeholder:`Enter your email`}),(0,v.jsx)(l,{label:`Username`,value:e?.username||``,disabled:!0,hint:`Your login username cannot be changed.`}),(0,v.jsx)(l,{label:`Role`,value:e?.user_type?e.user_type.charAt(0).toUpperCase()+e.user_type.slice(1):`Admin`,disabled:!0})]}),(0,v.jsx)(`div`,{className:`mt-6 pt-5 border-t border-[var(--color-border-light)] flex justify-end`,children:(0,v.jsx)(o,{onClick:async()=>{b(!0);try{await r.patch(`/auth/me/`,{full_name:t,email:a}),n.success(`Profile updated successfully`)}catch{n.error(`Failed to update profile`)}finally{b(!1)}},isLoading:y,children:`Save changes`})})]})]})]})})}function b(){return(0,v.jsx)(u,{title:`My Profile`,description:`Your personal information, avatar, and contact details.`,children:(0,v.jsx)(y,{})})}export{b as default};