openlearn-next 0.4.2 → 0.7.3
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/README.md +26 -21
- package/cli-data.mjs +535 -40
- package/cli-doctor.mjs +456 -17
- package/cli.mjs +214 -12
- package/dist/assets/AcademicYearFilter-DUUGpDKt.js +1 -0
- package/dist/assets/ActivityWorkspaceWidget-5PzyxF6a.js +1 -0
- package/dist/assets/AdminDirectoryView-BCtmQTEK.js +5 -0
- package/dist/assets/AssessmentCenter-B43ojHG-.js +1 -0
- package/dist/assets/BatchPickerModal-CbmjInp7.js +1 -0
- package/dist/assets/ClassesView-DEnMaDOt.js +32 -0
- package/dist/assets/ClassroomCountdownWidget-CHq4983w.js +2 -0
- package/dist/assets/CloudDriveModal-D2t3Uyzr.js +1 -0
- package/dist/assets/ComputerLabView-YtnoT5Rb.js +1 -0
- package/dist/assets/CourseManagement-DOXyJ_j-.js +1 -0
- package/dist/assets/CourseWizardModal-Dbi6Caw2.js +3 -0
- package/dist/assets/CoursewareHubPanel-CyxDIJAF.js +1 -0
- package/dist/assets/Dashboard-2rLu_ZBy.js +8 -0
- package/dist/assets/ExportWeightModal-BrmAh6VX.js +1 -0
- package/dist/assets/GLTFLoader-CZJbo_y1.js +1 -0
- package/dist/assets/HelpTour-D_q1z_MI.js +1 -0
- package/dist/assets/HelpView-CVBrKDrd.js +204 -0
- package/dist/assets/ImportLessonsModal-PhHtX31R.js +1 -0
- package/dist/assets/ImportModal-DqjqNeH4.js +2 -0
- package/dist/assets/InteractiveCoursewareViewer-Vi6lLz7a.js +1 -0
- package/dist/assets/InteractiveWhiteboard-lTzeayX5.js +65 -0
- package/dist/assets/LazyCourseware-KIt0rGtW.js +2 -0
- package/dist/assets/LazyWhiteboard-CCN3pYcW.js +2 -0
- package/dist/assets/LessonEditorView-D_GVhHuM.js +1 -0
- package/dist/assets/LiveClassroomView-BRsZ6QEq.js +61 -0
- package/dist/assets/NotificationDetailModal-tY5rxYCN.js +1 -0
- package/dist/assets/OrbitControls-CQjN_uwS.js +1 -0
- package/dist/assets/PluginView-CedpAW6d.js +77 -0
- package/dist/assets/ProcessLogsModal-Cfr-T9Gd.js +1 -0
- package/dist/assets/QuizGeneratorModal-bUA002kP.js +1 -0
- package/dist/assets/StudentAssignmentView-BhAz6Hfk.js +1 -0
- package/dist/assets/StudentLessonView-DC1yX4kG.js +1 -0
- package/dist/assets/StudentView-PHKxIV9T.js +2 -0
- package/dist/assets/SystemResourceLibraryModal-DgXYe6_x.js +1 -0
- package/dist/assets/TeacherView-DscJtOJ9.js +2 -0
- package/dist/assets/TimetableView-D2ozoj_D.js +6 -0
- package/dist/assets/UTIF-FfCsrHhe.js +1 -0
- package/dist/assets/__vite-optional-peer-dep_ai_ooxml-ui-BIHI7g3E.js +1 -0
- package/dist/assets/browser-DEI0QxZC.js +1 -0
- package/dist/assets/html2canvas-pro.esm-Bo50djkB.js +12 -0
- package/dist/assets/index-2676X8YB.js +131 -0
- package/dist/assets/index-C6hlh8pw.css +1 -0
- package/dist/assets/{index.es-C5eWEO4o.js → index.es-DyEF0CZ9.js} +1 -1
- package/dist/assets/pluginParsers-e4PSm2Iy.js +1 -0
- package/dist/assets/react_pptx-react-viewer-BIHI7g3E.js +1 -0
- package/dist/assets/teaching-modes-client-BeVaDdJ-.js +1 -0
- package/dist/assets/three.module-iOYB3rD4.js +4228 -0
- package/dist/assets/timeline-duration-BgdJCSrW.js +1 -0
- package/dist/assets/{vendor-charts-qLbgF1eL.js → vendor-charts-SrpBsvM3.js} +2 -2
- package/dist/assets/{vendor-icons-BRmhY6fg.js → vendor-icons-CXrZ3R2V.js} +2 -2
- package/dist/assets/{vendor-konva-CEOq4dcl.js → vendor-konva-Dne0Z-WC.js} +1 -1
- package/dist/assets/{vendor-pdf-D7rGevI1.js → vendor-pdf-C1Vh2Aqq.js} +56 -56
- package/dist/assets/vendor-pptx-Bzn6whfK.js +11311 -0
- package/dist/assets/vendor-pptx-DIWdXF1L.css +1 -0
- package/dist/assets/{vendor-react-B0t7H3hh.js → vendor-react-Kv_JATwr.js} +1 -1
- package/dist/assets/vendor-utils-aM7aYvPP.js +1 -0
- package/dist/cli-migrator.cjs +310 -0
- package/dist/env-validation.cjs +351 -0
- package/dist/index.html +13 -10
- package/dist/plugin-net-preload.cjs +263 -0
- package/dist/server.cjs +51140 -27229
- package/migrations/000_initial_schema.sql +410 -0
- package/migrations/001_add_execution_mode.sql +6 -0
- package/migrations/002_add_client_session_expiry.sql +6 -0
- package/migrations/003_classroom_runtime.sql +33 -0
- package/migrations/004_courseware_score_config.sql +26 -0
- package/migrations/005_assignment_hub.sql +155 -0
- package/migrations/006_classroom_event_bus.sql +28 -0
- package/migrations/007_interactive_classroom.sql +119 -0
- package/migrations/008_teaching_modes.sql +36 -0
- package/migrations/009_classroom_peer_review.sql +159 -0
- package/migrations/010_class_groups.sql +33 -0
- package/migrations/011_classroom_feed.sql +34 -0
- package/migrations/012_auto_record_score.sql +48 -0
- package/migrations/013_score_source_strategy.sql +81 -0
- package/migrations/014_performance_indexes.sql +21 -0
- package/migrations/015_demo_data_registry.sql +26 -0
- package/migrations/016_preset_polls_and_passcode_expiry.sql +33 -0
- package/migrations/017_pacing_signals_segment.sql +6 -0
- package/migrations/018_processes_plugin_owner.sql +26 -0
- package/migrations/019_plugins_version.sql +61 -0
- package/migrations/020_upload_max_file_mb.sql +14 -0
- package/migrations/021_class_owner_and_password_gate.sql +11 -0
- package/migrations/022_plugin_public_routes.sql +14 -0
- package/migrations/023_encrypt_class_passcodes.sql +18 -0
- package/migrations/024_segment_gates.sql +37 -0
- package/migrations/025_assignment_lookup_indexes.sql +11 -0
- package/migrations/026_plugin_grants.sql +21 -0
- package/migrations/027_academic_year.sql +26 -0
- package/migrations/028_classroom_indexes.sql +14 -0
- package/migrations/029_clean_lesson_think_artifacts.sql +13 -0
- package/migrations/030_backfill_academic_year.sql +30 -0
- package/migrations/031_assessment_core.sql +158 -0
- package/migrations/032_progress_verification.sql +17 -0
- package/migrations/033_student_lock_mode.sql +9 -0
- package/migrations/034_plugin_orphan_data.sql +27 -0
- package/migrations/035_icebreaker_checkins.sql +26 -0
- package/migrations/036_student_read_notifications_created_at.sql +19 -0
- package/migrations/037_plugin_config_scopes.sql +40 -0
- package/migrations/038_assessment_ai_grading_suggestion.sql +10 -0
- package/migrations/039_question_bank_sharing_and_papers.sql +14 -0
- package/migrations/040_assignment_grade_history.sql +37 -0
- package/migrations/041_course_package_idempotency.sql +33 -0
- package/migrations/042_assignment_grade_resubmit_audit.sql +12 -0
- package/migrations/043_mark_sha256_passwords.sql +31 -0
- package/migrations/README.md +61 -0
- package/migrations/schema-golden.json +640 -0
- package/package.json +54 -28
- package/dist/assets/AdminDirectoryView-DY--WM5Z.js +0 -1
- package/dist/assets/BatchPickerModal-BpWu0Lil.js +0 -1
- package/dist/assets/ClassesView-KbHEqJto.js +0 -22
- package/dist/assets/ClassroomCountdownWidget-96WFRO9A.js +0 -2
- package/dist/assets/CloudDriveModal-DEQ1nkNk.js +0 -1
- package/dist/assets/ComputerLabView-1qWDNRQ2.js +0 -1
- package/dist/assets/CourseManagement-D3ZpxY0l.js +0 -1
- package/dist/assets/CourseWizardModal-Ck_-M8pk.js +0 -3
- package/dist/assets/CoursewareHubPanel-CaEizhxl.js +0 -1
- package/dist/assets/Dashboard-CYbpbofV.js +0 -8
- package/dist/assets/ExportWeightModal-DW2bu9Zz.js +0 -1
- package/dist/assets/HelpTour-CMJbbGne.js +0 -1
- package/dist/assets/HelpView-CtzdqhBq.js +0 -204
- package/dist/assets/ImportLessonsModal-jBuIK453.js +0 -1
- package/dist/assets/ImportModal-D7L-KNhZ.js +0 -1
- package/dist/assets/InteractiveCoursewareViewer-Bj7ahXMs.js +0 -1
- package/dist/assets/InteractiveWhiteboard-B7JcJvDu.js +0 -77
- package/dist/assets/LazyCourseware-CuiPxhDg.js +0 -2
- package/dist/assets/LazyWhiteboard-BJwCEZAU.js +0 -2
- package/dist/assets/LessonEditorView-DFrOp2qp.js +0 -1
- package/dist/assets/LiveClassroomView-BZ5nGee3.js +0 -59
- package/dist/assets/NotificationDetailModal-Baqnc5pU.js +0 -1
- package/dist/assets/PluginView-CCbIuZ24.js +0 -66
- package/dist/assets/ProcessLogsModal-DmFXg9mG.js +0 -1
- package/dist/assets/QuizGeneratorModal-BBEDssp7.js +0 -1
- package/dist/assets/StudentAssignmentView-DgIjUsXz.js +0 -1
- package/dist/assets/StudentLessonView-CBJbI5x6.js +0 -1
- package/dist/assets/StudentPreviewModal-Bh8OZs0t.js +0 -1
- package/dist/assets/StudentView--uGxc5TJ.js +0 -2
- package/dist/assets/SystemResourceLibraryModal-BVCclcqA.js +0 -1
- package/dist/assets/TeacherView-D4Zsc0eZ.js +0 -2
- package/dist/assets/TimetableView-BQG-rEb5.js +0 -6
- package/dist/assets/index-BKBCBKvy.js +0 -217
- package/dist/assets/index-CvGu7LSj.css +0 -1
- package/dist/assets/purify.es-CYR4BTuT.js +0 -3
- package/dist/assets/vendor-pptx-C5-U7ieS.js +0 -39
- package/dist/assets/vendor-utils-m0Urvtws.js +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{j as e}from"./vendor-react-Kv_JATwr.js";import{as as o}from"./vendor-icons-CXrZ3R2V.js";import"./vendor-utils-aM7aYvPP.js";function n({showProcessLogs:s,setShowProcessLogs:r,processLogsContent:l,t}){return s?e.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50 p-4",children:e.jsxs("div",{className:"bg-white rounded-xl shadow-xl w-full max-w-2xl flex flex-col max-h-[90vh]",children:[e.jsxs("div",{className:"p-4 border-b border-gray-100 flex items-center justify-between",children:[e.jsxs("h2",{className:"font-semibold text-gray-800 flex items-center gap-2",children:[e.jsx(o,{size:18,className:"text-gray-600"}),t.processLogsTitle||"Process Logs"]}),e.jsx("button",{onClick:()=>r(null),className:"text-gray-400 hover:text-gray-600 font-bold px-2",children:"×"})]}),e.jsx("div",{className:"p-4 flex-1 overflow-auto bg-gray-900 m-4 rounded flex flex-col",children:e.jsx("pre",{className:"font-mono text-xs text-green-400 whitespace-pre-wrap",children:l||"No logs generated."})})]})}):null}export{n as ProcessLogsModal};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{j as e}from"./vendor-react-Kv_JATwr.js";import{m as O}from"./index-2676X8YB.js";import{ar as w,c as C,o as k}from"./vendor-icons-CXrZ3R2V.js";import"./vendor-utils-aM7aYvPP.js";import"./vendor-pdf-C1Vh2Aqq.js";import"./vendor-motion-BFAPOs-b.js";import"./vendor-charts-SrpBsvM3.js";function E(z){const{isQuizGeneratorOpen:S,setIsQuizGeneratorOpen:x,lessons:g,quizGenMode:n,setQuizGenMode:u,quizGenSelectedLessonId:l,setQuizGenSelectedLessonId:Q,quizGenTopic:c,setQuizGenTopic:M,isGeneratingSuggestions:p,setIsGeneratingSuggestions:h,suggestedObjectives:b,setSuggestedObjectives:f,suggestedQuestions:r,setSuggestedQuestions:m,quizGenTimeLimit:j,setQuizGenTimeLimit:G,savingQuiz:y,setSavingQuiz:v,quizGeneratorClassId:o,fetchClassDashboard:N}=z;return e.jsx(e.Fragment,{children:S&&e.jsx("div",{className:"fixed inset-0 bg-gray-900/40 backdrop-blur-sm flex items-center justify-center p-6 z-50 overflow-y-auto text-gray-850",children:e.jsxs(O.div,{initial:{opacity:0,scale:.95},animate:{opacity:1,scale:1},exit:{opacity:0,scale:.95},className:"bg-white border text-gray-900 border-gray-200 rounded-2xl shadow-2xl w-full max-w-3xl flex flex-col overflow-hidden max-h-[90vh]",children:[e.jsxs("div",{className:"p-4 border-b border-gray-100 flex items-center justify-between bg-gray-50/80 shrink-0",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(w,{className:"text-indigo-600 animate-pulse",size:20}),e.jsx("h2",{className:"font-bold text-gray-800 text-lg",children:"AI-Objective Quiz Generator"})]}),e.jsx("button",{onClick:()=>x(!1),className:"text-gray-400 hover:text-gray-600 font-bold p-1 hover:bg-gray-200 rounded transition-colors",children:"×"})]}),e.jsxs("div",{className:"flex-1 overflow-y-auto p-6 space-y-6",children:[r.length===0&&e.jsxs("div",{className:"space-y-4",children:[e.jsx("div",{className:"bg-indigo-50/80 p-4 rounded-xl border border-indigo-100 text-xs text-indigo-800 leading-relaxed font-sans",children:"Choose a lesson to scan. Our advanced AI model will run a deep semantic scan across the entire lesson curriculum content, discover your core learning objectives, and construct interactive multiple-choice questions aligning precisely with each of them."}),e.jsxs("div",{className:"font-sans",children:[e.jsx("label",{className:"block text-xs font-semibold text-gray-500 uppercase tracking-wider mb-2",children:"Scan Core Selection Mode"}),e.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[e.jsxs("button",{onClick:()=>u("scan_lesson"),className:`p-3 rounded-lg border text-left flex flex-col transition-all ${n==="scan_lesson"?"border-indigo-600 bg-indigo-50/40 ring-2 ring-indigo-100":"border-gray-200 hover:border-gray-300"}`,children:[e.jsx("span",{className:"font-semibold text-sm text-indigo-900",children:"Curriculum Lesson Scanning"}),e.jsx("span",{className:"text-xs text-gray-500 mt-1",children:"Examines real Markdown content inside virtual lesson modules."})]}),e.jsxs("button",{onClick:()=>u("topic"),className:`p-3 rounded-lg border text-left flex flex-col transition-all ${n==="topic"?"border-indigo-600 bg-indigo-50/40 ring-2 ring-indigo-100":"border-gray-200 hover:border-gray-300"}`,children:[e.jsx("span",{className:"font-semibold text-sm text-indigo-900",children:"Custom Keyword / Topic"}),e.jsx("span",{className:"text-xs text-gray-500 mt-1",children:"Provide a custom prompt keyword or objective manually."})]})]})]}),n==="scan_lesson"?e.jsxs("div",{className:"font-sans",children:[e.jsx("label",{className:"block text-xs font-semibold text-gray-500 uppercase tracking-wider mb-2",children:"Select Lesson to Scan"}),g.length===0?e.jsx("div",{className:"text-gray-500 text-xs py-3 border rounded border-dashed text-center",children:"No lessons available. Please create a lesson first."}):e.jsxs("select",{value:l,onChange:s=>Q(s.target.value),className:"w-full p-2.5 bg-white border border-gray-200 rounded-lg text-sm text-gray-800 focus:border-indigo-500 focus:outline-none shadow-sm",children:[e.jsx("option",{value:"",children:"-- Choose a lesson --"}),g.map(s=>e.jsx("option",{value:s.id,children:s.title},s.id))]})]}):e.jsxs("div",{className:"font-sans",children:[e.jsx("label",{className:"block text-xs font-semibold text-gray-505 uppercase tracking-wider mb-2",children:"Custom Topic Prompt"}),e.jsx("input",{type:"text",placeholder:"e.g. Introduction to React state, Cloud SQL setup...",value:c,onChange:s=>M(s.target.value),className:"w-full p-2.5 bg-white border border-gray-200 rounded-lg text-sm focus:border-indigo-500 focus:outline-none shadow-sm text-gray-800"})]}),e.jsx("div",{className:"pt-4 flex justify-end font-sans",children:e.jsx("button",{disabled:p||n==="scan_lesson"&&!l||n==="topic"&&!c.trim(),onClick:async()=>{h(!0);try{if(n==="scan_lesson"){const s=await fetch(`/api/classes/${o}/assignments/suggest`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({lessonId:l})});if(s.ok){const t=await s.json();f(t.learningObjectives||[]),m((t.questions||[]).map(i=>({...i,selected:!0})))}else alert("Error generating suggestions. Please make sure the selected lesson has content.")}else(await fetch(`/api/classes/${o}/assignments/generate`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({topic:c})})).ok?(await N(o),x(!1)):alert("Error generating topic quiz.")}catch(s){console.error(s),alert(s.message)}finally{h(!1)}},className:"px-5 py-2.5 bg-indigo-600 hover:bg-indigo-700 disabled:opacity-50 text-white rounded-lg font-medium text-xs shadow transition flex items-center gap-2",children:p?e.jsxs(e.Fragment,{children:[e.jsx(C,{size:16,className:"animate-spin"}),e.jsx("span",{children:"AI Scanning Content..."})]}):e.jsxs(e.Fragment,{children:[e.jsx(w,{size:16}),e.jsx("span",{children:"Generate Key MCQ Quiz"})]})})})]}),r.length>0&&e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"font-sans",children:[e.jsx("div",{className:"text-xs font-bold text-gray-500 uppercase tracking-wider mb-2",children:"Identified Core Objectives"}),e.jsx("div",{className:"flex flex-wrap gap-2",children:b.map((s,t)=>e.jsxs("span",{className:"px-2.5 py-1 bg-teal-50 text-teal-800 border border-teal-200 rounded-full text-xs font-semibold",children:["🎯 ",s]},t))})]}),e.jsxs("div",{className:"space-y-4 font-sans",children:[e.jsx("div",{className:"text-xs font-bold text-gray-500 uppercase tracking-wider font-semibold",children:"Suggested MCQ Questions"}),e.jsx("div",{className:"space-y-3",children:r.map((s,t)=>e.jsxs("div",{className:"p-4 rounded-xl border border-gray-150 bg-gray-50/50 hover:bg-gray-50 transition space-y-3 text-gray-800 text-gray-850",children:[e.jsxs("div",{className:"flex items-start justify-between",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"w-5 h-5 rounded-full bg-indigo-150 text-indigo-700 flex items-center justify-center text-xs font-bold shrink-0",children:t+1}),e.jsxs("span",{className:"text-xs font-semibold text-teal-700 bg-teal-50 px-2.5 py-0.5 rounded border border-teal-100",children:["objective: ",s.objective]})]}),e.jsx("input",{type:"checkbox",checked:!!s.selected,onChange:i=>{const a=[...r];a[t].selected=i.target.checked,m(a)},className:"w-4 h-4 text-indigo-600 border-gray-300 rounded focus:ring-indigo-500"})]}),e.jsx("p",{className:"font-semibold text-gray-800 text-sm leading-relaxed",children:s.question}),e.jsx("div",{className:"grid grid-cols-2 gap-2 text-xs",children:s.options.map((i,a)=>{const d=i===s.correctAnswer;return e.jsxs("div",{className:`p-2 rounded border flex items-center justify-between ${d?"bg-green-50 border-green-200 text-green-955 font-semibold":"bg-white border-gray-100 text-gray-700"}`,children:[e.jsx("span",{children:i}),d&&e.jsx(k,{size:12,className:"text-green-600 shrink-0"})]},a)})})]},t))})]}),e.jsxs("div",{className:"pt-4 border-t border-gray-100 flex justify-between items-center font-sans",children:[e.jsx("button",{onClick:()=>{f([]),m([])},className:"px-4 py-2 bg-gray-100 hover:bg-gray-200 text-gray-700 rounded-lg text-xs font-semibold transition",children:"Back / Scan New"}),e.jsxs("div",{className:"flex items-center gap-2 border border-indigo-150 bg-indigo-50/50 px-3 py-1.5 rounded-lg text-xs font-semibold text-indigo-900",children:[e.jsx("span",{children:"⏱️ Quiz Time Limit:"}),e.jsxs("select",{value:j,onChange:s=>G(Number(s.target.value)),className:"bg-transparent text-xs text-indigo-950 font-bold focus:outline-none cursor-pointer",children:[e.jsx("option",{className:"text-gray-800",value:0,children:"No Limit"}),e.jsx("option",{className:"text-gray-800",value:1,children:"1 Min"}),e.jsx("option",{className:"text-gray-800",value:2,children:"2 Mins"}),e.jsx("option",{className:"text-gray-800",value:5,children:"5 Mins"}),e.jsx("option",{className:"text-gray-800",value:10,children:"10 Mins"}),e.jsx("option",{className:"text-gray-800",value:15,children:"15 Mins"}),e.jsx("option",{className:"text-gray-800",value:20,children:"20 Mins"}),e.jsx("option",{className:"text-gray-800",value:30,children:"30 Mins"}),e.jsx("option",{className:"text-gray-800",value:45,children:"45 Mins"}),e.jsx("option",{className:"text-gray-800",value:60,children:"60 Mins"})]})]}),e.jsxs("button",{disabled:y||r.filter(s=>s.selected).length===0,onClick:async()=>{v(!0);try{const s=g.find(a=>a.id===l),t=s?s.title:c||"Custom Objective";(await fetch(`/api/classes/${o}/assignments/create-suggested-quiz`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({title:`MCQ Evaluation: ${t}`,description:"Automatic evaluation based on core learning objectives.",questions:r.filter(a=>a.selected).map(({selected:a,...d})=>d),learningObjectives:b,timeLimit:j})})).ok?(await N(o),x(!1)):alert("Failed to save suggested quiz.")}catch(s){console.error(s),alert(s.message)}finally{v(!1)}},className:"px-5 py-2.5 bg-indigo-600 hover:bg-indigo-700 text-white rounded-lg font-medium text-xs shadow hover:shadow-md transition flex items-center gap-2",children:[y?e.jsx(C,{size:16,className:"animate-spin"}):e.jsx(k,{size:16}),e.jsx("span",{children:"Create Assessment Quiz"})]})]})]})]})]})})})}export{E as QuizGeneratorModal};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{j as e,r as N}from"./vendor-react-Kv_JATwr.js";import{E as z,h as T,M as q}from"./index-2676X8YB.js";import{f as _,ar as C,o as A,h as S,T as E,X as R}from"./vendor-icons-CXrZ3R2V.js";import{L as O}from"./LazyWhiteboard-CCN3pYcW.js";import"./vendor-utils-aM7aYvPP.js";import"./vendor-pdf-C1Vh2Aqq.js";import"./vendor-motion-BFAPOs-b.js";import"./vendor-charts-SrpBsvM3.js";function I(x){const{setStudentViewStatus:s,setSelectedAssignment:i,selectedAssignment:o}=x;return e.jsxs("div",{className:"flex items-center justify-between flex-wrap gap-2",children:[e.jsxs("button",{onClick:()=>{s("dashboard"),i(null)},className:"flex items-center gap-2 text-indigo-600 hover:text-indigo-800 transition-colors font-medium text-sm",children:[e.jsx(_,{className:"rotate-180",size:16})," Back to Dashboard"]}),e.jsxs("div",{className:"flex items-center gap-3 flex-wrap",children:[e.jsxs("h2",{className:"text-xl font-bold text-gray-800",children:["Assignment: ",o.title]}),e.jsx(z,{slot:"student.assignment.toolbar.action",slotProps:{assignment:o}})]})]})}function Q(x){const{selectedAssignment:s,quizStudentAnswers:i,setQuizStudentAnswers:o,submitQuizAssignment:d}=x,m=T.match(s?.content);if(m){const n=m.config,r={assignment:s,answers:i,setAnswers:t=>o?.(t),lang:"zh"};return e.jsxs("div",{className:"w-1/3 border-r border-gray-100 pr-4 overflow-y-auto hidden md:block",children:[e.jsx("div",{className:"flex justify-between items-center mb-4",children:e.jsx("div",{className:"text-xs font-semibold uppercase tracking-wider text-indigo-500 bg-indigo-50 border border-indigo-100 p-2.5 rounded-lg flex items-center gap-1.5 w-full",children:n.label})}),n.render(r),!s.submission_status&&e.jsx("div",{className:"mt-6 border-t border-gray-100 pt-4",children:e.jsx("button",{onClick:async()=>{if(n.validate){const t=n.validate(r);if(t){window.alert(t);return}}n.buildSubmission&&o?.(n.buildSubmission(r)),await d(!1)},className:"w-full py-2 bg-indigo-600 text-white rounded-lg shadow font-medium hover:bg-indigo-700 transition",children:"Submit"})})]})}return e.jsxs("div",{className:"w-1/3 border-r border-gray-100 pr-4 overflow-y-auto hidden md:block",children:[e.jsx("div",{className:"flex justify-between items-center mb-4",children:e.jsx("div",{className:"text-xs font-semibold uppercase tracking-wider text-gray-400",children:s?.content&&s.content.startsWith('{"quizType":"mcq_learning_objectives"')?"Assessment":"Question"})}),s?.content&&s.content.startsWith('{"quizType":"mcq_learning_objectives"')?e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"text-xs font-semibold uppercase tracking-wider text-teal-700 bg-teal-50 border border-teal-100 p-2.5 rounded-lg flex items-center gap-1.5 font-sans",children:[e.jsx(C,{size:12,className:"text-teal-600 animate-pulse"})," AI Interactive Evaluation"]}),e.jsx("p",{className:"text-xs text-gray-500 leading-relaxed font-sans",children:"This assessment was automatically mapped to the core learning objectives of your lesson by our tutoring assistant compiler."}),(()=>{try{const n=JSON.parse(s.content);return e.jsxs("div",{className:"space-y-2 font-sans",children:[e.jsx("div",{className:"text-xs font-bold text-gray-400 uppercase tracking-wider",children:"Lesson Learning Objectives:"}),e.jsx("ul",{className:"space-y-1.5",children:(n.learningObjectives||[]).map((r,t)=>e.jsxs("li",{className:"text-xs text-gray-755 flex items-start gap-1.5 font-medium leading-normal",children:[e.jsx("span",{className:"text-indigo-500 shrink-0 select-none",children:"🎯"}),e.jsx("span",{children:r})]},t))})]})}catch{return null}})()]}):e.jsx("div",{className:"prose prose-sm prose-indigo max-w-none mb-6",children:e.jsx(q,{children:s.content||""})}),!s.submission_status&&e.jsxs("div",{className:"mt-8 border-t border-gray-100 pt-6",children:[e.jsx("div",{className:"text-xs font-semibold uppercase tracking-wider text-gray-400 mb-2",children:"Ready to submit?"}),e.jsx("p",{className:"text-xs text-gray-500 mb-4",children:s?.content&&s.content.startsWith('{"quizType":"mcq_learning_objectives"')?"Please answer all the interactive questions on the evaluation sheet, then click Submit.":"You can use the whiteboard to draw or answer, then click submit when finished."}),e.jsx("button",{onClick:async()=>{const n=s?.content&&s.content.startsWith('{"quizType":"mcq_learning_objectives"');if(n&&JSON.stringify(i),n)try{const r=JSON.parse(s.content),t=Object.keys(i).length;if(t<r.questions.length&&!window.confirm(`You have only answered ${t}/${r.questions.length} questions. Are you sure you want to submit your answers?`))return}catch{}await d(!1)},className:"w-full py-2 bg-indigo-600 text-white rounded-lg shadow font-medium hover:bg-indigo-700 transition",children:"Submit"})]}),s.submission_status==="graded"&&s.feedback&&e.jsxs("div",{className:"mt-6 bg-green-50 p-4 rounded-xl border border-green-100",children:[e.jsxs("div",{className:"font-semibold text-green-800 text-sm mb-1 flex items-center gap-1",children:[e.jsx(A,{size:16})," Grade: ",s.score,"%"]}),e.jsx("div",{className:"text-xs text-green-700 whitespace-pre-wrap leading-relaxed font-sans",children:s.feedback})]})]})}function W({assignmentId:x,timeLimitMinutes:s,onTimeUp:i,isSubmitted:o}){const[d,m]=N.useState(null);if(N.useEffect(()=>{if(o||!s||s<=0){m(null);return}const a=`quiz_timer_start_${x}`;let u=sessionStorage.getItem(a),g=u?parseInt(u,10):null;g||(g=Date.now(),sessionStorage.setItem(a,g.toString()));const l=s*60,c=()=>{const j=Math.floor((Date.now()-g)/1e3),h=l-j;h<=0?(m(0),i()):m(h)};c();const b=setInterval(c,1e3);return()=>clearInterval(b)},[x,s,o,i]),!s||s<=0)return null;if(o)return e.jsxs("div",{className:"flex items-center gap-2 font-sans text-xs bg-gray-100 text-gray-600 px-3 py-1.5 rounded-lg border border-gray-200",children:[e.jsx(S,{size:14}),e.jsxs("span",{children:["Time Limit: ",s," mins (Completed)"]})]});if(d===null)return null;const n=Math.floor(d/60),r=d%60,t=d<60;return e.jsxs("div",{className:`flex items-center gap-3 font-sans px-4 py-2.5 rounded-xl border transition-all ${t?"bg-red-50 text-red-700 border-red-200 animate-pulse font-bold":d<180?"bg-amber-50 text-amber-700 border-amber-200 font-semibold":"bg-indigo-50 text-indigo-700 border-indigo-100"}`,children:[e.jsx(S,{size:16,className:t?"text-red-600 animate-pulse":"text-indigo-600"}),e.jsxs("div",{className:"flex-1 flex justify-between items-center text-xs gap-4",children:[e.jsxs("div",{children:[e.jsx("span",{className:"font-medium",children:"Time Remaining:"}),e.jsxs("span",{className:"font-mono ml-1 text-sm bg-black/5 text-slate-800 px-1.5 py-0.5 rounded font-bold",children:[n.toString().padStart(2,"0"),":",r.toString().padStart(2,"0")]})]}),t&&e.jsxs("span",{className:"flex items-center gap-1 text-xs uppercase tracking-wider text-red-600 font-bold animate-pulse",children:[e.jsx(E,{size:12})," Time is almost up!"]})]})]})}function P(x){const{selectedAssignment:s,subAssignmentTab:i,setSubAssignmentTab:o,quizStudentAnswers:d,setQuizStudentAnswers:m,submitQuizAssignment:n,elements:r,activeRole:t,activeStudentId:a,fetchElements:u}=x;return e.jsx("div",{className:"flex-1 relative flex flex-col min-h-0",children:(()=>{const g=s?.content&&s.content.startsWith('{"quizType":"mcq_learning_objectives"');return e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex justify-between items-center mb-2",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("span",{className:"text-xs font-semibold uppercase tracking-wider text-gray-500 pointer-events-none",children:g&&i==="quiz"?"Evaluation Sheet":"Live Canvas"}),g&&e.jsxs("div",{className:"flex bg-gray-100 p-0.5 rounded-lg border border-gray-200 text-xs",children:[e.jsx("button",{onClick:()=>o("quiz"),className:`px-2.5 py-0.5 rounded text-xs font-bold transition-all ${i==="quiz"?"bg-white text-indigo-700 shadow-sm":"text-gray-500 hover:text-gray-900"}`,children:"Interactive Test"}),e.jsx("button",{onClick:()=>o("whiteboard"),className:`px-2.5 py-0.5 rounded text-xs font-bold transition-all ${i==="whiteboard"?"bg-white text-indigo-700 shadow-sm":"text-gray-500 hover:text-gray-900"}`,children:"Sketch Whiteboard"})]})]}),s.submission_status&&e.jsx("div",{className:"text-xs uppercase font-bold text-gray-400 bg-gray-100 px-2 py-0.5 rounded",children:"Read Only"})]}),g&&i==="quiz"?e.jsx("div",{className:"flex-1 bg-gray-50/50 rounded-xl border border-gray-200 p-6 overflow-y-auto space-y-6",children:(()=>{try{const l=JSON.parse(s.content);return e.jsxs(e.Fragment,{children:[l.timeLimit>0&&e.jsx(W,{assignmentId:s.id,timeLimitMinutes:l.timeLimit,onTimeUp:()=>n(!0),isSubmitted:!!s.submission_status}),l.questions.map((c,b)=>{const j=d[b],h=!!s.submission_status,v=d[b]===c.correctAnswer;return e.jsxs("div",{className:"bg-white p-5 rounded-xl border border-gray-100 shadow-sm space-y-3 font-sans",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"w-6 h-6 rounded-full bg-indigo-50 text-indigo-700 flex items-center justify-center text-xs font-bold ring-1 ring-indigo-100",children:b+1}),e.jsxs("span",{className:"text-xs font-semibold text-teal-700 bg-teal-50 px-2.5 py-0.5 rounded-full border border-teal-100",children:["evaluates: ",c.objective]})]}),h&&e.jsx("span",{className:`text-xs font-bold px-2.5 py-0.5 rounded-full ${v?"bg-green-100 text-green-800":"bg-red-100 text-red-800"}`,children:v?"Correct ✓":`Incorrect (Correct Option: ${c.correctAnswer})`})]}),e.jsx("div",{className:"font-semibold text-gray-800 text-sm",children:c.question}),e.jsx("div",{className:"grid grid-cols-2 gap-3 text-xs pt-1",children:c.options.map((f,$)=>{const y=j===f,w=f===c.correctAnswer;let p="border-gray-200 hover:border-gray-300 bg-white text-gray-700 hover:bg-gray-50/50 cursor-pointer";return h?y?p=w?"border-green-600 bg-green-50 text-green-900 ring-2 ring-green-100":"border-red-600 bg-red-50 text-red-900 ring-2 ring-red-100":w?p="border-green-400 bg-green-50/20 text-green-900":p="border-gray-200 opacity-60 text-gray-400":y&&(p="border-indigo-600 bg-indigo-50/30 text-indigo-900 ring-2 ring-indigo-100 font-medium cursor-pointer"),e.jsxs("div",{onClick:()=>{h||m(k=>({...k,[b]:f}))},className:`p-3 rounded-xl border transition-all duration-150 flex items-center justify-between ${p}`,children:[e.jsx("span",{children:f}),y&&(h?w?e.jsx(A,{size:14,className:"text-green-600 shrink-0"}):e.jsx(R,{size:14,className:"text-red-600 shrink-0"}):e.jsx("div",{className:"w-2 h-2 rounded-full bg-indigo-600 shadow-sm shrink-0"}))]},$)})})]},b)})]})}catch{return e.jsx("div",{className:"text-xs text-red-500 font-sans",children:"Error parsing quiz structure."})}})()}):e.jsx("div",{className:`flex-1 min-h-0 flex flex-col ${s.submission_status?"opacity-90 pointer-events-none filter grayscale-[0.2]":""}`,children:e.jsx(O,{lessonId:`assignment-${s.id}-student-${a}`,elements:r,userRole:t,enableAutoAI:t==="student"&&!s.submission_status,onElementAdd:async(l,c)=>{await fetch(`/api/lessons/assignment-${s.id}-student-${a}/whiteboard`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({type:l,data:c})}),u(`assignment-${s.id}-student-${a}`)},onElementUpdate:async(l,c)=>{await fetch(`/api/lessons/assignment-${s.id}-student-${a}/whiteboard/${l}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({data:c})}),u(`assignment-${s.id}-student-${a}`)},onElementDelete:async l=>{await fetch(`/api/lessons/assignment-${s.id}-student-${a}/whiteboard/${l}`,{method:"DELETE"}),u(`assignment-${s.id}-student-${a}`)},onClearBoard:async()=>{await fetch(`/api/lessons/assignment-${s.id}-student-${a}/whiteboard`,{method:"DELETE"}),u(`assignment-${s.id}-student-${a}`)},onRefresh:()=>u(`assignment-${s.id}-student-${a}`)})})]})})()})}function H(x){const{selectedAssignment:s,setStudentViewStatus:i,setSelectedAssignment:o,quizStudentAnswers:d,submitQuizAssignment:m,subAssignmentTab:n,setSubAssignmentTab:r,setQuizStudentAnswers:t,elements:a,activeRole:u,activeStudentId:g,fetchElements:l}=x;return e.jsxs("div",{className:"flex flex-col h-full space-y-4",children:[e.jsx(I,{setStudentViewStatus:i,setSelectedAssignment:o,selectedAssignment:s}),e.jsxs("div",{className:"flex-1 flex gap-6 min-h-0 bg-white border border-gray-200 rounded-xl p-4 shadow-sm",children:[e.jsx(Q,{selectedAssignment:s,quizStudentAnswers:d,setQuizStudentAnswers:t,submitQuizAssignment:m}),e.jsx(P,{selectedAssignment:s,subAssignmentTab:n,setSubAssignmentTab:r,quizStudentAnswers:d,setQuizStudentAnswers:t,submitQuizAssignment:m,elements:a,activeRole:u,activeStudentId:g,fetchElements:l})]})]})}export{H as StudentAssignmentView};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as j,j as e}from"./vendor-react-Kv_JATwr.js";import{u as le}from"./StudentView-PHKxIV9T.js";import{L as Q,f as de,B as ce,l as xe,m as me,q as se,R as G,a8 as te,b3 as be,$ as ge,C as fe,k as pe,O as je,a as ve,w as ye,a3 as ue,p as we,aY as ke,ao as Ne,X as Se,c as Ce,aA as ze,b4 as Le,e as $e}from"./vendor-icons-CXrZ3R2V.js";import{E as B,M as Pe,s as K,f as re}from"./index-2676X8YB.js";import{L as _e}from"./LazyWhiteboard-CCN3pYcW.js";import{L as Ie}from"./LazyCourseware-KIt0rGtW.js";import"./vendor-utils-aM7aYvPP.js";import"./vendor-pdf-C1Vh2Aqq.js";import"./vendor-motion-BFAPOs-b.js";import"./vendor-charts-SrpBsvM3.js";function Ae({lessonId:r,lang:s,addToast:d}){const[o,p]=j.useState(""),[i,u]=j.useState("idle"),[f,y]=j.useState("");if(j.useEffect(()=>{p(""),u("idle"),y("")},[r]),!r)return null;const c=async()=>{const x=o.trim();if(!x){u("error"),y(s==="zh"?"请先输入签到码":"Enter the check-in code first");return}u("submitting"),y("");try{const C=await fetch(`/api/classroom/sessions/${encodeURIComponent(r)}/checkin`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({code:x})}),h=await C.json().catch(()=>({}));if(!C.ok||!h.success){u("error");const m=h.error==="Invalid checkin code"?s==="zh"?"签到码不正确,请核对大屏后重试":"Wrong code, check the stage display and retry":h.error||(s==="zh"?"签到失败,请稍后重试":"Check-in failed, retry later");y(m);return}u("done");const z=h.attendanceScheduled!==!1;y(z?s==="zh"?"签到成功,出勤已记录":"Checked in, attendance recorded":s==="zh"?"签到成功(本课节未关联排课,未计入正式出勤)":"Checked in (no schedule linked; not counted in official attendance)"),d(s==="zh"?"签到成功":"Checked in",z?s==="zh"?"出勤已记录":"Attendance recorded":s==="zh"?"会话级签到,未计入正式出勤":"Session-level check-in only","success")}catch{u("error"),y(s==="zh"?"网络异常,请稍后重试":"Network error, retry later")}};return e.jsxs("div",{className:"flex flex-wrap items-center gap-2 bg-surface border border-theme rounded-xl px-3 py-2 shadow-sm text-main",children:[e.jsx("span",{className:"text-xs font-bold",children:s==="zh"?"课堂签到":"Check-in"}),i==="done"?e.jsxs("span",{className:"text-xs font-bold text-emerald-600",children:["✓ ",f]}):e.jsxs(e.Fragment,{children:[e.jsx("input",{value:o,onChange:x=>p(x.target.value.replace(/\s/g,"").slice(0,12)),onKeyDown:x=>{x.key==="Enter"&&c()},placeholder:s==="zh"?"输入大屏 4 位签到码":"4-digit code on stage display",inputMode:"numeric","aria-label":s==="zh"?"课堂签到码":"Class check-in code",className:"w-44 px-2 py-1 text-sm font-mono tracking-widest border border-theme rounded-lg bg-transparent"}),e.jsx("button",{type:"button",onClick:()=>void c(),disabled:i==="submitting",className:"px-3 py-1 text-xs font-bold rounded-lg bg-indigo-600 text-white hover:bg-indigo-700 disabled:opacity-50 cursor-pointer",children:i==="submitting"?s==="zh"?"提交中…":"Submitting…":s==="zh"?"签到":"Check in"})]}),i==="error"&&f&&e.jsx("span",{className:"text-xs text-rose-600",children:f})]})}function Ee(r){const{students:s,activeStudentId:d,isStudentLocked:o=!1,lockMode:p,setStudentViewStatus:i,setSelectedLesson:u,lessons:f,selectedLesson:y,lang:c="zh",addToast:x,onOpenIcebreaker:C}=r,h=le($=>$.activeSession),z=s.find($=>$.id===d),m=o||!!z?.locked_lesson_id,N=(p||z?.lock_mode||"full")==="navigation";return e.jsxs("div",{className:"flex items-center justify-between gap-4",children:[m?N?e.jsxs("div",{className:"text-amber-800 font-semibold text-sm flex items-center gap-2 px-3 py-1.5 rounded-lg bg-amber-50 border border-amber-200 shadow-3xs select-none",role:"status",title:c==="zh"?"答题锁定中 · 请完成作答后提交,暂时无法离开本页":"Answer Locked · Complete and submit your work before leaving",children:[e.jsx(Q,{size:15,className:"text-amber-600 shrink-0"}),c==="zh"?"答题锁定中 · 请完成作答后提交,暂时无法离开本页":"Answer Locked · Complete and submit work"]}):e.jsxs("div",{className:"text-indigo-700 font-semibold text-sm flex items-center gap-2 px-3 py-1.5 rounded-lg bg-indigo-50 border border-indigo-200 shadow-3xs select-none",role:"status",title:c==="zh"?"老师已开启全班专注锁定,您暂时无法切换页面":"The teacher locked the class focus. Navigating away is disabled.",children:[e.jsx(Q,{size:15,className:"text-indigo-600 shrink-0"}),c==="zh"?"全班专注锁定 · 跟随教师授课":"Class Focus Locked · Following Teacher"]}):e.jsxs("button",{onClick:()=>{i("dashboard"),u(null),h&&x?.(c==="zh"?"课堂仍在进行":"Class still in progress",c==="zh"?`可随时从看板顶部的「${h.lessonTitle} · 返回课堂」回到课堂。`:"You can return anytime via the banner at the top of your dashboard.","info")},className:"flex items-center gap-2 text-indigo-600 hover:text-indigo-800 transition-colors font-medium text-sm cursor-pointer",children:[e.jsx(de,{className:"rotate-180",size:16})," Back to Dashboard"]}),e.jsxs("div",{className:"flex items-center gap-3",children:[C&&e.jsxs("button",{type:"button","data-testid":"open-icebreaker-btn",onClick:C,className:"inline-flex items-center gap-1.5 px-3 py-1.5 rounded-lg border border-amber-200 dark:border-amber-800/60 bg-amber-50/80 hover:bg-amber-100/80 dark:bg-amber-950/30 dark:hover:bg-amber-950/50 text-amber-900 dark:text-amber-200 text-xs font-semibold shadow-3xs transition-colors cursor-pointer",title:c==="zh"?"课前破冰心情打卡":"Pre-class Icebreaker Check-in",children:[e.jsx("span",{children:"✨"}),e.jsx("span",{children:c==="zh"?"心情打卡":"Mood Check-in"})]}),e.jsx("h2",{className:"text-xl font-bold text-gray-800 dark:text-gray-100",children:f.find($=>$.id===y)?.title})]})]})}function Fe(r){const{students:s,activeStudentId:d,isStudentLocked:o=!1,studentFullscreenPanel:p,setStudentFullscreenPanel:i,timelineSegments:u,lang:f,activeSegmentId:y,localProgressPercent:c,setLocalProgressPercent:x,updateStudentProgress:C,selectedLesson:h,lessons:z,isStudentLessonContentCollapsed:m,addToast:k,segmentAccess:N}=r,$=a=>{if(!a?.id||y===a.id)return;k?.(f==="zh"?"请跟随课堂":"Follow the class",f==="zh"?"请跟随课堂当前环节":"Please follow the current class segment","warning")};return e.jsxs("div",{className:`${m?"hidden":p==="left"?"w-full":"w-1/3 md:block hidden"} border-gray-100 pr-4 overflow-y-auto ${p==="right"?"hidden":""} ${p==="left"?"":"border-r"} transition-all duration-300`,children:[e.jsxs("div",{className:"text-xs font-semibold uppercase tracking-wider text-gray-400 mb-4 flex items-center justify-between pointer-events-auto shrink-0 select-none border-b border-gray-100 pb-2",children:[e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(ce,{size:14,className:"text-indigo-500"})," Lesson Content (课程内容)"]}),e.jsx("button",{onClick:()=>i(a=>a==="left"?"none":"left"),className:"p-1 hover:bg-gray-100 text-subtle hover:text-main rounded transition-colors cursor-pointer flex items-center gap-1",title:p==="left"?"退出全屏":"全屏",children:p==="left"?e.jsxs(e.Fragment,{children:[e.jsx(xe,{size:13}),e.jsx("span",{className:"text-xs font-medium",children:"退出全屏"})]}):e.jsxs(e.Fragment,{children:[e.jsx(me,{size:13}),e.jsx("span",{className:"text-xs font-medium",children:"全屏"})]})})]}),e.jsxs("div",{className:"prose prose-sm prose-indigo max-w-none",children:[!o&&!s.find(a=>a.id===d)?.locked_lesson_id&&u.length>0&&e.jsxs("div",{className:"mb-4 flex flex-col gap-2 p-3 bg-slate-50/70 border border-slate-200/50 rounded-xl shadow-3xs text-left",onClick:a=>a.stopPropagation(),children:[e.jsxs("div",{className:"text-xs font-bold text-gray-500 uppercase tracking-wider flex items-center gap-1.5 mb-1 select-none",children:[e.jsx(se,{size:12,className:"text-indigo-500"}),f==="zh"?"教学环节 (点击切换)":"Timeline Segments"]}),e.jsx("div",{className:"flex flex-wrap gap-1.5",children:u.map((a,S)=>{const L=y===a.id,P=L&&N?.status==="locked";return e.jsxs("button",{onClick:()=>$(a),title:P?N?.reason||"未满足进入条件":void 0,className:`px-2.5 py-1 text-xs font-semibold rounded-lg border transition-all cursor-pointer shadow-3xs flex items-center gap-1.5 ${a.color} ${L?"ring-2 ring-indigo-500 scale-[1.02] shadow-sm border-indigo-400 font-bold":"opacity-85 hover:opacity-100"}`,children:[P&&e.jsx(Q,{size:11,className:"text-amber-600 shrink-0"}),e.jsxs("span",{children:[a.title," (",a.duration,")"]}),e.jsx(B,{slot:"student.segment.badge",slotProps:{segment:a,idx:S,isActive:L,isLocked:!!P,studentId:d,lessonId:h,lang:f}})]},a.id||S)})})]}),e.jsxs("div",{className:"mb-4 bg-slate-50 p-2.5 rounded-xl border border-slate-200/60 shadow-3xs flex flex-col gap-1.5 text-left select-none",children:[e.jsxs("div",{className:"flex justify-between items-center text-xs font-bold text-gray-500",children:[e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(se,{size:12,className:"text-indigo-500 animate-pulse"}),f==="zh"?"自主学习进度(教师确认后计入成绩)":"Learning Progress (graded after teacher verification)"]}),e.jsxs("span",{className:"font-mono text-indigo-600 font-extrabold",children:[c,"%"]})]}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("input",{type:"range",min:"0",max:"100",value:c,onChange:a=>{const S=parseInt(a.target.value);x(S)},onMouseUp:()=>C(c),onTouchEnd:()=>C(c),className:"flex-grow h-1.5 bg-gray-200 rounded-lg appearance-none cursor-pointer accent-indigo-600"}),e.jsx("button",{onClick:()=>{x(100),C(100)},className:`text-xs font-bold rounded-lg px-2 py-1 transition-all ${c===100?"bg-emerald-100 text-emerald-700 border border-emerald-200":"bg-white hover:bg-slate-50 text-slate-650 border border-slate-200 hover:border-indigo-200 shadow-3xs cursor-pointer"}`,children:f==="zh"?"已完成":"Done"})]})]}),e.jsx(Pe,{children:z.find(a=>a.id===h)?.content||""})]})]})}function Re(r){if(!r)return"";const s=r.split("/");return s[s.length-1]||r}function ne(r){const s=Re(r?.file_path);if(s)return s;const d=Array.isArray(r?.files)?r.files:[];return d.length===1?d[0]?.name||"附件":d.length>1?`${d.length} 个附件`:r?.textContent?"文字作答":r?.linkUrl?"链接作答":"已提交(无附件)"}function ae(r,s){return!s?.fileId||!r?.assignment_id?null:`/api/assignments/${r.assignment_id}/files/${s.fileId}`}function Te({lessonId:r,studentId:s,lang:d,addToast:o}){const[p,i]=j.useState(!1),[u,f]=j.useState(!1),[y,c]=j.useState(null),[x,C]=j.useState([]),[h,z]=j.useState(""),[m,k]=j.useState(!1),[N,$]=j.useState({}),[a,S]=j.useState({}),[L,P]=j.useState({}),n=d==="zh",A=async(t=!1)=>{t?f(!0):i(!0);try{const b=await(await fetch(`/api/lessons/${r}/students/${s}/eval-status`)).json();c(b);const _=await(await fetch(`/api/lessons/${r}/eval-submissions`)).json();C(_)}catch(g){console.error("Error fetching eval data:",g),o(n?"数据加载失败":"Failed to Load Data",n?"请检查网络连接或刷新页面。":"Please check your connection and try again.","warning")}finally{i(!1),f(!1)}};j.useEffect(()=>{r&&s&&A()},[r,s]);const D=async t=>{t.preventDefault(),h.trim(),k(!0);try{const b=await(await fetch(`/api/lessons/${r}/eval-submissions`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({studentId:s,filePath:h.trim()||void 0})})).json();if(b.success)o(n?"作业提交成功":"Assignment Submitted",n?`成功提交版本 ${b.version}!`:`Successfully submitted version ${b.version}!`,"success"),A(!0);else throw new Error(b.error||"Failed to submit assignment")}catch(g){o(n?"提交失败":"Submission Failed",g.message,"warning")}finally{k(!1)}},R=async(t,g)=>{const b=N[t],l=a[t]||"";if(b===void 0||isNaN(b)||b<0||b>100){o(n?"评分无效":"Invalid Score",n?"分数必须在 0 到 100 之间!":"Score must be between 0 and 100!","warning");return}P(_=>({..._,[t]:!0}));try{const U=await(await fetch(`/api/lessons/${r}/eval-submissions/${t}/reviews`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({score:Number(b),comment:l})})).json();if(U.success)o(n?"互评提交成功":"Review Submitted",n?"成功对同学的作品完成了评价!":"Successfully completed review for classmate!","success"),S(H=>{const E={...H};return delete E[t],E}),A(!0);else throw new Error(U.error||"Failed to submit review")}catch(_){o(n?"评价提交失败":"Review Failed",_.message,"warning")}finally{P(_=>({..._,[t]:!1}))}};if(p)return e.jsxs("div",{className:"flex-1 flex flex-col items-center justify-center py-12 text-gray-500",children:[e.jsx(G,{className:"animate-spin text-indigo-500 mb-2",size:32}),e.jsx("p",{children:n?"正在读取作业互评状态...":"Loading assignment status..."})]});const v=y?.submission,I=K(v?.linkUrl),w=y?.grade,T=y?.reviewsWritten||[],M=x.filter(t=>t.student_id!==s);return e.jsxs("div",{className:"flex-1 flex flex-col lg:flex-row gap-6 overflow-y-auto pr-2",children:[e.jsxs("div",{className:"w-full lg:w-5/12 flex flex-col gap-6",children:[e.jsxs("div",{className:"bg-slate-50 border border-slate-200/80 rounded-2xl p-5 shadow-3xs text-left",children:[e.jsxs("div",{className:"flex justify-between items-center mb-4",children:[e.jsxs("h3",{className:"text-sm font-bold text-slate-800 flex items-center gap-1.5 select-none",children:[e.jsx(te,{size:16,className:"text-indigo-600"}),n?"我的作业提交":"My Assignment Submission"]}),e.jsx("button",{onClick:()=>A(!0),className:"p-1 hover:bg-slate-200/50 rounded transition-colors text-slate-550",title:n?"刷新数据":"Refresh Data",children:e.jsx(G,{size:14,className:u?"animate-spin":""})})]}),v?e.jsxs("div",{className:"bg-white border border-slate-200 p-4 rounded-xl space-y-3 mb-4",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"bg-emerald-50 text-emerald-600 p-2.5 rounded-lg border border-emerald-100",children:e.jsx(be,{size:20})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("p",{className:"text-xs text-slate-400 font-medium",children:n?"当前已提交版本":"Currently Submitted Version"}),e.jsx("p",{className:"text-sm font-semibold text-slate-700 truncate",children:ne(v)})]}),e.jsxs("span",{className:"bg-indigo-100 text-indigo-700 text-xs font-bold px-2 py-0.5 rounded-full border border-indigo-200",children:["V",v.version]})]}),e.jsxs("div",{className:"border-t border-slate-100 pt-2.5 flex justify-between items-center text-xs text-slate-400",children:[e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(ge,{size:11}),n?"更新时间:":"Updated At:"," ",new Date(v.updated_at).toLocaleString()]}),e.jsx("span",{className:"font-mono text-slate-350 select-all truncate max-w-[120px]",title:v.file_path||void 0,children:v.file_path||"—"})]}),(v.textContent||v.linkUrl||Array.isArray(v.files)&&v.files.length>0)&&e.jsxs("div",{className:"border-t border-slate-100 pt-2.5 space-y-1 text-xs text-slate-600",children:[v.textContent&&e.jsx("p",{className:"whitespace-pre-wrap break-all max-h-20 overflow-hidden",children:v.textContent}),I&&e.jsx("a",{href:I,target:"_blank",rel:"noopener noreferrer",className:"block truncate text-indigo-600 hover:underline",children:v.linkUrl}),Array.isArray(v.files)&&v.files.map((t,g)=>{const b=K(ae(v,t));return b?e.jsx("a",{href:b,target:"_blank",rel:"noopener noreferrer",className:"block truncate text-indigo-600 hover:underline",children:t.name},t.fileId??g):e.jsx("span",{className:"block truncate",children:t.name},t.name??g)})]}),e.jsx(B,{slot:"assignment.submission.preview",slotProps:{submission:v,studentId:s,lessonId:r,isSelf:!0,lang:d}})]}):e.jsxs("div",{className:"bg-amber-50/50 border border-amber-100 p-4 rounded-xl flex items-start gap-3 mb-4 text-left",children:[e.jsx(fe,{className:"text-amber-500 shrink-0 mt-0.5",size:16}),e.jsxs("div",{className:"text-xs text-amber-700",children:[e.jsx("p",{className:"font-bold",children:n?"未提交作业":"No Submission Yet"}),e.jsx("p",{className:"mt-1",children:n?"在此上传提交后,其他同学将可以对您的作业进行评分互评。":"Once submitted, other students can view and peer-review your work."})]})]}),e.jsx("form",{onSubmit:D,className:"space-y-3",children:e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs font-bold text-slate-500 uppercase tracking-wider mb-1",children:n?"输入作品文件路径 / 虚拟路径":"Simulated File Path"}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx("input",{type:"text",value:h,onChange:t=>z(t.target.value),placeholder:"/files/homework.pdf",required:!0,className:"flex-1 bg-white border border-slate-200 px-3 py-2 text-xs rounded-lg text-slate-700 focus:outline-none focus:border-indigo-400 font-mono transition-colors"}),e.jsxs("button",{type:"submit",disabled:m,className:"bg-indigo-600 hover:bg-indigo-700 text-white font-bold text-xs px-4 py-2 rounded-lg transition-colors cursor-pointer disabled:opacity-50 flex items-center gap-1.5 shadow-3xs",children:[m?e.jsx(G,{className:"animate-spin",size:13}):e.jsx(te,{size:13}),v?n?"重新提交":"Re-submit":n?"上传作品":"Submit"]})]})]})})]}),v&&e.jsxs("div",{className:"bg-slate-50 border border-slate-200/80 rounded-2xl p-5 shadow-3xs text-left",children:[e.jsxs("h3",{className:"text-sm font-bold text-slate-800 flex items-center gap-1.5 mb-4 select-none",children:[e.jsx(pe,{size:16,className:"text-pink-650"}),n?"我的平时学习得分":"My Score & Feedback"]}),w?e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"bg-white border border-slate-200 p-4 rounded-xl flex items-center justify-between shadow-3xs",children:[e.jsxs("div",{children:[e.jsx("span",{className:"text-xs text-slate-400 font-bold uppercase tracking-wider",children:n?"学期对接总分":"Weighted Final Grade"}),e.jsxs("h2",{className:"text-3xl font-extrabold text-indigo-700 font-mono mt-1",children:[w.calculated_final_score," ",e.jsx("span",{className:"text-xs text-slate-455 font-normal",children:"/ 100"})]})]}),e.jsxs("div",{className:"text-right",children:[e.jsx("span",{className:`inline-block px-2.5 py-1 text-xs font-bold rounded-lg border ${w.status==="confirmed"?"bg-emerald-50 text-emerald-700 border-emerald-100":"bg-amber-50 text-amber-700 border-amber-100"}`,children:w.status==="confirmed"?n?"已确认同步":"Synced":n?"教师评分草稿":"Draft"}),e.jsx("p",{className:"text-xs text-slate-400 mt-1.5 font-medium",children:n?`教师分 ${w.teacher_score} (占 ${(w.teacher_weight*100).toFixed(0)}%)`:`Teacher ${w.teacher_score} (${(w.teacher_weight*100).toFixed(0)}%)`}),e.jsx("p",{className:"text-xs text-slate-400 mt-0.5 font-medium",children:n?`学生互评 (占 ${(w.peer_weight*100).toFixed(0)}%)`:`Peer Review (${(w.peer_weight*100).toFixed(0)}%)`})]})]}),w.teacher_comment&&e.jsxs("div",{className:"bg-slate-100/60 p-3 rounded-lg border border-slate-200 flex gap-2",children:[e.jsx(je,{size:14,className:"text-slate-400 shrink-0 mt-0.5"}),e.jsxs("div",{children:[e.jsx("p",{className:"text-xs font-bold text-slate-500",children:n?"教师寄语":"Teacher Comments"}),e.jsx("p",{className:"text-xs text-slate-650 mt-0.5",children:w.teacher_comment})]})]})]}):e.jsx("div",{className:"bg-white border border-slate-150 p-4 rounded-xl flex items-center justify-center text-slate-400 italic text-xs py-8",children:n?"教师尚未确认最终成绩与权重折算。":"Teacher grading is in progress."})]})]}),e.jsxs("div",{className:"flex-grow bg-slate-50 border border-slate-200/80 rounded-2xl p-5 shadow-3xs flex flex-col min-h-[400px] text-left",children:[e.jsxs("h3",{className:"text-sm font-bold text-slate-800 flex items-center gap-1.5 mb-4 shrink-0 select-none",children:[e.jsx(ve,{size:16,className:"text-teal-700"}),n?"同学作业互评公开板":"Classmate Submissions for Peer Review"]}),M.length===0?e.jsx("div",{className:"flex-grow flex items-center justify-center text-subtle italic text-xs py-12 border border-dashed border-slate-200 rounded-xl bg-white",children:n?"当前暂无同学提交作业作品。":"No classmate submissions available yet."}):e.jsx("div",{className:"flex-grow overflow-y-auto space-y-4 pr-1",children:M.map(t=>{const g=T.find(F=>F.submission_id===t.id),b=N[t.id]!==void 0?N[t.id]:g?g.score:85,l=a[t.id]!==void 0?a[t.id]:g?g.comment:"",_=L[t.id]||!1,U=Array.isArray(t.files)?t.files:[],H=K(t.file_path||ae(t,U[0])||null),E=H||K(t.linkUrl)||null;return e.jsxs("div",{className:"bg-white border border-slate-200 rounded-xl p-4 shadow-3xs flex flex-col gap-3",children:[e.jsxs("div",{className:"flex justify-between items-start border-b border-slate-100 pb-2",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:"w-8 h-8 rounded-full bg-indigo-50 text-indigo-700 flex items-center justify-center font-bold text-xs select-none",children:t.student_name?t.student_name[0]:"?"}),e.jsxs("div",{children:[e.jsx("h4",{className:"text-xs font-bold text-slate-700",children:t.student_name||t.student_id}),e.jsxs("p",{className:"text-xs text-slate-400 font-mono flex items-center gap-1 mt-0.5 truncate max-w-[200px]",title:t.file_path||void 0,children:[e.jsx(ye,{size:11,className:"text-slate-350"}),ne(t)," (V",t.version,")"]})]})]}),E?e.jsx("a",{href:E,target:"_blank",rel:"noopener noreferrer",className:"text-xs font-bold text-indigo-600 hover:text-indigo-800 transition-colors border border-indigo-100 px-2 py-1 rounded bg-indigo-50/50 hover:bg-indigo-50 shrink-0",children:H?n?"下载查阅":"Download File":n?"打开链接":"Open Link"}):e.jsx("span",{className:"text-xs text-slate-400 px-2 py-1 border border-slate-200 rounded bg-white shrink-0",children:n?"无附件":"No File"})]}),t.textContent&&e.jsx("p",{className:"text-xs text-slate-600 whitespace-pre-wrap break-all max-h-24 overflow-auto bg-slate-50 border border-slate-100 rounded-lg p-2",children:t.textContent}),e.jsx(B,{slot:"assignment.submission.preview",slotProps:{submission:t,studentId:t.student_id,lessonId:r,isSelf:!1,lang:d}}),g&&e.jsxs("div",{className:"bg-emerald-50/50 border border-emerald-100 p-2.5 rounded-lg flex items-start gap-2 text-xs text-emerald-800",children:[e.jsx(ue,{className:"text-emerald-500 shrink-0 mt-0.5",size:14}),e.jsxs("div",{className:"flex-1",children:[e.jsx("p",{className:"font-bold flex items-center gap-1",children:n?`我已评分:${g.score} 分`:`My Score: ${g.score} pts`}),g.comment&&e.jsxs("p",{className:"text-xs text-emerald-700/80 mt-0.5 italic",children:['"',g.comment,'"']})]})]}),e.jsxs("div",{className:"bg-slate-50/60 border border-slate-100 rounded-lg p-3 space-y-3",children:[e.jsxs("div",{className:"flex justify-between items-center",children:[e.jsx("span",{className:"text-xs font-bold text-slate-500 uppercase tracking-wider",children:n?"滑动或输入互评分数":"Peer Rating"}),e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx("input",{type:"number",min:"0",max:"100",value:b,onChange:F=>{const O=Math.min(100,Math.max(0,parseInt(F.target.value)||0));$(V=>({...V,[t.id]:O}))},className:"w-12 text-center text-xs font-bold font-mono border border-slate-200 rounded px-1 py-0.5 bg-white text-indigo-750"}),e.jsx("span",{className:"text-xs text-slate-400 font-bold",children:n?"分":"pts"})]})]}),e.jsx("input",{type:"range",min:"0",max:"100",value:b,onChange:F=>{const O=parseInt(F.target.value);$(V=>({...V,[t.id]:O}))},className:"w-full h-1.5 bg-gray-200 rounded-lg appearance-none cursor-pointer accent-indigo-600"}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx("textarea",{rows:1,value:l,onChange:F=>{S(O=>({...O,[t.id]:F.target.value}))},placeholder:n?"简要评语反馈...":"Brief feedback comment...",className:"flex-1 bg-white border border-slate-200 px-2 py-1 text-xs rounded-lg text-slate-700 focus:outline-none focus:border-indigo-400 resize-none transition-colors"}),e.jsxs("button",{onClick:()=>R(t.id,t.student_id),disabled:_,className:"bg-indigo-600 hover:bg-indigo-700 text-white font-bold text-xs px-3 rounded-lg transition-colors cursor-pointer disabled:opacity-50 flex items-center justify-center",children:[_?e.jsx(G,{className:"animate-spin",size:13}):e.jsx(we,{size:13}),e.jsx("span",{className:"ml-1 shrink-0",children:g?n?"修改评分":"Update":n?"确认提交":"Submit"})]})]})]})]},t.id)})})]})]})}function Me(r){const{isStudentLocked:s=!1,isNavigationLocked:d,isInteractionLocked:o,lockMode:p,studentLessonTab:i,setStudentLessonTab:u,isStudentLessonContentCollapsed:f,setIsStudentLessonContentCollapsed:y,lang:c,studentFullscreenPanel:x,setStudentFullscreenPanel:C,selectedLesson:h,elements:z,activeRole:m,activeSegmentId:k,contentSegmentId:N,blockSegmentContent:$=!1,setActiveSegmentId:a,fetchElements:S,currentVfsParent:L,setCurrentVfsParent:P,vfsNodes:n,studentSelectedCourseware:A,setStudentSelectedCourseware:D,activeStudentId:R,addToast:v}=r,I=d??s,w=o??(p==="navigation"?!1:s),T=(p||(!w&&I?"navigation":"full"))==="navigation",M=l=>{if(I){l!==i&&v(c==="zh"?T?"🔒 答题锁定":"🔒 全班专注锁定":T?"🔒 Answer Locked":"🔒 Class Focus Locked",c==="zh"?T?"答题锁定中,请在当前页面完成作答并提交。":"锁定期间无法切换标签页,请跟随教师当前授课内容。":T?"Answer lock active. Complete your work on this page.":"Switching tabs is disabled while the class is locked.","warning");return}u(l)},t=N||k,g=$,b=l=>`px-3 py-1.5 text-xs font-medium rounded-md transition-colors ${i===l?"bg-primary-theme/10 text-primary-theme shadow-sm font-bold":"text-muted hover:bg-surface-secondary"} ${I&&i!==l?"opacity-50 cursor-not-allowed":"cursor-pointer"}`;return e.jsxs("div",{className:`${f||x==="right"?"w-full flex-grow":"flex-grow flex-1"} relative flex flex-col min-h-0 ${x==="left"?"hidden":""} transition-all duration-300`,children:[e.jsxs("div",{className:"flex items-center justify-between mb-2",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("button",{onClick:()=>y(!f),className:"flex items-center gap-1.5 px-3 py-1.5 text-xs font-bold bg-primary-theme/10 text-primary-theme rounded-lg hover:bg-primary-theme/20 transition-colors border border-primary-theme/20 cursor-pointer shadow-3xs",title:f?"展开课程内容":"折叠课程内容",children:[e.jsx(ce,{size:13,className:"text-primary-theme"}),e.jsx("span",{children:f?c==="zh"?"展开课程内容":"Expand Content":c==="zh"?"折叠课程内容":"Collapse Content"})]}),e.jsxs("button",{onClick:()=>M("whiteboard"),className:b("whiteboard"),title:w&&c==="zh"?"锁定中:白板为只读跟随模式":I&&c==="zh"?"答题锁定中:请在此页面完成作答":void 0,children:["Interactive Whiteboard",w&&i==="whiteboard"&&e.jsxs("span",{className:"ml-1.5 text-xs font-bold text-indigo-500",children:["🔒 ",c==="zh"?"只读":"RO"]}),!w&&I&&i==="whiteboard"&&e.jsxs("span",{className:"ml-1.5 text-xs font-bold text-amber-600",children:["✏️ ",c==="zh"?"答题锁定":"Answering"]})]}),e.jsx("button",{onClick:()=>M("courseware"),className:b("courseware"),children:"Interactive Courseware Viewer"}),e.jsx("button",{onClick:()=>M("assignment"),className:b("assignment"),children:c==="zh"?"作业提交与互评":"Assignments & Peer Reviews"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(B,{slot:"student.lesson.tool",slotProps:{lessonId:h,studentId:R,activeSegmentId:k,lang:c}}),e.jsx("button",{onClick:()=>C(l=>l==="right"?"none":"right"),className:"p-1 hover:bg-gray-100 text-subtle hover:text-main rounded transition-colors cursor-pointer flex items-center gap-1",title:x==="right"?"退出全屏":"全屏",children:x==="right"?e.jsxs(e.Fragment,{children:[e.jsx(xe,{size:13}),e.jsx("span",{className:"text-xs font-medium",children:"退出全屏"})]}):e.jsxs(e.Fragment,{children:[e.jsx(me,{size:13}),e.jsx("span",{className:"text-xs font-medium",children:"全屏"})]})})]})]}),g?e.jsxs("div",{className:"flex-1 flex flex-col items-center justify-center p-6 text-amber-800 bg-amber-50/60 rounded-xl border border-amber-200 gap-3",children:[e.jsxs("div",{className:"text-sm font-semibold flex items-center gap-2",children:[e.jsx("span",{className:"w-2 h-2 rounded-full bg-amber-500 animate-pulse"}),e.jsx("span",{children:c==="zh"?"本教学环节尚未解锁":"This segment is not unlocked yet"})]}),e.jsx("p",{className:"text-xs text-amber-700 dark:text-amber-400 max-w-md text-center",children:c==="zh"?"您尚未满足本教学环节的进入门禁条件,请完成前置任务或等待教师统一推进。":"You have not met the gate conditions for this segment yet. Please complete prerequisites or wait for the teacher."}),e.jsx(B,{slot:"student.segment.gate_fallback",slotProps:{lessonId:h,activeSegmentId:k,studentId:R,contentSegmentId:N,lang:c}})]}):null,!g&&i==="whiteboard"&&e.jsx(_e,{lessonId:h,elements:z,userRole:m,readOnly:w,followRemoteFullscreen:!0,activeSegmentId:t,onSegmentSync:l=>{N!==void 0&&N!==k||a(l)},onElementUpdate:async()=>{},onElementDelete:async l=>{w||h&&(await fetch(`/api/lessons/${h}/whiteboard/${l}`,{method:"DELETE"}),S(h))},onClearBoard:async()=>{w||h&&(await fetch(`/api/lessons/${h}/whiteboard`,{method:"DELETE"}),S(h))},onElementAdd:async()=>{},onRefresh:()=>{h&&S(h)}}),!g&&i==="courseware"&&e.jsxs("div",{className:"flex-1 flex gap-4 min-h-0",children:[e.jsxs("div",{className:"w-48 flex-shrink-0 bg-gray-50 border border-gray-200 rounded-lg p-3 flex flex-col min-h-0",children:[e.jsx("h4",{className:"text-xs font-semibold uppercase tracking-wider text-gray-500 mb-2 border-b border-gray-200 pb-2",children:"Cloud Apps"}),e.jsxs("div",{className:"flex-1 overflow-y-auto space-y-1",children:[L!==null&&e.jsxs("button",{onClick:()=>P(null),className:"flex items-center gap-2 p-1.5 text-xs text-indigo-600 w-full hover:bg-gray-200 rounded mb-1 font-medium",children:[e.jsx(de,{className:"rotate-180",size:14})," Back to Root"]}),n.filter(l=>l.type==="dir").map(l=>e.jsxs("button",{onClick:()=>P(l.id),className:"w-full text-left p-1.5 rounded text-xs text-gray-700 hover:bg-gray-200 flex items-center gap-2 group truncate",title:l.name,children:[e.jsx(ke,{size:14,className:"text-indigo-400 shrink-0 group-hover:text-indigo-600"}),e.jsx("span",{className:"truncate",children:l.name})]},l.id)),n.filter(l=>l.type==="file"&&(l.name.endsWith(".html")||l.name.endsWith(".htm")||l.content?.includes("<html"))).length===0?e.jsx("div",{className:"text-xs text-center text-gray-400 italic py-4",children:"No interactive HTML apps found."}):n.filter(l=>l.type==="file"&&(l.name.endsWith(".html")||l.name.endsWith(".htm")||l.content?.includes("<html"))).map(l=>e.jsxs("button",{onClick:()=>D(l.id),className:`w-full text-left p-2 rounded text-xs flex items-center gap-2 truncate transition-colors ${A===l.id?"bg-indigo-100 text-indigo-700 font-medium":"text-gray-600 hover:bg-gray-100"}`,title:l.name,children:[e.jsx(Ne,{size:14,className:"shrink-0"}),e.jsx("span",{className:"truncate",children:l.name})]},l.id))]}),e.jsx("div",{className:"mt-2 text-xs text-gray-400 leading-tight",children:"Note: Showing HTML courseware from current OS drive directory. Ask agent to generate courseware."})]}),e.jsx("div",{className:"flex-1 relative bg-white min-h-0",children:e.jsx(Ie,{coursewareId:A,onClose:()=>D(null)})})]}),!g&&i==="assignment"&&h&&R&&e.jsx(Te,{lessonId:h,studentId:R,lang:c,addToast:v})]})}function Oe({access:r,lang:s}){if(!r.segmentId)return null;if(r.status==="loading"||r.status==="idle")return e.jsx("div",{className:"rounded-xl border border-slate-200 bg-slate-50 px-3 py-2 text-xs text-slate-600",role:"status",children:s==="zh"?"正在核对进入条件":"Checking entry conditions"});if(r.status!=="locked")return null;const d=r.gates.filter(o=>!o.allowed);return e.jsx("div",{"data-testid":"segment-gate-lock",role:"status",className:"rounded-xl border border-amber-300 bg-amber-50 px-3 py-2.5 text-xs text-amber-900",children:e.jsxs("div",{className:"flex items-start gap-2",children:[e.jsx(Q,{size:14,className:"mt-0.5 shrink-0 text-amber-700"}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("p",{className:"font-bold",children:s==="zh"?"本环节尚未解锁":"This segment is locked"}),e.jsx("p",{className:"mt-0.5 leading-snug",children:r.reason||(s==="zh"?"未满足进入条件":"Conditions not met")}),d.length>0&&e.jsx("ul",{className:"mt-1.5 space-y-0.5",children:d.map(o=>e.jsxs("li",{children:[o.reason||o.type,o.progress?`(${o.progress.current}/${o.progress.target}${o.progress.unit||""})`:""]},`${o.type}-${o.reason||""}`))})]})]})})}const ie={status:"idle",allowed:!0,gates:[],visibleSegmentId:null,segmentId:null};function oe(r,s){return{status:"locked",allowed:!1,reason:s,gates:[],visibleSegmentId:null,segmentId:r}}function Be(r,s){const[d,o]=j.useState(ie),p=j.useCallback(async()=>{if(!r||!s){o(ie);return}o(i=>i.segmentId===s&&(i.status==="open"||i.status==="locked")?i:{...i,status:"loading",segmentId:s});try{const i=await fetch(`/api/lessons/${encodeURIComponent(r)}/segment-access`,{method:"POST",headers:{"Content-Type":"application/json"},credentials:"same-origin",body:JSON.stringify({targetSegmentId:s})}),u=await i.json().catch(()=>null);if(typeof u?.allowed=="boolean"){const f=Array.isArray(u.gates)?u.gates:[];o({status:u.allowed?"open":"locked",allowed:u.allowed,reason:typeof u.reason=="string"?u.reason:void 0,progress:u.progress,gates:f,visibleSegmentId:typeof u.visibleSegmentId=="string"?u.visibleSegmentId:u.allowed?s:null,segmentId:s});return}o(oe(s,i.ok?"进入条件返回了无法识别的结果":`进入条件暂时无法核对(HTTP ${i.status})`))}catch{o(oe(s,"进入条件服务不可达,已暂时锁定"))}},[r,s]);return j.useEffect(()=>{p()},[p]),j.useEffect(()=>{const i=()=>{p()};window.addEventListener("openlearn:segment-gate-changed",i);const u=re.subscribe("QuizSubmitted",i),f=re.subscribe("assignment.submitted",i);return()=>{window.removeEventListener("openlearn:segment-gate-changed",i),u(),f()}},[p]),j.useEffect(()=>{if(d.status!=="locked"||!r||!s)return;const i=window.setInterval(()=>{p()},5e3);return()=>window.clearInterval(i)},[d.status,r,s,p]),d}function De({isOpen:r,onClose:s,classId:d,lessonId:o,studentId:p,lang:i="zh",onCheckinSuccess:u,addToast:f}){const[y,c]=j.useState(null),[x,C]=j.useState(!1),[h,z]=j.useState(null),m=i==="zh";if(j.useEffect(()=>{r&&z(null)},[r]),!r)return null;const k=async a=>{const S=y;if(S){if(!d){z(m?"未检测到当前班级信息,暂时无法打卡":"No class found, unable to check in");return}C(!0),z(null);try{const L=await fetch(`/api/classes/${encodeURIComponent(d)}/checkin/icebreaker`,{method:"POST",headers:{"Content-Type":"application/json"},credentials:"same-origin",body:JSON.stringify({mood:S,lessonId:o||void 0})});if(!L.ok){const n=await L.json().catch(()=>({}));throw new Error(n.error||`HTTP ${L.status}`)}const P=await L.json();try{const n=`icebreaker_checked_${p||"cur"}_${d}_${o||"today"}`;sessionStorage.setItem(n,S)}catch{}f&&f(m?"打卡成功!":"Check-in successful!",m?"老师已收到你的课前心态,祝本节课收获满满~":"Your mood has been shared with teacher.","success"),u&&u(P.stats),s()}catch(L){z(L.message||(m?"打卡失败,请重试":"Check-in failed, please retry"))}finally{C(!1)}}},N=()=>{try{const a=`icebreaker_skipped_${p||"cur"}_${d}_${o||"today"}`;sessionStorage.setItem(a,"1")}catch{}s()},$=[{id:"fullPower",label:m?"充满电":"Full Power",sub:m?"精力充沛,准备好迎接挑战!":"Energetic and ready to learn!",icon:e.jsx(ze,{className:"w-6 h-6 text-amber-500 animate-pulse"}),color:"hover:border-amber-400 hover:bg-amber-50/50 dark:hover:bg-amber-950/20",activeBorder:"border-amber-500 ring-2 ring-amber-400/30",activeBg:"bg-amber-50/80 dark:bg-amber-950/40"},{id:"needCoffee",label:m?"需要咖啡":"Need Coffee",sub:m?"稍显疲倦,需要唤醒状态~":"A bit tired, getting warmed up~",icon:e.jsx(Le,{className:"w-6 h-6 text-amber-700 dark:text-amber-300"}),color:"hover:border-amber-600 hover:bg-amber-50/50 dark:hover:bg-amber-950/20",activeBorder:"border-amber-600 ring-2 ring-amber-600/30",activeBg:"bg-amber-50/80 dark:bg-amber-950/40"},{id:"needHelp",label:m?"需要帮助":"Need Help",sub:m?"有点吃力,希望老师重点关照!":"Need support, please guide me!",icon:e.jsx($e,{className:"w-6 h-6 text-rose-500"}),color:"hover:border-rose-400 hover:bg-rose-50/50 dark:hover:bg-rose-950/20",activeBorder:"border-rose-500 ring-2 ring-rose-400/30",activeBg:"bg-rose-50/80 dark:bg-rose-950/40"}];return e.jsx("div",{"data-testid":"student-icebreaker-modal",className:"fixed inset-0 z-50 flex items-center justify-center p-4 bg-black/50 backdrop-blur-xs animate-in fade-in duration-200",role:"dialog","aria-modal":"true","aria-labelledby":"icebreaker-title",children:e.jsxs("div",{className:"relative w-full max-w-md rounded-2xl bg-white dark:bg-gray-900 border border-gray-200 dark:border-gray-800 shadow-2xl p-6 overflow-hidden",children:[e.jsx("div",{className:"absolute -top-16 -right-16 w-36 h-36 bg-amber-400/10 rounded-full blur-2xl pointer-events-none"}),e.jsx("div",{className:"absolute -bottom-16 -left-16 w-36 h-36 bg-indigo-500/10 rounded-full blur-2xl pointer-events-none"}),e.jsxs("div",{className:"flex items-start justify-between pb-3 border-b border-gray-100 dark:border-gray-800/80",children:[e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-xl",children:"✨"}),e.jsx("h2",{id:"icebreaker-title",className:"text-lg font-bold text-gray-900 dark:text-gray-100",children:m?"课前破冰心情打卡":"Pre-Class Icebreaker"})]}),e.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400 mt-1",children:m?"分享你此刻的心态,帮助老师更好地调整上课节奏":"Share your status so the teacher can tailor the lesson"})]}),e.jsx("button",{type:"button",onClick:N,className:"text-gray-400 hover:text-gray-600 dark:hover:text-gray-200 p-1 rounded-lg transition-colors cursor-pointer","aria-label":m?"跳过":"Skip",children:e.jsx(Se,{size:18})})]}),h&&e.jsxs("div",{className:"mt-3 p-2.5 rounded-lg bg-rose-50 dark:bg-rose-950/40 border border-rose-200 dark:border-rose-900/50 text-rose-700 dark:text-rose-300 text-xs flex items-center gap-2",children:[e.jsx("span",{className:"shrink-0",children:"⚠️"}),e.jsx("span",{children:h})]}),e.jsx("div",{className:"mt-4 space-y-2.5",children:$.map(a=>{const S=y===a.id;return e.jsxs("button",{type:"button","data-testid":`mood-option-${a.id}`,onClick:()=>c(a.id),className:`w-full text-left p-3.5 rounded-xl border transition-all cursor-pointer flex items-center justify-between gap-3 ${S?`${a.activeBorder} ${a.activeBg}`:`border-gray-200 dark:border-gray-800 bg-gray-50/50 dark:bg-gray-800/40 ${a.color}`}`,children:[e.jsxs("div",{className:"flex items-center gap-3 min-w-0",children:[e.jsx("div",{className:"shrink-0 p-2 rounded-lg bg-white dark:bg-gray-800 shadow-2xs border border-gray-100 dark:border-gray-700",children:a.icon}),e.jsxs("div",{className:"min-w-0",children:[e.jsx("div",{className:"text-sm font-semibold text-gray-900 dark:text-gray-100",children:a.label}),e.jsx("div",{className:"text-xs text-gray-500 dark:text-gray-400 truncate mt-0.5",children:a.sub})]})]}),S&&e.jsx(ue,{size:18,className:"shrink-0 text-indigo-600 dark:text-indigo-400"})]},a.id)})}),e.jsxs("div",{className:"mt-6 pt-3 border-t border-gray-100 dark:border-gray-800/80 flex items-center justify-between gap-3",children:[e.jsx("button",{type:"button","data-testid":"icebreaker-skip-btn",onClick:N,className:"text-xs text-gray-500 hover:text-gray-700 dark:hover:text-gray-300 px-3 py-2 rounded-lg transition-colors cursor-pointer",children:m?"稍后再说 / 跳过":"Skip for now"}),e.jsx("button",{type:"button","data-testid":"icebreaker-submit-btn",disabled:!y||x,onClick:()=>k(),className:`inline-flex items-center justify-center gap-1.5 px-5 py-2 rounded-xl text-xs font-bold transition-all shadow-xs cursor-pointer ${!y||x?"bg-gray-200 dark:bg-gray-800 text-gray-400 cursor-not-allowed":"bg-indigo-600 hover:bg-indigo-700 text-white shadow-indigo-500/20"}`,children:x?e.jsxs(e.Fragment,{children:[e.jsx(Ce,{size:14,className:"animate-spin"}),e.jsx("span",{children:m?"提交中...":"Submitting..."})]}):e.jsx("span",{children:m?"确认打卡":"Check In"})})]})]})})}function Xe(r){const{students:s,activeStudentId:d,isStudentLocked:o=!1,isNavigationLocked:p,isInteractionLocked:i,lockMode:u,setStudentViewStatus:f,setSelectedLesson:y,lessons:c,selectedLesson:x,studentFullscreenPanel:C,setStudentFullscreenPanel:h,timelineSegments:z,lang:m,activeSegmentId:k,setActiveSegmentId:N,localProgressPercent:$,setLocalProgressPercent:a,updateStudentProgress:S,isStudentLessonContentCollapsed:L,setIsStudentLessonContentCollapsed:P,studentLessonTab:n,setStudentLessonTab:A,elements:D,activeRole:R,fetchElements:v,currentVfsParent:I,setCurrentVfsParent:w,vfsNodes:T,studentSelectedCourseware:M,setStudentSelectedCourseware:t,addToast:g}=r,b=Be(x,k),_=!!k&&(b.status==="idle"||b.status==="loading")||b.status==="locked"&&!b.visibleSegmentId,U=b.status==="locked"&&b.visibleSegmentId?b.visibleSegmentId:k,[H,E]=j.useState(!1),[F,O]=j.useState(null),V=le(W=>W.activeSession),J=F||(V?.lessonId===x?V.classId:null);return j.useEffect(()=>{if(!(!J||!x))try{const W=`icebreaker_checked_${d||"cur"}_${J}_${x}`,Y=`icebreaker_skipped_${d||"cur"}_${J}_${x}`;!sessionStorage.getItem(W)&&!sessionStorage.getItem(Y)&&E(!0)}catch{}},[J,x,d]),j.useEffect(()=>{if(!x||typeof fetch!="function")return;let W=!1;const Y=async()=>{try{const Z=await fetch(`/api/classroom/sessions/${encodeURIComponent(x)}`,{credentials:"same-origin"});if(!Z.ok||W)return;const ee=await Z.json(),q=ee?.session?.current_segment_id,X=ee?.session?.class_id;X&&typeof X=="string"&&O(X),typeof q=="string"&&q&&q!==k&&N(q)}catch{}};Y();const he=window.setInterval(()=>{Y()},2500);return()=>{W=!0,window.clearInterval(he)}},[x,k,N]),e.jsxs("div",{className:"flex flex-col h-full space-y-4",children:[e.jsx(Ee,{students:s,activeStudentId:d,isStudentLocked:p??o,lockMode:u,setStudentViewStatus:f,setSelectedLesson:y,lessons:c,selectedLesson:x,addToast:g,lang:m,onOpenIcebreaker:()=>E(!0)}),e.jsx(Ae,{lessonId:x,lang:m,addToast:g}),e.jsx(Oe,{access:b,lang:m}),e.jsxs("div",{className:"flex-1 flex gap-6 min-h-0 bg-surface border border-theme rounded-xl p-4 shadow-sm text-main",children:[e.jsx(Fe,{students:s,activeStudentId:d,isStudentLocked:o,studentFullscreenPanel:C,setStudentFullscreenPanel:h,timelineSegments:z,lang:m,activeSegmentId:k,setActiveSegmentId:N,localProgressPercent:$,setLocalProgressPercent:a,updateStudentProgress:S,selectedLesson:x,lessons:c,isStudentLessonContentCollapsed:L,addToast:g,segmentAccess:b}),e.jsx(Me,{isStudentLocked:o,isNavigationLocked:p,isInteractionLocked:i,lockMode:u,studentLessonTab:n,setStudentLessonTab:A,isStudentLessonContentCollapsed:L,setIsStudentLessonContentCollapsed:P,lang:m,studentFullscreenPanel:C,setStudentFullscreenPanel:h,selectedLesson:x,elements:D,activeRole:R,activeSegmentId:k,contentSegmentId:U,blockSegmentContent:_,setActiveSegmentId:N,fetchElements:v,currentVfsParent:I,setCurrentVfsParent:w,vfsNodes:T,studentSelectedCourseware:M,setStudentSelectedCourseware:t,activeStudentId:d,addToast:g})]}),e.jsx(B,{slot:"student.lesson.notes_addon",slotProps:{lessonId:x,studentId:d,activeSegmentId:k,lang:m}}),e.jsx(B,{slot:"student.lesson.toolbox",slotProps:{lessonId:x,studentId:d,lang:m}}),e.jsx(De,{isOpen:H,onClose:()=>E(!1),classId:J,lessonId:x,studentId:d,lang:m,addToast:g})]})}export{Xe as StudentLessonView};
|