1import{n as Z,r as u,j as e,p as l,F as P,a6 as A,E as ee,T as z,C as se,D as W,x as ae}from"./index-NjMgXgUF.js";import te from"./purify.es-B9ZVCkUG.js";import{u as re}from"./useAcademia-vRLpPlDW.js";import{S as ie}from"./SimuladorInvestidorEN-BG6a6eDC.js";import{C as j,a as f,b as ne,c as le,d as ce}from"./card-D7ElHNJ0.js";import{P as B}from"./progress-BpteEOQh.js";import{B as T}from"./badge-xFaTzLq1.js";import{D,b as _,c as X,d as E,e as oe}from"./dialog-BgwGS2d4.js";import{u as me}from"./index-jO6GZqFp.js";import{S as de}from"./star-Cv69ISj_.js";import{L as xe}from"./log-out-CaRxj5_x.js";import{T as he}from"./trophy-YbgznHJd.js";import{C as g}from"./circle-check-DS0mPnPY.js";import{F as pe}from"./file-text-FCXkgcIK.js";import{S as ue}from"./shield-B77AnAph.js";import{W as je}from"./wallet-BVD7zclz.js";import{L as F}from"./lock-C8cWCAtH.js";import{C as O}from"./chevron-right-DywZDgAy.js";import{P as fe}from"./play-hysHif7C.js";import"./input-CkveMB6S.js";import"./label-DxviUXEG.js";import"./slider-ZEGcVip_.js";import"./calendar-BVZ92f7V.js";import"./refresh-cw-fuCZFTN9.js";import"./index-CdnraITV.js";import"./x-CEhdj1x0.js";const ge={bitcoin:W,coins:se,wallet:je,shield:ue,"trending-up":z,"file-text":pe,scale:ee},I={iniciante:{label:"Beginner",color:"bg-green-500/20 text-green-400"},intermediario:{label:"Intermediate",color:"bg-yellow-500/20 text-yellow-400"},avancado:{label:"Advanced",color:"bg-red-500/20 text-red-400"}},Ge=()=>{const d=Z(),{user:R,profile:c,courses:x,badges:N,userBadges:$,loading:H,startCourse:M,completeLesson:G,getCourseProgress:b,isLessonCompleted:y,getCourseLessons:q,signOut:U}=re(),[t,v]=u.useState(null),[r,m]=u.useState(null),[Y,w]=u.useState(!1),h=e.jsx(ae,{title:"SATS Academy | Learn about Bitcoin",description:"Learn about Bitcoin, earn XP, and unlock badges while mastering the world of cryptocurrency.",canonicalPath:"/en/academy",language:"en",alternateLanguagePath:"/academia"});if(H)return e.jsxs(e.Fragment,{children:[h,e.jsx("div",{className:"min-h-screen bg-background flex items-center justify-center",children:e.jsx("div",{className:"w-8 h-8 border-2 border-primary border-t-transparent rounded-full animate-spin"})})]});if(!R)return e.jsxs(e.Fragment,{children:[h,e.jsxs("div",{className:"min-h-screen bg-background flex flex-col items-center justify-center px-4 relative",children:[e.jsxs(l,{variant:"outline",onClick:()=>d("/en"),className:"absolute top-6 left-6",children:[e.jsx(P,{className:"h-4 w-4 mr-2"}),"Back to site"]}),e.jsx(A,{className:"h-16 w-16 text-primary mb-6"}),e.jsx("h1",{className:"text-3xl font-bold mb-4 text-center",children:"SATS Academy"}),e.jsx("p",{className:"text-muted-foreground text-center mb-8 max-w-md",children:"Learn about Bitcoin, complete courses, and earn XP to unlock exclusive badges."}),e.jsx(l,{onClick:()=>d("/auth"),size:"lg",children:"Login to get started"})]})]});const o=x.find(s=>s.id===t),C=t?q(t):[],J=async s=>{t&&await M(t),m(s)},K=async()=>{r&&t&&(await G(r.id,t),me.success("Lesson completed! +25 XP"),m(null))},p=(c==null?void 0:c.xp_points)||0,S=(c==null?void 0:c.level)||1,Q=p%100/100*100;return e.jsxs(e.Fragment,{children:[h,e.jsxs("div",{className:"min-h-screen bg-background",children:[e.jsx("header",{className:"sticky top-0 z-50 bg-background/80 backdrop-blur-xl border-b border-border",children:e.jsxs("div",{className:"container mx-auto px-4 py-4",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs(l,{variant:"ghost",onClick:()=>t?v(null):d("/en"),children:[e.jsx(P,{className:"h-4 w-4 mr-2"}),t?"Back to Courses":"Back to Site"]}),e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(de,{className:"h-5 w-5 text-primary"}),e.jsxs("span",{className:"font-bold",children:[p," XP"]})]}),e.jsxs(T,{variant:"outline",children:["Level ",S]}),e.jsx(l,{variant:"ghost",size:"sm",onClick:U,children:e.jsx(xe,{className:"h-4 w-4"})})]})]}),e.jsxs("div",{className:"mt-3",children:[e.jsxs("div",{className:"flex justify-between text-xs text-muted-foreground mb-1",children:[e.jsxs("span",{children:["Level ",S]}),e.jsxs("span",{children:[p%100,"/",100," XP"]})]}),e.jsx(B,{value:Q,className:"h-2"})]})]})}),e.jsx("main",{className:"container mx-auto px-4 py-8",children:t?e.jsxs("div",{className:"max-w-3xl mx-auto",children:[e.jsxs("div",{className:"mb-8",children:[e.jsx("h1",{className:"text-2xl font-bold mb-2",children:o==null?void 0:o.title}),e.jsx("p",{className:"text-muted-foreground",children:o==null?void 0:o.description})]}),e.jsx("div",{className:"space-y-4",children:C.map((s,i)=>{const a=y(s.id),n=i>0&&!y(C[i-1].id);
1return e.jsx(j,{className:`cursor-pointer transition-all ${n?"opacity-50":"hover:border-primary/50"}`,onClick:()=>!n&&J(s),children:e.jsx(f,{className:"py-4",children:e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsx("div",{className:`h-10 w-10 rounded-full flex items-center justify-center ${a?"bg-primary text-primary-foreground":n?"bg-muted":"bg-primary/10"}`,children:a?e.jsx(g,{className:"h-5 w-5"}):n?e.jsx(F,{className:"h-5 w-5 text-muted-foreground"}):e.jsx(fe,{className:"h-5 w-5 text-primary"})}),e.jsxs("div",{className:"flex-1",children:[e.jsx("h3",{className:"font-medium",children:s.title}),e.jsxs("p",{className:"text-sm text-muted-foreground",children:["+",s.xp_reward," XP"]})]}),e.jsx(O,{className:"h-5 w-5 text-muted-foreground"})]})})},s.id)})})]}):e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"text-center mb-12",children:[e.jsx("h1",{className:"text-3xl md:text-4xl font-bold mb-4",children:"Welcome to SATS Academy"}),e.jsx("p",{className:"text-muted-foreground max-w-2xl mx-auto",children:"Learn about Bitcoin, complete courses, and earn XP to unlock badges. Start your learning journey today!"})]}),N.length>0&&e.jsxs("section",{className:"mb-12",children:[e.jsxs("h2",{className:"text-xl font-bold mb-4 flex items-center gap-2",children:[e.jsx(he,{className:"h-5 w-5 text-primary"}),"Your Badges"]}),e.jsx("div",{className:"flex gap-4 overflow-x-auto pb-4",children:N.map(s=>{const i=$.some(a=>a.badge_id===s.id);return e.jsx(j,{className:`min-w-[120px] text-center ${i?"border-primary":"opacity-50"}`,children:e.jsxs(f,{className:"pt-4",children:[e.jsx("div",{className:"text-3xl mb-2",children:s.icon}),e.jsx("p",{className:"text-sm font-medium",children:s.title}),i&&e.jsx(g,{className:"h-4 w-4 text-primary mx-auto mt-2"})]})},s.id)})})]}),e.jsxs("section",{children:[e.jsxs("h2",{className:"text-xl font-bold mb-4 flex items-center gap-2",children:[e.jsx(A,{className:"h-5 w-5 text-primary"}),"Available Courses"]}),e.jsx("div",{className:"grid md:grid-cols-2 lg:grid-cols-3 gap-6",children:x.map((s,i)=>{var L;const a=b(s.id),n=i>0&&((L=b(x[i-1].id))==null?void 0:L.completed)!==!0,V=ge[s.icon||"bitcoin"]||W,k=I[s.difficulty]||I.iniciante;return e.jsxs(j,{className:`cursor-pointer transition-all hover:border-primary/50 ${n?"opacity-50":""}`,onClick:()=>!n&&v(s.id),children:[e.jsxs(ne,{children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("div",{className:"h-12 w-12 rounded-xl bg-primary/10 flex items-center justify-center",children:n?e.jsx(F,{className:"h-6 w-6 text-muted-foreground"}):e.jsx(V,{className:"h-6 w-6 text-primary"})}),e.jsx(T,{className:k.color,children:k.label})]}),e.jsx(le,{className:"mt-4",children:s.title}),e.jsx(ce,{children:s.description})]}),e.jsxs(f,{children:[e.jsxs("div",{className:"flex items-center justify-between text-sm mb-2",children:[e.jsx("span",{className:"text-muted-foreground",children:"Progress"}),e.jsxs("span",{className:"font-medium",children:[(a==null?void 0:a.progress_percent)??0,"%"]})]}),e.jsx(B,{value:(a==null?void 0:a.progress_percent)??0,className:"h-2"}),e.jsxs("div",{className:"flex items-center justify-between mt-4",children:[e.jsxs("span",{className:"text-xs text-muted-foreground",children:["+",s.xp_reward," XP"]}),e.jsx(O,{className:"h-4 w-4 text-muted-foreground"})]})]})]},s.id)})})]}),e.jsx("section",{className:"mt-12 text-center",children:e.jsxs(l,{variant:"outline",size:"lg",onClick:()=>w(!0),children:[e.jsx(z,{className:"h-5 w-5 mr-2"}),"Investment Simulator"]})})]})}),e.jsx(D,{open:!!r,onOpenChange:()=>m(null),children:e.jsxs(_,{className:"max-w-2xl max-h-[80vh] overflow-y-auto",children:[e.jsxs(X,{children:[e.jsx(E,{children:r==null?void 0:r.title}),e.jsx(oe,{children:"Read the content and complete the lesson"})]}),e.jsx("div",{className:"prose prose-invert max-w-none py-4",dangerouslySetInnerHTML:{__html:te.sanitize((r==null?void 0:r.content)||"",{ALLOWED_TAGS:["p","h1","h2","h3","h4","h5","h6","strong","em","u","a","ul","ol","li","blockquote","hr","br","img","mark","span"],ALLOWED_ATTR:["href","target","rel","src","alt","style","class"]})}}),e.jsxs("div",{className:"flex justify-end gap-4 pt-4 border-t",children:[e.jsx(l,{variant:"outline",onClick:()=>m(null),children:"Close"}),e.jsxs(l,{onClick:K,children:[e.jsx(g,{className:"h-4 w-4 mr-2"}),"Mark as Complete"]})]})]})}),e.jsx(D,{open:Y,onOpenChange:w,children:e.jsxs(_,{className:"max-w-4xl max-h-[90vh] overflow-y-auto",children:[e.jsx(X,{children:e.jsx(E,{children:"Investment Simulator"})}),e.jsx(ie,{})]})})]})]})};export{Ge 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.