@hydralms/components 0.3.0 → 0.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/StudentProfile-BPsZBaJj.cjs +1 -0
- package/dist/{StudentProfile-DeMxdrL3.js → StudentProfile-Cw2p-RZn.js} +577 -579
- package/dist/index.cjs +1 -1
- package/dist/index.js +172 -166
- package/dist/license/index.d.ts +2 -2
- package/dist/license/tiers.d.ts +3 -0
- package/dist/modules.cjs +1 -1
- package/dist/modules.js +111 -110
- package/dist/sections/AdaptiveLearningPath/AdaptiveLearningPath.d.ts +5 -0
- package/dist/sections/AdaptiveLearningPath/path-connector.d.ts +8 -0
- package/dist/sections/AdaptiveLearningPath/path-milestone-marker.d.ts +7 -0
- package/dist/sections/AdaptiveLearningPath/path-node-card.d.ts +10 -0
- package/dist/sections/AdaptiveLearningPath/path-skill-bar.d.ts +8 -0
- package/dist/sections/AdaptiveLearningPath/types.d.ts +136 -0
- package/dist/sections/ContentAuthoringStudio/ContentAuthoringStudio.d.ts +5 -0
- package/dist/sections/ContentAuthoringStudio/block-editor-item.d.ts +14 -0
- package/dist/sections/ContentAuthoringStudio/block-type-picker.d.ts +12 -0
- package/dist/sections/ContentAuthoringStudio/types.d.ts +67 -0
- package/dist/sections/index.d.ts +4 -0
- package/dist/sections.cjs +1 -1
- package/dist/sections.js +1325 -232
- package/dist/withProGate-BJdu1T9Y.cjs +2 -0
- package/dist/withProGate-BvFc7Jwy.js +4975 -0
- package/package.json +24 -7
- package/src/license/index.ts +2 -2
- package/src/license/tiers.ts +12 -2
- package/src/modules/CoursePlayer/CoursePlayer.tsx +3 -1
- package/src/progress/stat-card.tsx +10 -5
- package/src/sections/AdaptiveLearningPath/AdaptiveLearningPath.tsx +251 -0
- package/src/sections/AdaptiveLearningPath/path-connector.tsx +27 -0
- package/src/sections/AdaptiveLearningPath/path-milestone-marker.tsx +50 -0
- package/src/sections/AdaptiveLearningPath/path-node-card.tsx +166 -0
- package/src/sections/AdaptiveLearningPath/path-skill-bar.tsx +49 -0
- package/src/sections/AdaptiveLearningPath/types.ts +159 -0
- package/src/sections/ContentAuthoringStudio/ContentAuthoringStudio.tsx +289 -0
- package/src/sections/ContentAuthoringStudio/block-editor-item.tsx +487 -0
- package/src/sections/ContentAuthoringStudio/block-type-picker.tsx +123 -0
- package/src/sections/ContentAuthoringStudio/types.ts +67 -0
- package/src/sections/ForumBoard/ForumBoard.tsx +8 -6
- package/src/sections/LessonPage/LessonPage.tsx +4 -7
- package/src/sections/index.ts +18 -0
- package/src/video/video-player.tsx +14 -5
- package/dist/StudentProfile-BVfZMbnV.cjs +0 -1
- package/dist/tabs-BsfVo2Bl.cjs +0 -173
- package/dist/tabs-BuY1iNJE.js +0 -22305
- package/dist/withProGate-BWqcKdPM.js +0 -137
- package/dist/withProGate-DX6XqKLp.cjs +0 -1
package/dist/license/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export { HydraLicenseProvider, HydraLicenseContext } from './HydraContext';
|
|
2
2
|
export type { HydraPlan, HydraLicenseContextValue, HydraLicenseProviderProps } from './HydraContext';
|
|
3
3
|
export { useHydraLicense } from './useHydraLicense';
|
|
4
|
-
export { isProModule, PRO_MODULES } from './tiers';
|
|
5
|
-
export type { ProModuleName } from './tiers';
|
|
4
|
+
export { isProModule, PRO_MODULES, isProSection, PRO_SECTIONS } from './tiers';
|
|
5
|
+
export type { ProModuleName, ProSectionName } from './tiers';
|
|
6
6
|
export { ProBadge } from './ProBadge';
|
|
7
7
|
export { withProGate } from './withProGate';
|
package/dist/license/tiers.d.ts
CHANGED
|
@@ -1,3 +1,6 @@
|
|
|
1
1
|
export declare const PRO_MODULES: Set<"QuizModule" | "FlashcardLab" | "CoursePlayer" | "ExamModule" | "SurveyModule" | "GradeCenterModule" | "AssignmentModule" | "CertificateModule" | "DiscussionModule" | "StudentDashboardModule" | "CourseCatalogModule" | "StudentProfileModule">;
|
|
2
2
|
export type ProModuleName = typeof PRO_MODULES extends Set<infer T> ? T : never;
|
|
3
3
|
export declare function isProModule(name: string): boolean;
|
|
4
|
+
export declare const PRO_SECTIONS: Set<"ContentAuthoringStudio">;
|
|
5
|
+
export type ProSectionName = typeof PRO_SECTIONS extends Set<infer T> ? T : never;
|
|
6
|
+
export declare function isProSection(name: string): boolean;
|
package/dist/modules.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),t=require("react"),i=require("lucide-react"),A=require("./StudentProfile-BVfZMbnV.cjs"),s=require("./tabs-BsfVo2Bl.cjs"),L=require("./withProGate-DX6XqKLp.cjs");function q(d){const[N,x]=t.useState(0),l=t.useRef(null),j=t.useRef(null),o=t.useRef(0);t.useEffect(()=>(d?(l.current=Date.now(),j.current=setInterval(()=>{if(l.current){const c=Math.floor((Date.now()-l.current)/1e3);c!==o.current&&(o.current=c,x(c))}},1e3)):j.current&&(clearInterval(j.current),j.current=null),()=>{j.current&&clearInterval(j.current)}),[d]);const a=t.useCallback(()=>l.current?Math.floor((Date.now()-l.current)/1e3):o.current,[]),f=t.useCallback(()=>{o.current=0,x(0),l.current=null},[]);return{timeElapsed:N,getFinalElapsed:a,reset:f}}function V({icon:d,title:N,description:x,questionCount:l,timeLimitSeconds:j,passingScore:o,startLabel:a,onStart:f,children:c,readOnly:m=!1}){return e.jsx(s.Card,{children:e.jsxs(s.CardContent,{className:"pt-8 pb-8 text-center",children:[e.jsx("div",{className:"mx-auto mb-4 w-14 h-14 rounded-full bg-primary/10 flex items-center justify-center",children:d}),e.jsx("h2",{className:"text-2xl font-bold text-foreground mb-2",children:N}),x&&e.jsx("p",{className:"text-muted-foreground mb-6 max-w-md mx-auto",children:x}),c,e.jsxs("div",{className:"flex flex-wrap justify-center gap-2 mb-8",children:[e.jsxs(s.Badge,{variant:"outline",className:"gap-1.5",children:[e.jsx(i.HelpCircle,{className:"size-3.5"}),l," questions"]}),j!=null&&e.jsxs(s.Badge,{variant:"outline",className:"gap-1.5",children:[e.jsx(i.Clock,{className:"size-3.5"}),s.formatDuration(j)," time limit"]}),o!==void 0&&e.jsxs(s.Badge,{variant:"outline",className:"gap-1.5",children:[e.jsx(i.CheckCircle2,{className:"size-3.5"}),o,"% to pass"]})]}),e.jsxs(s.Button,{size:"lg",onClick:f,disabled:m,children:[e.jsx(i.Play,{className:"size-4 mr-2"}),a]})]})})}function Y({title:d,percentage:N,passed:x,correct:l,total:j,timeElapsedSeconds:o,answers:a,questions:f,allowRetake:c,onRetake:m,retakeLabel:g="Retake",showReview:C=!0,extraBadges:r,readOnly:S=!1}){return e.jsxs(e.Fragment,{children:[e.jsx(s.Card,{children:e.jsxs(s.CardContent,{className:"pt-8 pb-8",children:[e.jsxs("div",{className:"text-center mb-8",children:[e.jsx(s.ProgressRing,{value:N,size:140,strokeWidth:10,color:x?"var(--success)":"var(--destructive)",className:"mx-auto mb-4 text-foreground"}),e.jsx(s.Badge,{variant:x?"success":"destructive",className:"text-sm px-3 py-1 mb-2",children:x?"Passed":"Failed"}),r,e.jsx("h2",{className:"text-xl font-bold text-foreground",children:d})]}),e.jsxs("div",{className:"grid grid-cols-2 sm:grid-cols-4 gap-3 mb-8",children:[e.jsx(s.StatCard,{icon:e.jsx(i.CheckCircle2,{}),label:"Correct",description:"Questions answered right",value:`${l}/${j}`,accent:"var(--success)"}),e.jsx(s.StatCard,{icon:e.jsx(i.XCircle,{}),label:"Incorrect",description:"Questions to review",value:`${j-l}/${j}`,accent:"var(--destructive)"}),e.jsx(s.StatCard,{icon:e.jsx(i.Trophy,{}),label:"Score",description:"Overall percentage",value:`${N}%`,accent:"var(--palette-3)"}),e.jsx(s.StatCard,{icon:e.jsx(i.Clock,{}),label:"Time",description:"Total elapsed",value:s.formatDuration(o),accent:"var(--palette-1)"})]}),c&&m&&!S&&e.jsx("div",{className:"flex justify-center mb-8",children:e.jsxs(s.Button,{variant:"outline",onClick:m,children:[e.jsx(i.RotateCcw,{className:"size-4 mr-2"}),g]})})]})}),C&&e.jsxs(e.Fragment,{children:[e.jsx(s.Separator,{className:"my-6"}),e.jsx("h3",{className:"text-lg font-semibold text-foreground mb-4",children:"Question Review"}),e.jsx(A.AssessmentReview,{questions:f,sessionAnswers:a,showCorrectAnswers:!0})]})]})}function D({title:d,description:N,questions:x,timeLimitSeconds:l,passingScore:j,allowRetake:o=!0,onComplete:a,showReview:f=!0,questionMaterials:c,readOnly:m=!1,className:g,style:C}){const[r,S]=t.useState({tag:"intro"}),h=t.useRef(null),{timeElapsed:b,getFinalElapsed:v,reset:n}=q(r.tag==="quiz"),z=t.useRef(a);z.current=a,t.useEffect(()=>{var u;(u=h.current)==null||u.focus({preventScroll:!0})},[r.tag]);const R=t.useCallback(u=>{var M;const{correct:p,total:w,percentage:k}=s.scoreAssessment(x,u),E={answers:u,correct:p,total:w,percentage:k,passed:j!==void 0?k>=j:!0,timeElapsedSeconds:v()};S({tag:"results",result:E}),(M=z.current)==null||M.call(z,E)},[x,j,v]),B=t.useCallback(()=>{n(),S({tag:"intro"})},[n]);if(r.tag==="intro")return e.jsx("div",{ref:h,tabIndex:-1,className:s.cn("max-w-2xl mx-auto outline-none",g),style:C,children:e.jsx(V,{icon:e.jsx(i.Trophy,{className:"size-7 text-primary"}),title:d,description:N,questionCount:x.length,timeLimitSeconds:l,passingScore:j,startLabel:"Start Quiz",onStart:()=>S({tag:"quiz"}),readOnly:m})});if(r.tag==="quiz")return e.jsx("div",{ref:h,tabIndex:-1,className:s.cn("outline-none",g),style:C,children:e.jsx(A.QuizSession,{questions:x,onSubmit:R,timeElapsedSeconds:b,timeLimitSeconds:l,questionMaterials:c,readOnly:m})});const{result:T}=r;return e.jsx("div",{ref:h,tabIndex:-1,className:s.cn("max-w-2xl mx-auto outline-none",g),style:C,children:e.jsx(Y,{title:d,percentage:T.percentage,passed:T.passed,correct:T.correct,total:T.total,timeElapsedSeconds:T.timeElapsedSeconds,answers:T.answers,questions:x,allowRetake:o,onRetake:B,retakeLabel:"Retake Quiz",showReview:f,readOnly:m})})}const _=L.withProGate(D,"QuizModule");function X({decks:d=[],showShuffleToggle:N=!0,defaultShuffled:x=!1,allowMultiSelect:l=!0,onComplete:j,readOnly:o=!1,className:a,style:f}){const[c,m]=t.useState({tag:"setup"}),[g,C]=t.useState(new Set),[r,S]=t.useState(x),h=t.useRef(null),b=t.useRef(null);t.useEffect(()=>{var u;(u=b.current)==null||u.focus({preventScroll:!0})},[c.tag]);function v(u){C(p=>{const w=new Set(p);return w.has(u)?w.delete(u):(l||w.clear(),w.add(u)),w})}function n(){const u=d.filter(w=>g.has(w.uid)),p=u.flatMap(w=>w.cards);h.current=Date.now(),m({tag:"study",cards:p,deckUids:u.map(w=>w.uid),shuffled:r})}function z(){if(c.tag!=="study")return;const u=h.current?Math.floor((Date.now()-h.current)/1e3):0,p={totalCards:c.cards.length,decksStudied:c.deckUids.length,deckUids:c.deckUids,wasShuffled:c.shuffled,timeElapsedSeconds:u};m({tag:"completion",result:p}),j==null||j(p)}function R(){if(c.tag!=="completion")return;const p=d.filter(w=>c.result.deckUids.includes(w.uid)).flatMap(w=>w.cards);h.current=Date.now(),m({tag:"study",cards:p,deckUids:c.result.deckUids,shuffled:c.result.wasShuffled})}function B(){C(new Set),S(x),m({tag:"setup"})}if(c.tag==="setup")return e.jsx("div",{ref:b,tabIndex:-1,className:s.cn("max-w-2xl mx-auto outline-none",a),style:f,children:e.jsx(s.Card,{children:e.jsxs(s.CardContent,{className:"pt-8 pb-8",children:[e.jsxs("div",{className:"text-center mb-6",children:[e.jsx("div",{className:"mx-auto mb-4 w-14 h-14 rounded-full bg-primary/10 flex items-center justify-center",children:e.jsx(i.BookOpen,{className:"size-7 text-primary"})}),e.jsx("h2",{className:"text-2xl font-bold text-foreground mb-2",children:"Choose Your Decks"}),e.jsx("p",{className:"text-muted-foreground text-sm",children:l?"Select one or more decks to study":"Select a deck to study"})]}),e.jsx("div",{className:"grid sm:grid-cols-2 lg:grid-cols-3 gap-3 mb-6",children:d.map(u=>{const p=g.has(u.uid);return e.jsx(s.Card,{className:s.cn("cursor-pointer transition-all py-0",p?"border-primary ring-1 ring-primary":"hover:border-muted-foreground/30"),onClick:()=>v(u.uid),children:e.jsxs(s.CardContent,{className:"py-4",children:[e.jsxs("div",{className:"flex items-start justify-between mb-2",children:[e.jsx("h3",{className:"font-semibold text-foreground text-sm",children:u.title}),e.jsxs(s.Badge,{variant:"secondary",className:"text-xs shrink-0",children:[u.cards.length," cards"]})]}),u.description&&e.jsx("p",{className:"text-xs text-muted-foreground line-clamp-2",children:u.description})]})},u.uid)})}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[N&&e.jsxs(s.Button,{variant:r?"secondary":"outline",size:"sm",className:"gap-1.5",onClick:()=>S(u=>!u),children:[e.jsx(i.Shuffle,{className:"size-3.5"}),"Shuffle"]}),g.size>0&&e.jsxs("span",{className:"text-xs text-muted-foreground",children:[d.filter(u=>g.has(u.uid)).reduce((u,p)=>u+p.cards.length,0)," ","cards selected"]})]}),e.jsx(s.Button,{onClick:n,disabled:g.size===0||o,children:"Start Studying"})]})]})})});if(c.tag==="study"){const u=d.filter(p=>c.deckUids.includes(p.uid)).map(p=>p.title).join(", ");return e.jsx("div",{ref:b,tabIndex:-1,className:s.cn("outline-none",a),style:f,children:e.jsx(A.FlashcardStudySession,{cards:c.cards,title:u,shuffled:c.shuffled,onComplete:z,readOnly:o})})}const{result:T}=c;return e.jsx("div",{ref:b,tabIndex:-1,className:s.cn("max-w-2xl mx-auto outline-none",a),style:f,children:e.jsx(s.Card,{children:e.jsxs(s.CardContent,{className:"pt-8 pb-8",children:[e.jsxs("div",{className:"text-center mb-8",children:[e.jsxs("div",{className:"relative mx-auto mb-4",children:[e.jsx(s.ProgressRing,{value:100,size:120,strokeWidth:10,color:"var(--success)",className:"text-foreground",label:""}),e.jsx(i.CheckCircle2,{className:"size-8 text-success absolute inset-0 m-auto"})]}),e.jsx("h2",{className:"text-xl font-bold text-foreground mb-2",children:"Study Session Complete"}),e.jsx("p",{className:"text-muted-foreground text-sm",children:"Great work! Here's your session summary."})]}),e.jsxs("div",{className:"grid grid-cols-2 sm:grid-cols-4 gap-3 mb-8",children:[e.jsx(s.StatCard,{icon:e.jsx(i.Layers,{}),label:"Cards Studied",description:"Total cards reviewed",value:String(T.totalCards)}),e.jsx(s.StatCard,{icon:e.jsx(i.BookOpen,{}),label:"Decks",description:"Decks completed",value:String(T.decksStudied)}),e.jsx(s.StatCard,{icon:e.jsx(i.Clock,{}),label:"Time Spent",description:"Session duration",value:s.formatDuration(T.timeElapsedSeconds)}),e.jsx(s.StatCard,{icon:e.jsx(i.Shuffle,{}),label:"Shuffled",description:"Card order randomized",value:T.wasShuffled?"Yes":"No"})]}),e.jsxs("div",{className:"flex justify-center gap-3",children:[e.jsxs(s.Button,{variant:"outline",onClick:B,disabled:o,children:[e.jsx(i.ArrowLeft,{className:"size-4 mr-2"}),"Pick New Deck"]}),e.jsxs(s.Button,{onClick:R,disabled:o,children:[e.jsx(i.RotateCcw,{className:"size-4 mr-2"}),"Study Again"]})]})]})})})}const J=L.withProGate(X,"FlashcardLab");function K({courseTitle:d,curriculum:N,progress:x,items:l,initialItemUid:j,onItemComplete:o,onItemChange:a,sidebarCollapsed:f=!1,readOnly:c=!1,className:m,style:g}){const C=t.useRef(null),r=t.useMemo(()=>A.flattenLeaves(N),[N]),S=t.useMemo(()=>new Map(l.map(y=>[y.uid,y])),[l]),[h,b]=t.useState(j??r[0]??""),[v,n]=t.useState(!f),[z,R]=t.useState(()=>x?new Set(x.filter(y=>y.isCompleted).map(y=>y.resourceUid)):new Set),B=r.indexOf(h),T=B>0,u=B<r.length-1,p=z.has(h),w=r.length>0?Math.round(r.filter(y=>z.has(y)).length/r.length*100):0,k=S.get(h),E=t.useMemo(()=>(k==null?void 0:k.type)==="video"?{src:k.src,poster:k.poster,title:k.title}:null,[k]);t.useEffect(()=>{var y;(y=C.current)==null||y.focus({preventScroll:!0})},[h]);const M=t.useRef(a);M.current=a;const U=t.useRef(o);U.current=o;const I=t.useCallback(y=>{var P;b(y),(P=M.current)==null||P.call(M,y)},[]),G=t.useCallback(y=>{(!y.children||y.children.length===0)&&I(y.uid)},[I]),F=t.useCallback(()=>{var y;R(P=>new Set(P).add(h)),(y=U.current)==null||y.call(U,h)},[h]),Q=t.useCallback(()=>{const y=r.indexOf(h);y<r.length-1&&I(r[y+1])},[r,h,I]),$=t.useCallback(()=>{const y=r.indexOf(h);y>0&&I(r[y-1])},[r,h,I]),W=t.useMemo(()=>{const y=new Map((x??[]).map(P=>[P.resourceUid,P]));for(const P of z)y.has(P)?y.set(P,{...y.get(P),isCompleted:!0}):y.set(P,{resourceUid:P,isCompleted:!0});return Array.from(y.values())},[x,z]),H=u?S.get(r[B+1]):null;return e.jsxs("div",{className:s.cn("flex h-full overflow-hidden",m),style:g,children:[e.jsx(s.Drawer,{open:v,onOpenChange:n,side:"left",children:e.jsxs(s.DrawerContent,{size:"sm",scrollLock:!1,children:[e.jsxs(s.DrawerHeader,{className:"flex-row items-center justify-between",children:[e.jsx(s.DrawerTitle,{className:"text-xs font-semibold text-muted-foreground uppercase tracking-wide",children:"Course"}),e.jsx(s.DrawerClose,{})]}),e.jsx(s.DrawerBody,{className:"px-2 pb-2",children:e.jsx(A.CourseOutline,{items:N,progress:W,courseTitle:d,activeItemUid:h,onItemClick:G,readOnly:c})})]})}),e.jsxs("div",{className:"flex-1 flex flex-col min-w-0 overflow-hidden",children:[e.jsxs("div",{className:"flex items-center gap-2 px-4 py-2 border-b border-border bg-background shrink-0",children:[e.jsx(s.Button,{variant:"ghost",size:"sm",className:"size-7 p-0 mr-1",onClick:()=>n(!0),children:e.jsx(i.PanelLeft,{className:"size-4"})}),e.jsx("div",{className:"flex-1 min-w-0",children:e.jsx("span",{className:"text-sm font-semibold text-foreground truncate block",children:(k==null?void 0:k.title)??"Select an item"})}),e.jsxs("span",{className:"text-xs text-muted-foreground shrink-0",children:[B+1," / ",r.length]})]}),e.jsx("div",{ref:C,tabIndex:-1,className:"flex-1 overflow-y-auto p-6 outline-none",children:k?Z(k,c,F,p,Q,u,H,E):e.jsx(s.EmptyState,{title:"No content selected",description:"Select an item from the course outline to get started."})}),e.jsx("div",{className:"shrink-0 border-t border-border bg-background px-4 py-3",children:e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("div",{className:"flex items-center gap-2 mb-1",children:e.jsxs("span",{className:"text-xs text-muted-foreground",children:[w,"% complete"]})}),e.jsx(s.Progress,{value:w,size:"sm"})]}),e.jsxs("div",{className:"flex items-center gap-2 shrink-0",children:[!p&&k&&e.jsxs(s.Button,{size:"sm",variant:"outline",onClick:F,disabled:c,children:[e.jsx(i.Check,{className:"size-3.5 mr-1"}),"Complete"]}),e.jsx(s.Button,{size:"sm",variant:"ghost",onClick:$,disabled:!T,children:e.jsx(i.ChevronLeft,{className:"size-4"})}),e.jsx(s.Button,{size:"sm",variant:"ghost",onClick:Q,disabled:!u,children:e.jsx(i.ChevronRight,{className:"size-4"})})]})]})})]})]})}function Z(d,N,x,l,j,o,a,f){switch(d.type){case"lesson":return e.jsx(A.LessonPage,{title:d.title,blocks:d.blocks,isCompleted:l,onMarkComplete:x,onNextLesson:o?j:void 0,nextLessonTitle:a==null?void 0:a.title,readOnly:N});case"video":return e.jsx(A.LecturePlayer,{video:f??{src:"",title:d.title},onComplete:l?void 0:x});case"quiz":return e.jsx(A.PracticeQuiz,{questions:d.questions,instantFeedback:!0,allowRetry:!0,readOnly:N});default:return e.jsx(s.EmptyState,{title:"Unknown content type",description:"This content type is not supported."})}}const O=L.withProGate(K,"CoursePlayer");function ee({title:d,description:N,instructions:x,questions:l=[],timeLimitSeconds:j,passingScore:o,allowBackNavigation:a=!0,autoSubmitOnTimeout:f=!0,timeWarningThreshold:c,allowRetake:m=!1,showReview:g=!0,onComplete:C,readOnly:r=!1,className:S,style:h}){const[b,v]=t.useState({tag:"intro"}),n=t.useRef(null),{timeElapsed:z,reset:R}=q(b.tag==="exam"),B=t.useRef(C);B.current=C,t.useEffect(()=>{var w;(w=n.current)==null||w.focus({preventScroll:!0})},[b.tag]);const T=t.useCallback((w,k)=>{var G;const{correct:E,total:M,percentage:U}=s.scoreAssessment(l,w),I={answers:w,correct:E,total:M,percentage:U,passed:o!==void 0?U>=o:!0,timeElapsedSeconds:k.timeElapsedSeconds,wasAutoSubmitted:k.wasAutoSubmitted};v({tag:"results",result:I}),(G=B.current)==null||G.call(B,I)},[l,o]),u=t.useCallback(()=>{R(),v({tag:"intro"})},[R]);if(b.tag==="intro")return e.jsx("div",{ref:n,tabIndex:-1,className:s.cn("max-w-2xl mx-auto outline-none",S),style:h,children:e.jsx(V,{icon:e.jsx(i.ShieldCheck,{className:"size-7 text-primary"}),title:d,description:N,questionCount:l.length,timeLimitSeconds:j,passingScore:o,startLabel:"Begin Exam",onStart:()=>v({tag:"exam"}),readOnly:r,children:x&&e.jsx(s.Alert,{className:"text-left mb-6",children:e.jsx(s.AlertDescription,{children:x})})})});if(b.tag==="exam")return e.jsx("div",{ref:n,tabIndex:-1,className:s.cn("outline-none",S),style:h,children:e.jsx(A.ExamSession,{questions:l,timeLimitSeconds:j,timeElapsedSeconds:z,autoSubmitOnTimeout:f,timeWarningThreshold:c,allowBackNavigation:a,confirmBeforeSubmit:!0,examTitle:d,onSubmit:T,readOnly:r})});const{result:p}=b;return e.jsx("div",{ref:n,tabIndex:-1,className:s.cn("max-w-2xl mx-auto outline-none",S),style:h,children:e.jsx(Y,{title:d,percentage:p.percentage,passed:p.passed,correct:p.correct,total:p.total,timeElapsedSeconds:p.timeElapsedSeconds,answers:p.answers,questions:l,allowRetake:m,onRetake:u,retakeLabel:"Retake Exam",showReview:g,readOnly:r,extraBadges:p.wasAutoSubmitted?e.jsx(s.Badge,{variant:"outline",className:"text-sm px-3 py-1 mb-2 ml-2",children:"Auto-submitted"}):null})})}const se=L.withProGate(ee,"ExamModule");function te({title:d,description:N,questions:x=[],requireAll:l=!1,showProgress:j=!0,thankYouTitle:o="Thank You!",thankYouMessage:a,onComplete:f,allowRestart:c=!1,readOnly:m=!1,className:g,style:C}){const[r,S]=t.useState({tag:"intro"}),h=t.useRef(null),b=t.useRef(null);t.useEffect(()=>{var B;(B=b.current)==null||B.focus({preventScroll:!0})},[r.tag]);function v(B){const T=h.current?Math.floor((Date.now()-h.current)/1e3):0,u={answers:B,totalQuestions:x.length,answeredCount:B.length,timeElapsedSeconds:T};S({tag:"thankYou",result:u}),f==null||f(u)}function n(){h.current=null,S({tag:"intro"})}function z(){h.current=Date.now(),S({tag:"survey"})}if(r.tag==="intro")return e.jsx("div",{ref:b,tabIndex:-1,className:s.cn("max-w-2xl mx-auto outline-none",g),style:C,children:e.jsx(s.Card,{children:e.jsxs(s.CardContent,{className:"pt-8 pb-8 text-center",children:[e.jsx("div",{className:"mx-auto mb-4 w-14 h-14 rounded-full bg-primary/10 flex items-center justify-center",children:e.jsx(i.ClipboardList,{className:"size-7 text-primary"})}),e.jsx("h2",{className:"text-2xl font-bold text-foreground mb-2",children:d}),N&&e.jsx("p",{className:"text-muted-foreground mb-6 max-w-md mx-auto",children:N}),e.jsx("div",{className:"flex flex-wrap justify-center gap-2 mb-8",children:e.jsxs(s.Badge,{variant:"outline",className:"gap-1.5",children:[e.jsx(i.HelpCircle,{className:"size-3.5"}),x.length," questions"]})}),e.jsxs(s.Button,{size:"lg",onClick:z,disabled:m,children:[e.jsx(i.Play,{className:"size-4 mr-2"}),"Begin Survey"]})]})})});if(r.tag==="survey")return e.jsx("div",{ref:b,tabIndex:-1,className:s.cn("outline-none",g),style:C,children:e.jsx(A.SurveyForm,{title:d,questions:x,requireAll:l,showProgress:j,onSubmit:v,readOnly:m})});const{result:R}=r;return e.jsx("div",{ref:b,tabIndex:-1,className:s.cn("max-w-2xl mx-auto outline-none",g),style:C,children:e.jsx(s.Card,{children:e.jsxs(s.CardContent,{className:"pt-8 pb-8 text-center",children:[e.jsx("div",{className:"mx-auto mb-4 w-14 h-14 rounded-full bg-success/10 flex items-center justify-center",children:e.jsx(i.CheckCircle2,{className:"size-7 text-success"})}),e.jsx("h2",{className:"text-2xl font-bold text-foreground mb-2",children:o}),e.jsx("p",{className:"text-muted-foreground mb-6 max-w-md mx-auto",children:a??"Your responses have been recorded. Thank you for your feedback!"}),e.jsxs("div",{className:"grid grid-cols-2 gap-3 max-w-sm mx-auto mb-6",children:[e.jsx(s.StatCard,{icon:e.jsx(i.HelpCircle,{}),label:"Answered",description:"Questions completed",value:`${R.answeredCount}/${R.totalQuestions}`}),e.jsx(s.StatCard,{icon:e.jsx(i.Clock,{}),label:"Time",description:"Total elapsed",value:s.formatDuration(R.timeElapsedSeconds)})]}),c&&e.jsxs(s.Button,{variant:"outline",onClick:n,disabled:m,children:[e.jsx(i.RotateCcw,{className:"size-4 mr-2"}),"Take Again"]})]})})})}const re=L.withProGate(te,"SurveyModule");function ne({courseTitle:d,gradeItems:N=[],categories:x,overallGrade:l,showWeights:j,progressData:o,reviewData:a,readOnly:f=!1,className:c,style:m}){const[g,C]=t.useState(null),r=t.useRef(null);t.useEffect(()=>{var n;(n=r.current)==null||n.focus({preventScroll:!0})},[g]);function S(n){a!=null&&a[n.uid]&&C(n.uid)}function h(){C(null)}const b=g?N.find(n=>n.uid===g):null,v=g?a==null?void 0:a[g]:null;return e.jsxs("div",{ref:r,tabIndex:-1,className:s.cn("outline-none",c),style:m,children:[e.jsxs("div",{className:"flex items-center justify-between mb-6",children:[e.jsxs("div",{children:[d&&e.jsx("h2",{className:"text-xl font-bold text-foreground",children:d}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Grade Center"})]}),l&&e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(s.GradeIndicator,{percentage:l.percentage,letterGrade:l.letterGrade,size:"medium"}),e.jsxs("div",{className:"text-right",children:[e.jsxs("div",{className:"text-sm font-medium text-foreground",children:[l.pointsEarned,"/",l.pointsPossible," pts"]}),l.letterGrade&&e.jsx("div",{className:"text-xs text-muted-foreground",children:l.letterGrade})]})]})]}),e.jsx(s.Separator,{className:"mb-6"}),b&&v?e.jsxs("div",{children:[e.jsxs(s.Button,{variant:"ghost",size:"sm",onClick:h,className:"mb-4",children:[e.jsx(i.ArrowLeft,{className:"size-4 mr-1.5"}),"Back to Grades"]}),e.jsx(s.Card,{className:"mb-4",children:e.jsxs(s.CardContent,{className:"py-3 px-4",children:[e.jsx("h3",{className:"font-semibold text-foreground",children:b.name}),b.score!==null&&e.jsxs("p",{className:"text-sm text-muted-foreground",children:["Score: ",b.score,"/",b.maxScore," (",Math.round(b.score/b.maxScore*100),"%)"]})]})}),e.jsx(A.AssessmentReview,{questions:v.questions,sessionAnswers:v.sessionAnswers,score:v.score,showCorrectAnswers:!0})]}):e.jsxs(s.Tabs,{defaultValue:"grades",children:[o&&e.jsxs(s.TabsList,{className:"mb-6",children:[e.jsxs(s.TabsTrigger,{value:"grades",children:[e.jsx(i.BookOpen,{className:"size-4 mr-1.5"}),"Grades"]}),e.jsxs(s.TabsTrigger,{value:"progress",children:[e.jsx(i.BarChart3,{className:"size-4 mr-1.5"}),"Progress"]})]}),e.jsx(s.TabsContent,{value:"grades",children:e.jsx(A.GradebookTable,{items:N,categories:x,overallGrade:l,showWeights:j,onItemClick:S,readOnly:f})}),o&&e.jsx(s.TabsContent,{value:"progress",children:e.jsx(A.ProgressDashboard,{overallProgress:o.overallProgress,totalTimeSpent:o.totalTimeSpent,modules:o.modules,recentActivity:o.recentActivity,streak:o.streak,achievements:o.achievements})})]})]})}const ae=L.withProGate(ne,"GradeCenterModule"),le={text:"Text Entry",file:"File Upload",url:"URL Submission"};function ie({title:d,instructions:N,dueDate:x,maxScore:l,submissionTypes:j=["text","file"],fileConstraints:o,rubric:a,existingSubmission:f,status:c="not_started",grade:m,onSubmit:g,onComplete:C,onSaveDraft:r,readOnly:S=!1,className:h,style:b}){const v=c==="submitted"||c==="graded"?{tag:"confirmation",submission:f??{}}:{tag:"instructions"},[n,z]=t.useState(v),R=t.useRef(null);t.useEffect(()=>{var k;(k=R.current)==null||k.focus({preventScroll:!0})},[n.tag]);const B=t.useMemo(()=>Array.isArray(a)?a.reduce((k,E)=>k+Math.max(...E.levels.map(M=>M.points)),0):0,[a]);function T(k){g==null||g(k),C==null||C({submission:k,status:"submitted"}),z({tag:"confirmation",submission:k})}function u(k){r==null||r(k),C==null||C({submission:k,status:"draft"})}const p=c==="not_started"||c==="draft"||c==="resubmit";if(n.tag==="instructions")return e.jsx("div",{ref:R,tabIndex:-1,className:s.cn("max-w-2xl mx-auto outline-none",h),style:b,children:e.jsx(s.Card,{children:e.jsxs(s.CardContent,{className:"pt-8 pb-8",children:[e.jsxs("div",{className:"text-center mb-6",children:[e.jsx("div",{className:"mx-auto mb-4 w-14 h-14 rounded-full bg-primary/10 flex items-center justify-center",children:e.jsx(i.FileEdit,{className:"size-7 text-primary"})}),e.jsx("h2",{className:"text-2xl font-bold text-foreground mb-2",children:d})]}),e.jsxs("div",{className:"flex flex-wrap justify-center gap-2 mb-6",children:[x&&e.jsx(s.DueDateDisplay,{dueDate:x,size:"small"}),l!==void 0&&e.jsxs(s.Badge,{variant:"outline",className:"gap-1.5",children:[e.jsx(i.CheckCircle2,{className:"size-3.5"}),l," points"]}),e.jsxs(s.Badge,{variant:"outline",className:"gap-1.5",children:[e.jsx(i.Paperclip,{className:"size-3.5"}),j.map(k=>le[k]).join(", ")]}),e.jsx(s.StatusBadge,{status:c})]}),e.jsx(s.Separator,{className:"my-6"}),e.jsx("div",{className:"prose prose-sm text-foreground mb-6",children:N}),Array.isArray(a)&&a.length>0&&e.jsxs(e.Fragment,{children:[e.jsx(s.Separator,{className:"my-6"}),e.jsx(A.RubricView,{criteria:a,maxScore:B})]}),p&&!S&&e.jsx("div",{className:"text-center mt-8",children:e.jsxs(s.Button,{size:"lg",onClick:()=>z({tag:"work"}),disabled:S,children:[e.jsx(i.Play,{className:"size-4 mr-2"}),"Start Assignment"]})})]})})});if(n.tag==="work")return e.jsxs("div",{ref:R,tabIndex:-1,className:s.cn("outline-none",h),style:b,children:[e.jsxs(s.Button,{variant:"ghost",size:"sm",onClick:()=>z({tag:"instructions"}),className:"mb-4",children:[e.jsx(i.ArrowLeft,{className:"size-4 mr-1.5"}),"Back to Instructions"]}),e.jsx(A.AssignmentSubmission,{title:d,instructions:N,dueDate:x,maxScore:l,status:c,submissionTypes:j,existingSubmission:f,fileConstraints:o,grade:m,onSubmit:T,onSaveDraft:u,readOnly:S})]});const{submission:w}=n;return e.jsx("div",{ref:R,tabIndex:-1,className:s.cn("max-w-2xl mx-auto outline-none",h),style:b,children:e.jsx(s.Card,{children:e.jsxs(s.CardContent,{className:"pt-8 pb-8",children:[e.jsxs("div",{className:"text-center mb-6",children:[e.jsx("div",{className:"mx-auto mb-4 w-14 h-14 rounded-full bg-success/10 flex items-center justify-center",children:e.jsx(i.CheckCircle2,{className:"size-7 text-success"})}),e.jsx("h2",{className:"text-xl font-bold text-foreground mb-2",children:c==="graded"?"Assignment Graded":"Submission Received"}),e.jsxs("div",{className:"flex justify-center gap-2 mb-4",children:[e.jsx(s.StatusBadge,{status:c}),x&&e.jsx(s.DueDateDisplay,{dueDate:x,size:"small"})]})]}),c==="graded"&&m&&e.jsxs("div",{className:"text-center mb-6",children:[e.jsx(s.GradeIndicator,{percentage:l?Math.round(m.score/l*100):0,size:"large"}),e.jsxs("p",{className:"text-sm text-muted-foreground mt-2",children:[m.score,"/",l," points"]}),m.feedback&&e.jsx(s.Alert,{className:"text-left mt-4",children:e.jsx(s.AlertDescription,{children:m.feedback})}),Array.isArray(a)&&m.rubricLevels&&e.jsxs(e.Fragment,{children:[e.jsx(s.Separator,{className:"my-6"}),e.jsx(A.RubricView,{criteria:a,selectedLevels:m.rubricLevels,totalScore:m.score,maxScore:B})]})]}),e.jsx(s.Separator,{className:"my-6"}),e.jsx("h3",{className:"text-sm font-semibold text-foreground mb-3",children:"What You Submitted"}),e.jsxs("div",{className:"space-y-2 text-sm text-muted-foreground",children:[w.textContent&&e.jsxs("div",{className:"flex items-start gap-2",children:[e.jsx(i.FileText,{className:"size-4 mt-0.5 shrink-0"}),e.jsx("span",{className:"line-clamp-2",children:w.textContent.replace(/<[^>]*>/g,"")})]}),w.files&&w.files.length>0&&e.jsxs("div",{className:"flex items-start gap-2",children:[e.jsx(i.Paperclip,{className:"size-4 mt-0.5 shrink-0"}),e.jsxs("span",{children:[w.files.length," file",w.files.length!==1?"s":""," uploaded"]})]}),w.url&&e.jsxs("div",{className:"flex items-start gap-2",children:[e.jsx(i.Link,{className:"size-4 mt-0.5 shrink-0"}),e.jsx("span",{className:"truncate",children:w.url})]})]}),p&&!S&&e.jsx("div",{className:"text-center mt-8",children:e.jsxs(s.Button,{variant:"outline",onClick:()=>z({tag:"work"}),children:[e.jsx(i.FileEdit,{className:"size-4 mr-2"}),"Edit Submission"]})})]})})})}const ce=L.withProGate(ie,"AssignmentModule");function oe({courseTitle:d,recipientName:N,organizationName:x,organizationLogo:l,signatory:j,completionDate:o,certificateVariant:a="modern",requirements:f,overallProgress:c,onRequirementClick:m,onComplete:g,readOnly:C=!1,className:r,style:S}){const{allComplete:h,completedCount:b,derivedProgress:v}=t.useMemo(()=>{const p=f.filter(E=>E.completed).length,w=f.length,k=w>0?Math.round(p/w*100):0;return{allComplete:p===w,completedCount:p,derivedProgress:k}},[f]),n=c??v,[z,R]=t.useState({tag:"requirements"}),B=t.useRef(null),T=t.useRef(!1);t.useEffect(()=>{var p;(p=B.current)==null||p.focus({preventScroll:!0})},[z.tag]);const u=t.useRef(g);return u.current=g,t.useEffect(()=>{var p;z.tag==="certificate"&&!T.current&&(T.current=!0,(p=u.current)==null||p.call(u))},[z.tag]),z.tag==="requirements"?e.jsx("div",{ref:B,tabIndex:-1,className:s.cn("max-w-2xl mx-auto outline-none",r),style:S,children:e.jsx(s.Card,{children:e.jsxs(s.CardContent,{className:"pt-8 pb-8",children:[e.jsxs("div",{className:"text-center mb-6",children:[e.jsx(s.ProgressRing,{value:n,size:100,strokeWidth:8,color:h?"var(--success)":"var(--primary)",className:"mx-auto mb-4 text-foreground"}),e.jsx("h2",{className:"text-xl font-bold text-foreground mb-2",children:d}),e.jsx("p",{className:"text-sm text-muted-foreground",children:h?"All requirements met — your certificate is ready!":`${b} of ${f.length} requirements complete`})]}),e.jsx(A.RequirementsChecklist,{requirements:f,onRequirementClick:C?void 0:m,className:"mb-6"}),h&&e.jsx("div",{className:"text-center mt-6",children:e.jsxs(s.Button,{size:"lg",onClick:()=>R({tag:"certificate"}),disabled:C,children:[e.jsx(i.Award,{className:"size-4 mr-2"}),"View Certificate"]})})]})})}):e.jsxs("div",{ref:B,tabIndex:-1,className:s.cn("outline-none",r),style:S,children:[e.jsxs(s.Button,{variant:"ghost",size:"sm",onClick:()=>R({tag:"requirements"}),className:"mb-4",children:[e.jsx(i.ArrowLeft,{className:"size-4 mr-1.5"}),"Back to Requirements"]}),e.jsxs("div",{className:"text-center mb-8",children:[e.jsx("div",{className:"mx-auto mb-4 w-14 h-14 rounded-full bg-success/10 flex items-center justify-center",children:e.jsx(i.PartyPopper,{className:"size-7 text-success"})}),e.jsx("h2",{className:"text-2xl font-bold text-foreground mb-2",children:"Congratulations!"}),e.jsxs("p",{className:"text-muted-foreground",children:["You've completed all requirements for"," ",e.jsx("span",{className:"font-medium text-foreground",children:d})]})]}),e.jsx(A.CertificateViewer,{recipientName:N,courseTitle:d,completionDate:o??new Date().toISOString().split("T")[0],organizationName:x,organizationLogo:l,signatory:j,variant:a,showActions:!0})]})}const de=L.withProGate(oe,"CertificateModule");function ue({forumTitle:d,topics:N=[],currentUser:x,threads:l={},onCreateTopic:j,onReply:o,onToggleLike:a,onMarkAnswer:f,onTopicOpen:c,readOnly:m,className:g,style:C}){const[r,S]=t.useState(null),[h,b]=t.useState(""),[v,n]=t.useState("newest"),z=t.useRef(null);t.useEffect(()=>{var M;(M=z.current)==null||M.focus({preventScroll:!0})},[r]);const R=t.useRef(c);R.current=c;const B=t.useCallback(M=>{var U;S(M),(U=R.current)==null||U.call(R,M)},[]),T=t.useCallback(()=>{S(null)},[]),u=r?l[r]:null,p=r?N.find(M=>M.uid===r):null,w=t.useCallback((M,U)=>{r&&(o==null||o(r,M,U))},[r,o]),k=t.useCallback(M=>{r&&(a==null||a(r,M))},[r,a]),E=t.useCallback(M=>{r&&(f==null||f(r,M))},[r,f]);return e.jsx("div",{ref:z,tabIndex:-1,className:s.cn("outline-none",g),style:C,children:r&&u?e.jsxs("div",{children:[e.jsxs(s.Button,{variant:"ghost",size:"sm",onClick:T,className:"mb-4",children:[e.jsx(i.ArrowLeft,{className:"size-4 mr-1.5"}),"Back to Topics"]}),e.jsx(A.DiscussionThread,{title:(p==null?void 0:p.title)??"",rootPost:u.rootPost,replies:u.replies,currentUser:x,onReply:w,onToggleLike:a?k:void 0,onMarkAnswer:f?E:void 0,readOnly:m})]}):r&&!u?e.jsxs("div",{children:[e.jsxs(s.Button,{variant:"ghost",size:"sm",onClick:T,className:"mb-4",children:[e.jsx(i.ArrowLeft,{className:"size-4 mr-1.5"}),"Back to Topics"]}),e.jsx(s.EmptyState,{title:"No discussion yet",description:"Be the first to start this conversation."})]}):e.jsx(A.ForumBoard,{title:d,topics:N,currentUser:x,onTopicClick:B,onCreateTopic:j,sortOrder:v,onSortChange:n,searchQuery:h,onSearchChange:b,readOnly:m})})}const xe=L.withProGate(ue,"DiscussionModule");function me({studentName:d,overallProgress:N,totalTimeSpent:x,modules:l,recentActivity:j,streak:o,achievements:a,enrolledCourses:f,onCourseClick:c,announcements:m=[],onAnnouncementSelect:g,onMarkRead:C,readOnly:r=!1,className:S,style:h}){const b=t.useRef(null);t.useEffect(()=>{var n;(n=b.current)==null||n.focus({preventScroll:!0})},[]);const v=m.filter(n=>!n.isRead).length;return e.jsxs("div",{ref:b,tabIndex:-1,className:s.cn("outline-none",S),style:h,children:[e.jsxs("div",{className:"flex items-center justify-between mb-6",children:[e.jsxs("h2",{className:"text-xl font-bold text-foreground",children:["Welcome back, ",d]}),e.jsx(s.ProgressRing,{value:N,size:48,strokeWidth:4})]}),e.jsx(s.Separator,{className:"mb-6"}),e.jsxs(s.Tabs,{defaultValue:"overview",children:[e.jsxs(s.TabsList,{className:"mb-6",children:[e.jsxs(s.TabsTrigger,{value:"overview",children:[e.jsx(i.BarChart3,{className:"size-4 mr-1.5"}),"Overview"]}),e.jsxs(s.TabsTrigger,{value:"courses",children:[e.jsx(i.BookOpen,{className:"size-4 mr-1.5"}),"My Courses"]}),e.jsxs(s.TabsTrigger,{value:"announcements",children:[e.jsx(i.Bell,{className:"size-4 mr-1.5"}),"Announcements",v>0&&e.jsx("span",{className:"ml-1.5 inline-flex items-center justify-center rounded-full bg-primary text-primary-foreground text-xs font-medium min-w-5 h-5 px-1.5",children:v})]})]}),e.jsx(s.TabsContent,{value:"overview",children:e.jsx(A.ProgressDashboard,{overallProgress:N,totalTimeSpent:x,modules:l,recentActivity:j,streak:o,achievements:a})}),e.jsx(s.TabsContent,{value:"courses",children:e.jsx(A.CourseCatalog,{courses:f,onCourseClick:n=>!r&&c(n.uid),showSearch:!0,viewMode:"grid",readOnly:r})}),e.jsx(s.TabsContent,{value:"announcements",children:e.jsx(A.AnnouncementFeed,{announcements:m,onSelect:g,onMarkRead:C,readOnly:r})})]})]})}const he=L.withProGate(me,"StudentDashboardModule");function fe({title:d,courses:N=[],categories:x=[],enrollmentData:l,onEnroll:j,onCourseOpen:o,readOnly:a=!1,className:f,style:c}){var b;const[m,g]=t.useState({tag:"browse"}),C=t.useRef(null);t.useEffect(()=>{var v;(v=C.current)==null||v.focus({preventScroll:!0})},[m.tag]);function r(v){l!=null&&l[v]?g({tag:"enroll",courseUid:v}):o==null||o(v)}function S(){g({tag:"browse"})}function h(v){j(v),g({tag:"browse"})}return e.jsxs("div",{ref:C,tabIndex:-1,className:s.cn("outline-none",f),style:c,children:[d&&m.tag==="browse"&&e.jsx("h2",{className:"text-xl font-bold text-foreground mb-4",children:d}),m.tag==="enroll"?e.jsxs("div",{children:[e.jsxs(s.Button,{variant:"ghost",size:"sm",onClick:S,className:"mb-4",children:[e.jsx(i.ArrowLeft,{className:"size-4 mr-1.5"}),"Back to Catalog"]}),l!=null&&l[m.courseUid]?e.jsx(A.EnrollmentWizard,{course:l[m.courseUid].course,prerequisites:l[m.courseUid].prerequisites,onEnroll:h,onCancel:S}):e.jsx(s.Card,{children:e.jsxs(s.CardContent,{className:"pt-6",children:[e.jsx("h3",{className:"text-lg font-semibold text-foreground mb-2",children:((b=N.find(v=>v.uid===m.courseUid))==null?void 0:b.title)??"Course"}),e.jsx("p",{className:"text-sm text-muted-foreground mb-4",children:"Enrollment details are loading. You can enroll directly below."}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(s.Button,{variant:"outline",onClick:S,children:"Cancel"}),e.jsx(s.Button,{onClick:()=>h(m.courseUid),disabled:a,children:"Enroll Now"})]})]})})]}):e.jsx(A.CourseCatalog,{courses:N,categories:x,onCourseClick:v=>r(v.uid),onEnroll:v=>r(v.uid),readOnly:a})]})}const je=L.withProGate(fe,"CourseCatalogModule");function ge({student:d,enrolledCourses:N=[],achievements:x=[],certificates:l=[],stats:j,onCourseClick:o,certificateData:a,readOnly:f=!1,className:c,style:m}){const[g,C]=t.useState(null),r=t.useRef(null);t.useEffect(()=>{var n;(n=r.current)==null||n.focus({preventScroll:!0})},[g]);function S(n){f||a!=null&&a[n]&&C(n)}function h(){C(null)}const b=g?a==null?void 0:a[g]:null,v=g?l.find(n=>n.uid===g):null;return e.jsxs("div",{ref:r,tabIndex:-1,className:s.cn("outline-none",c),style:m,children:[e.jsxs("div",{className:"flex items-center gap-4 mb-6",children:[e.jsx(s.UserAvatar,{displayName:d.displayName,avatarUrl:d.avatarUrl,size:"medium"}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[e.jsx("h2",{className:"text-xl font-bold text-foreground",children:d.displayName}),d.role&&e.jsx(s.Badge,{variant:"secondary",children:d.role})]}),d.email&&e.jsx("p",{className:"text-sm text-muted-foreground",children:d.email})]})]}),e.jsx(s.Separator,{className:"mb-6"}),v&&b?e.jsxs("div",{children:[e.jsxs(s.Button,{variant:"ghost",size:"sm",onClick:h,className:"mb-4",children:[e.jsx(i.ArrowLeft,{className:"size-4 mr-1.5"}),"Back to Profile"]}),e.jsx(A.CertificateViewer,{...b,showActions:!0})]}):e.jsxs(s.Tabs,{defaultValue:"profile",children:[e.jsxs(s.TabsList,{className:"mb-6",children:[e.jsxs(s.TabsTrigger,{value:"profile",children:[e.jsx(i.User,{className:"size-4 mr-1.5"}),"Profile"]}),e.jsxs(s.TabsTrigger,{value:"courses",children:[e.jsx(i.BookOpen,{className:"size-4 mr-1.5"}),"Courses"]}),e.jsxs(s.TabsTrigger,{value:"achievements",children:[e.jsx(i.Trophy,{className:"size-4 mr-1.5"}),"Achievements"]}),e.jsxs(s.TabsTrigger,{value:"certificates",children:[e.jsx(i.Award,{className:"size-4 mr-1.5"}),"Certificates"]})]}),e.jsx(s.TabsContent,{value:"profile",children:e.jsx(A.StudentProfile,{student:d,enrolledCourses:N,achievements:x,stats:j,onCourseClick:o,showCourses:!1,showAchievements:!1,readOnly:!0})}),e.jsx(s.TabsContent,{value:"courses",children:N.length>0?e.jsx(s.Card,{children:e.jsx(s.CardContent,{className:"p-0 divide-y divide-border",children:N.map(n=>e.jsxs("div",{className:s.cn("flex items-center gap-3 px-4 py-3 transition-colors",o&&!f&&"cursor-pointer hover:bg-muted/50"),onClick:o&&!f?()=>o(n.uid):void 0,children:[e.jsx(s.ProgressRing,{value:n.progress,size:32,strokeWidth:3}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("p",{className:"text-sm font-medium text-foreground truncate",children:n.title}),n.lastAccessedAt&&e.jsx("p",{className:"text-xs text-muted-foreground",children:s.formatTimestamp(n.lastAccessedAt)})]}),e.jsxs("span",{className:"text-xs text-muted-foreground whitespace-nowrap",children:[Math.round(n.progress),"%"]})]},n.uid))})}):e.jsxs("div",{className:"py-12 text-center",children:[e.jsx(i.BookOpen,{className:"size-10 text-muted-foreground mx-auto mb-3"}),e.jsx("p",{className:"text-sm font-medium text-foreground",children:"No courses yet"}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"Enrolled courses will appear here."})]})}),e.jsx(s.TabsContent,{value:"achievements",children:x.length>0?e.jsx("div",{className:"grid grid-cols-2 sm:grid-cols-3 lg:grid-cols-4 gap-2",children:x.map(n=>e.jsx(s.AchievementBadge,{title:n.name,description:n.description,icon:n.iconUrl?e.jsx("img",{src:n.iconUrl,alt:n.name,className:"w-12 h-12"}):void 0,earnedDate:n.earnedAt},n.uid))}):e.jsxs("div",{className:"py-12 text-center",children:[e.jsx(i.Trophy,{className:"size-10 text-muted-foreground mx-auto mb-3"}),e.jsx("p",{className:"text-sm font-medium text-foreground",children:"No achievements yet"}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"Achievements will appear here as they are earned."})]})}),e.jsx(s.TabsContent,{value:"certificates",children:l.length>0?e.jsx(s.Card,{children:e.jsx(s.CardContent,{className:"p-0 divide-y divide-border",children:l.map(n=>e.jsxs("div",{className:s.cn("flex items-center gap-3 px-4 py-3 transition-colors",(a==null?void 0:a[n.uid])&&!f&&"cursor-pointer hover:bg-muted/50"),onClick:a!=null&&a[n.uid]&&!f?()=>S(n.uid):void 0,children:[e.jsx("div",{className:"w-9 h-9 rounded-lg bg-primary/10 flex items-center justify-center text-primary",children:e.jsx(i.Award,{size:20})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("p",{className:"text-sm font-medium text-foreground truncate",children:n.courseName}),e.jsxs("p",{className:"text-xs text-muted-foreground",children:["Issued"," ",new Date(n.issuedAt).toLocaleDateString()]})]}),(a==null?void 0:a[n.uid])&&e.jsx(s.Badge,{variant:"secondary",className:"text-xs",children:"View"})]},n.uid))})}):e.jsxs("div",{className:"py-12 text-center",children:[e.jsx(i.Award,{className:"size-10 text-muted-foreground mx-auto mb-3"}),e.jsx("p",{className:"text-sm font-medium text-foreground",children:"No certificates yet"}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"Certificates will appear here once courses are completed."})]})})]})]})}const pe=L.withProGate(ge,"StudentProfileModule");exports.AssignmentModule=ce;exports.CertificateModule=de;exports.CourseCatalogModule=je;exports.CoursePlayer=O;exports.DiscussionModule=xe;exports.ExamModule=se;exports.FlashcardLab=J;exports.GradeCenterModule=ae;exports.QuizModule=_;exports.StudentDashboardModule=he;exports.StudentProfileModule=pe;exports.SurveyModule=re;
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),t=require("react"),i=require("lucide-react"),A=require("./StudentProfile-BPsZBaJj.cjs"),s=require("./withProGate-BJdu1T9Y.cjs");function Q(d){const[N,x]=t.useState(0),l=t.useRef(null),j=t.useRef(null),o=t.useRef(0);t.useEffect(()=>(d?(l.current=Date.now(),j.current=setInterval(()=>{if(l.current){const c=Math.floor((Date.now()-l.current)/1e3);c!==o.current&&(o.current=c,x(c))}},1e3)):j.current&&(clearInterval(j.current),j.current=null),()=>{j.current&&clearInterval(j.current)}),[d]);const a=t.useCallback(()=>l.current?Math.floor((Date.now()-l.current)/1e3):o.current,[]),f=t.useCallback(()=>{o.current=0,x(0),l.current=null},[]);return{timeElapsed:N,getFinalElapsed:a,reset:f}}function q({icon:d,title:N,description:x,questionCount:l,timeLimitSeconds:j,passingScore:o,startLabel:a,onStart:f,children:c,readOnly:m=!1}){return e.jsx(s.Card,{children:e.jsxs(s.CardContent,{className:"pt-8 pb-8 text-center",children:[e.jsx("div",{className:"mx-auto mb-4 w-14 h-14 rounded-full bg-primary/10 flex items-center justify-center",children:d}),e.jsx("h2",{className:"text-2xl font-bold text-foreground mb-2",children:N}),x&&e.jsx("p",{className:"text-muted-foreground mb-6 max-w-md mx-auto",children:x}),c,e.jsxs("div",{className:"flex flex-wrap justify-center gap-2 mb-8",children:[e.jsxs(s.Badge,{variant:"outline",className:"gap-1.5",children:[e.jsx(i.HelpCircle,{className:"size-3.5"}),l," questions"]}),j!=null&&e.jsxs(s.Badge,{variant:"outline",className:"gap-1.5",children:[e.jsx(i.Clock,{className:"size-3.5"}),s.formatDuration(j)," time limit"]}),o!==void 0&&e.jsxs(s.Badge,{variant:"outline",className:"gap-1.5",children:[e.jsx(i.CheckCircle2,{className:"size-3.5"}),o,"% to pass"]})]}),e.jsxs(s.Button,{size:"lg",onClick:f,disabled:m,children:[e.jsx(i.Play,{className:"size-4 mr-2"}),a]})]})})}function V({title:d,percentage:N,passed:x,correct:l,total:j,timeElapsedSeconds:o,answers:a,questions:f,allowRetake:c,onRetake:m,retakeLabel:g="Retake",showReview:C=!0,extraBadges:r,readOnly:S=!1}){return e.jsxs(e.Fragment,{children:[e.jsx(s.Card,{children:e.jsxs(s.CardContent,{className:"pt-8 pb-8",children:[e.jsxs("div",{className:"text-center mb-8",children:[e.jsx(s.ProgressRing,{value:N,size:140,strokeWidth:10,color:x?"var(--success)":"var(--destructive)",className:"mx-auto mb-4 text-foreground"}),e.jsx(s.Badge,{variant:x?"success":"destructive",className:"text-sm px-3 py-1 mb-2",children:x?"Passed":"Failed"}),r,e.jsx("h2",{className:"text-xl font-bold text-foreground",children:d})]}),e.jsxs("div",{className:"grid grid-cols-2 sm:grid-cols-4 gap-3 mb-8",children:[e.jsx(s.StatCard,{icon:e.jsx(i.CheckCircle2,{}),label:"Correct",description:"Questions answered right",value:`${l}/${j}`,accent:"var(--success)"}),e.jsx(s.StatCard,{icon:e.jsx(i.XCircle,{}),label:"Incorrect",description:"Questions to review",value:`${j-l}/${j}`,accent:"var(--destructive)"}),e.jsx(s.StatCard,{icon:e.jsx(i.Trophy,{}),label:"Score",description:"Overall percentage",value:`${N}%`,accent:"var(--palette-3)"}),e.jsx(s.StatCard,{icon:e.jsx(i.Clock,{}),label:"Time",description:"Total elapsed",value:s.formatDuration(o),accent:"var(--palette-1)"})]}),c&&m&&!S&&e.jsx("div",{className:"flex justify-center mb-8",children:e.jsxs(s.Button,{variant:"outline",onClick:m,children:[e.jsx(i.RotateCcw,{className:"size-4 mr-2"}),g]})})]})}),C&&e.jsxs(e.Fragment,{children:[e.jsx(s.Separator,{className:"my-6"}),e.jsx("h3",{className:"text-lg font-semibold text-foreground mb-4",children:"Question Review"}),e.jsx(A.AssessmentReview,{questions:f,sessionAnswers:a,showCorrectAnswers:!0})]})]})}function H({title:d,description:N,questions:x,timeLimitSeconds:l,passingScore:j,allowRetake:o=!0,onComplete:a,showReview:f=!0,questionMaterials:c,readOnly:m=!1,className:g,style:C}){const[r,S]=t.useState({tag:"intro"}),h=t.useRef(null),{timeElapsed:b,getFinalElapsed:v,reset:n}=Q(r.tag==="quiz"),z=t.useRef(a);z.current=a,t.useEffect(()=>{var u;(u=h.current)==null||u.focus({preventScroll:!0})},[r.tag]);const R=t.useCallback(u=>{var M;const{correct:p,total:w,percentage:k}=s.scoreAssessment(x,u),E={answers:u,correct:p,total:w,percentage:k,passed:j!==void 0?k>=j:!0,timeElapsedSeconds:v()};S({tag:"results",result:E}),(M=z.current)==null||M.call(z,E)},[x,j,v]),B=t.useCallback(()=>{n(),S({tag:"intro"})},[n]);if(r.tag==="intro")return e.jsx("div",{ref:h,tabIndex:-1,className:s.cn("max-w-2xl mx-auto outline-none",g),style:C,children:e.jsx(q,{icon:e.jsx(i.Trophy,{className:"size-7 text-primary"}),title:d,description:N,questionCount:x.length,timeLimitSeconds:l,passingScore:j,startLabel:"Start Quiz",onStart:()=>S({tag:"quiz"}),readOnly:m})});if(r.tag==="quiz")return e.jsx("div",{ref:h,tabIndex:-1,className:s.cn("outline-none",g),style:C,children:e.jsx(A.QuizSession,{questions:x,onSubmit:R,timeElapsedSeconds:b,timeLimitSeconds:l,questionMaterials:c,readOnly:m})});const{result:T}=r;return e.jsx("div",{ref:h,tabIndex:-1,className:s.cn("max-w-2xl mx-auto outline-none",g),style:C,children:e.jsx(V,{title:d,percentage:T.percentage,passed:T.passed,correct:T.correct,total:T.total,timeElapsedSeconds:T.timeElapsedSeconds,answers:T.answers,questions:x,allowRetake:o,onRetake:B,retakeLabel:"Retake Quiz",showReview:f,readOnly:m})})}const D=s.withProGate(H,"QuizModule");function _({decks:d=[],showShuffleToggle:N=!0,defaultShuffled:x=!1,allowMultiSelect:l=!0,onComplete:j,readOnly:o=!1,className:a,style:f}){const[c,m]=t.useState({tag:"setup"}),[g,C]=t.useState(new Set),[r,S]=t.useState(x),h=t.useRef(null),b=t.useRef(null);t.useEffect(()=>{var u;(u=b.current)==null||u.focus({preventScroll:!0})},[c.tag]);function v(u){C(p=>{const w=new Set(p);return w.has(u)?w.delete(u):(l||w.clear(),w.add(u)),w})}function n(){const u=d.filter(w=>g.has(w.uid)),p=u.flatMap(w=>w.cards);h.current=Date.now(),m({tag:"study",cards:p,deckUids:u.map(w=>w.uid),shuffled:r})}function z(){if(c.tag!=="study")return;const u=h.current?Math.floor((Date.now()-h.current)/1e3):0,p={totalCards:c.cards.length,decksStudied:c.deckUids.length,deckUids:c.deckUids,wasShuffled:c.shuffled,timeElapsedSeconds:u};m({tag:"completion",result:p}),j==null||j(p)}function R(){if(c.tag!=="completion")return;const p=d.filter(w=>c.result.deckUids.includes(w.uid)).flatMap(w=>w.cards);h.current=Date.now(),m({tag:"study",cards:p,deckUids:c.result.deckUids,shuffled:c.result.wasShuffled})}function B(){C(new Set),S(x),m({tag:"setup"})}if(c.tag==="setup")return e.jsx("div",{ref:b,tabIndex:-1,className:s.cn("max-w-2xl mx-auto outline-none",a),style:f,children:e.jsx(s.Card,{children:e.jsxs(s.CardContent,{className:"pt-8 pb-8",children:[e.jsxs("div",{className:"text-center mb-6",children:[e.jsx("div",{className:"mx-auto mb-4 w-14 h-14 rounded-full bg-primary/10 flex items-center justify-center",children:e.jsx(i.BookOpen,{className:"size-7 text-primary"})}),e.jsx("h2",{className:"text-2xl font-bold text-foreground mb-2",children:"Choose Your Decks"}),e.jsx("p",{className:"text-muted-foreground text-sm",children:l?"Select one or more decks to study":"Select a deck to study"})]}),e.jsx("div",{className:"grid sm:grid-cols-2 lg:grid-cols-3 gap-3 mb-6",children:d.map(u=>{const p=g.has(u.uid);return e.jsx(s.Card,{className:s.cn("cursor-pointer transition-all py-0",p?"border-primary ring-1 ring-primary":"hover:border-muted-foreground/30"),onClick:()=>v(u.uid),children:e.jsxs(s.CardContent,{className:"py-4",children:[e.jsxs("div",{className:"flex items-start justify-between mb-2",children:[e.jsx("h3",{className:"font-semibold text-foreground text-sm",children:u.title}),e.jsxs(s.Badge,{variant:"secondary",className:"text-xs shrink-0",children:[u.cards.length," cards"]})]}),u.description&&e.jsx("p",{className:"text-xs text-muted-foreground line-clamp-2",children:u.description})]})},u.uid)})}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[N&&e.jsxs(s.Button,{variant:r?"secondary":"outline",size:"sm",className:"gap-1.5",onClick:()=>S(u=>!u),children:[e.jsx(i.Shuffle,{className:"size-3.5"}),"Shuffle"]}),g.size>0&&e.jsxs("span",{className:"text-xs text-muted-foreground",children:[d.filter(u=>g.has(u.uid)).reduce((u,p)=>u+p.cards.length,0)," ","cards selected"]})]}),e.jsx(s.Button,{onClick:n,disabled:g.size===0||o,children:"Start Studying"})]})]})})});if(c.tag==="study"){const u=d.filter(p=>c.deckUids.includes(p.uid)).map(p=>p.title).join(", ");return e.jsx("div",{ref:b,tabIndex:-1,className:s.cn("outline-none",a),style:f,children:e.jsx(A.FlashcardStudySession,{cards:c.cards,title:u,shuffled:c.shuffled,onComplete:z,readOnly:o})})}const{result:T}=c;return e.jsx("div",{ref:b,tabIndex:-1,className:s.cn("max-w-2xl mx-auto outline-none",a),style:f,children:e.jsx(s.Card,{children:e.jsxs(s.CardContent,{className:"pt-8 pb-8",children:[e.jsxs("div",{className:"text-center mb-8",children:[e.jsxs("div",{className:"relative mx-auto mb-4",children:[e.jsx(s.ProgressRing,{value:100,size:120,strokeWidth:10,color:"var(--success)",className:"text-foreground",label:""}),e.jsx(i.CheckCircle2,{className:"size-8 text-success absolute inset-0 m-auto"})]}),e.jsx("h2",{className:"text-xl font-bold text-foreground mb-2",children:"Study Session Complete"}),e.jsx("p",{className:"text-muted-foreground text-sm",children:"Great work! Here's your session summary."})]}),e.jsxs("div",{className:"grid grid-cols-2 sm:grid-cols-4 gap-3 mb-8",children:[e.jsx(s.StatCard,{icon:e.jsx(i.Layers,{}),label:"Cards Studied",description:"Total cards reviewed",value:String(T.totalCards)}),e.jsx(s.StatCard,{icon:e.jsx(i.BookOpen,{}),label:"Decks",description:"Decks completed",value:String(T.decksStudied)}),e.jsx(s.StatCard,{icon:e.jsx(i.Clock,{}),label:"Time Spent",description:"Session duration",value:s.formatDuration(T.timeElapsedSeconds)}),e.jsx(s.StatCard,{icon:e.jsx(i.Shuffle,{}),label:"Shuffled",description:"Card order randomized",value:T.wasShuffled?"Yes":"No"})]}),e.jsxs("div",{className:"flex justify-center gap-3",children:[e.jsxs(s.Button,{variant:"outline",onClick:B,disabled:o,children:[e.jsx(i.ArrowLeft,{className:"size-4 mr-2"}),"Pick New Deck"]}),e.jsxs(s.Button,{onClick:R,disabled:o,children:[e.jsx(i.RotateCcw,{className:"size-4 mr-2"}),"Study Again"]})]})]})})})}const X=s.withProGate(_,"FlashcardLab");function J({courseTitle:d,curriculum:N,progress:x,items:l,initialItemUid:j,onItemComplete:o,onItemChange:a,sidebarCollapsed:f=!1,readOnly:c=!1,className:m,style:g}){const C=t.useRef(null),r=t.useMemo(()=>A.flattenLeaves(N),[N]),S=t.useMemo(()=>new Map(l.map(y=>[y.uid,y])),[l]),[h,b]=t.useState(j??r[0]??""),[v,n]=t.useState(!f),[z,R]=t.useState(()=>x?new Set(x.filter(y=>y.isCompleted).map(y=>y.resourceUid)):new Set),B=r.indexOf(h),T=B>0,u=B<r.length-1,p=z.has(h),w=r.length>0?Math.round(r.filter(y=>z.has(y)).length/r.length*100):0,k=S.get(h),E=t.useMemo(()=>(k==null?void 0:k.type)==="video"?{src:k.src,poster:k.poster,title:k.title}:null,[k==null?void 0:k.uid]);t.useEffect(()=>{var y;(y=C.current)==null||y.focus({preventScroll:!0})},[h]);const M=t.useRef(a);M.current=a;const U=t.useRef(o);U.current=o;const L=t.useCallback(y=>{var P;b(y),(P=M.current)==null||P.call(M,y)},[]),I=t.useCallback(y=>{(!y.children||y.children.length===0)&&L(y.uid)},[L]),G=t.useCallback(()=>{var y;R(P=>new Set(P).add(h)),(y=U.current)==null||y.call(U,h)},[h]),F=t.useCallback(()=>{const y=r.indexOf(h);y<r.length-1&&L(r[y+1])},[r,h,L]),Y=t.useCallback(()=>{const y=r.indexOf(h);y>0&&L(r[y-1])},[r,h,L]),$=t.useMemo(()=>{const y=new Map((x??[]).map(P=>[P.resourceUid,P]));for(const P of z)y.has(P)?y.set(P,{...y.get(P),isCompleted:!0}):y.set(P,{resourceUid:P,isCompleted:!0});return Array.from(y.values())},[x,z]),W=u?S.get(r[B+1]):null;return e.jsxs("div",{className:s.cn("flex h-full overflow-hidden",m),style:g,children:[e.jsx(s.Drawer,{open:v,onOpenChange:n,side:"left",children:e.jsxs(s.DrawerContent,{size:"sm",scrollLock:!1,children:[e.jsxs(s.DrawerHeader,{className:"flex-row items-center justify-between",children:[e.jsx(s.DrawerTitle,{className:"text-xs font-semibold text-muted-foreground uppercase tracking-wide",children:"Course"}),e.jsx(s.DrawerClose,{})]}),e.jsx(s.DrawerBody,{className:"px-2 pb-2",children:e.jsx(A.CourseOutline,{items:N,progress:$,courseTitle:d,activeItemUid:h,onItemClick:I,readOnly:c})})]})}),e.jsxs("div",{className:"flex-1 flex flex-col min-w-0 overflow-hidden",children:[e.jsxs("div",{className:"flex items-center gap-2 px-4 py-2 border-b border-border bg-background shrink-0",children:[e.jsx(s.Button,{variant:"ghost",size:"sm",className:"size-7 p-0 mr-1",onClick:()=>n(!0),children:e.jsx(i.PanelLeft,{className:"size-4"})}),e.jsx("div",{className:"flex-1 min-w-0",children:e.jsx("span",{className:"text-sm font-semibold text-foreground truncate block",children:(k==null?void 0:k.title)??"Select an item"})}),e.jsxs("span",{className:"text-xs text-muted-foreground shrink-0",children:[B+1," / ",r.length]})]}),e.jsx("div",{ref:C,tabIndex:-1,className:"flex-1 overflow-y-auto p-6 outline-none",children:k?K(k,c,G,p,F,u,W,E):e.jsx(s.EmptyState,{title:"No content selected",description:"Select an item from the course outline to get started."})}),e.jsx("div",{className:"shrink-0 border-t border-border bg-background px-4 py-3",children:e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("div",{className:"flex items-center gap-2 mb-1",children:e.jsxs("span",{className:"text-xs text-muted-foreground",children:[w,"% complete"]})}),e.jsx(s.Progress,{value:w,size:"sm"})]}),e.jsxs("div",{className:"flex items-center gap-2 shrink-0",children:[!p&&k&&e.jsxs(s.Button,{size:"sm",variant:"outline",onClick:G,disabled:c,children:[e.jsx(i.Check,{className:"size-3.5 mr-1"}),"Complete"]}),e.jsx(s.Button,{size:"sm",variant:"ghost",onClick:Y,disabled:!T,children:e.jsx(i.ChevronLeft,{className:"size-4"})}),e.jsx(s.Button,{size:"sm",variant:"ghost",onClick:F,disabled:!u,children:e.jsx(i.ChevronRight,{className:"size-4"})})]})]})})]})]})}function K(d,N,x,l,j,o,a,f){switch(d.type){case"lesson":return e.jsx(A.LessonPage,{title:d.title,blocks:d.blocks,isCompleted:l,onMarkComplete:x,onNextLesson:o?j:void 0,nextLessonTitle:a==null?void 0:a.title,readOnly:N});case"video":return e.jsx(A.LecturePlayer,{video:f??{src:"",title:d.title},onComplete:l?void 0:x});case"quiz":return e.jsx(A.PracticeQuiz,{questions:d.questions,instantFeedback:!0,allowRetry:!0,readOnly:N});default:return e.jsx(s.EmptyState,{title:"Unknown content type",description:"This content type is not supported."})}}const Z=s.withProGate(J,"CoursePlayer");function O({title:d,description:N,instructions:x,questions:l=[],timeLimitSeconds:j,passingScore:o,allowBackNavigation:a=!0,autoSubmitOnTimeout:f=!0,timeWarningThreshold:c,allowRetake:m=!1,showReview:g=!0,onComplete:C,readOnly:r=!1,className:S,style:h}){const[b,v]=t.useState({tag:"intro"}),n=t.useRef(null),{timeElapsed:z,reset:R}=Q(b.tag==="exam"),B=t.useRef(C);B.current=C,t.useEffect(()=>{var w;(w=n.current)==null||w.focus({preventScroll:!0})},[b.tag]);const T=t.useCallback((w,k)=>{var I;const{correct:E,total:M,percentage:U}=s.scoreAssessment(l,w),L={answers:w,correct:E,total:M,percentage:U,passed:o!==void 0?U>=o:!0,timeElapsedSeconds:k.timeElapsedSeconds,wasAutoSubmitted:k.wasAutoSubmitted};v({tag:"results",result:L}),(I=B.current)==null||I.call(B,L)},[l,o]),u=t.useCallback(()=>{R(),v({tag:"intro"})},[R]);if(b.tag==="intro")return e.jsx("div",{ref:n,tabIndex:-1,className:s.cn("max-w-2xl mx-auto outline-none",S),style:h,children:e.jsx(q,{icon:e.jsx(i.ShieldCheck,{className:"size-7 text-primary"}),title:d,description:N,questionCount:l.length,timeLimitSeconds:j,passingScore:o,startLabel:"Begin Exam",onStart:()=>v({tag:"exam"}),readOnly:r,children:x&&e.jsx(s.Alert,{className:"text-left mb-6",children:e.jsx(s.AlertDescription,{children:x})})})});if(b.tag==="exam")return e.jsx("div",{ref:n,tabIndex:-1,className:s.cn("outline-none",S),style:h,children:e.jsx(A.ExamSession,{questions:l,timeLimitSeconds:j,timeElapsedSeconds:z,autoSubmitOnTimeout:f,timeWarningThreshold:c,allowBackNavigation:a,confirmBeforeSubmit:!0,examTitle:d,onSubmit:T,readOnly:r})});const{result:p}=b;return e.jsx("div",{ref:n,tabIndex:-1,className:s.cn("max-w-2xl mx-auto outline-none",S),style:h,children:e.jsx(V,{title:d,percentage:p.percentage,passed:p.passed,correct:p.correct,total:p.total,timeElapsedSeconds:p.timeElapsedSeconds,answers:p.answers,questions:l,allowRetake:m,onRetake:u,retakeLabel:"Retake Exam",showReview:g,readOnly:r,extraBadges:p.wasAutoSubmitted?e.jsx(s.Badge,{variant:"outline",className:"text-sm px-3 py-1 mb-2 ml-2",children:"Auto-submitted"}):null})})}const ee=s.withProGate(O,"ExamModule");function se({title:d,description:N,questions:x=[],requireAll:l=!1,showProgress:j=!0,thankYouTitle:o="Thank You!",thankYouMessage:a,onComplete:f,allowRestart:c=!1,readOnly:m=!1,className:g,style:C}){const[r,S]=t.useState({tag:"intro"}),h=t.useRef(null),b=t.useRef(null);t.useEffect(()=>{var B;(B=b.current)==null||B.focus({preventScroll:!0})},[r.tag]);function v(B){const T=h.current?Math.floor((Date.now()-h.current)/1e3):0,u={answers:B,totalQuestions:x.length,answeredCount:B.length,timeElapsedSeconds:T};S({tag:"thankYou",result:u}),f==null||f(u)}function n(){h.current=null,S({tag:"intro"})}function z(){h.current=Date.now(),S({tag:"survey"})}if(r.tag==="intro")return e.jsx("div",{ref:b,tabIndex:-1,className:s.cn("max-w-2xl mx-auto outline-none",g),style:C,children:e.jsx(s.Card,{children:e.jsxs(s.CardContent,{className:"pt-8 pb-8 text-center",children:[e.jsx("div",{className:"mx-auto mb-4 w-14 h-14 rounded-full bg-primary/10 flex items-center justify-center",children:e.jsx(i.ClipboardList,{className:"size-7 text-primary"})}),e.jsx("h2",{className:"text-2xl font-bold text-foreground mb-2",children:d}),N&&e.jsx("p",{className:"text-muted-foreground mb-6 max-w-md mx-auto",children:N}),e.jsx("div",{className:"flex flex-wrap justify-center gap-2 mb-8",children:e.jsxs(s.Badge,{variant:"outline",className:"gap-1.5",children:[e.jsx(i.HelpCircle,{className:"size-3.5"}),x.length," questions"]})}),e.jsxs(s.Button,{size:"lg",onClick:z,disabled:m,children:[e.jsx(i.Play,{className:"size-4 mr-2"}),"Begin Survey"]})]})})});if(r.tag==="survey")return e.jsx("div",{ref:b,tabIndex:-1,className:s.cn("outline-none",g),style:C,children:e.jsx(A.SurveyForm,{title:d,questions:x,requireAll:l,showProgress:j,onSubmit:v,readOnly:m})});const{result:R}=r;return e.jsx("div",{ref:b,tabIndex:-1,className:s.cn("max-w-2xl mx-auto outline-none",g),style:C,children:e.jsx(s.Card,{children:e.jsxs(s.CardContent,{className:"pt-8 pb-8 text-center",children:[e.jsx("div",{className:"mx-auto mb-4 w-14 h-14 rounded-full bg-success/10 flex items-center justify-center",children:e.jsx(i.CheckCircle2,{className:"size-7 text-success"})}),e.jsx("h2",{className:"text-2xl font-bold text-foreground mb-2",children:o}),e.jsx("p",{className:"text-muted-foreground mb-6 max-w-md mx-auto",children:a??"Your responses have been recorded. Thank you for your feedback!"}),e.jsxs("div",{className:"grid grid-cols-2 gap-3 max-w-sm mx-auto mb-6",children:[e.jsx(s.StatCard,{icon:e.jsx(i.HelpCircle,{}),label:"Answered",description:"Questions completed",value:`${R.answeredCount}/${R.totalQuestions}`}),e.jsx(s.StatCard,{icon:e.jsx(i.Clock,{}),label:"Time",description:"Total elapsed",value:s.formatDuration(R.timeElapsedSeconds)})]}),c&&e.jsxs(s.Button,{variant:"outline",onClick:n,disabled:m,children:[e.jsx(i.RotateCcw,{className:"size-4 mr-2"}),"Take Again"]})]})})})}const te=s.withProGate(se,"SurveyModule");function re({courseTitle:d,gradeItems:N=[],categories:x,overallGrade:l,showWeights:j,progressData:o,reviewData:a,readOnly:f=!1,className:c,style:m}){const[g,C]=t.useState(null),r=t.useRef(null);t.useEffect(()=>{var n;(n=r.current)==null||n.focus({preventScroll:!0})},[g]);function S(n){a!=null&&a[n.uid]&&C(n.uid)}function h(){C(null)}const b=g?N.find(n=>n.uid===g):null,v=g?a==null?void 0:a[g]:null;return e.jsxs("div",{ref:r,tabIndex:-1,className:s.cn("outline-none",c),style:m,children:[e.jsxs("div",{className:"flex items-center justify-between mb-6",children:[e.jsxs("div",{children:[d&&e.jsx("h2",{className:"text-xl font-bold text-foreground",children:d}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Grade Center"})]}),l&&e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(s.GradeIndicator,{percentage:l.percentage,letterGrade:l.letterGrade,size:"medium"}),e.jsxs("div",{className:"text-right",children:[e.jsxs("div",{className:"text-sm font-medium text-foreground",children:[l.pointsEarned,"/",l.pointsPossible," pts"]}),l.letterGrade&&e.jsx("div",{className:"text-xs text-muted-foreground",children:l.letterGrade})]})]})]}),e.jsx(s.Separator,{className:"mb-6"}),b&&v?e.jsxs("div",{children:[e.jsxs(s.Button,{variant:"ghost",size:"sm",onClick:h,className:"mb-4",children:[e.jsx(i.ArrowLeft,{className:"size-4 mr-1.5"}),"Back to Grades"]}),e.jsx(s.Card,{className:"mb-4",children:e.jsxs(s.CardContent,{className:"py-3 px-4",children:[e.jsx("h3",{className:"font-semibold text-foreground",children:b.name}),b.score!==null&&e.jsxs("p",{className:"text-sm text-muted-foreground",children:["Score: ",b.score,"/",b.maxScore," (",Math.round(b.score/b.maxScore*100),"%)"]})]})}),e.jsx(A.AssessmentReview,{questions:v.questions,sessionAnswers:v.sessionAnswers,score:v.score,showCorrectAnswers:!0})]}):e.jsxs(s.Tabs,{defaultValue:"grades",children:[o&&e.jsxs(s.TabsList,{className:"mb-6",children:[e.jsxs(s.TabsTrigger,{value:"grades",children:[e.jsx(i.BookOpen,{className:"size-4 mr-1.5"}),"Grades"]}),e.jsxs(s.TabsTrigger,{value:"progress",children:[e.jsx(i.BarChart3,{className:"size-4 mr-1.5"}),"Progress"]})]}),e.jsx(s.TabsContent,{value:"grades",children:e.jsx(A.GradebookTable,{items:N,categories:x,overallGrade:l,showWeights:j,onItemClick:S,readOnly:f})}),o&&e.jsx(s.TabsContent,{value:"progress",children:e.jsx(A.ProgressDashboard,{overallProgress:o.overallProgress,totalTimeSpent:o.totalTimeSpent,modules:o.modules,recentActivity:o.recentActivity,streak:o.streak,achievements:o.achievements})})]})]})}const ne=s.withProGate(re,"GradeCenterModule"),ae={text:"Text Entry",file:"File Upload",url:"URL Submission"};function le({title:d,instructions:N,dueDate:x,maxScore:l,submissionTypes:j=["text","file"],fileConstraints:o,rubric:a,existingSubmission:f,status:c="not_started",grade:m,onSubmit:g,onComplete:C,onSaveDraft:r,readOnly:S=!1,className:h,style:b}){const v=c==="submitted"||c==="graded"?{tag:"confirmation",submission:f??{}}:{tag:"instructions"},[n,z]=t.useState(v),R=t.useRef(null);t.useEffect(()=>{var k;(k=R.current)==null||k.focus({preventScroll:!0})},[n.tag]);const B=t.useMemo(()=>Array.isArray(a)?a.reduce((k,E)=>k+Math.max(...E.levels.map(M=>M.points)),0):0,[a]);function T(k){g==null||g(k),C==null||C({submission:k,status:"submitted"}),z({tag:"confirmation",submission:k})}function u(k){r==null||r(k),C==null||C({submission:k,status:"draft"})}const p=c==="not_started"||c==="draft"||c==="resubmit";if(n.tag==="instructions")return e.jsx("div",{ref:R,tabIndex:-1,className:s.cn("max-w-2xl mx-auto outline-none",h),style:b,children:e.jsx(s.Card,{children:e.jsxs(s.CardContent,{className:"pt-8 pb-8",children:[e.jsxs("div",{className:"text-center mb-6",children:[e.jsx("div",{className:"mx-auto mb-4 w-14 h-14 rounded-full bg-primary/10 flex items-center justify-center",children:e.jsx(i.FileEdit,{className:"size-7 text-primary"})}),e.jsx("h2",{className:"text-2xl font-bold text-foreground mb-2",children:d})]}),e.jsxs("div",{className:"flex flex-wrap justify-center gap-2 mb-6",children:[x&&e.jsx(s.DueDateDisplay,{dueDate:x,size:"small"}),l!==void 0&&e.jsxs(s.Badge,{variant:"outline",className:"gap-1.5",children:[e.jsx(i.CheckCircle2,{className:"size-3.5"}),l," points"]}),e.jsxs(s.Badge,{variant:"outline",className:"gap-1.5",children:[e.jsx(i.Paperclip,{className:"size-3.5"}),j.map(k=>ae[k]).join(", ")]}),e.jsx(s.StatusBadge,{status:c})]}),e.jsx(s.Separator,{className:"my-6"}),e.jsx("div",{className:"prose prose-sm text-foreground mb-6",children:N}),Array.isArray(a)&&a.length>0&&e.jsxs(e.Fragment,{children:[e.jsx(s.Separator,{className:"my-6"}),e.jsx(A.RubricView,{criteria:a,maxScore:B})]}),p&&!S&&e.jsx("div",{className:"text-center mt-8",children:e.jsxs(s.Button,{size:"lg",onClick:()=>z({tag:"work"}),disabled:S,children:[e.jsx(i.Play,{className:"size-4 mr-2"}),"Start Assignment"]})})]})})});if(n.tag==="work")return e.jsxs("div",{ref:R,tabIndex:-1,className:s.cn("outline-none",h),style:b,children:[e.jsxs(s.Button,{variant:"ghost",size:"sm",onClick:()=>z({tag:"instructions"}),className:"mb-4",children:[e.jsx(i.ArrowLeft,{className:"size-4 mr-1.5"}),"Back to Instructions"]}),e.jsx(A.AssignmentSubmission,{title:d,instructions:N,dueDate:x,maxScore:l,status:c,submissionTypes:j,existingSubmission:f,fileConstraints:o,grade:m,onSubmit:T,onSaveDraft:u,readOnly:S})]});const{submission:w}=n;return e.jsx("div",{ref:R,tabIndex:-1,className:s.cn("max-w-2xl mx-auto outline-none",h),style:b,children:e.jsx(s.Card,{children:e.jsxs(s.CardContent,{className:"pt-8 pb-8",children:[e.jsxs("div",{className:"text-center mb-6",children:[e.jsx("div",{className:"mx-auto mb-4 w-14 h-14 rounded-full bg-success/10 flex items-center justify-center",children:e.jsx(i.CheckCircle2,{className:"size-7 text-success"})}),e.jsx("h2",{className:"text-xl font-bold text-foreground mb-2",children:c==="graded"?"Assignment Graded":"Submission Received"}),e.jsxs("div",{className:"flex justify-center gap-2 mb-4",children:[e.jsx(s.StatusBadge,{status:c}),x&&e.jsx(s.DueDateDisplay,{dueDate:x,size:"small"})]})]}),c==="graded"&&m&&e.jsxs("div",{className:"text-center mb-6",children:[e.jsx(s.GradeIndicator,{percentage:l?Math.round(m.score/l*100):0,size:"large"}),e.jsxs("p",{className:"text-sm text-muted-foreground mt-2",children:[m.score,"/",l," points"]}),m.feedback&&e.jsx(s.Alert,{className:"text-left mt-4",children:e.jsx(s.AlertDescription,{children:m.feedback})}),Array.isArray(a)&&m.rubricLevels&&e.jsxs(e.Fragment,{children:[e.jsx(s.Separator,{className:"my-6"}),e.jsx(A.RubricView,{criteria:a,selectedLevels:m.rubricLevels,totalScore:m.score,maxScore:B})]})]}),e.jsx(s.Separator,{className:"my-6"}),e.jsx("h3",{className:"text-sm font-semibold text-foreground mb-3",children:"What You Submitted"}),e.jsxs("div",{className:"space-y-2 text-sm text-muted-foreground",children:[w.textContent&&e.jsxs("div",{className:"flex items-start gap-2",children:[e.jsx(i.FileText,{className:"size-4 mt-0.5 shrink-0"}),e.jsx("span",{className:"line-clamp-2",children:w.textContent.replace(/<[^>]*>/g,"")})]}),w.files&&w.files.length>0&&e.jsxs("div",{className:"flex items-start gap-2",children:[e.jsx(i.Paperclip,{className:"size-4 mt-0.5 shrink-0"}),e.jsxs("span",{children:[w.files.length," file",w.files.length!==1?"s":""," uploaded"]})]}),w.url&&e.jsxs("div",{className:"flex items-start gap-2",children:[e.jsx(i.Link,{className:"size-4 mt-0.5 shrink-0"}),e.jsx("span",{className:"truncate",children:w.url})]})]}),p&&!S&&e.jsx("div",{className:"text-center mt-8",children:e.jsxs(s.Button,{variant:"outline",onClick:()=>z({tag:"work"}),children:[e.jsx(i.FileEdit,{className:"size-4 mr-2"}),"Edit Submission"]})})]})})})}const ie=s.withProGate(le,"AssignmentModule");function ce({courseTitle:d,recipientName:N,organizationName:x,organizationLogo:l,signatory:j,completionDate:o,certificateVariant:a="modern",requirements:f,overallProgress:c,onRequirementClick:m,onComplete:g,readOnly:C=!1,className:r,style:S}){const{allComplete:h,completedCount:b,derivedProgress:v}=t.useMemo(()=>{const p=f.filter(E=>E.completed).length,w=f.length,k=w>0?Math.round(p/w*100):0;return{allComplete:p===w,completedCount:p,derivedProgress:k}},[f]),n=c??v,[z,R]=t.useState({tag:"requirements"}),B=t.useRef(null),T=t.useRef(!1);t.useEffect(()=>{var p;(p=B.current)==null||p.focus({preventScroll:!0})},[z.tag]);const u=t.useRef(g);return u.current=g,t.useEffect(()=>{var p;z.tag==="certificate"&&!T.current&&(T.current=!0,(p=u.current)==null||p.call(u))},[z.tag]),z.tag==="requirements"?e.jsx("div",{ref:B,tabIndex:-1,className:s.cn("max-w-2xl mx-auto outline-none",r),style:S,children:e.jsx(s.Card,{children:e.jsxs(s.CardContent,{className:"pt-8 pb-8",children:[e.jsxs("div",{className:"text-center mb-6",children:[e.jsx(s.ProgressRing,{value:n,size:100,strokeWidth:8,color:h?"var(--success)":"var(--primary)",className:"mx-auto mb-4 text-foreground"}),e.jsx("h2",{className:"text-xl font-bold text-foreground mb-2",children:d}),e.jsx("p",{className:"text-sm text-muted-foreground",children:h?"All requirements met — your certificate is ready!":`${b} of ${f.length} requirements complete`})]}),e.jsx(A.RequirementsChecklist,{requirements:f,onRequirementClick:C?void 0:m,className:"mb-6"}),h&&e.jsx("div",{className:"text-center mt-6",children:e.jsxs(s.Button,{size:"lg",onClick:()=>R({tag:"certificate"}),disabled:C,children:[e.jsx(i.Award,{className:"size-4 mr-2"}),"View Certificate"]})})]})})}):e.jsxs("div",{ref:B,tabIndex:-1,className:s.cn("outline-none",r),style:S,children:[e.jsxs(s.Button,{variant:"ghost",size:"sm",onClick:()=>R({tag:"requirements"}),className:"mb-4",children:[e.jsx(i.ArrowLeft,{className:"size-4 mr-1.5"}),"Back to Requirements"]}),e.jsxs("div",{className:"text-center mb-8",children:[e.jsx("div",{className:"mx-auto mb-4 w-14 h-14 rounded-full bg-success/10 flex items-center justify-center",children:e.jsx(i.PartyPopper,{className:"size-7 text-success"})}),e.jsx("h2",{className:"text-2xl font-bold text-foreground mb-2",children:"Congratulations!"}),e.jsxs("p",{className:"text-muted-foreground",children:["You've completed all requirements for"," ",e.jsx("span",{className:"font-medium text-foreground",children:d})]})]}),e.jsx(A.CertificateViewer,{recipientName:N,courseTitle:d,completionDate:o??new Date().toISOString().split("T")[0],organizationName:x,organizationLogo:l,signatory:j,variant:a,showActions:!0})]})}const oe=s.withProGate(ce,"CertificateModule");function de({forumTitle:d,topics:N=[],currentUser:x,threads:l={},onCreateTopic:j,onReply:o,onToggleLike:a,onMarkAnswer:f,onTopicOpen:c,readOnly:m,className:g,style:C}){const[r,S]=t.useState(null),[h,b]=t.useState(""),[v,n]=t.useState("newest"),z=t.useRef(null);t.useEffect(()=>{var M;(M=z.current)==null||M.focus({preventScroll:!0})},[r]);const R=t.useRef(c);R.current=c;const B=t.useCallback(M=>{var U;S(M),(U=R.current)==null||U.call(R,M)},[]),T=t.useCallback(()=>{S(null)},[]),u=r?l[r]:null,p=r?N.find(M=>M.uid===r):null,w=t.useCallback((M,U)=>{r&&(o==null||o(r,M,U))},[r,o]),k=t.useCallback(M=>{r&&(a==null||a(r,M))},[r,a]),E=t.useCallback(M=>{r&&(f==null||f(r,M))},[r,f]);return e.jsx("div",{ref:z,tabIndex:-1,className:s.cn("outline-none",g),style:C,children:r&&u?e.jsxs("div",{children:[e.jsxs(s.Button,{variant:"ghost",size:"sm",onClick:T,className:"mb-4",children:[e.jsx(i.ArrowLeft,{className:"size-4 mr-1.5"}),"Back to Topics"]}),e.jsx(A.DiscussionThread,{title:(p==null?void 0:p.title)??"",rootPost:u.rootPost,replies:u.replies,currentUser:x,onReply:w,onToggleLike:a?k:void 0,onMarkAnswer:f?E:void 0,readOnly:m})]}):r&&!u?e.jsxs("div",{children:[e.jsxs(s.Button,{variant:"ghost",size:"sm",onClick:T,className:"mb-4",children:[e.jsx(i.ArrowLeft,{className:"size-4 mr-1.5"}),"Back to Topics"]}),e.jsx(s.EmptyState,{title:"No discussion yet",description:"Be the first to start this conversation."})]}):e.jsx(A.ForumBoard,{title:d,topics:N,currentUser:x,onTopicClick:B,onCreateTopic:j,sortOrder:v,onSortChange:n,searchQuery:h,onSearchChange:b,readOnly:m})})}const ue=s.withProGate(de,"DiscussionModule");function xe({studentName:d,overallProgress:N,totalTimeSpent:x,modules:l,recentActivity:j,streak:o,achievements:a,enrolledCourses:f,onCourseClick:c,announcements:m=[],onAnnouncementSelect:g,onMarkRead:C,readOnly:r=!1,className:S,style:h}){const b=t.useRef(null);t.useEffect(()=>{var n;(n=b.current)==null||n.focus({preventScroll:!0})},[]);const v=m.filter(n=>!n.isRead).length;return e.jsxs("div",{ref:b,tabIndex:-1,className:s.cn("outline-none",S),style:h,children:[e.jsxs("div",{className:"flex items-center justify-between mb-6",children:[e.jsxs("h2",{className:"text-xl font-bold text-foreground",children:["Welcome back, ",d]}),e.jsx(s.ProgressRing,{value:N,size:48,strokeWidth:4})]}),e.jsx(s.Separator,{className:"mb-6"}),e.jsxs(s.Tabs,{defaultValue:"overview",children:[e.jsxs(s.TabsList,{className:"mb-6",children:[e.jsxs(s.TabsTrigger,{value:"overview",children:[e.jsx(i.BarChart3,{className:"size-4 mr-1.5"}),"Overview"]}),e.jsxs(s.TabsTrigger,{value:"courses",children:[e.jsx(i.BookOpen,{className:"size-4 mr-1.5"}),"My Courses"]}),e.jsxs(s.TabsTrigger,{value:"announcements",children:[e.jsx(i.Bell,{className:"size-4 mr-1.5"}),"Announcements",v>0&&e.jsx("span",{className:"ml-1.5 inline-flex items-center justify-center rounded-full bg-primary text-primary-foreground text-xs font-medium min-w-5 h-5 px-1.5",children:v})]})]}),e.jsx(s.TabsContent,{value:"overview",children:e.jsx(A.ProgressDashboard,{overallProgress:N,totalTimeSpent:x,modules:l,recentActivity:j,streak:o,achievements:a})}),e.jsx(s.TabsContent,{value:"courses",children:e.jsx(A.CourseCatalog,{courses:f,onCourseClick:n=>!r&&c(n.uid),showSearch:!0,viewMode:"grid",readOnly:r})}),e.jsx(s.TabsContent,{value:"announcements",children:e.jsx(A.AnnouncementFeed,{announcements:m,onSelect:g,onMarkRead:C,readOnly:r})})]})]})}const me=s.withProGate(xe,"StudentDashboardModule");function he({title:d,courses:N=[],categories:x=[],enrollmentData:l,onEnroll:j,onCourseOpen:o,readOnly:a=!1,className:f,style:c}){var b;const[m,g]=t.useState({tag:"browse"}),C=t.useRef(null);t.useEffect(()=>{var v;(v=C.current)==null||v.focus({preventScroll:!0})},[m.tag]);function r(v){l!=null&&l[v]?g({tag:"enroll",courseUid:v}):o==null||o(v)}function S(){g({tag:"browse"})}function h(v){j(v),g({tag:"browse"})}return e.jsxs("div",{ref:C,tabIndex:-1,className:s.cn("outline-none",f),style:c,children:[d&&m.tag==="browse"&&e.jsx("h2",{className:"text-xl font-bold text-foreground mb-4",children:d}),m.tag==="enroll"?e.jsxs("div",{children:[e.jsxs(s.Button,{variant:"ghost",size:"sm",onClick:S,className:"mb-4",children:[e.jsx(i.ArrowLeft,{className:"size-4 mr-1.5"}),"Back to Catalog"]}),l!=null&&l[m.courseUid]?e.jsx(A.EnrollmentWizard,{course:l[m.courseUid].course,prerequisites:l[m.courseUid].prerequisites,onEnroll:h,onCancel:S}):e.jsx(s.Card,{children:e.jsxs(s.CardContent,{className:"pt-6",children:[e.jsx("h3",{className:"text-lg font-semibold text-foreground mb-2",children:((b=N.find(v=>v.uid===m.courseUid))==null?void 0:b.title)??"Course"}),e.jsx("p",{className:"text-sm text-muted-foreground mb-4",children:"Enrollment details are loading. You can enroll directly below."}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(s.Button,{variant:"outline",onClick:S,children:"Cancel"}),e.jsx(s.Button,{onClick:()=>h(m.courseUid),disabled:a,children:"Enroll Now"})]})]})})]}):e.jsx(A.CourseCatalog,{courses:N,categories:x,onCourseClick:v=>r(v.uid),onEnroll:v=>r(v.uid),readOnly:a})]})}const fe=s.withProGate(he,"CourseCatalogModule");function je({student:d,enrolledCourses:N=[],achievements:x=[],certificates:l=[],stats:j,onCourseClick:o,certificateData:a,readOnly:f=!1,className:c,style:m}){const[g,C]=t.useState(null),r=t.useRef(null);t.useEffect(()=>{var n;(n=r.current)==null||n.focus({preventScroll:!0})},[g]);function S(n){f||a!=null&&a[n]&&C(n)}function h(){C(null)}const b=g?a==null?void 0:a[g]:null,v=g?l.find(n=>n.uid===g):null;return e.jsxs("div",{ref:r,tabIndex:-1,className:s.cn("outline-none",c),style:m,children:[e.jsxs("div",{className:"flex items-center gap-4 mb-6",children:[e.jsx(s.UserAvatar,{displayName:d.displayName,avatarUrl:d.avatarUrl,size:"medium"}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[e.jsx("h2",{className:"text-xl font-bold text-foreground",children:d.displayName}),d.role&&e.jsx(s.Badge,{variant:"secondary",children:d.role})]}),d.email&&e.jsx("p",{className:"text-sm text-muted-foreground",children:d.email})]})]}),e.jsx(s.Separator,{className:"mb-6"}),v&&b?e.jsxs("div",{children:[e.jsxs(s.Button,{variant:"ghost",size:"sm",onClick:h,className:"mb-4",children:[e.jsx(i.ArrowLeft,{className:"size-4 mr-1.5"}),"Back to Profile"]}),e.jsx(A.CertificateViewer,{...b,showActions:!0})]}):e.jsxs(s.Tabs,{defaultValue:"profile",children:[e.jsxs(s.TabsList,{className:"mb-6",children:[e.jsxs(s.TabsTrigger,{value:"profile",children:[e.jsx(i.User,{className:"size-4 mr-1.5"}),"Profile"]}),e.jsxs(s.TabsTrigger,{value:"courses",children:[e.jsx(i.BookOpen,{className:"size-4 mr-1.5"}),"Courses"]}),e.jsxs(s.TabsTrigger,{value:"achievements",children:[e.jsx(i.Trophy,{className:"size-4 mr-1.5"}),"Achievements"]}),e.jsxs(s.TabsTrigger,{value:"certificates",children:[e.jsx(i.Award,{className:"size-4 mr-1.5"}),"Certificates"]})]}),e.jsx(s.TabsContent,{value:"profile",children:e.jsx(A.StudentProfile,{student:d,enrolledCourses:N,achievements:x,stats:j,onCourseClick:o,showCourses:!1,showAchievements:!1,readOnly:!0})}),e.jsx(s.TabsContent,{value:"courses",children:N.length>0?e.jsx(s.Card,{children:e.jsx(s.CardContent,{className:"p-0 divide-y divide-border",children:N.map(n=>e.jsxs("div",{className:s.cn("flex items-center gap-3 px-4 py-3 transition-colors",o&&!f&&"cursor-pointer hover:bg-muted/50"),onClick:o&&!f?()=>o(n.uid):void 0,children:[e.jsx(s.ProgressRing,{value:n.progress,size:32,strokeWidth:3}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("p",{className:"text-sm font-medium text-foreground truncate",children:n.title}),n.lastAccessedAt&&e.jsx("p",{className:"text-xs text-muted-foreground",children:s.formatTimestamp(n.lastAccessedAt)})]}),e.jsxs("span",{className:"text-xs text-muted-foreground whitespace-nowrap",children:[Math.round(n.progress),"%"]})]},n.uid))})}):e.jsxs("div",{className:"py-12 text-center",children:[e.jsx(i.BookOpen,{className:"size-10 text-muted-foreground mx-auto mb-3"}),e.jsx("p",{className:"text-sm font-medium text-foreground",children:"No courses yet"}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"Enrolled courses will appear here."})]})}),e.jsx(s.TabsContent,{value:"achievements",children:x.length>0?e.jsx("div",{className:"grid grid-cols-2 sm:grid-cols-3 lg:grid-cols-4 gap-2",children:x.map(n=>e.jsx(s.AchievementBadge,{title:n.name,description:n.description,icon:n.iconUrl?e.jsx("img",{src:n.iconUrl,alt:n.name,className:"w-12 h-12"}):void 0,earnedDate:n.earnedAt},n.uid))}):e.jsxs("div",{className:"py-12 text-center",children:[e.jsx(i.Trophy,{className:"size-10 text-muted-foreground mx-auto mb-3"}),e.jsx("p",{className:"text-sm font-medium text-foreground",children:"No achievements yet"}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"Achievements will appear here as they are earned."})]})}),e.jsx(s.TabsContent,{value:"certificates",children:l.length>0?e.jsx(s.Card,{children:e.jsx(s.CardContent,{className:"p-0 divide-y divide-border",children:l.map(n=>e.jsxs("div",{className:s.cn("flex items-center gap-3 px-4 py-3 transition-colors",(a==null?void 0:a[n.uid])&&!f&&"cursor-pointer hover:bg-muted/50"),onClick:a!=null&&a[n.uid]&&!f?()=>S(n.uid):void 0,children:[e.jsx("div",{className:"w-9 h-9 rounded-lg bg-primary/10 flex items-center justify-center text-primary",children:e.jsx(i.Award,{size:20})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("p",{className:"text-sm font-medium text-foreground truncate",children:n.courseName}),e.jsxs("p",{className:"text-xs text-muted-foreground",children:["Issued"," ",new Date(n.issuedAt).toLocaleDateString()]})]}),(a==null?void 0:a[n.uid])&&e.jsx(s.Badge,{variant:"secondary",className:"text-xs",children:"View"})]},n.uid))})}):e.jsxs("div",{className:"py-12 text-center",children:[e.jsx(i.Award,{className:"size-10 text-muted-foreground mx-auto mb-3"}),e.jsx("p",{className:"text-sm font-medium text-foreground",children:"No certificates yet"}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"Certificates will appear here once courses are completed."})]})})]})]})}const ge=s.withProGate(je,"StudentProfileModule");exports.AssignmentModule=ie;exports.CertificateModule=oe;exports.CourseCatalogModule=fe;exports.CoursePlayer=Z;exports.DiscussionModule=ue;exports.ExamModule=ee;exports.FlashcardLab=X;exports.GradeCenterModule=ne;exports.QuizModule=D;exports.StudentDashboardModule=me;exports.StudentProfileModule=ge;exports.SurveyModule=te;
|