openlearn-next 0.3.21 → 0.3.22

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (43) hide show
  1. package/README.md +161 -38
  2. package/dist/assets/{AdminDirectoryView-CGo33RNh.js → AdminDirectoryView-D-AOtp1o.js} +1 -1
  3. package/dist/assets/{BatchPickerModal-CPmu_uF8.js → BatchPickerModal-C9FH3J57.js} +1 -1
  4. package/dist/assets/{ClassesView-TVobZ_Vs.js → ClassesView-DTuyCvYd.js} +1 -1
  5. package/dist/assets/{CloudDriveModal-ul9v6wHK.js → CloudDriveModal-Bi-aMuax.js} +1 -1
  6. package/dist/assets/{ComputerLabView-DGha_J8B.js → ComputerLabView-DWMtMSHV.js} +1 -1
  7. package/dist/assets/{CourseManagement-DFQsUxE1.js → CourseManagement-CeelAyst.js} +1 -1
  8. package/dist/assets/{CourseWizardModal-D92teHMD.js → CourseWizardModal-m7TDgcB2.js} +1 -1
  9. package/dist/assets/{CoursewareHubPanel-CEK_QEc5.js → CoursewareHubPanel-C4LQjt4v.js} +1 -1
  10. package/dist/assets/{Dashboard-CY138ODd.js → Dashboard-CiBtG7Ge.js} +2 -2
  11. package/dist/assets/{ExportWeightModal-BvoODxwp.js → ExportWeightModal-C4d-0uTM.js} +1 -1
  12. package/dist/assets/{HelpTour-Dlc1vvy3.js → HelpTour-00eT17Vg.js} +1 -1
  13. package/dist/assets/{HelpView-CHkXbtfB.js → HelpView-B9Pny6u9.js} +4 -4
  14. package/dist/assets/{ImportLessonsModal-YuTV3mnv.js → ImportLessonsModal-hKRuw9p4.js} +1 -1
  15. package/dist/assets/{ImportModal-B2acbUT8.js → ImportModal-CVXHZ1Ei.js} +1 -1
  16. package/dist/assets/{InteractiveCoursewareViewer-BBeuViik.js → InteractiveCoursewareViewer-DMMAs2k_.js} +1 -1
  17. package/dist/assets/InteractiveWhiteboard-jpweQ094.js +77 -0
  18. package/dist/assets/{LazyCourseware-Du9MgZyH.js → LazyCourseware-DVgyrg3r.js} +2 -2
  19. package/dist/assets/{LazyWhiteboard-CpSzdON0.js → LazyWhiteboard-BSzsAPXC.js} +2 -2
  20. package/dist/assets/{LessonEditorView-D9YYZQyP.js → LessonEditorView-D4g48fr5.js} +1 -1
  21. package/dist/assets/LiveClassroomView-HQGhVwd_.js +1 -0
  22. package/dist/assets/{NotificationDetailModal-BthQNwyd.js → NotificationDetailModal-1MOkBDr_.js} +1 -1
  23. package/dist/assets/{PluginView-CQLEVURc.js → PluginView-D8cQ8mLM.js} +3 -3
  24. package/dist/assets/{ProcessLogsModal-MtK-Pe4R.js → ProcessLogsModal-gZ9LILYM.js} +1 -1
  25. package/dist/assets/{QuizGeneratorModal-Bp4pUx-H.js → QuizGeneratorModal-BFCJe1cm.js} +1 -1
  26. package/dist/assets/{StudentAssignmentView-B-jN_m_B.js → StudentAssignmentView-C34nleZT.js} +1 -1
  27. package/dist/assets/{StudentLessonView-8-zC7BLx.js → StudentLessonView-DNbu2o04.js} +1 -1
  28. package/dist/assets/{StudentPreviewModal-DZdcKy1x.js → StudentPreviewModal-BXbKzQgo.js} +1 -1
  29. package/dist/assets/{StudentView-Cg5G4Guz.js → StudentView-BF2WjF4_.js} +2 -2
  30. package/dist/assets/{SystemResourceLibraryModal-CJ16MGxn.js → SystemResourceLibraryModal-Ce-Dis6M.js} +1 -1
  31. package/dist/assets/TeacherView-BySyCiZG.js +2 -0
  32. package/dist/assets/{TimetableView-Do_LWpV2.js → TimetableView-0VaTfpz3.js} +4 -4
  33. package/dist/assets/index-C7jMgry5.js +216 -0
  34. package/dist/assets/index-huP36ZNf.css +1 -0
  35. package/dist/assets/{vendor-icons-B2DRJfZU.js → vendor-icons-30iiuCQb.js} +1 -1
  36. package/dist/index.html +2 -2
  37. package/dist/server.cjs +2689 -341
  38. package/package.json +21 -22
  39. package/dist/assets/InteractiveWhiteboard-BASy3Ak8.js +0 -78
  40. package/dist/assets/LiveClassroomView-B2lKKiZK.js +0 -1
  41. package/dist/assets/TeacherView-_n9QWf7y.js +0 -2
  42. package/dist/assets/index-BApV4fuy.js +0 -202
  43. package/dist/assets/index-Ch_mD6B0.css +0 -1
@@ -1 +1 @@
1
- import{j as e,r as k}from"./vendor-react-B0t7H3hh.js";import{L as H,a4 as B,B as U,a7 as q,a6 as G,w as O,a5 as M,d as W,av as J,F as Y,C as K,ad as Q,a2 as X,a as Z,O as ee,aw as se,ax as te,aq as ae,s as ne}from"./vendor-icons-B2DRJfZU.js";import{M as re}from"./index-BApV4fuy.js";import{L as ie}from"./LazyWhiteboard-CpSzdON0.js";import{L as le}from"./LazyCourseware-Du9MgZyH.js";import"./vendor-utils-m0Urvtws.js";import"./vendor-pdf-Bw0ZQZtM.js";import"./vendor-motion-DjY2czvL.js";import"./vendor-pptx-C5-U7ieS.js";import"./vendor-charts-U9fLlNC_.js";function oe(f){const{students:r,activeStudentId:l,isStudentLocked:c=!1,setStudentViewStatus:x,setSelectedLesson:w,lessons:i,selectedLesson:o,lang:p="zh"}=f,m=c||!!r.find(h=>h.id===l)?.locked_lesson_id;return e.jsxs("div",{className:"flex items-center justify-between gap-4",children:[m?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:p==="zh"?"老师已开启全班专注锁定,您暂时无法切换页面":"The teacher locked the class focus. Navigating away is disabled.",children:[e.jsx(H,{size:15,className:"text-indigo-600 shrink-0"}),p==="zh"?"全班专注锁定 · 跟随教师授课":"Class Focus Locked · Following Teacher"]}):e.jsxs("button",{onClick:()=>{x("dashboard"),w(null)},className:"flex items-center gap-2 text-indigo-600 hover:text-indigo-800 transition-colors font-medium text-sm cursor-pointer",children:[e.jsx(B,{className:"rotate-180",size:16})," Back to Dashboard"]}),e.jsx("h2",{className:"text-xl font-bold text-gray-800",children:i.find(h=>h.id===o)?.title})]})}function de(f){const{students:r,activeStudentId:l,isStudentLocked:c=!1,studentFullscreenPanel:x,setStudentFullscreenPanel:w,timelineSegments:i,lang:o,activeSegmentId:p,setActiveSegmentId:m,localProgressPercent:h,setLocalProgressPercent:z,updateStudentProgress:j,selectedLesson:L,lessons:N,isStudentLessonContentCollapsed:P}=f;return e.jsxs("div",{className:`${P?"hidden":x==="left"?"w-full":"w-1/3 md:block hidden"} border-gray-100 pr-4 overflow-y-auto ${x==="right"?"hidden":""} ${x==="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(U,{size:14,className:"text-indigo-500"})," Lesson Content (课程内容)"]}),e.jsx("button",{onClick:()=>w(n=>n==="left"?"none":"left"),className:"p-1 hover:bg-gray-100 text-gray-400 hover:text-gray-700 rounded transition-colors cursor-pointer flex items-center gap-1",title:x==="left"?"退出全屏":"全屏",children:x==="left"?e.jsxs(e.Fragment,{children:[e.jsx(q,{size:13}),e.jsx("span",{className:"text-xs font-medium",children:"退出全屏"})]}):e.jsxs(e.Fragment,{children:[e.jsx(G,{size:13}),e.jsx("span",{className:"text-xs font-medium",children:"全屏"})]})})]}),e.jsxs("div",{className:"prose prose-sm prose-indigo max-w-none",children:[!c&&!r.find(n=>n.id===l)?.locked_lesson_id&&i.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:n=>n.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(O,{size:12,className:"text-indigo-500"}),o==="zh"?"教学环节 (点击切换)":"Timeline Segments"]}),e.jsx("div",{className:"flex flex-wrap gap-1.5",children:i.map((n,b)=>e.jsxs("button",{onClick:()=>m(n.id),className:`px-2.5 py-1 text-xs font-semibold rounded-lg border transition-all cursor-pointer shadow-3xs ${n.color} ${p===n.id?"ring-2 ring-indigo-500 scale-[1.02] shadow-sm border-indigo-400 font-bold":"opacity-85 hover:opacity-100"}`,children:[n.title," (",n.duration,")"]},n.id||b))})]}),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(O,{size:12,className:"text-indigo-500 animate-pulse"}),o==="zh"?"自主学习进度反馈":"Learning Progress"]}),e.jsxs("span",{className:"font-mono text-indigo-600 font-extrabold",children:[h,"%"]})]}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("input",{type:"range",min:"0",max:"100",value:h,onChange:n=>{const b=parseInt(n.target.value);z(b)},onMouseUp:()=>j(h),onTouchEnd:()=>j(h),className:"flex-grow h-1.5 bg-gray-200 rounded-lg appearance-none cursor-pointer accent-indigo-600"}),e.jsx("button",{onClick:()=>{z(100),j(100)},className:`text-xs font-bold rounded-lg px-2 py-1 transition-all ${h===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:o==="zh"?"已完成":"Done"})]})]}),e.jsx(re,{children:N.find(n=>n.id===L)?.content||""})]})]})}function ce({lessonId:f,studentId:r,lang:l,addToast:c}){const[x,w]=k.useState(!1),[i,o]=k.useState(!1),[p,m]=k.useState(null),[h,z]=k.useState([]),[j,L]=k.useState("/files/my-homework.pdf"),[N,P]=k.useState(!1),[n,b]=k.useState({}),[F,R]=k.useState({}),[T,_]=k.useState({}),s=l==="zh",y=async(a=!1)=>{a?o(!0):w(!0);try{const u=await(await fetch(`/api/lessons/${f}/students/${r}/eval-status`)).json();m(u);const v=await(await fetch(`/api/lessons/${f}/eval-submissions`)).json();z(v)}catch(d){console.error("Error fetching eval data:",d),c(s?"数据加载失败":"Failed to Load Data",s?"请检查网络连接或刷新页面。":"Please check your connection and try again.","warning")}finally{w(!1),o(!1)}};k.useEffect(()=>{f&&r&&y()},[f,r]);const t=async a=>{if(a.preventDefault(),!!j.trim()){P(!0);try{const u=await(await fetch("/api/commands",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({commandType:"assignment.submit",payload:{lessonId:f,studentId:r,filePath:j.trim()}})})).json();if(u.success)c(s?"作业提交成功":"Assignment Submitted",s?`成功提交版本 ${u.result.version}!`:`Successfully submitted version ${u.result.version}!`,"success"),y(!0);else throw new Error(u.error||"Failed to submit assignment")}catch(d){c(s?"提交失败":"Submission Failed",d.message,"warning")}finally{P(!1)}}},I=async(a,d)=>{const u=n[a],D=F[a]||"";if(u===void 0||isNaN(u)||u<0||u>100){c(s?"评分无效":"Invalid Score",s?"分数必须在 0 到 100 之间!":"Score must be between 0 and 100!","warning");return}_(v=>({...v,[a]:!0}));try{const C=await(await fetch("/api/commands",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({commandType:"assignment.peer_review",payload:{submissionId:a,reviewerId:r,score:Number(u),comment:D}})})).json();if(C.success)c(s?"互评提交成功":"Review Submitted",s?"成功对同学的作品完成了评价!":"Successfully completed review for classmate!","success"),R($=>{const E={...$};return delete E[a],E}),y(!0);else throw new Error(C.error||"Failed to submit review")}catch(v){c(s?"评价提交失败":"Review Failed",v.message,"warning")}finally{_(v=>({...v,[a]:!1}))}};if(x)return e.jsxs("div",{className:"flex-1 flex flex-col items-center justify-center py-12 text-gray-500",children:[e.jsx(M,{className:"animate-spin text-indigo-500 mb-2",size:32}),e.jsx("p",{children:s?"正在读取作业互评状态...":"Loading assignment status..."})]});const S=p?.submission,g=p?.grade,V=p?.reviewsWritten||[],A=h.filter(a=>a.student_id!==r);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(W,{size:16,className:"text-indigo-650"}),s?"我的作业提交":"My Assignment Submission"]}),e.jsx("button",{onClick:()=>y(!0),className:"p-1 hover:bg-slate-200/50 rounded transition-colors text-slate-550",title:s?"刷新数据":"Refresh Data",children:e.jsx(M,{size:14,className:i?"animate-spin":""})})]}),S?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(J,{size:20})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("p",{className:"text-xs text-slate-400 font-medium",children:s?"当前已提交版本":"Currently Submitted Version"}),e.jsx("p",{className:"text-sm font-semibold text-slate-700 truncate",children:S.file_path.split("/").pop()})]}),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",S.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(Y,{size:11}),s?"更新时间:":"Updated At:"," ",new Date(S.updated_at).toLocaleString()]}),e.jsx("span",{className:"font-mono text-slate-350 select-all truncate max-w-[120px]",title:S.file_path,children:S.file_path})]})]}):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(K,{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:s?"未提交作业":"No Submission Yet"}),e.jsx("p",{className:"mt-1",children:s?"在此上传提交后,其他同学将可以对您的作业进行评分互评。":"Once submitted, other students can view and peer-review your work."})]})]}),e.jsx("form",{onSubmit:t,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:s?"输入作品文件路径 / 虚拟路径":"Simulated File Path"}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx("input",{type:"text",value:j,onChange:a=>L(a.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:N,className:"bg-indigo-650 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:[N?e.jsx(M,{className:"animate-spin",size:13}):e.jsx(W,{size:13}),S?s?"重新提交":"Re-submit":s?"上传作品":"Submit"]})]})]})})]}),S&&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(Q,{size:16,className:"text-pink-650"}),s?"我的平时学习得分":"My Score & Feedback"]}),g?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:s?"学期对接总分":"Weighted Final Grade"}),e.jsxs("h2",{className:"text-3xl font-extrabold text-indigo-700 font-mono mt-1",children:[g.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 ${g.status==="confirmed"?"bg-emerald-50 text-emerald-700 border-emerald-100":"bg-amber-50 text-amber-700 border-amber-100"}`,children:g.status==="confirmed"?s?"已确认同步":"Synced":s?"教师评分草稿":"Draft"}),e.jsx("p",{className:"text-xs text-slate-400 mt-1.5 font-medium",children:s?`教师分 ${g.teacher_score} (占 ${(g.teacher_weight*100).toFixed(0)}%)`:`Teacher ${g.teacher_score} (${(g.teacher_weight*100).toFixed(0)}%)`}),e.jsx("p",{className:"text-xs text-slate-400 mt-0.5 font-medium",children:s?`学生互评 (占 ${(g.peer_weight*100).toFixed(0)}%)`:`Peer Review (${(g.peer_weight*100).toFixed(0)}%)`})]})]}),g.teacher_comment&&e.jsxs("div",{className:"bg-slate-100/60 p-3 rounded-lg border border-slate-200 flex gap-2",children:[e.jsx(X,{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:s?"教师寄语":"Teacher Comments"}),e.jsx("p",{className:"text-xs text-slate-650 mt-0.5",children:g.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:s?"教师尚未确认最终成绩与权重折算。":"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(Z,{size:16,className:"text-teal-650"}),s?"同学作业互评公开板":"Classmate Submissions for Peer Review"]}),A.length===0?e.jsx("div",{className:"flex-grow flex items-center justify-center text-slate-400 italic text-xs py-12 border border-dashed border-slate-200 rounded-xl bg-white",children:s?"当前暂无同学提交作业作品。":"No classmate submissions available yet."}):e.jsx("div",{className:"flex-grow overflow-y-auto space-y-4 pr-1",children:A.map(a=>{const d=V.find(C=>C.submission_id===a.id),u=n[a.id]!==void 0?n[a.id]:d?d.score:85,D=F[a.id]!==void 0?F[a.id]:d?d.comment:"",v=T[a.id]||!1;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:a.student_name?a.student_name[0]:"?"}),e.jsxs("div",{children:[e.jsx("h4",{className:"text-xs font-bold text-slate-700",children:a.student_name||a.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:a.file_path,children:[e.jsx(ee,{size:11,className:"text-slate-350"}),a.file_path.split("/").pop()," (V",a.version,")"]})]})]}),e.jsx("a",{href:a.file_path,target:"_blank",rel:"noopener noreferrer",className:"text-xs font-bold text-indigo-650 hover:text-indigo-800 transition-colors border border-indigo-100 px-2 py-1 rounded bg-indigo-50/50 hover:bg-indigo-50",children:s?"下载查阅":"Download File"})]}),d&&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(se,{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:s?`我已评分:${d.score} 分`:`My Score: ${d.score} pts`}),d.comment&&e.jsxs("p",{className:"text-xs text-emerald-700/80 mt-0.5 italic",children:['"',d.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:s?"滑动或输入互评分数":"Peer Rating"}),e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx("input",{type:"number",min:"0",max:"100",value:u,onChange:C=>{const $=Math.min(100,Math.max(0,parseInt(C.target.value)||0));b(E=>({...E,[a.id]:$}))},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:s?"分":"pts"})]})]}),e.jsx("input",{type:"range",min:"0",max:"100",value:u,onChange:C=>{const $=parseInt(C.target.value);b(E=>({...E,[a.id]:$}))},className:"w-full h-1.5 bg-gray-200 rounded-lg appearance-none cursor-pointer accent-indigo-650"}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx("textarea",{rows:1,value:D,onChange:C=>{R($=>({...$,[a.id]:C.target.value}))},placeholder:s?"简要评语反馈...":"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:()=>I(a.id,a.student_id),disabled:v,className:"bg-indigo-650 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:[v?e.jsx(M,{className:"animate-spin",size:13}):e.jsx(te,{size:13}),e.jsx("span",{className:"ml-1 shrink-0",children:d?s?"修改评分":"Update":s?"确认提交":"Submit"})]})]})]})]},a.id)})})]})]})}function xe(f){const{isStudentLocked:r=!1,studentLessonTab:l,setStudentLessonTab:c,isStudentLessonContentCollapsed:x,setIsStudentLessonContentCollapsed:w,lang:i,studentFullscreenPanel:o,setStudentFullscreenPanel:p,selectedLesson:m,elements:h,activeRole:z,activeSegmentId:j,setActiveSegmentId:L,fetchElements:N,currentVfsParent:P,setCurrentVfsParent:n,vfsNodes:b,studentSelectedCourseware:F,setStudentSelectedCourseware:R,activeStudentId:T,addToast:_}=f,s=t=>{if(r){t!==l&&_(i==="zh"?"🔒 全班专注锁定":"🔒 Class Focus Locked",i==="zh"?"锁定期间无法切换标签页,请跟随教师当前授课内容。":"Switching tabs is disabled while the class is locked.","warning");return}c(t)},y=t=>`px-3 py-1.5 text-xs font-medium rounded-md transition-colors ${l===t?"bg-primary-theme/10 text-primary-theme shadow-sm font-bold":"text-muted hover:bg-surface-secondary"} ${r&&l!==t?"opacity-50 cursor-not-allowed":"cursor-pointer"}`;return e.jsxs("div",{className:`${x||o==="right"?"w-full flex-grow":"flex-grow flex-1"} relative flex flex-col min-h-0 ${o==="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:()=>w(!x),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:x?"展开课程内容":"折叠课程内容",children:[e.jsx(U,{size:13,className:"text-primary-theme"}),e.jsx("span",{children:x?i==="zh"?"展开课程内容":"Expand Content":i==="zh"?"折叠课程内容":"Collapse Content"})]}),e.jsxs("button",{onClick:()=>s("whiteboard"),className:y("whiteboard"),title:r&&i==="zh"?"锁定中:白板为只读跟随模式":void 0,children:["Interactive Whiteboard",r&&l==="whiteboard"&&e.jsxs("span",{className:"ml-1.5 text-xs font-bold text-indigo-500",children:["🔒 ",i==="zh"?"只读":"RO"]})]}),e.jsx("button",{onClick:()=>s("courseware"),className:y("courseware"),children:"Interactive Courseware Viewer"}),e.jsx("button",{onClick:()=>s("assignment"),className:y("assignment"),children:i==="zh"?"作业提交与互评":"Assignments & Peer Reviews"})]}),e.jsx("button",{onClick:()=>p(t=>t==="right"?"none":"right"),className:"p-1 hover:bg-gray-100 text-gray-400 hover:text-gray-700 rounded transition-colors cursor-pointer flex items-center gap-1",title:o==="right"?"退出全屏":"全屏",children:o==="right"?e.jsxs(e.Fragment,{children:[e.jsx(q,{size:13}),e.jsx("span",{className:"text-xs font-medium",children:"退出全屏"})]}):e.jsxs(e.Fragment,{children:[e.jsx(G,{size:13}),e.jsx("span",{className:"text-xs font-medium",children:"全屏"})]})})]}),l==="whiteboard"&&e.jsx(ie,{lessonId:m,elements:h,userRole:z,readOnly:r,followRemoteFullscreen:!0,activeSegmentId:j,onSegmentSync:t=>L(t),onElementUpdate:async()=>{},onElementDelete:async t=>{r||(await fetch(`/api/lessons/${m}/whiteboard/${t}`,{method:"DELETE"}),N(m))},onClearBoard:async()=>{r||(await fetch(`/api/lessons/${m}/whiteboard`,{method:"DELETE"}),N(m))},onElementAdd:async()=>{},onRefresh:()=>N(m)}),l==="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:[P!==null&&e.jsxs("button",{onClick:()=>n(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(B,{className:"rotate-180",size:14})," Back to Root"]}),b.filter(t=>t.type==="dir").map(t=>e.jsxs("button",{onClick:()=>n(t.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:t.name,children:[e.jsx(ae,{size:14,className:"text-indigo-400 shrink-0 group-hover:text-indigo-600"}),e.jsx("span",{className:"truncate",children:t.name})]},t.id)),b.filter(t=>t.type==="file"&&(t.name.endsWith(".html")||t.name.endsWith(".htm")||t.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."}):b.filter(t=>t.type==="file"&&(t.name.endsWith(".html")||t.name.endsWith(".htm")||t.content?.includes("<html"))).map(t=>e.jsxs("button",{onClick:()=>R(t.id),className:`w-full text-left p-2 rounded text-xs flex items-center gap-2 truncate transition-colors ${F===t.id?"bg-indigo-100 text-indigo-700 font-medium":"text-gray-600 hover:bg-gray-100"}`,title:t.name,children:[e.jsx(ne,{size:14,className:"shrink-0"}),e.jsx("span",{className:"truncate",children:t.name})]},t.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(le,{coursewareId:F,onClose:()=>R(null)})})]}),l==="assignment"&&e.jsx(ce,{lessonId:m,studentId:T,lang:i,addToast:_})]})}function Ne(f){const{students:r,activeStudentId:l,isStudentLocked:c=!1,setStudentViewStatus:x,setSelectedLesson:w,lessons:i,selectedLesson:o,studentFullscreenPanel:p,setStudentFullscreenPanel:m,timelineSegments:h,lang:z,activeSegmentId:j,setActiveSegmentId:L,localProgressPercent:N,setLocalProgressPercent:P,updateStudentProgress:n,isStudentLessonContentCollapsed:b,setIsStudentLessonContentCollapsed:F,studentLessonTab:R,setStudentLessonTab:T,elements:_,activeRole:s,fetchElements:y,currentVfsParent:t,setCurrentVfsParent:I,vfsNodes:S,studentSelectedCourseware:g,setStudentSelectedCourseware:V,addToast:A}=f;return e.jsxs("div",{className:"flex flex-col h-full space-y-4",children:[e.jsx(oe,{students:r,activeStudentId:l,isStudentLocked:c,setStudentViewStatus:x,setSelectedLesson:w,lessons:i,selectedLesson:o}),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(de,{students:r,activeStudentId:l,isStudentLocked:c,studentFullscreenPanel:p,setStudentFullscreenPanel:m,timelineSegments:h,lang:z,activeSegmentId:j,setActiveSegmentId:L,localProgressPercent:N,setLocalProgressPercent:P,updateStudentProgress:n,selectedLesson:o,lessons:i,isStudentLessonContentCollapsed:b}),e.jsx(xe,{isStudentLocked:c,studentLessonTab:R,setStudentLessonTab:T,isStudentLessonContentCollapsed:b,setIsStudentLessonContentCollapsed:F,lang:z,studentFullscreenPanel:p,setStudentFullscreenPanel:m,selectedLesson:o,elements:_,activeRole:s,activeSegmentId:j,setActiveSegmentId:L,fetchElements:y,currentVfsParent:t,setCurrentVfsParent:I,vfsNodes:S,studentSelectedCourseware:g,setStudentSelectedCourseware:V,activeStudentId:l,addToast:A})]})]})}export{Ne as StudentLessonView};
1
+ import{j as e,r as k}from"./vendor-react-B0t7H3hh.js";import{L as q,a5 as B,B as U,a8 as G,a7 as H,w as O,a6 as M,d as W,aw as J,F as Y,C as K,ae as Q,a2 as X,a as Z,O as ee,ax as se,ay as te,ar as ae,s as ne}from"./vendor-icons-30iiuCQb.js";import{M as re}from"./index-C7jMgry5.js";import{L as ie}from"./LazyWhiteboard-BSzsAPXC.js";import{L as le}from"./LazyCourseware-DVgyrg3r.js";import"./vendor-utils-m0Urvtws.js";import"./vendor-pdf-Bw0ZQZtM.js";import"./vendor-motion-DjY2czvL.js";import"./vendor-pptx-C5-U7ieS.js";import"./vendor-charts-U9fLlNC_.js";function oe(f){const{students:r,activeStudentId:l,isStudentLocked:c=!1,setStudentViewStatus:x,setSelectedLesson:w,lessons:i,selectedLesson:o,lang:p="zh"}=f,m=c||!!r.find(h=>h.id===l)?.locked_lesson_id;return e.jsxs("div",{className:"flex items-center justify-between gap-4",children:[m?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:p==="zh"?"老师已开启全班专注锁定,您暂时无法切换页面":"The teacher locked the class focus. Navigating away is disabled.",children:[e.jsx(q,{size:15,className:"text-indigo-600 shrink-0"}),p==="zh"?"全班专注锁定 · 跟随教师授课":"Class Focus Locked · Following Teacher"]}):e.jsxs("button",{onClick:()=>{x("dashboard"),w(null)},className:"flex items-center gap-2 text-indigo-600 hover:text-indigo-800 transition-colors font-medium text-sm cursor-pointer",children:[e.jsx(B,{className:"rotate-180",size:16})," Back to Dashboard"]}),e.jsx("h2",{className:"text-xl font-bold text-gray-800",children:i.find(h=>h.id===o)?.title})]})}function de(f){const{students:r,activeStudentId:l,isStudentLocked:c=!1,studentFullscreenPanel:x,setStudentFullscreenPanel:w,timelineSegments:i,lang:o,activeSegmentId:p,setActiveSegmentId:m,localProgressPercent:h,setLocalProgressPercent:z,updateStudentProgress:j,selectedLesson:L,lessons:N,isStudentLessonContentCollapsed:P}=f;return e.jsxs("div",{className:`${P?"hidden":x==="left"?"w-full":"w-1/3 md:block hidden"} border-gray-100 pr-4 overflow-y-auto ${x==="right"?"hidden":""} ${x==="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(U,{size:14,className:"text-indigo-500"})," Lesson Content (课程内容)"]}),e.jsx("button",{onClick:()=>w(n=>n==="left"?"none":"left"),className:"p-1 hover:bg-gray-100 text-gray-400 hover:text-gray-700 rounded transition-colors cursor-pointer flex items-center gap-1",title:x==="left"?"退出全屏":"全屏",children:x==="left"?e.jsxs(e.Fragment,{children:[e.jsx(G,{size:13}),e.jsx("span",{className:"text-xs font-medium",children:"退出全屏"})]}):e.jsxs(e.Fragment,{children:[e.jsx(H,{size:13}),e.jsx("span",{className:"text-xs font-medium",children:"全屏"})]})})]}),e.jsxs("div",{className:"prose prose-sm prose-indigo max-w-none",children:[!c&&!r.find(n=>n.id===l)?.locked_lesson_id&&i.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:n=>n.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(O,{size:12,className:"text-indigo-500"}),o==="zh"?"教学环节 (点击切换)":"Timeline Segments"]}),e.jsx("div",{className:"flex flex-wrap gap-1.5",children:i.map((n,b)=>e.jsxs("button",{onClick:()=>m(n.id),className:`px-2.5 py-1 text-xs font-semibold rounded-lg border transition-all cursor-pointer shadow-3xs ${n.color} ${p===n.id?"ring-2 ring-indigo-500 scale-[1.02] shadow-sm border-indigo-400 font-bold":"opacity-85 hover:opacity-100"}`,children:[n.title," (",n.duration,")"]},n.id||b))})]}),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(O,{size:12,className:"text-indigo-500 animate-pulse"}),o==="zh"?"自主学习进度反馈":"Learning Progress"]}),e.jsxs("span",{className:"font-mono text-indigo-600 font-extrabold",children:[h,"%"]})]}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("input",{type:"range",min:"0",max:"100",value:h,onChange:n=>{const b=parseInt(n.target.value);z(b)},onMouseUp:()=>j(h),onTouchEnd:()=>j(h),className:"flex-grow h-1.5 bg-gray-200 rounded-lg appearance-none cursor-pointer accent-indigo-600"}),e.jsx("button",{onClick:()=>{z(100),j(100)},className:`text-xs font-bold rounded-lg px-2 py-1 transition-all ${h===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:o==="zh"?"已完成":"Done"})]})]}),e.jsx(re,{children:N.find(n=>n.id===L)?.content||""})]})]})}function ce({lessonId:f,studentId:r,lang:l,addToast:c}){const[x,w]=k.useState(!1),[i,o]=k.useState(!1),[p,m]=k.useState(null),[h,z]=k.useState([]),[j,L]=k.useState("/files/my-homework.pdf"),[N,P]=k.useState(!1),[n,b]=k.useState({}),[F,R]=k.useState({}),[T,_]=k.useState({}),s=l==="zh",y=async(a=!1)=>{a?o(!0):w(!0);try{const u=await(await fetch(`/api/lessons/${f}/students/${r}/eval-status`)).json();m(u);const v=await(await fetch(`/api/lessons/${f}/eval-submissions`)).json();z(v)}catch(d){console.error("Error fetching eval data:",d),c(s?"数据加载失败":"Failed to Load Data",s?"请检查网络连接或刷新页面。":"Please check your connection and try again.","warning")}finally{w(!1),o(!1)}};k.useEffect(()=>{f&&r&&y()},[f,r]);const t=async a=>{if(a.preventDefault(),!!j.trim()){P(!0);try{const u=await(await fetch("/api/commands",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({commandType:"assignment.submit",payload:{lessonId:f,studentId:r,filePath:j.trim()}})})).json();if(u.success)c(s?"作业提交成功":"Assignment Submitted",s?`成功提交版本 ${u.result.version}!`:`Successfully submitted version ${u.result.version}!`,"success"),y(!0);else throw new Error(u.error||"Failed to submit assignment")}catch(d){c(s?"提交失败":"Submission Failed",d.message,"warning")}finally{P(!1)}}},I=async(a,d)=>{const u=n[a],D=F[a]||"";if(u===void 0||isNaN(u)||u<0||u>100){c(s?"评分无效":"Invalid Score",s?"分数必须在 0 到 100 之间!":"Score must be between 0 and 100!","warning");return}_(v=>({...v,[a]:!0}));try{const C=await(await fetch("/api/commands",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({commandType:"assignment.peer_review",payload:{submissionId:a,reviewerId:r,score:Number(u),comment:D}})})).json();if(C.success)c(s?"互评提交成功":"Review Submitted",s?"成功对同学的作品完成了评价!":"Successfully completed review for classmate!","success"),R($=>{const E={...$};return delete E[a],E}),y(!0);else throw new Error(C.error||"Failed to submit review")}catch(v){c(s?"评价提交失败":"Review Failed",v.message,"warning")}finally{_(v=>({...v,[a]:!1}))}};if(x)return e.jsxs("div",{className:"flex-1 flex flex-col items-center justify-center py-12 text-gray-500",children:[e.jsx(M,{className:"animate-spin text-indigo-500 mb-2",size:32}),e.jsx("p",{children:s?"正在读取作业互评状态...":"Loading assignment status..."})]});const S=p?.submission,g=p?.grade,V=p?.reviewsWritten||[],A=h.filter(a=>a.student_id!==r);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(W,{size:16,className:"text-indigo-650"}),s?"我的作业提交":"My Assignment Submission"]}),e.jsx("button",{onClick:()=>y(!0),className:"p-1 hover:bg-slate-200/50 rounded transition-colors text-slate-550",title:s?"刷新数据":"Refresh Data",children:e.jsx(M,{size:14,className:i?"animate-spin":""})})]}),S?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(J,{size:20})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("p",{className:"text-xs text-slate-400 font-medium",children:s?"当前已提交版本":"Currently Submitted Version"}),e.jsx("p",{className:"text-sm font-semibold text-slate-700 truncate",children:S.file_path.split("/").pop()})]}),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",S.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(Y,{size:11}),s?"更新时间:":"Updated At:"," ",new Date(S.updated_at).toLocaleString()]}),e.jsx("span",{className:"font-mono text-slate-350 select-all truncate max-w-[120px]",title:S.file_path,children:S.file_path})]})]}):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(K,{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:s?"未提交作业":"No Submission Yet"}),e.jsx("p",{className:"mt-1",children:s?"在此上传提交后,其他同学将可以对您的作业进行评分互评。":"Once submitted, other students can view and peer-review your work."})]})]}),e.jsx("form",{onSubmit:t,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:s?"输入作品文件路径 / 虚拟路径":"Simulated File Path"}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx("input",{type:"text",value:j,onChange:a=>L(a.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:N,className:"bg-indigo-650 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:[N?e.jsx(M,{className:"animate-spin",size:13}):e.jsx(W,{size:13}),S?s?"重新提交":"Re-submit":s?"上传作品":"Submit"]})]})]})})]}),S&&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(Q,{size:16,className:"text-pink-650"}),s?"我的平时学习得分":"My Score & Feedback"]}),g?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:s?"学期对接总分":"Weighted Final Grade"}),e.jsxs("h2",{className:"text-3xl font-extrabold text-indigo-700 font-mono mt-1",children:[g.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 ${g.status==="confirmed"?"bg-emerald-50 text-emerald-700 border-emerald-100":"bg-amber-50 text-amber-700 border-amber-100"}`,children:g.status==="confirmed"?s?"已确认同步":"Synced":s?"教师评分草稿":"Draft"}),e.jsx("p",{className:"text-xs text-slate-400 mt-1.5 font-medium",children:s?`教师分 ${g.teacher_score} (占 ${(g.teacher_weight*100).toFixed(0)}%)`:`Teacher ${g.teacher_score} (${(g.teacher_weight*100).toFixed(0)}%)`}),e.jsx("p",{className:"text-xs text-slate-400 mt-0.5 font-medium",children:s?`学生互评 (占 ${(g.peer_weight*100).toFixed(0)}%)`:`Peer Review (${(g.peer_weight*100).toFixed(0)}%)`})]})]}),g.teacher_comment&&e.jsxs("div",{className:"bg-slate-100/60 p-3 rounded-lg border border-slate-200 flex gap-2",children:[e.jsx(X,{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:s?"教师寄语":"Teacher Comments"}),e.jsx("p",{className:"text-xs text-slate-650 mt-0.5",children:g.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:s?"教师尚未确认最终成绩与权重折算。":"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(Z,{size:16,className:"text-teal-650"}),s?"同学作业互评公开板":"Classmate Submissions for Peer Review"]}),A.length===0?e.jsx("div",{className:"flex-grow flex items-center justify-center text-slate-400 italic text-xs py-12 border border-dashed border-slate-200 rounded-xl bg-white",children:s?"当前暂无同学提交作业作品。":"No classmate submissions available yet."}):e.jsx("div",{className:"flex-grow overflow-y-auto space-y-4 pr-1",children:A.map(a=>{const d=V.find(C=>C.submission_id===a.id),u=n[a.id]!==void 0?n[a.id]:d?d.score:85,D=F[a.id]!==void 0?F[a.id]:d?d.comment:"",v=T[a.id]||!1;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:a.student_name?a.student_name[0]:"?"}),e.jsxs("div",{children:[e.jsx("h4",{className:"text-xs font-bold text-slate-700",children:a.student_name||a.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:a.file_path,children:[e.jsx(ee,{size:11,className:"text-slate-350"}),a.file_path.split("/").pop()," (V",a.version,")"]})]})]}),e.jsx("a",{href:a.file_path,target:"_blank",rel:"noopener noreferrer",className:"text-xs font-bold text-indigo-650 hover:text-indigo-800 transition-colors border border-indigo-100 px-2 py-1 rounded bg-indigo-50/50 hover:bg-indigo-50",children:s?"下载查阅":"Download File"})]}),d&&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(se,{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:s?`我已评分:${d.score} 分`:`My Score: ${d.score} pts`}),d.comment&&e.jsxs("p",{className:"text-xs text-emerald-700/80 mt-0.5 italic",children:['"',d.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:s?"滑动或输入互评分数":"Peer Rating"}),e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx("input",{type:"number",min:"0",max:"100",value:u,onChange:C=>{const $=Math.min(100,Math.max(0,parseInt(C.target.value)||0));b(E=>({...E,[a.id]:$}))},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:s?"分":"pts"})]})]}),e.jsx("input",{type:"range",min:"0",max:"100",value:u,onChange:C=>{const $=parseInt(C.target.value);b(E=>({...E,[a.id]:$}))},className:"w-full h-1.5 bg-gray-200 rounded-lg appearance-none cursor-pointer accent-indigo-650"}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx("textarea",{rows:1,value:D,onChange:C=>{R($=>({...$,[a.id]:C.target.value}))},placeholder:s?"简要评语反馈...":"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:()=>I(a.id,a.student_id),disabled:v,className:"bg-indigo-650 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:[v?e.jsx(M,{className:"animate-spin",size:13}):e.jsx(te,{size:13}),e.jsx("span",{className:"ml-1 shrink-0",children:d?s?"修改评分":"Update":s?"确认提交":"Submit"})]})]})]})]},a.id)})})]})]})}function xe(f){const{isStudentLocked:r=!1,studentLessonTab:l,setStudentLessonTab:c,isStudentLessonContentCollapsed:x,setIsStudentLessonContentCollapsed:w,lang:i,studentFullscreenPanel:o,setStudentFullscreenPanel:p,selectedLesson:m,elements:h,activeRole:z,activeSegmentId:j,setActiveSegmentId:L,fetchElements:N,currentVfsParent:P,setCurrentVfsParent:n,vfsNodes:b,studentSelectedCourseware:F,setStudentSelectedCourseware:R,activeStudentId:T,addToast:_}=f,s=t=>{if(r){t!==l&&_(i==="zh"?"🔒 全班专注锁定":"🔒 Class Focus Locked",i==="zh"?"锁定期间无法切换标签页,请跟随教师当前授课内容。":"Switching tabs is disabled while the class is locked.","warning");return}c(t)},y=t=>`px-3 py-1.5 text-xs font-medium rounded-md transition-colors ${l===t?"bg-primary-theme/10 text-primary-theme shadow-sm font-bold":"text-muted hover:bg-surface-secondary"} ${r&&l!==t?"opacity-50 cursor-not-allowed":"cursor-pointer"}`;return e.jsxs("div",{className:`${x||o==="right"?"w-full flex-grow":"flex-grow flex-1"} relative flex flex-col min-h-0 ${o==="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:()=>w(!x),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:x?"展开课程内容":"折叠课程内容",children:[e.jsx(U,{size:13,className:"text-primary-theme"}),e.jsx("span",{children:x?i==="zh"?"展开课程内容":"Expand Content":i==="zh"?"折叠课程内容":"Collapse Content"})]}),e.jsxs("button",{onClick:()=>s("whiteboard"),className:y("whiteboard"),title:r&&i==="zh"?"锁定中:白板为只读跟随模式":void 0,children:["Interactive Whiteboard",r&&l==="whiteboard"&&e.jsxs("span",{className:"ml-1.5 text-xs font-bold text-indigo-500",children:["🔒 ",i==="zh"?"只读":"RO"]})]}),e.jsx("button",{onClick:()=>s("courseware"),className:y("courseware"),children:"Interactive Courseware Viewer"}),e.jsx("button",{onClick:()=>s("assignment"),className:y("assignment"),children:i==="zh"?"作业提交与互评":"Assignments & Peer Reviews"})]}),e.jsx("button",{onClick:()=>p(t=>t==="right"?"none":"right"),className:"p-1 hover:bg-gray-100 text-gray-400 hover:text-gray-700 rounded transition-colors cursor-pointer flex items-center gap-1",title:o==="right"?"退出全屏":"全屏",children:o==="right"?e.jsxs(e.Fragment,{children:[e.jsx(G,{size:13}),e.jsx("span",{className:"text-xs font-medium",children:"退出全屏"})]}):e.jsxs(e.Fragment,{children:[e.jsx(H,{size:13}),e.jsx("span",{className:"text-xs font-medium",children:"全屏"})]})})]}),l==="whiteboard"&&e.jsx(ie,{lessonId:m,elements:h,userRole:z,readOnly:r,followRemoteFullscreen:!0,activeSegmentId:j,onSegmentSync:t=>L(t),onElementUpdate:async()=>{},onElementDelete:async t=>{r||(await fetch(`/api/lessons/${m}/whiteboard/${t}`,{method:"DELETE"}),N(m))},onClearBoard:async()=>{r||(await fetch(`/api/lessons/${m}/whiteboard`,{method:"DELETE"}),N(m))},onElementAdd:async()=>{},onRefresh:()=>N(m)}),l==="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:[P!==null&&e.jsxs("button",{onClick:()=>n(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(B,{className:"rotate-180",size:14})," Back to Root"]}),b.filter(t=>t.type==="dir").map(t=>e.jsxs("button",{onClick:()=>n(t.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:t.name,children:[e.jsx(ae,{size:14,className:"text-indigo-400 shrink-0 group-hover:text-indigo-600"}),e.jsx("span",{className:"truncate",children:t.name})]},t.id)),b.filter(t=>t.type==="file"&&(t.name.endsWith(".html")||t.name.endsWith(".htm")||t.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."}):b.filter(t=>t.type==="file"&&(t.name.endsWith(".html")||t.name.endsWith(".htm")||t.content?.includes("<html"))).map(t=>e.jsxs("button",{onClick:()=>R(t.id),className:`w-full text-left p-2 rounded text-xs flex items-center gap-2 truncate transition-colors ${F===t.id?"bg-indigo-100 text-indigo-700 font-medium":"text-gray-600 hover:bg-gray-100"}`,title:t.name,children:[e.jsx(ne,{size:14,className:"shrink-0"}),e.jsx("span",{className:"truncate",children:t.name})]},t.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(le,{coursewareId:F,onClose:()=>R(null)})})]}),l==="assignment"&&e.jsx(ce,{lessonId:m,studentId:T,lang:i,addToast:_})]})}function Ne(f){const{students:r,activeStudentId:l,isStudentLocked:c=!1,setStudentViewStatus:x,setSelectedLesson:w,lessons:i,selectedLesson:o,studentFullscreenPanel:p,setStudentFullscreenPanel:m,timelineSegments:h,lang:z,activeSegmentId:j,setActiveSegmentId:L,localProgressPercent:N,setLocalProgressPercent:P,updateStudentProgress:n,isStudentLessonContentCollapsed:b,setIsStudentLessonContentCollapsed:F,studentLessonTab:R,setStudentLessonTab:T,elements:_,activeRole:s,fetchElements:y,currentVfsParent:t,setCurrentVfsParent:I,vfsNodes:S,studentSelectedCourseware:g,setStudentSelectedCourseware:V,addToast:A}=f;return e.jsxs("div",{className:"flex flex-col h-full space-y-4",children:[e.jsx(oe,{students:r,activeStudentId:l,isStudentLocked:c,setStudentViewStatus:x,setSelectedLesson:w,lessons:i,selectedLesson:o}),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(de,{students:r,activeStudentId:l,isStudentLocked:c,studentFullscreenPanel:p,setStudentFullscreenPanel:m,timelineSegments:h,lang:z,activeSegmentId:j,setActiveSegmentId:L,localProgressPercent:N,setLocalProgressPercent:P,updateStudentProgress:n,selectedLesson:o,lessons:i,isStudentLessonContentCollapsed:b}),e.jsx(xe,{isStudentLocked:c,studentLessonTab:R,setStudentLessonTab:T,isStudentLessonContentCollapsed:b,setIsStudentLessonContentCollapsed:F,lang:z,studentFullscreenPanel:p,setStudentFullscreenPanel:m,selectedLesson:o,elements:_,activeRole:s,activeSegmentId:j,setActiveSegmentId:L,fetchElements:y,currentVfsParent:t,setCurrentVfsParent:I,vfsNodes:S,studentSelectedCourseware:g,setStudentSelectedCourseware:V,activeStudentId:l,addToast:A})]})]})}export{Ne as StudentLessonView};
@@ -1 +1 @@
1
- import{j as e}from"./vendor-react-B0t7H3hh.js";import{L as k}from"./LazyWhiteboard-CpSzdON0.js";import{L as C}from"./LazyCourseware-Du9MgZyH.js";import{m as z,M as $}from"./index-BApV4fuy.js";import{E as L,ap as E,X as P,B as S,a7 as g,a6 as f,a4 as T,aq as F,s as I}from"./vendor-icons-B2DRJfZU.js";import"./vendor-utils-m0Urvtws.js";import"./vendor-pdf-Bw0ZQZtM.js";import"./vendor-motion-DjY2czvL.js";import"./vendor-pptx-C5-U7ieS.js";import"./vendor-charts-U9fLlNC_.js";function H(p){const{isLessonPreviewVisible:b,setIsLessonPreviewVisible:u,lessons:o,selectedLesson:s,previewFullscreenPanel:r,setPreviewFullscreenPanel:d,previewLessonTab:n,setPreviewLessonTab:c,activeRole:w,elements:y,activeSegmentId:j,setActiveSegmentId:v,fetchElements:i,currentVfsParent:N,setCurrentVfsParent:x,vfsNodes:a,previewSelectedCourseware:m,setPreviewSelectedCourseware:h}=p;return e.jsx(e.Fragment,{children:b&&e.jsx("div",{className:"fixed inset-0 bg-gray-900/60 backdrop-blur-sm flex items-center justify-center p-4 md:p-6 z-[60] overflow-hidden text-gray-850",children:e.jsxs(z.div,{initial:{opacity:0,scale:.96},animate:{opacity:1,scale:1},exit:{opacity:0,scale:.96},className:"bg-white border text-gray-900 border-gray-200 rounded-2xl shadow-2xl w-full max-w-7xl h-[90vh] flex flex-col overflow-hidden",children:[e.jsxs("div",{className:"p-4 border-b border-gray-100 flex items-center justify-between bg-indigo-50/70 shrink-0 select-none",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"bg-indigo-600 text-white p-2 rounded-lg shadow-sm",children:e.jsx(L,{size:18})}),e.jsxs("div",{children:[e.jsx("h2",{className:"font-bold text-gray-900 text-base flex items-center gap-2",children:"学生视角预览 (Student Perspective Preview)"}),e.jsxs("p",{className:"text-xs text-gray-500 mt-0.5",children:["正在预览课程:"," ",e.jsx("span",{className:"font-semibold text-gray-700",children:o.find(t=>t.id===s)?.title})," ","• 演示同步与交互"]})]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("button",{type:"button",onClick:()=>{const t=`${window.location.origin}${window.location.pathname}?mode=student_live&lessonId=${encodeURIComponent(s||"")}#/student_live`;window.open(t,"_blank")},className:"px-3 py-1.5 bg-indigo-600 hover:bg-indigo-700 text-white text-xs font-semibold rounded-lg shadow-sm transition-all cursor-pointer flex items-center gap-1.5",title:"在独立浏览器新Tab中打开学生端,支持双屏或分屏预览",children:[e.jsx(E,{size:13}),e.jsx("span",{children:"独立Tab预览"})]}),e.jsxs("button",{type:"button",onClick:()=>u(!1),className:"px-3.5 py-1.5 bg-gray-100 hover:bg-gray-200 text-gray-600 hover:text-gray-800 text-xs font-semibold rounded-lg shadow-sm transition-all cursor-pointer flex items-center gap-1 border border-gray-200",children:[e.jsx(P,{size:14})," 退出预览"]})]})]}),e.jsxs("div",{className:"flex-1 flex min-h-0 bg-slate-50/50 p-4 gap-4",children:[e.jsxs("div",{className:`${r==="left"?"w-full":"w-1/3"} bg-white border border-gray-200 rounded-xl p-4 flex flex-col min-h-0 shadow-sm ${r==="right"?"hidden":""} transition-all duration-300`,children:[e.jsxs("div",{className:"text-xs font-bold uppercase tracking-wider text-gray-400 mb-3 border-b border-gray-100 pb-2 flex items-center justify-between shrink-0 select-none",children:[e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(S,{size:14,className:"text-indigo-500"})," Lesson Content (课程内容)"]}),e.jsx("button",{onClick:()=>d(t=>t==="left"?"none":"left"),className:"p-1 hover:bg-gray-100 text-gray-400 hover:text-gray-700 rounded transition-colors cursor-pointer flex items-center gap-1",title:r==="left"?"退出全屏":"全屏",children:r==="left"?e.jsxs(e.Fragment,{children:[e.jsx(g,{size:13}),e.jsx("span",{className:"text-xs font-medium",children:"退出全屏"})]}):e.jsxs(e.Fragment,{children:[e.jsx(f,{size:13}),e.jsx("span",{className:"text-xs font-medium",children:"全屏"})]})})]}),e.jsx("div",{className:"flex-1 overflow-y-auto prose prose-sm prose-indigo max-w-none text-gray-700 pr-1",children:e.jsx($,{children:o.find(t=>t.id===s)?.content||""})})]}),e.jsxs("div",{className:`${r==="right"?"w-full flex-grow":"flex-1"} bg-white border border-gray-200 rounded-xl p-4 flex flex-col min-h-0 shadow-sm ${r==="left"?"hidden":""} transition-all duration-300`,children:[e.jsxs("div",{className:"flex items-center justify-between border-b border-gray-100 pb-3 mb-3 shrink-0",children:[e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx("button",{onClick:()=>c("whiteboard"),className:`px-3 py-1.5 text-xs font-semibold rounded-lg transition-all cursor-pointer ${n==="whiteboard"?"bg-indigo-600 text-white shadow-sm":"text-gray-500 hover:bg-gray-100"}`,children:"Interactive Whiteboard"}),e.jsx("button",{onClick:()=>c("courseware"),className:`px-3 py-1.5 text-xs font-semibold rounded-lg transition-all cursor-pointer ${n==="courseware"?"bg-indigo-600 text-white shadow-sm":"text-gray-500 hover:bg-gray-100"}`,children:"Cloud Apps Viewer"})]}),e.jsx("button",{onClick:()=>d(t=>t==="right"?"none":"right"),className:"p-1 hover:bg-gray-100 text-gray-400 hover:text-gray-700 rounded transition-colors cursor-pointer flex items-center gap-1",title:r==="right"?"退出全屏":"全屏",children:r==="right"?e.jsxs(e.Fragment,{children:[e.jsx(g,{size:13}),e.jsx("span",{className:"text-xs font-medium",children:"退出全屏"})]}):e.jsxs(e.Fragment,{children:[e.jsx(f,{size:13}),e.jsx("span",{className:"text-xs font-medium",children:"全屏"})]})})]}),e.jsx("div",{className:"flex-grow flex-1 min-h-0 flex flex-col h-full relative",children:n==="whiteboard"?e.jsx("div",{className:"flex-grow flex-1 min-h-0 w-full h-full relative rounded-lg overflow-hidden border border-gray-100 flex flex-col",children:e.jsx(k,{lessonId:s,userRole:w,elements:y,activeSegmentId:j,onSegmentSync:t=>v(t),onElementAdd:async(t,l)=>{await fetch(`/api/lessons/${s}/whiteboard`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({type:t,data:l})}),i(s)},onElementUpdate:async(t,l)=>{await fetch(`/api/lessons/${s}/whiteboard/${t}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({data:l})}),i(s)},onElementDelete:async t=>{await fetch(`/api/lessons/${s}/whiteboard/${t}`,{method:"DELETE"}),i(s)},onClearBoard:async()=>{await fetch(`/api/lessons/${s}/whiteboard`,{method:"DELETE"}),i(s)},onRefresh:()=>i(s)})}):e.jsxs("div",{className:"flex-grow flex-1 flex gap-4 min-h-0 w-full h-full",children:[e.jsxs("div",{className:"w-52 flex-shrink-0 bg-gray-50 border border-gray-250/70 rounded-xl p-3 flex flex-col min-h-0 h-full animate-none",children:[e.jsx("h4",{className:"text-xs font-bold uppercase tracking-wider text-gray-550 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:[N!==null&&e.jsxs("button",{onClick:()=>x(null),className:"flex items-center gap-1 p-1.5 text-xs text-indigo-600 w-full hover:bg-gray-255 hover:bg-gray-200 rounded-lg mb-1 font-semibold",children:[e.jsx(T,{className:"rotate-180",size:14})," Back to Root"]}),a.filter(t=>t.type==="dir").map(t=>e.jsxs("button",{onClick:()=>x(t.id),className:"w-full text-left p-1.5 rounded-lg text-xs text-gray-700 hover:bg-gray-250 hover:bg-gray-200 flex items-center gap-2 group truncate cursor-pointer font-medium",title:t.name,children:[e.jsx(F,{size:14,className:"text-indigo-400 shrink-0 group-hover:text-indigo-600"}),e.jsx("span",{className:"truncate",children:t.name})]},t.id)),a.filter(t=>t.type==="file"&&(t.name.endsWith(".html")||t.name.endsWith(".htm")||t.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."}):a.filter(t=>t.type==="file"&&(t.name.endsWith(".html")||t.name.endsWith(".htm")||t.content?.includes("<html"))).map(t=>e.jsxs("button",{onClick:()=>h(t.id),className:`w-full text-left p-2 rounded-lg text-xs flex items-center gap-2 truncate transition-colors cursor-pointer font-medium ${m===t.id?"bg-indigo-100 text-indigo-700 font-semibold shadow-xs":"text-gray-600 hover:bg-gray-100"}`,title:t.name,children:[e.jsx(I,{size:14,className:"shrink-0 text-indigo-500"}),e.jsx("span",{className:"truncate",children:t.name})]},t.id))]}),e.jsx("div",{className:"mt-2 text-xs text-gray-400 leading-tight",children:"Note: Showing HTML courseware from current OS drive directory."})]}),e.jsx("div",{className:"flex-1 relative bg-white border border-gray-100 rounded-xl overflow-hidden min-h-0 h-full shadow-inner flex flex-col",children:e.jsx(C,{coursewareId:m,onClose:()=>h(null)})})]})})]})]})]})})})}export{H as StudentPreviewModal};
1
+ import{j as e}from"./vendor-react-B0t7H3hh.js";import{L as k}from"./LazyWhiteboard-BSzsAPXC.js";import{L as C}from"./LazyCourseware-DVgyrg3r.js";import{m as z,M as $}from"./index-C7jMgry5.js";import{E as L,aq as E,X as P,B as S,a8 as g,a7 as f,a5 as T,ar as F,s as I}from"./vendor-icons-30iiuCQb.js";import"./vendor-utils-m0Urvtws.js";import"./vendor-pdf-Bw0ZQZtM.js";import"./vendor-motion-DjY2czvL.js";import"./vendor-pptx-C5-U7ieS.js";import"./vendor-charts-U9fLlNC_.js";function H(p){const{isLessonPreviewVisible:b,setIsLessonPreviewVisible:u,lessons:o,selectedLesson:s,previewFullscreenPanel:r,setPreviewFullscreenPanel:d,previewLessonTab:n,setPreviewLessonTab:c,activeRole:w,elements:y,activeSegmentId:j,setActiveSegmentId:v,fetchElements:i,currentVfsParent:N,setCurrentVfsParent:x,vfsNodes:a,previewSelectedCourseware:m,setPreviewSelectedCourseware:h}=p;return e.jsx(e.Fragment,{children:b&&e.jsx("div",{className:"fixed inset-0 bg-gray-900/60 backdrop-blur-sm flex items-center justify-center p-4 md:p-6 z-[60] overflow-hidden text-gray-850",children:e.jsxs(z.div,{initial:{opacity:0,scale:.96},animate:{opacity:1,scale:1},exit:{opacity:0,scale:.96},className:"bg-white border text-gray-900 border-gray-200 rounded-2xl shadow-2xl w-full max-w-7xl h-[90vh] flex flex-col overflow-hidden",children:[e.jsxs("div",{className:"p-4 border-b border-gray-100 flex items-center justify-between bg-indigo-50/70 shrink-0 select-none",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"bg-indigo-600 text-white p-2 rounded-lg shadow-sm",children:e.jsx(L,{size:18})}),e.jsxs("div",{children:[e.jsx("h2",{className:"font-bold text-gray-900 text-base flex items-center gap-2",children:"学生视角预览 (Student Perspective Preview)"}),e.jsxs("p",{className:"text-xs text-gray-500 mt-0.5",children:["正在预览课程:"," ",e.jsx("span",{className:"font-semibold text-gray-700",children:o.find(t=>t.id===s)?.title})," ","• 演示同步与交互"]})]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("button",{type:"button",onClick:()=>{const t=`${window.location.origin}${window.location.pathname}?mode=student_live&lessonId=${encodeURIComponent(s||"")}#/student_live`;window.open(t,"_blank")},className:"px-3 py-1.5 bg-indigo-600 hover:bg-indigo-700 text-white text-xs font-semibold rounded-lg shadow-sm transition-all cursor-pointer flex items-center gap-1.5",title:"在独立浏览器新Tab中打开学生端,支持双屏或分屏预览",children:[e.jsx(E,{size:13}),e.jsx("span",{children:"独立Tab预览"})]}),e.jsxs("button",{type:"button",onClick:()=>u(!1),className:"px-3.5 py-1.5 bg-gray-100 hover:bg-gray-200 text-gray-600 hover:text-gray-800 text-xs font-semibold rounded-lg shadow-sm transition-all cursor-pointer flex items-center gap-1 border border-gray-200",children:[e.jsx(P,{size:14})," 退出预览"]})]})]}),e.jsxs("div",{className:"flex-1 flex min-h-0 bg-slate-50/50 p-4 gap-4",children:[e.jsxs("div",{className:`${r==="left"?"w-full":"w-1/3"} bg-white border border-gray-200 rounded-xl p-4 flex flex-col min-h-0 shadow-sm ${r==="right"?"hidden":""} transition-all duration-300`,children:[e.jsxs("div",{className:"text-xs font-bold uppercase tracking-wider text-gray-400 mb-3 border-b border-gray-100 pb-2 flex items-center justify-between shrink-0 select-none",children:[e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(S,{size:14,className:"text-indigo-500"})," Lesson Content (课程内容)"]}),e.jsx("button",{onClick:()=>d(t=>t==="left"?"none":"left"),className:"p-1 hover:bg-gray-100 text-gray-400 hover:text-gray-700 rounded transition-colors cursor-pointer flex items-center gap-1",title:r==="left"?"退出全屏":"全屏",children:r==="left"?e.jsxs(e.Fragment,{children:[e.jsx(g,{size:13}),e.jsx("span",{className:"text-xs font-medium",children:"退出全屏"})]}):e.jsxs(e.Fragment,{children:[e.jsx(f,{size:13}),e.jsx("span",{className:"text-xs font-medium",children:"全屏"})]})})]}),e.jsx("div",{className:"flex-1 overflow-y-auto prose prose-sm prose-indigo max-w-none text-gray-700 pr-1",children:e.jsx($,{children:o.find(t=>t.id===s)?.content||""})})]}),e.jsxs("div",{className:`${r==="right"?"w-full flex-grow":"flex-1"} bg-white border border-gray-200 rounded-xl p-4 flex flex-col min-h-0 shadow-sm ${r==="left"?"hidden":""} transition-all duration-300`,children:[e.jsxs("div",{className:"flex items-center justify-between border-b border-gray-100 pb-3 mb-3 shrink-0",children:[e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx("button",{onClick:()=>c("whiteboard"),className:`px-3 py-1.5 text-xs font-semibold rounded-lg transition-all cursor-pointer ${n==="whiteboard"?"bg-indigo-600 text-white shadow-sm":"text-gray-500 hover:bg-gray-100"}`,children:"Interactive Whiteboard"}),e.jsx("button",{onClick:()=>c("courseware"),className:`px-3 py-1.5 text-xs font-semibold rounded-lg transition-all cursor-pointer ${n==="courseware"?"bg-indigo-600 text-white shadow-sm":"text-gray-500 hover:bg-gray-100"}`,children:"Cloud Apps Viewer"})]}),e.jsx("button",{onClick:()=>d(t=>t==="right"?"none":"right"),className:"p-1 hover:bg-gray-100 text-gray-400 hover:text-gray-700 rounded transition-colors cursor-pointer flex items-center gap-1",title:r==="right"?"退出全屏":"全屏",children:r==="right"?e.jsxs(e.Fragment,{children:[e.jsx(g,{size:13}),e.jsx("span",{className:"text-xs font-medium",children:"退出全屏"})]}):e.jsxs(e.Fragment,{children:[e.jsx(f,{size:13}),e.jsx("span",{className:"text-xs font-medium",children:"全屏"})]})})]}),e.jsx("div",{className:"flex-grow flex-1 min-h-0 flex flex-col h-full relative",children:n==="whiteboard"?e.jsx("div",{className:"flex-grow flex-1 min-h-0 w-full h-full relative rounded-lg overflow-hidden border border-gray-100 flex flex-col",children:e.jsx(k,{lessonId:s,userRole:w,elements:y,activeSegmentId:j,onSegmentSync:t=>v(t),onElementAdd:async(t,l)=>{await fetch(`/api/lessons/${s}/whiteboard`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({type:t,data:l})}),i(s)},onElementUpdate:async(t,l)=>{await fetch(`/api/lessons/${s}/whiteboard/${t}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({data:l})}),i(s)},onElementDelete:async t=>{await fetch(`/api/lessons/${s}/whiteboard/${t}`,{method:"DELETE"}),i(s)},onClearBoard:async()=>{await fetch(`/api/lessons/${s}/whiteboard`,{method:"DELETE"}),i(s)},onRefresh:()=>i(s)})}):e.jsxs("div",{className:"flex-grow flex-1 flex gap-4 min-h-0 w-full h-full",children:[e.jsxs("div",{className:"w-52 flex-shrink-0 bg-gray-50 border border-gray-250/70 rounded-xl p-3 flex flex-col min-h-0 h-full animate-none",children:[e.jsx("h4",{className:"text-xs font-bold uppercase tracking-wider text-gray-550 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:[N!==null&&e.jsxs("button",{onClick:()=>x(null),className:"flex items-center gap-1 p-1.5 text-xs text-indigo-600 w-full hover:bg-gray-255 hover:bg-gray-200 rounded-lg mb-1 font-semibold",children:[e.jsx(T,{className:"rotate-180",size:14})," Back to Root"]}),a.filter(t=>t.type==="dir").map(t=>e.jsxs("button",{onClick:()=>x(t.id),className:"w-full text-left p-1.5 rounded-lg text-xs text-gray-700 hover:bg-gray-250 hover:bg-gray-200 flex items-center gap-2 group truncate cursor-pointer font-medium",title:t.name,children:[e.jsx(F,{size:14,className:"text-indigo-400 shrink-0 group-hover:text-indigo-600"}),e.jsx("span",{className:"truncate",children:t.name})]},t.id)),a.filter(t=>t.type==="file"&&(t.name.endsWith(".html")||t.name.endsWith(".htm")||t.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."}):a.filter(t=>t.type==="file"&&(t.name.endsWith(".html")||t.name.endsWith(".htm")||t.content?.includes("<html"))).map(t=>e.jsxs("button",{onClick:()=>h(t.id),className:`w-full text-left p-2 rounded-lg text-xs flex items-center gap-2 truncate transition-colors cursor-pointer font-medium ${m===t.id?"bg-indigo-100 text-indigo-700 font-semibold shadow-xs":"text-gray-600 hover:bg-gray-100"}`,title:t.name,children:[e.jsx(I,{size:14,className:"shrink-0 text-indigo-500"}),e.jsx("span",{className:"truncate",children:t.name})]},t.id))]}),e.jsx("div",{className:"mt-2 text-xs text-gray-400 leading-tight",children:"Note: Showing HTML courseware from current OS drive directory."})]}),e.jsx("div",{className:"flex-1 relative bg-white border border-gray-100 rounded-xl overflow-hidden min-h-0 h-full shadow-inner flex flex-col",children:e.jsx(C,{coursewareId:m,onClose:()=>h(null)})})]})})]})]})]})})})}export{H as StudentPreviewModal};