@hydralms/components 0.2.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.
Files changed (302) hide show
  1. package/dist/StudentProfile-BPsZBaJj.cjs +1 -0
  2. package/dist/StudentProfile-Cw2p-RZn.js +3273 -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 +495 -439
  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 +6 -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 +1267 -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/AdaptiveLearningPath/AdaptiveLearningPath.d.ts +5 -0
  74. package/dist/sections/AdaptiveLearningPath/path-connector.d.ts +8 -0
  75. package/dist/sections/AdaptiveLearningPath/path-milestone-marker.d.ts +7 -0
  76. package/dist/sections/AdaptiveLearningPath/path-node-card.d.ts +10 -0
  77. package/dist/sections/AdaptiveLearningPath/path-skill-bar.d.ts +8 -0
  78. package/dist/sections/AdaptiveLearningPath/types.d.ts +136 -0
  79. package/dist/sections/AnnouncementFeed/AnnouncementFeed.d.ts +1 -1
  80. package/dist/sections/AnnouncementFeed/types.d.ts +15 -1
  81. package/dist/sections/AssessmentReview/AssessmentReview.d.ts +1 -1
  82. package/dist/sections/AssessmentReview/types.d.ts +6 -0
  83. package/dist/sections/AssignmentSubmission/AssignmentSubmission.d.ts +1 -1
  84. package/dist/sections/AssignmentSubmission/types.d.ts +6 -0
  85. package/dist/sections/CertificateViewer/CertificateViewer.d.ts +1 -1
  86. package/dist/sections/CertificateViewer/certificate-variants.d.ts +42 -0
  87. package/dist/sections/CertificateViewer/types.d.ts +6 -0
  88. package/dist/sections/ContentAuthoringStudio/ContentAuthoringStudio.d.ts +5 -0
  89. package/dist/sections/ContentAuthoringStudio/block-editor-item.d.ts +14 -0
  90. package/dist/sections/ContentAuthoringStudio/block-type-picker.d.ts +12 -0
  91. package/dist/sections/ContentAuthoringStudio/types.d.ts +67 -0
  92. package/dist/sections/CourseCatalog/CourseCatalog.d.ts +2 -0
  93. package/dist/sections/CourseCatalog/types.d.ts +80 -0
  94. package/dist/sections/CourseOutline/CourseOutline.d.ts +1 -1
  95. package/dist/sections/CourseOutline/types.d.ts +6 -0
  96. package/dist/sections/DiscussionThread/DiscussionThread.d.ts +1 -1
  97. package/dist/sections/DiscussionThread/types.d.ts +6 -0
  98. package/dist/sections/EnrollmentWizard/EnrollmentWizard.d.ts +2 -0
  99. package/dist/sections/EnrollmentWizard/types.d.ts +66 -0
  100. package/dist/sections/ExamSession/ExamSession.d.ts +1 -1
  101. package/dist/sections/ExamSession/types.d.ts +6 -0
  102. package/dist/sections/FlashcardStudySession/FlashcardStudySession.d.ts +1 -1
  103. package/dist/sections/FlashcardStudySession/types.d.ts +6 -0
  104. package/dist/sections/ForumBoard/ForumBoard.d.ts +1 -1
  105. package/dist/sections/ForumBoard/types.d.ts +14 -0
  106. package/dist/sections/GradebookTable/GradebookTable.d.ts +1 -1
  107. package/dist/sections/GradebookTable/types.d.ts +14 -0
  108. package/dist/sections/LecturePlayer/LecturePlayer.d.ts +1 -1
  109. package/dist/sections/LecturePlayer/types.d.ts +8 -0
  110. package/dist/sections/LessonPage/LessonPage.d.ts +1 -1
  111. package/dist/sections/LessonPage/types.d.ts +6 -0
  112. package/dist/sections/PracticeQuiz/PracticeQuiz.d.ts +1 -1
  113. package/dist/sections/PracticeQuiz/types.d.ts +6 -0
  114. package/dist/sections/ProgressDashboard/ProgressDashboard.d.ts +1 -1
  115. package/dist/sections/ProgressDashboard/types.d.ts +6 -0
  116. package/dist/sections/QuizSession/QuizSession.d.ts +1 -1
  117. package/dist/sections/QuizSession/types.d.ts +6 -0
  118. package/dist/sections/RequirementsChecklist/RequirementsChecklist.d.ts +1 -1
  119. package/dist/sections/RequirementsChecklist/types.d.ts +6 -0
  120. package/dist/sections/ResourceLibrary/ResourceLibrary.d.ts +1 -1
  121. package/dist/sections/ResourceLibrary/types.d.ts +15 -1
  122. package/dist/sections/RubricView/RubricView.d.ts +1 -1
  123. package/dist/sections/RubricView/types.d.ts +6 -0
  124. package/dist/sections/ScrollableQuiz/ScrollableQuiz.d.ts +1 -1
  125. package/dist/sections/ScrollableQuiz/types.d.ts +6 -0
  126. package/dist/sections/StudentProfile/StudentProfile.d.ts +2 -0
  127. package/dist/sections/StudentProfile/types.d.ts +98 -0
  128. package/dist/sections/SurveyForm/SurveyForm.d.ts +1 -1
  129. package/dist/sections/SurveyForm/types.d.ts +6 -0
  130. package/dist/sections/_shared/merge-answers.d.ts +9 -0
  131. package/dist/sections/_shared/section-shell.d.ts +20 -0
  132. package/dist/sections/_shared/use-assessment-session.d.ts +30 -0
  133. package/dist/sections/index.d.ts +10 -0
  134. package/dist/sections.cjs +1 -1
  135. package/dist/sections.js +1361 -307
  136. package/dist/ui/badge.d.ts +1 -1
  137. package/dist/ui/index.d.ts +2 -0
  138. package/dist/ui/progress.d.ts +1 -1
  139. package/dist/ui/rich-text-editor.d.ts +3 -1
  140. package/dist/ui/toast.d.ts +43 -0
  141. package/dist/utils/debounce.d.ts +5 -1
  142. package/dist/utils/pick-palette-color.d.ts +19 -0
  143. package/dist/video/types.d.ts +15 -0
  144. package/dist/video/video-player.d.ts +1 -1
  145. package/dist/withProGate-BJdu1T9Y.cjs +2 -0
  146. package/dist/withProGate-BvFc7Jwy.js +4975 -0
  147. package/package.json +57 -226
  148. package/src/assessment-toolbar/question-navigator.tsx +10 -5
  149. package/src/assessment-toolbar/timer-display.tsx +4 -3
  150. package/src/assessment-toolbar/use-countdown.ts +1 -1
  151. package/src/common/empty-state.tsx +1 -0
  152. package/src/common/index.ts +2 -0
  153. package/src/common/pagination.tsx +135 -0
  154. package/src/common/search-input.tsx +2 -1
  155. package/src/common/types.ts +2 -0
  156. package/src/content/attachment-list.tsx +2 -0
  157. package/src/content/audio-player.tsx +196 -0
  158. package/src/content/code-block.tsx +113 -0
  159. package/src/content/content-block.tsx +64 -0
  160. package/src/content/embed-block.tsx +78 -0
  161. package/src/content/file-upload-zone.tsx +10 -0
  162. package/src/content/index.ts +6 -0
  163. package/src/content/types.ts +5 -0
  164. package/src/curriculum/course-card.tsx +199 -0
  165. package/src/curriculum/curriculum-item.tsx +3 -3
  166. package/src/curriculum/curriculum-tree.tsx +20 -13
  167. package/src/curriculum/index.ts +2 -0
  168. package/src/curriculum/types.ts +2 -2
  169. package/src/flashcards/flashcard.tsx +28 -8
  170. package/src/index.ts +3 -0
  171. package/src/license/HydraContext.tsx +62 -0
  172. package/src/license/ProBadge.tsx +43 -0
  173. package/src/license/index.ts +7 -0
  174. package/src/license/tiers.ts +34 -0
  175. package/src/license/useHydraLicense.ts +10 -0
  176. package/src/license/validate.ts +90 -0
  177. package/src/license/withProGate.tsx +21 -0
  178. package/src/modules/AssignmentModule/AssignmentModule.tsx +17 -8
  179. package/src/modules/AssignmentModule/types.ts +5 -1
  180. package/src/modules/CertificateModule/CertificateModule.tsx +21 -9
  181. package/src/modules/CertificateModule/types.ts +6 -4
  182. package/src/modules/CourseCatalogModule/CourseCatalogModule.tsx +126 -0
  183. package/src/modules/CourseCatalogModule/types.ts +47 -0
  184. package/src/modules/CoursePlayer/CoursePlayer.tsx +39 -22
  185. package/src/modules/DiscussionModule/DiscussionModule.tsx +57 -22
  186. package/src/modules/ExamModule/ExamModule.tsx +64 -198
  187. package/src/modules/ExamModule/types.ts +5 -14
  188. package/src/modules/FlashcardLab/FlashcardLab.tsx +10 -5
  189. package/src/modules/FlashcardLab/types.ts +2 -0
  190. package/src/modules/GradeCenterModule/GradeCenterModule.tsx +7 -2
  191. package/src/modules/GradeCenterModule/types.ts +2 -0
  192. package/src/modules/QuizModule/QuizModule.tsx +49 -169
  193. package/src/modules/QuizModule/types.ts +5 -15
  194. package/src/modules/StudentDashboardModule/StudentDashboardModule.tsx +117 -0
  195. package/src/modules/StudentDashboardModule/types.ts +56 -0
  196. package/src/modules/StudentProfileModule/StudentProfileModule.tsx +289 -0
  197. package/src/modules/StudentProfileModule/types.ts +45 -0
  198. package/src/modules/SurveyModule/SurveyModule.tsx +9 -4
  199. package/src/modules/SurveyModule/types.ts +2 -0
  200. package/src/modules/_shared/assessment-intro.tsx +75 -0
  201. package/src/modules/_shared/assessment-results.tsx +133 -0
  202. package/src/modules/_shared/types.ts +11 -0
  203. package/src/modules/_shared/use-timer.ts +49 -0
  204. package/src/modules/index.ts +9 -0
  205. package/src/progress/achievement-badge.tsx +3 -3
  206. package/src/progress/grade-indicator.tsx +9 -1
  207. package/src/progress/progress-ring.tsx +2 -1
  208. package/src/progress/stat-card.tsx +14 -2
  209. package/src/progress/types.ts +2 -0
  210. package/src/provider/HydraProvider.tsx +15 -6
  211. package/src/questions/choice.tsx +13 -6
  212. package/src/questions/confidence-indicator.tsx +107 -0
  213. package/src/questions/essay.tsx +6 -4
  214. package/src/questions/fill-in-the-blank.tsx +8 -4
  215. package/src/questions/hotspot.tsx +4 -4
  216. package/src/questions/index.ts +2 -0
  217. package/src/questions/inline-choice.tsx +5 -4
  218. package/src/questions/matching.tsx +5 -4
  219. package/src/questions/multiple-choice.tsx +13 -6
  220. package/src/questions/numeric.tsx +8 -4
  221. package/src/questions/ordering.tsx +12 -4
  222. package/src/questions/question-renderer.tsx +3 -2
  223. package/src/questions/scenario.tsx +4 -4
  224. package/src/questions/spreadsheet.tsx +5 -4
  225. package/src/questions/true-false.tsx +13 -6
  226. package/src/sections/AdaptiveLearningPath/AdaptiveLearningPath.tsx +251 -0
  227. package/src/sections/AdaptiveLearningPath/path-connector.tsx +27 -0
  228. package/src/sections/AdaptiveLearningPath/path-milestone-marker.tsx +50 -0
  229. package/src/sections/AdaptiveLearningPath/path-node-card.tsx +166 -0
  230. package/src/sections/AdaptiveLearningPath/path-skill-bar.tsx +49 -0
  231. package/src/sections/AdaptiveLearningPath/types.ts +159 -0
  232. package/src/sections/AnnouncementFeed/AnnouncementFeed.tsx +64 -8
  233. package/src/sections/AnnouncementFeed/types.ts +15 -1
  234. package/src/sections/AssessmentReview/AssessmentReview.tsx +37 -0
  235. package/src/sections/AssessmentReview/types.ts +6 -0
  236. package/src/sections/AssignmentSubmission/AssignmentSubmission.tsx +37 -1
  237. package/src/sections/AssignmentSubmission/types.ts +6 -0
  238. package/src/sections/CertificateViewer/CertificateViewer.tsx +29 -227
  239. package/src/sections/CertificateViewer/certificate-variants.tsx +170 -0
  240. package/src/sections/CertificateViewer/types.ts +6 -0
  241. package/src/sections/ContentAuthoringStudio/ContentAuthoringStudio.tsx +289 -0
  242. package/src/sections/ContentAuthoringStudio/block-editor-item.tsx +487 -0
  243. package/src/sections/ContentAuthoringStudio/block-type-picker.tsx +123 -0
  244. package/src/sections/ContentAuthoringStudio/types.ts +67 -0
  245. package/src/sections/CourseCatalog/CourseCatalog.tsx +220 -0
  246. package/src/sections/CourseCatalog/types.ts +76 -0
  247. package/src/sections/CourseOutline/CourseOutline.tsx +41 -0
  248. package/src/sections/CourseOutline/types.ts +6 -0
  249. package/src/sections/DiscussionThread/DiscussionThread.tsx +42 -1
  250. package/src/sections/DiscussionThread/types.ts +6 -0
  251. package/src/sections/EnrollmentWizard/EnrollmentWizard.tsx +343 -0
  252. package/src/sections/EnrollmentWizard/types.ts +65 -0
  253. package/src/sections/ExamSession/ExamSession.tsx +100 -94
  254. package/src/sections/ExamSession/types.ts +6 -0
  255. package/src/sections/FlashcardStudySession/FlashcardStudySession.tsx +53 -36
  256. package/src/sections/FlashcardStudySession/types.ts +6 -0
  257. package/src/sections/ForumBoard/ForumBoard.tsx +67 -7
  258. package/src/sections/ForumBoard/types.ts +14 -0
  259. package/src/sections/GradebookTable/GradebookTable.tsx +54 -1
  260. package/src/sections/GradebookTable/types.ts +14 -0
  261. package/src/sections/LecturePlayer/LecturePlayer.tsx +63 -37
  262. package/src/sections/LecturePlayer/types.ts +8 -0
  263. package/src/sections/LessonPage/LessonPage.tsx +34 -6
  264. package/src/sections/LessonPage/types.ts +6 -0
  265. package/src/sections/PracticeQuiz/PracticeQuiz.tsx +106 -74
  266. package/src/sections/PracticeQuiz/types.ts +6 -0
  267. package/src/sections/ProgressDashboard/ProgressDashboard.tsx +64 -10
  268. package/src/sections/ProgressDashboard/types.ts +6 -0
  269. package/src/sections/QuizSession/QuizSession.tsx +71 -82
  270. package/src/sections/QuizSession/types.ts +6 -0
  271. package/src/sections/RequirementsChecklist/RequirementsChecklist.tsx +41 -1
  272. package/src/sections/RequirementsChecklist/types.ts +6 -0
  273. package/src/sections/ResourceLibrary/ResourceLibrary.tsx +64 -8
  274. package/src/sections/ResourceLibrary/types.ts +15 -1
  275. package/src/sections/RubricView/RubricView.tsx +37 -1
  276. package/src/sections/RubricView/types.ts +6 -0
  277. package/src/sections/ScrollableQuiz/ScrollableQuiz.tsx +36 -15
  278. package/src/sections/ScrollableQuiz/types.ts +6 -0
  279. package/src/sections/StudentProfile/StudentProfile.tsx +279 -0
  280. package/src/sections/StudentProfile/types.ts +99 -0
  281. package/src/sections/SurveyForm/SurveyForm.tsx +32 -5
  282. package/src/sections/SurveyForm/types.ts +6 -0
  283. package/src/sections/_shared/merge-answers.ts +22 -0
  284. package/src/sections/_shared/section-shell.tsx +64 -0
  285. package/src/sections/_shared/use-assessment-session.ts +125 -0
  286. package/src/sections/index.ts +40 -0
  287. package/src/social/user-avatar.tsx +9 -5
  288. package/src/styles/globals.css +39 -41
  289. package/src/ui/badge.tsx +8 -0
  290. package/src/ui/index.ts +2 -0
  291. package/src/ui/progress.tsx +4 -0
  292. package/src/ui/rich-text-editor.tsx +10 -0
  293. package/src/ui/rich-text-toolbar.tsx +2 -1
  294. package/src/ui/toast.tsx +170 -0
  295. package/src/utils/debounce.ts +8 -2
  296. package/src/utils/pick-palette-color.ts +33 -0
  297. package/src/video/types.ts +16 -0
  298. package/src/video/video-player.tsx +27 -6
  299. package/dist/ForumBoard-CHXU3mjC.js +0 -2207
  300. package/dist/ForumBoard-d1w5-r6n.cjs +0 -1
  301. package/dist/tabs-DRM2Iq_J.cjs +0 -172
  302. package/dist/tabs-Wf3h_Cx3.js +0 -21580
package/dist/sections.js CHANGED
@@ -1,144 +1,162 @@
1
- import { A as be, a as ge, C as ve, b as Ne, D as we, E as ye, F as Ce, c as Se, G as ze, L as Te, d as ke, P as Ae, e as Pe, Q as Ue, R as Le, f as Qe, S as Ee } from "./ForumBoard-CHXU3mjC.js";
2
- import { jsxs as r, jsx as e } from "react/jsx-runtime";
3
- import { useState as S, useRef as Z, useMemo as U, useEffect as $, useCallback as J } from "react";
4
- import { c as f, C as Q, w as I, aj as O, an as W, B as L, am as X, aG as B, aI as D, aH as F, aB as q, aD as ee, aE as M, Z as K, a8 as G, b as _, aK as te, u as ie, aT as se } from "./tabs-Wf3h_Cx3.js";
5
- import { List as ne, Grid as re, Download as ae, Pin as le } from "lucide-react";
6
- function ue({
7
- questions: l,
8
- initialAnswers: h = [],
9
- onSubmit: x,
10
- onAnswerChange: b,
11
- showNavigator: z = !0,
12
- showQuestionNumbers: T = !0,
13
- questionGroups: g,
14
- isSubmitting: N = !1,
15
- readOnly: u = !1,
16
- className: k,
17
- style: A
1
+ import { m as Ae, S as ne } from "./StudentProfile-Cw2p-RZn.js";
2
+ import { A as kt, a as Qt, b as $t, C as Vt, c as Ht, d as Ot, D as Gt, E as Wt, e as Kt, F as Yt, f as Jt, G as Xt, L as Zt, g as qt, P as ea, h as ta, Q as aa, R as ra, i as sa, j as ia, k as la } from "./StudentProfile-Cw2p-RZn.js";
3
+ import { jsx as e, jsxs as s, Fragment as $ } from "react/jsx-runtime";
4
+ import { useState as j, useRef as Z, useMemo as O, useEffect as Ne, useCallback as B, memo as ce } from "react";
5
+ import { c as T, C as W, x as q, ar as Te, av as ee, v as E, aw as R, a2 as te, au as Ie, aQ as Y, aS as J, aR as X, aL as Le, aN as Pe, aO as me, ae as se, b3 as ue, ak as De, B as ae, ad as A, as as Ee, b2 as be, b4 as Be, J as Re, a as ye, P as _e, an as Me, az as H } from "./withProGate-BvFc7Jwy.js";
6
+ import { AlertCircle as Fe, List as Ue, Grid as je, Download as ke, Plus as Qe, Minus as $e, Paperclip as Ve, Table as He, Globe as Oe, Music as Ge, MessageSquare as We, Code as Ke, Video as Ye, Image as Je, Heading as Xe, Type as de, GripVertical as Ze, ChevronRight as qe, ChevronDown as et, Copy as tt, Trash2 as ie, Eye as at, Pencil as rt, Save as st, SkipForward as it, Lock as we, Play as lt, CheckCircle2 as nt, ShieldCheck as ct, Sparkles as dt, Clock as Ce, Trophy as ot, Target as mt, BookOpen as ut, TrendingUp as pe, Flame as pt } from "lucide-react";
7
+ const ht = [];
8
+ function Rt({
9
+ questions: t,
10
+ initialAnswers: r = [],
11
+ onSubmit: a,
12
+ onAnswerChange: i,
13
+ showNavigator: l = !0,
14
+ showQuestionNumbers: C = !0,
15
+ questionGroups: x,
16
+ isSubmitting: p = !1,
17
+ readOnly: h = !1,
18
+ isLoading: N,
19
+ error: I,
20
+ onRetry: m,
21
+ className: c,
22
+ style: d
18
23
  }) {
19
- var V;
20
- const [p, w] = S(h), [i, c] = S(((V = l[0]) == null ? void 0 : V.uid) ?? null), d = Z(/* @__PURE__ */ new Map()), m = U(() => {
21
- const s = /* @__PURE__ */ new Map();
22
- for (const n of p) {
23
- const a = s.get(n.uid);
24
- a ? a.push(n) : s.set(n.uid, [n]);
24
+ var _;
25
+ const [y, v] = j(r), [D, w] = j(((_ = t[0]) == null ? void 0 : _.uid) ?? null), L = Z(/* @__PURE__ */ new Map()), S = O(() => {
26
+ const o = /* @__PURE__ */ new Map();
27
+ for (const f of y) {
28
+ const b = o.get(f.uid);
29
+ b ? b.push(f) : o.set(f.uid, [f]);
25
30
  }
26
- return s;
27
- }, [p]), P = U(
28
- () => l.filter((s) => m.has(s.uid)).length,
29
- [l, m]
31
+ return o;
32
+ }, [y]), g = O(
33
+ () => t.filter((o) => S.has(o.uid)).length,
34
+ [t, S]
30
35
  );
31
- $(() => {
32
- const s = new IntersectionObserver(
33
- (n) => {
34
- for (const a of n)
35
- a.isIntersecting && c(a.target.getAttribute("data-question-uid"));
36
+ Ne(() => {
37
+ const o = new IntersectionObserver(
38
+ (f) => {
39
+ for (const b of f)
40
+ b.isIntersecting && w(b.target.getAttribute("data-question-uid"));
36
41
  },
37
42
  { rootMargin: "-20% 0px -60% 0px" }
38
43
  );
39
- return d.current.forEach((n) => s.observe(n)), () => s.disconnect();
40
- }, [l]);
41
- const j = J((s, n) => {
42
- n ? d.current.set(s, n) : d.current.delete(s);
43
- }, []);
44
- function t(s, n) {
45
- const a = n.map((o) => ({
46
- uid: s,
47
- answerUid: o.uid,
48
- content: o.content
49
- }));
50
- w((o) => {
51
- const R = [...o.filter((Y) => Y.uid !== s), ...a];
52
- return b == null || b(R), R;
53
- });
54
- }
55
- function v(s) {
56
- var n;
57
- (n = d.current.get(s)) == null || n.scrollIntoView({ behavior: "smooth", block: "center" });
44
+ return L.current.forEach((f) => o.observe(f)), () => o.disconnect();
45
+ }, [t]);
46
+ const k = B((o, f) => {
47
+ f ? L.current.set(o, f) : L.current.delete(o);
48
+ }, []), U = Z(i);
49
+ U.current = i;
50
+ const V = B(
51
+ (o, f) => {
52
+ v(
53
+ (b) => Ae(b, o, f, U.current)
54
+ );
55
+ },
56
+ []
57
+ );
58
+ function F(o) {
59
+ var f;
60
+ (f = L.current.get(o)) == null || f.scrollIntoView({ behavior: "smooth", block: "center" });
58
61
  }
59
- const y = U(() => {
60
- if (!g) return [{ label: null, questions: l }];
61
- const s = g.map(
62
- (o) => ({
63
- label: o.label,
64
- questions: o.questionUids.map((C) => l.find((R) => R.uid === C)).filter(Boolean)
62
+ const G = O(() => {
63
+ if (!x) return [{ label: null, questions: t }];
64
+ const o = x.map(
65
+ (M) => ({
66
+ label: M.label,
67
+ questions: M.questionUids.map((Q) => t.find((u) => u.uid === Q)).filter(Boolean)
65
68
  })
66
- ), n = new Set(g.flatMap((o) => o.questionUids)), a = l.filter((o) => !n.has(o.uid));
67
- return a.length > 0 && s.push({ label: null, questions: a }), s;
68
- }, [l, g]);
69
- let E = 0;
70
- return /* @__PURE__ */ r("div", { className: f("flex gap-3", k), style: A, children: [
71
- /* @__PURE__ */ r("div", { className: "flex-1 min-w-0", children: [
72
- y.map((s, n) => /* @__PURE__ */ r("div", { children: [
73
- s.label && /* @__PURE__ */ e("p", { className: f("text-lg font-semibold mb-2 text-foreground", n > 0 && "mt-4"), children: s.label }),
74
- s.questions.map((a) => {
75
- const o = E++;
76
- return /* @__PURE__ */ e(
77
- Q,
78
- {
79
- ref: (C) => j(a.uid, C),
80
- "data-question-uid": a.uid,
81
- className: "mb-2",
82
- children: /* @__PURE__ */ r(I, { className: "pt-6", children: [
83
- T && /* @__PURE__ */ r("p", { className: "font-semibold text-sm text-muted-foreground mb-1", children: [
84
- "Question ",
85
- o + 1
86
- ] }),
87
- /* @__PURE__ */ e(
88
- O,
89
- {
90
- question: a,
91
- sessionAnswers: m.get(a.uid) ?? [],
92
- onAnswer: (C) => t(a.uid, C),
93
- readOnly: u
94
- }
95
- )
96
- ] })
97
- },
98
- a.uid
99
- );
100
- })
101
- ] }, s.label ?? `ungrouped-${n}`)),
102
- /* @__PURE__ */ e(W, { className: "my-3" }),
103
- /* @__PURE__ */ r("div", { className: "flex justify-between items-center", children: [
104
- /* @__PURE__ */ r("span", { className: "text-sm text-muted-foreground", children: [
105
- P,
106
- " of ",
107
- l.length,
108
- " answered"
69
+ ), f = new Set(x.flatMap((M) => M.questionUids)), b = t.filter((M) => !f.has(M.uid));
70
+ return b.length > 0 && o.push({ label: null, questions: b }), o;
71
+ }, [t, x]);
72
+ let n = 0;
73
+ return /* @__PURE__ */ e(
74
+ ne,
75
+ {
76
+ isLoading: N,
77
+ error: I,
78
+ onRetry: m,
79
+ className: c,
80
+ style: d,
81
+ skeleton: /* @__PURE__ */ s($, { children: [
82
+ /* @__PURE__ */ e(R, { className: "h-32 w-full" }),
83
+ /* @__PURE__ */ e(R, { className: "h-32 w-full" }),
84
+ /* @__PURE__ */ e(R, { className: "h-32 w-full" })
85
+ ] }),
86
+ children: /* @__PURE__ */ s("div", { className: "flex gap-3", children: [
87
+ /* @__PURE__ */ s("div", { className: "flex-1 min-w-0", children: [
88
+ G.map((o, f) => /* @__PURE__ */ s("div", { children: [
89
+ o.label && /* @__PURE__ */ e("p", { className: T("text-lg font-semibold mb-2 text-foreground", f > 0 && "mt-4"), children: o.label }),
90
+ o.questions.map((b) => {
91
+ const M = n++;
92
+ return /* @__PURE__ */ e(
93
+ W,
94
+ {
95
+ ref: (Q) => k(b.uid, Q),
96
+ "data-question-uid": b.uid,
97
+ className: "mb-2",
98
+ children: /* @__PURE__ */ s(q, { className: "pt-6", children: [
99
+ C && /* @__PURE__ */ s("p", { className: "font-semibold text-sm text-muted-foreground mb-1", children: [
100
+ "Question ",
101
+ M + 1
102
+ ] }),
103
+ /* @__PURE__ */ e(
104
+ Te,
105
+ {
106
+ question: b,
107
+ sessionAnswers: S.get(b.uid) ?? ht,
108
+ onAnswer: (Q) => V(b.uid, Q),
109
+ readOnly: h
110
+ }
111
+ )
112
+ ] })
113
+ },
114
+ b.uid
115
+ );
116
+ })
117
+ ] }, o.label ?? `ungrouped-${f}`)),
118
+ /* @__PURE__ */ e(ee, { className: "my-3" }),
119
+ /* @__PURE__ */ s("div", { className: "flex justify-between items-center", children: [
120
+ /* @__PURE__ */ s("span", { className: "text-sm text-muted-foreground", children: [
121
+ g,
122
+ " of ",
123
+ t.length,
124
+ " answered"
125
+ ] }),
126
+ /* @__PURE__ */ e(
127
+ E,
128
+ {
129
+ onClick: () => a(y),
130
+ disabled: p || h,
131
+ children: p ? "Submitting..." : "Submit"
132
+ }
133
+ )
134
+ ] })
109
135
  ] }),
110
- /* @__PURE__ */ e(
111
- L,
112
- {
113
- onClick: () => x(p),
114
- disabled: N || u,
115
- children: N ? "Submitting..." : "Submit"
116
- }
117
- )
136
+ l && /* @__PURE__ */ e(W, { className: "hidden md:block w-50 shrink-0 sticky top-4 self-start", children: /* @__PURE__ */ s(q, { className: "p-3", children: [
137
+ /* @__PURE__ */ e("p", { className: "font-semibold text-sm mb-1 text-foreground", children: "Questions" }),
138
+ /* @__PURE__ */ e("div", { className: "flex flex-wrap gap-1", children: t.map((o, f) => {
139
+ const b = S.has(o.uid), M = D === o.uid;
140
+ return /* @__PURE__ */ e(
141
+ "button",
142
+ {
143
+ type: "button",
144
+ className: T(
145
+ "inline-flex items-center justify-center text-xs font-medium min-w-9 px-1 py-0.5 rounded-full cursor-pointer border transition-colors",
146
+ M ? "bg-primary border-primary text-primary-foreground" : b ? "border-success text-success bg-transparent" : "border-border text-foreground bg-transparent hover:bg-muted"
147
+ ),
148
+ onClick: () => F(o.uid),
149
+ children: f + 1
150
+ },
151
+ o.uid
152
+ );
153
+ }) })
154
+ ] }) })
118
155
  ] })
119
- ] }),
120
- z && /* @__PURE__ */ e(Q, { className: "hidden md:block w-50 shrink-0 sticky top-4 self-start", children: /* @__PURE__ */ r(I, { className: "p-3", children: [
121
- /* @__PURE__ */ e("p", { className: "font-semibold text-sm mb-1 text-foreground", children: "Questions" }),
122
- /* @__PURE__ */ e("div", { className: "flex flex-wrap gap-1", children: l.map((s, n) => {
123
- const a = m.has(s.uid), o = i === s.uid;
124
- return /* @__PURE__ */ e(
125
- "button",
126
- {
127
- type: "button",
128
- className: f(
129
- "inline-flex items-center justify-center text-xs font-medium min-w-9 px-1 py-0.5 rounded-full cursor-pointer border transition-colors",
130
- o ? "bg-primary border-primary text-primary-foreground" : a ? "border-success text-success bg-transparent" : "border-border text-foreground bg-transparent hover:bg-muted"
131
- ),
132
- onClick: () => v(s.uid),
133
- children: n + 1
134
- },
135
- s.uid
136
- );
137
- }) })
138
- ] }) })
139
- ] });
156
+ }
157
+ );
140
158
  }
141
- const H = {
159
+ const he = {
142
160
  pdf: "document",
143
161
  document: "document",
144
162
  video: "video",
@@ -147,257 +165,1293 @@ const H = {
147
165
  archive: "document",
148
166
  other: "document"
149
167
  };
150
- function pe({
151
- resources: l,
152
- categories: h,
153
- onResourceClick: x,
154
- onDownload: b,
155
- viewMode: z = "list",
156
- allowViewToggle: T = !0,
157
- showSearch: g = !0,
158
- emptyMessage: N = "No resources found",
159
- readOnly: u = !1,
160
- className: k,
161
- style: A
168
+ function _t({
169
+ resources: t,
170
+ categories: r,
171
+ onResourceClick: a,
172
+ onDownload: i,
173
+ viewMode: l = "list",
174
+ allowViewToggle: C = !0,
175
+ showSearch: x = !0,
176
+ emptyMessage: p = "No resources found",
177
+ readOnly: h = !1,
178
+ isLoading: N,
179
+ error: I,
180
+ onRetry: m,
181
+ pageSize: c,
182
+ currentPage: d = 1,
183
+ totalItems: y,
184
+ onPageChange: v,
185
+ className: D,
186
+ style: w
162
187
  }) {
163
- const [p, w] = S(""), [i, c] = S(null), [d, m] = S(z), P = U(() => {
164
- let t = l;
165
- if (i && (t = t.filter((v) => v.categoryUid === i)), p.trim()) {
166
- const v = p.toLowerCase();
167
- t = t.filter(
168
- (y) => {
169
- var E;
170
- return y.name.toLowerCase().includes(v) || ((E = y.description) == null ? void 0 : E.toLowerCase().includes(v));
188
+ const [L, S] = j(""), [g, k] = j(null), [U, V] = j(l), F = O(() => {
189
+ let n = t;
190
+ if (g && (n = n.filter((_) => _.categoryUid === g)), L.trim()) {
191
+ const _ = L.toLowerCase();
192
+ n = n.filter(
193
+ (o) => {
194
+ var f;
195
+ return o.name.toLowerCase().includes(_) || ((f = o.description) == null ? void 0 : f.toLowerCase().includes(_));
171
196
  }
172
197
  );
173
198
  }
174
- return t;
175
- }, [l, i, p]);
176
- function j(t) {
177
- const v = H[t.type] ?? "document";
178
- return /* @__PURE__ */ r(
199
+ return n;
200
+ }, [t, g, L]);
201
+ if (N)
202
+ return /* @__PURE__ */ s("div", { className: T("space-y-4", D), style: w, children: [
203
+ /* @__PURE__ */ e(R, { className: "h-9 w-full" }),
204
+ /* @__PURE__ */ e("div", { className: "grid grid-cols-3 gap-4", children: Array.from({ length: 6 }).map((n, _) => /* @__PURE__ */ e(R, { className: "h-32 w-full rounded-lg" }, _)) })
205
+ ] });
206
+ if (I)
207
+ return /* @__PURE__ */ e("div", { className: T("py-12", D), style: w, children: /* @__PURE__ */ e(
208
+ te,
209
+ {
210
+ icon: /* @__PURE__ */ e(Fe, { className: "size-10 text-destructive" }),
211
+ title: "Something went wrong",
212
+ description: I,
213
+ action: m ? /* @__PURE__ */ e(E, { variant: "outline", onClick: m, children: "Retry" }) : void 0
214
+ }
215
+ ) });
216
+ function G(n) {
217
+ const _ = he[n.type] ?? "document";
218
+ return /* @__PURE__ */ s(
179
219
  "div",
180
220
  {
181
- className: f(
221
+ className: T(
182
222
  "flex items-center gap-3 px-3 py-2",
183
- !u && "cursor-pointer hover:bg-muted",
184
- u && "opacity-70"
223
+ !h && a && "cursor-pointer hover:bg-muted",
224
+ (h || !a) && "opacity-70"
185
225
  ),
186
- onClick: () => !u && x(t),
226
+ onClick: () => !h && (a == null ? void 0 : a(n)),
187
227
  children: [
188
- /* @__PURE__ */ e("div", { className: "min-w-10", children: /* @__PURE__ */ e(G, { type: v, size: 20 }) }),
189
- /* @__PURE__ */ r("div", { className: "flex-1 min-w-0", children: [
190
- /* @__PURE__ */ e("span", { className: "text-sm text-foreground", children: t.name }),
191
- (t.description || t.fileSize != null) && /* @__PURE__ */ e("span", { className: "block text-xs text-muted-foreground", children: [
192
- t.description,
193
- t.fileSize != null && _(t.fileSize)
228
+ /* @__PURE__ */ e("div", { className: "min-w-10", children: /* @__PURE__ */ e(se, { type: _, size: 20 }) }),
229
+ /* @__PURE__ */ s("div", { className: "flex-1 min-w-0", children: [
230
+ /* @__PURE__ */ e("span", { className: "text-sm text-foreground", children: n.name }),
231
+ (n.description || n.fileSize != null) && /* @__PURE__ */ e("span", { className: "block text-xs text-muted-foreground", children: [
232
+ n.description,
233
+ n.fileSize != null && ue(n.fileSize)
194
234
  ].filter(Boolean).join(" · ") })
195
235
  ] }),
196
- b && /* @__PURE__ */ r(B, { children: [
197
- /* @__PURE__ */ e(D, { children: /* @__PURE__ */ e(
198
- L,
236
+ i && /* @__PURE__ */ s(Y, { children: [
237
+ /* @__PURE__ */ e(J, { children: /* @__PURE__ */ e(
238
+ E,
199
239
  {
200
240
  variant: "ghost",
201
241
  size: "icon-xs",
202
242
  "aria-label": "Download",
203
- onClick: (y) => {
204
- y.stopPropagation(), b(t);
243
+ onClick: (o) => {
244
+ o.stopPropagation(), i(n);
205
245
  },
206
- children: /* @__PURE__ */ e(ae, { size: 16 })
246
+ children: /* @__PURE__ */ e(ke, { size: 16 })
207
247
  }
208
248
  ) }),
209
- /* @__PURE__ */ e(F, { children: "Download" })
249
+ /* @__PURE__ */ e(X, { children: "Download" })
210
250
  ] })
211
251
  ]
212
252
  },
213
- t.uid
253
+ n.uid
214
254
  );
215
255
  }
216
- return /* @__PURE__ */ r("div", { className: k, style: A, children: [
217
- /* @__PURE__ */ r("div", { className: "flex gap-2 items-center mb-2", children: [
218
- g && /* @__PURE__ */ e("div", { className: "flex-1 max-w-80", children: /* @__PURE__ */ e(
219
- X,
256
+ return /* @__PURE__ */ s("div", { className: D, style: w, children: [
257
+ /* @__PURE__ */ s("div", { className: "flex gap-2 items-center mb-2", children: [
258
+ x && /* @__PURE__ */ e("div", { className: "flex-1 max-w-80", children: /* @__PURE__ */ e(
259
+ Ie,
220
260
  {
221
- value: p,
222
- onChange: w,
261
+ value: L,
262
+ onChange: S,
223
263
  placeholder: "Search resources...",
224
264
  size: "small"
225
265
  }
226
266
  ) }),
227
- T && /* @__PURE__ */ r("div", { className: "flex gap-0.5", children: [
228
- /* @__PURE__ */ r(B, { children: [
229
- /* @__PURE__ */ e(D, { children: /* @__PURE__ */ e(
230
- L,
267
+ C && /* @__PURE__ */ s("div", { className: "flex gap-0.5", children: [
268
+ /* @__PURE__ */ s(Y, { children: [
269
+ /* @__PURE__ */ e(J, { children: /* @__PURE__ */ e(
270
+ E,
231
271
  {
232
272
  variant: "ghost",
233
273
  size: "icon-xs",
234
274
  "aria-label": "List view",
235
- className: f(d === "list" && "text-primary"),
236
- onClick: () => m("list"),
237
- children: /* @__PURE__ */ e(ne, { size: 18 })
275
+ className: T(U === "list" && "text-primary"),
276
+ onClick: () => V("list"),
277
+ children: /* @__PURE__ */ e(Ue, { size: 18 })
238
278
  }
239
279
  ) }),
240
- /* @__PURE__ */ e(F, { children: "List view" })
280
+ /* @__PURE__ */ e(X, { children: "List view" })
241
281
  ] }),
242
- /* @__PURE__ */ r(B, { children: [
243
- /* @__PURE__ */ e(D, { children: /* @__PURE__ */ e(
244
- L,
282
+ /* @__PURE__ */ s(Y, { children: [
283
+ /* @__PURE__ */ e(J, { children: /* @__PURE__ */ e(
284
+ E,
245
285
  {
246
286
  variant: "ghost",
247
287
  size: "icon-xs",
248
288
  "aria-label": "Grid view",
249
- className: f(d === "grid" && "text-primary"),
250
- onClick: () => m("grid"),
251
- children: /* @__PURE__ */ e(re, { size: 18 })
289
+ className: T(U === "grid" && "text-primary"),
290
+ onClick: () => V("grid"),
291
+ children: /* @__PURE__ */ e(je, { size: 18 })
252
292
  }
253
293
  ) }),
254
- /* @__PURE__ */ e(F, { children: "Grid view" })
294
+ /* @__PURE__ */ e(X, { children: "Grid view" })
255
295
  ] })
256
296
  ] })
257
297
  ] }),
258
- h && h.length > 0 && /* @__PURE__ */ e(
259
- q,
298
+ r && r.length > 0 && /* @__PURE__ */ e(
299
+ Le,
260
300
  {
261
- value: i ?? "all",
262
- onValueChange: (t) => c(t === "all" ? null : t),
301
+ value: g ?? "all",
302
+ onValueChange: (n) => k(n === "all" ? null : n),
263
303
  className: "mb-2",
264
- children: /* @__PURE__ */ r(ee, { children: [
265
- /* @__PURE__ */ e(M, { value: "all", children: "All" }),
266
- h.map((t) => /* @__PURE__ */ e(M, { value: t.uid, children: t.label }, t.uid))
304
+ children: /* @__PURE__ */ s(Pe, { children: [
305
+ /* @__PURE__ */ e(me, { value: "all", children: "All" }),
306
+ r.map((n) => /* @__PURE__ */ e(me, { value: n.uid, children: n.label }, n.uid))
267
307
  ] })
268
308
  }
269
309
  ),
270
- P.length === 0 ? /* @__PURE__ */ e(K, { title: N, description: "Try adjusting your search or filter." }) : d === "list" ? /* @__PURE__ */ e(Q, { children: P.map(j) }) : /* @__PURE__ */ e("div", { className: "grid grid-cols-[repeat(auto-fill,minmax(240px,1fr))] gap-2", children: P.map((t) => /* @__PURE__ */ e(
271
- Q,
310
+ F.length === 0 ? /* @__PURE__ */ e(te, { title: p, description: "Try adjusting your search or filter." }) : U === "list" ? /* @__PURE__ */ e(W, { children: (v && c ? F.slice((d - 1) * c, d * c) : F).map(G) }) : /* @__PURE__ */ e("div", { className: "grid grid-cols-[repeat(auto-fill,minmax(240px,1fr))] gap-2", children: (v && c ? F.slice((d - 1) * c, d * c) : F).map((n) => /* @__PURE__ */ e(
311
+ W,
272
312
  {
273
- className: f(
313
+ className: T(
274
314
  "transition-colors",
275
- !u && "cursor-pointer hover:border-primary"
315
+ !h && a && "cursor-pointer hover:border-primary"
276
316
  ),
277
- onClick: () => !u && x(t),
278
- children: /* @__PURE__ */ r(I, { className: "pt-4 pb-4", children: [
279
- /* @__PURE__ */ r("div", { className: "flex gap-1 items-center mb-1", children: [
280
- /* @__PURE__ */ e(G, { type: H[t.type] ?? "document", size: 20 }),
281
- /* @__PURE__ */ e("span", { className: "font-semibold text-sm text-foreground truncate", children: t.name })
317
+ onClick: () => !h && (a == null ? void 0 : a(n)),
318
+ children: /* @__PURE__ */ s(q, { className: "pt-4 pb-4", children: [
319
+ /* @__PURE__ */ s("div", { className: "flex gap-1 items-center mb-1", children: [
320
+ /* @__PURE__ */ e(se, { type: he[n.type] ?? "document", size: 20 }),
321
+ /* @__PURE__ */ e("span", { className: "font-semibold text-sm text-foreground truncate", children: n.name })
282
322
  ] }),
283
- t.description && /* @__PURE__ */ e("p", { className: "text-sm text-muted-foreground mb-1 truncate", children: t.description }),
284
- t.fileSize != null && /* @__PURE__ */ e("span", { className: "text-xs text-muted-foreground", children: _(t.fileSize) })
323
+ n.description && /* @__PURE__ */ e("p", { className: "text-sm text-muted-foreground mb-1 truncate", children: n.description }),
324
+ n.fileSize != null && /* @__PURE__ */ e("span", { className: "text-xs text-muted-foreground", children: ue(n.fileSize) })
285
325
  ] })
286
326
  },
287
- t.uid
288
- )) })
327
+ n.uid
328
+ )) }),
329
+ v && c && F.length > 0 && /* @__PURE__ */ e(
330
+ De,
331
+ {
332
+ currentPage: d,
333
+ totalPages: Math.ceil((y ?? F.length) / c),
334
+ onPageChange: v,
335
+ className: "mt-4"
336
+ }
337
+ )
289
338
  ] });
290
339
  }
340
+ const le = [
341
+ { type: "richtext", label: "Rich Text", description: "Formatted text content" },
342
+ { type: "heading", label: "Heading", description: "Section heading" },
343
+ { type: "image", label: "Image", description: "Image with caption" },
344
+ { type: "video", label: "Video", description: "Video player" },
345
+ { type: "code", label: "Code", description: "Code snippet" },
346
+ { type: "callout", label: "Callout", description: "Info, warning, or tip" },
347
+ { type: "audio", label: "Audio", description: "Audio player" },
348
+ { type: "embed", label: "Embed", description: "External embed" },
349
+ { type: "table", label: "Table", description: "Data table" },
350
+ { type: "file", label: "Files", description: "File attachments" },
351
+ { type: "divider", label: "Divider", description: "Horizontal separator" }
352
+ ], Se = {
353
+ richtext: de,
354
+ heading: Xe,
355
+ image: Je,
356
+ video: Ye,
357
+ code: Ke,
358
+ callout: We,
359
+ audio: Ge,
360
+ embed: Oe,
361
+ table: He,
362
+ file: Ve,
363
+ divider: $e
364
+ };
365
+ function ft(t) {
366
+ return Se[t] ?? de;
367
+ }
368
+ function gt(t) {
369
+ var r;
370
+ return ((r = le.find((a) => a.type === t)) == null ? void 0 : r.label) ?? t;
371
+ }
291
372
  function fe({
292
- announcements: l,
293
- onMarkRead: h,
294
- onSelect: x,
295
- showAvatars: b = !0,
296
- previewLines: z = 3,
297
- emptyMessage: T = "No announcements yet",
298
- readOnly: g = !1,
299
- className: N,
300
- style: u
373
+ onSelect: t,
374
+ allowedTypes: r,
375
+ className: a
376
+ }) {
377
+ const [i, l] = j(!1), C = Z(null), x = r ? le.filter((p) => r.includes(p.type)) : le;
378
+ return Ne(() => {
379
+ if (!i) return;
380
+ function p(h) {
381
+ C.current && !C.current.contains(h.target) && l(!1);
382
+ }
383
+ return document.addEventListener("mousedown", p), () => document.removeEventListener("mousedown", p);
384
+ }, [i]), /* @__PURE__ */ s("div", { className: T("relative", a), ref: C, children: [
385
+ /* @__PURE__ */ s(
386
+ E,
387
+ {
388
+ variant: "ghost",
389
+ size: "sm",
390
+ onClick: () => l(!i),
391
+ className: "text-muted-foreground hover:text-foreground gap-1 h-7 text-xs",
392
+ children: [
393
+ /* @__PURE__ */ e(Qe, { className: "size-3.5" }),
394
+ "Add block"
395
+ ]
396
+ }
397
+ ),
398
+ i && /* @__PURE__ */ e("div", { className: "absolute left-1/2 -translate-x-1/2 top-full mt-1 z-50 w-72 rounded-lg border border-border bg-background shadow-lg p-2", children: /* @__PURE__ */ e("div", { className: "grid grid-cols-3 gap-1", children: x.map(({ type: p, label: h }) => {
399
+ const N = Se[p] ?? de;
400
+ return /* @__PURE__ */ s(
401
+ "button",
402
+ {
403
+ type: "button",
404
+ onClick: () => {
405
+ t(p), l(!1);
406
+ },
407
+ className: "flex flex-col items-center gap-1 rounded-md p-2 text-xs text-muted-foreground hover:bg-muted hover:text-foreground transition-colors",
408
+ children: [
409
+ /* @__PURE__ */ e(N, { className: "size-4" }),
410
+ /* @__PURE__ */ e("span", { children: h })
411
+ ]
412
+ },
413
+ p
414
+ );
415
+ }) }) })
416
+ ] });
417
+ }
418
+ const vt = ce(function({
419
+ item: r,
420
+ onChange: a,
421
+ onRemove: i,
422
+ onDuplicate: l,
423
+ onToggleCollapse: C,
424
+ dragProps: x,
425
+ isDragging: p,
426
+ isDragOver: h
427
+ }) {
428
+ const { id: N, block: I, collapsed: m } = r, c = ft(I.type), d = gt(I.type), y = B(
429
+ (L) => a(N, L),
430
+ [N, a]
431
+ ), v = B(() => i(N), [N, i]), D = B(() => l(N), [N, l]), w = B(() => C(N), [N, C]);
432
+ return /* @__PURE__ */ s(
433
+ "div",
434
+ {
435
+ ...x,
436
+ className: T(
437
+ "group rounded-lg border border-border bg-background transition-all",
438
+ p && "opacity-50",
439
+ h && "border-primary shadow-sm"
440
+ ),
441
+ children: [
442
+ /* @__PURE__ */ s("div", { className: "flex items-center gap-1 px-2 py-1.5 border-b border-border/50", children: [
443
+ /* @__PURE__ */ e(
444
+ "span",
445
+ {
446
+ className: "cursor-grab text-muted-foreground/50 hover:text-muted-foreground",
447
+ "aria-label": "Drag to reorder",
448
+ children: /* @__PURE__ */ e(Ze, { className: "size-4" })
449
+ }
450
+ ),
451
+ /* @__PURE__ */ e(
452
+ "button",
453
+ {
454
+ type: "button",
455
+ onClick: w,
456
+ className: "text-muted-foreground hover:text-foreground p-0.5",
457
+ children: m ? /* @__PURE__ */ e(qe, { className: "size-3.5" }) : /* @__PURE__ */ e(et, { className: "size-3.5" })
458
+ }
459
+ ),
460
+ /* @__PURE__ */ s(ae, { variant: "secondary", className: "text-[10px] gap-1 px-1.5 py-0", children: [
461
+ /* @__PURE__ */ e(c, { className: "size-3" }),
462
+ d
463
+ ] }),
464
+ /* @__PURE__ */ e("div", { className: "flex-1" }),
465
+ /* @__PURE__ */ e(
466
+ E,
467
+ {
468
+ variant: "ghost",
469
+ size: "sm",
470
+ onClick: D,
471
+ className: "h-6 w-6 p-0 opacity-0 group-hover:opacity-100 text-muted-foreground",
472
+ children: /* @__PURE__ */ e(tt, { className: "size-3" })
473
+ }
474
+ ),
475
+ /* @__PURE__ */ e(
476
+ E,
477
+ {
478
+ variant: "ghost",
479
+ size: "sm",
480
+ onClick: v,
481
+ className: "h-6 w-6 p-0 opacity-0 group-hover:opacity-100 text-destructive",
482
+ children: /* @__PURE__ */ e(ie, { className: "size-3" })
483
+ }
484
+ )
485
+ ] }),
486
+ !m && /* @__PURE__ */ e("div", { className: "p-3", children: /* @__PURE__ */ e(xt, { block: I, onChange: y }) })
487
+ ]
488
+ }
489
+ );
490
+ });
491
+ function xt({
492
+ block: t,
493
+ onChange: r
494
+ }) {
495
+ switch (t.type) {
496
+ case "richtext":
497
+ return /* @__PURE__ */ e(
498
+ Ee,
499
+ {
500
+ value: t.html,
501
+ onChange: (a) => r({ ...t, html: a }),
502
+ placeholder: "Write your content..."
503
+ }
504
+ );
505
+ case "heading":
506
+ return /* @__PURE__ */ s("div", { className: "flex gap-2", children: [
507
+ /* @__PURE__ */ s(
508
+ "select",
509
+ {
510
+ value: t.level ?? 2,
511
+ onChange: (a) => r({ ...t, level: Number(a.target.value) }),
512
+ className: "h-9 rounded-md border border-input bg-transparent px-2 text-sm",
513
+ children: [
514
+ /* @__PURE__ */ e("option", { value: 1, children: "H1" }),
515
+ /* @__PURE__ */ e("option", { value: 2, children: "H2" }),
516
+ /* @__PURE__ */ e("option", { value: 3, children: "H3" })
517
+ ]
518
+ }
519
+ ),
520
+ /* @__PURE__ */ e(
521
+ A,
522
+ {
523
+ value: t.text,
524
+ onChange: (a) => r({ ...t, text: a.target.value }),
525
+ placeholder: "Heading text...",
526
+ className: "flex-1"
527
+ }
528
+ )
529
+ ] });
530
+ case "image":
531
+ return /* @__PURE__ */ s("div", { className: "space-y-2", children: [
532
+ /* @__PURE__ */ e(
533
+ A,
534
+ {
535
+ value: t.src,
536
+ onChange: (a) => r({ ...t, src: a.target.value }),
537
+ placeholder: "Image URL..."
538
+ }
539
+ ),
540
+ /* @__PURE__ */ s("div", { className: "flex gap-2", children: [
541
+ /* @__PURE__ */ e(
542
+ A,
543
+ {
544
+ value: t.alt ?? "",
545
+ onChange: (a) => r({ ...t, alt: a.target.value }),
546
+ placeholder: "Alt text...",
547
+ className: "flex-1"
548
+ }
549
+ ),
550
+ /* @__PURE__ */ e(
551
+ A,
552
+ {
553
+ value: t.caption ?? "",
554
+ onChange: (a) => r({ ...t, caption: a.target.value }),
555
+ placeholder: "Caption...",
556
+ className: "flex-1"
557
+ }
558
+ )
559
+ ] }),
560
+ t.src && /* @__PURE__ */ e(
561
+ "img",
562
+ {
563
+ src: t.src,
564
+ alt: t.alt ?? "",
565
+ className: "max-h-40 rounded-md object-cover"
566
+ }
567
+ )
568
+ ] });
569
+ case "video":
570
+ return /* @__PURE__ */ s("div", { className: "space-y-2", children: [
571
+ /* @__PURE__ */ e(
572
+ A,
573
+ {
574
+ value: t.video.src ?? "",
575
+ onChange: (a) => r({ ...t, video: { ...t.video, src: a.target.value } }),
576
+ placeholder: "Video URL..."
577
+ }
578
+ ),
579
+ /* @__PURE__ */ e(
580
+ A,
581
+ {
582
+ value: t.video.title ?? "",
583
+ onChange: (a) => r({ ...t, video: { ...t.video, title: a.target.value } }),
584
+ placeholder: "Video title..."
585
+ }
586
+ )
587
+ ] });
588
+ case "code":
589
+ return /* @__PURE__ */ s("div", { className: "space-y-2", children: [
590
+ /* @__PURE__ */ s("div", { className: "flex gap-2", children: [
591
+ /* @__PURE__ */ e(
592
+ A,
593
+ {
594
+ value: t.language ?? "",
595
+ onChange: (a) => r({ ...t, language: a.target.value }),
596
+ placeholder: "Language (e.g. javascript)",
597
+ className: "w-40"
598
+ }
599
+ ),
600
+ /* @__PURE__ */ e(
601
+ A,
602
+ {
603
+ value: t.filename ?? "",
604
+ onChange: (a) => r({ ...t, filename: a.target.value }),
605
+ placeholder: "Filename (optional)",
606
+ className: "flex-1"
607
+ }
608
+ )
609
+ ] }),
610
+ /* @__PURE__ */ e(
611
+ "textarea",
612
+ {
613
+ value: t.code,
614
+ onChange: (a) => r({ ...t, code: a.target.value }),
615
+ placeholder: "Paste your code...",
616
+ className: "w-full min-h-24 rounded-md border border-input bg-muted p-3 font-mono text-sm resize-y focus:outline-none focus:ring-2 focus:ring-ring",
617
+ spellCheck: !1
618
+ }
619
+ )
620
+ ] });
621
+ case "callout":
622
+ return /* @__PURE__ */ s("div", { className: "space-y-2", children: [
623
+ /* @__PURE__ */ s(
624
+ "select",
625
+ {
626
+ value: t.variant ?? "info",
627
+ onChange: (a) => r({
628
+ ...t,
629
+ variant: a.target.value
630
+ }),
631
+ className: "h-9 rounded-md border border-input bg-transparent px-2 text-sm",
632
+ children: [
633
+ /* @__PURE__ */ e("option", { value: "info", children: "Info" }),
634
+ /* @__PURE__ */ e("option", { value: "warning", children: "Warning" }),
635
+ /* @__PURE__ */ e("option", { value: "tip", children: "Tip" })
636
+ ]
637
+ }
638
+ ),
639
+ /* @__PURE__ */ e(
640
+ A,
641
+ {
642
+ value: t.content,
643
+ onChange: (a) => r({ ...t, content: a.target.value }),
644
+ placeholder: "Callout text..."
645
+ }
646
+ )
647
+ ] });
648
+ case "audio":
649
+ return /* @__PURE__ */ s("div", { className: "space-y-2", children: [
650
+ /* @__PURE__ */ e(
651
+ A,
652
+ {
653
+ value: t.src,
654
+ onChange: (a) => r({ ...t, src: a.target.value }),
655
+ placeholder: "Audio URL..."
656
+ }
657
+ ),
658
+ /* @__PURE__ */ e(
659
+ A,
660
+ {
661
+ value: t.title ?? "",
662
+ onChange: (a) => r({ ...t, title: a.target.value }),
663
+ placeholder: "Title (optional)"
664
+ }
665
+ )
666
+ ] });
667
+ case "embed":
668
+ return /* @__PURE__ */ s("div", { className: "space-y-2", children: [
669
+ /* @__PURE__ */ e(
670
+ A,
671
+ {
672
+ value: t.src,
673
+ onChange: (a) => r({ ...t, src: a.target.value }),
674
+ placeholder: "Embed URL..."
675
+ }
676
+ ),
677
+ /* @__PURE__ */ s("div", { className: "flex gap-2", children: [
678
+ /* @__PURE__ */ e(
679
+ A,
680
+ {
681
+ value: t.title ?? "",
682
+ onChange: (a) => r({ ...t, title: a.target.value }),
683
+ placeholder: "Title (optional)",
684
+ className: "flex-1"
685
+ }
686
+ ),
687
+ /* @__PURE__ */ s(
688
+ "select",
689
+ {
690
+ value: t.aspectRatio ?? "16/9",
691
+ onChange: (a) => r({
692
+ ...t,
693
+ aspectRatio: a.target.value
694
+ }),
695
+ className: "h-9 rounded-md border border-input bg-transparent px-2 text-sm",
696
+ children: [
697
+ /* @__PURE__ */ e("option", { value: "16/9", children: "16:9" }),
698
+ /* @__PURE__ */ e("option", { value: "4/3", children: "4:3" }),
699
+ /* @__PURE__ */ e("option", { value: "1/1", children: "1:1" })
700
+ ]
701
+ }
702
+ )
703
+ ] })
704
+ ] });
705
+ case "table":
706
+ return /* @__PURE__ */ e(Nt, { block: t, onChange: r });
707
+ case "file":
708
+ return /* @__PURE__ */ s("p", { className: "text-sm text-muted-foreground", children: [
709
+ "File attachments are managed via the ",
710
+ /* @__PURE__ */ e("code", { className: "text-xs", children: "files" }),
711
+ " prop.",
712
+ t.files.length > 0 && /* @__PURE__ */ s("span", { className: "ml-1", children: [
713
+ "(",
714
+ t.files.length,
715
+ " file",
716
+ t.files.length !== 1 && "s",
717
+ " attached)"
718
+ ] })
719
+ ] });
720
+ case "divider":
721
+ return /* @__PURE__ */ e(ee, {});
722
+ case "question":
723
+ case "flashcards":
724
+ return /* @__PURE__ */ s("p", { className: "text-sm text-muted-foreground italic", children: [
725
+ "Interactive ",
726
+ t.type,
727
+ " blocks are configured via props."
728
+ ] });
729
+ case "custom":
730
+ return /* @__PURE__ */ e("p", { className: "text-sm text-muted-foreground italic", children: "Custom blocks are not editable in the authoring studio." });
731
+ default:
732
+ return null;
733
+ }
734
+ }
735
+ function Nt({
736
+ block: t,
737
+ onChange: r
301
738
  }) {
302
- const [k, A] = S(/* @__PURE__ */ new Set()), p = U(() => {
303
- const i = l.filter((d) => d.isPinned), c = l.filter((d) => !d.isPinned);
304
- return [...i, ...c];
305
- }, [l]);
306
- function w(i) {
307
- A((d) => {
308
- const m = new Set(d);
309
- return m.has(i) ? m.delete(i) : m.add(i), m;
739
+ const { headers: a, rows: i, caption: l } = t;
740
+ function C(m, c) {
741
+ const d = [...a];
742
+ d[m] = c, r({ ...t, headers: d });
743
+ }
744
+ function x(m, c, d) {
745
+ const y = i.map((v) => [...v]);
746
+ y[m][c] = d, r({ ...t, rows: y });
747
+ }
748
+ function p() {
749
+ r({
750
+ ...t,
751
+ headers: [...a, ""],
752
+ rows: i.map((m) => [...m, ""])
753
+ });
754
+ }
755
+ function h(m) {
756
+ a.length <= 1 || r({
757
+ ...t,
758
+ headers: a.filter((c, d) => d !== m),
759
+ rows: i.map((c) => c.filter((d, y) => y !== m))
310
760
  });
311
- const c = l.find((d) => d.uid === i);
312
- c && !c.isRead && (h == null || h(i));
313
761
  }
314
- return p.length === 0 ? /* @__PURE__ */ e("div", { className: N, style: u, children: /* @__PURE__ */ e(K, { title: T }) }) : /* @__PURE__ */ e("div", { className: f("flex flex-col gap-2", N), style: u, children: p.map((i) => {
315
- const c = k.has(i.uid);
316
- return /* @__PURE__ */ e(
317
- Q,
762
+ function N() {
763
+ r({
764
+ ...t,
765
+ rows: [...i, a.map(() => "")]
766
+ });
767
+ }
768
+ function I(m) {
769
+ r({
770
+ ...t,
771
+ rows: i.filter((c, d) => d !== m)
772
+ });
773
+ }
774
+ return /* @__PURE__ */ s("div", { className: "space-y-2", children: [
775
+ /* @__PURE__ */ e(
776
+ A,
318
777
  {
319
- className: f(
320
- i.isRead && "opacity-85",
321
- x && "cursor-pointer",
322
- i.isPinned && "border-l-4 border-l-warning"
323
- ),
324
- onClick: () => x && !g ? x(i) : w(i.uid),
325
- children: /* @__PURE__ */ e(I, { className: "py-4", children: /* @__PURE__ */ r("div", { className: "flex gap-1.5 items-start", children: [
326
- b && /* @__PURE__ */ e(
778
+ value: l ?? "",
779
+ onChange: (m) => r({ ...t, caption: m.target.value }),
780
+ placeholder: "Table caption (optional)",
781
+ className: "text-sm"
782
+ }
783
+ ),
784
+ /* @__PURE__ */ e("div", { className: "overflow-x-auto", children: /* @__PURE__ */ s("table", { className: "w-full text-sm", children: [
785
+ /* @__PURE__ */ e("thead", { children: /* @__PURE__ */ s("tr", { children: [
786
+ a.map((m, c) => /* @__PURE__ */ e("th", { className: "p-1", children: /* @__PURE__ */ s("div", { className: "flex gap-0.5", children: [
787
+ /* @__PURE__ */ e(
788
+ A,
789
+ {
790
+ value: m,
791
+ onChange: (d) => C(c, d.target.value),
792
+ placeholder: `Col ${c + 1}`,
793
+ className: "h-7 text-xs font-semibold"
794
+ }
795
+ ),
796
+ a.length > 1 && /* @__PURE__ */ e(
797
+ E,
798
+ {
799
+ variant: "ghost",
800
+ size: "sm",
801
+ onClick: () => h(c),
802
+ className: "h-7 w-7 p-0 text-destructive shrink-0",
803
+ children: /* @__PURE__ */ e(ie, { className: "size-3" })
804
+ }
805
+ )
806
+ ] }) }, c)),
807
+ /* @__PURE__ */ e("th", { className: "p-1 w-8", children: /* @__PURE__ */ e(
808
+ E,
809
+ {
810
+ variant: "ghost",
811
+ size: "sm",
812
+ onClick: p,
813
+ className: "h-7 w-7 p-0 text-muted-foreground",
814
+ children: "+"
815
+ }
816
+ ) })
817
+ ] }) }),
818
+ /* @__PURE__ */ e("tbody", { children: i.map((m, c) => /* @__PURE__ */ s("tr", { children: [
819
+ m.map((d, y) => /* @__PURE__ */ e("td", { className: "p-1", children: /* @__PURE__ */ e(
820
+ A,
821
+ {
822
+ value: d,
823
+ onChange: (v) => x(c, y, v.target.value),
824
+ className: "h-7 text-xs"
825
+ }
826
+ ) }, y)),
827
+ /* @__PURE__ */ e("td", { className: "p-1", children: /* @__PURE__ */ e(
828
+ E,
829
+ {
830
+ variant: "ghost",
831
+ size: "sm",
832
+ onClick: () => I(c),
833
+ className: "h-7 w-7 p-0 text-destructive",
834
+ children: /* @__PURE__ */ e(ie, { className: "size-3" })
835
+ }
836
+ ) })
837
+ ] }, c)) })
838
+ ] }) }),
839
+ /* @__PURE__ */ e(
840
+ E,
841
+ {
842
+ variant: "ghost",
843
+ size: "sm",
844
+ onClick: N,
845
+ className: "text-xs text-muted-foreground",
846
+ children: "+ Add row"
847
+ }
848
+ )
849
+ ] });
850
+ }
851
+ let bt = 0;
852
+ function re() {
853
+ return `ab_${++bt}_${Date.now().toString(36)}`;
854
+ }
855
+ function yt(t) {
856
+ return t.map((r) => ({ id: re(), block: r }));
857
+ }
858
+ function wt(t) {
859
+ switch (t) {
860
+ case "richtext":
861
+ return { type: "richtext", html: "" };
862
+ case "heading":
863
+ return { type: "heading", text: "", level: 2 };
864
+ case "image":
865
+ return { type: "image", src: "", alt: "" };
866
+ case "video":
867
+ return { type: "video", video: { src: "" } };
868
+ case "code":
869
+ return { type: "code", code: "", language: "javascript" };
870
+ case "callout":
871
+ return { type: "callout", content: "", variant: "info" };
872
+ case "audio":
873
+ return { type: "audio", src: "" };
874
+ case "embed":
875
+ return { type: "embed", src: "" };
876
+ case "table":
877
+ return { type: "table", headers: ["Column 1", "Column 2"], rows: [["", ""]] };
878
+ case "file":
879
+ return { type: "file", files: [] };
880
+ case "divider":
881
+ return { type: "divider" };
882
+ case "question":
883
+ return {
884
+ type: "question",
885
+ question: {
886
+ uid: re(),
887
+ type: "multiple_choice",
888
+ content: "",
889
+ answers: []
890
+ }
891
+ };
892
+ case "flashcards":
893
+ return { type: "flashcards", cards: [] };
894
+ case "custom":
895
+ return { type: "custom", render: null };
896
+ default:
897
+ return { type: "richtext", html: "" };
898
+ }
899
+ }
900
+ function Ct({
901
+ title: t = "",
902
+ blocks: r,
903
+ onBlocksChange: a,
904
+ onTitleChange: i,
905
+ onSave: l,
906
+ showPreviewToggle: C = !0,
907
+ allowedBlockTypes: x,
908
+ readOnly: p = !1,
909
+ isLoading: h,
910
+ error: N,
911
+ onRetry: I,
912
+ className: m,
913
+ style: c
914
+ }) {
915
+ const [d, y] = j(t), [v, D] = j(
916
+ () => yt(r ?? [])
917
+ ), [w, L] = j(p ? "preview" : "edit"), S = O(() => v.map((u) => u.block), [v]), g = B(
918
+ (u) => {
919
+ D(u), a == null || a(u.map((z) => z.block));
920
+ },
921
+ [a]
922
+ ), k = Z(v);
923
+ k.current = v;
924
+ function U(u, z) {
925
+ const P = { id: re(), block: wt(u) }, K = [...v];
926
+ K.splice(z, 0, P), g(K);
927
+ }
928
+ const V = B((u, z) => {
929
+ g(k.current.map((P) => P.id === u ? { ...P, block: z } : P));
930
+ }, [g]), F = B((u) => {
931
+ g(k.current.filter((z) => z.id !== u));
932
+ }, [g]), G = B((u) => {
933
+ const z = k.current, P = z.findIndex((ze) => ze.id === u);
934
+ if (P === -1) return;
935
+ const K = {
936
+ id: re(),
937
+ block: structuredClone(z[P].block)
938
+ }, oe = [...z];
939
+ oe.splice(P + 1, 0, K), g(oe);
940
+ }, [g]), n = B((u) => {
941
+ D(
942
+ (z) => z.map(
943
+ (P) => P.id === u ? { ...P, collapsed: !P.collapsed } : P
944
+ )
945
+ );
946
+ }, []);
947
+ function _(u) {
948
+ y(u), i == null || i(u);
949
+ }
950
+ function o() {
951
+ l == null || l({ title: d, blocks: S });
952
+ }
953
+ const { getDragProps: f, dragIndex: b, dragOverIndex: M } = Be({
954
+ items: v,
955
+ onReorder: g,
956
+ disabled: p || w === "preview"
957
+ }), Q = w === "edit" && !p;
958
+ return /* @__PURE__ */ e(
959
+ ne,
960
+ {
961
+ isLoading: h,
962
+ error: N,
963
+ onRetry: I,
964
+ className: m,
965
+ style: c,
966
+ skeleton: /* @__PURE__ */ s($, { children: [
967
+ /* @__PURE__ */ e(R, { className: "h-10 w-64" }),
968
+ /* @__PURE__ */ e(R, { className: "h-6 w-32" }),
969
+ /* @__PURE__ */ e(R, { className: "h-32 w-full" }),
970
+ /* @__PURE__ */ e(R, { className: "h-24 w-full" }),
971
+ /* @__PURE__ */ e(R, { className: "h-32 w-full" })
972
+ ] }),
973
+ children: /* @__PURE__ */ s("div", { children: [
974
+ /* @__PURE__ */ s("div", { className: "flex items-center gap-2 mb-4", children: [
975
+ Q ? /* @__PURE__ */ e(
976
+ A,
977
+ {
978
+ value: d,
979
+ onChange: (u) => _(u.target.value),
980
+ placeholder: "Lesson title...",
981
+ className: "text-lg font-semibold flex-1 h-10"
982
+ }
983
+ ) : /* @__PURE__ */ e("h2", { className: "text-xl font-bold flex-1 text-foreground", children: d || "Untitled Lesson" }),
984
+ C && !p && /* @__PURE__ */ e(
985
+ E,
986
+ {
987
+ variant: "outline",
988
+ size: "sm",
989
+ onClick: () => L(w === "edit" ? "preview" : "edit"),
990
+ className: "gap-1.5",
991
+ children: w === "edit" ? /* @__PURE__ */ s($, { children: [
992
+ /* @__PURE__ */ e(at, { className: "size-3.5" }),
993
+ " Preview"
994
+ ] }) : /* @__PURE__ */ s($, { children: [
995
+ /* @__PURE__ */ e(rt, { className: "size-3.5" }),
996
+ " Edit"
997
+ ] })
998
+ }
999
+ ),
1000
+ l && !p && /* @__PURE__ */ s(E, { size: "sm", onClick: o, className: "gap-1.5", children: [
1001
+ /* @__PURE__ */ e(st, { className: "size-3.5" }),
1002
+ " Save"
1003
+ ] })
1004
+ ] }),
1005
+ Q ? /* @__PURE__ */ s("div", { className: "space-y-1", children: [
1006
+ /* @__PURE__ */ e("div", { className: "flex justify-center py-1", children: /* @__PURE__ */ e(
1007
+ fe,
1008
+ {
1009
+ onSelect: (u) => U(u, 0),
1010
+ allowedTypes: x
1011
+ }
1012
+ ) }),
1013
+ v.length === 0 && /* @__PURE__ */ e(
327
1014
  te,
328
1015
  {
329
- displayName: i.author.displayName,
330
- avatarUrl: i.author.avatarUrl,
331
- role: i.author.role,
332
- size: "medium"
1016
+ title: "No content blocks",
1017
+ description: "Click 'Add block' above to start building your lesson."
333
1018
  }
334
1019
  ),
335
- /* @__PURE__ */ r("div", { className: "flex-1 min-w-0", children: [
336
- /* @__PURE__ */ r("div", { className: "flex items-center gap-1 mb-0.5", children: [
337
- i.isPinned && /* @__PURE__ */ e(le, { size: 14 }),
338
- /* @__PURE__ */ e(
339
- "span",
340
- {
341
- className: f("text-foreground", i.isRead ? "font-normal" : "font-semibold"),
342
- children: i.title
343
- }
344
- ),
345
- !i.isRead && /* @__PURE__ */ e(ie, { variant: "destructive", className: "text-[10px] px-1.5 py-0", children: "New" })
1020
+ v.map((u, z) => /* @__PURE__ */ s("div", { children: [
1021
+ /* @__PURE__ */ e(
1022
+ vt,
1023
+ {
1024
+ item: u,
1025
+ onChange: V,
1026
+ onRemove: F,
1027
+ onDuplicate: G,
1028
+ onToggleCollapse: n,
1029
+ dragProps: f(z),
1030
+ isDragging: b === z,
1031
+ isDragOver: M === z
1032
+ }
1033
+ ),
1034
+ /* @__PURE__ */ e("div", { className: "flex justify-center py-1", children: /* @__PURE__ */ e(
1035
+ fe,
1036
+ {
1037
+ onSelect: (P) => U(P, z + 1),
1038
+ allowedTypes: x
1039
+ }
1040
+ ) })
1041
+ ] }, u.id))
1042
+ ] }) : (
1043
+ /* Preview mode */
1044
+ /* @__PURE__ */ e("div", { className: "flex flex-col gap-3", children: v.length > 0 ? v.map((u) => /* @__PURE__ */ e(Re, { block: u.block, readOnly: !0 }, u.id)) : /* @__PURE__ */ e(
1045
+ te,
1046
+ {
1047
+ title: "No content yet",
1048
+ description: "Switch to edit mode to add content blocks."
1049
+ }
1050
+ ) })
1051
+ )
1052
+ ] })
1053
+ }
1054
+ );
1055
+ }
1056
+ const Mt = be(
1057
+ Ct,
1058
+ "ContentAuthoringStudio"
1059
+ ), St = {
1060
+ mastered: { label: "Mastered", variant: "success", icon: ct },
1061
+ completed: { label: "Completed", variant: "success", icon: nt },
1062
+ in_progress: { label: "In Progress", variant: "info", icon: lt },
1063
+ available: { label: "Available", variant: "secondary" },
1064
+ locked: { label: "Locked", variant: "muted", icon: we },
1065
+ skipped: { label: "Skipped", variant: "muted", icon: it }
1066
+ }, zt = ce(function({
1067
+ node: r,
1068
+ onClick: a,
1069
+ onStart: i,
1070
+ readOnly: l = !1,
1071
+ className: C
1072
+ }) {
1073
+ const x = St[r.status], p = x.icon, h = r.status !== "locked" && !l, N = !l && (r.status === "available" || r.recommended) && r.status !== "locked" && r.status !== "completed" && r.status !== "mastered" && i, I = B(() => {
1074
+ h && a && a(r.uid);
1075
+ }, [h, a, r.uid]), m = B(
1076
+ (d) => {
1077
+ (d.key === "Enter" || d.key === " ") && (d.preventDefault(), a == null || a(r.uid));
1078
+ },
1079
+ [a, r.uid]
1080
+ ), c = B(
1081
+ (d) => {
1082
+ d.stopPropagation(), i == null || i(r.uid);
1083
+ },
1084
+ [i, r.uid]
1085
+ );
1086
+ return /* @__PURE__ */ e(
1087
+ W,
1088
+ {
1089
+ className: T(
1090
+ "transition-all",
1091
+ h && a && "cursor-pointer hover:border-primary/50 hover:shadow-md",
1092
+ r.status === "in_progress" && "border-primary ring-1 ring-primary/20",
1093
+ r.status === "locked" && "opacity-60",
1094
+ r.status === "skipped" && "opacity-50",
1095
+ r.recommended && r.status !== "locked" && "border-primary/40",
1096
+ C
1097
+ ),
1098
+ onClick: h && a ? I : void 0,
1099
+ role: h && a ? "button" : void 0,
1100
+ tabIndex: h && a ? 0 : void 0,
1101
+ onKeyDown: h && a ? m : void 0,
1102
+ children: /* @__PURE__ */ e(q, { className: "p-4", children: /* @__PURE__ */ s("div", { className: "flex items-start gap-3", children: [
1103
+ /* @__PURE__ */ e(
1104
+ "div",
1105
+ {
1106
+ className: T(
1107
+ "shrink-0 w-9 h-9 rounded-lg flex items-center justify-center",
1108
+ r.status === "locked" ? "bg-muted text-muted-foreground" : "bg-primary/10 text-primary"
1109
+ ),
1110
+ children: r.icon ?? /* @__PURE__ */ e(se, { type: r.type, size: 18 })
1111
+ }
1112
+ ),
1113
+ /* @__PURE__ */ s("div", { className: "flex-1 min-w-0", children: [
1114
+ /* @__PURE__ */ s("div", { className: "flex items-center gap-2 flex-wrap", children: [
1115
+ /* @__PURE__ */ e("h4", { className: "text-sm font-semibold text-foreground truncate", children: r.title }),
1116
+ r.recommended && r.status !== "locked" && /* @__PURE__ */ s(ae, { variant: "default", className: "text-[10px] px-1.5 h-5 gap-0.5", children: [
1117
+ /* @__PURE__ */ e(dt, { size: 10 }),
1118
+ "Recommended"
1119
+ ] })
1120
+ ] }),
1121
+ r.description && /* @__PURE__ */ e("p", { className: "text-xs text-muted-foreground mt-0.5 line-clamp-1", children: r.description }),
1122
+ /* @__PURE__ */ s("div", { className: "flex items-center gap-3 mt-2 flex-wrap", children: [
1123
+ /* @__PURE__ */ s(ae, { variant: x.variant, className: "text-[10px] px-1.5 h-5 gap-0.5", children: [
1124
+ p && /* @__PURE__ */ e(p, { size: 10 }),
1125
+ x.label
346
1126
  ] }),
347
- /* @__PURE__ */ r("span", { className: "block text-xs text-muted-foreground mb-1", children: [
348
- i.author.displayName,
349
- " · ",
350
- se(i.createdAt)
1127
+ r.estimatedDuration != null && r.estimatedDuration > 0 && /* @__PURE__ */ s("span", { className: "flex items-center gap-1 text-xs text-muted-foreground", children: [
1128
+ /* @__PURE__ */ e(Ce, { size: 12 }),
1129
+ ye(r.estimatedDuration)
351
1130
  ] }),
1131
+ r.score != null && /* @__PURE__ */ s("span", { className: "text-xs font-medium tabular-nums text-foreground", children: [
1132
+ r.score,
1133
+ "%"
1134
+ ] })
1135
+ ] })
1136
+ ] }),
1137
+ N && /* @__PURE__ */ e(
1138
+ E,
1139
+ {
1140
+ size: "sm",
1141
+ variant: r.recommended ? "default" : "outline",
1142
+ className: "shrink-0",
1143
+ onClick: c,
1144
+ children: r.status === "in_progress" ? "Continue" : "Start"
1145
+ }
1146
+ )
1147
+ ] }) })
1148
+ }
1149
+ );
1150
+ });
1151
+ function ge({ fromStatus: t, className: r }) {
1152
+ const a = t === "mastered" || t === "completed", i = t === "in_progress";
1153
+ return /* @__PURE__ */ e("div", { className: T("flex justify-center", r), children: /* @__PURE__ */ e(
1154
+ "div",
1155
+ {
1156
+ className: T(
1157
+ "w-0.5 h-8",
1158
+ a && "bg-success",
1159
+ i && "bg-primary",
1160
+ !a && !i && "bg-border",
1161
+ t === "skipped" && "border-l border-dashed border-muted-foreground bg-transparent"
1162
+ )
1163
+ }
1164
+ ) });
1165
+ }
1166
+ const At = {
1167
+ default: "text-primary",
1168
+ gold: "text-palette-3",
1169
+ silver: "text-muted-foreground",
1170
+ bronze: "text-palette-3/70"
1171
+ };
1172
+ function ve({
1173
+ milestone: t,
1174
+ className: r
1175
+ }) {
1176
+ const a = t.variant ?? "default";
1177
+ return /* @__PURE__ */ s(
1178
+ "div",
1179
+ {
1180
+ className: T(
1181
+ "flex items-center gap-3 py-2 px-4",
1182
+ !t.reached && "opacity-50",
1183
+ r
1184
+ ),
1185
+ children: [
1186
+ /* @__PURE__ */ e("div", { className: "flex-1 h-px bg-border" }),
1187
+ /* @__PURE__ */ s("div", { className: "flex items-center gap-2", children: [
1188
+ t.reached ? /* @__PURE__ */ e(ot, { size: 16, className: At[a] }) : /* @__PURE__ */ e(we, { size: 14, className: "text-muted-foreground" }),
1189
+ /* @__PURE__ */ e(
1190
+ "span",
1191
+ {
1192
+ className: T(
1193
+ "text-xs font-semibold whitespace-nowrap",
1194
+ t.reached ? "text-foreground" : "text-muted-foreground"
1195
+ ),
1196
+ children: t.title
1197
+ }
1198
+ )
1199
+ ] }),
1200
+ /* @__PURE__ */ e("div", { className: "flex-1 h-px bg-border" })
1201
+ ]
1202
+ }
1203
+ );
1204
+ }
1205
+ const Tt = ce(function({ skill: r, onClick: a, className: i }) {
1206
+ const l = r.targetProficiency ?? 100;
1207
+ return /* @__PURE__ */ s(Y, { children: [
1208
+ /* @__PURE__ */ e(J, { children: /* @__PURE__ */ s(
1209
+ "button",
1210
+ {
1211
+ type: "button",
1212
+ onClick: a ? () => a(r.uid) : void 0,
1213
+ disabled: !a,
1214
+ className: T(
1215
+ "flex items-center gap-2 min-w-0 text-left",
1216
+ a && "cursor-pointer hover:opacity-80",
1217
+ !a && "cursor-default",
1218
+ i
1219
+ ),
1220
+ children: [
1221
+ /* @__PURE__ */ e("span", { className: "text-xs font-medium text-foreground whitespace-nowrap truncate min-w-16", children: r.name }),
1222
+ /* @__PURE__ */ e(
1223
+ _e,
1224
+ {
1225
+ value: r.proficiency,
1226
+ max: l,
1227
+ size: "sm",
1228
+ className: "flex-1 min-w-20"
1229
+ }
1230
+ ),
1231
+ /* @__PURE__ */ s("span", { className: "text-xs tabular-nums text-muted-foreground whitespace-nowrap", children: [
1232
+ r.proficiency,
1233
+ "%"
1234
+ ] })
1235
+ ]
1236
+ }
1237
+ ) }),
1238
+ /* @__PURE__ */ s(X, { children: [
1239
+ r.name,
1240
+ ": ",
1241
+ r.proficiency,
1242
+ "%",
1243
+ l < 100 ? ` / ${l}% target` : ""
1244
+ ] })
1245
+ ] });
1246
+ }), xe = {
1247
+ beginner: { label: "Beginner", variant: "success" },
1248
+ intermediate: { label: "Intermediate", variant: "warning" },
1249
+ advanced: { label: "Advanced", variant: "destructive" }
1250
+ };
1251
+ function It({
1252
+ title: t,
1253
+ description: r,
1254
+ difficulty: a,
1255
+ nodes: i = [],
1256
+ progress: l,
1257
+ skills: C,
1258
+ milestones: x,
1259
+ onNodeClick: p,
1260
+ onNodeStart: h,
1261
+ onSkillClick: N,
1262
+ readOnly: I = !1,
1263
+ isLoading: m,
1264
+ error: c,
1265
+ onRetry: d,
1266
+ className: y,
1267
+ style: v
1268
+ }) {
1269
+ const D = O(() => {
1270
+ const S = /* @__PURE__ */ new Map();
1271
+ if (x)
1272
+ for (const g of x)
1273
+ S.set(g.afterNodeIndex, g);
1274
+ return S;
1275
+ }, [x]), w = Array.isArray(i) ? i : [], L = Array.isArray(C) ? C : [];
1276
+ return /* @__PURE__ */ e(
1277
+ ne,
1278
+ {
1279
+ isLoading: m,
1280
+ error: c,
1281
+ onRetry: d,
1282
+ className: y,
1283
+ style: v,
1284
+ skeleton: /* @__PURE__ */ s($, { children: [
1285
+ /* @__PURE__ */ e(R, { className: "h-8 w-64" }),
1286
+ /* @__PURE__ */ e(R, { className: "h-4 w-96 mt-2" }),
1287
+ /* @__PURE__ */ e("div", { className: "grid grid-cols-2 sm:grid-cols-4 gap-3 mt-6", children: Array.from({ length: 4 }, (S, g) => /* @__PURE__ */ e(R, { className: "h-28" }, g)) }),
1288
+ /* @__PURE__ */ e("div", { className: "mt-8 space-y-3", children: Array.from({ length: 5 }, (S, g) => /* @__PURE__ */ e(R, { className: "h-20" }, g)) })
1289
+ ] }),
1290
+ children: /* @__PURE__ */ s("div", { className: y, style: v, children: [
1291
+ /* @__PURE__ */ s("div", { className: "flex items-start justify-between gap-4 flex-wrap", children: [
1292
+ /* @__PURE__ */ s("div", { className: "flex items-center gap-4", children: [
352
1293
  /* @__PURE__ */ e(
353
- "span",
1294
+ Me,
354
1295
  {
355
- className: f(
356
- "text-sm text-foreground",
357
- !c && "line-clamp-(--preview-lines) overflow-hidden"
358
- ),
359
- style: c ? void 0 : { "--preview-lines": z },
360
- children: i.content
1296
+ value: l.completionPercentage,
1297
+ size: 64,
1298
+ strokeWidth: 5,
1299
+ className: "shrink-0 text-primary"
361
1300
  }
362
1301
  ),
363
- !c && i.content.length > 200 && /* @__PURE__ */ e(
364
- L,
1302
+ /* @__PURE__ */ s("div", { children: [
1303
+ /* @__PURE__ */ e("h2", { className: "text-xl font-bold text-foreground", children: t }),
1304
+ r && /* @__PURE__ */ e("p", { className: "text-sm text-muted-foreground mt-0.5", children: r })
1305
+ ] })
1306
+ ] }),
1307
+ a && /* @__PURE__ */ e(ae, { variant: xe[a].variant, children: xe[a].label })
1308
+ ] }),
1309
+ /* @__PURE__ */ s("div", { className: "grid grid-cols-2 sm:grid-cols-4 gap-3 mt-6", children: [
1310
+ /* @__PURE__ */ e(
1311
+ H,
1312
+ {
1313
+ icon: /* @__PURE__ */ e(mt, {}),
1314
+ label: "Progress",
1315
+ value: `${Math.round(l.completionPercentage)}%`,
1316
+ subtitle: "of path completed",
1317
+ accent: "var(--primary)"
1318
+ }
1319
+ ),
1320
+ /* @__PURE__ */ e(
1321
+ H,
1322
+ {
1323
+ icon: /* @__PURE__ */ e(ut, {}),
1324
+ label: "Completed",
1325
+ value: `${l.completedNodes}/${l.totalNodes}`,
1326
+ subtitle: "activities",
1327
+ accent: "var(--success)"
1328
+ }
1329
+ ),
1330
+ /* @__PURE__ */ e(
1331
+ H,
1332
+ {
1333
+ icon: /* @__PURE__ */ e(Ce, {}),
1334
+ label: "Time Spent",
1335
+ value: ye(l.totalTimeSpent),
1336
+ subtitle: "total",
1337
+ accent: "var(--info)"
1338
+ }
1339
+ ),
1340
+ l.averageScore != null ? /* @__PURE__ */ e(
1341
+ H,
1342
+ {
1343
+ icon: /* @__PURE__ */ e(pe, {}),
1344
+ label: "Avg Score",
1345
+ value: `${Math.round(l.averageScore)}%`,
1346
+ subtitle: "across activities",
1347
+ accent: "var(--warning)"
1348
+ }
1349
+ ) : l.currentStreak != null ? /* @__PURE__ */ e(
1350
+ H,
1351
+ {
1352
+ icon: /* @__PURE__ */ e(pt, {}),
1353
+ label: "Streak",
1354
+ value: `${l.currentStreak}`,
1355
+ subtitle: "days",
1356
+ accent: "var(--warning)"
1357
+ }
1358
+ ) : /* @__PURE__ */ e(
1359
+ H,
1360
+ {
1361
+ icon: /* @__PURE__ */ e(pe, {}),
1362
+ label: "Remaining",
1363
+ value: `${l.totalNodes - l.completedNodes}`,
1364
+ subtitle: "activities left",
1365
+ accent: "var(--warning)"
1366
+ }
1367
+ )
1368
+ ] }),
1369
+ L.length > 0 && /* @__PURE__ */ s($, { children: [
1370
+ /* @__PURE__ */ e(ee, { className: "my-5" }),
1371
+ /* @__PURE__ */ s("div", { children: [
1372
+ /* @__PURE__ */ e("h3", { className: "text-sm font-semibold text-foreground mb-3", children: "Skills" }),
1373
+ /* @__PURE__ */ e("div", { className: "grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-x-6 gap-y-2", children: L.map((S) => /* @__PURE__ */ e(
1374
+ Tt,
365
1375
  {
366
- variant: "link",
367
- size: "xs",
368
- className: "px-0 mt-0.5 h-auto",
369
- onClick: (d) => {
370
- d.stopPropagation(), w(i.uid);
371
- },
372
- children: "Read more"
373
- }
374
- )
1376
+ skill: S,
1377
+ onClick: N
1378
+ },
1379
+ S.uid
1380
+ )) })
375
1381
  ] })
376
- ] }) })
377
- },
378
- i.uid
379
- );
380
- }) });
1382
+ ] }),
1383
+ /* @__PURE__ */ e(ee, { className: "my-5" }),
1384
+ /* @__PURE__ */ s(
1385
+ "div",
1386
+ {
1387
+ className: "relative",
1388
+ role: "list",
1389
+ "aria-label": `Learning path: ${l.completedNodes} of ${l.totalNodes} completed`,
1390
+ children: [
1391
+ w.map((S, g) => /* @__PURE__ */ s("div", { role: "listitem", children: [
1392
+ g > 0 && /* @__PURE__ */ e(ge, { fromStatus: w[g - 1].status }),
1393
+ D.has(g - 1) && /* @__PURE__ */ e(
1394
+ ve,
1395
+ {
1396
+ milestone: D.get(g - 1),
1397
+ className: "my-1"
1398
+ }
1399
+ ),
1400
+ /* @__PURE__ */ e(
1401
+ zt,
1402
+ {
1403
+ node: S,
1404
+ onClick: p,
1405
+ onStart: h,
1406
+ readOnly: I
1407
+ }
1408
+ )
1409
+ ] }, S.uid)),
1410
+ w.length > 0 && D.has(w.length - 1) && /* @__PURE__ */ s($, { children: [
1411
+ /* @__PURE__ */ e(ge, { fromStatus: w[w.length - 1].status }),
1412
+ /* @__PURE__ */ e(
1413
+ ve,
1414
+ {
1415
+ milestone: D.get(w.length - 1),
1416
+ className: "my-1"
1417
+ }
1418
+ )
1419
+ ] })
1420
+ ]
1421
+ }
1422
+ )
1423
+ ] })
1424
+ }
1425
+ );
381
1426
  }
1427
+ const Ft = be(
1428
+ It,
1429
+ "AdaptiveLearningPath"
1430
+ );
382
1431
  export {
383
- fe as AnnouncementFeed,
384
- be as AssessmentReview,
385
- ge as AssignmentSubmission,
386
- ve as CertificateViewer,
387
- Ne as CourseOutline,
388
- we as DiscussionThread,
389
- ye as ExamSession,
390
- Ce as FlashcardStudySession,
391
- Se as ForumBoard,
392
- ze as GradebookTable,
393
- Te as LecturePlayer,
394
- ke as LessonPage,
395
- Ae as PracticeQuiz,
396
- Pe as ProgressDashboard,
397
- Ue as QuizSession,
398
- Le as RequirementsChecklist,
399
- pe as ResourceLibrary,
400
- Qe as RubricView,
401
- ue as ScrollableQuiz,
402
- Ee as SurveyForm
1432
+ Ft as AdaptiveLearningPath,
1433
+ kt as AnnouncementFeed,
1434
+ Qt as AssessmentReview,
1435
+ $t as AssignmentSubmission,
1436
+ Vt as CertificateViewer,
1437
+ Mt as ContentAuthoringStudio,
1438
+ Ht as CourseCatalog,
1439
+ Ot as CourseOutline,
1440
+ Gt as DiscussionThread,
1441
+ Wt as EnrollmentWizard,
1442
+ Kt as ExamSession,
1443
+ Yt as FlashcardStudySession,
1444
+ Jt as ForumBoard,
1445
+ Xt as GradebookTable,
1446
+ Zt as LecturePlayer,
1447
+ qt as LessonPage,
1448
+ ea as PracticeQuiz,
1449
+ ta as ProgressDashboard,
1450
+ aa as QuizSession,
1451
+ ra as RequirementsChecklist,
1452
+ _t as ResourceLibrary,
1453
+ sa as RubricView,
1454
+ Rt as ScrollableQuiz,
1455
+ ia as StudentProfile,
1456
+ la as SurveyForm
403
1457
  };