import{r as m,y as p,j as e,a as f}from"./app-Dory5LSx.js";import{j as u,H as h,D as t,_ as j,I as b,A as g,S as N}from"./SidebarMini-BQt5ZOO8.js";import{C as v}from"./ContentEmpty-BXageBFX.js";import{c as w}from"./clsx-B-dksMZM.js";import{q as y,j as C,r as A,s as B,k as r,t as k,e as _,p as S}from"./index-Bxh65pw0.js";import U from"./UpdateProfileInformationForm-CfBIZz13.js";import D from"./UpdatePasswordForm-qv728Oe-.js";import E from"./DeleteUserForm-BDt-M1vR.js";import"./transition-DQuJwdlY.js";import"./Modal-B6fPhL-B.js";import"./InputLabel-BXurWe64.js";import"./InputError-CQtLR-0E.js";import"./PrimaryButton-CTvXnBiS.js";function P(){const{theme:o,setTheme:l,auth:a,setAuth:x}=u(),[s,n]=m.useState({profile:!0,password:!1,deleteAccount:!1}),{width:c}=h();m.useEffect(()=>{c>640&&p.get(route("chats.index"))},[c]);const d=i=>{b(a,{active_status:i}).then(()=>{x({...a,active_status:i})})};return e.jsxs("div",{className:"order-1 flex flex-1 shrink-0 flex-col gap-2 sm:order-2 sm:flex sm:w-[320px] sm:flex-initial sm:border-l sm:border-secondary lg:w-[360px]",children:[e.jsx("div",{className:"flex items-center justify-between px-2 pt-2 sm:pb-0",children:e.jsx("h3",{className:"text-2xl font-semibold",children:"Preferences"})}),e.jsxs("div",{className:"flex h-full max-h-[calc(100vh_-_106px)] flex-col gap-2 overflow-x-auto p-2",children:[e.jsxs("div",{className:"flex justify-between",children:[e.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[e.jsx(y,{}),"Theme"]}),e.jsxs(t,{children:[e.jsx(t.Trigger,{children:e.jsxs("button",{className:"btn btn-secondary flex items-center gap-2",children:[o.charAt(0).toUpperCase()+o.slice(1),e.jsx(C,{})]})}),e.jsxs(t.Content,{children:[e.jsx(t.Button,{onClick:()=>l("system"),children:"System"}),e.jsx(t.Button,{onClick:()=>l("dark"),children:"Dark"}),e.jsx(t.Button,{onClick:()=>l("light"),children:"Light"})]})]})]}),e.jsxs("div",{className:"flex justify-between",children:[e.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[e.jsx(A,{}),"Active Status"]}),e.jsxs(j,{checked:a.active_status,onChange:d,className:w("relative inline-flex h-6 w-11 items-center rounded-full",a.active_status?"bg-primary":"bg-secondary"),children:[e.jsx("span",{className:"sr-only",children:"Enable active status"}),e.jsx("span",{className:`${a.active_status?"translate-x-6":"translate-x-1"} inline-block h-4 w-4 transform rounded-full bg-white transition`})]})]}),e.jsx("hr",{className:"my-2 border-secondary"}),s.profile&&e.jsx(U,{mustVerifyEmail:!0,className:"max-w-xl"}),s.password&&e.jsx(D,{className:"max-w-xl"}),s.deleteAccount&&e.jsx(E,{className:"max-w-xl"}),e.jsx("div",{className:"my-1"}),!s.profile&&e.jsx("button",{className:"btn btn-secondary",onClick:()=>n({profile:!0,password:!1,deleteAccount:!1}),children:e.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[e.jsx(B,{}),"Update profile",e.jsx(r,{className:"ml-auto"})]})}),!s.password&&e.jsx("button",{className:"btn btn-secondary",onClick:()=>n({profile:!1,password:!0,deleteAccount:!1}),children:e.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[e.jsx(k,{}),"Update password",e.jsx(r,{className:"ml-auto"})]})}),!s.deleteAccount&&e.jsx("button",{className:"btn btn-secondary",onClick:()=>n({profile:!1,password:!1,deleteAccount:!0}),children:e.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[e.jsx(_,{}),"Delete Account",e.jsx(r,{className:"ml-auto"})]})}),e.jsxs(f,{href:route("logout"),as:"button",method:"post",className:"btn btn-secondary flex items-center gap-2",children:[e.jsx(S,{}),"Log out",e.jsx(r,{className:"ml-auto"})]})]})]})}function J(){return e.jsxs(g,{title:"Preferences",children:[e.jsx(N,{}),e.jsx(P,{}),e.jsx(v,{})]})}export{J as default};
