PageSourceSearch

https://abantra.com/assets/HomePage-FcqUeKF3.js

js abantra.com collected 2026-09-24 14:37:35 UTC 87,857 bytes, 1 lines download raw bytes

1import{c as createLucideIcon,u as useAuth,t as useNavigate,a as useTranslation,j as jsxRuntimeExports,a2 as getEffectiveStreak,bo as isFirestoreTimestampBeforeToday,Z as Zap,aB as Shield,K as Sparkles,d as Trophy,bp as XP_PER_DAILY_GOAL,bq as GEMS_PER_DAILY_GOAL,B as BookOpen,ad as X,r as reactExports,I as useTheme,l as useLocation,ai as useWords,z as httpsCallable,E as functions,i as LoaderCircle,C as Check,V as Vt,br as needsVocabularyCalibration,L as LocalizedLink,J as Target,aX as updateDoc,W as doc,x as db,ac as getUserProfileDocPath,aY as serverTimestamp,bs as GUIDED_TOUR_STEPS,a_ as STATUS_IGNORED,bt as getContextualActions,au as Modal,a0 as getDocs,a1 as query,w as collection,bu as getUserReadingPlansCollectionPath,X as where,$ as limit,bv as calculateLevelProgress,aa as LEVELS_CONFIG,h as usePractice,bw as getLanguageProgress,aV as BookMarked}from"./index-BmIPE7n8.js";import{fetchPublicCatalogBooks}from"./catalogQuery-BGDCu03V.js";import{d as dashboardMetaCacheKey,D as DASHBOARD_META_TTL_MS}from"./dashboardMetaCache-0rg-FHat.js";import{e as buildTodaySession}from"./practiceFilters-BRP7gHHe.js";import{C as Clock}from"./clock-BXpqbSGg.js";import{C as CirclePlus}from"./circle-plus-CAo2mIUv.js";import{M as MessageSquareText}from"./message-square-text-DW3deo_b.js";import{F as Flame}from"./flame-BAnABVTg.js";import{C as Calendar}from"./calendar-BTl2ffBG.js";import{C as CircleCheckBig}from"./circle-check-big-BlXdua2n.js";import{C as ChevronRight}from"./chevron-right-FCkV48eU.js";import{C as Chrome}from"./chrome-YNo7nwMR.js";import{A as ArrowRight}from"./arrow-right-DlkVgGw7.js";import{L as Lightbulb}from"./lightbulb-Y73nDfX-.js";import{P as Play}from"./play-BXcYJGKc.js";import{B as Book}from"./book-DRfpke7-.js";import{N as Newspaper}from"./newspaper-BA5GYdDm.js";import{a as buildApproximateComprehensionStats,b as buildComprehensionStats}from"./comprehensionUtils-CdHhubet.js";import{g as getExploreCache,s as setExploreCache}from"./exploreListCache-Bx9NTpUE.js";import{d as decodeHtmlEntities,w as withArticleImageFields,b as getArticleRouteId}from"./articleContentUtils-1jXqp6vY.js";import{P as PremiumContentBadge}from"./PremiumContentBadge-o4Izh2hE.js";import{C as ChevronLeft}from"./chevron-left-DdvU2VfX.js";import{R as RecommendedPacksSection}from"./RecommendedPacksSection-DS0WV8Un.js";import{N as NewsImage}from"./NewsImage-tC1B3C9n.js";import{C as ContextualActionCard}from"./ContextualActionCard-CeMtrtNo.js";import{P as PracticeStreakBanner}from"./PracticeStreakBanner-DUA-AOOH.js";import{T as TriangleAlert}from"./triangle-alert-utRoQCqS.js";import"./wordUtils-DpJ9VUHz.js";import"./packUtils-CMXIcoZ-.js";import"./VocabPackCard-CuhMJNYe.js";import"./eye-CCZo2who.js";const ArrowDownRight=createLucideIcon("ArrowDownRight",[["path",{d:"m7 7 10 10",key:"1fmybs"}],["path",{d:"M17 7v10H7",key:"6fjiku"}]]),ArrowUpRight=createLucideIcon("ArrowUpRight",[["path",{d:"M7 7h10v10",key:"1tivn9"}],["path",{d:"M7 17 17 7",key:"1vkiza"}]]),MissionItem=({icon:icon,text:text,isCompleted:isCompleted,action:action})=>{const{t:t}=useTranslation();return jsxRuntimeExports.jsxs("button",{onClick:action,disabled:isCompleted,className:"w-full group flex items-center gap-4 p-4 rounded-xl transition-all duration-300 border "+(isCompleted?"bg-slate-50/50 dark:bg-slate-900/20 border-transparent opacity-60":"bg-white dark:bg-slate-800 border-slate-100 dark:border-slate-700 hover:border-teal-500/50 hover:shadow-md active:scale-[0.98]"),children:[jsxRuntimeExports.jsx("div",{className:"flex-shrink-0 w-10 h-10 rounded-full flex items-center justify-center transition-all duration-500 "+(isCompleted?"bg-green-100 dark:bg-green-900/30 text-green-500 scale-90":"bg-slate-50 dark:bg-slate-700 text-slate-500 group-hover:bg-teal-50 dark:group-hover:bg-teal-900/40 group-hover:text-teal-500"),children:isCompleted?jsxRuntimeExports.jsx(CircleCheckBig,{size:20}):icon}),jsxRuntimeExports.jsx("div",{className:"flex-grow text-left",children:jsxRuntimeExports.jsx("span",{className:"text-sm font-medium block leading-tight "+(isCompleted?"text-slate-400 dark:text-slate-500 italic line-through":"text-slate-700 dark:text-slate-200"),children:text})}),!isCompleted&&jsxRuntimeExports.jsxs("div",{className:"flex items-center gap-1 text-[10px] font-black uppercase tracking-widest text-teal-600 dar
1k:text-teal-400 bg-teal-50 dark:bg-teal-900/30 px-2 py-1 rounded-md opacity-0 group-hover:opacity-100 transition-opacity",children:[t("dashboard.widgets.dailyProgress.missions.go"),jsxRuntimeExports.jsx(ChevronRight,{size:12})]})]})},ReadingMissionItem=({currentMinutes:currentMinutes,goalMinutes:goalMinutes,action:action})=>{const{t:t}=useTranslation(),isCompleted=currentMinutes>=goalMinutes,progressPercent=goalMinutes>0?Math.min(currentMinutes/goalMinutes*100,100):0;return jsxRuntimeExports.jsxs("button",{onClick:action,disabled:isCompleted,className:"w-full group flex flex-col gap-3 p-4 rounded-xl transition-all duration-300 border "+(isCompleted?"bg-slate-50/50 dark:bg-slate-900/20 border-transparent opacity-60":"bg-white dark:bg-slate-800 border-slate-100 dark:border-slate-700 hover:border-teal-500/50 hover:shadow-md active:scale-[0.98]"),children:[jsxRuntimeExports.jsxs("div",{className:"flex items-center gap-4 w-full",children:[jsxRuntimeExports.jsx("div",{className:"flex-shrink-0 w-10 h-10 rounded-full flex items-center justify-center transition-all duration-500 "+(isCompleted?"bg-green-100 dark:bg-green-900/30 text-green-500 scale-90":"bg-slate-50 dark:bg-slate-700 text-slate-500 group-hover:bg-teal-50 dark:group-hover:bg-teal-900/40 group-hover:text-teal-500"),children:isCompleted?jsxRuntimeExports.jsx(CircleCheckBig,{size:20}):jsxRuntimeExports.jsx(BookOpen,{size:18})}),jsxRuntimeExports.jsxs("div",{className:"flex-grow text-left",children:[jsxRuntimeExports.jsx("span",{className:"text-sm font-medium block leading-tight "+(isCompleted?"text-slate-400 dark:text-slate-500 italic line-through":"text-slate-700 dark:text-slate-200"),children:t("dashboard.widgets.dailyProgress.missions.read",{minutes:goalMinutes})}),jsxRuntimeExports.jsxs("p",{className:"text-[10px] font-mono mt-0.5 "+(isCompleted?"text-green-500":"text-slate-400"),children:[currentMinutes," / ",goalMinutes," min"]})]}),!isCompleted&&jsxRuntimeExports.jsx("div",{className:"flex items-center gap-1 text-[10px] font-black uppercase tracking-widest text-teal-600 dark:text-teal-400 bg-teal-50 dark:bg-teal-900/30 px-2 py-1 rounded-md opacity-0 group-hover:opacity-100 transition-opacity",children:jsxRuntimeExports.jsx(ChevronRight,{size:12})})]}),!isCompleted&&jsxRuntimeExports.jsx("div",{className:"w-full bg-slate-100 dark:bg-slate-700 rounded-full h-1.5 overflow-hidden",children:jsxRuntimeExports.jsx("div",{className:"h-full bg-gradient-to-r from-teal-400 to-cyan-500 rounded-full transition-all duration-1000 ease-out",style:{width:`${progressPercent}%`}})})]})},StreakMilestone=({days:days,icon:icon,isCompleted:isCompleted})=>jsxRuntimeExports.jsxs("div",{className:"flex flex-col items-center gap-1.5 group relative",children:[jsxRuntimeExports.jsx("div",{className:"w-10 h-10 rounded-2xl flex items-center justify-center transition-all duration-500 "+(isCompleted?"bg-orange-500 text-white shadow-lg shadow-orange-500/20 rotate-3":"bg-slate-50 dark:bg-slate-800 text-slate-400 border border-slate-100 dark:border-slate-700 group-hover:border-slate-300"),children:jsxRuntimeExports.jsx("span",{className:"text-base transition-transform group-hover:scale-125 "+(isCompleted?"animate-bounce-slow":"grayscale opacity-50"),children:icon})}),jsxRuntimeExports.jsxs("span",{className:"text-[10px] font-black tracking-tighter sm:tracking-normal "+(isCompleted?"text-orange-500 uppercase":"text-slate-400"),children:[days,"D"]})]});function DailyProgressWidget({dueWordsCount:dueWordsCount=0,embedded:embedded=!1}){const{userProfile:userProfile,isGuest:isGuest,claimDailyGoal:claimDailyGoal}=useAuth(),navigate=useNavigate(),{t:t}=useTranslation();if(!userProfile?.dailyGoal)return jsxRuntimeExports.jsxs("div",{className:"bg-white dark:bg-slate-800 p-8 rounded-3xl shadow-xl text-center flex flex-col items-center justify-center min-h-[300px]",children:[jsxRuntimeExports.jsx(Clock,{className:"w-12 h-12 text-slate-200 animate-pulse mb-4"}),jsxRuntimeExports.jsx("p",{className:"text-slate-400 font-medium",children:t("dashboard.widgets.dailyProgress.loading")})]});const{xpCurrent:xpCurrent,xpTarget:xpTarget,lastReset:lastReset,rewardClaimed:rewardClaimed}=userProfile.dailyGoal,{current:streak}=getEffectiveStreak(userProfile.streak),activityToday=isFirestoreTimestampBeforeToday(lastReset)?{practiceSessionsCompleted:0,newWordsMarked:0,sentencesPracticed:0}:userProfile.dailyActivity||{practiceSessionsCompleted:0,newWordsMarked:0,sentencesPracticed:0},displayXpCurrent=isFirestoreTimestampBeforeToday(lastReset)?0:xpCurrent,progress=Math.min(displayXpCurrent/xpTarget*100,100),isGoalCompleted=progress>=100,isRewardClaimed=!isFirestoreTimestampBeforeToday(lastReset)&&rewardClaimed,basePath=isGuest?"/demo":"/home",streakInfo=(currentStreak=streak)>=30?{title:"¡Imparable!",color:"from-red-500 to-rose-600",text:"Estableciendo récords"}:currentStreak>=7?{title:"¡En racha!",color:"from-orange-500 to-amber-600",text:"Mantén el ritmo"}:{title:"Tu racha",color:"from-teal-500 to-emerald-600",text:"Día a día"};var currentStreak;const missions=[{icon:jsxRuntimeExports.jsx(Zap,{size:18}),text:t("dashboard.widgets.dailyProgress.missions.review"),isCompleted:(activityToday.practiceSessionsCompleted||0)>=1,action:()=>navigate(`${basePath}/practica`)},{icon:jsxRuntimeExports.jsx(CirclePlus,{size:18}),text:t("dashboard.widgets.dailyProgress.missions.learn"),isCompleted:(activityToday.newWordsMarked||0)>=5,action:()=>navigate(`${basePath}/biblioteca`)},{icon:jsxRuntimeExports.jsx(MessageSquareText,{size:18}),text:t("dashboard.widgets.dailyProgress.missions.practice"),isCompleted:(activityToday.sentencesPracticed||
10)>=5,action:()=>navigate(`${basePath}/practica`)}],readingGoal=userProfile.readingGoal||{value:15},dailyProgress=userProfile.dailyProgress||{date:"",readingTime:0},todayStr=(new Date).toISOString().split("T")[0],currentReadingMinutes=(dailyProgress.date?.seconds?new Date(1e3*dailyProgress.date.seconds).toISOString().split("T")[0]===todayStr:dailyProgress.date===todayStr)&&dailyProgress.readingTime||0,readingGoalMinutes=readingGoal.value||0,hasReadingGoal=readingGoalMinutes>0,reviewDone=(activityToday.practiceSessionsCompleted||0)>=1,reviewProgress=reviewDone?100:0,readingProgressPercent=readingGoalMinutes>0?Math.min(currentReadingMinutes/readingGoalMinutes*100,100):0;return jsxRuntimeExports.jsxs("div",{id:"dashboard-progress-widget",className:"bg-white dark:bg-slate-900 flex flex-col border border-slate-200 dark:border-slate-800 animate-fade-in "+(embedded?"rounded-2xl shadow-lg p-5 ring-1 ring-slate-100 dark:ring-slate-800":"rounded-[2.5rem] shadow-2xl shadow-slate-200/50 dark:shadow-black/20 p-6 sm:p-8 h-full ring-1 ring-slate-100 dark:ring-slate-800"),children:[jsxRuntimeExports.jsxs("div",{className:"mb-6 p-4 rounded-2xl bg-gradient-to-br from-teal-50 via-white to-amber-50 dark:from-slate-800 dark:via-slate-900 dark:to-slate-800 border border-teal-100 dark:border-slate-700",children:[jsxRuntimeExports.jsx("p",{className:"text-xs font-bold uppercase tracking-wider text-teal-600 dark:text-teal-400 mb-3",children:t("dashboard.widgets.dailyProgress.unified.title")}),jsxRuntimeExports.jsxs("div",{className:"space-y-3",children:[jsxRuntimeExports.jsxs("div",{children:[jsxRuntimeExports.jsxs("div",{className:"flex justify-between text-sm mb-1",children:[jsxRuntimeExports.jsx("span",{className:"font-medium text-slate-700 dark:text-slate-200",children:t("dashboard.widgets.dailyProgress.unified.read",{minutes:readingGoalMinutes})}),jsxRuntimeExports.jsxs("span",{className:"text-slate-500",children:[currentReadingMinutes,"/",readingGoalMinutes," min"]})]}),jsxRuntimeExports.jsx("div",{className:"h-2 bg-slate-200 dark:bg-slate-700 rounded-full overflow-hidden",children:jsxRuntimeExports.jsx("div",{className:"h-full bg-teal-500 rounded-full transition-all",style:{width:`${readingProgressPercent}%`}})})]}),jsxRuntimeExports.jsxs("div",{children:[jsxRuntimeExports.jsxs("div",{className:"flex justify-between text-sm mb-1",children:[jsxRuntimeExports.jsx("span",{className:"font-medium text-slate-700 dark:text-slate-200",children:dueWordsCount>0?t("dashboard.widgets.dailyProgress.unified.reviewDue",{count:dueWordsCount}):t("dashboard.widgets.dailyProgress.unified.review")}),jsxRuntimeExports.jsx("span",{className:"text-slate-500",children:reviewDone?"✓":"—"})]}),jsxRuntimeExports.jsx("div",{className:"h-2 bg-slate-200 dark:bg-slate-700 rounded-full overflow-hidden",children:jsxRuntimeExports.jsx("div",{className:"h-full bg-amber-500 rounded-full transition-all",style:{width:`${reviewProgress}%`}})})]})]})]}),jsxRuntimeExports.jsxs("div",{className:"relative bg-gradient-to-br from-slate-50 to-slate-100 dark:from-slate-800/50 dark:to-slate-900 border border-white dark:border-slate-700/50 overflow-hidden group "+(embedded?"mb-6 p-5 rounded-2xl":"mb-8 p-6 rounded-[2rem]"),children:[jsxRuntimeExports.jsx("div",{className:`absolute top-[-20px] right-[-20px] w-32 h-32 bg-gradient-to-br ${streakInfo.color} opacity-5 blur-3xl group-hover:opacity-10 transition-opacity`}),jsxRuntimeExports.jsxs("div",{className:"relative z-10 flex flex-col items-center text-center",children:[jsxRuntimeExports.jsxs("div",{className:"relative p-4 rounded-3xl bg-white dark:bg-slate-800 shadow-xl border border-slate-50 dark:border-slate-700 mb-3 transform transition-transform group-hover:scale-110 group-hover:rotate-3 duration-500",children:[jsxRuntimeExports.jsx(Flame,{className:"w-10 h-10 "+(streak>0?"text-orange-500 drop-shadow-lg":"text-slate-300")}),userProfile.consumables?.powerup_streakfreeze>0&&jsxRuntimeExports.jsx("div",{className:"absolute -top-2 -right-2 w-7 h-7 bg-blue-500 text-white rounded-full flex items-center justify-center shadow-lg border-2 border-white dark:border-slate-800 animate-pulse",title:"Protección de Racha Activa",children:jsxRuntimeExports.jsx(Shield,{size:14,fill:"currentColor"})}),userProfile.isDoubleXpActive&&jsxRuntimeExports.jsxs("div",{className:"absolute -bottom-2 -left-2 w-8 h-8 bg-yellow-400 text-white rounded-lg flex flex-col items-center justify-center shadow-lg border-2 border-white dark:border-slate-800 rotate-[-12deg]",title:"¡Puntos Dobles Activos!",children:[jsxRuntimeExports.jsx(Zap,{size:10,fill:"currentColor"}),jsxRuntimeExports.jsx("span",{className:"text-[10px] font-black leading-none",children:"x2"})]})]}),jsxRuntimeExports.jsxs("h2",{className:"font-black text-slate-900 dark:text-white tracking-tight leading-none mb-1 "+(embedded?"text-3xl":"text-4xl"),children:[streak," ",jsxRuntimeExports.jsx("span",{className:"text-base font-bold text-slate-400 tracking-normal capitalize",children:t("dashboard.widgets.dailyProgress.streak.day",{count:streak}).split(" ")[1]})]}),jsxRuntimeExports.jsx("p",{className:`text-xs font-black uppercase tracking-widest bg-clip-text text-transparent bg-gradient-to-r ${streakInfo.color}`,children:streakInfo.title}),jsxRuntimeExports.jsxs("button",{onClick:()=>navigate(`${basePath}/estadisticas`),className:"mt-4 px-4 py-1.5 bg-white/50 dark:bg-black/20 hover:bg-white dark:hover:bg-black/30 text-[10px] font-bold text-slate-500 dark:text-slate-400 rounded-full transition-all border border-slate-200 dark:border-slate-700 flex items-center gap-2",children:[jsxRuntimeExports.jsx(Calendar,{size:12})," ",t("dashboard.widgets.dailyProgress.streak.viewCalendar")||"Cronología"]})]})]}
1),jsxRuntimeExports.jsxs("div",{className:"flex-grow space-y-6",children:[jsxRuntimeExports.jsx("div",{className:"px-2",children:jsxRuntimeExports.jsxs("div",{className:"flex justify-between items-center relative gap-2",children:[jsxRuntimeExports.jsx("div",{className:"absolute top-[20px] left-0 right-0 h-0.5 bg-slate-100 dark:bg-slate-800"}),[{days:3,icon:"🔥"},{days:7,icon:"🔥"},{days:15,icon:"⚡"},{days:30,icon:"🏆"}].map((milestone,index)=>jsxRuntimeExports.jsx(StreakMilestone,{days:milestone.days,icon:milestone.icon,isCompleted:streak>=milestone.days},index))]})}),jsxRuntimeExports.jsxs("div",{className:"space-y-4 pt-4 border-t border-slate-50 dark:border-slate-800",children:[jsxRuntimeExports.jsxs("div",{className:"flex justify-between items-end px-1",children:[jsxRuntimeExports.jsxs("div",{children:[jsxRuntimeExports.jsx("h4",{className:"text-sm font-black text-slate-800 dark:text-slate-100 uppercase tracking-wider",children:t("dashboard.widgets.dailyProgress.goal.title")}),jsxRuntimeExports.jsx("p",{className:"text-[10px] text-slate-400 font-bold uppercase",children:isGoalCompleted?"¡Meta alcanzada!":"En curso"})]}),jsxRuntimeExports.jsxs("p",{className:"text-lg font-black text-slate-900 dark:text-white tabular-nums",children:[displayXpCurrent," ",jsxRuntimeExports.jsxs("span",{className:"text-xs text-slate-400 font-bold",children:["/ ",xpTarget," XP"]})]})]}),jsxRuntimeExports.jsx("div",{className:"h-4 bg-slate-100 dark:bg-slate-800 rounded-full p-1 relative box-content shadow-inner",children:jsxRuntimeExports.jsxs("div",{className:"h-full rounded-full transition-all duration-1000 ease-out relative group/bar "+(isGoalCompleted?"bg-gradient-to-r from-teal-400 to-emerald-500 shadow-[0_0_15px_rgba(20,184,166,0.3)]":"bg-gradient-to-r from-orange-400 to-rose-500"),style:{width:`${progress}%`},children:[jsxRuntimeExports.jsx("div",{className:"absolute inset-0 bg-white/20 origin-left scale-x-0 group-hover/bar:scale-x-100 transition-transform duration-700"}),isGoalCompleted&&jsxRuntimeExports.jsx(Sparkles,{className:"absolute -right-2 -top-2 text-yellow-400 transition-all duration-500 group-hover/bar:scale-125",size:16})]})})]}),jsxRuntimeExports.jsxs("div",{className:"pt-2",children:[jsxRuntimeExports.jsx("h5",{className:"text-[10px] font-black text-slate-400 uppercase tracking-[0.2em] mb-4 text-center",children:t("dashboard.widgets.dailyProgress.missions.title")}),jsxRuntimeExports.jsxs("div",{className:"space-y-3",children:[missions.map((mission,index)=>jsxRuntimeExports.jsx(MissionItem,{...mission},index)),hasReadingGoal&&jsxRuntimeExports.jsx(ReadingMissionItem,{currentMinutes:currentReadingMinutes,goalMinutes:readingGoalMinutes,action:()=>navigate(`${basePath}/biblioteca`)})]})]})]}),jsxRuntimeExports.jsx("div",{className:"mt-8 pt-6 border-t border-slate-50 dark:border-slate-800",children:jsxRuntimeExports.jsxs("div",{className:"p-4 rounded-3xl transition-all duration-500 "+(isGoalCompleted&&!isRewardClaimed?"bg-gradient-to-br from-sky-50 to-indigo-50 dark:from-sky-900/20 dark:to-indigo-900/20 ring-2 ring-sky-500/20":"bg-slate-50/50 dark:bg-slate-800/30"),children:[jsxRuntimeExports.jsxs("div",{className:"flex items-center gap-4 mb-4",children:[jsxRuntimeExports.jsx("div",{className:"w-12 h-12 rounded-2xl flex items-center justify-center transition-all duration-500 "+(isGoalCompleted&&!isRewardClaimed?"bg-sky-500 text-white shadow-xl shadow-sky-500/30 rotate-6 scale-110":"bg-slate-200 dark:bg-slate-700 text-slate-400 opacity-50"),children:jsxRuntimeExports.jsx(Trophy,{size:24})}),jsxRuntimeExports.jsxs("div",{children:[jsxRuntimeExports.jsx("h4",{className:"text-sm font-black text-slate-800 dark:text-slate-100",children:t("dashboard.widgets.dailyProgress.reward.title")}),jsxRuntimeExports.jsxs("div",{className:"flex items-center gap-2 mt-0.5",children:[jsxRuntimeExports.jsxs("span",{className:"flex items-center gap-1 text-[10px] font-black text-sky-600 dark:text-sky-400 bg-sky-100 dark:bg-sky-900/50 px-2 py-0.5 rounded-full uppercase",children:["+",XP_PER_DAILY_GOAL," XP"]}),jsxRuntimeExports.jsxs("span",{className:"flex items-center gap-1 text-[10px] font-black text-amber-600 dar
1k:text-amber-400 bg-amber-100 dark:bg-amber-900/50 px-2 py-0.5 rounded-full uppercase",children:["+",GEMS_PER_DAILY_GOAL," Gemas"]})]})]})]}),jsxRuntimeExports.jsx("button",{onClick:async()=>{await claimDailyGoal()},disabled:!isGoalCompleted||isRewardClaimed,className:"w-full py-4 rounded-2xl text-xs font-black tracking-widest uppercase transition-all duration-300 transform active:scale-95 "+(isRewardClaimed?"bg-slate-100 dark:bg-slate-800 text-slate-400 cursor-not-allowed opacity-50":isGoalCompleted?"bg-slate-900 dark:bg-white text-white dark:text-slate-900 shadow-xl shadow-slate-900/20 hover:shadow-sky-500/30":"bg-slate-100 dark:bg-slate-800 text-slate-400 cursor-not-allowed border border-transparent hover:border-slate-200"),children:isRewardClaimed?t("dashboard.widgets.dailyProgress.reward.claimed"):isGoalCompleted?t("dashboard.widgets.dailyProgress.reward.claim"):t("dashboard.widgets.dailyProgress.reward.instruction",{target:xpTarget})})]})})]})}function GetExtensionWidget({onDismiss:onDismiss}){return jsxRuntimeExports.jsxs("div",{className:"relative group w-full",children:[jsxRuntimeExports.jsxs("a",{href:"https://chromewebstore.google.com/detail/lbeopbhhcjfanecfcpcibjekgclhlogm?authuser=0&hl=es-419",target:"_blank",rel:"noopener noreferrer",className:"block w-full text-left p-6 bg-gradient-to-r from-violet-600 to-purple-700 hover:from-violet-700 hover:to-purple-800 text-white rounded-2xl shadow-lg transition-transform hover:scale-[1.01] flex items-center relative overflow-hidden",children:[jsxRuntimeExports.jsx("div",{className:"absolute -right-10 -top-10 w-40 h-40 bg-white/5 rounded-full blur-3xl pointer-events-none"}),jsxRuntimeExports.jsx(Chrome,{size:40,className:"mr-5 flex-shrink-0 text-purple-100"}),jsxRuntimeExports.jsxs("div",{className:"pr-10 relative z-10",children:[jsxRuntimeExports.jsx("h4",{className:"text-xl sm:text-2xl font-bold text-white",children:"Instala la Extensión"}),jsxRuntimeExports.jsx("p",{className:"opacity-90 mt-1 text-sm sm:text-base text-purple-50",children:"Captura palabras de cualquier web y llévatelas a tu biblioteca."})]}),jsxRuntimeExports.jsx(ArrowRight,{size:28,className:"ml-auto flex-shrink-0 text-white/80 group-hover:text-white transition-colors"})]}),jsxRuntimeExports.jsx("button",{onClick:e=>{e.preventDefault(),e.stopPropagation(),onDismiss()},className:"absolute top-3 right-3 p-1.5 text-white/40 hover:text-white hover:bg-white/10 rounded-full transition-all z-20",title:"Ya la tengo / No por ahora",children:jsxRuntimeExports.jsx(X,{size:16})})]})}const GuidedTour=({steps:steps,onFinish:onFinish})=>{const[currentStepIndex,setCurrentStepIndex]=reactExports.useState(0),[style,setStyle]=reactExports.useState({}),[highlightStyle,setHighlightStyle]=reactExports.useState({}),{theme:theme}=useTheme(),step=steps[currentStepIndex];reactExports.useEffect(()=>{const targetElement=document.querySelector(step.target);if(targetElement){targetElement.scrollIntoView({behavior:"smooth",block:"center",inline:"center"});const handleResize=()=>{const targetRect=targetElement.getBoundingClientRect(),spaceBelow=window.innerHeight-targetRect.bottom;let top,left;setHighlightStyle({width:`${targetRect.width+12}px`,height:`${targetRect.height+12}px`,top:targetRect.top-6+"px",left:targetRect.left-6+"px"}),top=spaceBelow>170?targetRect.bottom+15:targetRect.top-15,left=targetRect.left+targetRect.width/2,left-150<10&&(left=160),left+150>window.innerWidth-10&&(left=window.innerWidth-150-10),setStyle({top:`${top}px`,left:`${left}px`,transform:"translateX(-50%) "+(spaceBelow>170?"":"translateY(-100%)")})},scrollTimeout=setTimeout(handleResize,300);return window.addEventListener("resize",handleResize),()=>{clearTimeout(scrollTimeout),window.removeEventListener("resize",handleResize)}}},[currentStepIndex,step.target]);const handleSkip=()=>{onFinish()};return jsxRuntimeExports.jsxs("div",{className:"fixed inset-0 z-50 transition-opacity duration-300",children:[jsxRuntimeExports.jsx("div",{className:"fixed inset-0 bg-black/50 animate-fade-in-fast",onClick:handleSkip}),jsxRuntimeExports.jsx("div",{className:"fixed bg-transparent roun
1ded-lg transition-all duration-300 ease-in-out pointer-events-none",style:{...highlightStyle,boxShadow:"0 0 0 9999px rgba(0,0,0,0.5)"}}),jsxRuntimeExports.jsxs("div",{style:style,className:"fixed p-5 rounded-lg shadow-2xl max-w-xs w-[300px] transition-all duration-300 animate-fade-in-fast "+("dark"===theme?"bg-slate-800":"bg-white"),children:[jsxRuntimeExports.jsxs("div",{className:"flex items-start gap-3 mb-4",children:[jsxRuntimeExports.jsx(Lightbulb,{className:"text-yellow-400 mt-1 flex-shrink-0",size:24}),jsxRuntimeExports.jsx("p",{className:"text-sm text-gray-800 dark:text-gray-200",children:step.content})]}),jsxRuntimeExports.jsxs("div",{className:"flex justify-between items-center mt-4",children:[jsxRuntimeExports.jsxs("span",{className:"text-xs font-bold text-gray-500",children:[currentStepIndex+1," / ",steps.length]}),jsxRuntimeExports.jsxs("div",{className:"flex gap-2",children:[jsxRuntimeExports.jsx("button",{onClick:handleSkip,className:"text-xs font-semibold text-gray-500 hover:underline",children:"Omitir"}),jsxRuntimeExports.jsx("button",{onClick:()=>{currentStepIndex<steps.length-1?setCurrentStepIndex(currentStepIndex+1):onFinish()},className:"bg-teal-500 hover:bg-teal-600 text-white text-sm font-semibold py-1.5 px-4 rounded-md",children:currentStepIndex<steps.length-1?"Siguiente":"¡Entendido!"})]})]})]})]})};function MomentOfTheDayBanner({isGuest:isGuest,item:item}){const navigate=useNavigate(),{t:t}=useTranslation(),basePath=isGuest?"/demo":"/home",finalItem=item||{id:"scWj1BMRHUA",type:"video",title:"10 Phrasal Verbs You Use Every Day",author:"English with Lucy",duration:"8 min",thumbnail:"https://images.unsplash.com/photo-1546410531-bb4caa6b424d?auto=format&fit=crop&q=80&w=1000",reward:"+25 XP"},{pathname:pathname}=useLocation();return jsxRuntimeExports.jsxs("div",{onClick:()=>{const pathSegments=pathname.split("/").filter(Boolean),langPrefix=2===pathSegments[0]?.length?`/${pathSegments[0]}`:"";"video"===finalItem.type?navigate(`${langPrefix}/watch/${finalItem.id}`,{state:{title:finalItem.title,from:`${pathname}${window.location.search||""}`}}):"book"===finalItem.type?navigate(`${langPrefix}${basePath}/explorar/libro/${finalItem.id}`):navigate(`${langPrefix}${basePath}/read/${finalItem.id}`)},className:"group relative w-full h-64 sm:h-80 rounded-3xl overflow-hidden shadow-2xl cursor-pointer transition-all duration-500 hover:scale-[1.01]",children:[jsxRuntimeExports.jsxs("div",{className:"absolute inset-0 grayscale-[20%] group-hover:grayscale-0 transition-all duration-700",children:[jsxRuntimeExports.jsx("img",{src:finalItem.thumbnail,alt:finalItem.title,className:"w-full h-full object-cover transform scale-110 group-hover:scale-100 transition-transform duration-1000"}),jsxRuntimeExports.jsx("div",{className:"absolute inset-0 bg-gradient-to-t from-black via-black/40 to-transparent opacity-80 group-hover:opacity-70 transition-opacity"}),jsxRuntimeExports.jsx("div",{className:"absolute inset-0 bg-black/30 group-hover:bg-transparent transition-colors duration-500"})]}),jsxRuntimeExports.jsxs("div",{className:"absolute inset-0 p-6 sm:p-10 flex flex-col justify-end",children:[jsxRuntimeExports.jsxs("div",{className:"absolute top-6 left-6 flex flex-wrap items-center gap-2 sm:gap-4",children:[jsxRuntimeExports.jsxs("span",{className:"bg-amber-500/90 text-black text-[10px] sm:text-xs font-black px-2 sm:px-3 py-1 rounded-full flex items-center gap-1 shadow-lg border border-amber-400",children:[jsxRuntimeExports.jsx(Sparkles,{size:12})," ",t("dashboard.momentOfTheDay.badge","MOMENTO DEL DÍA")]}),jsxRuntimeExports.jsxs("span",{className:"bg-white/10 backdrop-blur-md text-white/90 text-[10px] sm:text-xs font-bold px-2 sm:px-3 py-1 rounded-full border border-white/20 flex items-center gap-1.5 shadow-sm",children:[jsxRuntimeExports.jsx(Clock,{size:12})," ",finalItem.duration]}),jsxRuntimeExports.jsx("span",{className:"bg-teal-500/90 text-white text-[10px] sm:text-xs font-black px-2 sm:px-3 py-1 rounded-full shadow-lg border border-teal-400",children:finalItem.reward||"+25 XP"})]}),jsxRuntimeExports.jsxs("div",{className:"space-y-3 max-w-2xl transform translate-y-2 group-hover:translate-y-0 transition-transform duration-500",children:[jsxRuntimeExports.jsxs("div",{className:"flex items-center gap-3 text-white/80 text-sm font-medium",children:["video"===finalItem.type?jsxRuntimeExports.jsx(Play,{size:24}):"book"===finalItem.type?jsxRuntimeExports.jsx(Book,{size:24}):jsxRuntimeExports.jsx(Newspaper,{size:24}),jsxRuntimeExports.jsx("span",{className:"uppercase tracking-widest text-[10px] sm:text-xs",children:"video"===finalItem.type?t("dashboard.momentOfTheDay.video","VÍDEO RECOMENDADO"):"book"===finalItem.type?t("dashboard.momentOfTheDay.book","LIBRO RECOMENDADO"):t("dashboard.momentOfTheDay.article","ARTÍCULO RECOMENDADO")})]}),jsxRuntimeExports.jsx("h2",{className:"text-2xl sm:text-4xl lg:text-5xl font-black text-white leading-tight drop-shadow-xl",children:finalItem.title}),jsxRuntimeExports.jsx("p",{className:"text-white/70 text-sm sm:text-base font-medium line-clamp-1 max-w-[90%]",children:finalItem.author?`Mejora tu vocabulario con contenido de ${finalItem.author}.`:"Practica hoy y saca el máximo partido a tu tiempo."}),jsxRuntimeExports.jsx("div",{className:"pt-2 flex items-center gap-6 opacity-0 group-hover:opacity-100 transition-opacity duration-500 delay-100",children:jsxRuntimeExports.jsxs("div",{className:"bg-white text-black font-black py-2 px-6 rounded-full flex items-center gap-3 shadow-2xl hover:bg-teal-400 hover:text-white transition-all transform hover:scale-105 text-sm uppercase",children:[t("common.start","Empezar")," ",jsxRuntimeExports.jsx(ArrowRight,{size:18})]})})]})]}),jsxRuntimeExports.jsx("div",{className:"absolute -bottom-10 -right-10 w-40 h-40 bg-teal-500/20 rounded-full blur-3xl group-hover:bg-teal-500/40 transition-colors"})]})}const FALLBACK_THUMB="https://images.unsplash.com/photo-1544947950-fa07a98d237f?auto=format&fit=crop&q=80&w=800";function carouselBooksCacheKey(lang,isGuest){return`carouselBooks:v4:${lang||"en"}:${isGuest?"guest":"user"}`}async function fetchExploreCatalogBooks({lang:lang="en",isGuest:isGuest=!1,take:take=5}={}){const cacheKey=carouselBooksCacheKey(lang,isGuest),cached=getExploreCache(cacheKey);if(cached&&!cached.stale&&Array.isArray(cached.data))return cached.data.slice(0,take);const books=(await fetchPublicCatalogBooks({section:"newest",limit:Math.max(take,8),language:lang||"en"})).filter(book=>
1"video"!==book.type).map(book=>({id:book.id,title:book.title,author:book.author||null,estimatedCEFR:book.estimatedCEFR||null,type:"book",thumbnail:book.thumbnailURL||book.coverURL||FALLBACK_THUMB,isPremium:!0===book.isPremium,comprehensionSample:book.comprehensionSample||null,totalUniqueWords:book.totalUniqueWords||null})).slice(0,take);return setExploreCache(cacheKey,books),books}const getRecommendedMedia=httpsCallable(functions,"getRecommendedMedia"),TYPE_I18N={video:"dashboard.inProgress.types.video",book:"dashboard.inProgress.types.book",article:"dashboard.inProgress.types.article"},YT_THUMB=id=>id?`https://i.ytimg.com/vi/${id}/hqdefault.jpg`:null,BOOK_FALLBACK_THUMB="https://images.unsplash.com/photo-1544947950-fa07a98d237f?auto=format&fit=crop&q=80&w=800";function resolveCarouselThumb(item){return item?.thumbnail?item.thumbnail:"video"===item?.type?YT_THUMB(item.id):BOOK_FALLBACK_THUMB}const ExploreCarouselSkeleton=({title:title,count:count=6})=>jsxRuntimeExports.jsxs("div",{className:"space-y-4","aria-busy":"true",children:[jsxRuntimeExports.jsx("div",{className:"flex items-center justify-between px-2",children:jsxRuntimeExports.jsxs("h3",{className:"text-xl sm:text-2xl font-black text-gray-800 dark:text-gray-100 flex items-center gap-2",children:[jsxRuntimeExports.jsx(Sparkles,{className:"text-amber-500"})," ",title]})}),jsxRuntimeExports.jsx("div",{className:"flex gap-4 overflow-hidden pb-2 px-2 w-full",children:Array.from({length:count},(_,i)=>jsxRuntimeExports.jsxs("div",{className:"snap-start flex-shrink-0 w-72 sm:w-80 rounded-xl overflow-hidden bg-white dark:bg-slate-800 border border-slate-200 dark:border-slate-700",children:[jsxRuntimeExports.jsx("div",{className:"h-36 sm:h-40 w-full carousel-skeleton-shimmer"}),jsxRuntimeExports.jsxs("div",{className:"p-3 space-y-2",children:[jsxRuntimeExports.jsx("div",{className:"h-3 w-4/5 rounded carousel-skeleton-shimmer"}),jsxRuntimeExports.jsx("div",{className:"h-3 w-3/5 rounded carousel-skeleton-shimmer"})]})]},i))})]}),CarouselCard=({item:item,basePath:basePath})=>{const{t:t}=useTranslation(),navigate=useNavigate(),{pathname:pathname}=useLocation(),[thumbSrc,setThumbSrc]=reactExports.useState(()=>resolveCarouselThumb(item));reactExports.useEffect(()=>{setThumbSrc(resolveCarouselThumb(item))},[item.id,item.thumbnail,item.type]);const typeKey=TYPE_I18N[item.type]||TYPE_I18N.article,title=decodeHtmlEntities(item.title||""),comprehensionPct=item.comprehensionStats?.comprehensionPercentage,showComprehension="book"===item.type&&"number"==typeof comprehensionPct;return jsxRuntimeExports.jsxs("button",{type:"button",onClick:()=>{const pathSegments=pathname.split("/").filter(Boolean),langPrefix=2===pathSegments[0]?.length?`/${pathSegments[0]}`:"";if("video"===item.type)navigate(`${langPrefix}/watch/${item.id}`,{state:{title:title,from:`${pathname}${window.location.search||""}`}});else if("book"===item.type){const bookId=item.catalogId||item.id;navigate(`${langPrefix}${basePath}/explorar/libro/${bookId}`)}else navigate(`${langPrefix}${basePath}/read/${item.id}`)},className:"snap-start flex-shrink-0 w-72 sm:w-80 text-left rounded-xl overflow-hidden bg-white dark:bg-slate-800 border border-slate-200 dark:border-slate-700 shadow-sm hover:shadow-md hover:border-teal-400 transition-all group flex flex-col",children:[jsxRuntimeExports.jsxs("div",{className:"relative -mb-px h-36 sm:h-40 shrink-0 overflow-hidden bg-slate-200 dark:bg-slate-700",children:[thumbSrc?jsxRuntimeExports.jsx("img",{src:thumbSrc,alt:"",className:"absolute inset-0 block h-full w-full object-cover object-center transition-transform duration-300 "+("book"===item.type?"scale-[1.12] group-hover:scale-[1.18]":"scale-[1.04] group-hover:scale-110"),loading:"eager",decoding:"async",referrerPolicy:"no-referrer",onError:()=>{const ytFallback="video"===item.type?YT_THUMB(item.id):null;ytFallback&&thumbSrc!==ytFallback?setThumbSrc(ytFallback):thumbSrc!==BOOK_FALLBACK_THUMB&&setThumbSrc(BOOK_FALLBACK_THUMB)}}):null,jsxRuntimeExports.jsx("span",{className:"absolute top-2 left-2 z-10 bg-black/60 text-white text-[10px] font-bold uppercase px-1.5 py-0.5 rounded",children:t(typeKey)}),item.isPremium&&"book"===item.type&&jsxRuntimeExports.jsx(PremiumContentBadge,{size:"sm",className:"top-2 right-2"}),"video"===item.type&&jsxRuntimeExports.jsx("div",{className:"absolute inset-0 z-10 flex items-center justify-center opacity-0 group-hover:opacity-100 transition-opacity",children:jsxRuntimeExports.jsx("div",{className:"bg-black/50 backdrop-blur-sm p-2.5 rounded-full border border-white/30",children:jsxRuntimeExports.jsx(Play,{size:22,className:"text-white",f
1ill:"currentColor"})})})]}),jsxRuntimeExports.jsxs("div",{className:"relative z-[1] p-3 bg-white dark:bg-slate-800",children:[jsxRuntimeExports.jsx("p",{className:"font-semibold text-sm text-gray-800 dark:text-gray-100 line-clamp-2 group-hover:text-teal-600 dark:group-hover:text-teal-400 leading-snug",children:title}),showComprehension&&jsxRuntimeExports.jsxs("span",{className:"mt-2 inline-flex items-center rounded-full bg-teal-50 dark:bg-teal-900/40 text-teal-700 dark:text-teal-300 text-[11px] font-bold px-2.5 py-0.5 ring-1 ring-teal-200/80 dark:ring-teal-700/60",children:[comprehensionPct,"% ",t("explore.media.comprehensible","comprensible")]})]})]})};function ExploreCarousel({title:title,items:items,isGuest:isGuest,activeLanguage:activeLanguage,prefetchedBooks:prefetchedBooks,skipCatalogFetch:skipCatalogFetch=!1}){const scrollRef=reactExports.useRef(null),navigate=useNavigate(),{t:t}=useTranslation(),{wordsMap:wordsMap}=useWords(),basePath=isGuest?"/demo":"/home",[catalogBooks,setCatalogBooks]=reactExports.useState([]),[realVideos,setRealVideos]=reactExports.useState([]),[isLoading,setIsLoading]=reactExports.useState(!0);reactExports.useEffect(()=>{if(skipCatalogFetch)return void setCatalogBooks(Array.isArray(prefetchedBooks)?prefetchedBooks:[]);let cancelled=!1;return(async()=>{try{const books=await fetchExploreCatalogBooks({lang:activeLanguage||"en",isGuest:isGuest,take:4});cancelled||setCatalogBooks(books)}catch{cancelled||setCatalogBooks([])}})(),()=>{cancelled=!0}},[activeLanguage,isGuest,skipCatalogFetch,prefetchedBooks]);const realBooks=reactExports.useMemo(()=>catalogBooks.map(book=>{let comprehensionStats=null;return isGuest||(Array.isArray(book.comprehensionSample)&&book.comprehensionSample.length>0?comprehensionStats=buildApproximateComprehensionStats(book.comprehensionSample,wordsMap,book.totalUniqueWords):book.uniqueWordsList?.length&&(comprehensionStats=buildComprehensionStats(book.uniqueWordsList,wordsMap,book.totalUniqueWords))),{id:book.id,title:book.title,type:book.type||"book",thumbnail:book.thumbnail||BOOK_FALLBACK_THUMB,isPremium:book.isPremium,comprehensionStats:comprehensionStats}}),[catalogBooks,isGuest,wordsMap]);reactExports.useEffect(()=>{let cancelled=!1;const normalizeVideos=list=>(Array.isArray(list)?list:[]).map(video=>({...video,type:"video",thumbnail:video.thumbnail||YT_THUMB(video.id)}));return(async()=>{const lang=activeLanguage||"en",cacheKey=`carouselVideos:v2:${lang}`,cached=getExploreCache(cacheKey);if(!cached||cached.stale){cached?.data&&(cancelled||setRealVideos(normalizeVideos(cached.data))),setIsLoading(!0);try{const response=await getRecommendedMedia({lang:lang,types:["video"],category:null});if(cancelled)return;const videos=normalizeVideos((response.data?.videos||[]).filter(video=>!((channel="")=>{const name=String(channel).toLowerCase().trim();return!name.includes("learning english")&&(name.includes("bbc news")||name.includes("bbc world")||"bbc"===name||"bbc news"===name)})(video.channelTitle||video.author||"")).slice(0,4).map(video=>({id:video.id,title:video.title,type:"video",thumbnail:video.thumbnail||YT_THUMB(video.id)})));setExploreCache(cacheKey,videos),setRealVideos(videos)}catch(err){console.error("Error loading explore carousel videos:",err),cancelled||setRealVideos([])}finally{cancelled||setIsLoading(!1)}}else cancelled||(setRealVideos(normalizeVideos(cached.data)),setIsLoading(!1))})(),()=>{cancelled=!0}},[activeLanguage]);const liveItems=[...realVideos,...realBooks],finalItems=items||liveItems,scroll=direction=>{if(scrollRef.current){const{scrollLeft:scrollLeft,clientWidth:clientWidth}=scrollRef.current,scrollTo="left"===direction?scrollLeft-.75*clientWidth:scrollLeft+.75*clientWidth;scrollRef.current.scrollTo({left:scrollTo,behavior:"smooth"})}},sectionTitle=title||t("dashboard.explore.carousel.title","Novedades para Explorar");return isLoading&&0===finalItems.length?jsxRuntimeExports.jsx(ExploreCarouselSkeleton,{title:sectionTitle,count:6}):jsxRuntimeExports.jsxs("div",{className:"space-y-4 group/carousel relative",children:[jsxRuntimeExports.jsxs("div",{className:"flex items-center justify-between px-2",children:[jsxRuntimeExports.jsxs("h3",{className:"text-xl sm:text-2xl font-black text-gray-800 dark:text-gray-100 flex items-center gap-2",children:[jsxRuntimeExports.jsx(Sparkles,{className:"text-amber-500"})," ",sectionTitle]}),jsxRuntimeExports.jsxs("div",{className:"flex gap-2",children:[jsxRuntimeExports.jsx("button",{onClick:()=>scroll("left"),className:"p-2 rounded-full border border-slate-200 dark:border-slate-700 hover:bg-white dark:hover:bg-slate-800 shadow-sm transition-colors text-slate-500 dark:text-slate-400",children:jsxRuntimeExports.jsx(ChevronLeft,{size:20})}),jsxRuntimeExports.jsx("button",{onClick:()=>scroll("right"),className:"p-2 rounded-full border border-slate-200 dark:border-slate-700 hover:bg-white dark:hover:bg-slate-800 shadow-sm transition-colors text-slate-500 dark:text-slate-400",children:jsxRuntimeExports.jsx(ChevronRight,{size:20})})]})]}),0===finalItems.length?jsxRuntimeExports.jsxs("div",{className:"rounded-2xl border border-dashed border-slate-300 dark:border-slate-600 bg-slate-50 dark:bg-slate-800/40 p-8 text-center",children:[jsxRuntimeExports.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-400 mb-3",children:"Aún no hay contenido disponible en Explorar para este idioma."}),jsxRuntimeExports.jsx("button",{type:"button",onClick:()=>navigate(`${basePath}/explorar`),className:"text-sm font-semibold text-teal-600 hover:underline",children:"Ir a Explorar →"})]}):jsxRuntimeExports.jsx("div",{ref:scrollRef,className:"flex gap-4 overflow-x-auto pb-2 px-2 no-scrollbar snap-x snap-mandatory",style:{scrollbarWidth:"none",msOverflowStyle:"none"},children:finalItems.map(item=>jsxRuntimeExports.jsx(CarouselCard,{item:item,basePath:basePath},`${item.type}-${item.id}`))}),jsxRuntimeExports.jsx("div",{className:"absolute left-0 bottom-4 top-14 w-10 bg-gradient-to-r from-slate-100 dar
1k:from-slate-900 to-transparent pointer-events-none opacity-0 group-hover/carousel:opacity-100 transition-opacity"}),jsxRuntimeExports.jsx("div",{className:"absolute right-0 bottom-4 top-14 w-10 bg-gradient-to-l from-slate-100 dark:from-slate-900 to-transparent pointer-events-none opacity-0 group-hover/carousel:opacity-100 transition-opacity"})]})}const NEWS_FALLBACK=[{id:"tech-ai-race",title:"The Tech Giants' Race for AI Supremacy Heats Up",source:"TechDaily",image:"https://images.unsplash.com/photo-1677442136019-21780ecad995?auto=format&fit=crop&q=80&w=800",readTime:"4 min"},{id:"climate-change",title:"Global Summit Reaches Historic Agreement on Climate Action",source:"World News",image:"https://images.unsplash.com/photo-1464822759023-fed622ff2c3b?auto=format&fit=crop&q=80&w=800",readTime:"6 min"},{id:"space-mission",title:"New Space Mission Aims to Map Distant Exoplanets",source:"Science Daily",image:"https://images.unsplash.com/photo-1446776811953-b23d57bd21aa?auto=format&fit=crop&q=80&w=800",readTime:"5 min"},{id:"city-transport",title:"Major Cities Expand Public Transport to Cut Emissions",source:"World News",image:"https://images.unsplash.com/photo-1474487548417-781cb71495f3?auto=format&fit=crop&q=80&w=800",readTime:"4 min"},{id:"health-sleep",title:"Researchers Link Daily Walks to Better Sleep Quality",source:"Health Watch",image:"https://images.unsplash.com/photo-1476480862126-209bfaa8edc8?auto=format&fit=crop&q=80&w=800",readTime:"5 min"},{id:"ocean-cleanup",title:"Ocean Cleanup Project Removes Record Amount of Plastic",source:"Planet Report",image:"https://images.unsplash.com/photo-1507525428034-b723cf961d3e?auto=format&fit=crop&q=80&w=800",readTime:"6 min"}];function NewsCard({article:article,onRead:onRead,labelText:labelText}){return jsxRuntimeExports.jsxs("button",{type:"button",onClick:()=>onRead(article),className:"snap-start flex-shrink-0 w-72 text-left rounded-xl overflow-hidden bg-white dark:bg-slate-800 border border-slate-200 dark:border-slate-700 shadow-sm hover:shadow-md hover:border-teal-400 transition-all group",children:[jsxRuntimeExports.jsxs("div",{className:"relative h-32",children:[jsxRuntimeExports.jsx(NewsImage,{article:article,className:"w-full h-full object-cover group-hover:scale-105 transition-transform duration-300"}),jsxRuntimeExports.jsx("span",{className:"absolute top-2 left-2 bg-black/60 text-white text-[10px] font-bold uppercase px-1.5 py-0.5 rounded",children:labelText})]}),jsxRuntimeExports.jsxs("div",{className:"p-3",children:[jsxRuntimeExports.jsx("p",{className:"font-semibold text-sm text-gray-800 dark:text-gray-100 line-clamp-2 group-hover:text-teal-600 dark:group-hover:text-teal-400",children:article.title}),jsxRuntimeExports.jsxs("div",{className:"mt-2 flex items-center gap-2 text-xs text-gray-500 dark:text-gray-400",children:[jsxRuntimeExports.jsx("span",{children:article.source}),jsxRuntimeExports.jsx("span",{children:"·"}),jsxRuntimeExports.jsxs("span",{className:"flex items-center gap-1",children:[jsxRuntimeExports.jsx(Clock,{size:12}),article.readTime]})]})]})]})}function HomeNewsRow({activeLanguage:activeLanguage="en",basePath:basePath="/home"}){const{t:t}=useTranslation(),navigate=useNavigate(),[articles,setArticles]=reactExports.useState([]),[isLoading,setIsLoading]=reactExports.useState(!0);if(reactExports.useEffect(()=>{if(!activeLanguage)return;let cancelled=!1;return(async()=>{const cacheKey=`homeNews:v2:${activeLanguage}`,cached=getExploreCache(cacheKey);if(!cached||cached.stale){cached?.data?cancelled||(setArticles(cached.data),setIsLoading(!1)):cancelled||setIsLoading(!0);try{const getMedia=httpsCallable(functions,"getRecommendedMedia"),result=await getMedia({lang:activeLanguage,types:["news"],category:"news"});if(cancelled)return;const fetched=result.data?.news||[],nextArticles=fetched.length>0?fetched.slice(0,6).map((item,index)=>withArticleImageFields({id:item.link||item.id||`news-${index}`,title:item.title,source:item.source||"News",image:item.thumbnail||item.image,readTime:"5 min",link:item.link,content:Array.isArray(item.content)&&item.content.length>0?item.content:void 0,contentSnippet:item.contentSnippet})):NEWS_FALLBACK;setExploreCache(cacheKey,nextArticles),cancelled||setArticles(nextArticles)}catch(error){console.error("[HomeNewsRow] Error cargando noticias:",error),cancelled||cached?.data||(setExploreCache(cacheKey,NEWS_FALLBACK),setArticles(NEWS_FALLBACK))}finally{cancelled||setIsLoading(!1)}}else cancelled||(setArticles(cached.data),setIsLoading(!1))})(),()=>{cancelled=!0}},[activeLanguage]),isLoading)return null;if(0===articles.length)return null;const handleRead=article=>{const routeId=getArticleRouteId(article);navigate(`${basePath}/read/${routeId}
1`,{state:{article:{...article,id:article.id||routeId}}})};return jsxRuntimeExports.jsxs("section",{className:"space-y-3",children:[jsxRuntimeExports.jsxs("div",{className:"flex items-center justify-between gap-4 px-1",children:[jsxRuntimeExports.jsxs("h2",{className:"text-xl md:text-2xl font-bold text-gray-800 dark:text-gray-100 flex items-center gap-2",children:[jsxRuntimeExports.jsx(Newspaper,{size:22,className:"text-teal-500"}),t("dashboard.contentFeed.news.title")]}),jsxRuntimeExports.jsxs("button",{type:"button",onClick:()=>navigate(`${basePath}/explorar/kiosco`),className:"text-sm font-semibold text-teal-600 dark:text-teal-400 hover:underline flex items-center gap-1 shrink-0",children:[t("dashboard.contentFeed.news.viewAll"),jsxRuntimeExports.jsx(ArrowRight,{size:14})]})]}),jsxRuntimeExports.jsx("div",{className:"flex gap-4 overflow-x-auto pb-2 scrollbar-hide snap-x snap-mandatory",children:articles.map(article=>jsxRuntimeExports.jsx(NewsCard,{article:article,onRead:handleRead,labelText:t("dashboard.inProgress.types.article")},article.id))})]})}function UnifiedContentFeed({isGuest:isGuest,userProfile:userProfile,basePath:basePath}){const{t:t}=useTranslation(),activeLanguage=userProfile?.activeLanguage||"en",[catalogBooks,setCatalogBooks]=reactExports.useState([]),[booksReady,setBooksReady]=reactExports.useState(!1);reactExports.useEffect(()=>{let cancelled=!1;const lang=activeLanguage,cacheKey=carouselBooksCacheKey(lang,isGuest),cached=getExploreCache(cacheKey);if(cached?.data?.length&&(setCatalogBooks(cached.data),setBooksReady(!0),!cached.stale))return;return(async()=>{try{const books=await fetchExploreCatalogBooks({lang:lang,isGuest:isGuest,take:5});cancelled||(setCatalogBooks(books),setBooksReady(!0))}catch(err){console.error("[UnifiedContentFeed] catalog books:",err),cancelled||setBooksReady(!0)}})(),()=>{cancelled=!0}},[activeLanguage,isGuest]);const{momentItem:momentItem,carouselBooks:carouselBooks}=reactExports.useMemo(()=>{const idx=function(length,date=new Date){if(!length)return-1;const start=new Date(date.getFullYear(),0,0);return Math.floor((date-start)/864e5)%length}(catalogBooks.length);if(idx<0)return{momentItem:null,carouselBooks:catalogBooks};const featured=catalogBooks[idx];return{momentItem:(book=featured,book?{id:book.id,type:"book",title:book.title,author:book.author||"Abantra",level:book.estimatedCEFR||"All",duration:"Lectura recomendada",thumbnail:book.thumbnail||book.thumbnailURL||book.coverURL||FALLBACK_THUMB,reward:"+50 XP"}:null),carouselBooks:catalogBooks.filter(b=>b.id!==featured.id).slice(0,4)};var book},[catalogBooks]);return jsxRuntimeExports.jsxs("div",{className:"space-y-8",children:[jsxRuntimeExports.jsxs("div",{children:[jsxRuntimeExports.jsx("h3",{className:"text-lg font-bold text-gray-800 dark:text-gray-100 mb-4",children:t("dashboard.contentFeed.title")}),booksReady&&jsxRuntimeExports.jsx(MomentOfTheDayBanner,{isGuest:isGuest,item:momentItem||void 0})]}),jsxRuntimeExports.jsx(ExploreCarousel,{isGuest:isGuest,activeLanguage:activeLanguage,prefetchedBooks:carouselBooks,skipCatalogFetch:!0}),jsxRuntimeExports.jsx("div",{className:"hidden lg:block",children:jsxRuntimeExports.jsx(RecommendedPacksSection,{activeLanguage:activeLanguage,basePath:basePath})}),jsxRuntimeExports.jsx(HomeNewsRow,{activeLanguage:activeLanguage,basePath:basePath})]})}const updateReadingGoalFunc=httpsCallable(functions,"updateReadingGoal"),dismissGoalSuggestionFunc=httpsCallable(functions,"dismissGoalSuggestion");function GoalSuggestionCard({suggestion:suggestion}){const{t:t}=useTranslation(),[isLoading,setIsLoading]=reactExports.useState(!1);if(!suggestion)return null;const isIncrease="increase"===suggestion.type,descKey=isIncrease?"increase.desc":"decrease.desc",title=t(`dashboard.goalSuggestion.${isIncrease?"increase.title":"decrease.title"}`),description=t(`dashboard.goalSuggestion.${descKey}`,{from:suggestion.from,to:suggestion.to}),icon=isIncrease?jsxRuntimeExports.jsx(ArrowUpRight,{size:24,className:"text-green-500"}):jsxRuntimeExports.jsx(ArrowDownRight,{size:24,className:"text-orange-500"});return jsxRuntimeExports.jsx("div",{className:"bg-white dark:bg-slate-800 p-6 rounded-2xl shadow-lg border border-slate-200 dark:border-slate-700 animate-fade-in-fast",children:jsxRuntimeExports.jsxs("div",{className:"flex flex-col sm:flex-row items-start gap-5",children:[jsxRuntimeExports.jsx("div",{className:"flex-shrink-0 w-12 h-12 rounded-full flex items-center justify-center bg-slate-100 dar
1k:bg-slate-700",children:icon}),jsxRuntimeExports.jsxs("div",{className:"flex-grow",children:[jsxRuntimeExports.jsx("h3",{className:"text-xl font-bold text-gray-800 dark:text-gray-100",children:title}),jsxRuntimeExports.jsx("p",{className:"mt-1 text-slate-600 dark:text-slate-300",children:description})]}),jsxRuntimeExports.jsxs("div",{className:"flex-shrink-0 flex items-center gap-3 w-full sm:w-auto pt-3 sm:pt-0",children:[jsxRuntimeExports.jsxs("button",{onClick:async()=>{setIsLoading(!0);try{await dismissGoalSuggestionFunc(),Vt.success(t("dashboard.goalSuggestion.toast.dismissed"))}catch(error){console.error("Error al descartar la sugerencia de meta:",error),Vt.error(t("dashboard.goalSuggestion.toast.dismissError"))}finally{setIsLoading(!1)}},disabled:isLoading,className:"w-full sm:w-auto flex items-center justify-center gap-2 bg-slate-200 hover:bg-slate-300 dark:bg-slate-600 dark:hover:bg-slate-500 text-slate-700 dark:text-slate-200 font-semibold py-2 px-4 rounded-md transition-colors disabled:opacity-50",children:[isLoading?jsxRuntimeExports.jsx(LoaderCircle,{size:18,className:"animate-spin"}):jsxRuntimeExports.jsx(X,{size:18}),t("dashboard.goalSuggestion.dismiss")]}),jsxRuntimeExports.jsxs("button",{onClick:async()=>{setIsLoading(!0);try{const newGoal={type:"time",value:suggestion.to};await Vt.promise(updateReadingGoalFunc({newGoal:newGoal}),{loading:t("dashboard.goalSuggestion.toast.updating"),success:t("dashboard.goalSuggestion.toast.success"),error:t("dashboard.goalSuggestion.toast.error")})}catch(error){console.error("Error al aceptar la sugerencia de meta:",error)}finally{setIsLoading(!1)}},disabled:isLoading,className:"w-full sm:w-auto flex items-center justify-center gap-2 bg-green-500 hover:bg-green-600 text-white font-semibold py-2 px-4 rounded-md shadow transition-colors disabled:opacity-50",children:[isLoading?jsxRuntimeExports.jsx(LoaderCircle,{size:18,className:"animate-spin"}):jsxRuntimeExports.jsx(Check,{size:18}),t("dashboard.goalSuggestion.accept")]})]})]})})}function VocabularyBaseAlerts({className:className=""}){const{t:t}=useTranslation(),{userProfile:userProfile,isGuest:isGuest,userId:userId,forceProfileRefresh:forceProfileRefresh}=useAuth(),{virtualVocabularyStatus:virtualVocabularyStatus,activeLanguage:activeLanguage}=useWords(),[migrating,setMigrating]=reactExports.useState(!1),showEmpty="empty"===virtualVocabularyStatus,showUnsupported="unsupported"===virtualVocabularyStatus,showCalibration=needsVocabularyCalibration(userProfile,{isGuest:isGuest});if(!showEmpty&&!showUnsupported&&!showCalibration)return null;return jsxRuntimeExports.jsxs("div",{className:`space-y-2 ${className}`,children:[showUnsupported&&jsxRuntimeExports.jsxs("div",{role:"status",className:"flex items-start gap-3 rounded-xl border border-amber-200 bg-amber-50 px-4 py-3 text-sm text-amber-900 dark:border-amber-800/60 dark:bg-amber-950/40 dark:text-amber-100",children:[jsxRuntimeExports.jsx(TriangleAlert,{size:18,className:"mt-0.5 shrink-0 text-amber-600 dark:text-amber-400"}),jsxRuntimeExports.jsxs("div",{children:[jsxRuntimeExports.jsx("p",{className:"font-semibold",children:t("vocabularyBase.unsupportedTitle",{lang:(activeLanguage||"").toUpperCase(),defaultValue:"No vocabulary base for {{lang}}"})}),jsxRuntimeExports.jsx("p",{className:"mt-1 text-amber-800/90 dark:text-amber-200/90",children:t("vocabularyBase.unsupportedBody",{defaultValue:"This study language has no frequency pack yet, so blue highlighting has no level baseline. Switch to a supported study language."})}),jsxRuntimeExports.jsxs("div",{className:"mt-2 flex flex-wrap gap-3",children:[!isGuest&&userId&&jsxRuntimeExports.jsx("button",{type:"button",disabled:migrating,onClick:async()=>{if(userId&&!isGuest&&!migrating){setMigrating(!0);try{await updateDoc(doc(db,getUserProfileDocPath(userId)),{activeLanguage:"en",unsupportedStudyLanguageMigratedFrom:activeLanguage||null,unsupportedStudyLanguageMigratedAt:serverTimestamp(),updatedAt:serverTimestamp()}),Vt.success(t("vocabularyBase.migrateSuccess",{lang:"en".toUpperCase(),defaultValue:"Study language updated to {{lang}}"})),"function"==typeof forceProfileRefresh&&await forceProfileRefresh()}catch(error){console.error("[VocabularyBaseAlerts] migrate failed:",error),Vt.error(t("vocabularyBase.migrateError",{defaultValue:"Could not update study language. Try again in Settings."}))}finally{setMigrating(!1)}}},className:"font-bold text-amber-800 underline underline-offset-2 disabled:opacity-50 dark:text-amber-200",children:migrating?t("vocabularyBase.migrating",{defaultValue:"Updating…"}):t("vocabularyBase.migrateToEn",{defaultValue:"Switch study language to English"})}),jsxRuntimeExports.jsx(LocalizedLink,{to:"/configuracion",className:"font-bold text-amber-700 underline underline-offset-2 dark:text-amber-300",children:t("vocabularyBase.openSettings",{defaultValue:"Open settings"})})]})]})]}),showEmpty&&!showUnsupported&&jsxRuntimeExports.jsxs("div",{role:"status",className:"flex items-start gap-3 rounded-xl border border-amber-200 bg-amber-50 px-4 py-3 text-sm text-amber-900 dark:border-amber-800/60 dark:bg-amber-950/40 dark:text-amber-100",children:[jsxRuntimeExports.jsx(TriangleAlert,{size:18,className:"mt-0.5 shrink-0 text-amber-600 dar
1k:text-amber-400"}),jsxRuntimeExports.jsxs("div",{children:[jsxRuntimeExports.jsx("p",{className:"font-semibold",children:t("vocabularyBase.emptyTitle",{defaultValue:"No vocabulary base loaded"})}),jsxRuntimeExports.jsx("p",{className:"mt-1 text-amber-800/90 dark:text-amber-200/90",children:t("vocabularyBase.emptyBody",{defaultValue:"Almost every word may appear blue until a vocabulary pack loads. Check your study language or try again."})}),jsxRuntimeExports.jsx(LocalizedLink,{to:"/configuracion",className:"mt-2 inline-block font-bold text-amber-700 underline underline-offset-2 dark:text-amber-300",children:t("vocabularyBase.openSettings",{defaultValue:"Open settings"})})]})]}),showCalibration&&jsxRuntimeExports.jsxs("div",{role:"status",className:"flex items-start gap-3 rounded-xl border border-teal-200 bg-teal-50 px-4 py-3 text-sm text-teal-950 dark:border-teal-800/60 dark:bg-teal-950/40 dark:text-teal-100",children:[jsxRuntimeExports.jsx(Target,{size:18,className:"mt-0.5 shrink-0 text-teal-600 dark:text-teal-400"}),jsxRuntimeExports.jsxs("div",{children:[jsxRuntimeExports.jsx("p",{className:"font-semibold",children:t("vocabularyBase.calibrateTitle",{defaultValue:"Set your level for accurate blue words"})}),jsxRuntimeExports.jsx("p",{className:"mt-1 text-teal-900/80 dark:text-teal-200/90",children:t("vocabularyBase.calibrateBody",{defaultValue:"You are on a default intermediate baseline (B1). Calibrate your level so highlighting matches what you already know."})}),jsxRuntimeExports.jsx(LocalizedLink,{to:"/welcome",className:"mt-2 inline-block font-bold text-teal-700 underline underline-offset-2 dark:text-teal-300",children:t("vocabularyBase.calibrateCta",{defaultValue:"Choose my level"})})]})]})]})}const OnboardingSuccessModal=({isOpen:isOpen,onClose:onClose,userName:userName})=>{const{t:t}=useTranslation(),navigate=useNavigate(),{isGuest:isGuest}=useAuth(),basePath=isGuest?"/demo":"/home";if(!isOpen)return null;return jsxRuntimeExports.jsxs(Modal,{isOpen:isOpen,onClose:onClose,maxWidth:"max-w-lg",children:[jsxRuntimeExports.jsxs("div",{className:"text-center",children:[jsxRuntimeExports.jsx(CircleCheckBig,{size:48,className:"mx-auto text-green-500 mb-3"}),jsxRuntimeExports.jsx("h2",{className:"text-2xl font-bold text-gray-800 dark:text-gray-100",children:t("dashboard.onboardingSuccess.title2",{name:userName})}),jsxRuntimeExports.jsx("p",{className:"mt-2 text-base text-gray-500 dark:text-gray-400",children:t("dashboard.onboardingSuccess.subtitle")})]}),jsxRuntimeExports.jsxs("div",{className:"mt-6 space-y-3",children:[jsxRuntimeExports.jsxs("button",{onClick:()=>{return path=`${basePath}/explorar`,onClose(),void navigate(path);var path},className:"w-full flex items-center gap-4 p-4 bg-indigo-50 dark:bg-indigo-900/30 hover:bg-indigo-100 dark:hover:bg-indigo-900/50 border-2 border-indigo-200 dark:border-indigo-700 hover:border-indigo-400 rounded-xl text-left transition-all group",children:[jsxRuntimeExports.jsx("div",{className:"flex-shrink-0 w-12 h-12 flex items-center justify-center bg-indigo-500 rounded-lg text-white text-xl",children:"📚"}),jsxRuntimeExports.jsxs("div",{className:"flex-1",children:[jsxRuntimeExports.jsx("p",{className:"font-bold text-gray-800 dark:text-gray-100 group-hover:text-indigo-700 dark:group-hover:text-indigo-300",children:t("dashboard.onboardingSuccess.cta.catalog.title")}),jsxRuntimeExports.jsx("p",{className:"text-sm text-gray-500 dark:text-gray-400 mt-0.5",children:t("dashboard.onboardingSuccess.cta.catalog.desc")})]}),jsxRuntimeExports.jsx(ArrowRight,{size:20,className:"flex-shrink-0 text-indigo-400 group-hover:translate-x-1 transition-transform"})]}),jsxRuntimeExports.jsxs("a",{href:"https://chromewebstore.google.com/detail/lbeopbhhcjfanecfcpcibjekgclhlogm?authuser=0&hl=es-419",target:"_blank",rel:"noopener noreferrer",onClick:onClose,className:"w-full flex items-center gap-4 p-4 bg-orange-50 dark:bg-orange-900/30 hover:bg-orange-100 dark:hover:bg-orange-900/50 border-2 border-orange-200 dark:border-orange-700 hover:border-orange-400 rounded-xl text-left transition-all group",children:[jsxRuntimeExports.jsx("div",{className:"flex-shrink-0 w-12 h-12 flex items-center justify-center bg-orange-500 rounded-lg text-white text-xl",children:"🔌"}),jsxRuntimeExports.jsxs("div",{className:"flex-1",children:[jsxRuntimeExports.jsx("p",{className:"font-bold text-gray-800 dark:text-gray-100 group-hover:text-orange-700 dark:group-hover:text-orange-300",children:t("dashboard.onboardingSuccess.cta.extension.title")}),jsxRuntimeExports.jsx("p",{className:"text-sm text-gray-500 dark:text-gray-400 mt-0.5",children:t("dashboard.onboardingSuccess.cta.extension.desc")})]}),jsxRuntimeExports.jsx(ArrowRight,{size:20,className:"flex-shrink-0 text-orange-400 group-hover:translate-x-1 transition-transform"})]})]}),jsxRuntimeExports.jsx("div",{className:"mt-5 text-center",children:jsxRuntimeExports.jsx("button",{onClick:onClose,className:"text-sm text-gray-400 hover:text-gray-600 dark:hover:text-gray-300 transition-colors",children:t("dashboard.onboardingSuccess.skip")})})]})},getActiveLanguageName=(code,t)=>{if(!code)return t("languages.en");const key=`languages.${code}`,translated=t(key);return translated===key?code.toUpperCase():translated},MobileHomeProgressCard=({userProfile:userProfile,basePath:basePath="/home",capturedWordsCount:capturedWordsCount=0,dueWordsCount:dueWordsCount=0,activeLanguage:activeLanguage})=>{const{t:t}=useTranslation(),navigate=useNavigate(),{currentLevel:currentLevel,nextLevel:nextLevel,userXP:userXP,progressPercentage:progressPercentage}=calculateLevelProgress(userProfile,LEVELS_CONFIG),langName=getActiveLanguageName(activeLanguage||userProfile?.activeLanguage,t),reviewDone=((isFirestoreTimestampBeforeToday(userProfile?.dailyGoal?.lastReset)?{practiceSessionsCompleted:0}:userProfile?.dailyActivity||{practiceSessionsCompleted:0}).practiceSessionsCompleted||0)>=1,readingGoal=userProfile?.readingGoal||{value:15},dailyProgress=userProfile?.dailyProgress||{date:"",readingTime:0},todayStr=(new Date).toISOString().split("T")[0],currentReadingMinutes=(dailyProgress.date?.seconds?new Date(1e3*dailyProgress.date.seconds).toISOString().split("T")[0]===todayStr:dailyProgress.date===todayStr)&&dailyProgress.readingTime||0,readingGoalMinutes=readingGoal.value||15,readingProgressPercent=readingGoalMinutes>0?Math.min(currentReadingMinutes/readingGoalMinutes*100,100):0;return currentLevel?jsxRuntimeExports.jsxs("div",{className:"bg-gradient-to-br from-slate-700 to-slate-800 dark:from-slate-900 dark:to-slate-950 text-white p-4 rounded-2xl shadow-lg border border-slate-600 dar
1k:border-slate-700",children:[jsxRuntimeExports.jsxs("button",{type:"button",onClick:()=>navigate(`${basePath}/estadisticas`),className:"w-full text-left flex justify-between items-start gap-2",children:[jsxRuntimeExports.jsxs("div",{className:"min-w-0",children:[jsxRuntimeExports.jsx("p",{className:"text-xs opacity-80",children:t("dashboard.progress.title",{lang:langName})}),jsxRuntimeExports.jsx("h2",{className:"text-lg font-bold mt-0.5 truncate",children:t("dashboard.progress.greeting",{name:userProfile?.displayName||"Explorador"})})]}),jsxRuntimeExports.jsx(ArrowRight,{className:"text-white/40 flex-shrink-0 mt-1",size:18})]}),jsxRuntimeExports.jsxs("div",{className:"mt-3 grid grid-cols-2 gap-2",children:[jsxRuntimeExports.jsxs("button",{type:"button",onClick:()=>navigate(`${basePath}/vocabulario`),className:"flex items-center justify-between gap-2 px-3 py-2 rounded-xl bg-white/10 border border-white/5 hover:bg-white/15 transition-colors",children:[jsxRuntimeExports.jsx("span",{className:"text-xs text-teal-200 truncate",children:t("dashboard.progress.collection")}),jsxRuntimeExports.jsx("span",{className:"text-sm font-bold text-teal-100",children:capturedWordsCount.toLocaleString()})]}),jsxRuntimeExports.jsxs("button",{type:"button",onClick:()=>navigate(`${basePath}/practica`),className:"flex items-center justify-between gap-2 px-3 py-2 rounded-xl bg-white/10 border border-white/5 hover:bg-white/15 transition-colors",children:[jsxRuntimeExports.jsx("span",{className:"text-xs text-amber-200 truncate",children:t("dashboard.progress.dueToday")}),jsxRuntimeExports.jsx("span",{className:"text-sm font-bold text-amber-100",children:dueWordsCount.toLocaleString()})]})]}),nextLevel&&jsxRuntimeExports.jsxs("div",{className:"mt-3 flex items-center gap-2",children:[jsxRuntimeExports.jsx("span",{className:"text-lg flex-shrink-0","aria-hidden":!0,children:currentLevel.icon}),jsxRuntimeExports.jsxs("div",{className:"flex-1 min-w-0",children:[jsxRuntimeExports.jsxs("div",{className:"flex justify-between text-[10px] font-medium mb-1 opacity-80",children:[jsxRuntimeExports.jsx("span",{className:"truncate",children:t("dashboard.progress.level",{level:currentLevel.level,name:t(currentLevel.nameKey)})}),jsxRuntimeExports.jsxs("span",{className:"text-yellow-300 flex-shrink-0 ml-2",children:[userXP," / ",nextLevel.minXp," XP"]})]}),jsxRuntimeExports.jsx("div",{className:"w-full bg-black/40 rounded-full h-1.5 overflow-hidden",children:jsxRuntimeExports.jsx("div",{className:"bg-gradient-to-r from-yellow-300 to-amber-400 h-1.5 rounded-full",style:{width:`${progressPercentage}%`}})})]})]}),jsxRuntimeExports.jsxs("div",{className:"mt-3 pt-3 border-t border-white/10 space-y-2.5",children:[jsxRuntimeExports.jsx("p",{className:"text-[10px] font-bold uppercase tracking-wider text-teal-300/90",children:t("dashboard.widgets.dailyProgress.unified.title")}),jsxRuntimeExports.jsxs("div",{children:[jsxRuntimeExports.jsxs("div",{className:"flex justify-between text-xs mb-1",children:[jsxRuntimeExports.jsx("span",{className:"text-white/80",children:t("dashboard.widgets.dailyProgress.unified.read",{minutes:readingGoalMinutes})}),jsxRuntimeExports.jsxs("span",{className:"text-white/50 tabular-nums",children:[currentReadingMinutes,"/",readingGoalMinutes," min"]})]}),jsxRuntimeExports.jsx("div",{className:"h-1.5 bg-black/40 rounded-full overflow-hidden",children:jsxRuntimeExports.jsx("div",{className:"h-full bg-teal-400 rounded-full",style:{width:`${readingProgressPercent}%`}})})]}),jsxRuntimeExports.jsxs("div",{children:[jsxRuntimeExports.jsxs("div",{className:"flex justify-between text-xs mb-1",children:[jsxRuntimeExports.jsx("span",{className:"text-white/80",children:dueWordsCount>0?t("dashboard.widgets.dailyProgress.unified.reviewDue",{count:dueWordsCount}):t("dashboard.widgets.dailyProgress.unified.review")}),jsxRuntimeExports.jsx("span",{className:"text-white/50",children:reviewDone?"✓":"—"})]}),jsxRuntimeExports.jsx("div",{className:"h-1.5 bg-black/40 rounded-full overflow-hidden",children:jsxRuntimeExports.jsx("div",{className:"h-full bg-amber-400 rounded-full",style:{width:reviewDone?"100%":"
10%"}})})]})]})]}):null},OptimalNextAction=({userProfile:userProfile,navigate:navigate,basePath:basePath,hasRealWords:hasRealWords,activePlan:activePlan,allWords:allWords=[]})=>{const{startPracticeSession:startPracticeSession}=usePractice(),{t:t}=useTranslation(),{current:streak,practicedToday:practicedToday}=getEffectiveStreak(userProfile?.streak),isStreakInDanger=streak>0&&!practicedToday,todaySessionWords=reactExports.useMemo(()=>buildTodaySession(allWords),[allWords]),handleStartTodaySession=()=>{todaySessionWords.length?(startPracticeSession({type:"today",data:todaySessionWords}),navigate(`${basePath}/practica`)):Vt.error(t("practicePage.todaySession.empty"))},StreakNotice=()=>isStreakInDanger?jsxRuntimeExports.jsxs("div",{className:"absolute -top-3 left-6 flex items-center gap-1.5 bg-red-600 text-white px-3 py-1 rounded-full text-xs font-bold shadow-lg animate-bounce-once z-10",children:[jsxRuntimeExports.jsx(Flame,{size:14,className:"fill-current"}),t("dashboard.nextAction.streakDanger",{count:streak})]}):null,singleCtaClass=(bgClass,ringClass="")=>`w-full text-left px-5 py-4 ${bgClass} text-white rounded-2xl shadow-lg transition-all hover:scale-[1.01] flex items-center justify-between ${ringClass}`,readingShortcut=(()=>{if(activePlan)return{path:`${basePath}/lector/${activePlan.bookId}`,label:t("dashboard.nextAction.todaySession.continueReading"),detail:activePlan.bookTitle};const langProgress2=getLanguageProgress(userProfile,userProfile?.activeLanguage);return langProgress2.lastReadBookId?{path:`${basePath}/lector/${langProgress2.lastReadBookId}`,label:t("dashboard.nextAction.todaySession.continueReading"),detail:langProgress2.lastReadEpub?.title||t("dashboard.shortcuts.defaults.lastBook")}:null})();if(hasRealWords&&todaySessionWords.length>0)return jsxRuntimeExports.jsxs("div",{className:"space-y-3",children:[jsxRuntimeExports.jsxs("div",{className:"relative",children:[jsxRuntimeExports.jsx(StreakNotice,{}),jsxRuntimeExports.jsxs("button",{id:"optimal-next-action",onClick:handleStartTodaySession,className:singleCtaClass("bg-teal-500 hover:bg-teal-600",isStreakInDanger?"ring-4 ring-amber-500/30":""),children:[jsxRuntimeExports.jsxs("div",{className:"flex items-center gap-4 min-w-0",children:[jsxRuntimeExports.jsx(Sparkles,{size:28,className:"flex-shrink-0"}),jsxRuntimeExports.jsxs("div",{className:"min-w-0",children:[jsxRuntimeExports.jsx("h4",{className:"text-xl font-bold",children:t("dashboard.nextAction.todaySession.title")}),jsxRuntimeExports.jsx("p",{className:"opacity-90 mt-0.5 text-sm",children:t("dashboard.nextAction.todaySession.desc",{count:todaySessionWords.length})})]})]}),jsxRuntimeExports.jsx(ArrowRight,{size:22,className:"ml-4 flex-shrink-0"})]})]}),readingShortcut&&jsxRuntimeExports.jsxs("button",{type:"button",onClick:()=>navigate(readingShortcut.path),className:"w-full text-left px-4 py-3 rounded-xl bg-slate-50 dark:bg-slate-800 border border-slate-100 dark:border-slate-700 hover:border-teal-300 dark:hover:border-teal-700 flex items-center justify-between gap-3",children:[jsxRuntimeExports.jsxs("div",{className:"min-w-0",children:[jsxRuntimeExports.jsx("p",{className:"text-sm font-bold text-slate-800 dark:text-slate-100",children:readingShortcut.label}),readingShortcut.detail&&jsxRuntimeExports.jsx("p",{className:"text-xs text-slate-500 truncate",children:readingShortcut.detail})]}),jsxRuntimeExports.jsx(BookMarked,{size:18,className:"text-teal-500 shrink-0"})]})]});if(activePlan)return jsxRuntimeExports.jsxs("div",{className:"relative",children:[jsxRuntimeExports.jsx(StreakNotice,{}),jsxRuntimeExports.jsxs("button",{id:"optimal-next-action",onClick:()=>navigate(`${basePath}/lector/${activePlan.bookId}`),className:singleCtaClass("bg-gradient-to-r from-blue-500 to-indigo-600 hover:from-blue-600 hover:to-indigo-700",isStreakInDanger?"ring-4 ring-red-500/30":""),children:[jsxRuntimeExports.jsxs("div",{className:"flex items-center gap-4 min-w-0",children:[jsxRuntimeExports.jsx(Target,{size:28,className:"flex-shrink-0"}),jsxRuntimeExports.jsxs("div",{className:"min-w-0",children:[jsxRuntimeExports.jsx("h4",{className:"text-xl font-bold",children:t("dashboard.nextAction.plan.title")}),jsxRuntimeExports.jsx("p",{className:"opacity-90 mt-0.5 text-sm truncate",children:t("dashboard.nextAction.plan.desc",{book:activePlan.bookTitle||"tu libro"})})]})]}),jsxRuntimeExports.jsx(ArrowRight,{size:22,className:"ml-4 flex-shrink-0"})]})]});const langProgress=getLanguageProgress(userProfile,userProfile?.activeLanguage);if(langProgress.lastReadBookId){const bookId=langProgress.lastReadBookId,bookTitle=langProgress.lastReadEpub?.title||t("dashboard.shortcuts.defaults.lastBook");return jsxRuntimeExports.jsxs("div",{className:"relative",children:[jsxRuntimeExports.jsx(StreakNotice,{}),jsxRuntimeExports.jsxs("button",{id:"optimal-next-action",onClick:()=>navigate(`${basePath}/lector/${bookId}`),className:singleCtaClass("bg-teal-500 hover:bg-teal-600",isStreakInDanger?"ring-4 ring-red-500/30":""),children:[jsxRuntimeExports.jsxs("div",{className:"flex items-center gap-4 min-w-0",children:[jsxRuntimeExports.jsx(BookMarked,{size:28,className:"flex-shrink-0"}),jsxRuntimeExports.jsxs("div",{className:"min-w-0",children:[jsxRuntimeExports.jsx("h4",{className:"text-xl font-bold",children:t("dashboard.nextAction.continue.title")}),jsxRuntimeExports.jsx("p",{className:"opacity-90 mt-0.5 text-sm truncate max-w-xs",children:t("dashboard.nextAction.continue.desc",{book:bookTitle})})]})]}),jsxRuntimeExports.jsx(ArrowRight,{size:22,className:"ml-4 flex-shrink-0"})]})]})}if(hasRealWords)return jsxRuntimeExports.jsxs("div",{className:"relative",children:[jsxRuntimeExports.jsx(StreakNotice,{}),jsxRuntimeExports.jsxs("button",{id:"optimal-next-action",onClick:()=>navigate(`${basePath}/practica`),className:singleCtaClass("bg-sky-500 hover:bg-sky-600",isStreakInDanger?"ring-4 ring-red-500/30":""),children:[jsxRuntimeExports.jsxs("div",{className:"flex items-center gap-4 min-w-0",children:[jsxRuntimeExports.jsx(Sparkles,{size:28,className:"flex-shrink-0"}),jsxRuntimeExports.jsxs("div",{className:"min-w-0",children:[jsxRuntimeExports.jsx("h4",{className:"text-xl font-bold",children:t("dashboard.nextAction.train.title")}),jsxRuntimeExports.jsx("p",{className:"opacity-90 mt-0.5 text-sm",children:t("dashboard.nextAction.train.desc")})]})]}),jsxRuntimeExports.jsx(ArrowRight,{size:22,className:"ml-4 flex-shrink-0"})]})]});{const extensionUrl="https://chromewebstore.google.com/detail/lbeopbhhcjfanecfcpcibjekgclhlogm?authuser=0&hl=es-419";return jsxRuntimeExports.jsxs("div",{className:"h-full grid grid-cols-1 md:grid-cols-2 gap-4",children:[jsxRuntimeExports.jsxs("button",{id:"optimal-next-action",onClick:()=>navigate(`${basePath}/explorar`),className:"w-full h-full text-left p-6 bg-indigo-500 hover:bg-indigo-600 text-white rounded-2xl shadow-lg transition-all hover:scale-[1.02] flex flex-col justify-between group",children:[jsxRuntimeExports.jsxs("div",{children:[jsxRuntimeExports.jsx(BookOpen,{size:36,className:"mb-4 opacity-90"}),jsxRuntimeExports.jsx("h4",{className:"text-2xl font-bold",children:t("dashboard.nextAction.exploreCatalog.title")}),jsxRuntimeExports.jsx("p",{className:"opacity-90 mt-2 text-sm leading-relaxed",children:t("dashboard.nextAction.exploreCatalog.desc")})]}),jsxRuntimeExports.jsxs("div",{className:"flex items-center gap-2 mt-4 font-semibold text-white/80 text-sm",children:[t("dashboard.nextAction.exploreCatalog.cta"),jsxRuntimeExports.jsx(ArrowRight,{size:16,className:"transition-transform group-hover:translate-x-1"})]})]}),jsxRuntimeExports.jsxs("a",{href:extensionUrl,target:"_blank",rel:"noopener noreferrer",className:"w-full h-full text-left p-6 bg-violet-600 hover:bg-violet-700 text-white rounded-2xl shadow-lg transition-all hover:scale-[1.02] flex flex-col justify-between group",children:[jsxRuntimeExports.jsxs("div",{children:[jsxRuntimeExports.jsx(Chrome,{size:36,className:"mb-4 opacity-90"}),jsxRuntimeExports.jsx("h4",{className:"text-2xl font-bold",children:t("dashboard.nextAction.installExtension.title")}),jsxRuntimeExports.jsx("p",{className:"opacity-90 mt-2 text-sm leading-relaxed",children:t("dashboard.nextAction.installExtension.desc")})]}),jsxRuntimeExports.jsxs("div",{className:"flex items-center gap-2 mt-4 font-semibold text-white/80 text-sm",children:[t("dashboard.nextAction.installExtension.cta"),jsxRuntimeExports.jsx(ArrowRight,{size:16,className:"transition-transform group-hover:translate-x-1"})]})]})]})}},UserProgressWidget=({userProfile:userProfile,basePath:basePath="/home",capturedWordsCount:capturedWordsCount=0,dueWordsCount:dueWordsCount=0,activeLanguage:activeLanguage})=>{const{t:t}=useTranslation(),navigate=useNavigate(),{currentLevel:currentLevel,nextLevel:nextLevel,userXP:userXP,progressPercentage:progressPercentage}=calculateLevelProgress(userProfile,LEVELS_CONFIG),langName=getActiveLanguageName(activeLanguage||userProfile?.activeLanguage,t);return currentLevel?jsxRuntimeExports.jsxs("div",{onClick:()=>navigate(`${basePath}/estadisticas`),className:"bg-gradient-to-br from-slate-700 to-slate-800 dark:from-slate-900 dark:to-slate-950 text-white p-6 rounded-2xl shadow-lg border border-slate-600 dar
1k:border-slate-700 cursor-pointer hover:shadow-xl hover:scale-[1.01] transition-all duration-200 group",children:[jsxRuntimeExports.jsxs("div",{className:"flex justify-between items-start",children:[jsxRuntimeExports.jsxs("div",{children:[jsxRuntimeExports.jsx("p",{className:"text-sm opacity-90",children:t("dashboard.progress.title",{lang:langName})}),jsxRuntimeExports.jsx("h2",{className:"text-2xl font-bold mt-1",children:t("dashboard.progress.greeting",{name:userProfile?.displayName||"Explorador"})})]}),jsxRuntimeExports.jsx(ArrowRight,{className:"text-white/50 group-hover:text-white transition-colors",size:20})]}),jsxRuntimeExports.jsxs("div",{className:"mt-4 grid grid-cols-1 gap-3",children:[jsxRuntimeExports.jsxs("div",{onClick:e=>{e.stopPropagation(),navigate(`${basePath}/vocabulario`)},className:"p-4 bg-white/10 rounded-xl border border-white/5 shadow-inner cursor-pointer hover:bg-white/20 hover:border-teal-400/30 transition-all",children:[jsxRuntimeExports.jsxs("div",{className:"flex justify-between items-center mb-1",children:[jsxRuntimeExports.jsx("span",{className:"text-sm font-medium text-teal-300",children:t("dashboard.progress.collection")}),jsxRuntimeExports.jsx("span",{className:"text-sm font-bold bg-teal-500/20 px-2 py-0.5 rounded-full text-teal-200",children:capturedWordsCount.toLocaleString()})]}),jsxRuntimeExports.jsx("p",{className:"text-xs text-white/70 italic mt-1",children:t("dashboard.progress.collectionDesc")})]}),jsxRuntimeExports.jsxs("div",{onClick:e=>{e.stopPropagation(),navigate(`${basePath}/practica`)},className:"p-4 bg-white/10 rounded-xl border border-white/5 shadow-inner cursor-pointer hover:bg-white/20 hover:border-amber-400/30 transition-all",children:[jsxRuntimeExports.jsxs("div",{className:"flex justify-between items-center mb-1",children:[jsxRuntimeExports.jsx("span",{className:"text-sm font-medium text-amber-200",children:t("dashboard.progress.dueToday")}),jsxRuntimeExports.jsx("span",{className:"text-sm font-bold bg-amber-500/20 px-2 py-0.5 rounded-full text-amber-100",children:dueWordsCount.toLocaleString()})]}),jsxRuntimeExports.jsx("p",{className:"text-xs text-white/70 italic mt-1",children:t("dashboard.progress.dueTodayDesc")})]})]}),jsxRuntimeExports.jsxs("div",{className:"mt-4 pt-4 border-t border-white/10",children:[jsxRuntimeExports.jsxs("div",{className:"flex items-center gap-3 mb-3",children:[jsxRuntimeExports.jsx("div",{className:"w-12 h-12 flex-shrink-0 flex items-center justify-center bg-gradient-to-br from-yellow-400/20 to-amber-500/20 rounded-full border border-yellow-400/30",children:jsxRuntimeExports.jsx("span",{className:"text-2xl drop-shadow-md",children:currentLevel.icon})}),jsxRuntimeExports.jsxs("div",{children:[jsxRuntimeExports.jsx("h3",{className:"text-sm font-bold text-yellow-300",children:t("dashboard.progress.level",{level:currentLevel.level,name:t(currentLevel.nameKey)})}),jsxRuntimeExports.jsx("p",{className:"text-xs text-white/60",children:t("dashboard.progress.appLevelLabel")})]})]}),nextLevel&&jsxRuntimeExports.jsxs("div",{className:"pl-1",children:[jsxRuntimeExports.jsxs("div",{className:"flex justify-between text-[11px] font-medium mb-1.5 opacity-80 uppercase tracking-wide",children:[jsxRuntimeExports.jsx("span",{children:t("dashboard.progress.nextLevelShort",{level:nextLevel.level})}),jsxRuntimeExports.jsxs("span",{className:"text-yellow-300",children:[userXP," / ",nextLevel.minXp," XP"]})]}),jsxRuntimeExports.jsx("div",{className:"w-full bg-black/50 rounded-full h-2 shadow-inner overflow-hidden",children:jsxRuntimeExports.jsx("div",{className:"bg-gradient-to-r from-yellow-300 to-amber-400 h-2 rounded-full relative",style:{width:`${progressPercentage}%`},children:jsxRuntimeExports.jsx("div",{className:"absolute top-0 right-0 bottom-0 left-0 bg-white/20 animate-pulse"})})})]})]})]}):null},DashboardState=({userProfile:userProfile,hasRealWords:hasRealWords,capturedWordsCount:capturedWordsCount})=>{const{userId:userId,isGuest:isGuest}=useAuth(),{words:words,isLoadingWords:isLoadingWords}=useWords(),navigate=useNavigate(),[storeHighlights,setStoreHighlights]=reactExports.useState([]),[activePlan,setActivePlan]=reactExports.useState(null),[isLoadingMeta,setIsLoadingMeta]=reactExports.useState(!0),{t:t}=useTranslation(),[isExtensionDismissed,setIsExtensionDismissed]=reactExports.useState(()=>{try{return"true"===localStorage.getItem("abantra_extension_dismissed")}catch(e){return!1}}),[isExtensionInstalled,setIsExtensionInstalled]=reactExports.useState(!1);reactExports.useEffect(()=>{"true"===document.body.getAttribute("data-abantra-extension-installed")&&setIsExtensionInstalled(!0);const handleExtensionEvent=()=>setIsExtensionInstalled(!0);return window.addEventListener("abantra-extension-installed",handleExtensionEvent),()=>window.removeEventListener("abantra-extension-installed",handleExtensionEvent)},[]);const basePath=isGuest?"/demo":"/home",{dueWords:dueWords,weakWords:weakWords,allWords:allWords}=reactExports.useMemo(()=>{const now=new Date,allWords2=(words||[]).filter(word=>"_init"!==word?.id&&word?.status!==STATUS_IGNORED),due=allWords2.filter(word=>{const reviewAt=function(word){return word?.srsNextReview?word.srsNextReview instanceof Date?word.srsNextReview:"function"==typeof word.srsNextReview?.toDate?word.srsNextReview.toDate():null:null}(word);return reviewAt&&reviewAt<=now}),dueIds=new Set(due.map(w=>w.id));return{dueWords:due,weakWords:allWords2.filter(word=>!dueIds.has(word.id)).sort((a,b)=>(a.srsLevel||0)-(b.srsLevel||0)).slice(0,10),allWords:allWords2}},[words]);if(reactExports.useEffect(()=>{if(!userId)return void setIsLoadingMeta(!1);if(!userProfile?.activeLanguage)return void(userProfile&&(console.warn("Dashboard: No active language found for user."),setIsLoadingMeta(!1)));let cancelled=!1;return(async()=>{try{const raw=sessionStorage.getItem(dashboardMetaCacheKey(userId));if(raw){const{data:data,savedAt:savedAt}=JSON.parse(raw);if(Date.now()-savedAt<DASHBOARD_META_TTL_MS)return void(cancelled||(setStoreHighlights(data.highlights||[]),setA
1ctivePlan(data.activePlan||null),setIsLoadingMeta(!1)))}}catch(_){}cancelled||setIsLoadingMeta(!0);try{const lang=userProfile?.activeLanguage||"en",[highlights,plansSnap]=await Promise.all([fetchPublicCatalogBooks({section:"newest",limit:3,language:lang}),getDocs(query(collection(db,getUserReadingPlansCollectionPath(userId)),where("status","==","active"),limit(1)))]);if(cancelled)return;const activePlanData=plansSnap.empty?null:{id:plansSnap.docs[0].id,...plansSnap.docs[0].data()};setStoreHighlights(highlights),setActivePlan(activePlanData);try{sessionStorage.setItem(dashboardMetaCacheKey(userId),JSON.stringify({data:{highlights:highlights,activePlan:activePlanData},savedAt:Date.now()}))}catch(_){}}catch(err){console.error("Dashboard meta load error:",err)}finally{cancelled||setIsLoadingMeta(!1)}})(),()=>{cancelled=!0}},[userId,userProfile?.activeLanguage]),isLoadingMeta||isLoadingWords||!userProfile)return jsxRuntimeExports.jsxs("div",{className:"flex justify-center items-center py-10",children:[jsxRuntimeExports.jsx(LoaderCircle,{className:"animate-spin h-8 w-8 mr-3"}),t("dashboard.loading")]});const contextualActions=getContextualActions(userProfile,weakWords,storeHighlights,dueWords.length),hasGoalSuggestion=userProfile.goalSuggestion&&"pending"===userProfile.goalSuggestion.status;return jsxRuntimeExports.jsxs("div",{className:"space-y-8 lg:space-y-10",children:[hasGoalSuggestion&&jsxRuntimeExports.jsx(GoalSuggestionCard,{suggestion:userProfile.goalSuggestion}),jsxRuntimeExports.jsxs("div",{className:"lg:hidden space-y-4",children:[jsxRuntimeExports.jsx(PracticeStreakBanner,{}),jsxRuntimeExports.jsx(MobileHomeProgressCard,{userProfile:userProfile,basePath:basePath,capturedWordsCount:capturedWordsCount,dueWordsCount:dueWords.length,activeLanguage:userProfile?.activeLanguage})]}),jsxRuntimeExports.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-12 gap-6 lg:gap-10 items-start",children:[jsxRuntimeExports.jsxs("div",{className:"lg:col-span-8 space-y-8",children:[jsxRuntimeExports.jsx(UnifiedContentFeed,{isGuest:isGuest,userProfile:userProfile,basePath:basePath}),jsxRuntimeExports.jsxs("section",{children:[jsxRuntimeExports.jsx("div",{className:"hidden lg:block mb-4",children:jsxRuntimeExports.jsx(PracticeStreakBanner,{})}),jsxRuntimeExports.jsx("h3",{className:"text-xl font-bold mb-4 text-gray-800 dark:text-gray-100",children:t("dashboard.nextAction.title")}),jsxRuntimeExports.jsx(OptimalNextAction,{userProfile:userProfile,navigate:navigate,basePath:basePath,dueWords:dueWords,hasRealWords:hasRealWords,activePlan:activePlan,allWords:allWords})]}),hasRealWords&&jsxRuntimeExports.jsxs("section",{className:"hidden lg:flex flex-col",children:[jsxRuntimeExports.jsx("h3",{className:"text-2xl font-bold mb-3 text-gray-800 dark:text-gray-100",children:t("dashboard.shortcuts.title")}),jsxRuntimeExports.jsx("div",{className:"grid grid-cols-3 gap-3",children:contextualActions.map(action=>jsxRuntimeExports.jsx(ContextualActionCard,{title:t(action.titleKey,action.titleParams),description:t(action.descKey,{...action.descParams,book:"default_last_book"===action.descParams?.book?t("dashboard.shortcuts.defaults.lastBook"):action.descParams?.book}),icon:action.icon,path:action.path,theme:action.theme,badge:action.badge,compact:!0},action.id))})]}),!hasRealWords&&!isExtensionDismissed&&!isExtensionInstalled&&jsxRuntimeExports.jsx("div",{className:"hidden lg:block w-full animate-fade-in-up",children:jsxRuntimeExports.jsx(GetExtensionWidget,{onDismiss:()=>{setIsExtensionDismissed(!0);try{localStorage.setItem("abantra_extension_dismissed","true")}catch(e){console.error("Failed to save extension dismissal",e)}}})})]}),jsxRuntimeExports.jsxs("div",{className:"hidden lg:flex lg:col-span-4 flex-col gap-5 lg:sticky lg:top-24 self-start",children:[jsxRuntimeExports.jsx(UserProgressWidget,{userProfile:userProfile,basePath:basePath,capturedWordsCount:capturedWordsCount,dueWordsCount:dueWords.length,activeLanguage:userProfile?.activeLanguage}),jsxRuntimeExports.jsx(DailyProgressWidget,{dueWordsCount:dueWords.length,embedded:!0})]})]})]})};function HomePage(){const{userId:userId,userProfile:userProfile}=useAuth(),{words:words,isLoadingWords:isLoadingWords}=useWords(),location=useLocation(),navigate=useNavigate(),{t:t}=useTranslation(),[showOnboardingSuccessModal,setShowOnboardingSuccessModal]=reactExports.useState(!1),[showTour,setShowTour]=reactExports.useState(!1),wordCount=reactExports.useMemo(()=>(words||[]).filter(w=>
1w?.id&&"_init"!==w.id).length,[words]);reactExports.useEffect(()=>{const justFinishedOnboarding=location.state?.fromOnboarding;justFinishedOnboarding&&(setShowOnboardingSuccessModal(!0),navigate(location.pathname,{replace:!0,state:{}}))},[location.state,navigate]),reactExports.useEffect(()=>{},[userProfile]);return reactExports.useEffect(()=>{userProfile&&!userProfile.onboardingCompleted&&navigate("/welcome")},[userProfile,navigate]),!userProfile||isLoadingWords?jsxRuntimeExports.jsxs("div",{className:"flex justify-center items-center py-10",children:[jsxRuntimeExports.jsx(LoaderCircle,{className:"animate-spin h-8 w-8 mr-3"}),jsxRuntimeExports.jsx("span",{children:t("dashboard.loadingGeneral")})]}):userProfile.onboardingCompleted?jsxRuntimeExports.jsxs("div",{className:"w-full",children:[showTour&&jsxRuntimeExports.jsx(GuidedTour,{steps:GUIDED_TOUR_STEPS,onFinish:async()=>{if(setShowTour(!1),userId)try{const userDocRef=doc(db,getUserProfileDocPath(userId));await updateDoc(userDocRef,{"onboardingState.hasCompletedTour":!0})}catch(error){console.error("Error al marcar el tour como completado:",error)}}}),jsxRuntimeExports.jsx(VocabularyBaseAlerts,{className:"mb-4"}),jsxRuntimeExports.jsx(DashboardState,{userProfile:userProfile,hasRealWords:wordCount>0,capturedWordsCount:wordCount}),userProfile?.displayName&&jsxRuntimeExports.jsx(OnboardingSuccessModal,{isOpen:showOnboardingSuccessModal,onClose:()=>setShowOnboardingSuccessModal(!1),userName:userProfile.displayName})]}):jsxRuntimeExports.jsxs("div",{className:"flex justify-center items-center h-[calc(100vh-200px)]",children:[jsxRuntimeExports.jsx(LoaderCircle,{className:"animate-spin h-10 w-10 text-teal-500 mr-4"}),jsxRuntimeExports.jsx("span",{className:"text-xl font-medium text-gray-600 dark:text-gray-300",children:t("dashboard.redirecting")})]})}export{HomePage 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.