1var Ne=Object.defineProperty;var ve=(s,a,i)=>a in s?Ne(s,a,{enumerable:!0,configurable:!0,writable:!0,value:i}):s[a]=i;var te=(s,a,i)=>ve(s,typeof a!="symbol"?a+"":a,i);import{c as I,j as e,G as we,r as h,s as d,C as b,h as B,B as _,u as Q,e as de,H as ie,S as me,T as _e,g as ee,y as A,a as M,z as D,I as T,L,d as U,J as X,b as ye,D as ke,q as Se,t as Ce,v as Me,w as Ee,K as Pe,A as qe,M as Ae,N as De,O as ue,i as Te,F as Ie}from"./index-DO0ZNUzu.js";import{A as Fe,a as Le,b as Re}from"./avatar-k1omA2Fi.js";import{S as re}from"./separator-CTR_znUr.js";import{S as z}from"./switch-t8rwWEdY.js";import{P as He}from"./progress-JqVFM1gN.js";import{C as je}from"./calendar-Dodd1r6N.js";import{f as ne}from"./format-Cn6ElKJ8.js";import{S as ze}from"./smile-DAGHp0Pv.js";import{B as he}from"./bell-Dc_RYjMz.js";import{L as V}from"./loader-circle-CZ_geqae.js";import{U as Ye}from"./user-Dd_SXVXr.js";import{S as Be}from"./settings-cLgs3mni.js";import{C as Ue}from"./camera-CQT33gaU.js";import{M as $e}from"./mail-rAjwM4rG.js";/** 2 * @license lucide-react v0.462.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 Oe=I("BellOff",[["path",{d:"M8.7 3A6 6 0 0 1 18 8a21.3 21.3 0 0 0 .6 5",key:"o7mx20"}],["path",{d:"M17 17H3s3-2 3-9a4.67 4.67 0 0 1 .3-1.7",key:"16f1lm"}],["path",{d:"M10.3 21a1.94 1.94 0 0 0 3.4 0",key:"qgo35s"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]]);/** 7 * @license lucide-react v0.462.0 - ISC 8 * 9 * This source code is licensed under the ISC license. 10 * See the LICENSE file in the root directory of this source tree. 11 */const xe=I("Brain",[["path",{d:"M12 5a3 3 0 1 0-5.997.125 4 4 0 0 0-2.526 5.77 4 4 0 0 0 .556 6.588A4 4 0 1 0 12 18Z",key:"l5xja"}],["path",{d:"M12 5a3 3 0 1 1 5.997.125 4 4 0 0 1 2.526 5.77 4 4 0 0 1-.556 6.588A4 4 0 1 1 12 18Z",key:"ep3f8r"}],["path",{d:"M15 13a4.5 4.5 0 0 1-3-4 4.5 4.5 0 0 1-3 4",key:"1p4c4q"}],["path",{d:"M17.599 6.5a3 3 0 0 0 .399-1.375",key:"tmeiqw"}],["path",{d:"M6.003 5.125A3 3 0 0 0 6.401 6.5",key:"105sqy"}],["path",{d:"M3.477 10.896a4 4 0 0 1 .585-.396",key:"ql3yin"}],["path",{d:"M19.938 10.5a4 4 0 0 1 .585.396",key:"1qfode"}],["path",{d:"M6 18a4 4 0 0 1-1.967-.516",key:"2e4loj"}],["path",{d:"M19.967 17.484A4 4 0 0 1 18 18",key:"159ez6"}]]);/** 12 * @license lucide-react v0.462.0 - ISC 13 * 14 * This source code is licensed under the ISC license. 15 * See the LICENSE file in the root directory of this source tree. 16 */const We=I("ClipboardList",[["rect",{width:"8",height:"4",x:"8",y:"2",rx:"1",ry:"1",key:"tgr4d6"}],["path",{d:"M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2",key:"116196"}],["path",{d:"M12 11h4",key:"1jrz19"}],["path",{d:"M12 16h4",key:"n85exb"}],["path",{d:"M8 11h.01",key:"1dfujw"}],["path",{d:"M8 16h.01",key:"18s6g9"}]]);/** 17 * @license lucide-react v0.462.0 - ISC 18 * 19 * This source code is licensed under the ISC license. 20 * See the LICENSE file in the root directory of this source tree. 21 */const Ve=I("CloudRain",[["path",{d:"M4 14.899A7 7 0 1 1 15.71 8h1.79a4.5 4.5 0 0 1 2.5 8.242",key:"1pljnt"}],["path",{d:"M16 14v6",key:"1j4efv"}],["path",{d:"M8 14v6",key:"17c4r9"}],["path",{d:"M12 16v6",key:"c8a4gj"}]]);/** 22 * @license lucide-react v0.462.0 - ISC 23 * 24 * This source code is licensed under the ISC license. 25 * See the LICENSE file in the root directory of this source tree. 26 */const Ge=I("Cloud",[["path",{d:"M17.5 19H9a7 7 0 1 1 6.71-9h1.79a4.5 4.5 0 1 1 0 9Z",key:"p7xjir"}]]);/** 27 * @license lucide-react v0.462.0 - ISC 28 * 29 * This source code is licensed under the ISC license. 30 * See the LICENSE file in the root directory of this source tree. 31 */const Je=I("Frown",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M16 16s-1.5-2-4-2-4 2-4 2",key:"epbg0q"}],["line",{x1:"9",x2:"9.01",y1:"9",y2:"9",key:"yxxnd0"}],["line",{x1:"15",x2:"15.01",y1:"9",y2:"9",key:"1p4y9e"}]]);/** 32 * @license lucide-react v0.462.0 - ISC 33 * 34 * This source code is licensed under the ISC license. 35 * See the LICENSE file in the root directory of this source tree. 36 */const fe=I("History",[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}],["path",{d:"M12 7v5l4 2",key:"1fdv2h"}]]);/** 37 * @license lucide-react v0.462.0 - ISC 38 * 39 * This source code is licensed under the ISC license. 40 * See the LICENSE file in the root directory of this source tree. 41 */const pe=I("Meh",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"8",x2:"16",y1:"15",y2:"15",key:"1xb1d9"}],["line",{x1:"9",x2:"9.01",y1:"9",y2:"9",key:"yxxnd0"}],["line",{x1:"15",x2:"15.01",y1:"9",y2:"9",key:"1p4y9e"}]]);/** 42 * @license lucide-react v0.462.0 - ISC 43 * 44 * This source code is licensed under the ISC license. 45 * See the LICENSE file in the root directory of this source tree. 46 */const ge=I("Sun",[["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"m4.93 4.93 1.41 1.41",key:"149t6j"}],["path",{d:"m17.66 17.66 1.41 1.41",key:"ptbguv"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"m6.34 17.66-1.41 1.41",key:"1m8zz5"}],["path",{d:"m19.07 4.93-1.41 1.41",key:"1shlcs"}]]);/** 47 * @license lucide-react v0.462.0 - ISC 48 * 49 * This source code is licensed under the ISC license. 50 * See the LICENSE file in the root directory of this source tree. 51 */const G=I("Trophy",[["path",{d:"M6 9H4.5a2.5 2.5 0 0 1 0-5H6",key:"17hqa7"}],["path",{d:"M18 9h1.5a2.5 2.5 0 0 0 0-5H18",key:"lmptdp"}],["path",{d:"M4 22h16",key:"57wxv0"}
51],["path",{d:"M10 14.66V17c0 .55-.47.98-.97 1.21C7.85 18.75 7 20.24 7 22",key:"1nw9bq"}],["path",{d:"M14 14.66V17c0 .55.47.98.97 1.21C16.15 18.75 17 20.24 17 22",key:"1np0yb"}],["path",{d:"M18 2H6v7a6 6 0 0 0 12 0V2Z",key:"u46fv3"}]]);function W({className:s,...a}){return e.jsx("div",{className:we("animate-pulse rounded-md bg-muted",s),...a})}const Ke=()=>{const[s,a]=h.useState([]),[i,n]=h.useState(!0);h.useEffect(()=>{r()},[]);const r=async()=>{try{const{data:{user:c}}=await d.auth.getUser();if(!c){n(!1);return}const{data:p,error:w}=await d.from("mood_checkins").select("*").eq("user_id",c.id).order("created_at",{ascending:!1}).limit(10);if(w)throw w;a(p||[])}catch(c){console.error("Error fetching check-ins:",c)}finally{n(!1)}},f=c=>{switch(c){case"amazing":case"good":return ze;case"okay":return pe;case"low":return Je;default:return pe}},o=c=>{switch(c){case"sunny":return ge;case"cloudy":return Ge;case"rainy":return Ve;default:return ge}},u=c=>{switch(c){case"amazing":return"text-accent-gold";case"good":return"text-primary";case"okay":return"text-muted-foreground";case"low":return"text-secondary-foreground";default:return"text-muted-foreground"}},y=c=>{switch(c){case"sunny":return"text-accent-gold";case"cloudy":return"text-muted-foreground";case"rainy":return"text-primary";default:return"text-accent-gold"}};return i?e.jsx("div",{className:"space-y-6",children:e.jsxs("div",{className:"text-center space-y-2",children:[e.jsx("h2",{className:"text-2xl font-bold bg-gradient-primary bg-clip-text text-transparent",children:"Your Check-In History"}),e.jsx("p",{className:"text-muted-foreground",children:"Loading your mood journey..."})]})}):s.length===0?e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"text-center space-y-2",children:[e.jsx("h2",{className:"text-2xl font-bold bg-gradient-primary bg-clip-text text-transparent",children:"Your Check-In History"}),e.jsx("p",{className:"text-muted-foreground",children:"No check-ins yet. Start your mood tracking journey today!"})]}),e.jsxs(b,{className:"p-8 text-center bg-gradient-card shadow-soft border-0",children:[e.jsx(je,{className:"h-12 w-12 mx-auto text-muted-foreground mb-4"}),e.jsx("p",{className:"text-muted-foreground",children:"Your mood board check-ins will appear here once you start tracking your daily emotions and experiences."})]})]}):e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"text-center space-y-2",children:[e.jsx("h2",{className:"text-2xl font-bold bg-gradient-primary bg-clip-text text-transparent",children:"Your Check-In History"}),e.jsx("p",{className:"text-muted-foreground",children:"Track your emotional journey over time"})]}),e.jsx("div",{className:"space-y-4",children:s.map(c=>{const p=f(c.selected_mood),w=o(c.selected_weather);return e.jsx(b,{className:"p-6 bg-gradient-card shadow-soft border-0",children:e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(p,{className:`h-5 w-5 ${u(c.selected_mood)}`}),e.jsx("span",{className:"text-sm font-medium capitalize",children:c.selected_mood})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(w,{className:`h-5 w-5 ${y(c.selected_weather)}`}),e.jsx("span",{className:"text-sm font-medium capitalize",children:c.selected_weather})]})]}),e.jsx(B,{variant:"secondary",className:"text-xs",children:ne(new Date(c.created_at),"MMM d, yyyy")})]}),c.selected_colors.length>0&&e.jsxs("div",{className:"space-y-2",children:[e.jsx("p",{className:"text-sm font-medium text-card-foreground",children:"Colors that spoke to you:"}),e.jsx("div",{className:"flex gap-2",children:c.selected_colors.map((x,m)=>e.jsx("div",{className:"w-6 h-6 rounded-full border border-border/20",style:{backgroundColor:x}},m))})]}),c.uploaded_images.length>0&&e.jsxs("div",{className:"space-y-2",children:[e.jsx("p",{className:"text-sm font-medium text-card-foreground",children:"Visual memories:"}),e.jsx("div",{className:"grid grid-cols-2 sm:grid-cols-4 gap-2",children:c.uploaded_images.map((x,m)=>e.jsx("div",{className:"p-1 bg-gradient-card rounded-lg shadow-soft border border-border/20",children:e.jsx("img",{src:x,alt:`Memory ${m+1}`,className:"w-full h-16 object-cover rounded"})},m))})]})]})},c.id)})}),s.length>=10&&e.jsx("div",{className:"text-center",children:e.jsx(_,{variant:"outline",onClick:r,children:"Load More Check-Ins"})})]})},Ze=()=>{const[s,a]=h.useState(!1),[i,n]=h.useState(!1),[r,f]=h.useState(0),[o,u]=h.useState({streak:0,totalEntries:0}),[y,c]=h.useState([]),[p,w]=h.useState([]),{user:x}=Q(),m=async()=>{try{if(!x)return;const{count:l}=await d.from("journal_entries").select("*",{count:"exact",head:!0}).eq("user_id",x.id),{count:j}=await d.from("mood_checkins").select("*",{count:"exact",head:!0}).eq("user_id",x.id),N=[{id:1,name:"First Steps",description:"Completed your first journal entry",icon:de,earned:(l||0)>=1,color:"bg-gradient-gold"},{id:2,name:"Self-Love Champion",description:"Completed 5 journal entries",icon:ie,earned:(l||0)>=5,color:"bg-gradient-primary"},{id:3,name:"Reflection Master",description:"7-day journaling streak",icon:me,earned:o.streak>
51=7,color:"bg-gradient-wellness"},{id:4,name:"Mood Tracker",description:"Completed 10 mood check-ins",icon:_e,earned:(j||0)>=10,color:"bg-gradient-primary"},{id:5,name:"Wellness Warrior",description:"30-day journaling streak",icon:G,earned:o.streak>=30,color:"bg-gradient-gold"}];w(N)}catch(l){console.error("Error fetching achievements:",l),n(!0)}},v=async()=>{try{if(!x)return;const{count:l}=await d.from("user_challenge_completions").select("*",{count:"exact",head:!0}).eq("user_id",x.id),{count:j}=await d.from("user_affirmation_interactions").select("*",{count:"exact",head:!0}).eq("user_id",x.id).eq("is_liked",!0),{data:N}=await d.from("user_points").select("total_points, current_level").eq("user_id",x.id).single(),S=(N==null?void 0:N.total_points)||0,q=(N==null?void 0:N.current_level)||1,k=q*300-S;se({challengesCompleted:l||0,affirmationsLoved:j||0,currentLevel:q,pointsToNextLevel:Math.max(0,k),totalPoints:S})}catch(l){console.error("Error fetching user stats:",l),n(!0)}},F=()=>{n(!1),E(),O(),$(),m(),v()};h.useEffect(()=>{if(x){E(),O(),$(),m(),v();const l=d.channel("journal-updates").on("postgres_changes",{event:"*",schema:"public",table:"journal_entries",filter:`user_id=eq.${x.id}`},()=>{O(),$(),m()}).subscribe(),j=d.channel("checkin-updates").on("postgres_changes",{event:"*",schema:"public",table:"mood_checkins",filter:`user_id=eq.${x.id}`},()=>{E(),m()}).subscribe(),N=d.channel("stats-updates").on("postgres_changes",{event:"*",schema:"public",table:"user_challenge_completions",filter:`user_id=eq.${x.id}`},()=>{v(),m()}).on("postgres_changes",{event:"*",schema:"public",table:"user_affirmation_interactions",filter:`user_id=eq.${x.id}`},()=>{v()}).subscribe();return()=>{d.removeChannel(l),d.removeChannel(j),d.removeChannel(N)}}},[x]);const E=async()=>{try{if(!x)return;const{count:l,error:j}=await d.from("mood_checkins").select("*",{count:"exact",head:!0}).eq("user_id",x.id);if(j)throw j;f(l||0)}catch(l){console.error("Error fetching check-ins count:",l),n(!0)}},O=async()=>{try{if(!x)return;const{count:l,error:j}=await d.from("journal_entries").select("*",{count:"exact",head:!0}).eq("user_id",x.id);if(j)throw j;const N=new Date;N.setDate(N.getDate()-30);const{data:S,error:q}=await d.from("journal_entries").select("created_at").eq("user_id",x.id).gte("created_at",N.toISOString()).order("created_at",{ascending:!1});if(q)throw q;const k=J(S||[]);u({streak:k,totalEntries:l||0})}catch(l){console.error("Error fetching journal stats:",l),n(!0)}},$=async()=>{try{if(!x)return;const l=[],{data:j,error:N}=await d.from("journal_entries").select("created_at").eq("user_id",x.id).order("created_at",{ascending:!1}).limit(7);if(N)throw N;const S=new Date;S.setHours(0,0,0,0),(j==null?void 0:j.find(t=>{const g=new Date(t.created_at);return g.setHours(0,0,0,0),g.getTime()===S.getTime()}))&&l.push({date:"Today",achievement:"Completed daily journal entry",points:25}),o.streak>=7&&l.push({date:o.streak===7?"Today":`${o.streak-7} days ago`,achievement:`${o.streak}-day journaling streak`,points:o.streak*5});const{data:k,error:C}=await d.from("mood_checkins").select("created_at").eq("user_id",x.id).order("created_at",{ascending:!1}).limit(3);if(C)throw C;(k==null?void 0:k.find(t=>{const g=new Date(t.created_at);return g.setHours(0,0,0,0),g.getTime()===S.getTime()}))&&l.push({date:"Today",achievement:"Completed daily mood check-in",points:15}),c(l.slice(0,4))}catch(l){console.error("Error fetching recent milestones:",l),n(!0)}},J=l=>{if(!l.length)return 0;const j=new Date;j.setHours(0,0,0,0);const N=l.map(C=>{const R=new Date(C.created_at);return R.setHours(0,0,0,0),R.getTime()}),S=[...new Set(N)].sort((C,R)=>R-C);let q=0,k=j.getTime();for(const C of S)if(C===k||C===k-864e5)q++,k=C-864e5;else break;return q},[P,se]=h.useState({challengesCompleted:0,affirmationsLoved:0,currentLevel:1,pointsToNextLevel:300,totalPoints:0}),K=P.totalPoints%300/300*100;return s?e.jsxs("div",{className:"space-y-6",children:[e.jsx("div",{className:"flex items-center justify-between",children:e.jsx(_,{variant:"outline",onClick:()=>a(!1),className:"flex items-center gap-2",children:"â Back to Progress"})}),e.jsx(Ke,{})]}):e.jsxs("div",{className:"space-y-6",children:[i&&e.jsxs(b,{className:"p-4 border-destructive/30 bg-destructive/5 flex flex-col sm:flex-row sm:items-center gap-3 justify-between",children:[e.jsx("p",{className:"text-sm text-foreground",children:"We couldn't load some of your progress right now."}),e.jsx(_,{variant:"outline",size:"sm",onClick:F,children:"Try again"})]}),e.jsxs("div",{className:"text-center space-y-2",children:[e.jsx("h2",{className:"text-2xl font-bold bg-gradient-primary bg-clip-text text-transparent",children:"Your Growth Journey"}),e.jsx("p",{className:"text-muted-foreground",children:"Celebrate every step of your self-love journey"})]}),e.jsxs("div",{className:"grid gap-6",children:[e.jsx(b,{className:"p-6 bg-gradient-card shadow-soft border-0",children:e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("h3",{className:"font-semibold text-card-foreground",children:["Level ",P.currentLevel," Wellness Warrior"]}),e.jsxs(B,{variant:"secondary",className:"bg-gradient-gold text-accent-foreground",children:[P.totalPoints," points"]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex justify-between text-sm",children:[e.jsxs("span",{className:"text-muted-foreground",children:["Progress to Level ",P.currentLevel+1]}),e.jsxs("span",{className:"text-muted-foreground",children:[Math.round(K),"%"]})]}),e.jsx(He,{value:K,className:"h-2"}),e.jsxs("p",{className:"text-xs text-muted-foreground",children:[P.pointsToNextLevel," more points needed"]})]})]})}),e.jsxs("div",{className:"grid grid-cols-2 sm:grid-cols-4 gap-4",children:[e.jsxs(b,{className:"p-4 text-center bg-gradient-card shadow-soft border-0",children:[e.jsx(de,{className:"h-6 w-6 mx-auto text-primary mb-2"}),e.jsx("p",{className:"text-2xl font-bold text-card-foreground",children:o.streak}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Day Streak"})]}),e.jsxs(b,{className:"p-4 text-center bg-gradient-card shadow-soft border-0",children:[e.jsx(ie,{className:"h-6 w-6 mx-auto text-accent-gold mb-2"}),e.jsx("p",{className:"text-2xl font-bold text-card-foreground",children:P.challengesCompleted}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Challenges"})]}),e.jsxs(b,{className:"p-4 text-center bg-gradient-card shadow-soft border-0",children:[e.jsx(me,{className:"h-6 w-6 mx-auto text-primary mb-2"}),e.jsx("p",{className:"text-2xl font-bold text-card-foreground",children:o.totalEntries}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Journal Entries"})]}),e.jsxs(b,{className:"p-4 text-center bg-gradient-card shadow-soft border-0",children:[e.jsx(fe,{className:"h-6 w-6 mx-auto text-primary mb-2"}),e.jsx("p",{className:"text-2xl font-bold text-card-foreground",children:r}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Check-ins"})]})]}),e.jsx(b,{className:"p-6 bg-gradient-card shadow-soft border-0",children:e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("h3",{className:"font-semibold text-card-foreground",children:"Mood Check-ins"}),e.jsxs(_,{variant:"outline",size:"sm",onClick:()=>a(!0),className:"flex items-center gap-2",children:[e.jsx(fe,{className:"h-4 w-4"}),"View History"]})]}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Track your daily moods and emotions. View your complete check-in history to see patterns and growth over time."})]})}),e.jsx(b,{className:"p-6 bg-gradient-card shadow-soft border-0",children:e.jsxs("div",{className:"space-y-4",children:[e.jsx("h3",{className:"font-semibold text-card-foreground",children:"Achievement Badges"}),e.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:p.map(l=>{const j=l.icon;return e.jsx("div",{className:`p-4 rounded-lg border transition-gentle ${l.earned?"bg-gradient-wellness/10 border-primary/30":"bg-muted/30 border-muted"}`,children:e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx("div",{className:`p-2 rounded-full ${l.color}`,children:e.jsx(j,{className:`h-4 w-4 ${l.earned?"text-white":"text-muted-foreground"}`})}),e.jsxs("div",{className:"flex-1",children:[e.jsx("h4",{className:`font-medium ${l.earned?"text-card-foreground":"text-muted-foreground"}`,children:l.name}),e.jsx("p",{className:"text-sm text-muted-foreground",children:l.description})]}),l.earned&&e.jsx(G,{className:"h-4 w-4 text-accent-gold"})]})},l.id)})})]})}),e.jsx(b,{className:"p-6 bg-gradient-card shadow-soft border-0",children:e.jsxs("div",{className:"space-y-4",children:[e.jsx("h3",{className:"font-semibold text-card-foreground",children:"Recent Milestones"}),e.jsx("div",{className:"space-y-3",children:y.map((l,j)=>e.jsxs("div",{className:"flex items-center justify-between py-2 border-b border-border/30 last:border-0",children:[e.jsxs("div",{children:[e.jsx("p",{className:"font-medium text-card-foreground",children:l.achievement}),e.jsx("p",{className:"text-sm text-muted-foreground",children:l.date})]}),e.jsxs(B,{variant:"secondary",className:"bg-gradient-gold text-accent-foreground",children:["+",l.points,"pts"]})]},j))})]})})]})]})},Y=class Y{constructor(){te(this,"registration",null)}static getInstance(){return Y.instance||(Y.instance=new Y),Y.instance}
51async initialize(){if(!("serviceWorker"in navigator)||!("PushManager"in window))return console.warn("Push notifications are not supported"),!1;try{return this.registration=await navigator.serviceWorker.ready,!0}catch(a){return console.error("Error initializing notification manager:",a),!1}}async requestPermission(){if(!("Notification"in window))return console.warn("Notifications not supported"),"denied";const a=await Notification.requestPermission();return console.log("Notification permission:",a),a}async subscribe(a,i){try{if(await this.requestPermission()!=="granted")return console.log("Notification permission denied"),!1;if(!this.registration&&!await this.initialize())return!1;let r=await this.registration.pushManager.getSubscription();if(!r){const y=this.urlBase64ToUint8Array("YOUR_VAPID_PUBLIC_KEY");r=await this.registration.pushManager.subscribe({userVisibleOnly:!0,applicationServerKey:y})}const f=r.toJSON(),{error:o}=await d.from("push_subscriptions").upsert({user_id:a,endpoint:f.endpoint,p256dh:f.keys.p256dh,auth:f.keys.auth,device_name:i||this.getDeviceName(),last_used:new Date().toISOString()},{onConflict:"user_id,endpoint"});return o?(console.error("Error saving subscription:",o),!1):(console.log("Push subscription saved successfully"),!0)}catch(n){return console.error("Error subscribing to push notifications:",n),!1}}async unsubscribe(a){var i;try{this.registration||await this.initialize();const n=await((i=this.registration)==null?void 0:i.pushManager.getSubscription());if(n){await n.unsubscribe();const{error:r}=await d.from("push_subscriptions").delete().eq("user_id",a).eq("endpoint",n.endpoint);if(r)return console.error("Error removing subscription:",r),!1}return!0}catch(n){return console.error("Error unsubscribing:",n),!1}}async isSubscribed(a){try{const{data:i,error:n}=await d.from("push_subscriptions").select("id").eq("user_id",a).limit(1);return n?(console.error("Error checking subscription:",n),!1):i&&i.length>0}catch(i){return console.error("Error checking subscription:",i),!1}}urlBase64ToUint8Array(a){const i="=".repeat((4-a.length%4)%4),n=(a+i).replace(/\-/g,"+").replace(/_/g,"/"),r=window.atob(n),f=new Uint8Array(r.length);for(let o=0;o<r.length;++o)f[o]=r.charCodeAt(o);return f}getDeviceName(){const a=navigator.userAgent;return/(tablet|ipad|playbook|silk)|(android(?!.*mobi))/i.test(a)?"Tablet":/Mobile|Android|iP(hone|od)|IEMobile|BlackBerry|Kindle|Silk-Accelerated|(hpw|web)OS|Opera M(obi|ini)/.test(a)?"Mobile":"Desktop"}async showNotification(a,i){this.registration||await this.initialize(),this.registration&&Notification.permission==="granted"&&await this.registration.showNotification(a,{badge:"/icon-512.png",icon:"/icon-512.png",...i})}};te(Y,"instance");let ce=Y;const ae=ce.getInstance(),Xe=()=>{const{user:s}=Q(),{toast:a}=ee(),[i,n]=h.useState(!1),[r,f]=h.useState(!0),[o,u]=h.useState({circle_messages:!0,daily_affirmations:!0,challenge_reminders:!0,new_member_join:!1,admin_announcements:!0});h.useEffect(()=>{s&&(y(),c())},[s]);const y=async()=>{if(s)try{const m=await ae.isSubscribed(s.id);n(m)}catch(m){console.error("Error checking subscription:",m)}finally{f(!1)}},c=async()=>{if(s)try{const{data:m,error:v}=await d.from("notification_preferences").select("*").eq("user_id",s.id).single();if(v&&v.code!=="PGRST116")throw v;m&&u({circle_messages:m.circle_messages,daily_affirmations:m.daily_affirmations,challenge_reminders:m.challenge_reminders,new_member_join:m.new_member_join,admin_announcements:m.admin_announcements})}catch(m){console.error("Error loading preferences:",m)}};return{isSubscribed:i,isLoading:r,preferences:o,subscribe:async()=>{if(!s)return a({title:"Not logged in",description:"Please log in to enable notifications",variant:"destructive"}),!1;f(!0);try{return await ae.subscribe(s.id)?(n(!0),a({title:"Notifications enabled",description:"You will now receive push notifications"}),!0):(a({title:"Failed to enable notifications",description:"Please check your browser settings",variant:"destructive"}),!1)}catch(m){return console.error("Error subscribing:",m),a({title:"Error",description:"Failed to enable notifications",variant:"destructive"}),!1}finally{f(!1)}},unsubscribe:async()=>
51{if(!s)return!1;f(!0);try{return await ae.unsubscribe(s.id)?(n(!1),a({title:"Notifications disabled",description:"You will no longer receive push notifications"}),!0):!1}catch(m){return console.error("Error unsubscribing:",m),a({title:"Error",description:"Failed to disable notifications",variant:"destructive"}),!1}finally{f(!1)}},updatePreferences:async m=>{if(!s)return!1;try{const{error:v}=await d.from("notification_preferences").upsert({user_id:s.id,...o,...m},{onConflict:"user_id"});if(v)throw v;return u(F=>({...F,...m})),a({title:"Preferences updated",description:"Your notification preferences have been saved"}),!0}catch(v){return console.error("Error updating preferences:",v),a({title:"Error",description:"Failed to update preferences",variant:"destructive"}),!1}}}},Qe=()=>{const{isSubscribed:s,isLoading:a,preferences:i,subscribe:n,unsubscribe:r,updatePreferences:f}=Xe(),[o,u]=h.useState(!1),y=async()=>{u(!0),s?await r():await n(),u(!1)},c=async(p,w)=>{u(!0),await f({[p]:w}),u(!1)};return a?e.jsxs(b,{children:[e.jsxs(A,{children:[e.jsx(W,{className:"h-8 w-48"}),e.jsx(W,{className:"h-4 w-full mt-2"})]}),e.jsxs(M,{className:"space-y-4",children:[e.jsx(W,{className:"h-12 w-full"}),e.jsx(W,{className:"h-12 w-full"}),e.jsx(W,{className:"h-12 w-full"})]})]}):e.jsxs(b,{children:[e.jsxs(A,{children:[e.jsxs(D,{className:"flex items-center gap-2",children:[e.jsx(he,{className:"h-5 w-5"}),"Push Notifications"]}),e.jsx(T,{children:"Manage your push notification preferences"})]}),e.jsxs(M,{className:"space-y-6",children:[e.jsxs("div",{className:"flex items-center justify-between p-4 border rounded-lg",children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(L,{className:"text-base",children:s?"Notifications Enabled":"Notifications Disabled"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:s?"You will receive push notifications based on your preferences below":"Enable push notifications to stay updated"})]}),e.jsx(_,{variant:s?"destructive":"default",size:"sm",onClick:y,disabled:o,children:s?e.jsxs(e.Fragment,{children:[e.jsx(Oe,{className:"h-4 w-4 mr-2"}),"Disable"]}):e.jsxs(e.Fragment,{children:[e.jsx(he,{className:"h-4 w-4 mr-2"}),"Enable"]})})]}),s&&e.jsxs("div",{className:"space-y-4",children:[e.jsx("h4",{className:"font-medium text-sm text-muted-foreground",children:"NOTIFICATION TYPES"}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(L,{htmlFor:"circle_messages",children:"Circle Messages"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Get notified when someone posts in your circles"})]}),e.jsx(z,{id:"circle_messages",checked:i.circle_messages,onCheckedChange:p=>c("circle_messages",p),disabled:o})]}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(L,{htmlFor:"daily_affirmations",children:"Daily Affirmations"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Receive your daily affirmation reminder"})]}),e.jsx(z,{id:"daily_affirmations",checked:i.daily_affirmations,onCheckedChange:p=>c("daily_affirmations",p),disabled:o})]}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(L,{htmlFor:"challenge_reminders",children:"Challenge Reminders"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Reminders to complete your wellness challenges"})]}),e.jsx(z,{id:"challenge_reminders",checked:i.challenge_reminders,onCheckedChange:p=>c("challenge_reminders",p),disabled:o})]}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(L,{htmlFor:"new_member_join",children:"New Member Joins"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Know when new members join your circles"})]}),e.jsx(z,{id:"new_member_join",onCheckedChange:p=>c("new_member_join",p),checked:i.new_member_join,disabled:o})]}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(L,{htmlFor:"admin_announcements",children:"Admin Announcements"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Important updates from the HERPower team"})]}),e.jsx(z,{id:"admin_announcements",checked:i.admin_announcements,onCheckedChange:p=>c("admin_announcements",p),disabled:o})]})]})]})]})]})},es=()=>{const[s,a]=h.useState([]),[i,n]=h.useState(!1),{toast:r}=ee(),f=async()=>{n(!0);try{const{data:u,error:y}=await d.functions.invoke("generate-personalized-affirmations");
51if(y)throw y;a(u.affirmations),r({title:"⨠Affirmations Generated",description:"Here are affirmations crafted just for you!"})}catch(u){console.error("Error generating affirmations:",u),r({title:"Error",description:u.message||"Failed to generate affirmations",variant:"destructive"})}finally{n(!1)}},o=async u=>{try{const{data:{user:y}}=await d.auth.getUser();if(!y)return;const{data:c,error:p}=await d.from("affirmations").insert({text:u.text,category:u.category,author_name:"AI Generated",is_active:!0}).select().single();if(p)throw p;const{error:w}=await d.from("user_affirmation_interactions").insert({user_id:y.id,affirmation_id:c.id,is_saved:!0});if(w)throw w;r({title:"ð Affirmation Saved",description:"Added to your saved affirmations"})}catch(y){console.error("Error saving affirmation:",y),r({title:"Error",description:"Failed to save affirmation",variant:"destructive"})}};return e.jsxs(b,{className:"border-primary/20",children:[e.jsxs(A,{children:[e.jsxs(D,{className:"flex items-center gap-2",children:[e.jsx(U,{className:"w-5 h-5 text-primary"}),"AI-Personalized Affirmations"]}),e.jsx(T,{children:"Affirmations tailored to your mood, journey, and preferences"})]}),e.jsxs(M,{className:"space-y-4",children:[e.jsx(_,{onClick:f,disabled:i,className:"w-full",children:i?e.jsxs(e.Fragment,{children:[e.jsx(V,{className:"w-4 h-4 mr-2 animate-spin"}),"Generating..."]}):e.jsxs(e.Fragment,{children:[e.jsx(U,{className:"w-4 h-4 mr-2"}),"Generate My Affirmations"]})}),s.length>0&&e.jsx("div",{className:"space-y-3 mt-6",children:s.map((u,y)=>e.jsxs("div",{className:"p-4 rounded-lg bg-gradient-to-r from-primary/10 to-secondary/10 border border-primary/20",children:[e.jsx("p",{className:"text-foreground font-medium mb-2",children:u.text}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{className:"text-xs text-muted-foreground capitalize",children:u.category}),e.jsxs(_,{variant:"ghost",size:"sm",onClick:()=>o(u),children:[e.jsx(ie,{className:"w-4 h-4 mr-1"}),"Save"]})]})]},y))})]})]})},ss=()=>{const[s,a]=h.useState(null),[i,n]=h.useState(!1),{toast:r}=ee(),f=async()=>{n(!0);try{const{data:o,error:u}=await d.functions.invoke("generate-mood-insights");if(u)throw u;a(o),r({title:"ð§ Insights Generated",description:"Your personalized mood insights are ready!"})}catch(o){console.error("Error generating insights:",o),r({title:"Error",description:o.message||"Failed to generate insights",variant:"destructive"})}finally{n(!1)}};return e.jsxs(b,{className:"border-secondary/20",children:[e.jsxs(A,{children:[e.jsxs(D,{className:"flex items-center gap-2",children:[e.jsx(xe,{className:"w-5 h-5 text-secondary"}),"AI Mood Insights"]}),e.jsx(T,{children:"Understand your emotional patterns and get personalized recommendations"})]}),e.jsxs(M,{className:"space-y-4",children:[e.jsx(_,{onClick:f,disabled:i,className:"w-full",variant:"secondary",children:i?e.jsxs(e.Fragment,{children:[e.jsx(V,{className:"w-4 h-4 mr-2 animate-spin"}),"Analyzing..."]}):e.jsxs(e.Fragment,{children:[e.jsx(X,{className:"w-4 h-4 mr-2"}),"Analyze My Mood Patterns"]})}),s&&e.jsxs("div",{className:"space-y-4 mt-6",children:[e.jsxs("div",{className:"p-4 rounded-lg bg-gradient-to-r from-secondary/10 to-primary/10 border border-secondary/20",children:[e.jsxs("h4",{className:"font-semibold text-foreground mb-2 flex items-center gap-2",children:[e.jsx(xe,{className:"w-4 h-4"}),"Your Insight"]}),e.jsx("p",{className:"text-foreground/80 leading-relaxed",children:s.insight})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs("h4",{className:"font-semibold text-foreground flex items-center gap-2",children:[e.jsx(X,{className:"w-4 h-4"}),"Recommendations"]}),e.jsx("ul",{className:"space-y-2",children:s.recommendations.map((o,u)=>e.jsxs("li",{className:"p-3 rounded-lg bg-muted/50 border border-border text-foreground/80",children:[u+1,". ",o]},u))})]})]})]})]})},ts=()=>{const{user:s}=Q(),[a,i]=h.useState(!1),[n,r]=h.useState(null),[f,o]=h.useState(!0);return h.useEffect(()=>{(async()=>{if(!s){o(!1);return}try{const{data:c}=await d.from("profiles").select("is_beta_user, beta_approved_at").eq("user_id",s.id).single();if(!c||!c.is_beta_user){o(!1);return}if(!c.beta_approved_at){o(!1);return}const p=new Date(c.beta_approved_at),w=new Date,x=Math.floor((w.getTime()-p.getTime())/(1e3*60*60*24)),{data:m}=await d.from("exit_survey_responses").select("*").eq("user_id",s.id).maybeSingle();r(m);const v=localStorage.getItem(`exit_survey_dismissed_${s.id}`),F=v?new Date(v):null,E=F&&w.getTime()-F.getTime()<7*24*60*60*1e3;x>=30&&!m&&!E&&i(!0)}catch(c){console.error("Error checking survey eligibility:",c)}finally{o(!1)}})()},[s]),{shouldShowSurvey:a,existingResponse:n,loading:f,dismissSurvey:()=>{s&&localStorage.setItem(`exit_survey_dismissed_${s.id}`,new Date().toISOString()),i(!1)},setShouldShowSurvey:i}},rs=({open:s,onOpenChange:a,onDismiss:i})=>{const n=ye(),r=()=>{a(!1),n("/exit-survey")},f=()=>{i(),a(!1)};return e.jsx(ke,{open:s,onOpenChange:a,children:e.jsxs(Se,{className:"sm:max-w-md",children:[e.jsxs(Ce,{children:[e.jsx("div",{className:"flex justify-center mb-4",children:e.jsx("div",{className:"w-16 h-16 rounded-full bg-primary/20 flex items-center justify-center",children:e.jsx(We,{className:"h-8 w-8 text-primary"})})}),e.jsx(Me,{className:"text-center text-xl",children:"Congratulations on 30 Days! ð"}),e.jsx(Ee,{className:"text-center",children:"You've been on your self-love journey with HERPower for 30 days! We'd love to hear about your experience."})]}),e.jsxs("div",{className:"space-y-4 py-4",children:[e.jsx("p",{className:"text-sm text-muted-foreground text-center",children:"Your feedback helps us make HERPower even better for young queens like you!"}),e.jsxs("div",{className:"flex flex-col gap-3",children:[e.jsxs(_,{onClick:r,className:"w-full gap-2",children:[e.jsx(U,{className:"h-4 w-4"}),"Take Exit Survey"]}),e.jsx(_,{variant:"outline",onClick:f,className:"w-full",children:"Remind Me Later"})]})]})]})})},as=()=>{const{shouldShowSurvey:s,dismissSurvey:a,loading:i}=ts(),[n,r]=h.useState(!0);return i||!s?null:e.jsx(rs,{open:n,onOpenChange:r,onDismiss:a})},is=()=>{var R;const{user:s}=Q(),{isAdmin:a}=Pe(),{toast:i}
51=ee(),n=ye(),[r,f]=h.useState(null),[o,u]=h.useState([]),[y,c]=h.useState(""),[p,w]=h.useState(!1),[x,m]=h.useState(!0),[v,F]=h.useState(!1),[E,O]=h.useState([]),[$,J]=h.useState({daily_affirmations:!1,circle_notifications:!0});h.useEffect(()=>{s&&(P(),se(),j(),S())},[s]);const P=async()=>{try{const{data:t,error:g}=await d.from("profiles").select("*").eq("user_id",s==null?void 0:s.id).single();if(g)throw g;f(t),c(t.display_name||"")}catch(t){console.error("Error fetching profile:",t)}finally{m(!1)}},se=async()=>{try{const{data:t,error:g}=await d.from("assessment_results").select("*").eq("user_id",s==null?void 0:s.id).order("created_at",{ascending:!1});if(g)throw g;u(t||[])}catch(t){console.error("Error fetching assessment results:",t)}},K=async()=>{try{F(!0);const{error:t}=await d.from("profiles").update({display_name:y}).eq("user_id",s==null?void 0:s.id);if(t)throw t;i({title:"Success! â¨",description:"Your profile has been successfully updated."}),P()}catch(t){i({title:"Update Failed",description:t.message||"Failed to update profile. Please try again.",variant:"destructive"})}finally{F(!1)}},l=async t=>{try{if(w(!0),!t.target.files||t.target.files.length===0)throw new Error("You must select an image to upload.");const g=t.target.files[0],H=g.name.split(".").pop(),Z=`${s==null?void 0:s.id}/avatar.${H}`,{error:oe}=await d.storage.from("profiles").upload(Z,g,{upsert:!0});if(oe)throw oe;const{data:be}=d.storage.from("profiles").getPublicUrl(Z),{error:le}=await d.from("profiles").update({avatar_url:be.publicUrl}).eq("user_id",s==null?void 0:s.id);if(le)throw le;i({title:"Success! ð¸",description:"Your profile picture has been successfully updated."}),P()}catch(g){i({title:"Upload Failed",description:g.message||"Failed to upload image. Please try again.",variant:"destructive"})}finally{w(!1)}},j=async()=>{try{const{data:t,error:g}=await d.from("user_email_preferences").select("*").eq("user_id",s==null?void 0:s.id).maybeSingle();if(g&&g.code!=="PGRST116")throw g;t&&J({daily_affirmations:t.daily_affirmations,circle_notifications:t.circle_notifications})}catch(t){console.error("Error fetching email preferences:",t)}},N=async(t,g)=>{try{const{error:H}=await d.from("user_email_preferences").upsert({user_id:s==null?void 0:s.id,[t]:g},{onConflict:"user_id"});if(H)throw H;J(Z=>({...Z,[t]:g})),i({title:"Success! âï¸",description:"Your email preferences have been saved."})}catch(H){i({title:"Update Failed",description:H.message||"Failed to update preferences. Please try again.",variant:"destructive"})}},S=async()=>{try{const{data:t,error:g}=await d.from("weekly_beta_feedback").select("week_number").eq("user_id",s==null?void 0:s.id);if(g)throw g;O((t==null?void 0:t.map(H=>H.week_number))||[])}catch(t){console.error("Error fetching weekly feedback progress:",t)}},q=async()=>{try{const{error:t}=await d.from("profiles").update({beta_access_requested:!0,beta_request_date:new Date().toISOString(),beta_request_status:"pending"}).eq("user_id",s==null?void 0:s.id);if(t)throw t;await P(),i({title:"Request Submitted!",description:"Your beta access request has been submitted. An admin will review it soon."})}catch(t){i({title:"Request Failed",description:t.message||"Failed to submit beta request. Please try again.",variant:"destructive"})}},k=t=>t>=85?"text-pink-600":t>=70?"text-purple-600":t>=50?"text-green-600":"text-blue-600",C=t=>t>=85?"default":t>=70?"secondary":"outline";return x?e.jsx("div",{className:"min-h-screen bg-background flex items-center justify-center",children:e.jsxs("div",{className:"text-center",children:[e.jsx(V,{className:"h-12 w-12 animate-spin text-primary mx-auto mb-4"}),e.jsx("p",{className:"text-muted-foreground",children:"Loading your profile..."})]})}):e.jsxs("div",{className:"min-h-screen bg-background",children:[e.jsx(as,{}),e.jsxs("div",{className:"container mx-auto px-4 py-8",children:[e.jsx("div",{className:"flex items-center justify-between mb-6",children:e.jsxs(_,{variant:"ghost",onClick:()=>n("/dashboard"),className:"flex items-center gap-2",children:[e.jsx(qe,{className:"h-4 w-4"}),"Back to Dashboard"]})}
51),e.jsxs("div",{className:"max-w-4xl xl:max-w-5xl mx-auto space-y-6",children:[e.jsxs(b,{children:[e.jsx(A,{children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsxs(D,{className:"flex items-center gap-2",children:[e.jsx(Ye,{className:"h-5 w-5"}),"My Profile",a&&e.jsx(Ae,{})]}),e.jsx(T,{children:"Manage your profile information and view your wellness journey."})]}),a&&e.jsxs(_,{variant:"outline",onClick:()=>n("/admin/settings"),className:"gap-2",children:[e.jsx(Be,{className:"h-4 w-4"}),"Admin Settings"]})]})}),e.jsx(M,{className:"space-y-6",children:e.jsxs("div",{className:"flex items-center gap-6",children:[e.jsxs("div",{className:"relative",children:[e.jsxs(Fe,{className:"h-24 w-24",children:[e.jsx(Le,{src:r==null?void 0:r.avatar_url,alt:"Profile picture"}),e.jsx(Re,{className:"text-lg",children:r!=null&&r.display_name?r.display_name.charAt(0).toUpperCase():(R=s==null?void 0:s.email)==null?void 0:R.charAt(0).toUpperCase()})]}),e.jsxs("label",{className:"absolute -bottom-2 -right-2 bg-primary text-primary-foreground rounded-full p-2 cursor-pointer hover:bg-primary/90 transition-colors disabled:opacity-50 disabled:cursor-not-allowed",children:[p?e.jsx(V,{className:"h-4 w-4 animate-spin"}):e.jsx(Ue,{className:"h-4 w-4"}),e.jsx("input",{type:"file",accept:"image/*",onChange:l,disabled:p,className:"hidden"})]})]}),e.jsxs("div",{className:"flex-1",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(L,{htmlFor:"displayName",children:"Display Name"}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(De,{id:"displayName",value:y,onChange:t=>c(t.target.value),placeholder:"Enter your display name"}),e.jsx(_,{onClick:K,disabled:!y.trim()||v,children:v?e.jsxs(e.Fragment,{children:[e.jsx(V,{className:"mr-2 h-4 w-4 animate-spin"}),"Updating"]}):"Update"})]})]}),e.jsxs("p",{className:"text-sm text-muted-foreground mt-2",children:["Email: ",s==null?void 0:s.email]})]})]})})]}),e.jsxs(b,{children:[e.jsxs(A,{children:[e.jsxs(D,{className:"flex items-center gap-2",children:[e.jsx($e,{className:"h-5 w-5"}),"Email Preferences"]}),e.jsx(T,{children:"Choose how you'd like to receive emails from us."})]}),e.jsxs(M,{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(L,{htmlFor:"daily-affirmations",children:"Daily Affirmations"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Receive daily affirmations in your inbox"})]}),e.jsx(z,{id:"daily-affirmations",checked:$.daily_affirmations,onCheckedChange:t=>N("daily_affirmations",t)})]}),e.jsx(re,{}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(L,{htmlFor:"circle-notifications",children:"Circle Notifications"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Get notified about circle activity and messages"})]}),e.jsx(z,{id:"circle-notifications",checked:$.circle_notifications,onCheckedChange:t=>N("circle_notifications",t)})]})]})]}
51),!(r!=null&&r.is_beta_user)&&e.jsxs(b,{className:"border-primary/20",children:[e.jsxs(A,{children:[e.jsxs(D,{className:"flex items-center gap-2",children:[e.jsx(U,{className:"h-5 w-5 text-primary"}),"Beta Tester Program"]}),e.jsx(T,{children:"Get early access to new features and help shape the future of our app"})]}),e.jsx(M,{className:"space-y-4",children:(r==null?void 0:r.beta_request_status)==="none"||!(r!=null&&r.beta_access_requested)?e.jsxs("div",{className:"space-y-4",children:[e.jsx("p",{className:"text-sm",children:"Join our beta testing program to access exclusive features, provide feedback, and be part of our growing community."}),e.jsxs(_,{onClick:q,className:"gap-2",children:[e.jsx(U,{className:"h-4 w-4"}),"Request Beta Access"]})]}):(r==null?void 0:r.beta_request_status)==="pending"?e.jsxs("div",{className:"space-y-2",children:[e.jsx(B,{variant:"secondary",children:"Request Pending"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Your beta access request is under review. We'll notify you once it's approved!"}),(r==null?void 0:r.beta_request_date)&&e.jsxs("p",{className:"text-xs text-muted-foreground",children:["Requested on ",ne(new Date(r.beta_request_date),"MMM dd, yyyy")]})]}):(r==null?void 0:r.beta_request_status)==="approved"?e.jsxs("div",{className:"space-y-2",children:[e.jsx(B,{variant:"default",children:"Approved"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Your beta access has been approved! Refresh the page to start using beta features."})]}):(r==null?void 0:r.beta_request_status)==="denied"?e.jsxs("div",{className:"space-y-2",children:[e.jsx(B,{variant:"destructive",children:"Request Denied"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Your beta access request was not approved at this time."})]}):null})]}),(r==null?void 0:r.is_beta_user)&&e.jsxs(b,{className:"border-primary/20 bg-gradient-to-br from-primary/5 to-accent/5",children:[e.jsxs(A,{children:[e.jsxs(D,{className:"flex items-center gap-2",children:[e.jsx(ue,{className:"h-5 w-5 text-primary"}),"Weekly Beta Check-in"]}),e.jsx(T,{children:"Share your weekly experience to help us improve HERPower"})]}),e.jsxs(M,{className:"space-y-4",children:[e.jsx("div",{className:"grid grid-cols-4 gap-2",children:[1,2,3,4].map(t=>e.jsxs("div",{className:`p-3 rounded-lg border text-center transition-all ${E.includes(t)?"bg-green-500/10 border-green-500 text-green-700":"bg-muted/50 border-border"}`,children:[e.jsxs("div",{className:"flex items-center justify-center gap-1 mb-1",children:[e.jsxs("span",{className:"text-sm font-medium",children:["Week ",t]}),E.includes(t)&&e.jsx(Te,{className:"h-4 w-4 text-green-500"})]}),e.jsx("span",{className:"text-xs text-muted-foreground",children:E.includes(t)?"Done":"Pending"})]},t))}),e.jsxs("div",{className:"flex items-center justify-between pt-2",children:[e.jsxs("p",{className:"text-sm text-muted-foreground",children:[E.length,"/4 weeks completed"]}),e.jsxs(_,{onClick:()=>n("/weekly-beta-feedback"),className:"gap-2",children:[e.jsx(ue,{className:"h-4 w-4"}),E.length<4?"Submit Check-in":"View Progress"]})]})]})]}),e.jsxs("div",{className:"grid md:grid-cols-2 gap-6",children:[e.jsx(es,{}),e.jsx(ss,{})]}),e.jsx(Qe,{}),e.jsxs(b,{children:[e.jsxs(A,{children:[e.jsxs(D,{className:"flex items-center gap-2",children:[e.jsx(U,{className:"h-5 w-5"}),"Video Tour"]}),e.jsx(T,{children:"Watch Xa'viar guide you through HERPower features"})]}),e.jsxs(M,{className:"space-y-4",children:[e.jsx("div",{className:"relative bg-gradient-card rounded-lg overflow-hidden border border-primary/20",children:e.jsx("div",{className:"aspect-video bg-muted flex items-center justify-center",children:e.jsxs("div",{className:"text-center space-y-3 p-6",children:[e.jsx("div",{className:"h-16 w-16 rounded-full bg-primary/10 flex items-center justify-center mx-auto",children:e.jsx(U,{className:"h-8 w-8 text-primary"})}),e.jsx("p",{className:"text-sm font-medium text-foreground",children:"Video Tour Coming Soon"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Xa'viar will guide you through all HERPower features"})]})})}),e.jsx("p",{className:"text-xs text-muted-foreground text-center",children:"Learn about Daily Feed ⢠Journaling ⢠Mood Tracking ⢠Circles ⢠and more"})]})]}),e.jsxs(b,{children:[e.jsxs(A,{children:[e.jsxs(D,{className:"flex items-center gap-2",children:[e.jsx(G,{className:"h-5 w-5 text-primary"}),"Subscription"]}),e.jsx(T,{children:"Manage your membership, billing, and payment methods"})]}),e.jsx(M,{children:e.jsx(_,{onClick:()=>n("/subscription"),variant:"outline",className:"w-full sm:w-auto",children:"Manage Subscription"})})]}),e.jsxs(b,{children:[e.jsxs(A,{children:[e.jsxs(D,{className:"flex items-center gap-2",children:[e.jsx(G,{className:"h-5 w-5"}),"Assessment Results"]}),e.jsx(T,{children:"View your self-love assessment history and track y
51our progress."})]}),e.jsx(M,{children:o.length===0?e.jsxs("div",{className:"text-center py-8",children:[e.jsx(G,{className:"h-12 w-12 text-muted-foreground mx-auto mb-4"}),e.jsx("h3",{className:"text-lg font-medium mb-2",children:"No assessments yet"}),e.jsx("p",{className:"text-muted-foreground mb-4",children:"Take your first self-love assessment to see your results here."}),e.jsx(_,{onClick:()=>n("/assessment"),variant:"wellness",children:"Take Assessment"})]}):e.jsxs("div",{className:"space-y-4",children:[o.map(t=>e.jsx(b,{className:"border-l-4 border-l-primary",children:e.jsx(M,{className:"pt-6",children:e.jsx("div",{className:"flex items-start justify-between",children:e.jsxs("div",{className:"flex-1",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[e.jsx("h4",{className:`font-semibold ${k(t.percentage_score)}`,children:t.result_title}),e.jsxs(B,{variant:C(t.percentage_score),children:[Math.round(t.percentage_score),"%"]})]}),e.jsx("p",{className:"text-sm text-muted-foreground mb-3",children:t.result_message}),e.jsxs("div",{className:"flex items-center gap-4 text-sm text-muted-foreground",children:[e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx(je,{className:"h-4 w-4"}),ne(new Date(t.created_at),"MMM dd, yyyy")]}),e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx(X,{className:"h-4 w-4"}),"Score: ",t.total_score,"/31"]})]})]})})})},t.id)),e.jsx(re,{}),e.jsx("div",{className:"text-center pt-2",children:e.jsx(_,{onClick:()=>n("/assessment"),variant:"outline",children:"Take Another Assessment"})})]})})]}),e.jsx(re,{}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(X,{className:"h-5 w-5 text-primary"}),e.jsx("h2",{className:"text-xl font-semibold",children:"Your Progress"})]}),e.jsx(Ze,{})]})]})]}),e.jsx(Ie,{})]})},Ns=Object.freeze(Object.defineProperty({__proto__:null,default:is},Symbol.toStringTag,{value:"Module"}));export{Ge as C,Je as F,pe as M,is as P,ge as S,Ve as a,W as b,Ns as c};
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.