1import{f as te,e as l,j as e}from"./vendor-react-C-tLJ3C8.js";import{v as ae,ab as D,ae as u,ag as re,x as E,l as B,ai as se,m as O,O as ie,r as f}from"./index-DxoJEjRy.js";import{u as le}from"./consentUiStore-XNGvLEbA.js";import{p as ne,g as oe,h as n}from"./motion-BZ9X7-6B.js";import{u as de,X as ce}from"./XPBar-OnhbrOrX.js";import{u as xe,M as me,S as ge}from"./useTheme-DyjDdJlO.js";import{A as he}from"./Avatar-BinY_M5D.js";import{C as r}from"./Card-CD2rnSRu.js";import{B as A}from"./Badge-p3wyzqIi.js";import{B as pe}from"./Button-Bj9BQB0O.js";import{I as T}from"./Input-BFzIVhaK.js";import{R as fe}from"./RankBadge-BMOcPn3Y.js";import{E as ye}from"./constants-CqL9EwJy.js";import{N as ue}from"./nigeria-DrlLtxCl.js";import{S as be}from"./StudyAreaStep-BhUCBwrt.js";import{a as je}from"./useProfile-DwJdn-QT.js";import{m as s}from"./vendor-motion-Dx4K3zup.js";import{M as ve}from"./mail-BIJd09jt.js";import{C as ke}from"./calendar-d2Ynz4M7.js";import{C as I}from"./crown-CZafzO-M.js";import{Z as Ne}from"./zap-CcCk-Q0A.js";import{F as we}from"./flame-apNRIuvm.js";import{C as Se}from"./circle-dollar-sign-BGlwBH_8.js";import{U as Ce}from"./user-BPf9ce2H.js";import{P as Pe}from"./phone-DZHIpvvP.js";import{M as De}from"./map-pin-CdH_1JiY.js";import{B as Ee}from"./book-open-CeUPlp1x.js";import{S as Be}from"./save-C_d8C51k.js";import{B as Oe}from"./bookmark-BtDgsXuz.js";import{C as c}from"./chevron-right-qk4onCl7.js";import{U as Ae}from"./users-BHHIcpWr.js";import{B as Te}from"./bell-DVceWrUz.js";import{S as Ie}from"./shield-check-W3luJzyp.js";import{L as Me}from"./lock-DKgWjvVD.js";import{L as Le}from"./log-out-qAlH0s7f.js";import"./vendor-query-4BWL3uTy.js";import"./useAnswerOutbox-Sa-o1eJe.js";import"./practiceOutbox-CaTx9uhC.js";import"./useQuestions-C1P9mP-3.js";import"./useExamBodyCatalog-Dhbp7Jto.js";import"./awards-DlVhY_PM.js";import"./gamificationEvents-Joc7c9SD.js";import"./index-YFvaqnYW.js";import"./loader-circle-DOgBBCoV.js";import"./trophy-D65RJ9Yk.js";import"./award-B9Zzvoeg.js";import"./shield-4MivIpB6.js";import"./graduation-cap-8KoonlOE.js";import"./landmark-BfEHMRj2.js";import"./check-DAJrOQX0.js";/** 2 * @license lucide-react v0.378.0 - ISC 3 * 4 * This source code is licensed under the ISC license. 5 * See the LICENSE file in the root directory of this source tree. 6 */const Ue=ae("Tag",[["path",{d:"M12.586 2.586A2 2 0 0 0 11.172 2H4a2 2 0 0 0-2 2v7.172a2 2 0 0 0 .586 1.414l8.704 8.704a2.426 2.426 0 0 0 3.42 0l6.58-6.58a2.426 2.426 0 0 0 0-3.42z",key:"vktsd0"}],["circle",{cx:"7.5",cy:"7.5",r:".5",fill:"currentColor",key:"kqv944"}]]),Fe=[{label:"30s",value:30},{label:"60s",value:60},{label:"90s",value:90},{label:"Off",value:0}],Re=["All","Easy","Medium","Hard"],b="study_preferences";function Lt(){const o=te(),M=le(a=>a.show),t=D(a=>a.user),L=D(a=>a.logout),U=u(a=>a.totalXp),F=u(a=>a.rank),R=u(a=>a.padiCoins),{streak:Y}=de(),{isDark:x,toggleTheme:z}=xe(),d=je(),{toast:j}=re(),[Q,v]=l.useState(!1),[m,_]=l.useState((t==null?void 0:t.fullName)??""),[y,X]=l.useState((t==null?void 0:t.phone)??""),[g,J]=l.useState((t==null?void 0:t.state)??""),[h,G]=l.useState((t==null?void 0:t.examBody)??"JAMB"),[p,H]=l.useState((t==null?void 0:t.yearOfStudy)??""),[Z,k]=l.useState(60),[q,N]=l.useState("All");l.useEffect(()=>{try{const a=localStorage.getItem(b);if(!a)return;const i=JSON.parse(a);typeof i.timerPerQuestion=="number"&&k(i.timerPerQuestion),typeof i.defaultDifficulty=="string"&&N(i.defaultDifficulty)}catch{}},[]);function w(a,i){try{const C=localStorage.getItem(b),P=C?JSON.parse(C):{};P[a]=i,localStorage.setItem(b,JSON.stringify(P))}catch{}}const K=t!=null&&t.createdAt?new Date(t.createdAt).toLocaleDateString("en-NG",{month:"long",year:"numeric"}):"N/A",S=(t==null?void 0:t.subscriptionTier)==="pro"?"Pro":"Free",V=(t==null?void 0:t.subscriptionTier)==="pro"?"gold":"muted";function W(){const a={};m.trim()&&m.trim()!==(t==null?void 0:t.fullName)&&(a.fullName=m.trim()),y.trim()!==((t==null?void 0:t.phone)??"")&&(a.phone=y.trim()),g!==((t==null?void 0:t.state)??"")&&(a.state=g===""?null:g),h&&h!==(t==null?void 0:t.examBody)&&(a.examBody=h),p!==((t==null?void 0:t.yearOfStudy)??"")&&(a.yearOfStudy=p===""?null:p),Object.keys(a).length>0&&d.mutate(a)}async function $(a){if(a!==B(t)){v(!0);try{await d.mutateAsync({studyArea:a}),j("success","Study area updated."),o("/app/dashboard")}catch{j("error","Could not update study area. Please try again.")}finally{v(!1)}}}function ee(){L(),o("/login")}return e.jsxs(s.div,{variants:ne,initial:"initial",animate:"animate",exit:"exit",children:[e.jsx("div",{className:"mb-6",children:e.jsx("h1",{className:"text-2xl font-bold text-gray-900 dark:text-white",children:"Profile"})}),e.jsxs(s.div,{variants:oe,initial:"initial",animate:"animate",className:"space-y-4",children:[e.jsx(s.div,{variants:n,children:e.jsxs(r,{variant:"elevated",padding:"lg",children:[e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsx(he,{name:(t==null?void 0:t.fullName)||"Student",src:t==null?void 0:t.avatarUrl,size:"xl",ring:"green"}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("h2",{className:"truncate text-lg font-bold text-gray-900 dark:text-white",children:(t==null?void 0:t.fullName)||"Student"}),e.jsxs("div",{className:"mt-1 flex items-center gap-1.5 text-sm text-gray-500 dark:text-gray-400",children:[e.jsx(ve,{className:"h-3.5 w-3.5 shrink-0"}),e.jsx("span",{className:"truncate",children:t==null?void 0:t.email})]}),e.jsxs("div",{className:"mt-1.5 flex flex-wrap items-center gap-3",children:[e.jsx(fe,{rank:F,size:"sm"}),e.jsxs("div",{className:"flex items-center gap-1 text-xs text-gray-500 dark:text-gray-400",children:[e.jsx(ke,{className:"h-3.5 w-3.5"}),e.jsxs("span",{children:["Since ",K]})]})]})]})]}),e.jsxs("div",{className:"mt-4 flex items-center gap-2",children:[e.jsxs(A,{variant:V,size:"md",children:[e.jsx(I,{className:"mr-1 h-3 w-3"}),S," Plan"]}),(t==null?void 0:t.subscriptionTier)!=="pro"&&e.jsx("button",{onClick:()=>o("/app/profile/subscription"),className:"rounded-full border border-yellow-300 bg-yellow-50 px-3 py-1 text-xs font-semibold text-yellow-800 transition hover:bg-yellow-100 dark:border-yellow-700 dark:bg-yellow-900/20 dark:text-yellow-300 dark:hover:bg-yellow-900/30",children:"Upgrade â"})]})]})}),e.jsx(s.div,{variants:n,children:e.jsxs("div",{className:"grid grid-cols-2 gap-3 sm:grid-cols-4",children:[e.jsx(r,{variant:"default",children:e.jsxs("div",{className:"flex flex-col items-center text-center",children:[e.jsx(Ne,{className:"mb-1 h-6 w-6 text-yellow-500"}),e.jsx("p",{className:"text-xl font-bold text-gray-900 dark:text-white",children:E(U)}),e.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400",children:"Total XP"})]})}),e.jsx(r,{variant:"default",children:e.jsxs("div",{className:"flex flex-col items-center text-center",children:[e.jsx(we,{className:"mb-1 h-6 w-6 text-orange-500"}),e.jsx("p",{className:"text-xl font-bold text-gray-900 dark:text-white",children:Y}),e.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400",children:"Day Streak"})]})}),e.jsx(r,{variant:"default",children:e.jsxs("div",{className:"flex flex-col items-center text-center",children:[e.jsx(Se,{className:"mb-1 h-6 w-6 text-yellow-600 dark:text-yellow-400"}),e.jsx("p",{className:"text-xl font-bold text-gray-900 dark:text-white",children:E((t==null?void 0:t.padiCoins)??R)}),e.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400",children:"PadiCoins"})]})}),e.jsx(r,{variant:"default",children:e.jsxs("div",{className:"flex flex-col items-center text-center",children:[e.jsx(I,{className:"mb-1 h-6 w-6 text-purple-600 dar
6k:text-purple-400"}),e.jsx("p",{className:"text-sm font-bold capitalize text-gray-900 dark:text-white",children:S}),e.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400",children:"Subscription"})]})})]})}),e.jsx(s.div,{variants:n,children:e.jsxs(r,{variant:"default",padding:"lg",children:[e.jsx("h3",{className:"mb-3 text-sm font-semibold text-gray-500 uppercase tracking-wider dark:text-gray-400",children:"Rank Progress"}),e.jsx(ce,{})]})}),e.jsx(s.div,{variants:n,children:e.jsxs(r,{variant:"default",padding:"lg",children:[e.jsx("h3",{className:"mb-4 text-sm font-semibold text-gray-500 uppercase tracking-wider dark:text-gray-400",children:"Study Area"}),e.jsx("p",{className:"mb-4 text-xs text-gray-500 dark:text-gray-400",children:"Changing your study area updates what you see in the app. You will return to the dashboard after saving."}),e.jsx("div",{className:Q?"pointer-events-none opacity-60":void 0,children:e.jsx(be,{selected:B(t),showHeader:!1,onSelect:a=>void $(a)})})]})}),e.jsx(s.div,{variants:n,children:e.jsxs(r,{variant:"default",padding:"lg",children:[e.jsx("h3",{className:"mb-4 text-sm font-semibold text-gray-500 uppercase tracking-wider dark:text-gray-400",children:"Edit Profile"}),e.jsxs("div",{className:"space-y-4",children:[e.jsx(T,{label:"Full Name",iconLeft:Ce,value:m,onChange:a=>_(a.target.value),placeholder:"Your full name"}),e.jsx(T,{label:"Phone Number",iconLeft:Pe,value:y,onChange:a=>X(a.target.value),placeholder:"e.g. 08012345678",type:"tel"}),e.jsxs("div",{children:[e.jsx("label",{className:"mb-1.5 block text-xs font-medium text-gray-700 dark:text-gray-300",children:e.jsxs("span",{className:"inline-flex items-center gap-1.5",children:[e.jsx(De,{className:"h-3.5 w-3.5"}),"State"]})}),e.jsxs("select",{value:g,onChange:a=>J(a.target.value),className:"block w-full rounded-lg border border-gray-300 bg-white px-3 py-2 text-sm text-gray-900 focus:border-green-500 focus:outline-none focus:ring-1 focus:ring-green-500 dark:border-gray-700 dark:bg-dark-card dark:text-white",children:[e.jsx("option",{value:"",children:"Not set"}),ue.map(a=>e.jsx("option",{value:a,children:a},a))]}),e.jsx("p",{className:"mt-1 text-[11px] text-gray-400 dark:text-gray-500",children:"Powers your state-leaderboard rank. Optional."})]}),e.jsxs("div",{children:[e.jsx("label",{className:"mb-1.5 block text-xs font-medium text-gray-700 dark:text-gray-300",children:e.jsxs("span",{className:"inline-flex items-center gap-1.5",children:[e.jsx(Ee,{className:"h-3.5 w-3.5"}),"Exam Body"]})}),e.jsx("select",{value:h,onChange:a=>G(a.target.value),className:"block w-full rounded-lg border border-gray-300 bg-white px-3 py-2 text-sm text-gray-900 focus:border-green-500 focus:outline-none focus:ring-1 focus:ring-green-500 dark:border-gray-700 dark:bg-dark-card dark:text-white",children:ye.map(a=>e.jsxs("option",{value:a.id,disabled:!a.active,children:[a.label,a.active?"":" (coming soon)"]},a.id))})]}),e.jsxs("div",{children:[e.jsx("label",{className:"mb-1.5 block text-xs font-medium text-gray-700 dark:text-gray-300",children:"Year of study"}),e.jsxs("select",{value:p,onChange:a=>H(a.target.value),className:"block w-full rounded-lg border border-gray-300 bg-white px-3 py-2 text-sm text-gray-900 focus:border-green-500 focus:outline-none focus:ring-1 focus:ring-green-500 dark:border-gray-700 dark:bg-dark-card dark:text-white",children:[e.jsx("option",{value:"",children:"Not set"}),se(t).map(a=>e.jsx("option",{value:a,children:a},a))]})]}),O(t)&&e.jsxs("p",{className:"text-xs text-gray-500 dark:text-gray-400",children:[ie(t)?"University":"School",":"," ",e.jsx("span",{className:"font-medium text-gray-800 dark:text-gray-200",children:O(t)})]}),e.jsx(pe,{variant:"primary",size:"md",icon:Be,loading:d.isPending,onClick:W,className:"w-full sm:w-auto",children:"Save Changes"}),d.isSuccess&&e.jsx("p",{className:"text-xs text-green-600 dark:text-green-400",children:"Profile updated successfully."}),d.isError&&e.jsx("p",{className:"text-xs text-red-500 dark:text-red-400",children:"Failed to update profile. Please try again."})]})]})}),e.jsx(s.div,{variants:n,children:e.jsxs(r,{variant:"default",padding:"lg",children:[e.jsx("h3",{className:"mb-4 text-sm font-semibold text-gray-500 uppercase tracking-wider dark:text-gray-400",children:"Selected Subjects"}),e.jsxs("div",{className:"mb-2 flex items-center gap-2",children:[e.jsx(Ue,{className:"h-4 w-4 text-gray-400"}),e.jsx("p",{className:"text-xs font-medium text-gray-500 dark:text-gray-400",children:"Currently studying"})]}),e.jsxs("div",{className:"flex flex-wrap gap-2",children:[((t==null?void 0:t.subjects)??[]).map(a=>e.jsx(A,{variant:"primary",size:"md",children:a},a)),((t==null?void 0:t.subjects)??[]).length===0&&e.jsx("p",{className:"text-xs text-gray-400 dark:text-gray-500",children:"No subjects selected"})]})]})}),e.jsx(s.div,{variants:n,children:e.jsxs(r,{variant:"default",padding:"lg",children:[e.jsx("h3",{className:"mb-4 text-sm font-semibold text-gray-500 uppercase tracking-wider dark:text-gray-400",children:"Study Preferences"}),e.jsx("p",{className:"mb-2 text-xs font-medium text-gray-700 dark:text-gray-300",children:"Timer Per Question"}),e.jsx("div",{className:"mb-5 flex flex-wrap gap-2",children:Fe.map(a=>{const i=Z===a.value;return e.jsx("button",{onClick:()=>{k(a.value),w("timerPerQuestion",a.value)},className:f("rounded-full border px-4 py-1.5 text-sm font-medium transition",i?"border-green-500 bg-green-500 text-white shadow-sm":"border-gray-200 bg-white text-gray-700 hover:border-green-300 dark:border-gray-700 dark:bg-dark-card dark:text-gray-200"),children:a.label},a.value)})}),e.jsx("p",{className:"mb-2 text-xs font-medium text-gray-700 dark:text-gray-300",children:"Default Difficulty"}),e.jsx("div",{className:"flex flex-wrap gap-2",children:Re.map(a=>{const i=q===a;return e.jsx("button",{onClick:()=>{N(a),w("defaultDifficulty",a)},className:f("rounded-full border px-4 py-1.5 text-sm font-medium transition",i?"border-green-500 bg-green-500 text-white shadow-sm":"border-gray-200 bg-white text-gray-700 hover:border-green-300 dark:border-gray-700 dark:bg-dark-card dark:text-gray-200"),children:a},a)})}),e.jsx("p",{className:"mt-3 text-[11px] text-gray-400 dark:text-gray-500",children:"Stored in this browser. Mobile devices keep their own copy."})]})}),e.jsxs(s.div,{variants:n,children:[e.jsx("h3",{className:"mb-2 text-sm font-semibold text-gray-500 uppercase tracking-wider dark:text-gray-400",children:"Settings"}),e.jsxs(r,{variant:"default",padding:"none",children:[e.jsxs("button",{onClick:z,className:"flex w-full items-center justify-between px-4 py-3.5 transition-colors hover:bg-gray-50 dark:hover:bg-white/5",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[x?e.jsx(me,{className:"h-5 w-5 text-gray-500 dark:text-gray-400"}):e.jsx(ge,{className:"h-5 w-5 text-gray-500"}),e.jsx("span",{className:"text-sm font-medium text-gray-800 dark:text-gray-200",children:x?"Dark Mode":"Light Mode"})]}),e.jsx("div",{className:f("flex h-6 w-11 items-center rounded-full px-0.5 transition-colors",x?"bg-green-600":"bg-gray-300"),children:e.jsx("div",{className:f("h-5 w-5 rounded-full bg-white shadow transition-transform",x?"translate-x-5":"translate-x-0")})})]}),e.jsx("div",{className:"h-px bg-gray-100 dark:bg-[#2D3748]"}),e.jsxs("button",{onClick:()=>o("/app/bookmarks"),className:"flex w-full items-center justify-between px-4 py-3.5 transition-colors hover:bg-gray-50 dark:hover:bg-white/5",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(Oe,{className:"h-5 w-5 text-gray-500 dark:text-gray-400"}),e.jsx("span",{className:"text-sm font-medium text-gray-800 dark:text-gray-200",children:"Bookmarked Questions"})]}),e.jsx(c,{className:"h-4 w-4 text-gray-400"})]}),e.jsx("div",{className:"h-px bg-gray-100 dark:bg-[#2D3748]"}),e.jsxs("button",{onClick:()=>o("/app/friends"),className:"flex w-full items-center justify-between px-4 py-3.5 transition-colors hover:bg-gray-50 dark:hover:bg-white/5",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(Ae,{className:"h-5 w-5 text-gray-500 dark:text-gray-400"}),e.jsx("span",{className:"text-sm font-medium text-gray-800 dark:text-gray-200",children:"Friends"})]}),e.jsx(c,{className:"h-4 w-4 text-gray-400"})]}),e.jsx("div",{className:"h-px bg-gray-100 dark:bg-[#2D3748]"}),e.jsxs("button",{onClick:()=>o("/app/profile/notifications"),className:"flex w-full items-center justify-between px-4 py-3.5 transition-colors hover:bg-gray-50 dark:hover:bg-white/5",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(Te,{className:"h-5 w-5 text-gray-500 dark:text-gray-400"}),e.jsx("span",{className:"text-sm font-medium text-gray-800 dark:text-gray-200",children:"Notification Preferences"})]}),e.jsx(c,{className:"h-4 w-4 text-gray-400"})]}),e.jsx("div",{className:"h-px bg-gray-100 dark:bg-[#2D3748]"}),e.jsxs("button",{onClick:()=>M("settings"),className:"flex w-full items-center justify-between px-4 py-3.5 transition-colors hover:bg-gray-50 dark:hover:bg-white/5",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(Ie,{className:"h-5 w-5 text-gray-500 dark:text-gray-400"}),e.jsx("span",{className:"text-sm font-medium text-gray-800 dark:text-gray-200",children:"Privacy choices"})]}),e.jsx(c,{className:"h-4 w-4 text-gray-400"})]}),e.jsx("div",{className:"h-px bg-gray-100 dark:bg-[#2D3748]"}),e.jsxs("button",{onClick:()=>o("/app/profile/change-password"),className:"flex w-full items-center justify-between px-4 py-3.5 transition-colors hover:bg-gray-50 dark:hover:bg-white/5",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(Me,{className:"h-5 w-5 text-gray-500 dark:text-gray-400"}),e.jsx("span",{className:"text-sm font-medium text-gray-800 dark:text-gray-200",children:"Change Password"})]}),e.jsx(c,{className:"h-4 w-4 text-gray-400"})]})]})]}),e.jsxs(s.div,{variants:n,children:[e.jsx("h3",{className:"mb-2 text-sm font-semibold text-red-500 uppercase tracking-wider dark:text-red-400",children:"Danger Zone"}),e.jsxs("button",{onClick:ee,className:"flex w-full items-center justify-center gap-2 rounded-xl border border-red-200 bg-red-50 px-4 py-3 text-sm font-semibold text-red-600 transition-colors hover:bg-red-100 dark:border-red-800/50 dark:bg-red-900/10 dark:text-red-400 dark:hover:bg-red-900/20",children:[e.jsx(Le,{className:"h-4 w-4"}),"Log Out"]})]})]})]})}export{Lt 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.