@hydralms/components 0.2.0 → 0.3.0

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.
Files changed (283) hide show
  1. package/dist/StudentProfile-BVfZMbnV.cjs +1 -0
  2. package/dist/StudentProfile-DeMxdrL3.js +3275 -0
  3. package/dist/assessment-toolbar/question-navigator.d.ts +1 -1
  4. package/dist/assessment-toolbar/timer-display.d.ts +1 -1
  5. package/dist/common/index.d.ts +2 -1
  6. package/dist/common/pagination.d.ts +26 -0
  7. package/dist/common/types.d.ts +1 -0
  8. package/dist/components.css +1 -1
  9. package/dist/content/audio-player.d.ts +22 -0
  10. package/dist/content/code-block.d.ts +30 -0
  11. package/dist/content/embed-block.d.ts +28 -0
  12. package/dist/content/index.d.ts +6 -0
  13. package/dist/content/types.d.ts +24 -0
  14. package/dist/curriculum/course-card.d.ts +51 -0
  15. package/dist/curriculum/index.d.ts +2 -0
  16. package/dist/curriculum/types.d.ts +2 -2
  17. package/dist/index.cjs +1 -1
  18. package/dist/index.d.ts +1 -0
  19. package/dist/index.js +494 -444
  20. package/dist/license/HydraContext.d.ts +16 -0
  21. package/dist/license/ProBadge.d.ts +6 -0
  22. package/dist/license/index.d.ts +7 -0
  23. package/dist/license/tiers.d.ts +3 -0
  24. package/dist/license/useHydraLicense.d.ts +6 -0
  25. package/dist/license/validate.d.ts +13 -0
  26. package/dist/license/withProGate.d.ts +6 -0
  27. package/dist/modules/AssignmentModule/AssignmentModule.d.ts +4 -7
  28. package/dist/modules/AssignmentModule/types.d.ts +5 -1
  29. package/dist/modules/CertificateModule/CertificateModule.d.ts +4 -8
  30. package/dist/modules/CertificateModule/types.d.ts +6 -4
  31. package/dist/modules/CourseCatalogModule/CourseCatalogModule.d.ts +5 -0
  32. package/dist/modules/CourseCatalogModule/types.d.ts +43 -0
  33. package/dist/modules/CoursePlayer/CoursePlayer.d.ts +4 -1
  34. package/dist/modules/DiscussionModule/DiscussionModule.d.ts +4 -7
  35. package/dist/modules/ExamModule/ExamModule.d.ts +4 -7
  36. package/dist/modules/ExamModule/types.d.ts +5 -14
  37. package/dist/modules/FlashcardLab/FlashcardLab.d.ts +4 -1
  38. package/dist/modules/FlashcardLab/types.d.ts +2 -0
  39. package/dist/modules/GradeCenterModule/GradeCenterModule.d.ts +4 -8
  40. package/dist/modules/GradeCenterModule/types.d.ts +2 -0
  41. package/dist/modules/QuizModule/QuizModule.d.ts +4 -1
  42. package/dist/modules/QuizModule/types.d.ts +5 -14
  43. package/dist/modules/StudentDashboardModule/StudentDashboardModule.d.ts +5 -0
  44. package/dist/modules/StudentDashboardModule/types.d.ts +54 -0
  45. package/dist/modules/StudentProfileModule/StudentProfileModule.d.ts +5 -0
  46. package/dist/modules/StudentProfileModule/types.d.ts +43 -0
  47. package/dist/modules/SurveyModule/SurveyModule.d.ts +4 -6
  48. package/dist/modules/SurveyModule/types.d.ts +2 -0
  49. package/dist/modules/_shared/assessment-intro.d.ts +16 -0
  50. package/dist/modules/_shared/assessment-results.d.ts +23 -0
  51. package/dist/modules/_shared/types.d.ts +10 -0
  52. package/dist/modules/_shared/use-timer.d.ts +9 -0
  53. package/dist/modules/index.d.ts +6 -0
  54. package/dist/modules.cjs +1 -1
  55. package/dist/modules.js +1266 -854
  56. package/dist/progress/types.d.ts +2 -0
  57. package/dist/provider/HydraProvider.d.ts +5 -1
  58. package/dist/questions/choice.d.ts +1 -1
  59. package/dist/questions/confidence-indicator.d.ts +37 -0
  60. package/dist/questions/essay.d.ts +1 -1
  61. package/dist/questions/fill-in-the-blank.d.ts +1 -1
  62. package/dist/questions/hotspot.d.ts +1 -1
  63. package/dist/questions/index.d.ts +2 -0
  64. package/dist/questions/inline-choice.d.ts +1 -1
  65. package/dist/questions/matching.d.ts +1 -1
  66. package/dist/questions/multiple-choice.d.ts +1 -1
  67. package/dist/questions/numeric.d.ts +1 -1
  68. package/dist/questions/ordering.d.ts +1 -1
  69. package/dist/questions/question-renderer.d.ts +1 -1
  70. package/dist/questions/scenario.d.ts +1 -1
  71. package/dist/questions/spreadsheet.d.ts +1 -1
  72. package/dist/questions/true-false.d.ts +1 -1
  73. package/dist/sections/AnnouncementFeed/AnnouncementFeed.d.ts +1 -1
  74. package/dist/sections/AnnouncementFeed/types.d.ts +15 -1
  75. package/dist/sections/AssessmentReview/AssessmentReview.d.ts +1 -1
  76. package/dist/sections/AssessmentReview/types.d.ts +6 -0
  77. package/dist/sections/AssignmentSubmission/AssignmentSubmission.d.ts +1 -1
  78. package/dist/sections/AssignmentSubmission/types.d.ts +6 -0
  79. package/dist/sections/CertificateViewer/CertificateViewer.d.ts +1 -1
  80. package/dist/sections/CertificateViewer/certificate-variants.d.ts +42 -0
  81. package/dist/sections/CertificateViewer/types.d.ts +6 -0
  82. package/dist/sections/CourseCatalog/CourseCatalog.d.ts +2 -0
  83. package/dist/sections/CourseCatalog/types.d.ts +80 -0
  84. package/dist/sections/CourseOutline/CourseOutline.d.ts +1 -1
  85. package/dist/sections/CourseOutline/types.d.ts +6 -0
  86. package/dist/sections/DiscussionThread/DiscussionThread.d.ts +1 -1
  87. package/dist/sections/DiscussionThread/types.d.ts +6 -0
  88. package/dist/sections/EnrollmentWizard/EnrollmentWizard.d.ts +2 -0
  89. package/dist/sections/EnrollmentWizard/types.d.ts +66 -0
  90. package/dist/sections/ExamSession/ExamSession.d.ts +1 -1
  91. package/dist/sections/ExamSession/types.d.ts +6 -0
  92. package/dist/sections/FlashcardStudySession/FlashcardStudySession.d.ts +1 -1
  93. package/dist/sections/FlashcardStudySession/types.d.ts +6 -0
  94. package/dist/sections/ForumBoard/ForumBoard.d.ts +1 -1
  95. package/dist/sections/ForumBoard/types.d.ts +14 -0
  96. package/dist/sections/GradebookTable/GradebookTable.d.ts +1 -1
  97. package/dist/sections/GradebookTable/types.d.ts +14 -0
  98. package/dist/sections/LecturePlayer/LecturePlayer.d.ts +1 -1
  99. package/dist/sections/LecturePlayer/types.d.ts +8 -0
  100. package/dist/sections/LessonPage/LessonPage.d.ts +1 -1
  101. package/dist/sections/LessonPage/types.d.ts +6 -0
  102. package/dist/sections/PracticeQuiz/PracticeQuiz.d.ts +1 -1
  103. package/dist/sections/PracticeQuiz/types.d.ts +6 -0
  104. package/dist/sections/ProgressDashboard/ProgressDashboard.d.ts +1 -1
  105. package/dist/sections/ProgressDashboard/types.d.ts +6 -0
  106. package/dist/sections/QuizSession/QuizSession.d.ts +1 -1
  107. package/dist/sections/QuizSession/types.d.ts +6 -0
  108. package/dist/sections/RequirementsChecklist/RequirementsChecklist.d.ts +1 -1
  109. package/dist/sections/RequirementsChecklist/types.d.ts +6 -0
  110. package/dist/sections/ResourceLibrary/ResourceLibrary.d.ts +1 -1
  111. package/dist/sections/ResourceLibrary/types.d.ts +15 -1
  112. package/dist/sections/RubricView/RubricView.d.ts +1 -1
  113. package/dist/sections/RubricView/types.d.ts +6 -0
  114. package/dist/sections/ScrollableQuiz/ScrollableQuiz.d.ts +1 -1
  115. package/dist/sections/ScrollableQuiz/types.d.ts +6 -0
  116. package/dist/sections/StudentProfile/StudentProfile.d.ts +2 -0
  117. package/dist/sections/StudentProfile/types.d.ts +98 -0
  118. package/dist/sections/SurveyForm/SurveyForm.d.ts +1 -1
  119. package/dist/sections/SurveyForm/types.d.ts +6 -0
  120. package/dist/sections/_shared/merge-answers.d.ts +9 -0
  121. package/dist/sections/_shared/section-shell.d.ts +20 -0
  122. package/dist/sections/_shared/use-assessment-session.d.ts +30 -0
  123. package/dist/sections/index.d.ts +6 -0
  124. package/dist/sections.cjs +1 -1
  125. package/dist/sections.js +268 -307
  126. package/dist/tabs-BsfVo2Bl.cjs +173 -0
  127. package/dist/{tabs-Wf3h_Cx3.js → tabs-BuY1iNJE.js} +7532 -6807
  128. package/dist/ui/badge.d.ts +1 -1
  129. package/dist/ui/index.d.ts +2 -0
  130. package/dist/ui/progress.d.ts +1 -1
  131. package/dist/ui/rich-text-editor.d.ts +3 -1
  132. package/dist/ui/toast.d.ts +43 -0
  133. package/dist/utils/debounce.d.ts +5 -1
  134. package/dist/utils/pick-palette-color.d.ts +19 -0
  135. package/dist/video/types.d.ts +15 -0
  136. package/dist/video/video-player.d.ts +1 -1
  137. package/dist/withProGate-BWqcKdPM.js +137 -0
  138. package/dist/withProGate-DX6XqKLp.cjs +1 -0
  139. package/package.json +34 -220
  140. package/src/assessment-toolbar/question-navigator.tsx +10 -5
  141. package/src/assessment-toolbar/timer-display.tsx +4 -3
  142. package/src/assessment-toolbar/use-countdown.ts +1 -1
  143. package/src/common/empty-state.tsx +1 -0
  144. package/src/common/index.ts +2 -0
  145. package/src/common/pagination.tsx +135 -0
  146. package/src/common/search-input.tsx +2 -1
  147. package/src/common/types.ts +2 -0
  148. package/src/content/attachment-list.tsx +2 -0
  149. package/src/content/audio-player.tsx +196 -0
  150. package/src/content/code-block.tsx +113 -0
  151. package/src/content/content-block.tsx +64 -0
  152. package/src/content/embed-block.tsx +78 -0
  153. package/src/content/file-upload-zone.tsx +10 -0
  154. package/src/content/index.ts +6 -0
  155. package/src/content/types.ts +5 -0
  156. package/src/curriculum/course-card.tsx +199 -0
  157. package/src/curriculum/curriculum-item.tsx +3 -3
  158. package/src/curriculum/curriculum-tree.tsx +20 -13
  159. package/src/curriculum/index.ts +2 -0
  160. package/src/curriculum/types.ts +2 -2
  161. package/src/flashcards/flashcard.tsx +28 -8
  162. package/src/index.ts +3 -0
  163. package/src/license/HydraContext.tsx +62 -0
  164. package/src/license/ProBadge.tsx +43 -0
  165. package/src/license/index.ts +7 -0
  166. package/src/license/tiers.ts +24 -0
  167. package/src/license/useHydraLicense.ts +10 -0
  168. package/src/license/validate.ts +90 -0
  169. package/src/license/withProGate.tsx +21 -0
  170. package/src/modules/AssignmentModule/AssignmentModule.tsx +17 -8
  171. package/src/modules/AssignmentModule/types.ts +5 -1
  172. package/src/modules/CertificateModule/CertificateModule.tsx +21 -9
  173. package/src/modules/CertificateModule/types.ts +6 -4
  174. package/src/modules/CourseCatalogModule/CourseCatalogModule.tsx +126 -0
  175. package/src/modules/CourseCatalogModule/types.ts +47 -0
  176. package/src/modules/CoursePlayer/CoursePlayer.tsx +37 -22
  177. package/src/modules/DiscussionModule/DiscussionModule.tsx +57 -22
  178. package/src/modules/ExamModule/ExamModule.tsx +64 -198
  179. package/src/modules/ExamModule/types.ts +5 -14
  180. package/src/modules/FlashcardLab/FlashcardLab.tsx +10 -5
  181. package/src/modules/FlashcardLab/types.ts +2 -0
  182. package/src/modules/GradeCenterModule/GradeCenterModule.tsx +7 -2
  183. package/src/modules/GradeCenterModule/types.ts +2 -0
  184. package/src/modules/QuizModule/QuizModule.tsx +49 -169
  185. package/src/modules/QuizModule/types.ts +5 -15
  186. package/src/modules/StudentDashboardModule/StudentDashboardModule.tsx +117 -0
  187. package/src/modules/StudentDashboardModule/types.ts +56 -0
  188. package/src/modules/StudentProfileModule/StudentProfileModule.tsx +289 -0
  189. package/src/modules/StudentProfileModule/types.ts +45 -0
  190. package/src/modules/SurveyModule/SurveyModule.tsx +9 -4
  191. package/src/modules/SurveyModule/types.ts +2 -0
  192. package/src/modules/_shared/assessment-intro.tsx +75 -0
  193. package/src/modules/_shared/assessment-results.tsx +133 -0
  194. package/src/modules/_shared/types.ts +11 -0
  195. package/src/modules/_shared/use-timer.ts +49 -0
  196. package/src/modules/index.ts +9 -0
  197. package/src/progress/achievement-badge.tsx +3 -3
  198. package/src/progress/grade-indicator.tsx +9 -1
  199. package/src/progress/progress-ring.tsx +2 -1
  200. package/src/progress/stat-card.tsx +8 -1
  201. package/src/progress/types.ts +2 -0
  202. package/src/provider/HydraProvider.tsx +15 -6
  203. package/src/questions/choice.tsx +13 -6
  204. package/src/questions/confidence-indicator.tsx +107 -0
  205. package/src/questions/essay.tsx +6 -4
  206. package/src/questions/fill-in-the-blank.tsx +8 -4
  207. package/src/questions/hotspot.tsx +4 -4
  208. package/src/questions/index.ts +2 -0
  209. package/src/questions/inline-choice.tsx +5 -4
  210. package/src/questions/matching.tsx +5 -4
  211. package/src/questions/multiple-choice.tsx +13 -6
  212. package/src/questions/numeric.tsx +8 -4
  213. package/src/questions/ordering.tsx +12 -4
  214. package/src/questions/question-renderer.tsx +3 -2
  215. package/src/questions/scenario.tsx +4 -4
  216. package/src/questions/spreadsheet.tsx +5 -4
  217. package/src/questions/true-false.tsx +13 -6
  218. package/src/sections/AnnouncementFeed/AnnouncementFeed.tsx +64 -8
  219. package/src/sections/AnnouncementFeed/types.ts +15 -1
  220. package/src/sections/AssessmentReview/AssessmentReview.tsx +37 -0
  221. package/src/sections/AssessmentReview/types.ts +6 -0
  222. package/src/sections/AssignmentSubmission/AssignmentSubmission.tsx +37 -1
  223. package/src/sections/AssignmentSubmission/types.ts +6 -0
  224. package/src/sections/CertificateViewer/CertificateViewer.tsx +29 -227
  225. package/src/sections/CertificateViewer/certificate-variants.tsx +170 -0
  226. package/src/sections/CertificateViewer/types.ts +6 -0
  227. package/src/sections/CourseCatalog/CourseCatalog.tsx +220 -0
  228. package/src/sections/CourseCatalog/types.ts +76 -0
  229. package/src/sections/CourseOutline/CourseOutline.tsx +41 -0
  230. package/src/sections/CourseOutline/types.ts +6 -0
  231. package/src/sections/DiscussionThread/DiscussionThread.tsx +42 -1
  232. package/src/sections/DiscussionThread/types.ts +6 -0
  233. package/src/sections/EnrollmentWizard/EnrollmentWizard.tsx +343 -0
  234. package/src/sections/EnrollmentWizard/types.ts +65 -0
  235. package/src/sections/ExamSession/ExamSession.tsx +100 -94
  236. package/src/sections/ExamSession/types.ts +6 -0
  237. package/src/sections/FlashcardStudySession/FlashcardStudySession.tsx +53 -36
  238. package/src/sections/FlashcardStudySession/types.ts +6 -0
  239. package/src/sections/ForumBoard/ForumBoard.tsx +59 -1
  240. package/src/sections/ForumBoard/types.ts +14 -0
  241. package/src/sections/GradebookTable/GradebookTable.tsx +54 -1
  242. package/src/sections/GradebookTable/types.ts +14 -0
  243. package/src/sections/LecturePlayer/LecturePlayer.tsx +63 -37
  244. package/src/sections/LecturePlayer/types.ts +8 -0
  245. package/src/sections/LessonPage/LessonPage.tsx +36 -5
  246. package/src/sections/LessonPage/types.ts +6 -0
  247. package/src/sections/PracticeQuiz/PracticeQuiz.tsx +106 -74
  248. package/src/sections/PracticeQuiz/types.ts +6 -0
  249. package/src/sections/ProgressDashboard/ProgressDashboard.tsx +64 -10
  250. package/src/sections/ProgressDashboard/types.ts +6 -0
  251. package/src/sections/QuizSession/QuizSession.tsx +71 -82
  252. package/src/sections/QuizSession/types.ts +6 -0
  253. package/src/sections/RequirementsChecklist/RequirementsChecklist.tsx +41 -1
  254. package/src/sections/RequirementsChecklist/types.ts +6 -0
  255. package/src/sections/ResourceLibrary/ResourceLibrary.tsx +64 -8
  256. package/src/sections/ResourceLibrary/types.ts +15 -1
  257. package/src/sections/RubricView/RubricView.tsx +37 -1
  258. package/src/sections/RubricView/types.ts +6 -0
  259. package/src/sections/ScrollableQuiz/ScrollableQuiz.tsx +36 -15
  260. package/src/sections/ScrollableQuiz/types.ts +6 -0
  261. package/src/sections/StudentProfile/StudentProfile.tsx +279 -0
  262. package/src/sections/StudentProfile/types.ts +99 -0
  263. package/src/sections/SurveyForm/SurveyForm.tsx +32 -5
  264. package/src/sections/SurveyForm/types.ts +6 -0
  265. package/src/sections/_shared/merge-answers.ts +22 -0
  266. package/src/sections/_shared/section-shell.tsx +64 -0
  267. package/src/sections/_shared/use-assessment-session.ts +125 -0
  268. package/src/sections/index.ts +22 -0
  269. package/src/social/user-avatar.tsx +9 -5
  270. package/src/styles/globals.css +39 -41
  271. package/src/ui/badge.tsx +8 -0
  272. package/src/ui/index.ts +2 -0
  273. package/src/ui/progress.tsx +4 -0
  274. package/src/ui/rich-text-editor.tsx +10 -0
  275. package/src/ui/rich-text-toolbar.tsx +2 -1
  276. package/src/ui/toast.tsx +170 -0
  277. package/src/utils/debounce.ts +8 -2
  278. package/src/utils/pick-palette-color.ts +33 -0
  279. package/src/video/types.ts +16 -0
  280. package/src/video/video-player.tsx +13 -1
  281. package/dist/ForumBoard-CHXU3mjC.js +0 -2207
  282. package/dist/ForumBoard-d1w5-r6n.cjs +0 -1
  283. package/dist/tabs-DRM2Iq_J.cjs +0 -172
package/dist/modules.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),a=require("react"),t=require("lucide-react"),A=require("./ForumBoard-d1w5-r6n.cjs"),s=require("./tabs-DRM2Iq_J.cjs");function Q({title:m,description:v,questions:h,timeLimitSeconds:u,passingScore:w,allowRetake:f=!0,onComplete:i,showReview:o=!0,questionMaterials:j,className:x,style:C}){const[g,l]=a.useState({tag:"intro"}),[N,c]=a.useState(0),p=a.useRef(null),b=a.useRef(null),R=a.useRef(null);a.useEffect(()=>{var n;(n=R.current)==null||n.focus({preventScroll:!0})},[g.tag]),a.useEffect(()=>(g.tag==="quiz"?(p.current=Date.now(),b.current=setInterval(()=>{p.current&&c(Math.floor((Date.now()-p.current)/1e3))},1e3)):b.current&&(clearInterval(b.current),b.current=null),()=>{b.current&&clearInterval(b.current)}),[g.tag]);function k(n){const{correct:B,total:T,percentage:E}=s.scoreAssessment(h,n),M=p.current?Math.floor((Date.now()-p.current)/1e3):N;return{answers:n,correct:B,total:T,percentage:E,passed:w!==void 0?E>=w:!0,timeElapsedSeconds:M}}function S(n){const B=k(n);l({tag:"results",result:B}),i==null||i(B)}function y(){c(0),p.current=null,l({tag:"intro"})}if(g.tag==="intro")return e.jsx("div",{ref:R,tabIndex:-1,className:s.cn("max-w-2xl mx-auto outline-none",x),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(t.Trophy,{className:"size-7 text-primary"})}),e.jsx("h2",{className:"text-2xl font-bold text-foreground mb-2",children:m}),v&&e.jsx("p",{className:"text-muted-foreground mb-6 max-w-md mx-auto",children:v}),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(t.HelpCircle,{className:"size-3.5"}),h.length," questions"]}),u&&e.jsxs(s.Badge,{variant:"outline",className:"gap-1.5",children:[e.jsx(t.Clock,{className:"size-3.5"}),s.formatDuration(u)," time limit"]}),w!==void 0&&e.jsxs(s.Badge,{variant:"outline",className:"gap-1.5",children:[e.jsx(t.CheckCircle2,{className:"size-3.5"}),w,"% to pass"]})]}),e.jsxs(s.Button,{size:"lg",onClick:()=>l({tag:"quiz"}),children:[e.jsx(t.Play,{className:"size-4 mr-2"}),"Start Quiz"]})]})})});if(g.tag==="quiz")return e.jsx("div",{ref:R,tabIndex:-1,className:s.cn("outline-none",x),style:C,children:e.jsx(A.QuizSession,{questions:h,onSubmit:S,timeElapsedSeconds:N,timeLimitSeconds:u,questionMaterials:j})});const{result:r}=g,d=r.passed;return e.jsxs("div",{ref:R,tabIndex:-1,className:s.cn("max-w-2xl mx-auto outline-none",x),style:C,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:r.percentage,size:140,strokeWidth:10,color:d?"var(--success)":"var(--destructive)",className:"mx-auto mb-4 text-foreground"}),e.jsx(s.Badge,{variant:d?"success":"destructive",className:"text-sm px-3 py-1 mb-2",children:d?"Passed":"Failed"}),e.jsx("h2",{className:"text-xl font-bold text-foreground",children:m})]}),e.jsxs("div",{className:"grid grid-cols-2 sm:grid-cols-4 gap-3 mb-8",children:[e.jsx(s.StatCard,{icon:e.jsx(t.CheckCircle2,{}),label:"Correct",description:"Questions answered right",value:`${r.correct}/${r.total}`}),e.jsx(s.StatCard,{icon:e.jsx(t.XCircle,{}),label:"Incorrect",description:"Questions to review",value:`${r.total-r.correct}/${r.total}`}),e.jsx(s.StatCard,{icon:e.jsx(t.Trophy,{}),label:"Score",description:"Overall percentage",value:`${r.percentage}%`}),e.jsx(s.StatCard,{icon:e.jsx(t.Clock,{}),label:"Time",description:"Total elapsed",value:s.formatDuration(r.timeElapsedSeconds)})]}),f&&e.jsx("div",{className:"flex justify-center mb-8",children:e.jsxs(s.Button,{variant:"outline",onClick:y,children:[e.jsx(t.RotateCcw,{className:"size-4 mr-2"}),"Retake Quiz"]})})]})}),o&&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:h,sessionAnswers:r.answers,showCorrectAnswers:!0})]})]})}function $({decks:m,showShuffleToggle:v=!0,defaultShuffled:h=!1,allowMultiSelect:u=!0,onComplete:w,className:f,style:i}){const[o,j]=a.useState({tag:"setup"}),[x,C]=a.useState(new Set),[g,l]=a.useState(h),N=a.useRef(null),c=a.useRef(null);a.useEffect(()=>{var r;(r=c.current)==null||r.focus({preventScroll:!0})},[o.tag]);function p(r){C(d=>{const n=new Set(d);return n.has(r)?n.delete(r):(u||n.clear(),n.add(r)),n})}function b(){const r=m.filter(n=>x.has(n.uid)),d=r.flatMap(n=>n.cards);N.current=Date.now(),j({tag:"study",cards:d,deckUids:r.map(n=>n.uid),shuffled:g})}function R(){if(o.tag!=="study")return;const r=N.current?Math.floor((Date.now()-N.current)/1e3):0,d={totalCards:o.cards.length,decksStudied:o.deckUids.length,deckUids:o.deckUids,wasShuffled:o.shuffled,timeElapsedSeconds:r};j({tag:"completion",result:d}),w==null||w(d)}function k(){if(o.tag!=="completion")return;const d=m.filter(n=>o.result.deckUids.includes(n.uid)).flatMap(n=>n.cards);N.current=Date.now(),j({tag:"study",cards:d,deckUids:o.result.deckUids,shuffled:o.result.wasShuffled})}function S(){C(new Set),l(h),j({tag:"setup"})}if(o.tag==="setup")return e.jsx("div",{ref:c,tabIndex:-1,className:s.cn("max-w-2xl mx-auto outline-none",f),style:i,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(t.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:u?"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:m.map(r=>{const d=x.has(r.uid);return e.jsx(s.Card,{className:s.cn("cursor-pointer transition-all py-0",d?"border-primary ring-1 ring-primary":"hover:border-muted-foreground/30"),onClick:()=>p(r.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:r.title}),e.jsxs(s.Badge,{variant:"secondary",className:"text-xs shrink-0",children:[r.cards.length," cards"]})]}),r.description&&e.jsx("p",{className:"text-xs text-muted-foreground line-clamp-2",children:r.description})]})},r.uid)})}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[v&&e.jsxs(s.Button,{variant:g?"secondary":"outline",size:"sm",className:"gap-1.5",onClick:()=>l(r=>!r),children:[e.jsx(t.Shuffle,{className:"size-3.5"}),"Shuffle"]}),x.size>0&&e.jsxs("span",{className:"text-xs text-muted-foreground",children:[m.filter(r=>x.has(r.uid)).reduce((r,d)=>r+d.cards.length,0)," ","cards selected"]})]}),e.jsx(s.Button,{onClick:b,disabled:x.size===0,children:"Start Studying"})]})]})})});if(o.tag==="study"){const r=m.filter(d=>o.deckUids.includes(d.uid)).map(d=>d.title).join(", ");return e.jsx("div",{ref:c,tabIndex:-1,className:s.cn("outline-none",f),style:i,children:e.jsx(A.FlashcardStudySession,{cards:o.cards,title:r,shuffled:o.shuffled,onComplete:R})})}const{result:y}=o;return e.jsx("div",{ref:c,tabIndex:-1,className:s.cn("max-w-2xl mx-auto outline-none",f),style:i,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(t.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(t.Layers,{}),label:"Cards Studied",description:"Total cards reviewed",value:String(y.totalCards)}),e.jsx(s.StatCard,{icon:e.jsx(t.BookOpen,{}),label:"Decks",description:"Decks completed",value:String(y.decksStudied)}),e.jsx(s.StatCard,{icon:e.jsx(t.Clock,{}),label:"Time Spent",description:"Session duration",value:s.formatDuration(y.timeElapsedSeconds)}),e.jsx(s.StatCard,{icon:e.jsx(t.Shuffle,{}),label:"Shuffled",description:"Card order randomized",value:y.wasShuffled?"Yes":"No"})]}),e.jsxs("div",{className:"flex justify-center gap-3",children:[e.jsxs(s.Button,{variant:"outline",onClick:S,children:[e.jsx(t.ArrowLeft,{className:"size-4 mr-2"}),"Pick New Deck"]}),e.jsxs(s.Button,{onClick:k,children:[e.jsx(t.RotateCcw,{className:"size-4 mr-2"}),"Study Again"]})]})]})})})}function q({courseTitle:m,curriculum:v,progress:h,items:u,initialItemUid:w,onItemComplete:f,onItemChange:i,sidebarCollapsed:o=!1,readOnly:j=!1,className:x,style:C}){const g=a.useRef(null),l=a.useMemo(()=>A.flattenLeaves(v),[v]),N=a.useMemo(()=>new Map(u.map(z=>[z.uid,z])),[u]),[c,p]=a.useState(w??l[0]??""),[b,R]=a.useState(!o),[k,S]=a.useState(()=>h?new Set(h.filter(z=>z.isCompleted).map(z=>z.resourceUid)):new Set),y=l.indexOf(c),r=y>0,d=y<l.length-1,n=k.has(c),B=l.length>0?Math.round(l.filter(z=>k.has(z)).length/l.length*100):0,T=N.get(c);a.useEffect(()=>{var z;(z=g.current)==null||z.focus({preventScroll:!0})},[c]);function E(z){p(z),i==null||i(z)}function M(z){(!z.children||z.children.length===0)&&E(z.uid)}function D(){S(z=>new Set(z).add(c)),f==null||f(c)}function I(){d&&E(l[y+1])}function U(){r&&E(l[y-1])}const L=a.useMemo(()=>{const z=new Map((h??[]).map(P=>[P.resourceUid,P]));for(const P of k)z.has(P)?z.set(P,{...z.get(P),isCompleted:!0}):z.set(P,{resourceUid:P,isCompleted:!0});return Array.from(z.values())},[h,k]),F=d?N.get(l[y+1]):null;return e.jsxs("div",{className:s.cn("flex h-full overflow-hidden",x),style:C,children:[e.jsx(s.Drawer,{open:b,onOpenChange:R,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:v,progress:L,courseTitle:m,activeItemUid:c,onItemClick:M,readOnly:j})})]})}),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:()=>R(!0),children:e.jsx(t.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:(T==null?void 0:T.title)??"Select an item"})}),e.jsxs("span",{className:"text-xs text-muted-foreground shrink-0",children:[y+1," / ",l.length]})]}),e.jsx("div",{ref:g,tabIndex:-1,className:"flex-1 overflow-y-auto p-6 outline-none",children:T?Y(T,j,D,n,I,d,F):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:[B,"% complete"]})}),e.jsx(s.Progress,{value:B,size:"sm"})]}),e.jsxs("div",{className:"flex items-center gap-2 shrink-0",children:[!n&&T&&e.jsxs(s.Button,{size:"sm",variant:"outline",onClick:D,disabled:j,children:[e.jsx(t.Check,{className:"size-3.5 mr-1"}),"Complete"]}),e.jsx(s.Button,{size:"sm",variant:"ghost",onClick:U,disabled:!r,children:e.jsx(t.ChevronLeft,{className:"size-4"})}),e.jsx(s.Button,{size:"sm",variant:"ghost",onClick:I,disabled:!d,children:e.jsx(t.ChevronRight,{className:"size-4"})})]})]})})]})]})}function Y(m,v,h,u,w,f,i){switch(m.type){case"lesson":return e.jsx(A.LessonPage,{title:m.title,blocks:m.blocks,isCompleted:u,onMarkComplete:h,onNextLesson:f?w:void 0,nextLessonTitle:i==null?void 0:i.title,readOnly:v});case"video":return e.jsx(A.LecturePlayer,{video:{src:m.src,poster:m.poster,title:m.title}});case"quiz":return e.jsx(A.PracticeQuiz,{questions:m.questions,instantFeedback:!0,allowRetry:!0,readOnly:v});default:return e.jsx(s.EmptyState,{title:"Unknown content type",description:"This content type is not supported."})}}function G({title:m,description:v,instructions:h,questions:u,timeLimitSeconds:w,passingScore:f,allowBackNavigation:i=!0,autoSubmitOnTimeout:o=!0,timeWarningThreshold:j,allowRetake:x=!1,showReview:C=!0,onComplete:g,className:l,style:N}){const[c,p]=a.useState({tag:"intro"}),[b,R]=a.useState(0),k=a.useRef(null),S=a.useRef(null),y=a.useRef(null);a.useEffect(()=>{var E;(E=y.current)==null||E.focus({preventScroll:!0})},[c.tag]),a.useEffect(()=>(c.tag==="exam"?(k.current=Date.now(),S.current=setInterval(()=>{k.current&&R(Math.floor((Date.now()-k.current)/1e3))},1e3)):S.current&&(clearInterval(S.current),S.current=null),()=>{S.current&&clearInterval(S.current)}),[c.tag]);function r(E,M){const{correct:D,total:I,percentage:U}=s.scoreAssessment(u,E);return{answers:E,correct:D,total:I,percentage:U,passed:f!==void 0?U>=f:!0,timeElapsedSeconds:M.timeElapsedSeconds,wasAutoSubmitted:M.wasAutoSubmitted}}function d(E,M){const D=r(E,M);p({tag:"results",result:D}),g==null||g(D)}function n(){R(0),k.current=null,p({tag:"intro"})}if(c.tag==="intro")return e.jsx("div",{ref:y,tabIndex:-1,className:s.cn("max-w-2xl mx-auto outline-none",l),style:N,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(t.ShieldCheck,{className:"size-7 text-primary"})}),e.jsx("h2",{className:"text-2xl font-bold text-foreground mb-2",children:m}),v&&e.jsx("p",{className:"text-muted-foreground mb-6 max-w-md mx-auto",children:v}),h&&e.jsx(s.Alert,{className:"text-left mb-6",children:e.jsx(s.AlertDescription,{children:h})}),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(t.HelpCircle,{className:"size-3.5"}),u.length," questions"]}),e.jsxs(s.Badge,{variant:"outline",className:"gap-1.5",children:[e.jsx(t.Clock,{className:"size-3.5"}),s.formatDuration(w)," time limit"]}),f!==void 0&&e.jsxs(s.Badge,{variant:"outline",className:"gap-1.5",children:[e.jsx(t.CheckCircle2,{className:"size-3.5"}),f,"% to pass"]})]}),e.jsxs(s.Button,{size:"lg",onClick:()=>p({tag:"exam"}),children:[e.jsx(t.Play,{className:"size-4 mr-2"}),"Begin Exam"]})]})})});if(c.tag==="exam")return e.jsx("div",{ref:y,tabIndex:-1,className:s.cn("outline-none",l),style:N,children:e.jsx(A.ExamSession,{questions:u,timeLimitSeconds:w,timeElapsedSeconds:b,autoSubmitOnTimeout:o,timeWarningThreshold:j,allowBackNavigation:i,confirmBeforeSubmit:!0,examTitle:m,onSubmit:d})});const{result:B}=c,T=B.passed;return e.jsxs("div",{ref:y,tabIndex:-1,className:s.cn("max-w-2xl mx-auto outline-none",l),style:N,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:B.percentage,size:140,strokeWidth:10,color:T?"var(--success)":"var(--destructive)",className:"mx-auto mb-4 text-foreground"}),e.jsx(s.Badge,{variant:T?"success":"destructive",className:"text-sm px-3 py-1 mb-2",children:T?"Passed":"Failed"}),B.wasAutoSubmitted&&e.jsx(s.Badge,{variant:"outline",className:"text-sm px-3 py-1 mb-2 ml-2",children:"Auto-submitted"}),e.jsx("h2",{className:"text-xl font-bold text-foreground",children:m})]}),e.jsxs("div",{className:"grid grid-cols-2 sm:grid-cols-4 gap-3 mb-8",children:[e.jsx(s.StatCard,{icon:e.jsx(t.CheckCircle2,{}),label:"Correct",description:"Questions answered right",value:`${B.correct}/${B.total}`}),e.jsx(s.StatCard,{icon:e.jsx(t.XCircle,{}),label:"Incorrect",description:"Questions to review",value:`${B.total-B.correct}/${B.total}`}),e.jsx(s.StatCard,{icon:e.jsx(t.Trophy,{}),label:"Score",description:"Overall percentage",value:`${B.percentage}%`}),e.jsx(s.StatCard,{icon:e.jsx(t.Clock,{}),label:"Time",description:"Total elapsed",value:s.formatDuration(B.timeElapsedSeconds)})]}),x&&e.jsx("div",{className:"flex justify-center mb-8",children:e.jsxs(s.Button,{variant:"outline",onClick:n,children:[e.jsx(t.RotateCcw,{className:"size-4 mr-2"}),"Retake Exam"]})})]})}),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:u,sessionAnswers:B.answers,showCorrectAnswers:!0})]})]})}function H({title:m,description:v,questions:h,requireAll:u=!1,showProgress:w=!0,thankYouTitle:f="Thank You!",thankYouMessage:i,onComplete:o,allowRestart:j=!1,className:x,style:C}){const[g,l]=a.useState({tag:"intro"}),N=a.useRef(null),c=a.useRef(null);a.useEffect(()=>{var S;(S=c.current)==null||S.focus({preventScroll:!0})},[g.tag]);function p(S){const y=N.current?Math.floor((Date.now()-N.current)/1e3):0,r={answers:S,totalQuestions:h.length,answeredCount:S.length,timeElapsedSeconds:y};l({tag:"thankYou",result:r}),o==null||o(r)}function b(){N.current=null,l({tag:"intro"})}function R(){N.current=Date.now(),l({tag:"survey"})}if(g.tag==="intro")return e.jsx("div",{ref:c,tabIndex:-1,className:s.cn("max-w-2xl mx-auto outline-none",x),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(t.ClipboardList,{className:"size-7 text-primary"})}),e.jsx("h2",{className:"text-2xl font-bold text-foreground mb-2",children:m}),v&&e.jsx("p",{className:"text-muted-foreground mb-6 max-w-md mx-auto",children:v}),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(t.HelpCircle,{className:"size-3.5"}),h.length," questions"]})}),e.jsxs(s.Button,{size:"lg",onClick:R,children:[e.jsx(t.Play,{className:"size-4 mr-2"}),"Begin Survey"]})]})})});if(g.tag==="survey")return e.jsx("div",{ref:c,tabIndex:-1,className:s.cn("outline-none",x),style:C,children:e.jsx(A.SurveyForm,{title:m,questions:h,requireAll:u,showProgress:w,onSubmit:p})});const{result:k}=g;return e.jsx("div",{ref:c,tabIndex:-1,className:s.cn("max-w-2xl mx-auto outline-none",x),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(t.CheckCircle2,{className:"size-7 text-success"})}),e.jsx("h2",{className:"text-2xl font-bold text-foreground mb-2",children:f}),e.jsx("p",{className:"text-muted-foreground mb-6 max-w-md mx-auto",children:i??"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(t.HelpCircle,{}),label:"Answered",description:"Questions completed",value:`${k.answeredCount}/${k.totalQuestions}`}),e.jsx(s.StatCard,{icon:e.jsx(t.Clock,{}),label:"Time",description:"Total elapsed",value:s.formatDuration(k.timeElapsedSeconds)})]}),j&&e.jsxs(s.Button,{variant:"outline",onClick:b,children:[e.jsx(t.RotateCcw,{className:"size-4 mr-2"}),"Take Again"]})]})})})}function O({courseTitle:m,gradeItems:v,categories:h,overallGrade:u,showWeights:w,progressData:f,reviewData:i,className:o,style:j}){const[x,C]=a.useState(null),g=a.useRef(null);a.useEffect(()=>{var b;(b=g.current)==null||b.focus({preventScroll:!0})},[x]);function l(b){i!=null&&i[b.uid]&&C(b.uid)}function N(){C(null)}const c=x?v.find(b=>b.uid===x):null,p=x?i==null?void 0:i[x]:null;return e.jsxs("div",{ref:g,tabIndex:-1,className:s.cn("outline-none",o),style:j,children:[e.jsxs("div",{className:"flex items-center justify-between mb-6",children:[e.jsxs("div",{children:[m&&e.jsx("h2",{className:"text-xl font-bold text-foreground",children:m}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Grade Center"})]}),u&&e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(s.GradeIndicator,{percentage:u.percentage,letterGrade:u.letterGrade,size:"medium"}),e.jsxs("div",{className:"text-right",children:[e.jsxs("div",{className:"text-sm font-medium text-foreground",children:[u.pointsEarned,"/",u.pointsPossible," pts"]}),u.letterGrade&&e.jsx("div",{className:"text-xs text-muted-foreground",children:u.letterGrade})]})]})]}),e.jsx(s.Separator,{className:"mb-6"}),c&&p?e.jsxs("div",{children:[e.jsxs(s.Button,{variant:"ghost",size:"sm",onClick:N,className:"mb-4",children:[e.jsx(t.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:c.name}),c.score!==null&&e.jsxs("p",{className:"text-sm text-muted-foreground",children:["Score: ",c.score,"/",c.maxScore," (",Math.round(c.score/c.maxScore*100),"%)"]})]})}),e.jsx(A.AssessmentReview,{questions:p.questions,sessionAnswers:p.sessionAnswers,score:p.score,showCorrectAnswers:!0})]}):e.jsxs(s.Tabs,{defaultValue:"grades",children:[f&&e.jsxs(s.TabsList,{className:"mb-6",children:[e.jsxs(s.TabsTrigger,{value:"grades",children:[e.jsx(t.BookOpen,{className:"size-4 mr-1.5"}),"Grades"]}),e.jsxs(s.TabsTrigger,{value:"progress",children:[e.jsx(t.BarChart3,{className:"size-4 mr-1.5"}),"Progress"]})]}),e.jsx(s.TabsContent,{value:"grades",children:e.jsx(A.GradebookTable,{items:v,categories:h,overallGrade:u,showWeights:w,onItemClick:l})}),f&&e.jsx(s.TabsContent,{value:"progress",children:e.jsx(A.ProgressDashboard,{overallProgress:f.overallProgress,totalTimeSpent:f.totalTimeSpent,modules:f.modules,recentActivity:f.recentActivity,streak:f.streak,achievements:f.achievements})})]})]})}const V={text:"Text Entry",file:"File Upload",url:"URL Submission"};function W({title:m,instructions:v,dueDate:h,maxScore:u,submissionTypes:w,fileConstraints:f,rubric:i,existingSubmission:o,status:j="not_started",grade:x,onSubmit:C,onSaveDraft:g,className:l,style:N}){const c=j==="submitted"||j==="graded"?{tag:"confirmation",submission:o??{}}:{tag:"instructions"},[p,b]=a.useState(c),R=a.useRef(null);a.useEffect(()=>{var n;(n=R.current)==null||n.focus({preventScroll:!0})},[p.tag]);const k=a.useMemo(()=>i?i.reduce((n,B)=>n+Math.max(...B.levels.map(T=>T.points)),0):0,[i]);function S(n){C==null||C(n),b({tag:"confirmation",submission:n})}function y(n){g==null||g(n)}const r=j==="not_started"||j==="draft"||j==="resubmit";if(p.tag==="instructions")return e.jsx("div",{ref:R,tabIndex:-1,className:s.cn("max-w-2xl mx-auto outline-none",l),style:N,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(t.FileEdit,{className:"size-7 text-primary"})}),e.jsx("h2",{className:"text-2xl font-bold text-foreground mb-2",children:m})]}),e.jsxs("div",{className:"flex flex-wrap justify-center gap-2 mb-6",children:[h&&e.jsx(s.DueDateDisplay,{dueDate:h,size:"small"}),u!==void 0&&e.jsxs(s.Badge,{variant:"outline",className:"gap-1.5",children:[e.jsx(t.CheckCircle2,{className:"size-3.5"}),u," points"]}),e.jsxs(s.Badge,{variant:"outline",className:"gap-1.5",children:[e.jsx(t.Paperclip,{className:"size-3.5"}),w.map(n=>V[n]).join(", ")]}),e.jsx(s.StatusBadge,{status:j})]}),e.jsx(s.Separator,{className:"my-6"}),e.jsx("div",{className:"prose prose-sm text-foreground mb-6",children:v}),i&&i.length>0&&e.jsxs(e.Fragment,{children:[e.jsx(s.Separator,{className:"my-6"}),e.jsx(A.RubricView,{criteria:i,maxScore:k})]}),r&&e.jsx("div",{className:"text-center mt-8",children:e.jsxs(s.Button,{size:"lg",onClick:()=>b({tag:"work"}),children:[e.jsx(t.Play,{className:"size-4 mr-2"}),"Start Assignment"]})})]})})});if(p.tag==="work")return e.jsxs("div",{ref:R,tabIndex:-1,className:s.cn("outline-none",l),style:N,children:[e.jsxs(s.Button,{variant:"ghost",size:"sm",onClick:()=>b({tag:"instructions"}),className:"mb-4",children:[e.jsx(t.ArrowLeft,{className:"size-4 mr-1.5"}),"Back to Instructions"]}),e.jsx(A.AssignmentSubmission,{title:m,instructions:v,dueDate:h,maxScore:u,status:j,submissionTypes:w,existingSubmission:o,fileConstraints:f,grade:x,onSubmit:S,onSaveDraft:y})]});const{submission:d}=p;return e.jsx("div",{ref:R,tabIndex:-1,className:s.cn("max-w-2xl mx-auto outline-none",l),style:N,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(t.CheckCircle2,{className:"size-7 text-success"})}),e.jsx("h2",{className:"text-xl font-bold text-foreground mb-2",children:j==="graded"?"Assignment Graded":"Submission Received"}),e.jsxs("div",{className:"flex justify-center gap-2 mb-4",children:[e.jsx(s.StatusBadge,{status:j}),h&&e.jsx(s.DueDateDisplay,{dueDate:h,size:"small"})]})]}),j==="graded"&&x&&e.jsxs("div",{className:"text-center mb-6",children:[e.jsx(s.GradeIndicator,{percentage:u?Math.round(x.score/u*100):0,size:"large"}),e.jsxs("p",{className:"text-sm text-muted-foreground mt-2",children:[x.score,"/",u," points"]}),x.feedback&&e.jsx(s.Alert,{className:"text-left mt-4",children:e.jsx(s.AlertDescription,{children:x.feedback})}),i&&x.rubricLevels&&e.jsxs(e.Fragment,{children:[e.jsx(s.Separator,{className:"my-6"}),e.jsx(A.RubricView,{criteria:i,selectedLevels:x.rubricLevels,totalScore:x.score,maxScore:k})]})]}),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:[d.textContent&&e.jsxs("div",{className:"flex items-start gap-2",children:[e.jsx(t.FileText,{className:"size-4 mt-0.5 shrink-0"}),e.jsx("span",{className:"line-clamp-2",children:d.textContent})]}),d.files&&d.files.length>0&&e.jsxs("div",{className:"flex items-start gap-2",children:[e.jsx(t.Paperclip,{className:"size-4 mt-0.5 shrink-0"}),e.jsxs("span",{children:[d.files.length," file",d.files.length!==1?"s":""," uploaded"]})]}),d.url&&e.jsxs("div",{className:"flex items-start gap-2",children:[e.jsx(t.Link,{className:"size-4 mt-0.5 shrink-0"}),e.jsx("span",{className:"truncate",children:d.url})]})]}),r&&e.jsx("div",{className:"text-center mt-8",children:e.jsxs(s.Button,{variant:"outline",onClick:()=>b({tag:"work"}),children:[e.jsx(t.FileEdit,{className:"size-4 mr-2"}),"Edit Submission"]})})]})})})}function _({courseTitle:m,recipientName:v,organizationName:h,organizationLogo:u,signatory:w,completionDate:f,certificateVariant:i="modern",requirements:o,overallProgress:j,onRequirementClick:x,onCertificateEarned:C,className:g,style:l}){const{allComplete:N,completedCount:c}=a.useMemo(()=>{const S=o.filter(y=>y.completed).length;return{allComplete:S===o.length,completedCount:S}},[o]),[p,b]=a.useState({tag:"requirements"}),R=a.useRef(null),k=a.useRef(!1);return a.useEffect(()=>{var S;(S=R.current)==null||S.focus({preventScroll:!0})},[p.tag]),a.useEffect(()=>{p.tag==="certificate"&&!k.current&&(k.current=!0,C==null||C())},[p.tag,C]),p.tag==="requirements"?e.jsx("div",{ref:R,tabIndex:-1,className:s.cn("max-w-2xl mx-auto outline-none",g),style:l,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:j,size:100,strokeWidth:8,color:N?"var(--success)":"var(--primary)",className:"mx-auto mb-4 text-foreground"}),e.jsx("h2",{className:"text-xl font-bold text-foreground mb-2",children:m}),e.jsx("p",{className:"text-sm text-muted-foreground",children:N?"All requirements met — your certificate is ready!":`${c} of ${o.length} requirements complete`})]}),e.jsx(A.RequirementsChecklist,{requirements:o,onRequirementClick:x,className:"mb-6"}),N&&e.jsx("div",{className:"text-center mt-6",children:e.jsxs(s.Button,{size:"lg",onClick:()=>b({tag:"certificate"}),children:[e.jsx(t.Award,{className:"size-4 mr-2"}),"View Certificate"]})})]})})}):e.jsxs("div",{ref:R,tabIndex:-1,className:s.cn("outline-none",g),style:l,children:[e.jsxs(s.Button,{variant:"ghost",size:"sm",onClick:()=>b({tag:"requirements"}),className:"mb-4",children:[e.jsx(t.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(t.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:m})]})]}),e.jsx(A.CertificateViewer,{recipientName:v,courseTitle:m,completionDate:f??new Date().toISOString().split("T")[0],organizationName:h,organizationLogo:u,signatory:w,variant:i,showActions:!0})]})}function X({forumTitle:m,topics:v,currentUser:h,threads:u,onCreateTopic:w,onReply:f,onToggleLike:i,onMarkAnswer:o,onTopicOpen:j,readOnly:x,className:C,style:g}){const[l,N]=a.useState(null),[c,p]=a.useState(""),[b,R]=a.useState("newest"),k=a.useRef(null);a.useEffect(()=>{var n;(n=k.current)==null||n.focus({preventScroll:!0})},[l]);function S(n){N(n),j==null||j(n)}function y(){N(null)}const r=l?u[l]:null,d=l?v.find(n=>n.uid===l):null;return e.jsx("div",{ref:k,tabIndex:-1,className:s.cn("outline-none",C),style:g,children:l&&r?e.jsxs("div",{children:[e.jsxs(s.Button,{variant:"ghost",size:"sm",onClick:y,className:"mb-4",children:[e.jsx(t.ArrowLeft,{className:"size-4 mr-1.5"}),"Back to Topics"]}),e.jsx(A.DiscussionThread,{title:(d==null?void 0:d.title)??"",rootPost:r.rootPost,replies:r.replies,currentUser:h,onReply:(n,B)=>f==null?void 0:f(l,n,B),onToggleLike:i?n=>i(l,n):void 0,onMarkAnswer:o?n=>o(l,n):void 0,readOnly:x})]}):e.jsx(A.ForumBoard,{title:m,topics:v,currentUser:h,onTopicClick:S,onCreateTopic:w,sortOrder:b,onSortChange:R,searchQuery:c,onSearchChange:p,readOnly:x})})}exports.AssignmentModule=W;exports.CertificateModule=_;exports.CoursePlayer=q;exports.DiscussionModule=X;exports.ExamModule=G;exports.FlashcardLab=$;exports.GradeCenterModule=O;exports.QuizModule=Q;exports.SurveyModule=H;
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;