@hydralms/components 0.1.0 → 0.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components.css +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.js +442 -110
- package/dist/modules/CoursePlayer/CoursePlayer.d.ts +2 -0
- package/dist/modules/CoursePlayer/types.d.ts +59 -0
- package/dist/modules/FlashcardLab/FlashcardLab.d.ts +2 -0
- package/dist/modules/FlashcardLab/types.d.ts +55 -0
- package/dist/modules/QuizModule/QuizModule.d.ts +2 -0
- package/dist/modules/QuizModule/types.d.ts +54 -0
- package/dist/modules/index.d.ts +6 -0
- package/dist/provider/HydraProvider.d.ts +1 -1
- package/dist/sections.cjs +1 -1
- package/dist/sections.js +261 -291
- package/dist/table-BrS5cDQu.js +2510 -0
- package/dist/table-D6AkBBEo.cjs +1 -0
- package/dist/ui/alert-dialog.d.ts +14 -8
- package/dist/ui/button.d.ts +1 -1
- package/dist/ui/tabs.d.ts +15 -5
- package/dist/ui/tooltip.d.ts +12 -5
- package/dist/video/index.d.ts +6 -1
- package/dist/video/types.d.ts +167 -0
- package/dist/video/video-bookmark.d.ts +2 -0
- package/dist/video/video-chapter-list.d.ts +2 -0
- package/dist/video/video-playlist-item.d.ts +2 -0
- package/dist/video/video-thumbnail-card.d.ts +2 -0
- package/dist/video/video-transcript.d.ts +2 -0
- package/package.json +135 -24
- package/src/__tests__/setup.ts +1 -0
- package/src/assessment-toolbar/assessment-toolbar.tsx +96 -0
- package/src/assessment-toolbar/index.ts +10 -0
- package/src/assessment-toolbar/question-navigator.tsx +86 -0
- package/src/assessment-toolbar/timer-display.tsx +73 -0
- package/src/assessment-toolbar/types.ts +92 -0
- package/src/assets/hydra-icon.png +0 -0
- package/src/assets/hydra-icon.svg +18 -0
- package/src/assets/hydra-lms-icon.png +0 -0
- package/src/assets/hydra-lms-icon.svg +9 -0
- package/src/common/confirm-dialog.tsx +60 -0
- package/src/common/due-date-display.tsx +64 -0
- package/src/common/empty-state.tsx +24 -0
- package/src/common/index.ts +12 -0
- package/src/common/search-input.tsx +68 -0
- package/src/common/status-badge.test.tsx +43 -0
- package/src/common/status-badge.tsx +81 -0
- package/src/common/types.ts +129 -0
- package/src/content/content-block.tsx +116 -0
- package/src/content/file-upload-zone.tsx +109 -0
- package/src/content/index.ts +7 -0
- package/src/content/types.ts +76 -0
- package/src/curriculum/curriculum-item.tsx +81 -0
- package/src/curriculum/curriculum-tree.tsx +69 -0
- package/src/curriculum/index.ts +11 -0
- package/src/curriculum/learning-object-icon.tsx +44 -0
- package/src/curriculum/types.ts +83 -0
- package/src/feedback/feedback-banner.tsx +46 -0
- package/src/feedback/index.ts +8 -0
- package/src/feedback/likert-scale.tsx +58 -0
- package/src/feedback/star-rating.tsx +65 -0
- package/src/feedback/types.ts +86 -0
- package/src/flashcards/flashcard-deck.tsx +130 -0
- package/src/flashcards/flashcard.tsx +108 -0
- package/src/flashcards/index.ts +3 -0
- package/src/flashcards/types.ts +60 -0
- package/src/index.ts +38 -0
- package/src/lib/utils.ts +6 -0
- package/src/modules/CoursePlayer/CoursePlayer.tsx +281 -0
- package/src/modules/CoursePlayer/types.ts +48 -0
- package/src/modules/FlashcardLab/FlashcardLab.tsx +275 -0
- package/src/modules/FlashcardLab/types.ts +58 -0
- package/src/modules/QuizModule/QuizModule.tsx +241 -0
- package/src/modules/QuizModule/types.ts +56 -0
- package/src/modules/index.ts +12 -0
- package/src/progress/grade-indicator.tsx +65 -0
- package/src/progress/index.ts +8 -0
- package/src/progress/progress-ring.tsx +56 -0
- package/src/progress/stat-card.tsx +42 -0
- package/src/progress/types.ts +73 -0
- package/src/provider/HydraProvider.tsx +26 -0
- package/src/provider/index.ts +2 -0
- package/src/questions/choice.tsx +90 -0
- package/src/questions/essay.tsx +59 -0
- package/src/questions/fill-in-the-blank.tsx +69 -0
- package/src/questions/index.ts +14 -0
- package/src/questions/multiple-choice.test.tsx +104 -0
- package/src/questions/multiple-choice.tsx +97 -0
- package/src/questions/question-renderer.tsx +37 -0
- package/src/questions/true-false.test.tsx +89 -0
- package/src/questions/true-false.tsx +90 -0
- package/src/questions/types.ts +53 -0
- package/src/sections/AnnouncementFeed/AnnouncementFeed.tsx +141 -0
- package/src/sections/AnnouncementFeed/types.ts +50 -0
- package/src/sections/AssessmentReview/AssessmentReview.tsx +148 -0
- package/src/sections/AssessmentReview/types.ts +61 -0
- package/src/sections/AssignmentSubmission/AssignmentSubmission.tsx +190 -0
- package/src/sections/AssignmentSubmission/types.ts +60 -0
- package/src/sections/CertificateViewer/CertificateViewer.tsx +117 -0
- package/src/sections/CertificateViewer/types.ts +45 -0
- package/src/sections/CourseOutline/CourseOutline.tsx +79 -0
- package/src/sections/CourseOutline/types.ts +53 -0
- package/src/sections/DiscussionThread/DiscussionThread.tsx +186 -0
- package/src/sections/DiscussionThread/types.ts +77 -0
- package/src/sections/ExamSession/ExamSession.tsx +182 -0
- package/src/sections/ExamSession/types.ts +64 -0
- package/src/sections/FlashcardStudySession/FlashcardStudySession.tsx +76 -0
- package/src/sections/FlashcardStudySession/types.ts +42 -0
- package/src/sections/GradebookTable/GradebookTable.tsx +229 -0
- package/src/sections/GradebookTable/types.ts +75 -0
- package/src/sections/LecturePlayer/LecturePlayer.tsx +60 -0
- package/src/sections/LecturePlayer/types.ts +48 -0
- package/src/sections/LessonPage/LessonPage.tsx +91 -0
- package/src/sections/LessonPage/types.ts +41 -0
- package/src/sections/PracticeQuiz/PracticeQuiz.tsx +199 -0
- package/src/sections/PracticeQuiz/types.ts +44 -0
- package/src/sections/ProgressDashboard/ProgressDashboard.tsx +140 -0
- package/src/sections/ProgressDashboard/types.ts +74 -0
- package/src/sections/QuizSession/QuizSession.tsx +113 -0
- package/src/sections/QuizSession/types.ts +47 -0
- package/src/sections/ResourceLibrary/ResourceLibrary.tsx +218 -0
- package/src/sections/ResourceLibrary/types.ts +57 -0
- package/src/sections/ScrollableQuiz/ScrollableQuiz.tsx +170 -0
- package/src/sections/ScrollableQuiz/types.ts +40 -0
- package/src/sections/SurveyForm/SurveyForm.tsx +180 -0
- package/src/sections/SurveyForm/types.ts +69 -0
- package/src/sections/index.ts +90 -0
- package/src/social/index.ts +3 -0
- package/src/social/post-card.tsx +91 -0
- package/src/social/types.ts +57 -0
- package/src/social/user-avatar.tsx +76 -0
- package/src/styles/globals.css +125 -0
- package/src/ui/alert-dialog.tsx +343 -0
- package/src/ui/alert.tsx +65 -0
- package/src/ui/avatar.tsx +52 -0
- package/src/ui/badge.tsx +53 -0
- package/src/ui/button.tsx +62 -0
- package/src/ui/card.tsx +92 -0
- package/src/ui/index.ts +44 -0
- package/src/ui/input.tsx +21 -0
- package/src/ui/progress.tsx +73 -0
- package/src/ui/separator.tsx +29 -0
- package/src/ui/skeleton.tsx +15 -0
- package/src/ui/slot.tsx +48 -0
- package/src/ui/table.tsx +108 -0
- package/src/ui/tabs.tsx +147 -0
- package/src/ui/textarea.tsx +20 -0
- package/src/ui/tooltip.tsx +177 -0
- package/src/utils/debounce.test.ts +59 -0
- package/src/utils/debounce.ts +10 -0
- package/src/utils/format-duration.test.ts +55 -0
- package/src/utils/format-duration.ts +30 -0
- package/src/video/index.ts +17 -0
- package/src/video/types.ts +216 -0
- package/src/video/video-bookmark.tsx +76 -0
- package/src/video/video-chapter-list.tsx +93 -0
- package/src/video/video-player.tsx +103 -0
- package/src/video/video-playlist-item.tsx +90 -0
- package/src/video/video-thumbnail-card.tsx +74 -0
- package/src/video/video-transcript.tsx +102 -0
- package/dist/table-CW4_BYny.js +0 -9869
- package/dist/table-DSBBqb9X.cjs +0 -56
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { FlashcardData } from '../../flashcards/types';
|
|
2
|
+
/**
|
|
3
|
+
* FlashcardLab — a guided multi-step flashcard study session.
|
|
4
|
+
*
|
|
5
|
+
* Steps: Setup (deck selection) -> Study -> Completion
|
|
6
|
+
*
|
|
7
|
+
* Composes FlashcardStudySession, Card, Button, Badge, StatCard, ProgressRing.
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* <FlashcardLab
|
|
11
|
+
* decks={[
|
|
12
|
+
* { uid: "d1", title: "React Basics", cards: reactCards },
|
|
13
|
+
* { uid: "d2", title: "TypeScript", cards: tsCards },
|
|
14
|
+
* ]}
|
|
15
|
+
* onComplete={(result) => trackStudy(result)}
|
|
16
|
+
* />
|
|
17
|
+
*/
|
|
18
|
+
export interface FlashcardLabProps {
|
|
19
|
+
/** Available decks for the user to choose from */
|
|
20
|
+
decks: FlashcardDeckOption[];
|
|
21
|
+
/** Whether to show a shuffle toggle on the setup screen. @default true */
|
|
22
|
+
showShuffleToggle?: boolean;
|
|
23
|
+
/** Default shuffle setting. @default false */
|
|
24
|
+
defaultShuffled?: boolean;
|
|
25
|
+
/** Whether the user can select multiple decks to combine. @default true */
|
|
26
|
+
allowMultiSelect?: boolean;
|
|
27
|
+
/** Called when the user completes a study session */
|
|
28
|
+
onComplete?: (result: FlashcardLabResult) => void;
|
|
29
|
+
/** CSS class name for the root element */
|
|
30
|
+
className?: string;
|
|
31
|
+
/** Inline styles for the root element */
|
|
32
|
+
style?: React.CSSProperties;
|
|
33
|
+
}
|
|
34
|
+
export interface FlashcardDeckOption {
|
|
35
|
+
/** Unique deck identifier */
|
|
36
|
+
uid: string;
|
|
37
|
+
/** Deck title */
|
|
38
|
+
title: string;
|
|
39
|
+
/** Optional description */
|
|
40
|
+
description?: string;
|
|
41
|
+
/** The flashcard data */
|
|
42
|
+
cards: FlashcardData[];
|
|
43
|
+
}
|
|
44
|
+
export interface FlashcardLabResult {
|
|
45
|
+
/** Total cards studied */
|
|
46
|
+
totalCards: number;
|
|
47
|
+
/** Number of decks selected */
|
|
48
|
+
decksStudied: number;
|
|
49
|
+
/** UIDs of the decks that were studied */
|
|
50
|
+
deckUids: string[];
|
|
51
|
+
/** Whether cards were shuffled */
|
|
52
|
+
wasShuffled: boolean;
|
|
53
|
+
/** Total time spent studying in seconds */
|
|
54
|
+
timeElapsedSeconds: number;
|
|
55
|
+
}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { QuestionData, SessionAnswer } from '../../questions/types';
|
|
2
|
+
/**
|
|
3
|
+
* QuizModule — a complete multi-step assessment experience.
|
|
4
|
+
*
|
|
5
|
+
* Steps: Intro -> Quiz -> Results/Review
|
|
6
|
+
*
|
|
7
|
+
* Composes QuizSession, AssessmentReview, ProgressRing, StatCard, Card, and Button.
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* <QuizModule
|
|
11
|
+
* title="React Hooks Quiz"
|
|
12
|
+
* description="Test your knowledge of React hooks"
|
|
13
|
+
* questions={questions}
|
|
14
|
+
* passingScore={70}
|
|
15
|
+
* timeLimitSeconds={600}
|
|
16
|
+
* onComplete={(result) => saveResult(result)}
|
|
17
|
+
* />
|
|
18
|
+
*/
|
|
19
|
+
export interface QuizModuleProps {
|
|
20
|
+
/** Quiz title displayed on the intro screen */
|
|
21
|
+
title: string;
|
|
22
|
+
/** Quiz description displayed on the intro screen */
|
|
23
|
+
description?: string;
|
|
24
|
+
/** Ordered list of questions */
|
|
25
|
+
questions: QuestionData[];
|
|
26
|
+
/** Time limit in seconds — when provided, shows countdown info on intro and enables timer */
|
|
27
|
+
timeLimitSeconds?: number;
|
|
28
|
+
/** Passing threshold as a percentage (e.g. 70 means 70%). Determines pass/fail on results. */
|
|
29
|
+
passingScore?: number;
|
|
30
|
+
/** Whether to allow retaking the quiz from the results screen. @default true */
|
|
31
|
+
allowRetake?: boolean;
|
|
32
|
+
/** Called when the user completes the quiz (submits answers) */
|
|
33
|
+
onComplete?: (result: QuizModuleResult) => void;
|
|
34
|
+
/** Whether to show correct/incorrect answer highlighting in the review. @default true */
|
|
35
|
+
showReview?: boolean;
|
|
36
|
+
/** CSS class name for the root element */
|
|
37
|
+
className?: string;
|
|
38
|
+
/** Inline styles for the root element */
|
|
39
|
+
style?: React.CSSProperties;
|
|
40
|
+
}
|
|
41
|
+
export interface QuizModuleResult {
|
|
42
|
+
/** The user's submitted answers */
|
|
43
|
+
answers: SessionAnswer[];
|
|
44
|
+
/** Number of correct answers */
|
|
45
|
+
correct: number;
|
|
46
|
+
/** Total number of questions */
|
|
47
|
+
total: number;
|
|
48
|
+
/** Score as a percentage (0-100) */
|
|
49
|
+
percentage: number;
|
|
50
|
+
/** Whether the user passed (only meaningful when passingScore is set) */
|
|
51
|
+
passed: boolean;
|
|
52
|
+
/** Total time taken in seconds */
|
|
53
|
+
timeElapsedSeconds: number;
|
|
54
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export { QuizModule } from './QuizModule/QuizModule';
|
|
2
|
+
export type { QuizModuleProps, QuizModuleResult } from './QuizModule/types';
|
|
3
|
+
export { FlashcardLab } from './FlashcardLab/FlashcardLab';
|
|
4
|
+
export type { FlashcardLabProps, FlashcardDeckOption, FlashcardLabResult, } from './FlashcardLab/types';
|
|
5
|
+
export { CoursePlayer } from './CoursePlayer/CoursePlayer';
|
|
6
|
+
export type { CoursePlayerProps, CoursePlayerItem } from './CoursePlayer/types';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ReactNode } from 'react';
|
|
2
2
|
export interface HydraProviderProps {
|
|
3
3
|
children: ReactNode;
|
|
4
|
-
/** Controls
|
|
4
|
+
/** Controls color mode. Defaults to `"dark"`. Set to `"light"` to use the light theme. */
|
|
5
5
|
colorMode?: "light" | "dark";
|
|
6
6
|
className?: string;
|
|
7
7
|
style?: React.CSSProperties;
|
package/dist/sections.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),p=require("react"),t=require("./table-DSBBqb9X.cjs"),M=require("lucide-react");function W({questions:n,initialAnswers:r=[],onSubmit:l,onAnswerChange:c,timeElapsedSeconds:f,timeLimitSeconds:a,isSubmitting:m=!1,readOnly:i=!1,className:w,style:C}){const[d,b]=p.useState(0),[D,u]=p.useState(r),[z,N]=p.useState(new Set),T=n[d],j=p.useMemo(()=>n.map((S,h)=>({uid:S.uid,sequence:h+1,isFlagged:z.has(S.uid),isAnswered:D.some(x=>x.uid===S.uid),isSkipped:!1})),[n,D,z]);function k(S){if(!T)return;const h=T.uid,x=S.map(v=>({uid:h,answerUid:v.uid,content:v.content}));u(v=>{const y=[...v.filter(A=>A.uid!==h),...x];return c==null||c(y),y})}function s(S){const h=n.findIndex(x=>x.uid===S);h!==-1&&b(h)}function o(S){N(h=>{const x=new Set(h);return x.has(S)?x.delete(S):x.add(S),x})}function g(){l(D)}return e.jsxs("div",{className:t.cn(w),style:C,children:[e.jsx(t.AssessmentToolbar,{currentQuestionIndex:d,totalQuestions:n.length,hasNext:d<n.length-1,hasPrevious:d>0,onNext:()=>b(S=>Math.min(S+1,n.length-1)),onPrevious:()=>b(S=>Math.max(S-1,0)),onSubmit:g,timeElapsedSeconds:f,timeLimitSeconds:a,questions:j,onNavigateToQuestion:s,onToggleFlag:o,currentQuestionUid:T==null?void 0:T.uid,isSubmitting:m,readOnly:i}),T&&e.jsx(t.Card,{className:"mt-3",children:e.jsx(t.CardContent,{className:"pt-6",children:e.jsx(t.QuestionRenderer,{question:T,sessionAnswers:D.filter(S=>S.uid===T.uid),onAnswer:k,readOnly:i})})})]})}function X({video:n,notes:r,layout:l="horizontal",notesPanelWidth:c="340px",notesPanelHeight:f="240px",className:a,style:m}){const i=l==="horizontal";return r?e.jsxs("div",{className:t.cn("flex overflow-hidden",i?"flex-row":"flex-col",a),style:m,children:[e.jsx("div",{className:"flex-1 min-w-0 min-h-0",children:e.jsx(t.VideoPlayer,{...n})}),e.jsxs(t.Card,{className:t.cn("overflow-auto shrink-0 rounded-none border-0",i?"border-l border-border":"border-t border-border w-full"),style:{width:i?c:void 0,height:i?void 0:f},children:[e.jsx(t.CardHeader,{children:e.jsx(t.CardTitle,{children:"Notes"})}),e.jsx(t.CardContent,{children:typeof r=="string"?e.jsx("span",{className:"text-sm text-foreground",children:r}):r})]})]}):e.jsx("div",{className:a,style:m,children:e.jsx(t.VideoPlayer,{...n})})}function O({cards:n,title:r,description:l,shuffled:c=!1,onComplete:f,readOnly:a=!1,className:m,style:i}){const[w,C]=p.useState(!1),d={totalCards:n.length,wasShuffled:c};function b(){C(!0),f==null||f(d)}function D(){C(!1)}return w?e.jsx("div",{className:t.cn(m),style:i,children:e.jsx(t.Card,{children:e.jsxs(t.CardContent,{className:"pt-6 text-center flex flex-col items-center gap-2",children:[e.jsx(M.CheckCircle,{size:48,className:"text-success"}),e.jsx("span",{className:"text-xl font-bold text-foreground",children:"Deck complete!"}),r&&e.jsxs("span",{className:"text-muted-foreground",children:["You finished ",e.jsx("strong",{children:r})]}),e.jsxs("span",{className:"text-sm text-muted-foreground",children:[d.totalCards," card",d.totalCards!==1?"s":""," studied",d.wasShuffled?" (shuffled)":""]}),e.jsx(t.Button,{className:"mt-1",onClick:D,children:"Study Again"})]})})}):e.jsx("div",{className:t.cn(m),style:i,children:e.jsx(t.FlashcardDeck,{cards:n,deckName:r,deckDescription:l,shuffled:c,showProgress:!0,onComplete:b,readOnly:a})})}function q({score:n}){const r=n.percentage!==void 0?n.percentage:n.total>0?Math.round(n.correct/n.total*100):0;return e.jsx(t.Card,{className:"mb-3",children:e.jsx(t.CardContent,{className:"pt-6",children:e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.jsxs("div",{children:[e.jsxs("span",{className:"text-2xl font-bold leading-none text-foreground",children:[r,"%"]}),e.jsxs("span",{className:"text-sm text-muted-foreground",children:[n.correct," of ",n.total," correct"]})]}),n.passed!==void 0&&e.jsx(t.Badge,{variant:n.passed?"success":"destructive",children:n.passed?"Passed":"Failed"}),n.passingScore!==void 0&&e.jsxs("span",{className:"text-sm text-muted-foreground",children:["Passing score: ",n.passingScore,"%"]})]})})})}function V({questions:n,sessionAnswers:r,showCorrectAnswers:l}){return e.jsx("div",{className:"flex flex-col gap-3",children:n.map((c,f)=>e.jsxs(t.Card,{className:"overflow-hidden",children:[e.jsx("div",{className:"px-2 py-1 bg-muted",children:e.jsxs("span",{className:"text-xs text-muted-foreground font-semibold",children:["Question ",f+1]})}),e.jsx(t.Separator,{}),e.jsx(t.CardContent,{className:"pt-4 pb-6",children:e.jsx(t.QuestionRenderer,{question:c,sessionAnswers:r.filter(a=>a.uid===c.uid),readOnly:!0,showCorrectAnswers:l})})]},c.uid))})}function ee(n,r,l,c){const f=new Map(n.map(i=>[i.uid,i])),a=new Set(l.flatMap(i=>i.questionUids)),m=n.filter(i=>!a.has(i.uid));return e.jsxs("div",{className:"flex flex-col gap-4",children:[l.map(i=>{const w=i.questionUids.map(C=>f.get(C)).filter(Boolean);return e.jsxs("div",{children:[e.jsx("span",{className:"uppercase text-xs tracking-wide text-muted-foreground font-semibold",children:i.label}),e.jsx(t.Separator,{className:"mb-2"}),e.jsx(V,{questions:w,sessionAnswers:r,showCorrectAnswers:c})]},i.label)}),m.length>0&&e.jsx("div",{children:e.jsx(V,{questions:m,sessionAnswers:r,showCorrectAnswers:c})})]})}function te({questions:n,sessionAnswers:r,score:l,questionGroups:c,showCorrectAnswers:f=!0,className:a,style:m}){return e.jsxs("div",{className:t.cn(a),style:m,children:[l&&e.jsx(q,{score:l}),c&&c.length>0?ee(n,r,c,f):e.jsx(V,{questions:n,sessionAnswers:r,showCorrectAnswers:f})]})}function G(n){const r=[];for(const l of n)!l.children||l.children.length===0?r.push(l.uid):r.push(...G(l.children));return r}function se({items:n,progress:r,courseTitle:l,activeItemUid:c,onItemClick:f,showOverallProgress:a=!0,showDuration:m=!0,showIcons:i=!0,readOnly:w=!1,className:C,style:d}){const{completedCount:b,totalCount:D,percentage:u}=p.useMemo(()=>{const z=G(n),N=z.length,T=r?z.filter(j=>r.some(k=>k.resourceUid===j&&k.isCompleted)).length:0;return{completedCount:T,totalCount:N,percentage:N>0?Math.round(T/N*100):0}},[n,r]);return e.jsxs("div",{className:t.cn(C),style:d,children:[(l||a)&&e.jsxs("div",{className:"px-2 pt-2 pb-1",children:[l&&e.jsx("p",{className:t.cn("font-semibold text-sm text-foreground",a&&"mb-1"),children:l}),a&&e.jsxs("div",{children:[e.jsx(t.Progress,{value:u,size:"sm"}),e.jsxs("span",{className:"text-xs text-muted-foreground mt-0.5 block",children:[b," of ",D," completed"]})]})]}),e.jsx(t.CurriculumTree,{items:n,progress:r,activeItemUid:c,onItemClick:f,readOnly:w,showDuration:m,showIcons:i,showProgress:!0})]})}function ne({questions:n,initialAnswers:r=[],onSubmit:l,onAnswerChange:c,showNavigator:f=!0,showQuestionNumbers:a=!0,questionGroups:m,isSubmitting:i=!1,readOnly:w=!1,className:C,style:d}){var S;const[b,D]=p.useState(r),[u,z]=p.useState(((S=n[0])==null?void 0:S.uid)??null),N=p.useRef(new Map),T=p.useMemo(()=>{const h=new Set(b.map(x=>x.uid));return n.filter(x=>h.has(x.uid)).length},[n,b]);p.useEffect(()=>{const h=new IntersectionObserver(x=>{for(const v of x)v.isIntersecting&&z(v.target.getAttribute("data-question-uid"))},{rootMargin:"-20% 0px -60% 0px"});return N.current.forEach(x=>h.observe(x)),()=>h.disconnect()},[n]);const j=p.useCallback((h,x)=>{x?N.current.set(h,x):N.current.delete(h)},[]);function k(h,x){const v=x.map(U=>({uid:h,answerUid:U.uid,content:U.content}));D(U=>{const A=[...U.filter(F=>F.uid!==h),...v];return c==null||c(A),A})}function s(h){var x;(x=N.current.get(h))==null||x.scrollIntoView({behavior:"smooth",block:"center"})}const o=p.useMemo(()=>{if(!m)return[{label:null,questions:n}];const h=m.map(U=>({label:U.label,questions:U.questionUids.map(y=>n.find(A=>A.uid===y)).filter(Boolean)})),x=new Set(m.flatMap(U=>U.questionUids)),v=n.filter(U=>!x.has(U.uid));return v.length>0&&h.push({label:null,questions:v}),h},[n,m]);let g=0;return e.jsxs("div",{className:t.cn("flex gap-3",C),style:d,children:[e.jsxs("div",{className:"flex-1 min-w-0",children:[o.map((h,x)=>e.jsxs("div",{children:[h.label&&e.jsx("p",{className:t.cn("text-lg font-semibold mb-2 text-foreground",x>0&&"mt-4"),children:h.label}),h.questions.map(v=>{const U=g++;return e.jsx(t.Card,{ref:y=>j(v.uid,y),"data-question-uid":v.uid,className:"mb-2",children:e.jsxs(t.CardContent,{className:"pt-6",children:[a&&e.jsxs("p",{className:"font-semibold text-sm text-muted-foreground mb-1",children:["Question ",U+1]}),e.jsx(t.QuestionRenderer,{question:v,sessionAnswers:b.filter(y=>y.uid===v.uid),onAnswer:y=>k(v.uid,y),readOnly:w})]})},v.uid)})]},x)),e.jsxs("div",{className:"mt-3 flex justify-between items-center",children:[e.jsxs("span",{className:"text-sm text-muted-foreground",children:[T," of ",n.length," answered"]}),e.jsx(t.Button,{onClick:()=>l(b),disabled:i||w,children:i?"Submitting...":"Submit"})]})]}),f&&e.jsxs(t.Card,{className:"hidden md:block w-50 shrink-0 sticky top-4 self-start p-3",children:[e.jsx("p",{className:"font-semibold text-sm mb-1 text-foreground",children:"Questions"}),e.jsx("div",{className:"flex flex-wrap gap-0.5",children:n.map((h,x)=>{const v=b.some(y=>y.uid===h.uid),U=u===h.uid;return e.jsx("button",{type:"button",className:t.cn("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",U?"bg-primary border-primary text-primary-foreground":v?"border-success text-success bg-transparent":"border-border text-foreground bg-transparent hover:bg-muted"),onClick:()=>s(h.uid),children:x+1},h.uid)})})]})]})}function re(n){const r=[...n];for(let l=r.length-1;l>0;l--){const c=Math.floor(Math.random()*(l+1));[r[l],r[c]]=[r[c],r[l]]}return r}function ae({questions:n,instantFeedback:r=!0,allowRetry:l=!0,onComplete:c,shuffled:f=!1,readOnly:a=!1,className:m,style:i}){const w=p.useMemo(()=>f?re(n):n,[n,f]),[C,d]=p.useState(0),[b,D]=p.useState(new Set),[u,z]=p.useState(new Map),[N,T]=p.useState(new Set),[j,k]=p.useState(null),[s,o]=p.useState(!1),g=w[C],S=g?b.has(g.uid):!1;function h(){var $;if(!g||!j)return;const y=(u.get(g.uid)??0)+1;z(R=>new Map(R).set(g.uid,y)),D(R=>new Set(R).add(g.uid));const A=new Set((($=g.answers)==null?void 0:$.filter(R=>R.isCorrect).map(R=>R.uid))??[]),F=new Set(j.map(R=>R.uid));A.size===F.size&&[...A].every(R=>F.has(R))&&y===1&&T(R=>new Set(R).add(g.uid))}function x(){g&&(D(y=>{const A=new Set(y);return A.delete(g.uid),A}),k(null))}function v(){if(C<w.length-1)d(y=>y+1),k(null);else{const y={totalQuestions:w.length,correctOnFirstAttempt:N.size,totalAttempts:Array.from(u.values()).reduce((A,F)=>A+F,0)};o(!0),c==null||c(y)}}const U=p.useMemo(()=>{var F;if(!g||!j)return!1;const y=new Set(((F=g.answers)==null?void 0:F.filter(I=>I.isCorrect).map(I=>I.uid))??[]),A=new Set(j.map(I=>I.uid));return y.size===A.size&&[...y].every(I=>A.has(I))},[g,j]);if(s){const y=w.length>0?Math.round(N.size/w.length*100):0;return e.jsx(t.Card,{className:m,style:i,children:e.jsxs(t.CardContent,{className:"pt-6 text-center",children:[e.jsx(M.CheckCircle,{size:48,className:"text-success mx-auto mb-4"}),e.jsx("p",{className:"text-xl font-bold mb-1 text-foreground",children:"Practice Complete!"}),e.jsxs("p",{className:"text-muted-foreground mb-2",children:[N.size," of ",w.length," correct on first attempt (",y,"%)"]}),e.jsx("div",{className:"flex justify-center",children:e.jsx(t.Button,{variant:"outline",onClick:()=>{d(0),D(new Set),z(new Map),T(new Set),k(null),o(!1)},children:"Practice Again"})})]})})}return e.jsxs("div",{className:m,style:i,children:[e.jsxs("div",{className:"flex justify-between items-center mb-2",children:[e.jsxs("span",{className:"font-semibold text-sm text-foreground",children:["Question ",C+1," of ",w.length]}),e.jsxs("span",{className:"text-xs text-muted-foreground",children:[N.size," correct on first try"]})]}),e.jsx(t.Progress,{value:C+(S?1:0),max:w.length,size:"sm",className:"mb-3"}),g&&e.jsx(t.Card,{children:e.jsxs(t.CardContent,{className:"pt-6",children:[e.jsx(t.QuestionRenderer,{question:g,sessionAnswers:(j==null?void 0:j.map(y=>({uid:g.uid,answerUid:y.uid,content:y.content})))??[],onAnswer:y=>k(y),readOnly:a||S,showCorrectAnswers:S}),r&&S&&e.jsx(t.FeedbackBanner,{isCorrect:U,explanation:g.explanation,onRetry:l&&!U?x:void 0}),e.jsxs("div",{className:"flex justify-end gap-1 mt-2",children:[!S&&r&&e.jsx(t.Button,{onClick:h,disabled:!j||j.length===0||a,children:"Check Answer"}),(!r||S)&&e.jsx(t.Button,{onClick:v,disabled:a,children:C<w.length-1?"Next Question":"Finish"})]})]})})]})}function le({questions:n,initialAnswers:r=[],onSubmit:l,onAnswerChange:c,timeLimitSeconds:f,timeElapsedSeconds:a,autoSubmitOnTimeout:m=!0,timeWarningThreshold:i=300,allowBackNavigation:w=!0,confirmBeforeSubmit:C=!0,examTitle:d,instructions:b,isSubmitting:D=!1,readOnly:u=!1,className:z,style:N}){const[T,j]=p.useState(0),[k,s]=p.useState(r),[o,g]=p.useState(new Set),[S,h]=p.useState(!1),[x,v]=p.useState(!1),U=p.useRef(!1),y=n[T],A=f-a;p.useEffect(()=>{A<=i&&A>0&&v(!0)},[A,i]),p.useEffect(()=>{m&&A<=0&&!U.current&&(U.current=!0,_(!0))},[A,m]);const F=p.useMemo(()=>n.map((B,P)=>({uid:B.uid,sequence:P+1,isFlagged:o.has(B.uid),isAnswered:k.some(L=>L.uid===B.uid),isSkipped:!1})),[n,k,o]);function I(B){if(!y)return;const P=y.uid,L=B.map(Q=>({uid:P,answerUid:Q.uid,content:Q.content}));s(Q=>{const H=[...Q.filter(K=>K.uid!==P),...L];return c==null||c(H),H})}function $(B){const P=n.findIndex(L=>L.uid===B);P!==-1&&j(P)}function R(B){g(P=>{const L=new Set(P);return L.has(B)?L.delete(B):L.add(B),L})}function J(){C?h(!0):_(!1)}function _(B){const P=new Set(k.map(Q=>Q.uid)),L={timeElapsedSeconds:a,wasAutoSubmitted:B,answeredCount:n.filter(Q=>P.has(Q.uid)).length,totalQuestions:n.length};l(k,L)}return e.jsxs("div",{className:t.cn(z),style:N,children:[d&&e.jsx("p",{className:"text-xl font-bold mb-2 text-foreground",children:d}),x&&A>0&&A<=i&&e.jsx(t.Alert,{variant:"warning",className:"mb-2",children:e.jsxs(t.AlertDescription,{children:[Math.ceil(A/60)," minute",Math.ceil(A/60)!==1?"s":""," remaining"]})}),e.jsx(t.AssessmentToolbar,{currentQuestionIndex:T,totalQuestions:n.length,hasNext:T<n.length-1,hasPrevious:w&&T>0,onNext:()=>j(B=>Math.min(B+1,n.length-1)),onPrevious:()=>w&&j(B=>Math.max(B-1,0)),onSubmit:J,timeElapsedSeconds:a,timeLimitSeconds:f,questions:F,onNavigateToQuestion:$,onToggleFlag:R,currentQuestionUid:y==null?void 0:y.uid,isSubmitting:D,readOnly:u}),b&&T===0&&e.jsx(t.Card,{className:"mb-2",children:e.jsx(t.CardContent,{className:"pt-6",children:b})}),y&&e.jsx(t.Card,{className:"mt-3",children:e.jsx(t.CardContent,{className:"pt-6",children:e.jsx(t.QuestionRenderer,{question:y,sessionAnswers:k.filter(B=>B.uid===y.uid),onAnswer:I,readOnly:u})})}),e.jsx(t.ConfirmDialog,{open:S,title:"Submit Exam?",message:`You have answered ${F.filter(B=>B.isAnswered).length} of ${n.length} questions. Once submitted, you cannot change your answers.`,confirmLabel:"Submit Exam",cancelLabel:"Continue Exam",confirmColor:"primary",onConfirm:()=>{h(!1),_(!1)},onCancel:()=>h(!1),isLoading:D})]})}function ie({title:n,description:r,questions:l,initialAnswers:c=[],onSubmit:f,onAnswerChange:a,showProgress:m=!0,requireAll:i=!1,submitLabel:w="Submit Survey",isSubmitting:C=!1,readOnly:d=!1,className:b,style:D}){const[u,z]=p.useState(c),N=p.useMemo(()=>{const s=new Set(u.map(o=>o.questionUid));return l.filter(o=>s.has(o.uid)).length},[l,u]),T=!i||N===l.length;function j(s,o){z(g=>{const h=[...g.filter(x=>x.questionUid!==s),{questionUid:s,value:o}];return a==null||a(h),h})}function k(s){return u.find(o=>o.questionUid===s)}return e.jsxs("div",{className:b,style:D,children:[e.jsx("p",{className:"text-xl font-bold text-foreground mb-1",children:n}),r&&e.jsx("div",{className:"mb-2 text-muted-foreground text-sm",children:typeof r=="string"?e.jsx("span",{children:r}):r}),m&&e.jsxs("div",{className:"mb-3",children:[e.jsx(t.Progress,{value:N/l.length*100}),e.jsxs("span",{className:"block text-xs text-muted-foreground mt-0.5",children:[N," of ",l.length," answered"]})]}),l.map((s,o)=>{var S,h;const g=k(s.uid);return e.jsx(t.Card,{className:"mb-2",children:e.jsxs(t.CardContent,{className:"pt-6",children:[e.jsxs("p",{className:"font-medium text-foreground mb-2",children:[o+1,". ",s.content,s.required&&e.jsx("span",{className:"text-destructive ml-0.5",children:"*"})]}),s.type==="likert"&&e.jsx(t.LikertScale,{value:g?Number(g.value):null,onChange:x=>j(s.uid,x),points:s.scalePoints,lowLabel:(S=s.scaleLabels)==null?void 0:S.low,highLabel:(h=s.scaleLabels)==null?void 0:h.high,readOnly:d}),s.type==="rating"&&e.jsx(t.StarRating,{value:g?Number(g.value):0,onChange:x=>j(s.uid,x),readOnly:d}),s.type==="open_text"&&e.jsx(t.Textarea,{placeholder:"Type your response...",value:(g==null?void 0:g.value)??"",onChange:x=>j(s.uid,x.target.value),disabled:d,className:"min-h-24"}),s.type==="choice"&&s.answers&&e.jsx("div",{className:"flex flex-col gap-2",children:s.answers.map(x=>e.jsxs("label",{className:"flex items-center gap-2 cursor-pointer py-1 text-sm text-foreground has-[input:disabled]:cursor-default has-[input:disabled]:opacity-60",children:[e.jsx("input",{type:"radio",className:"accent-primary m-0 shrink-0",name:`survey-q-${s.uid}`,value:x.uid,checked:(g==null?void 0:g.value)===x.uid,onChange:()=>j(s.uid,x.uid),disabled:d}),e.jsx("span",{children:x.content})]},x.uid))}),s.type==="multiple_choice"&&s.answers&&e.jsx("div",{className:"flex flex-col gap-2",children:s.answers.map(x=>{const v=u.filter(U=>U.questionUid===s.uid).map(U=>String(U.value));return e.jsxs("label",{className:"flex items-center gap-2 cursor-pointer py-1 text-sm text-foreground has-[input:disabled]:cursor-default has-[input:disabled]:opacity-60",children:[e.jsx("input",{type:"checkbox",className:"accent-primary m-0 shrink-0",checked:v.includes(x.uid),disabled:d,onChange:U=>{const y=u.filter(F=>F.questionUid===s.uid);let A;U.target.checked?A=[...y,{questionUid:s.uid,value:x.uid}]:A=y.filter(F=>String(F.value)!==x.uid),z(F=>[...F.filter(I=>I.questionUid!==s.uid),...A]),a==null||a([...u.filter(F=>F.questionUid!==s.uid),...A])}}),e.jsx("span",{children:x.content})]},x.uid)})})]})},s.uid)}),e.jsxs("div",{className:"flex justify-between items-center mt-2",children:[e.jsxs("span",{className:"text-sm text-muted-foreground",children:[N," of ",l.length," answered"]}),e.jsx(t.Button,{onClick:()=>f(u),disabled:!T||C||d,children:C?"Submitting...":w})]})]})}function de({title:n,blocks:r,isCompleted:l=!1,onMarkComplete:c,onNextLesson:f,nextLessonTitle:a,estimatedDuration:m,showDuration:i=!0,readOnly:w=!1,className:C,style:d}){const[b,D]=p.useState(l),[,u]=p.useState(new Map);function z(T,j){u(k=>new Map(k).set(T,j))}function N(){D(!0),c==null||c()}return e.jsxs("div",{className:t.cn(C),style:d,children:[e.jsxs("div",{className:"mb-3",children:[e.jsx("p",{className:"text-2xl font-bold mb-0.5 text-foreground",children:n}),i&&m!=null&&e.jsxs("div",{className:"flex items-center gap-0.5 text-muted-foreground",children:[e.jsx(M.Clock,{size:16}),e.jsx("span",{className:"text-sm",children:t.formatDuration(m)})]})]}),e.jsx(t.Separator,{className:"mb-3"}),e.jsx("div",{className:"flex flex-col gap-3",children:r.map((T,j)=>e.jsx(t.ContentBlock,{block:T,onQuestionAnswer:z,readOnly:w},j))}),e.jsx("div",{className:"border border-border rounded-md px-4 py-3 mt-4 sticky bottom-0 bg-background z-10",children:e.jsxs("div",{className:"flex justify-between items-center",children:[b?e.jsxs("div",{className:"flex items-center gap-1 text-success",children:[e.jsx(M.Check,{size:20}),e.jsx("span",{className:"text-sm font-semibold",children:"Lesson Complete"})]}):e.jsxs(t.Button,{onClick:N,disabled:w,children:[e.jsx(M.Check,{size:18})," Mark Complete"]}),f&&e.jsxs(t.Button,{variant:b?"default":"outline",onClick:f,children:[a?`Next: ${a}`:"Next Lesson"," ",e.jsx(M.ChevronRight,{size:18})]})]})})]})}function Y(n){return n<1024?`${n} B`:n<1024*1024?`${(n/1024).toFixed(1)} KB`:`${(n/(1024*1024)).toFixed(1)} MB`}const Z={pdf:"document",document:"document",video:"video",link:"link",image:"document",archive:"document",other:"document"};function ce({resources:n,categories:r,onResourceClick:l,onDownload:c,viewMode:f="list",allowViewToggle:a=!0,showSearch:m=!0,emptyMessage:i="No resources found",readOnly:w=!1,className:C,style:d}){const[b,D]=p.useState(""),[u,z]=p.useState(null),[N,T]=p.useState(f),j=p.useMemo(()=>{let s=n;if(u&&(s=s.filter(o=>o.categoryUid===u)),b.trim()){const o=b.toLowerCase();s=s.filter(g=>{var S;return g.name.toLowerCase().includes(o)||((S=g.description)==null?void 0:S.toLowerCase().includes(o))})}return s},[n,u,b]);function k(s){const o=Z[s.type]??"document";return e.jsxs("div",{className:t.cn("flex items-center gap-3 px-3 py-2",!w&&"cursor-pointer hover:bg-muted",w&&"opacity-70"),onClick:()=>!w&&l(s),children:[e.jsx("div",{className:"min-w-10",children:e.jsx(t.LearningObjectIcon,{type:o,size:20})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("span",{className:"text-sm text-foreground",children:s.name}),(s.description||s.fileSize!=null)&&e.jsx("span",{className:"text-sm text-muted-foreground",children:[s.description,s.fileSize!=null&&Y(s.fileSize)].filter(Boolean).join(" · ")})]}),c&&e.jsxs(t.Tooltip,{children:[e.jsx(t.TooltipTrigger,{render:e.jsx(t.Button,{variant:"ghost",size:"icon-xs","aria-label":"Download",onClick:g=>{g.stopPropagation(),c(s)},children:e.jsx(M.Download,{size:16})})}),e.jsx(t.TooltipContent,{children:"Download"})]})]},s.uid)}return e.jsxs("div",{className:C,style:d,children:[e.jsxs("div",{className:"flex gap-2 items-center mb-2",children:[m&&e.jsx("div",{className:"flex-1 max-w-80",children:e.jsx(t.SearchInput,{value:b,onChange:D,placeholder:"Search resources...",size:"small"})}),a&&e.jsxs("div",{className:"flex gap-0.5",children:[e.jsxs(t.Tooltip,{children:[e.jsx(t.TooltipTrigger,{render:e.jsx(t.Button,{variant:"ghost",size:"icon-xs","aria-label":"List view",className:t.cn(N==="list"&&"text-primary"),onClick:()=>T("list"),children:e.jsx(M.List,{size:18})})}),e.jsx(t.TooltipContent,{children:"List view"})]}),e.jsxs(t.Tooltip,{children:[e.jsx(t.TooltipTrigger,{render:e.jsx(t.Button,{variant:"ghost",size:"icon-xs","aria-label":"Grid view",className:t.cn(N==="grid"&&"text-primary"),onClick:()=>T("grid"),children:e.jsx(M.Grid,{size:18})})}),e.jsx(t.TooltipContent,{children:"Grid view"})]})]})]}),r&&r.length>0&&e.jsx(t.Tabs,{value:u??"all",onValueChange:s=>z(s==="all"?null:s),className:"mb-2",children:e.jsxs(t.TabsList,{children:[e.jsx(t.TabsTrigger,{value:"all",children:"All"}),r.map(s=>e.jsx(t.TabsTrigger,{value:s.uid,children:s.label},s.uid))]})}),j.length===0?e.jsx(t.EmptyState,{title:i,description:"Try adjusting your search or filter."}):N==="list"?e.jsx(t.Card,{children:j.map(k)}):e.jsx("div",{className:"grid grid-cols-[repeat(auto-fill,minmax(240px,1fr))] gap-2",children:j.map(s=>e.jsx(t.Card,{className:t.cn("transition-colors",!w&&"cursor-pointer hover:border-primary"),onClick:()=>!w&&l(s),children:e.jsxs(t.CardContent,{className:"pt-4 pb-4",children:[e.jsxs("div",{className:"flex gap-1 items-center mb-1",children:[e.jsx(t.LearningObjectIcon,{type:Z[s.type]??"document",size:20}),e.jsx("span",{className:"font-semibold text-sm text-foreground truncate",children:s.name})]}),s.description&&e.jsx("p",{className:"text-sm text-muted-foreground mb-1 truncate",children:s.description}),s.fileSize!=null&&e.jsx("span",{className:"text-xs text-muted-foreground",children:Y(s.fileSize)})]})},s.uid))})]})}function oe(n){const r=new Date(n),c=new Date().getTime()-r.getTime(),f=Math.floor(c/6e4);if(f<1)return"Just now";if(f<60)return`${f}m ago`;const a=Math.floor(f/60);if(a<24)return`${a}h ago`;const m=Math.floor(a/24);return m<7?`${m}d ago`:r.toLocaleDateString()}function ue({announcements:n,onMarkRead:r,onSelect:l,showAvatars:c=!0,previewLines:f=3,emptyMessage:a="No announcements yet",readOnly:m=!1,className:i,style:w}){const[C,d]=p.useState(new Set),b=p.useMemo(()=>{const u=n.filter(N=>N.isPinned),z=n.filter(N=>!N.isPinned);return[...u,...z]},[n]);function D(u){d(N=>{const T=new Set(N);return T.has(u)?T.delete(u):T.add(u),T});const z=n.find(N=>N.uid===u);z&&!z.isRead&&(r==null||r(u))}return b.length===0?e.jsx("div",{className:i,style:w,children:e.jsx(t.EmptyState,{title:a})}):e.jsx("div",{className:t.cn("flex flex-col gap-2",i),style:w,children:b.map(u=>{const z=C.has(u.uid);return e.jsx(t.Card,{className:t.cn(u.isRead&&"opacity-85",l&&"cursor-pointer",u.isPinned&&"border-l-4 border-l-warning"),onClick:()=>l&&!m?l(u):D(u.uid),children:e.jsx(t.CardContent,{className:"pt-4 pb-4",children:e.jsxs("div",{className:"flex gap-1.5 items-start",children:[c&&e.jsx(t.UserAvatar,{displayName:u.author.displayName,avatarUrl:u.author.avatarUrl,role:u.author.role,size:"medium"}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-1 mb-0.5",children:[u.isPinned&&e.jsx(M.Pin,{size:14}),e.jsx("span",{className:t.cn("text-foreground",u.isRead?"font-normal":"font-semibold"),children:u.title}),!u.isRead&&e.jsx(t.Badge,{variant:"destructive",className:"text-[10px] px-1.5 py-0",children:"New"})]}),e.jsxs("span",{className:"block text-xs text-muted-foreground mb-1",children:[u.author.displayName," · ",oe(u.createdAt)]}),e.jsx("span",{className:t.cn("text-sm text-foreground",!z&&"line-clamp-(--preview-lines) overflow-hidden"),style:z?void 0:{"--preview-lines":f},children:u.content}),!z&&u.content.length>200&&e.jsx(t.Button,{variant:"link",size:"xs",className:"px-0 mt-0.5 h-auto",onClick:N=>{N.stopPropagation(),D(u.uid)},children:"Read more"})]})]})})},u.uid)})})}function xe({title:n,rootPost:r,replies:l,currentUser:c,onReply:f,onToggleLike:a,onMarkAnswer:m,maxDepth:i=3,allowReplies:w=!0,sortOrder:C="oldest",readOnly:d=!1,className:b,style:D}){const[u,z]=p.useState(null),[N,T]=p.useState(""),j=p.useMemo(()=>{const o=new Map;for(const g of l){const S=g.parentUid??r.uid,h=o.get(S)??[];h.push(g),o.set(S,h)}for(const[,g]of o)g.sort((S,h)=>C==="newest"?new Date(h.createdAt).getTime()-new Date(S.createdAt).getTime():C==="most_liked"?h.likeCount-S.likeCount:new Date(S.createdAt).getTime()-new Date(h.createdAt).getTime());return o},[l,r.uid,C]);function k(o){N.trim()&&(f(o,N.trim()),T(""),z(null))}function s(o,g){const S=j.get(o.uid)??[],h=Math.min(g,i),x=e.jsxs("div",{className:"flex items-center gap-1",children:[a&&!d&&e.jsxs(t.Tooltip,{children:[e.jsx(t.TooltipTrigger,{render:e.jsxs(t.Button,{variant:"ghost",size:"sm","aria-label":o.isLikedByCurrentUser?"Unlike":"Like",className:t.cn(o.isLikedByCurrentUser&&"text-destructive"),onClick:()=>a(o.uid),children:[e.jsx(M.Heart,{size:14,fill:o.isLikedByCurrentUser?"currentColor":"none"}),o.likeCount>0?o.likeCount:"Like"]})}),e.jsx(t.TooltipContent,{children:o.isLikedByCurrentUser?"Unlike":"Like"})]}),w&&!d&&e.jsxs(t.Tooltip,{children:[e.jsx(t.TooltipTrigger,{render:e.jsxs(t.Button,{variant:"ghost",size:"sm","aria-label":"Reply",onClick:()=>z(o.uid),children:[e.jsx(M.Reply,{size:14}),"Reply"]})}),e.jsx(t.TooltipContent,{children:"Reply"})]}),m&&!d&&c.role!=="student"&&!o.isAnswer&&e.jsxs(t.Tooltip,{children:[e.jsx(t.TooltipTrigger,{render:e.jsxs(t.Button,{variant:"ghost",size:"sm","aria-label":"Mark as answer",className:"text-success",onClick:()=>m(o.uid),children:[e.jsx(M.CheckCircle,{size:14}),"Mark Answer"]})}),e.jsx(t.TooltipContent,{children:"Mark as answer"})]})]});return e.jsxs("div",{children:[e.jsx(t.PostCard,{author:o.author,content:o.content,createdAt:o.createdAt,updatedAt:o.updatedAt,actions:x,highlight:o.isAnswer?"answer":"none",indentLevel:h,className:"mb-1"}),u===o.uid&&e.jsx(t.Card,{className:"mb-1",style:{marginLeft:`${(h+1)*16}px`},children:e.jsxs(t.CardContent,{className:"pt-4 pb-4",children:[e.jsx(t.Textarea,{className:"min-h-15 mb-1",placeholder:"Write a reply...",value:N,onChange:v=>T(v.target.value)}),e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx(t.Button,{size:"sm",onClick:()=>k(o.uid),disabled:!N.trim(),children:"Post Reply"}),e.jsx(t.Button,{variant:"ghost",size:"sm",onClick:()=>{z(null),T("")},children:"Cancel"})]})]})}),S.map(v=>s(v,g+1))]},o.uid)}return e.jsxs("div",{className:b,style:D,children:[e.jsxs("div",{className:"flex items-center gap-1 mb-2",children:[e.jsx(M.MessageSquare,{size:20,className:"text-foreground shrink-0"}),e.jsx("span",{className:"text-lg font-semibold text-foreground",children:n}),e.jsxs("span",{className:"text-sm text-muted-foreground",children:[l.length," ",l.length===1?"reply":"replies"]})]}),e.jsx(t.Separator,{className:"mb-2"}),s(r,0)]})}function me({title:n,instructions:r,dueDate:l,maxScore:c,status:f,submissionTypes:a,existingSubmission:m,fileConstraints:i,onSubmit:w,onSaveDraft:C,grade:d,isSubmitting:b=!1,readOnly:D=!1,className:u,style:z}){const[N,T]=p.useState((m==null?void 0:m.textContent)??""),[j,k]=p.useState((m==null?void 0:m.files)??[]),[s,o]=p.useState((m==null?void 0:m.url)??""),[g,S]=p.useState(a[0]),h=!D&&!["submitted","graded"].includes(f);function x(){return{textContent:a.includes("text")?N:void 0,files:a.includes("file")?j:void 0,url:a.includes("url")?s:void 0}}return e.jsxs("div",{className:u,style:z,children:[e.jsx("div",{className:"flex justify-between items-start mb-2",children:e.jsxs("div",{children:[e.jsx("div",{className:"text-xl font-bold text-foreground mb-0.5",children:n}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(t.StatusBadge,{status:f}),l&&e.jsx(t.DueDateDisplay,{dueDate:l,size:"small"}),c!=null&&e.jsxs("span",{className:"text-sm text-muted-foreground",children:[c," points"]})]})]})}),e.jsx(t.Card,{className:"mb-3",children:e.jsxs(t.CardContent,{className:"pt-6",children:[e.jsx("div",{className:"font-semibold text-sm text-foreground mb-1",children:"Instructions"}),e.jsx("div",{className:"text-muted-foreground text-sm",children:typeof r=="string"?e.jsx("span",{children:r}):r})]})}),d&&e.jsx(t.Alert,{variant:"success",className:"mb-3",children:e.jsxs(t.AlertDescription,{children:[e.jsxs("div",{className:"font-semibold text-sm mb-1",children:["Grade: ",d.score,c!=null?` / ${c}`:""]}),d.feedback&&e.jsx("div",{children:d.feedback})]})}),h&&e.jsxs(e.Fragment,{children:[a.length>1?e.jsxs(t.Tabs,{value:g,onValueChange:v=>S(v),children:[e.jsxs(t.TabsList,{children:[a.includes("text")&&e.jsx(t.TabsTrigger,{value:"text",children:"Text"}),a.includes("file")&&e.jsx(t.TabsTrigger,{value:"file",children:"File Upload"}),a.includes("url")&&e.jsx(t.TabsTrigger,{value:"url",children:"URL"})]}),a.includes("text")&&e.jsx(t.TabsContent,{value:"text",children:e.jsx(t.Textarea,{className:"min-h-45",placeholder:"Type your submission...",value:N,onChange:v=>T(v.target.value)})}),a.includes("file")&&e.jsx(t.TabsContent,{value:"file",children:e.jsx(t.FileUploadZone,{files:j,onFilesAdded:v=>k(U=>[...U,...v]),onFileRemove:v=>k(U=>U.filter((y,A)=>A!==v)),accept:i==null?void 0:i.acceptedTypes,maxFiles:i==null?void 0:i.maxFiles,maxSizeMB:i==null?void 0:i.maxSizeMB})}),a.includes("url")&&e.jsx(t.TabsContent,{value:"url",children:e.jsx(t.Input,{placeholder:"https://...",value:s,onChange:v=>o(v.target.value)})})]}):e.jsxs(e.Fragment,{children:[a.includes("text")&&e.jsx(t.Textarea,{className:"min-h-45 mb-2",placeholder:"Type your submission...",value:N,onChange:v=>T(v.target.value)}),a.includes("file")&&e.jsx("div",{className:"mb-2",children:e.jsx(t.FileUploadZone,{files:j,onFilesAdded:v=>k(U=>[...U,...v]),onFileRemove:v=>k(U=>U.filter((y,A)=>A!==v)),accept:i==null?void 0:i.acceptedTypes,maxFiles:i==null?void 0:i.maxFiles,maxSizeMB:i==null?void 0:i.maxSizeMB})}),a.includes("url")&&e.jsx(t.Input,{className:"mb-2",placeholder:"https://...",value:s,onChange:v=>o(v.target.value)})]}),e.jsx(t.Separator,{className:"my-2"}),e.jsxs("div",{className:"flex gap-1 justify-end",children:[C&&e.jsxs(t.Button,{variant:"outline",onClick:()=>C(x()),disabled:b,children:[e.jsx(M.Save,{size:16}),"Save Draft"]}),e.jsxs(t.Button,{onClick:()=>w(x()),disabled:b,children:[e.jsx(M.Send,{size:16}),b?"Submitting...":"Submit"]})]})]})]})}function E({label:n,field:r,sortField:l,sortDir:c,onSort:f,textAlign:a}){const m=l===r;return e.jsx(t.TableHead,{className:t.cn("cursor-pointer select-none hover:bg-muted",a==="right"&&"text-right"),onClick:()=>f(r),children:e.jsxs("div",{className:t.cn("flex items-center gap-1",a==="right"&&"justify-end"),children:[e.jsx("span",{className:t.cn(m?"text-foreground":"text-muted-foreground"),children:n}),m&&(c==="asc"?e.jsx(M.ArrowUp,{size:14}):e.jsx(M.ArrowDown,{size:14}))]})})}function he({items:n,categories:r,overallGrade:l,showWeights:c=!0,showCategoryTotals:f=!0,onItemClick:a,readOnly:m=!1,className:i,style:w}){const[C,d]=p.useState("dueDate"),[b,D]=p.useState("asc");function u(j){C===j?D(k=>k==="asc"?"desc":"asc"):(d(j),D("asc"))}const z=p.useMemo(()=>{const j=[...n];return j.sort((k,s)=>{let o=0;switch(C){case"name":o=k.name.localeCompare(s.name);break;case"score":o=(k.score??-1)-(s.score??-1);break;case"dueDate":o=(k.dueDate??"").localeCompare(s.dueDate??"");break;case"status":o=k.status.localeCompare(s.status);break}return b==="asc"?o:-o}),j},[n,C,b]),N=p.useMemo(()=>{if(!r||r.length===0)return[{category:null,items:z}];const j=r.map(s=>({category:s,items:z.filter(o=>o.categoryUid===s.uid)})),k=z.filter(s=>!s.categoryUid);return k.length>0&&j.push({category:null,items:k}),j},[z,r]),T=c?5:4;return e.jsxs("div",{className:i,style:w,children:[l&&e.jsx(t.Card,{className:"mb-3",children:e.jsx(t.CardContent,{className:"pt-6",children:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(t.GradeIndicator,{percentage:l.percentage,letterGrade:l.letterGrade,size:"large",passingThreshold:60}),e.jsxs("div",{children:[e.jsx("div",{className:"text-lg font-semibold text-foreground",children:"Overall Grade"}),e.jsxs("span",{className:"text-sm text-muted-foreground",children:[l.pointsEarned," / ",l.pointsPossible," points"]})]})]})})}),e.jsx(t.Card,{children:e.jsxs(t.Table,{children:[e.jsx(t.TableHeader,{children:e.jsxs(t.TableRow,{children:[e.jsx(E,{label:"Assignment",field:"name",sortField:C,sortDir:b,onSort:u}),e.jsx(E,{label:"Status",field:"status",sortField:C,sortDir:b,onSort:u}),e.jsx(E,{label:"Due Date",field:"dueDate",sortField:C,sortDir:b,onSort:u}),e.jsx(E,{label:"Score",field:"score",sortField:C,sortDir:b,onSort:u,textAlign:"right"}),c&&e.jsx(t.TableHead,{className:"text-right text-muted-foreground",children:"Weight"})]})}),e.jsx(t.TableBody,{children:N.map((j,k)=>e.jsxs(p.Fragment,{children:[j.category&&f&&e.jsx(t.TableRow,{className:"bg-muted hover:bg-muted",children:e.jsx(t.TableCell,{colSpan:T,children:e.jsxs("span",{className:"font-semibold text-sm text-foreground",children:[j.category.name,j.category.weight!=null&&` (${j.category.weight}%)`]})})}),j.items.map(s=>e.jsxs(t.TableRow,{className:t.cn(a&&!m&&"cursor-pointer"),onClick:()=>a&&!m?a(s):void 0,children:[e.jsx(t.TableCell,{children:s.name}),e.jsx(t.TableCell,{children:e.jsx(t.StatusBadge,{status:s.status,size:"small"})}),e.jsx(t.TableCell,{children:s.dueDate?e.jsx(t.DueDateDisplay,{dueDate:s.dueDate,submittedDate:s.submittedDate,size:"small"}):"—"}),e.jsx(t.TableCell,{className:"text-right",children:s.score!=null?e.jsxs("span",{className:"text-sm font-semibold text-foreground",children:[s.score," / ",s.maxScore]}):s.status==="excused"?e.jsx("span",{className:"text-sm text-muted-foreground",children:"Excused"}):e.jsx("span",{className:"text-sm text-muted-foreground",children:"—"})}),c&&e.jsx(t.TableCell,{className:"text-right",children:s.weight!=null?`${s.weight}%`:"—"})]},s.uid))]},k))})]})})]})}const fe={lesson_completed:M.BookOpen,quiz_passed:M.CheckCircle,assignment_submitted:M.Send,badge_earned:M.Award};function je({overallProgress:n,totalTimeSpent:r,modules:l,recentActivity:c,streak:f,achievements:a,recentActivityLimit:m=5,onModuleClick:i,className:w,style:C}){return e.jsxs("div",{className:w,style:C,children:[e.jsxs("div",{className:"grid grid-cols-[repeat(auto-fit,minmax(160px,1fr))] gap-2 mb-3",children:[e.jsx(t.Card,{className:"p-2 flex justify-center",children:e.jsx(t.ProgressRing,{value:n,size:100})}),e.jsx(t.StatCard,{icon:e.jsx(M.Clock,{size:24}),label:"Time Spent",value:t.formatDuration(r)}),f&&e.jsx(t.StatCard,{icon:e.jsx(M.Flame,{size:24}),label:"Current Streak",value:`${f.currentDays} days`,subtitle:`Longest: ${f.longestDays} days`}),e.jsx(t.StatCard,{icon:e.jsx(M.BookOpen,{size:24}),label:"Modules",value:`${l.filter(d=>d.completedItems===d.totalItems).length} / ${l.length}`,subtitle:"completed"})]}),e.jsx("p",{className:"text-lg font-semibold mb-2 text-foreground",children:"Module Progress"}),e.jsx("div",{className:"flex flex-col gap-1.5 mb-3",children:l.map(d=>{const b=d.totalItems>0?d.completedItems/d.totalItems*100:0;return e.jsxs(t.Card,{className:t.cn("p-2 transition-colors",i&&"cursor-pointer hover:border-primary"),onClick:()=>i==null?void 0:i(d.uid),children:[e.jsxs("div",{className:"flex justify-between items-center mb-0.5",children:[e.jsx("span",{className:"font-semibold text-sm text-foreground",children:d.name}),e.jsxs("span",{className:"text-xs text-muted-foreground",children:[d.completedItems," / ",d.totalItems]})]}),e.jsx(t.Progress,{value:b,size:"sm"})]},d.uid)})}),c&&c.length>0&&e.jsxs(e.Fragment,{children:[e.jsx("p",{className:"text-lg font-semibold mb-2 text-foreground",children:"Recent Activity"}),e.jsx("div",{className:"flex flex-col gap-1 mb-3",children:c.slice(0,m).map(d=>{const b=fe[d.type]??M.CheckCircle;return e.jsxs("div",{className:"flex gap-1.5 items-center",children:[e.jsx(b,{size:16}),e.jsx("span",{className:"flex-1 text-sm text-foreground",children:d.description}),e.jsx("span",{className:"text-xs text-muted-foreground",children:new Date(d.timestamp).toLocaleDateString()})]},d.uid)})})]}),a&&a.length>0&&e.jsxs(e.Fragment,{children:[e.jsx("p",{className:"text-lg font-semibold mb-2 text-foreground",children:"Achievements"}),e.jsx("div",{className:"grid grid-cols-[repeat(auto-fill,minmax(140px,1fr))] gap-2",children:a.map(d=>e.jsxs(t.Card,{className:"p-2 text-center",children:[d.iconUrl?e.jsx("img",{src:d.iconUrl,alt:d.name,className:"w-12 h-12 mb-1 mx-auto"}):e.jsx(M.Trophy,{size:32,className:"mx-auto mb-2 text-warning"}),e.jsx("p",{className:"font-semibold text-sm text-foreground",children:d.name}),e.jsx("p",{className:"text-xs text-muted-foreground",children:d.description})]},d.uid))})]})]})}const pe={classic:"border-[3px] border-double border-warning bg-linear-to-br from-[#fffbe6] to-[#fff8e1]",modern:"border border-primary bg-linear-to-br from-[#fff5f5] to-[#fee2e2]",minimal:"border border-border"};function ge({recipientName:n,courseTitle:r,completionDate:l,organizationName:c,organizationLogo:f,signatory:a,certificateId:m,variant:i="classic",showActions:w=!0,onPrint:C,onDownload:d,className:b,style:D}){const u=(()=>{try{return new Date(l).toLocaleDateString("en-US",{year:"numeric",month:"long",day:"numeric"})}catch{return l}})();function z(){C?C():window.print()}return e.jsxs("div",{className:b,style:D,children:[e.jsxs("div",{className:t.cn("p-3 sm:p-5 md:p-6 text-center max-w-200 mx-auto rounded-md",pe[i]),children:[f?e.jsx("img",{src:f,alt:c,className:"h-15 mb-2 mx-auto block"}):e.jsx(M.Award,{size:48,className:t.cn("mx-auto mb-4",i==="classic"&&"text-warning")}),e.jsx("p",{className:"uppercase tracking-[3px] text-sm text-foreground/70",children:"Certificate of Completion"}),e.jsx(t.Separator,{className:"my-2 mx-auto max-w-50"}),e.jsx("p",{className:"text-sm text-foreground mb-1",children:"This is to certify that"}),e.jsx("p",{className:t.cn("text-2xl font-bold mb-2 text-foreground",i==="classic"&&"font-serif"),children:n}),e.jsx("p",{className:"text-sm text-foreground mb-1",children:"has successfully completed"}),e.jsx("p",{className:"text-xl font-bold mb-2 text-primary",children:r}),e.jsxs("p",{className:"text-sm text-foreground mb-3",children:["Issued by ",c," on ",u]}),a&&e.jsxs("div",{className:"mt-4 mb-2",children:[e.jsx(t.Separator,{className:"my-2 mx-auto max-w-50"}),e.jsx("p",{className:"font-semibold text-sm text-foreground",children:a.name}),e.jsx("p",{className:"text-xs text-muted-foreground",children:a.title})]}),m&&e.jsxs("span",{className:"block text-xs text-muted-foreground mt-2",children:["Certificate ID: ",m]})]}),w&&e.jsxs("div",{className:"flex justify-center gap-2 mt-3",children:[e.jsxs(t.Button,{variant:"outline",onClick:z,children:[e.jsx(M.Printer,{size:16})," Print"]}),d&&e.jsxs(t.Button,{variant:"outline",onClick:d,children:[e.jsx(M.Download,{size:16})," Download"]})]})]})}exports.AnnouncementFeed=ue;exports.AssessmentReview=te;exports.AssignmentSubmission=me;exports.CertificateViewer=ge;exports.CourseOutline=se;exports.DiscussionThread=xe;exports.ExamSession=le;exports.FlashcardStudySession=O;exports.GradebookTable=he;exports.LecturePlayer=X;exports.LessonPage=de;exports.PracticeQuiz=ae;exports.ProgressDashboard=je;exports.QuizSession=W;exports.ResourceLibrary=ce;exports.ScrollableQuiz=ne;exports.SurveyForm=ie;
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),p=require("react"),t=require("./table-D6AkBBEo.cjs"),M=require("lucide-react");function W({questions:n,initialAnswers:r=[],onSubmit:a,onAnswerChange:d,timeElapsedSeconds:f,timeLimitSeconds:l,isSubmitting:m=!1,readOnly:i=!1,className:w,style:C}){const[c,b]=p.useState(0),[D,u]=p.useState(r),[z,N]=p.useState(new Set),T=n[c],j=p.useMemo(()=>n.map((S,h)=>({uid:S.uid,sequence:h+1,isFlagged:z.has(S.uid),isAnswered:D.some(x=>x.uid===S.uid),isSkipped:!1})),[n,D,z]);function k(S){if(!T)return;const h=T.uid,x=S.map(v=>({uid:h,answerUid:v.uid,content:v.content}));u(v=>{const y=[...v.filter(A=>A.uid!==h),...x];return d==null||d(y),y})}function s(S){const h=n.findIndex(x=>x.uid===S);h!==-1&&b(h)}function o(S){N(h=>{const x=new Set(h);return x.has(S)?x.delete(S):x.add(S),x})}function g(){a(D)}return e.jsxs("div",{className:t.cn(w),style:C,children:[e.jsx(t.AssessmentToolbar,{currentQuestionIndex:c,totalQuestions:n.length,hasNext:c<n.length-1,hasPrevious:c>0,onNext:()=>b(S=>Math.min(S+1,n.length-1)),onPrevious:()=>b(S=>Math.max(S-1,0)),onSubmit:g,timeElapsedSeconds:f,timeLimitSeconds:l,questions:j,onNavigateToQuestion:s,onToggleFlag:o,currentQuestionUid:T==null?void 0:T.uid,isSubmitting:m,readOnly:i}),T&&e.jsx(t.Card,{className:"mt-3",children:e.jsx(t.CardContent,{className:"pt-6",children:e.jsx(t.QuestionRenderer,{question:T,sessionAnswers:D.filter(S=>S.uid===T.uid),onAnswer:k,readOnly:i})})})]})}function X({video:n,notes:r,layout:a="horizontal",notesPanelWidth:d="340px",notesPanelHeight:f="240px",className:l,style:m}){const i=a==="horizontal";return r?e.jsxs("div",{className:t.cn("flex overflow-hidden",i?"flex-row":"flex-col",l),style:m,children:[e.jsx("div",{className:"flex-1 min-w-0 min-h-0",children:e.jsx(t.VideoPlayer,{...n})}),e.jsxs(t.Card,{className:t.cn("overflow-auto shrink-0 rounded-none border-0",i?"border-l border-border":"border-t border-border w-full"),style:{width:i?d:void 0,height:i?void 0:f},children:[e.jsx(t.CardHeader,{children:e.jsx(t.CardTitle,{children:"Notes"})}),e.jsx(t.CardContent,{children:typeof r=="string"?e.jsx("span",{className:"text-sm text-foreground",children:r}):r})]})]}):e.jsx("div",{className:l,style:m,children:e.jsx(t.VideoPlayer,{...n})})}function O({cards:n,title:r,description:a,shuffled:d=!1,onComplete:f,readOnly:l=!1,className:m,style:i}){const[w,C]=p.useState(!1),c={totalCards:n.length,wasShuffled:d};function b(){C(!0),f==null||f(c)}function D(){C(!1)}return w?e.jsx("div",{className:t.cn("flex flex-col items-center",m),style:i,children:e.jsx(t.Card,{children:e.jsxs(t.CardContent,{className:"pt-6 text-center flex flex-col items-center gap-2",children:[e.jsx(M.CheckCircle,{size:48,className:"text-success"}),e.jsx("span",{className:"text-xl font-bold text-foreground",children:"Deck complete!"}),r&&e.jsxs("span",{className:"text-muted-foreground",children:["You finished ",e.jsx("strong",{children:r})]}),e.jsxs("span",{className:"text-sm text-muted-foreground",children:[c.totalCards," card",c.totalCards!==1?"s":""," studied",c.wasShuffled?" (shuffled)":""]}),e.jsx(t.Button,{className:"mt-2",onClick:D,children:"Study Again"})]})})}):e.jsx("div",{className:t.cn("flex flex-col items-center",m),style:i,children:e.jsx(t.FlashcardDeck,{cards:n,deckName:r,deckDescription:a,shuffled:d,showProgress:!0,onComplete:b,readOnly:l})})}function q({score:n}){const r=n.percentage!==void 0?n.percentage:n.total>0?Math.round(n.correct/n.total*100):0;return e.jsx(t.Card,{className:"mb-3",children:e.jsx(t.CardContent,{className:"pt-6",children:e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.jsxs("div",{children:[e.jsxs("span",{className:"text-2xl font-bold leading-none text-foreground",children:[r,"%"]}),e.jsxs("span",{className:"text-sm text-muted-foreground",children:[n.correct," of ",n.total," correct"]})]}),n.passed!==void 0&&e.jsx(t.Badge,{variant:n.passed?"success":"destructive",children:n.passed?"Passed":"Failed"}),n.passingScore!==void 0&&e.jsxs("span",{className:"text-sm text-muted-foreground",children:["Passing score: ",n.passingScore,"%"]})]})})})}function V({questions:n,sessionAnswers:r,showCorrectAnswers:a}){return e.jsx("div",{className:"flex flex-col gap-3",children:n.map((d,f)=>e.jsxs(t.Card,{className:"overflow-hidden",children:[e.jsx("div",{className:"px-2 py-1 bg-muted",children:e.jsxs("span",{className:"text-xs text-muted-foreground font-semibold",children:["Question ",f+1]})}),e.jsx(t.Separator,{}),e.jsx(t.CardContent,{className:"pt-4 pb-4",children:e.jsx(t.QuestionRenderer,{question:d,sessionAnswers:r.filter(l=>l.uid===d.uid),readOnly:!0,showCorrectAnswers:a})})]},d.uid))})}function ee(n,r,a,d){const f=new Map(n.map(i=>[i.uid,i])),l=new Set(a.flatMap(i=>i.questionUids)),m=n.filter(i=>!l.has(i.uid));return e.jsxs("div",{className:"flex flex-col gap-4",children:[a.map(i=>{const w=i.questionUids.map(C=>f.get(C)).filter(Boolean);return e.jsxs("div",{children:[e.jsx("span",{className:"uppercase text-xs tracking-wide text-muted-foreground font-semibold",children:i.label}),e.jsx(t.Separator,{className:"mb-2"}),e.jsx(V,{questions:w,sessionAnswers:r,showCorrectAnswers:d})]},i.label)}),m.length>0&&e.jsx("div",{children:e.jsx(V,{questions:m,sessionAnswers:r,showCorrectAnswers:d})})]})}function te({questions:n,sessionAnswers:r,score:a,questionGroups:d,showCorrectAnswers:f=!0,className:l,style:m}){return e.jsxs("div",{className:t.cn(l),style:m,children:[a&&e.jsx(q,{score:a}),d&&d.length>0?ee(n,r,d,f):e.jsx(V,{questions:n,sessionAnswers:r,showCorrectAnswers:f})]})}function G(n){const r=[];for(const a of n)!a.children||a.children.length===0?r.push(a.uid):r.push(...G(a.children));return r}function se({items:n,progress:r,courseTitle:a,activeItemUid:d,onItemClick:f,showOverallProgress:l=!0,showDuration:m=!0,showIcons:i=!0,readOnly:w=!1,className:C,style:c}){const{completedCount:b,totalCount:D,percentage:u}=p.useMemo(()=>{const z=G(n),N=z.length,T=r?z.filter(j=>r.some(k=>k.resourceUid===j&&k.isCompleted)).length:0;return{completedCount:T,totalCount:N,percentage:N>0?Math.round(T/N*100):0}},[n,r]);return e.jsxs("div",{className:t.cn(C),style:c,children:[(a||l)&&e.jsxs("div",{className:"px-2 pt-2 pb-1",children:[a&&e.jsx("p",{className:t.cn("font-semibold text-sm text-foreground",l&&"mb-1"),children:a}),l&&e.jsxs("div",{children:[e.jsx(t.Progress,{value:u,size:"sm"}),e.jsxs("span",{className:"text-xs text-muted-foreground mt-0.5 block",children:[b," of ",D," completed"]})]})]}),e.jsx(t.CurriculumTree,{items:n,progress:r,activeItemUid:d,onItemClick:f,readOnly:w,showDuration:m,showIcons:i,showProgress:!0})]})}function ne({questions:n,initialAnswers:r=[],onSubmit:a,onAnswerChange:d,showNavigator:f=!0,showQuestionNumbers:l=!0,questionGroups:m,isSubmitting:i=!1,readOnly:w=!1,className:C,style:c}){var S;const[b,D]=p.useState(r),[u,z]=p.useState(((S=n[0])==null?void 0:S.uid)??null),N=p.useRef(new Map),T=p.useMemo(()=>{const h=new Set(b.map(x=>x.uid));return n.filter(x=>h.has(x.uid)).length},[n,b]);p.useEffect(()=>{const h=new IntersectionObserver(x=>{for(const v of x)v.isIntersecting&&z(v.target.getAttribute("data-question-uid"))},{rootMargin:"-20% 0px -60% 0px"});return N.current.forEach(x=>h.observe(x)),()=>h.disconnect()},[n]);const j=p.useCallback((h,x)=>{x?N.current.set(h,x):N.current.delete(h)},[]);function k(h,x){const v=x.map(U=>({uid:h,answerUid:U.uid,content:U.content}));D(U=>{const A=[...U.filter(F=>F.uid!==h),...v];return d==null||d(A),A})}function s(h){var x;(x=N.current.get(h))==null||x.scrollIntoView({behavior:"smooth",block:"center"})}const o=p.useMemo(()=>{if(!m)return[{label:null,questions:n}];const h=m.map(U=>({label:U.label,questions:U.questionUids.map(y=>n.find(A=>A.uid===y)).filter(Boolean)})),x=new Set(m.flatMap(U=>U.questionUids)),v=n.filter(U=>!x.has(U.uid));return v.length>0&&h.push({label:null,questions:v}),h},[n,m]);let g=0;return e.jsxs("div",{className:t.cn("flex gap-3",C),style:c,children:[e.jsxs("div",{className:"flex-1 min-w-0",children:[o.map((h,x)=>e.jsxs("div",{children:[h.label&&e.jsx("p",{className:t.cn("text-lg font-semibold mb-2 text-foreground",x>0&&"mt-4"),children:h.label}),h.questions.map(v=>{const U=g++;return e.jsx(t.Card,{ref:y=>j(v.uid,y),"data-question-uid":v.uid,className:"mb-2",children:e.jsxs(t.CardContent,{className:"pt-6",children:[l&&e.jsxs("p",{className:"font-semibold text-sm text-muted-foreground mb-1",children:["Question ",U+1]}),e.jsx(t.QuestionRenderer,{question:v,sessionAnswers:b.filter(y=>y.uid===v.uid),onAnswer:y=>k(v.uid,y),readOnly:w})]})},v.uid)})]},x)),e.jsxs("div",{className:"mt-3 flex justify-between items-center",children:[e.jsxs("span",{className:"text-sm text-muted-foreground",children:[T," of ",n.length," answered"]}),e.jsx(t.Button,{onClick:()=>a(b),disabled:i||w,children:i?"Submitting...":"Submit"})]})]}),f&&e.jsxs(t.Card,{className:"hidden md:block w-50 shrink-0 sticky top-4 self-start p-3",children:[e.jsx("p",{className:"font-semibold text-sm mb-1 text-foreground",children:"Questions"}),e.jsx("div",{className:"flex flex-wrap gap-1",children:n.map((h,x)=>{const v=b.some(y=>y.uid===h.uid),U=u===h.uid;return e.jsx("button",{type:"button",className:t.cn("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",U?"bg-primary border-primary text-primary-foreground":v?"border-success text-success bg-transparent":"border-border text-foreground bg-transparent hover:bg-muted"),onClick:()=>s(h.uid),children:x+1},h.uid)})})]})]})}function re(n){const r=[...n];for(let a=r.length-1;a>0;a--){const d=Math.floor(Math.random()*(a+1));[r[a],r[d]]=[r[d],r[a]]}return r}function le({questions:n,instantFeedback:r=!0,allowRetry:a=!0,onComplete:d,shuffled:f=!1,readOnly:l=!1,className:m,style:i}){const w=p.useMemo(()=>f?re(n):n,[n,f]),[C,c]=p.useState(0),[b,D]=p.useState(new Set),[u,z]=p.useState(new Map),[N,T]=p.useState(new Set),[j,k]=p.useState(null),[s,o]=p.useState(!1),g=w[C],S=g?b.has(g.uid):!1;function h(){var $;if(!g||!j)return;const y=(u.get(g.uid)??0)+1;z(R=>new Map(R).set(g.uid,y)),D(R=>new Set(R).add(g.uid));const A=new Set((($=g.answers)==null?void 0:$.filter(R=>R.isCorrect).map(R=>R.uid))??[]),F=new Set(j.map(R=>R.uid));A.size===F.size&&[...A].every(R=>F.has(R))&&y===1&&T(R=>new Set(R).add(g.uid))}function x(){g&&(D(y=>{const A=new Set(y);return A.delete(g.uid),A}),k(null))}function v(){if(C<w.length-1)c(y=>y+1),k(null);else{const y={totalQuestions:w.length,correctOnFirstAttempt:N.size,totalAttempts:Array.from(u.values()).reduce((A,F)=>A+F,0)};o(!0),d==null||d(y)}}const U=p.useMemo(()=>{var F;if(!g||!j)return!1;const y=new Set(((F=g.answers)==null?void 0:F.filter(I=>I.isCorrect).map(I=>I.uid))??[]),A=new Set(j.map(I=>I.uid));return y.size===A.size&&[...y].every(I=>A.has(I))},[g,j]);if(s){const y=w.length>0?Math.round(N.size/w.length*100):0;return e.jsx(t.Card,{className:m,style:i,children:e.jsxs(t.CardContent,{className:"pt-6 text-center",children:[e.jsx(M.CheckCircle,{size:48,className:"text-success mx-auto mb-4"}),e.jsx("p",{className:"text-xl font-bold mb-1 text-foreground",children:"Practice Complete!"}),e.jsxs("p",{className:"text-muted-foreground mb-2",children:[N.size," of ",w.length," correct on first attempt (",y,"%)"]}),e.jsx("div",{className:"flex justify-center",children:e.jsx(t.Button,{variant:"outline",onClick:()=>{c(0),D(new Set),z(new Map),T(new Set),k(null),o(!1)},children:"Practice Again"})})]})})}return e.jsxs("div",{className:m,style:i,children:[e.jsxs("div",{className:"flex justify-between items-center mb-2",children:[e.jsxs("span",{className:"font-semibold text-sm text-foreground",children:["Question ",C+1," of ",w.length]}),e.jsxs("span",{className:"text-xs text-muted-foreground",children:[N.size," correct on first try"]})]}),e.jsx(t.Progress,{value:C+(S?1:0),max:w.length,size:"sm",className:"mb-3"}),g&&e.jsx(t.Card,{children:e.jsxs(t.CardContent,{className:"pt-6",children:[e.jsx(t.QuestionRenderer,{question:g,sessionAnswers:(j==null?void 0:j.map(y=>({uid:g.uid,answerUid:y.uid,content:y.content})))??[],onAnswer:y=>k(y),readOnly:l||S,showCorrectAnswers:S}),r&&S&&e.jsx(t.FeedbackBanner,{isCorrect:U,explanation:g.explanation,onRetry:a&&!U?x:void 0}),e.jsxs("div",{className:"flex justify-end gap-2 mt-2",children:[!S&&r&&e.jsx(t.Button,{onClick:h,disabled:!j||j.length===0||l,children:"Check Answer"}),(!r||S)&&e.jsx(t.Button,{onClick:v,disabled:l,children:C<w.length-1?"Next Question":"Finish"})]})]})})]})}function ae({questions:n,initialAnswers:r=[],onSubmit:a,onAnswerChange:d,timeLimitSeconds:f,timeElapsedSeconds:l,autoSubmitOnTimeout:m=!0,timeWarningThreshold:i=300,allowBackNavigation:w=!0,confirmBeforeSubmit:C=!0,examTitle:c,instructions:b,isSubmitting:D=!1,readOnly:u=!1,className:z,style:N}){const[T,j]=p.useState(0),[k,s]=p.useState(r),[o,g]=p.useState(new Set),[S,h]=p.useState(!1),[x,v]=p.useState(!1),U=p.useRef(!1),y=n[T],A=f-l;p.useEffect(()=>{A<=i&&A>0&&v(!0)},[A,i]),p.useEffect(()=>{m&&A<=0&&!U.current&&(U.current=!0,_(!0))},[A,m]);const F=p.useMemo(()=>n.map((B,P)=>({uid:B.uid,sequence:P+1,isFlagged:o.has(B.uid),isAnswered:k.some(L=>L.uid===B.uid),isSkipped:!1})),[n,k,o]);function I(B){if(!y)return;const P=y.uid,L=B.map(Q=>({uid:P,answerUid:Q.uid,content:Q.content}));s(Q=>{const H=[...Q.filter(K=>K.uid!==P),...L];return d==null||d(H),H})}function $(B){const P=n.findIndex(L=>L.uid===B);P!==-1&&j(P)}function R(B){g(P=>{const L=new Set(P);return L.has(B)?L.delete(B):L.add(B),L})}function J(){C?h(!0):_(!1)}function _(B){const P=new Set(k.map(Q=>Q.uid)),L={timeElapsedSeconds:l,wasAutoSubmitted:B,answeredCount:n.filter(Q=>P.has(Q.uid)).length,totalQuestions:n.length};a(k,L)}return e.jsxs("div",{className:t.cn(z),style:N,children:[c&&e.jsx("p",{className:"text-xl font-bold mb-2 text-foreground",children:c}),x&&A>0&&A<=i&&e.jsx(t.Alert,{variant:"warning",className:"mb-2",children:e.jsxs(t.AlertDescription,{children:[Math.ceil(A/60)," minute",Math.ceil(A/60)!==1?"s":""," remaining"]})}),e.jsx(t.AssessmentToolbar,{currentQuestionIndex:T,totalQuestions:n.length,hasNext:T<n.length-1,hasPrevious:w&&T>0,onNext:()=>j(B=>Math.min(B+1,n.length-1)),onPrevious:()=>w&&j(B=>Math.max(B-1,0)),onSubmit:J,timeElapsedSeconds:l,timeLimitSeconds:f,questions:F,onNavigateToQuestion:$,onToggleFlag:R,currentQuestionUid:y==null?void 0:y.uid,isSubmitting:D,readOnly:u}),b&&T===0&&e.jsx(t.Card,{className:"mt-3",children:e.jsx(t.CardContent,{className:"pt-6",children:b})}),y&&e.jsx(t.Card,{className:"mt-3",children:e.jsx(t.CardContent,{className:"pt-6",children:e.jsx(t.QuestionRenderer,{question:y,sessionAnswers:k.filter(B=>B.uid===y.uid),onAnswer:I,readOnly:u})})}),e.jsx(t.ConfirmDialog,{open:S,title:"Submit Exam?",message:`You have answered ${F.filter(B=>B.isAnswered).length} of ${n.length} questions. Once submitted, you cannot change your answers.`,confirmLabel:"Submit Exam",cancelLabel:"Continue Exam",confirmColor:"primary",onConfirm:()=>{h(!1),_(!1)},onCancel:()=>h(!1),isLoading:D})]})}function ie({title:n,description:r,questions:a,initialAnswers:d=[],onSubmit:f,onAnswerChange:l,showProgress:m=!0,requireAll:i=!1,submitLabel:w="Submit Survey",isSubmitting:C=!1,readOnly:c=!1,className:b,style:D}){const[u,z]=p.useState(d),N=p.useMemo(()=>{const s=new Set(u.map(o=>o.questionUid));return a.filter(o=>s.has(o.uid)).length},[a,u]),T=!i||N===a.length;function j(s,o){z(g=>{const h=[...g.filter(x=>x.questionUid!==s),{questionUid:s,value:o}];return l==null||l(h),h})}function k(s){return u.find(o=>o.questionUid===s)}return e.jsxs("div",{className:b,style:D,children:[e.jsx("p",{className:"text-xl font-bold text-foreground mb-2",children:n}),r&&e.jsx("div",{className:"mb-2 text-muted-foreground text-sm",children:typeof r=="string"?e.jsx("span",{children:r}):r}),m&&e.jsxs("div",{className:"mb-3",children:[e.jsx(t.Progress,{value:N/a.length*100}),e.jsxs("span",{className:"block text-xs text-muted-foreground mt-0.5",children:[N," of ",a.length," answered"]})]}),a.map((s,o)=>{var S,h;const g=k(s.uid);return e.jsx(t.Card,{className:"mb-2",children:e.jsxs(t.CardContent,{className:"pt-6",children:[e.jsxs("p",{className:"font-medium text-foreground mb-2",children:[o+1,". ",s.content,s.required&&e.jsx("span",{className:"text-destructive ml-0.5",children:"*"})]}),s.type==="likert"&&e.jsx(t.LikertScale,{value:g?Number(g.value):null,onChange:x=>j(s.uid,x),points:s.scalePoints,lowLabel:(S=s.scaleLabels)==null?void 0:S.low,highLabel:(h=s.scaleLabels)==null?void 0:h.high,readOnly:c}),s.type==="rating"&&e.jsx(t.StarRating,{value:g?Number(g.value):0,onChange:x=>j(s.uid,x),readOnly:c}),s.type==="open_text"&&e.jsx(t.Textarea,{placeholder:"Type your response...",value:(g==null?void 0:g.value)??"",onChange:x=>j(s.uid,x.target.value),disabled:c,className:"min-h-24"}),s.type==="choice"&&s.answers&&e.jsx("div",{className:"flex flex-col gap-2",children:s.answers.map(x=>e.jsxs("label",{className:"flex items-center gap-2 cursor-pointer py-1 text-sm text-foreground has-[input:disabled]:cursor-default has-[input:disabled]:opacity-60",children:[e.jsx("input",{type:"radio",className:"accent-primary m-0 shrink-0",name:`survey-q-${s.uid}`,value:x.uid,checked:(g==null?void 0:g.value)===x.uid,onChange:()=>j(s.uid,x.uid),disabled:c}),e.jsx("span",{children:x.content})]},x.uid))}),s.type==="multiple_choice"&&s.answers&&e.jsx("div",{className:"flex flex-col gap-2",children:s.answers.map(x=>{const v=u.filter(U=>U.questionUid===s.uid).map(U=>String(U.value));return e.jsxs("label",{className:"flex items-center gap-2 cursor-pointer py-1 text-sm text-foreground has-[input:disabled]:cursor-default has-[input:disabled]:opacity-60",children:[e.jsx("input",{type:"checkbox",className:"accent-primary m-0 shrink-0",checked:v.includes(x.uid),disabled:c,onChange:U=>{const y=u.filter(F=>F.questionUid===s.uid);let A;U.target.checked?A=[...y,{questionUid:s.uid,value:x.uid}]:A=y.filter(F=>String(F.value)!==x.uid),z(F=>[...F.filter(I=>I.questionUid!==s.uid),...A]),l==null||l([...u.filter(F=>F.questionUid!==s.uid),...A])}}),e.jsx("span",{children:x.content})]},x.uid)})})]})},s.uid)}),e.jsxs("div",{className:"flex justify-between items-center mt-3",children:[e.jsxs("span",{className:"text-sm text-muted-foreground",children:[N," of ",a.length," answered"]}),e.jsx(t.Button,{onClick:()=>f(u),disabled:!T||C||c,children:C?"Submitting...":w})]})]})}function ce({title:n,blocks:r,isCompleted:a=!1,onMarkComplete:d,onNextLesson:f,nextLessonTitle:l,estimatedDuration:m,showDuration:i=!0,readOnly:w=!1,className:C,style:c}){const[b,D]=p.useState(a),[,u]=p.useState(new Map);function z(T,j){u(k=>new Map(k).set(T,j))}function N(){D(!0),d==null||d()}return e.jsxs("div",{className:t.cn(C),style:c,children:[e.jsxs("div",{className:"mb-3",children:[e.jsx("p",{className:"text-2xl font-bold mb-0.5 text-foreground",children:n}),i&&m!=null&&e.jsxs("div",{className:"flex items-center gap-0.5 text-muted-foreground",children:[e.jsx(M.Clock,{size:16}),e.jsx("span",{className:"text-sm",children:t.formatDuration(m)})]})]}),e.jsx(t.Separator,{className:"mb-3"}),e.jsx("div",{className:"flex flex-col gap-3",children:r.map((T,j)=>e.jsx(t.ContentBlock,{block:T,onQuestionAnswer:z,readOnly:w},j))}),e.jsx("div",{className:"border border-border rounded-md px-4 py-3 mt-4 sticky bottom-0 bg-background z-10",children:e.jsxs("div",{className:"flex justify-between items-center",children:[b?e.jsxs("div",{className:"flex items-center gap-1 text-success",children:[e.jsx(M.Check,{size:20}),e.jsx("span",{className:"text-sm font-semibold",children:"Lesson Complete"})]}):e.jsxs(t.Button,{onClick:N,disabled:w,children:[e.jsx(M.Check,{size:18})," Mark Complete"]}),f&&e.jsxs(t.Button,{variant:b?"default":"outline",onClick:f,children:[l?`Next: ${l}`:"Next Lesson"," ",e.jsx(M.ChevronRight,{size:18})]})]})})]})}function Y(n){return n<1024?`${n} B`:n<1024*1024?`${(n/1024).toFixed(1)} KB`:`${(n/(1024*1024)).toFixed(1)} MB`}const Z={pdf:"document",document:"document",video:"video",link:"link",image:"document",archive:"document",other:"document"};function de({resources:n,categories:r,onResourceClick:a,onDownload:d,viewMode:f="list",allowViewToggle:l=!0,showSearch:m=!0,emptyMessage:i="No resources found",readOnly:w=!1,className:C,style:c}){const[b,D]=p.useState(""),[u,z]=p.useState(null),[N,T]=p.useState(f),j=p.useMemo(()=>{let s=n;if(u&&(s=s.filter(o=>o.categoryUid===u)),b.trim()){const o=b.toLowerCase();s=s.filter(g=>{var S;return g.name.toLowerCase().includes(o)||((S=g.description)==null?void 0:S.toLowerCase().includes(o))})}return s},[n,u,b]);function k(s){const o=Z[s.type]??"document";return e.jsxs("div",{className:t.cn("flex items-center gap-3 px-3 py-2",!w&&"cursor-pointer hover:bg-muted",w&&"opacity-70"),onClick:()=>!w&&a(s),children:[e.jsx("div",{className:"min-w-10",children:e.jsx(t.LearningObjectIcon,{type:o,size:20})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("span",{className:"text-sm text-foreground",children:s.name}),(s.description||s.fileSize!=null)&&e.jsx("span",{className:"text-sm text-muted-foreground",children:[s.description,s.fileSize!=null&&Y(s.fileSize)].filter(Boolean).join(" · ")})]}),d&&e.jsxs(t.Tooltip,{children:[e.jsx(t.TooltipTrigger,{children:e.jsx(t.Button,{variant:"ghost",size:"icon-xs","aria-label":"Download",onClick:g=>{g.stopPropagation(),d(s)},children:e.jsx(M.Download,{size:16})})}),e.jsx(t.TooltipContent,{children:"Download"})]})]},s.uid)}return e.jsxs("div",{className:C,style:c,children:[e.jsxs("div",{className:"flex gap-2 items-center mb-2",children:[m&&e.jsx("div",{className:"flex-1 max-w-80",children:e.jsx(t.SearchInput,{value:b,onChange:D,placeholder:"Search resources...",size:"small"})}),l&&e.jsxs("div",{className:"flex gap-0.5",children:[e.jsxs(t.Tooltip,{children:[e.jsx(t.TooltipTrigger,{children:e.jsx(t.Button,{variant:"ghost",size:"icon-xs","aria-label":"List view",className:t.cn(N==="list"&&"text-primary"),onClick:()=>T("list"),children:e.jsx(M.List,{size:18})})}),e.jsx(t.TooltipContent,{children:"List view"})]}),e.jsxs(t.Tooltip,{children:[e.jsx(t.TooltipTrigger,{children:e.jsx(t.Button,{variant:"ghost",size:"icon-xs","aria-label":"Grid view",className:t.cn(N==="grid"&&"text-primary"),onClick:()=>T("grid"),children:e.jsx(M.Grid,{size:18})})}),e.jsx(t.TooltipContent,{children:"Grid view"})]})]})]}),r&&r.length>0&&e.jsx(t.Tabs,{value:u??"all",onValueChange:s=>z(s==="all"?null:s),className:"mb-2",children:e.jsxs(t.TabsList,{children:[e.jsx(t.TabsTrigger,{value:"all",children:"All"}),r.map(s=>e.jsx(t.TabsTrigger,{value:s.uid,children:s.label},s.uid))]})}),j.length===0?e.jsx(t.EmptyState,{title:i,description:"Try adjusting your search or filter."}):N==="list"?e.jsx(t.Card,{children:j.map(k)}):e.jsx("div",{className:"grid grid-cols-[repeat(auto-fill,minmax(240px,1fr))] gap-2",children:j.map(s=>e.jsx(t.Card,{className:t.cn("transition-colors",!w&&"cursor-pointer hover:border-primary"),onClick:()=>!w&&a(s),children:e.jsxs(t.CardContent,{className:"pt-4 pb-4",children:[e.jsxs("div",{className:"flex gap-1 items-center mb-1",children:[e.jsx(t.LearningObjectIcon,{type:Z[s.type]??"document",size:20}),e.jsx("span",{className:"font-semibold text-sm text-foreground truncate",children:s.name})]}),s.description&&e.jsx("p",{className:"text-sm text-muted-foreground mb-1 truncate",children:s.description}),s.fileSize!=null&&e.jsx("span",{className:"text-xs text-muted-foreground",children:Y(s.fileSize)})]})},s.uid))})]})}function oe(n){const r=new Date(n),d=new Date().getTime()-r.getTime(),f=Math.floor(d/6e4);if(f<1)return"Just now";if(f<60)return`${f}m ago`;const l=Math.floor(f/60);if(l<24)return`${l}h ago`;const m=Math.floor(l/24);return m<7?`${m}d ago`:r.toLocaleDateString()}function ue({announcements:n,onMarkRead:r,onSelect:a,showAvatars:d=!0,previewLines:f=3,emptyMessage:l="No announcements yet",readOnly:m=!1,className:i,style:w}){const[C,c]=p.useState(new Set),b=p.useMemo(()=>{const u=n.filter(N=>N.isPinned),z=n.filter(N=>!N.isPinned);return[...u,...z]},[n]);function D(u){c(N=>{const T=new Set(N);return T.has(u)?T.delete(u):T.add(u),T});const z=n.find(N=>N.uid===u);z&&!z.isRead&&(r==null||r(u))}return b.length===0?e.jsx("div",{className:i,style:w,children:e.jsx(t.EmptyState,{title:l})}):e.jsx("div",{className:t.cn("flex flex-col gap-2",i),style:w,children:b.map(u=>{const z=C.has(u.uid);return e.jsx(t.Card,{className:t.cn(u.isRead&&"opacity-85",a&&"cursor-pointer",u.isPinned&&"border-l-4 border-l-warning"),onClick:()=>a&&!m?a(u):D(u.uid),children:e.jsx(t.CardContent,{className:"pt-4 pb-4",children:e.jsxs("div",{className:"flex gap-1.5 items-start",children:[d&&e.jsx(t.UserAvatar,{displayName:u.author.displayName,avatarUrl:u.author.avatarUrl,role:u.author.role,size:"medium"}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-1 mb-0.5",children:[u.isPinned&&e.jsx(M.Pin,{size:14}),e.jsx("span",{className:t.cn("text-foreground",u.isRead?"font-normal":"font-semibold"),children:u.title}),!u.isRead&&e.jsx(t.Badge,{variant:"destructive",className:"text-[10px] px-1.5 py-0",children:"New"})]}),e.jsxs("span",{className:"block text-xs text-muted-foreground mb-1",children:[u.author.displayName," · ",oe(u.createdAt)]}),e.jsx("span",{className:t.cn("text-sm text-foreground",!z&&"line-clamp-(--preview-lines) overflow-hidden"),style:z?void 0:{"--preview-lines":f},children:u.content}),!z&&u.content.length>200&&e.jsx(t.Button,{variant:"link",size:"xs",className:"px-0 mt-0.5 h-auto",onClick:N=>{N.stopPropagation(),D(u.uid)},children:"Read more"})]})]})})},u.uid)})})}function xe({title:n,rootPost:r,replies:a,currentUser:d,onReply:f,onToggleLike:l,onMarkAnswer:m,maxDepth:i=3,allowReplies:w=!0,sortOrder:C="oldest",readOnly:c=!1,className:b,style:D}){const[u,z]=p.useState(null),[N,T]=p.useState(""),j=p.useMemo(()=>{const o=new Map;for(const g of a){const S=g.parentUid??r.uid,h=o.get(S)??[];h.push(g),o.set(S,h)}for(const[,g]of o)g.sort((S,h)=>C==="newest"?new Date(h.createdAt).getTime()-new Date(S.createdAt).getTime():C==="most_liked"?h.likeCount-S.likeCount:new Date(S.createdAt).getTime()-new Date(h.createdAt).getTime());return o},[a,r.uid,C]);function k(o){N.trim()&&(f(o,N.trim()),T(""),z(null))}function s(o,g){const S=j.get(o.uid)??[],h=Math.min(g,i),x=e.jsxs("div",{className:"flex items-center gap-1",children:[l&&!c&&e.jsxs(t.Tooltip,{children:[e.jsx(t.TooltipTrigger,{children:e.jsxs(t.Button,{variant:"ghost",size:"sm","aria-label":o.isLikedByCurrentUser?"Unlike":"Like",className:t.cn(o.isLikedByCurrentUser&&"text-destructive"),onClick:()=>l(o.uid),children:[e.jsx(M.Heart,{size:14,fill:o.isLikedByCurrentUser?"currentColor":"none"}),o.likeCount>0?o.likeCount:"Like"]})}),e.jsx(t.TooltipContent,{children:o.isLikedByCurrentUser?"Unlike":"Like"})]}),w&&!c&&e.jsxs(t.Tooltip,{children:[e.jsx(t.TooltipTrigger,{children:e.jsxs(t.Button,{variant:"ghost",size:"sm","aria-label":"Reply",onClick:()=>z(o.uid),children:[e.jsx(M.Reply,{size:14}),"Reply"]})}),e.jsx(t.TooltipContent,{children:"Reply"})]}),m&&!c&&d.role!=="student"&&!o.isAnswer&&e.jsxs(t.Tooltip,{children:[e.jsx(t.TooltipTrigger,{children:e.jsxs(t.Button,{variant:"ghost",size:"sm","aria-label":"Mark as answer",className:"text-success",onClick:()=>m(o.uid),children:[e.jsx(M.CheckCircle,{size:14}),"Mark Answer"]})}),e.jsx(t.TooltipContent,{children:"Mark as answer"})]})]});return e.jsxs("div",{children:[e.jsx(t.PostCard,{author:o.author,content:o.content,createdAt:o.createdAt,updatedAt:o.updatedAt,actions:x,highlight:o.isAnswer?"answer":"none",indentLevel:h,className:"mb-2"}),u===o.uid&&e.jsx(t.Card,{className:"mb-2",style:{marginLeft:`${(h+1)*16}px`},children:e.jsxs(t.CardContent,{className:"pt-4 pb-4",children:[e.jsx(t.Textarea,{className:"min-h-15 mb-2",placeholder:"Write a reply...",value:N,onChange:v=>T(v.target.value)}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(t.Button,{size:"sm",onClick:()=>k(o.uid),disabled:!N.trim(),children:"Post Reply"}),e.jsx(t.Button,{variant:"ghost",size:"sm",onClick:()=>{z(null),T("")},children:"Cancel"})]})]})}),S.map(v=>s(v,g+1))]},o.uid)}return e.jsxs("div",{className:b,style:D,children:[e.jsxs("div",{className:"flex items-center gap-1 mb-2",children:[e.jsx(M.MessageSquare,{size:20,className:"text-foreground shrink-0"}),e.jsx("span",{className:"text-lg font-semibold text-foreground",children:n}),e.jsxs("span",{className:"text-sm text-muted-foreground",children:[a.length," ",a.length===1?"reply":"replies"]})]}),e.jsx(t.Separator,{className:"mb-2"}),s(r,0)]})}function me({title:n,instructions:r,dueDate:a,maxScore:d,status:f,submissionTypes:l,existingSubmission:m,fileConstraints:i,onSubmit:w,onSaveDraft:C,grade:c,isSubmitting:b=!1,readOnly:D=!1,className:u,style:z}){const[N,T]=p.useState((m==null?void 0:m.textContent)??""),[j,k]=p.useState((m==null?void 0:m.files)??[]),[s,o]=p.useState((m==null?void 0:m.url)??""),[g,S]=p.useState(l[0]),h=!D&&!["submitted","graded"].includes(f);function x(){return{textContent:l.includes("text")?N:void 0,files:l.includes("file")?j:void 0,url:l.includes("url")?s:void 0}}return e.jsxs("div",{className:u,style:z,children:[e.jsx("div",{className:"flex justify-between items-start mb-2",children:e.jsxs("div",{children:[e.jsx("div",{className:"text-xl font-bold text-foreground mb-0.5",children:n}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(t.StatusBadge,{status:f}),a&&e.jsx(t.DueDateDisplay,{dueDate:a,size:"small"}),d!=null&&e.jsxs("span",{className:"text-sm text-muted-foreground",children:[d," points"]})]})]})}),e.jsx(t.Card,{className:"mb-3",children:e.jsxs(t.CardContent,{className:"pt-6",children:[e.jsx("div",{className:"font-semibold text-sm text-foreground mb-1",children:"Instructions"}),e.jsx("div",{className:"text-muted-foreground text-sm",children:typeof r=="string"?e.jsx("span",{children:r}):r})]})}),c&&e.jsx(t.Alert,{variant:"success",className:"mb-3",children:e.jsxs(t.AlertDescription,{children:[e.jsxs("div",{className:"font-semibold text-sm mb-1",children:["Grade: ",c.score,d!=null?` / ${d}`:""]}),c.feedback&&e.jsx("div",{children:c.feedback})]})}),h&&e.jsxs(e.Fragment,{children:[l.length>1?e.jsxs(t.Tabs,{value:g,onValueChange:v=>S(v),children:[e.jsxs(t.TabsList,{children:[l.includes("text")&&e.jsx(t.TabsTrigger,{value:"text",children:"Text"}),l.includes("file")&&e.jsx(t.TabsTrigger,{value:"file",children:"File Upload"}),l.includes("url")&&e.jsx(t.TabsTrigger,{value:"url",children:"URL"})]}),l.includes("text")&&e.jsx(t.TabsContent,{value:"text",children:e.jsx(t.Textarea,{className:"min-h-45",placeholder:"Type your submission...",value:N,onChange:v=>T(v.target.value)})}),l.includes("file")&&e.jsx(t.TabsContent,{value:"file",children:e.jsx(t.FileUploadZone,{files:j,onFilesAdded:v=>k(U=>[...U,...v]),onFileRemove:v=>k(U=>U.filter((y,A)=>A!==v)),accept:i==null?void 0:i.acceptedTypes,maxFiles:i==null?void 0:i.maxFiles,maxSizeMB:i==null?void 0:i.maxSizeMB})}),l.includes("url")&&e.jsx(t.TabsContent,{value:"url",children:e.jsx(t.Input,{placeholder:"https://...",value:s,onChange:v=>o(v.target.value)})})]}):e.jsxs(e.Fragment,{children:[l.includes("text")&&e.jsx(t.Textarea,{className:"min-h-45 mb-2",placeholder:"Type your submission...",value:N,onChange:v=>T(v.target.value)}),l.includes("file")&&e.jsx("div",{className:"mb-2",children:e.jsx(t.FileUploadZone,{files:j,onFilesAdded:v=>k(U=>[...U,...v]),onFileRemove:v=>k(U=>U.filter((y,A)=>A!==v)),accept:i==null?void 0:i.acceptedTypes,maxFiles:i==null?void 0:i.maxFiles,maxSizeMB:i==null?void 0:i.maxSizeMB})}),l.includes("url")&&e.jsx(t.Input,{className:"mb-2",placeholder:"https://...",value:s,onChange:v=>o(v.target.value)})]}),e.jsx(t.Separator,{className:"my-2"}),e.jsxs("div",{className:"flex gap-2 justify-end",children:[C&&e.jsxs(t.Button,{variant:"outline",onClick:()=>C(x()),disabled:b,children:[e.jsx(M.Save,{size:16}),"Save Draft"]}),e.jsxs(t.Button,{onClick:()=>w(x()),disabled:b,children:[e.jsx(M.Send,{size:16}),b?"Submitting...":"Submit"]})]})]})]})}function E({label:n,field:r,sortField:a,sortDir:d,onSort:f,textAlign:l}){const m=a===r;return e.jsx(t.TableHead,{className:t.cn("cursor-pointer select-none hover:bg-muted",l==="right"&&"text-right"),onClick:()=>f(r),children:e.jsxs("div",{className:t.cn("flex items-center gap-1",l==="right"&&"justify-end"),children:[e.jsx("span",{className:t.cn(m?"text-foreground":"text-muted-foreground"),children:n}),m&&(d==="asc"?e.jsx(M.ArrowUp,{size:14}):e.jsx(M.ArrowDown,{size:14}))]})})}function he({items:n,categories:r,overallGrade:a,showWeights:d=!0,showCategoryTotals:f=!0,onItemClick:l,readOnly:m=!1,className:i,style:w}){const[C,c]=p.useState("dueDate"),[b,D]=p.useState("asc");function u(j){C===j?D(k=>k==="asc"?"desc":"asc"):(c(j),D("asc"))}const z=p.useMemo(()=>{const j=[...n];return j.sort((k,s)=>{let o=0;switch(C){case"name":o=k.name.localeCompare(s.name);break;case"score":o=(k.score??-1)-(s.score??-1);break;case"dueDate":o=(k.dueDate??"").localeCompare(s.dueDate??"");break;case"status":o=k.status.localeCompare(s.status);break}return b==="asc"?o:-o}),j},[n,C,b]),N=p.useMemo(()=>{if(!r||r.length===0)return[{category:null,items:z}];const j=r.map(s=>({category:s,items:z.filter(o=>o.categoryUid===s.uid)})),k=z.filter(s=>!s.categoryUid);return k.length>0&&j.push({category:null,items:k}),j},[z,r]),T=d?5:4;return e.jsxs("div",{className:i,style:w,children:[a&&e.jsx(t.Card,{className:"mb-3",children:e.jsx(t.CardContent,{className:"pt-6",children:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(t.GradeIndicator,{percentage:a.percentage,letterGrade:a.letterGrade,size:"large",passingThreshold:60}),e.jsxs("div",{children:[e.jsx("div",{className:"text-lg font-semibold text-foreground",children:"Overall Grade"}),e.jsxs("span",{className:"text-sm text-muted-foreground",children:[a.pointsEarned," / ",a.pointsPossible," points"]})]})]})})}),e.jsx(t.Card,{children:e.jsxs(t.Table,{children:[e.jsx(t.TableHeader,{children:e.jsxs(t.TableRow,{children:[e.jsx(E,{label:"Assignment",field:"name",sortField:C,sortDir:b,onSort:u}),e.jsx(E,{label:"Status",field:"status",sortField:C,sortDir:b,onSort:u}),e.jsx(E,{label:"Due Date",field:"dueDate",sortField:C,sortDir:b,onSort:u}),e.jsx(E,{label:"Score",field:"score",sortField:C,sortDir:b,onSort:u,textAlign:"right"}),d&&e.jsx(t.TableHead,{className:"text-right text-muted-foreground",children:"Weight"})]})}),e.jsx(t.TableBody,{children:N.map((j,k)=>e.jsxs(p.Fragment,{children:[j.category&&f&&e.jsx(t.TableRow,{className:"bg-muted hover:bg-muted",children:e.jsx(t.TableCell,{colSpan:T,children:e.jsxs("span",{className:"font-semibold text-sm text-foreground",children:[j.category.name,j.category.weight!=null&&` (${j.category.weight}%)`]})})}),j.items.map(s=>e.jsxs(t.TableRow,{className:t.cn(l&&!m&&"cursor-pointer"),onClick:()=>l&&!m?l(s):void 0,children:[e.jsx(t.TableCell,{children:s.name}),e.jsx(t.TableCell,{children:e.jsx(t.StatusBadge,{status:s.status,size:"small"})}),e.jsx(t.TableCell,{children:s.dueDate?e.jsx(t.DueDateDisplay,{dueDate:s.dueDate,submittedDate:s.submittedDate,size:"small"}):"—"}),e.jsx(t.TableCell,{className:"text-right",children:s.score!=null?e.jsxs("span",{className:"text-sm font-semibold text-foreground",children:[s.score," / ",s.maxScore]}):s.status==="excused"?e.jsx("span",{className:"text-sm text-muted-foreground",children:"Excused"}):e.jsx("span",{className:"text-sm text-muted-foreground",children:"—"})}),d&&e.jsx(t.TableCell,{className:"text-right",children:s.weight!=null?`${s.weight}%`:"—"})]},s.uid))]},k))})]})})]})}const fe={lesson_completed:M.BookOpen,quiz_passed:M.CheckCircle,assignment_submitted:M.Send,badge_earned:M.Award};function je({overallProgress:n,totalTimeSpent:r,modules:a,recentActivity:d,streak:f,achievements:l,recentActivityLimit:m=5,onModuleClick:i,className:w,style:C}){return e.jsxs("div",{className:w,style:C,children:[e.jsxs("div",{className:"grid grid-cols-[repeat(auto-fit,minmax(160px,1fr))] gap-2 mb-3",children:[e.jsx(t.Card,{className:"p-2 flex justify-center",children:e.jsx(t.ProgressRing,{value:n,size:100})}),e.jsx(t.StatCard,{icon:e.jsx(M.Clock,{size:24}),label:"Time Spent",value:t.formatDuration(r)}),f&&e.jsx(t.StatCard,{icon:e.jsx(M.Flame,{size:24}),label:"Current Streak",value:`${f.currentDays} days`,subtitle:`Longest: ${f.longestDays} days`}),e.jsx(t.StatCard,{icon:e.jsx(M.BookOpen,{size:24}),label:"Modules",value:`${a.filter(c=>c.completedItems===c.totalItems).length} / ${a.length}`,subtitle:"completed"})]}),e.jsx("p",{className:"text-lg font-semibold mb-2 text-foreground",children:"Module Progress"}),e.jsx("div",{className:"flex flex-col gap-2 mb-3",children:a.map(c=>{const b=c.totalItems>0?c.completedItems/c.totalItems*100:0;return e.jsxs(t.Card,{className:t.cn("p-2 transition-colors",i&&"cursor-pointer hover:border-primary"),onClick:()=>i==null?void 0:i(c.uid),children:[e.jsxs("div",{className:"flex justify-between items-center mb-0.5",children:[e.jsx("span",{className:"font-semibold text-sm text-foreground",children:c.name}),e.jsxs("span",{className:"text-xs text-muted-foreground",children:[c.completedItems," / ",c.totalItems]})]}),e.jsx(t.Progress,{value:b,size:"sm"})]},c.uid)})}),d&&d.length>0&&e.jsxs(e.Fragment,{children:[e.jsx("p",{className:"text-lg font-semibold mb-2 text-foreground",children:"Recent Activity"}),e.jsx("div",{className:"flex flex-col gap-1.5 mb-3",children:d.slice(0,m).map(c=>{const b=fe[c.type]??M.CheckCircle;return e.jsxs("div",{className:"flex gap-1.5 items-center",children:[e.jsx(b,{size:16}),e.jsx("span",{className:"flex-1 text-sm text-foreground",children:c.description}),e.jsx("span",{className:"text-xs text-muted-foreground",children:new Date(c.timestamp).toLocaleDateString()})]},c.uid)})})]}),l&&l.length>0&&e.jsxs(e.Fragment,{children:[e.jsx("p",{className:"text-lg font-semibold mb-2 text-foreground",children:"Achievements"}),e.jsx("div",{className:"grid grid-cols-[repeat(auto-fill,minmax(140px,1fr))] gap-2",children:l.map(c=>e.jsxs(t.Card,{className:"p-2 text-center",children:[c.iconUrl?e.jsx("img",{src:c.iconUrl,alt:c.name,className:"w-12 h-12 mb-1 mx-auto"}):e.jsx(M.Trophy,{size:32,className:"mx-auto mb-2 text-warning"}),e.jsx("p",{className:"font-semibold text-sm text-foreground",children:c.name}),e.jsx("p",{className:"text-xs text-muted-foreground",children:c.description})]},c.uid))})]})]})}const pe={classic:"border-[3px] border-double border-warning bg-linear-to-br from-[#fffbe6] to-[#fff8e1]",modern:"border border-primary bg-linear-to-br from-[#fff5f5] to-[#fee2e2]",minimal:"border border-border"};function ge({recipientName:n,courseTitle:r,completionDate:a,organizationName:d,organizationLogo:f,signatory:l,certificateId:m,variant:i="classic",showActions:w=!0,onPrint:C,onDownload:c,className:b,style:D}){const u=(()=>{try{return new Date(a).toLocaleDateString("en-US",{year:"numeric",month:"long",day:"numeric"})}catch{return a}})();function z(){C?C():window.print()}return e.jsxs("div",{className:b,style:D,children:[e.jsxs("div",{className:t.cn("p-3 sm:p-5 md:p-6 text-center max-w-200 mx-auto rounded-md",pe[i]),children:[f?e.jsx("img",{src:f,alt:d,className:"h-15 mb-2 mx-auto block"}):e.jsx(M.Award,{size:48,className:t.cn("mx-auto mb-4",i==="classic"&&"text-warning")}),e.jsx("p",{className:"uppercase tracking-[3px] text-sm text-foreground/70",children:"Certificate of Completion"}),e.jsx(t.Separator,{className:"my-2 mx-auto max-w-50"}),e.jsx("p",{className:"text-sm text-foreground mb-1",children:"This is to certify that"}),e.jsx("p",{className:t.cn("text-2xl font-bold mb-2 text-foreground",i==="classic"&&"font-serif"),children:n}),e.jsx("p",{className:"text-sm text-foreground mb-1",children:"has successfully completed"}),e.jsx("p",{className:"text-xl font-bold mb-2 text-primary",children:r}),e.jsxs("p",{className:"text-sm text-foreground mb-3",children:["Issued by ",d," on ",u]}),l&&e.jsxs("div",{className:"mt-4 mb-2",children:[e.jsx(t.Separator,{className:"my-2 mx-auto max-w-50"}),e.jsx("p",{className:"font-semibold text-sm text-foreground",children:l.name}),e.jsx("p",{className:"text-xs text-muted-foreground",children:l.title})]}),m&&e.jsxs("span",{className:"block text-xs text-muted-foreground mt-2",children:["Certificate ID: ",m]})]}),w&&e.jsxs("div",{className:"flex justify-center gap-2 mt-3",children:[e.jsxs(t.Button,{variant:"outline",onClick:z,children:[e.jsx(M.Printer,{size:16})," Print"]}),c&&e.jsxs(t.Button,{variant:"outline",onClick:c,children:[e.jsx(M.Download,{size:16})," Download"]})]})]})}exports.AnnouncementFeed=ue;exports.AssessmentReview=te;exports.AssignmentSubmission=me;exports.CertificateViewer=ge;exports.CourseOutline=se;exports.DiscussionThread=xe;exports.ExamSession=ae;exports.FlashcardStudySession=O;exports.GradebookTable=he;exports.LecturePlayer=X;exports.LessonPage=ce;exports.PracticeQuiz=le;exports.ProgressDashboard=je;exports.QuizSession=W;exports.ResourceLibrary=de;exports.ScrollableQuiz=ne;exports.SurveyForm=ie;
|