openlearn-next 0.3.22 → 0.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -0
- package/dist/assets/AdminDirectoryView-DY--WM5Z.js +1 -0
- package/dist/assets/{BatchPickerModal-C9FH3J57.js → BatchPickerModal-DCDKZsrS.js} +1 -1
- package/dist/assets/ClassesView-COk1pTlX.js +22 -0
- package/dist/assets/ClassroomCountdownWidget-CHUvYSrT.js +2 -0
- package/dist/assets/CloudDriveModal-DY7BSVJN.js +1 -0
- package/dist/assets/ComputerLabView-1qWDNRQ2.js +1 -0
- package/dist/assets/CourseManagement-DA1m3Div.js +1 -0
- package/dist/assets/CourseWizardModal-yDZpcltW.js +3 -0
- package/dist/assets/CoursewareHubPanel-CaEizhxl.js +1 -0
- package/dist/assets/Dashboard-QTNgTjoi.js +8 -0
- package/dist/assets/{ExportWeightModal-C4d-0uTM.js → ExportWeightModal-Cq3BaikE.js} +1 -1
- package/dist/assets/HelpTour-CMJbbGne.js +1 -0
- package/dist/assets/{HelpView-B9Pny6u9.js → HelpView-DY4CA5VA.js} +4 -4
- package/dist/assets/{ImportLessonsModal-hKRuw9p4.js → ImportLessonsModal-DzeCcQOI.js} +1 -1
- package/dist/assets/{ImportModal-CVXHZ1Ei.js → ImportModal-D7L-KNhZ.js} +1 -1
- package/dist/assets/InteractiveCoursewareViewer-D5py6E0c.js +1 -0
- package/dist/assets/InteractiveWhiteboard-D5YKM1I6.js +77 -0
- package/dist/assets/LazyCourseware-DWCx60AO.js +2 -0
- package/dist/assets/LazyWhiteboard-CFn-1ATp.js +2 -0
- package/dist/assets/LessonEditorView-CfvhQfzG.js +1 -0
- package/dist/assets/LiveClassroomView-CB_0PN1X.js +59 -0
- package/dist/assets/{NotificationDetailModal-1MOkBDr_.js → NotificationDetailModal-DBg7UPZh.js} +1 -1
- package/dist/assets/PluginView-wozVlSXQ.js +66 -0
- package/dist/assets/{ProcessLogsModal-gZ9LILYM.js → ProcessLogsModal-DmFXg9mG.js} +1 -1
- package/dist/assets/QuizGeneratorModal-DnW-ff7D.js +1 -0
- package/dist/assets/StudentAssignmentView-tQiAv5Xn.js +1 -0
- package/dist/assets/StudentLessonView-DRwhbGoU.js +1 -0
- package/dist/assets/StudentPreviewModal-BQ_a7sQY.js +1 -0
- package/dist/assets/StudentView-XBaWzGO3.js +2 -0
- package/dist/assets/{SystemResourceLibraryModal-Ce-Dis6M.js → SystemResourceLibraryModal-Bcak0WSz.js} +1 -1
- package/dist/assets/TeacherView-961tBSMT.js +2 -0
- package/dist/assets/{TimetableView-0VaTfpz3.js → TimetableView-BQG-rEb5.js} +4 -4
- package/dist/assets/index-BQF_s4QO.js +217 -0
- package/dist/assets/index-CvGu7LSj.css +1 -0
- package/dist/assets/{index.es-CkgATcHw.js → index.es-C5eWEO4o.js} +1 -1
- package/dist/assets/{vendor-charts-U9fLlNC_.js → vendor-charts-qLbgF1eL.js} +1 -1
- package/dist/assets/{vendor-icons-30iiuCQb.js → vendor-icons-BRmhY6fg.js} +1 -1
- package/dist/assets/vendor-motion-BFAPOs-b.js +1 -0
- package/dist/assets/{vendor-pdf-Bw0ZQZtM.js → vendor-pdf-D7rGevI1.js} +3 -2
- package/dist/index.html +12 -13
- package/dist/server.cjs +4955 -623
- package/package.json +9 -4
- package/dist/assets/AdminDirectoryView-D-AOtp1o.js +0 -1
- package/dist/assets/ClassesView-DTuyCvYd.js +0 -19
- package/dist/assets/CloudDriveModal-Bi-aMuax.js +0 -1
- package/dist/assets/ComputerLabView-DWMtMSHV.js +0 -1
- package/dist/assets/CourseManagement-CeelAyst.js +0 -1
- package/dist/assets/CourseWizardModal-m7TDgcB2.js +0 -3
- package/dist/assets/CoursewareHubPanel-C4LQjt4v.js +0 -1
- package/dist/assets/Dashboard-CiBtG7Ge.js +0 -8
- package/dist/assets/HelpTour-00eT17Vg.js +0 -1
- package/dist/assets/InteractiveCoursewareViewer-DMMAs2k_.js +0 -1
- package/dist/assets/InteractiveWhiteboard-jpweQ094.js +0 -77
- package/dist/assets/LazyCourseware-DVgyrg3r.js +0 -2
- package/dist/assets/LazyWhiteboard-BSzsAPXC.js +0 -2
- package/dist/assets/LessonEditorView-D4g48fr5.js +0 -1
- package/dist/assets/LiveClassroomView-HQGhVwd_.js +0 -1
- package/dist/assets/PluginView-D8cQ8mLM.js +0 -65
- package/dist/assets/QuizGeneratorModal-BFCJe1cm.js +0 -1
- package/dist/assets/StudentAssignmentView-C34nleZT.js +0 -1
- package/dist/assets/StudentLessonView-DNbu2o04.js +0 -1
- package/dist/assets/StudentPreviewModal-BXbKzQgo.js +0 -1
- package/dist/assets/StudentView-BF2WjF4_.js +0 -2
- package/dist/assets/TeacherView-BySyCiZG.js +0 -2
- package/dist/assets/index-C7jMgry5.js +0 -216
- package/dist/assets/index-huP36ZNf.css +0 -1
- package/dist/assets/vendor-motion-DjY2czvL.js +0 -1
- /package/dist/assets/{vendor-content-CYR4BTuT.js → purify.es-CYR4BTuT.js} +0 -0
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import{r as l,j as e,R as _t}from"./vendor-react-B0t7H3hh.js";import{L as Ur}from"./LazyWhiteboard-CFn-1ATp.js";import{h as Ks,E as oe,i as Be,j as He,l as Ds,e as Hr,k as qr,n as Ye,r as Vr}from"./index-BQF_s4QO.js";import{ab as $e,am as Re,aD as Kr,C as Js,aI as Qs,_ as tt,aB as ss,U as ke,J as os,b as is,t as Et,i as ls,aM as De,N as st,aW as Ys,aJ as Zs,W as cs,Q as Jr,aX as Qr,aY as Xs,aZ as Yr,ad as Zr,ac as er,X as be,y as ds,r as je,A as ht,O as rt,w as Ge,a_ as xs,a$ as ms,b0 as tr,b1 as Mt,Y as Oe,f as fe,B as ot,b2 as rs,a8 as hs,F as Le,b3 as Xr,b4 as ea,ax as It,p as us,ah as _e,b5 as ta,aL as sa,b6 as sr,b7 as mt,b8 as Dt,b9 as ra,ba as rr,D as Ot,aO as ps,bb as ar,R as ut,bc as aa,bd as na,be as Tt,T as at,n as nr,bf as or,bg as oa,a4 as Se,Z as ia,bh as la,bi as Lt,bj as ca,bk as da,h as pt,K as xa,e as Ve,j as ft,bl as ma,ay as Pt,a2 as ir,bm as lr,bn as fs,u as xt,bo as bs,aF as bt,z as cr,bp as dr,G as ha,bq as ua,br as pa,bs as xr,L as fa,E as Ft,bt as ba,m as mr,ap as ga,ae as gs,a3 as hr,bu as ur,bv as js,bw as ja,bx as pr,by as fr,bz as Na,bA as ya,aQ as as,v as va,S as Os,aw as wa,aG as ka}from"./vendor-icons-BRmhY6fg.js";import{C as za,T as Sa}from"./ClassroomCountdownWidget-CHUvYSrT.js";import{a as Ca,P as $a,h as Aa,g as Ea}from"./vendor-charts-qLbgF1eL.js";import"./vendor-utils-m0Urvtws.js";import"./vendor-pdf-D7rGevI1.js";import"./vendor-motion-BFAPOs-b.js";import"./vendor-pptx-C5-U7ieS.js";function br({lessonId:s,lang:i,addToast:n}){const[o,a]=l.useState(!1),[t,r]=l.useState(!1),[c,x]=l.useState([]),[d,m]=l.useState(60),[u,v]=l.useState(40),[N,g]=l.useState({}),[p,j]=l.useState({}),[k,w]=l.useState({}),[f,b]=l.useState({}),[z,_]=l.useState({}),[C,B]=l.useState({}),R=i==="zh",J=async(I=!1)=>{I?r(!0):a(!0);try{const P=await(await fetch(`/api/lessons/${s}/eval-grades`)).json();if(Array.isArray(P)){x(P);const y={},M={},$={},S={};P.forEach(E=>{E.grade?(y[E.id]=E.grade.teacher_score,M[E.id]=E.grade.teacher_comment,$[E.id]=Math.round(E.grade.teacher_weight*100),S[E.id]=Math.round(E.grade.peer_weight*100)):(y[E.id]=N[E.id]!==void 0?N[E.id]:80,M[E.id]=p[E.id]!==void 0?p[E.id]:"",$[E.id]=k[E.id]!==void 0?k[E.id]:d,S[E.id]=f[E.id]!==void 0?f[E.id]:u)}),g(E=>({...y,...E})),j(E=>({...M,...E})),w(E=>({...$,...E})),b(E=>({...S,...E}))}else throw new Error("Invalid submissions data format")}catch(V){console.error("Error fetching submissions grades:",V),n(R?"数据加载失败":"Failed to Load Data",R?"请检查网络连接或刷新页面。":"Please check your connection and try again.","warning")}finally{a(!1),r(!1)}};l.useEffect(()=>{s&&J()},[s]),l.useEffect(()=>{const I=Ks();if(!I||!s)return;const V=P=>{(!P?.lessonId||P.lessonId===s)&&J()};return I.on("assignment-submitted-toast",V),()=>{typeof I.off=="function"&&I.off("assignment-submitted-toast",V)}},[s]);const O=I=>{m(I),v(100-I),w(V=>{const P={...V};return c.forEach(y=>{(!y.grade||y.grade.status!=="confirmed")&&(P[y.id]=I)}),P}),b(V=>{const P={...V};return c.forEach(y=>{(!y.grade||y.grade.status!=="confirmed")&&(P[y.id]=100-I)}),P})},H=(I,V)=>{w(P=>({...P,[I]:V})),b(P=>({...P,[I]:100-V}))},ee=async(I,V)=>{const P=N[I],y=p[I]||"",M=(k[I]??d)/100,$=(f[I]??u)/100;if(P===void 0||isNaN(P)||P<0||P>100){n(R?"评分无效":"Invalid Score",R?"教师评分必须在 0 到 100 之间!":"Teacher score must be between 0 and 100!","warning");return}if(V==="confirmed"){const S=R?"确认同步后,最终得分将直接同步写入宿主学期成绩库,此后该学生的作业成绩将锁定不可修改。是否确认?":"Once confirmed, the final score will be synced to the host semester reports and locked. Proceed?";if(!window.confirm(S))return}B(S=>({...S,[I]:V}));try{const E=await(await fetch("/api/commands",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({commandType:"assignment.grade",payload:{submissionId:I,teacherScore:Number(P),teacherComment:y,teacherWeight:M,peerWeight:$,status:V}})})).json();if(E.success)n(V==="confirmed"?R?"平时成绩同步成功":"Semester Grade Synced":R?"平时成绩草稿已保存":"Grade Draft Saved",V==="confirmed"?R?`已将平时成绩 ${E.result.calculatedFinalScore} 分同步至学期报告!`:`Successfully synced grade ${E.result.calculatedFinalScore}!`:R?"成功保存了教师打分与评语草稿。":"Successfully saved score and comment draft.","success"),J(!0);else throw new Error(E.error||"Failed to submit grade")}catch(S){n(R?"操作失败":"Operation Failed",S.message,"warning")}finally{B(S=>({...S,[I]:null}))}},se=I=>{_(V=>({...V,[I]:!V[I]}))};return o?e.jsxs("div",{className:"flex-grow flex flex-col items-center justify-center py-12 text-gray-500",children:[e.jsx($e,{className:"animate-spin text-indigo-500 mb-2",size:32}),e.jsx("p",{className:"text-xs",children:R?"正在读取学生作业与成绩状态...":"Loading student submissions and grades..."})]}):e.jsxs("div",{className:"flex-1 flex flex-col min-h-0 w-full relative rounded-xl overflow-hidden border border-slate-200 shadow-md bg-white p-5 text-left",children:[e.jsxs("div",{className:"flex justify-between items-center pb-4 border-b border-slate-100 mb-4 gap-3 shrink-0",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("h3",{className:"text-sm font-bold text-slate-800 flex items-center gap-1.5 select-none",children:[e.jsx(Re,{size:16,className:"text-indigo-655"}),R?"学生作业成绩评定与折算系统":"Student Assignment Grading & Sync"]}),e.jsxs("span",{className:"text-xs bg-indigo-50 text-indigo-750 px-2 py-0.5 rounded-full border border-indigo-100 font-bold",children:[c.length," ",R?"个提交":"submissions"]})]}),e.jsx("button",{onClick:()=>J(!0),disabled:t,className:"p-1.5 bg-white hover:bg-slate-55 border border-slate-200 rounded-lg text-slate-600 transition-colors flex items-center justify-center cursor-pointer shadow-4xs",title:R?"刷新数据":"Refresh",children:e.jsx($e,{size:12,className:t?"animate-spin":""})})]}),e.jsxs("div",{className:"bg-slate-50 border border-slate-200 rounded-xl p-4 mb-5 shrink-0 flex flex-col md:flex-row md:items-center justify-between gap-4",children:[e.jsxs("div",{className:"flex items-start gap-2.5",children:[e.jsx(Kr,{className:"text-indigo-500 shrink-0 mt-0.5",size:16}),e.jsxs("div",{children:[e.jsx("h4",{className:"text-xs font-bold text-slate-700",children:R?"全局默认折算权重设置":"Default Grading Weights Configuration"}),e.jsx("p",{className:"text-xs text-slate-400 mt-0.5 font-medium",children:R?"调整权重分配,所有尚未锁定成绩的学生将自动应用此默认权重比例。":"Setting global default weights. Changes will automatically apply to non-confirmed grades."})]})]}),e.jsxs("div",{className:"flex items-center gap-4 shrink-0 bg-white px-3.5 py-2 rounded-lg border border-slate-200 shadow-3xs",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-xs font-bold text-slate-500",children:R?"教师评分:":"Teacher:"}),e.jsx("input",{type:"range",min:"0",max:"100",step:"5",value:d,onChange:I=>O(Number(I.target.value)),className:"w-20 accent-indigo-650 cursor-pointer"}),e.jsxs("span",{className:"text-xs font-bold text-indigo-700 w-8 text-right",children:[d,"%"]})]}),e.jsx("div",{className:"h-4 w-[1px] bg-slate-200"}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-xs font-bold text-slate-500",children:R?"学生互评:":"Peer Review:"}),e.jsxs("span",{className:"text-xs font-bold text-slate-700 w-8",children:[u,"%"]})]})]})]}),e.jsx("div",{className:"flex-grow flex-1 overflow-y-auto space-y-4 pr-1 scrollbar-thin",children:c.length===0?e.jsxs("div",{className:"h-full flex flex-col items-center justify-center py-12 text-slate-400 gap-2",children:[e.jsx(Js,{size:32,className:"text-slate-350"}),e.jsx("p",{className:"text-xs",children:R?"本节课目前没有任何学生提交作业。":"No students have submitted assignments yet for this lesson."})]}):c.map(I=>{const V=N[I.id]!==void 0?N[I.id]:80,P=p[I.id]||"",y=k[I.id]??d,M=f[I.id]??u,$=I.grade?.status==="confirmed",S=Math.round(V*(y/100)+I.peerAverageScore*(M/100));return e.jsxs("div",{className:`bg-white border rounded-xl shadow-3xs overflow-hidden transition-all ${$?"border-emerald-200 bg-emerald-50/5":"border-slate-200"}`,children:[e.jsxs("div",{className:"px-4 py-3 bg-slate-50/50 border-b border-slate-100 flex flex-col md:flex-row md:items-center justify-between gap-3",children:[e.jsxs("div",{className:"flex items-center gap-2.5",children:[e.jsx("div",{className:"w-8 h-8 rounded-full bg-indigo-50 border border-indigo-100 flex items-center justify-center text-indigo-700 font-bold text-xs select-none",children:I.studentName?.charAt(0)||"S"}),e.jsxs("div",{children:[e.jsx("div",{className:"text-xs font-bold text-slate-800",children:I.studentName}),e.jsxs("div",{className:"text-xs text-slate-400 font-mono mt-0.5 flex items-center gap-1.5",children:[e.jsxs("span",{children:["V",I.version]}),e.jsx("span",{children:"•"}),e.jsx("span",{children:new Date(I.updatedAt).toLocaleString()})]})]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[$?e.jsxs("span",{className:"bg-emerald-55 text-emerald-700 text-xs font-black px-2.5 py-1 rounded-full border border-emerald-150 flex items-center gap-1 shadow-3xs select-none",children:[e.jsx(Qs,{size:12}),R?"成绩已同步":"Synced to Reports"]}):e.jsx("span",{className:"bg-amber-50 text-amber-805 text-xs font-bold px-2 py-0.5 rounded-full border border-amber-200/60 select-none",children:I.grade?R?"草稿状态":"Draft":R?"未评定":"Ungraded"}),e.jsxs("a",{href:I.filePath,target:"_blank",rel:"noopener noreferrer",className:"text-xs text-indigo-600 hover:text-indigo-850 font-medium hover:underline flex items-center gap-1 bg-white border border-slate-200 px-2 py-1 rounded-lg shadow-4xs",title:I.filePath,children:[e.jsx(tt,{size:11}),R?"查看作业":"View File",e.jsx(ss,{size:8})]})]})]}),e.jsxs("div",{className:"p-4 grid grid-cols-1 lg:grid-cols-12 gap-5",children:[e.jsxs("div",{className:"lg:col-span-5 flex flex-col gap-2.5 border-r border-slate-100 pr-0 lg:pr-5 text-left",children:[e.jsxs("div",{className:"flex justify-between items-center",children:[e.jsxs("span",{className:"text-xs font-bold text-slate-650 flex items-center gap-1 select-none",children:[e.jsx(ke,{size:13,className:"text-slate-400"}),R?"学生互评详情":"Peer Review Details"]}),e.jsxs("span",{className:"text-xs font-bold text-slate-500 bg-slate-100 px-2 py-0.5 rounded-md",children:[R?"互评人数:":"Reviews:"," ",I.peerReviews.length]})]}),e.jsxs("div",{className:"bg-slate-50 border border-slate-100 rounded-xl p-3 flex items-center gap-3",children:[e.jsxs("div",{className:"bg-white border border-slate-200 w-12 h-12 rounded-lg flex flex-col items-center justify-center shrink-0 shadow-3xs",children:[e.jsx("span",{className:"text-xs text-slate-405 select-none font-bold",children:R?"均分":"Avg"}),e.jsx("span",{className:"text-sm font-extrabold text-slate-700 leading-none mt-0.5",children:I.peerAverageScore})]}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("p",{className:"text-xs text-slate-450 leading-normal font-medium",children:I.peerReviews.length>0?R?"根据同学互评分数得出的平均值。":"Average score computed from classmate evaluations.":R?"暂无同学对此作业给出评分。":"No classmate peer reviews received yet."}),I.peerReviews.length>0&&e.jsx("button",{onClick:()=>se(I.id),className:"text-xs text-indigo-650 hover:text-indigo-800 font-bold mt-1.5 flex items-center gap-0.5 cursor-pointer outline-none",children:z[I.id]?e.jsxs(e.Fragment,{children:[R?"收起互评详情":"Hide Details"," ",e.jsx(os,{size:12})]}):e.jsxs(e.Fragment,{children:[R?"展开互评详情":"Show Details"," ",e.jsx(is,{size:12})]})})]})]}),z[I.id]&&I.peerReviews.length>0&&e.jsx("div",{className:"mt-2 space-y-2 border-t border-slate-100 pt-2.5 max-h-40 overflow-y-auto scrollbar-thin",children:I.peerReviews.map(E=>e.jsxs("div",{className:"bg-white border border-slate-200 rounded-lg p-2.5 text-xs text-left shadow-4xs",children:[e.jsxs("div",{className:"flex justify-between items-center font-bold text-slate-700",children:[e.jsxs("span",{className:"flex items-center gap-1 font-semibold text-slate-655",children:[e.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-slate-300"}),E.reviewer_name]}),e.jsxs("span",{className:"text-indigo-650 bg-indigo-50 border border-indigo-100 rounded px-1.5 py-0.5 text-xs",children:[E.score," ",R?"分":"pts"]})]}),E.comment&&e.jsxs("p",{className:"text-xs text-slate-550 mt-1 italic pl-2.5 border-l-2 border-slate-100 font-medium",children:['"',E.comment,'"']})]},E.id))})]}),e.jsxs("div",{className:"lg:col-span-7 flex flex-col gap-3 justify-between",children:[e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs font-bold text-slate-650 mb-1 select-none",children:R?"教师平时分评分 (0-100)":"Teacher Score (0-100)"}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx("input",{id:`teacher_score_input_${I.id}`,type:"number",min:"0",max:"100",disabled:$,value:V,onChange:E=>g(Q=>({...Q,[I.id]:Math.min(100,Math.max(0,Number(E.target.value)))})),className:"bg-white border border-slate-250 rounded-lg text-xs font-bold text-slate-700 px-3 py-1.5 focus:ring-1 focus:ring-indigo-500 outline-none w-20 shadow-4xs disabled:opacity-50 disabled:bg-slate-50"}),e.jsx("input",{type:"range",min:"0",max:"100",disabled:$,value:V,onChange:E=>g(Q=>({...Q,[I.id]:Number(E.target.value)})),className:"flex-1 accent-indigo-650 disabled:opacity-40 cursor-pointer"})]})]}),e.jsxs("div",{children:[e.jsxs("div",{className:"flex justify-between items-center mb-1",children:[e.jsx("label",{className:"block text-xs font-bold text-slate-600 select-none",children:R?"打分占比 (教师权重)":"Teacher Score Weight"}),e.jsx("span",{className:"text-xs font-bold text-slate-400",children:R?`学生互评: ${M}%`:`Peer: ${M}%`})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("input",{id:`teacher_weight_input_${I.id}`,type:"range",min:"0",max:"100",step:"5",disabled:$,value:y,onChange:E=>H(I.id,Number(E.target.value)),className:"flex-1 accent-indigo-650 disabled:opacity-40 cursor-pointer"}),e.jsxs("span",{className:"text-xs font-extrabold text-indigo-750 w-9 text-right",children:[y,"%"]})]})]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs font-bold text-slate-655 mb-1 select-none",children:R?"教师评价评语":"Teacher Comments & Feedback"}),e.jsx("textarea",{id:`teacher_comment_input_${I.id}`,disabled:$,value:P,placeholder:R?"在此输入对学生作业作品的改进指导意见及评语。":"Enter guiding feedback for this student.",onChange:E=>j(Q=>({...Q,[I.id]:E.target.value})),rows:2,className:"w-full bg-white border border-slate-250 rounded-lg text-xs p-2 focus:ring-1 focus:ring-indigo-500 outline-none shadow-4xs disabled:opacity-50 disabled:bg-slate-50 resize-none font-medium text-slate-700"})]}),e.jsxs("div",{className:"flex flex-col md:flex-row md:items-center justify-between gap-4 pt-2 border-t border-slate-100 mt-1",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:`p-1.5 rounded-lg border flex items-center justify-center shrink-0 ${$?"bg-emerald-50 text-emerald-600 border-emerald-100":"bg-indigo-50 text-indigo-700 border-indigo-100"}`,children:e.jsx(Et,{size:14})}),e.jsxs("div",{className:"text-xs text-slate-500 font-medium",children:[e.jsxs("div",{children:[R?"平时总分计算公式":"Calculated Final Grade",":"]}),e.jsxs("div",{className:"font-bold text-slate-700 mt-0.5 animate-formula",children:[y,"% × ",e.jsx("span",{className:"text-indigo-650 font-bold",children:V}),I.peerReviews.length>0&&` + ${M}% × ${I.peerAverageScore}`," = ",e.jsx("span",{className:$?"text-emerald-700 font-black text-xs":"text-indigo-700 font-black text-xs",children:$&&I.grade?.calculated_final_score||S}),R?"分":" pts"]})]})]}),!$&&e.jsxs("div",{className:"flex gap-2 justify-end shrink-0",children:[e.jsxs("button",{id:`teacher_draft_btn_${I.id}`,type:"button",disabled:!!C[I.id],onClick:()=>ee(I.id,"draft"),className:"px-3 py-1.5 bg-white border border-slate-350 rounded-lg text-xs font-bold text-slate-700 hover:bg-slate-55 flex items-center gap-1.5 shadow-4xs cursor-pointer select-none disabled:opacity-50",children:[e.jsx(ls,{size:12}),C[I.id]==="draft"?R?"保存中...":"Saving...":R?"暂存草稿":"Save Draft"]}),e.jsxs("button",{id:`teacher_confirm_btn_${I.id}`,type:"button",disabled:!!C[I.id],onClick:()=>ee(I.id,"confirmed"),className:"px-3.5 py-1.5 bg-indigo-600 border border-indigo-700 rounded-lg text-xs font-bold text-white hover:bg-indigo-700 flex items-center gap-1.5 shadow-3xs cursor-pointer select-none disabled:opacity-50",children:[e.jsx(De,{size:12}),C[I.id]==="confirmed"?R?"同步中...":"Syncing...":R?"确认并同步":"Confirm & Sync"]})]})]})]})]})]},I.id)})})]})}const Ta=({state:s,onToggleAnonymous:i,onOpenRubricModal:n,onToggleVoiceDanmaku:o,onAdvanceStage:a,onAddMinute:t,onTogglePauseTimer:r,isFullscreen:c,onToggleFullscreen:x,onClose:d})=>{const m=v=>{const N=Math.floor(Math.max(0,v)/60),g=Math.max(0,v)%60;return`${String(N).padStart(2,"0")}:${String(g).padStart(2,"0")}`},u=Math.round(s.completedReviews/Math.max(1,s.totalStudents)*100);return e.jsxs("div",{id:"peer-review-telemetry-header",className:"w-full bg-[#131b2e] border-b border-[#2d3449] px-6 py-3 flex flex-wrap items-center justify-between gap-4 select-none shrink-0",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"px-2 py-0.5 rounded bg-[#171f33] text-[#908fa0] text-[10px] font-mono font-semibold tracking-wider",children:"STAGE 02.4"}),e.jsxs("div",{className:"flex items-center gap-1.5 text-xs text-[#c7c4d7]",children:[e.jsx("span",{children:"随堂巩固"}),e.jsx(st,{size:13,className:"text-[#908fa0]"}),e.jsx("span",{children:"收卷归档"}),e.jsx(st,{size:13,className:"text-[#908fa0]"}),e.jsxs("span",{className:"text-[#4edea3] font-medium flex items-center gap-1",children:[e.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-[#4edea3] animate-ping"}),"全班大屏协同互评阶段 ",s.isLocked&&"(已锁定全班终端)"]})]})]}),e.jsx("div",{className:"h-4 w-[1px] bg-[#2d3449] hidden md:block"}),e.jsxs("div",{className:"hidden sm:flex items-center gap-1.5 px-2.5 py-1 rounded bg-[#00a572]/20 text-[#4edea3] text-xs font-medium border border-[#00a572]/30",children:[e.jsx(Ys,{size:14,className:"text-[#4edea3]"}),e.jsxs("span",{children:["教室主大屏协同输出 ",s.isDualScreen?"(4K 双屏模式)":"(投影模式)"]})]})]}),e.jsxs("div",{className:"flex items-center gap-4 sm:gap-6",children:[e.jsxs("div",{className:"flex items-center gap-2 bg-[#060e20] px-3 py-1.5 rounded-xl border border-[#2d3449]/60",children:[e.jsx(Zs,{size:18,className:"text-[#ffb95f] animate-pulse"}),e.jsxs("div",{className:"flex flex-col",children:[e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx("span",{className:"text-[10px] font-mono text-[#908fa0] leading-none",children:"COUNTDOWN"}),t&&e.jsx("button",{type:"button",onClick:t,className:"text-[10px] text-[#ffb95f] hover:text-[#ffddb8] font-mono transition-colors",title:"加时 1 分钟",children:"+1m"})]}),e.jsxs("div",{className:"flex items-center gap-1.5 mt-0.5",children:[e.jsxs("span",{className:"text-sm font-semibold font-mono text-[#dae2fd] leading-none",children:[m(s.timeRemainingSeconds),e.jsxs("span",{className:"text-[#908fa0] text-xs font-normal",children:[" / ",m(s.totalTimeSeconds)]})]}),r&&e.jsx("button",{type:"button",onClick:r,className:"text-[#c7c4d7] hover:text-white transition-colors",title:s.isPaused?"恢复倒计时":"暂停倒计时",children:s.isPaused?e.jsx(cs,{size:12,className:"text-[#4edea3]"}):e.jsx(Jr,{size:12})})]})]})]}),e.jsxs("div",{className:"flex items-center gap-2.5",children:[e.jsxs("div",{className:"relative w-8 h-8 flex items-center justify-center",children:[e.jsxs("svg",{className:"w-8 h-8 -rotate-90",viewBox:"0 0 36 36",children:[e.jsx("path",{className:"text-[#2d3449]",d:"M18 2.0845 a 15.9155 15.9155 0 0 1 0 31.831 a 15.9155 15.9155 0 0 1 0 -31.831",fill:"none",stroke:"currentColor",strokeWidth:"3.5"}),e.jsx("path",{className:"text-[#4edea3] transition-all duration-500",d:"M18 2.0845 a 15.9155 15.9155 0 0 1 0 31.831 a 15.9155 15.9155 0 0 1 0 -31.831",fill:"none",stroke:"currentColor",strokeDasharray:`${u}, 100`,strokeLinecap:"round",strokeWidth:"3.5"})]}),e.jsxs("span",{className:"absolute text-[9px] font-mono text-[#dae2fd] font-semibold",children:[u,"%"]})]}),e.jsxs("div",{className:"flex flex-col",children:[e.jsx("span",{className:"text-[10px] font-mono text-[#908fa0] leading-none",children:"SUBMISSIONS"}),e.jsxs("span",{className:"text-xs font-medium text-[#dae2fd] mt-0.5",children:[s.completedReviews," / ",s.totalStudents," 人已评"]})]})]}),e.jsxs("div",{className:"hidden lg:flex items-center gap-2 bg-[#171f33] px-3 py-1.5 rounded-xl border border-[#2d3449]/60",children:[e.jsx(Qr,{size:16,className:"text-[#c0c1ff]"}),e.jsxs("div",{className:"flex flex-col",children:[e.jsx("span",{className:"text-[10px] font-mono text-[#908fa0] leading-none",children:"PEER REACTIONS"}),e.jsxs("span",{className:"text-xs font-mono font-medium text-[#c0c1ff] mt-0.5",children:[s.totalLikes," 次点赞 · ",s.totalNominations," 份提名"]})]})]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("label",{htmlFor:"toggle-anon",className:"flex items-center gap-2 cursor-pointer bg-[#171f33] px-2.5 py-1.5 rounded-xl hover:bg-[#222a3d] transition-colors border border-[#2d3449]/50",title:"开启后隐藏学生真实姓名",children:[e.jsx("input",{id:"toggle-anon",type:"checkbox",checked:s.isAnonymous,onChange:i,className:"sr-only peer"}),e.jsx("div",{className:"w-7 h-4 bg-[#2d3449] peer-checked:bg-[#4edea3] rounded-full relative transition-colors",children:e.jsx("div",{className:`w-3 h-3 bg-white rounded-full absolute top-0.5 left-0.5 transition-transform ${s.isAnonymous?"translate-x-3":""}`})}),e.jsx("span",{className:"text-xs text-[#c7c4d7] font-medium",children:"双盲匿名"})]}),e.jsxs("button",{type:"button",onClick:n,className:"flex items-center gap-1.5 px-3 py-1.5 rounded-xl bg-[#171f33] hover:bg-[#222a3d] text-[#c7c4d7] hover:text-[#dae2fd] transition-colors text-xs font-medium border border-[#2d3449]/50",children:[e.jsx(Xs,{size:15,className:"text-[#ffb95f]"}),e.jsx("span",{children:"互评量规"})]}),e.jsxs("button",{type:"button",onClick:o,className:`flex items-center gap-1.5 px-3 py-1.5 rounded-xl transition-colors text-xs font-medium border ${s.showDanmaku?"bg-[#00a572]/20 border-[#00a572]/40 text-[#4edea3]":"bg-[#171f33] border-[#2d3449]/50 text-[#c7c4d7] hover:text-[#dae2fd]"}`,title:"开关大屏弹幕墙",children:[e.jsx(Yr,{size:15,className:"text-[#4edea3]"}),e.jsx("span",{children:"全员语音弹幕"})]}),e.jsxs("button",{type:"button",onClick:a,className:"flex items-center gap-2 px-3.5 py-1.5 rounded-xl bg-[#c0c1ff] text-[#1000a9] hover:bg-[#8083ff] hover:text-white transition-all shadow-sm text-xs font-semibold",children:[e.jsx(Re,{size:15}),e.jsx("span",{children:"揭晓勋章榜"}),e.jsx("span",{className:"font-mono text-[10px] bg-[#1000a9]/15 px-1 py-0.5 rounded leading-none",children:"Enter"})]}),e.jsx(oe,{slot:"peer_review.action"}),x&&e.jsx("button",{type:"button",onClick:x,className:"p-1.5 rounded-xl text-[#c7c4d7] hover:text-white hover:bg-[#222a3d] transition-colors ml-1",title:c?"退出全屏":"全屏展示",children:c?e.jsx(Zr,{size:16}):e.jsx(er,{size:16})}),d&&e.jsx("button",{type:"button",onClick:d,className:"p-1.5 rounded-xl text-[#ffb4ab] hover:text-white hover:bg-[#93000a]/50 transition-colors ml-1",title:"关闭大屏互评",children:e.jsx(be,{size:16})})]})]})},Pa=({matchingItems:s,badges:i,isAnonymous:n=!1,onSelectMatchingItem:o})=>{const a=(t,r)=>!r||t.length<=1?t:`${t[0]}**`;return e.jsxs("div",{id:"peer-review-matrix-panel",className:"flex flex-col gap-4 w-full select-none",children:[e.jsxs("div",{className:"bg-[#131b2e] p-4 rounded-xl border border-[#2d3449]/60 flex flex-col gap-2.5",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:"w-7 h-7 rounded-lg bg-[#c0c1ff]/15 flex items-center justify-center text-[#c0c1ff]",children:e.jsx(ds,{size:16})}),e.jsx("h2",{className:"text-sm font-semibold text-[#dae2fd]",children:"智能交叉互评"})]}),e.jsx("span",{className:"px-2 py-0.5 rounded bg-[#8083ff]/20 text-[#c0c1ff] font-mono text-[10px] font-semibold",children:"1生评2份"})]}),e.jsx("p",{className:"text-xs text-[#c7c4d7] leading-relaxed",children:"分层对调机制:将满分逻辑范本与攻坚调试作业交叉分发,激发逆向审阅与自愈思考。"})]}),e.jsxs("div",{className:"bg-[#131b2e] p-4 rounded-xl border border-[#2d3449]/60 flex flex-col gap-3",children:[e.jsxs("div",{className:"flex items-center justify-between text-xs",children:[e.jsx("span",{className:"text-[#908fa0] font-mono text-[10px] font-semibold",children:"PEER MATCHING REALTIME"}),e.jsxs("span",{className:"text-[#4edea3] font-mono text-[11px] flex items-center gap-1",children:[e.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-[#4edea3] animate-pulse"})," 实时同步中"]})]}),e.jsx("div",{className:"flex flex-col gap-2.5 max-h-[380px] overflow-y-auto pr-0.5",children:s.map(t=>{const r=a(t.reviewerName,n),c=a(t.targetStudentName,n);return e.jsxs("div",{onClick:()=>o?.(t),className:`p-3 rounded-lg border transition-all cursor-pointer ${t.status==="submitted"?"bg-[#222a3d] border-[#4edea3]/40 shadow-sm":"bg-[#171f33] border-[#2d3449]/60 hover:bg-[#222a3d] hover:border-[#464554]"}`,children:[e.jsxs("div",{className:"flex items-center justify-between mb-1.5",children:[e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx("span",{className:"font-mono text-[11px] text-[#ffb95f] font-semibold",children:t.code}),e.jsxs("span",{className:"text-xs text-[#dae2fd] font-semibold truncate max-w-[130px]",children:[r," ",t.reviewerGroup?`(${t.reviewerGroup})`:""]})]}),t.status==="submitted"&&e.jsx("span",{className:"text-[10px] font-mono px-1.5 py-0.5 rounded bg-[#00a572]/20 text-[#4edea3]",children:"已提交评语"}),t.status==="in_progress"&&e.jsx("span",{className:"text-[10px] font-mono px-1.5 py-0.5 rounded bg-[#ca8100]/20 text-[#ffb95f] animate-pulse",children:"正在推导 (2/3)"}),t.status==="completed"&&e.jsxs("span",{className:"text-[10px] font-mono px-1.5 py-0.5 rounded bg-[#00a572]/20 text-[#4edea3] flex items-center gap-1",children:[e.jsx(je,{size:10})," 已完成"]}),t.status==="improvement"&&e.jsx("span",{className:"text-[10px] font-mono px-1.5 py-0.5 rounded bg-[#c0c1ff]/20 text-[#c0c1ff]",children:"提出改进建议 💡"})]}),e.jsxs("div",{className:"flex items-center gap-1.5 text-xs text-[#c7c4d7] mb-1.5",children:[e.jsx(ht,{size:12,className:"text-[#908fa0] shrink-0"}),e.jsxs("span",{className:"text-[#c0c1ff] font-medium truncate",children:[c," · ",t.targetWorkTitle]})]}),t.comment&&e.jsxs("div",{className:"bg-[#060e20] p-2 rounded text-xs text-[#c7c4d7] italic border border-[#2d3449]/40 mb-1.5 leading-relaxed",children:['"',t.comment,'"']}),t.progressPercent!==void 0&&t.status==="in_progress"&&e.jsx("div",{className:"w-full bg-[#2d3449] h-1 rounded-full mt-2 overflow-hidden",children:e.jsx("div",{className:"bg-[#ffb95f] h-full rounded-full transition-all duration-300",style:{width:`${t.progressPercent}%`}})}),t.stars!==void 0&&e.jsxs("div",{className:"flex items-center justify-between mt-1.5 pt-1.5 border-t border-[#2d3449]/50",children:[e.jsx("div",{className:"flex text-[#ffb95f]",children:Array.from({length:5}).map((x,d)=>e.jsx(rt,{size:13,className:d<t.stars?"text-[#ffb95f] fill-[#ffb95f]":"text-[#464554]"},d))}),e.jsxs("span",{className:"text-[10px] font-mono text-[#908fa0]",children:[t.score?.toFixed(1)||"5.0"," / ",t.maxScore||"5.0"]})]})]},t.id)})})]}),e.jsxs("div",{className:"bg-[#131b2e] p-4 rounded-xl border border-[#2d3449]/60 flex flex-col gap-2.5",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{className:"text-[10px] font-mono font-semibold text-[#908fa0]",children:"LIVE PEER BADGE STREAM"}),e.jsx(Ge,{size:14,className:"text-[#908fa0]"})]}),e.jsx("div",{className:"flex flex-col gap-2 overflow-hidden",children:i.map(t=>e.jsxs("div",{className:"flex items-center gap-2 p-2 rounded-lg bg-[#171f33] border border-[#2d3449]/50 text-xs text-[#dae2fd]",children:[e.jsx("span",{className:"text-sm shrink-0",children:t.emoji}),e.jsxs("div",{className:"truncate",children:[e.jsx("span",{className:"text-[#4edea3] font-medium",children:a(t.senderName,n)}),e.jsx("span",{className:"text-[#c7c4d7] mx-1",children:"为"}),e.jsx("span",{className:"text-[#c0c1ff] font-medium",children:a(t.receiverName,n)}),e.jsx("span",{className:"ml-1 px-1.5 py-0.5 bg-[#222a3d] rounded text-[10px] font-mono text-[#ffb95f]",children:t.badgeTitle})]})]},t.id))}),e.jsx(oe,{slot:"peer_review.badge"})]})]})},Ra=({workA:s,workB:i,annotations:n,isAnonymous:o=!1,onFullscreenCanvas:a,onSyncSandboxToClass:t,onAddAnnotation:r})=>{const[c,x]=l.useState("visual"),[d,m]=l.useState(!1),[u,v]=l.useState(""),N=(p,j)=>!j||p.length<=1?p:`${p[0]}**`,g=p=>{p.preventDefault(),u.trim()&&(r?.(u.trim()),v(""),m(!1))};return e.jsxs("div",{id:"spotlight-dual-work-arena",className:"flex flex-col gap-4 w-full select-none",children:[e.jsxs("div",{className:"bg-[#131b2e] p-4 rounded-xl border border-[#2d3449]/60 flex flex-wrap items-center justify-between gap-3 shadow-md",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"w-9 h-9 rounded-xl bg-[#8083ff]/20 flex items-center justify-center text-[#c0c1ff] border border-[#8083ff]/30",children:e.jsx(xs,{size:20})}),e.jsxs("div",{className:"flex flex-col",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("h1",{className:"text-base font-bold text-[#dae2fd]",children:"大屏焦点作品对比赏析"}),e.jsxs("span",{className:"px-2 py-0.5 rounded bg-[#ca8100]/20 text-[#ffb95f] font-mono text-[10px] font-semibold flex items-center gap-1 border border-[#ca8100]/30",children:[e.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-[#ffb95f] animate-ping"}),"教师激光笔协同标记中"]})]}),e.jsxs("span",{className:"text-xs text-[#c7c4d7] mt-0.5",children:["标杆创新解法 (",N(s.studentName,o),") ⟷ 经典逆风翻盘解法 (",N(i.studentName,o),")"]})]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[t&&e.jsxs("button",{type:"button",onClick:t,className:"flex items-center gap-1.5 px-3 py-1.5 rounded-lg bg-[#171f33] hover:bg-[#222a3d] text-[#c7c4d7] hover:text-white border border-[#2d3449]/60 transition-colors text-xs font-medium",title:"将对比沙箱推送到全班学生机",children:[e.jsx(ms,{size:14,className:"text-[#4edea3]"}),e.jsx("span",{children:"同步沙箱至全班"})]}),a&&e.jsx("button",{type:"button",onClick:a,className:"p-2 rounded-lg bg-[#171f33] hover:bg-[#222a3d] text-[#c7c4d7] hover:text-white border border-[#2d3449]/60 transition-colors",title:"全屏沉浸投影",children:e.jsx(er,{size:16})})]})]}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[e.jsxs("div",{className:"bg-[#131b2e] rounded-xl p-4 flex flex-col gap-3 border border-[#2d3449]/60 shadow-md relative",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-2.5",children:[e.jsx("div",{className:"w-8 h-8 rounded-full bg-[#8083ff] text-white flex items-center justify-center font-bold text-xs shadow-sm",children:o?"A":s.studentInitial}),e.jsxs("div",{className:"flex flex-col",children:[e.jsxs("span",{className:"text-sm font-semibold text-[#dae2fd]",children:[N(s.studentName,o)," (作品 A)"]}),e.jsx("span",{className:"text-[11px] font-mono text-[#908fa0]",children:s.workSubtitle})]})]}),e.jsxs("div",{className:"flex items-center gap-1 px-2 py-0.5 rounded bg-[#ca8100]/20 text-[#ffb95f] border border-[#ca8100]/30",children:[e.jsx(rt,{size:13,className:"text-[#ffb95f] fill-[#ffb95f]"}),e.jsx("span",{className:"font-mono text-xs font-semibold",children:typeof s.rating=="number"?s.rating.toFixed(1):"—"}),e.jsxs("span",{className:"text-[10px] text-[#908fa0]",children:["(",s.reviewCount??0,"评)"]})]})]}),e.jsx("div",{className:"flex flex-wrap gap-1.5",children:s.badges.map((p,j)=>e.jsx("span",{className:`px-2 py-0.5 rounded text-[10px] font-mono font-medium ${p.colorClass}`,children:p.label},j))}),e.jsxs("div",{className:"w-full h-44 rounded-lg bg-[#060e20] flex items-center justify-center relative overflow-hidden border border-[#2d3449]/60 group",children:[e.jsxs("svg",{className:"w-36 h-36 transform -rotate-12 transition-transform duration-700 group-hover:scale-110",viewBox:"0 0 100 100",children:[e.jsx("polygon",{points:"50,10 88,38 73,82 27,82 12,38",fill:"none",stroke:"#c0c1ff",strokeWidth:"1.2",opacity:"0.3"}),e.jsx("polygon",{points:"50,15 84,39 71,78 29,78 16,39",fill:"none",stroke:"#8083ff",strokeWidth:"1.4",opacity:"0.5",transform:"rotate(10 50 50)"}),e.jsx("polygon",{points:"50,20 80,41 68,74 32,74 20,41",fill:"none",stroke:"#4edea3",strokeWidth:"1.6",opacity:"0.7",transform:"rotate(22 50 50)"}),e.jsx("polygon",{points:"50,26 76,43 65,70 35,70 24,43",fill:"none",stroke:"#ffb95f",strokeWidth:"1.8",opacity:"0.85",transform:"rotate(35 50 50)"}),e.jsx("polygon",{points:"50,32 72,45 63,66 37,66 28,45",fill:"none",stroke:"#c0c1ff",strokeWidth:"2.2",opacity:"1.0",transform:"rotate(50 50 50)"}),e.jsx("circle",{cx:"50",cy:"50",r:"3",fill:"#4edea3"})]}),e.jsx("span",{className:"absolute bottom-2 right-2 text-[10px] font-mono text-[#908fa0] bg-[#131b2e]/90 px-1.5 py-0.5 rounded border border-[#2d3449]/50",children:s.visualBadgeText})]}),e.jsxs("div",{className:"bg-[#060e20] rounded-lg p-3 font-mono text-[11px] leading-5 border border-[#2d3449]/60 overflow-x-auto text-[#dae2fd]",children:[e.jsxs("div",{className:"text-[#908fa0] mb-1",children:["# ",s.codeTitle??""]}),(s.codeLines??[]).map((p,j)=>e.jsxs("div",{className:`${p.isHighlight?"bg-[#8083ff]/20 px-1 rounded -mx-1 text-[#dae2fd]":""}`,style:{paddingLeft:`${(p.indent||0)*12}px`},children:[e.jsx("span",{children:p.text}),p.comment&&e.jsx("span",{className:"text-[#908fa0] ml-2",children:p.comment})]},j))]})]}),e.jsxs("div",{className:"bg-[#131b2e] rounded-xl p-4 flex flex-col gap-3 border border-[#2d3449]/60 shadow-md relative",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-2.5",children:[e.jsx("div",{className:"w-8 h-8 rounded-full bg-[#00a572] text-white flex items-center justify-center font-bold text-xs shadow-sm",children:o?"B":i.studentInitial}),e.jsxs("div",{className:"flex flex-col",children:[e.jsxs("span",{className:"text-sm font-semibold text-[#dae2fd]",children:[N(i.studentName,o)," (作品 B)"]}),e.jsx("span",{className:"text-[11px] font-mono text-[#908fa0]",children:i.workSubtitle})]})]}),e.jsxs("div",{className:"flex items-center gap-1 px-2 py-0.5 rounded bg-[#ca8100]/20 text-[#ffb95f] border border-[#ca8100]/30",children:[e.jsx(rt,{size:13,className:"text-[#ffb95f] fill-[#ffb95f]"}),e.jsx("span",{className:"font-mono text-xs font-semibold",children:typeof i.rating=="number"?i.rating.toFixed(1):"—"}),e.jsxs("span",{className:"text-[10px] text-[#908fa0]",children:["(",i.reviewCount??0,"评)"]})]})]}),e.jsx("div",{className:"flex flex-wrap gap-1.5",children:i.badges.map((p,j)=>e.jsx("span",{className:`px-2 py-0.5 rounded text-[10px] font-mono font-medium ${p.colorClass}`,children:p.label},j))}),e.jsxs("div",{className:"w-full h-44 rounded-lg bg-[#060e20] flex items-center justify-center relative overflow-hidden border border-[#2d3449]/60 group",children:[e.jsxs("svg",{className:"w-36 h-36 transition-transform duration-700 group-hover:scale-110",viewBox:"0 0 100 100",children:[e.jsx("circle",{cx:"50",cy:"50",r:"42",fill:"none",stroke:"#2d3449",strokeWidth:"1"}),e.jsx("rect",{x:"25",y:"25",width:"50",height:"50",fill:"none",stroke:"#4edea3",strokeWidth:"1.8",transform:"rotate(0 50 50)"}),e.jsx("rect",{x:"25",y:"25",width:"50",height:"50",fill:"none",stroke:"#6ffbbe",strokeWidth:"1.8",opacity:"0.8",transform:"rotate(18 50 50)"}),e.jsx("rect",{x:"25",y:"25",width:"50",height:"50",fill:"none",stroke:"#ffb95f",strokeWidth:"1.8",opacity:"0.7",transform:"rotate(36 50 50)"}),e.jsx("rect",{x:"25",y:"25",width:"50",height:"50",fill:"none",stroke:"#c0c1ff",strokeWidth:"1.8",opacity:"0.6",transform:"rotate(54 50 50)"}),e.jsx("circle",{cx:"50",cy:"50",r:"3",fill:"#ffb95f"})]}),e.jsxs("span",{className:"absolute bottom-2 right-2 text-[10px] font-mono text-[#4edea3] bg-[#131b2e]/90 px-1.5 py-0.5 rounded border border-[#2d3449]/50 flex items-center gap-1",children:[e.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-[#4edea3]"}),i.visualBadgeText]})]}),e.jsxs("div",{className:"bg-[#060e20] rounded-lg p-3 font-mono text-[11px] leading-5 border border-[#2d3449]/60 overflow-x-auto text-[#dae2fd]",children:[e.jsxs("div",{className:"text-[#908fa0] mb-1",children:["# ",i.codeTitle??""]}),(i.codeLines??[]).map((p,j)=>e.jsxs("div",{className:`${p.isSuccess?"bg-[#00a572]/20 px-1 rounded -mx-1 text-[#4edea3] font-medium":""}`,style:{paddingLeft:`${(p.indent||0)*12}px`},children:[e.jsx("span",{children:p.text}),p.comment&&e.jsx("span",{className:"text-[#4edea3] text-[10px] ml-2",children:p.comment})]},j))]})]})]}),e.jsxs("div",{className:"bg-[#131b2e] rounded-xl p-4 flex flex-col gap-3 border border-[#2d3449]/60 shadow-md",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(tr,{size:16,className:"text-[#ffb95f]"}),e.jsx("span",{className:"text-xs font-semibold text-[#dae2fd]",children:"协同板书标注与点评审阅"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("span",{className:"text-[10px] font-mono text-[#908fa0]",children:[n.length," 条实时批注挂载"]}),r&&e.jsx("button",{type:"button",onClick:()=>m(!d),className:"text-[11px] text-[#c0c1ff] hover:text-white font-medium transition-colors",children:d?"取消批注":"+ 追加教师批注"})]})]}),d&&e.jsxs("form",{onSubmit:g,className:"flex gap-2",children:[e.jsx("input",{type:"text",value:u,onChange:p=>v(p.target.value),placeholder:"输入大屏协同批注要点...",className:"flex-1 px-3 py-1.5 rounded-lg bg-[#060e20] border border-[#2d3449] text-xs text-[#dae2fd] placeholder-[#908fa0] focus:outline-none focus:border-[#8083ff]"}),e.jsx("button",{type:"submit",className:"px-3 py-1.5 rounded-lg bg-[#c0c1ff] text-[#1000a9] font-semibold text-xs hover:bg-[#8083ff] hover:text-white transition-colors",children:"发送批注"})]}),e.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-3",children:n.map(p=>e.jsxs("div",{className:"bg-[#171f33] p-3 rounded-lg flex flex-col gap-1.5 relative overflow-hidden border border-[#2d3449]/50",children:[e.jsx("div",{className:"w-1 absolute left-0 top-0 bottom-0",style:{backgroundColor:p.borderColor}}),e.jsxs("div",{className:"flex items-center justify-between pl-2",children:[e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx("span",{className:`px-1.5 py-0.5 rounded text-[10px] font-mono font-bold ${p.authorType==="teacher"?"bg-[#8083ff] text-white":"bg-[#00a572] text-white"}`,children:p.authorRole}),e.jsx("span",{className:"text-xs font-semibold text-[#dae2fd]",children:N(p.authorName,o)})]}),e.jsx("span",{className:"text-[10px] font-mono text-[#908fa0]",children:p.timeAgo})]}),e.jsx("p",{className:"text-xs text-[#dae2fd] pl-2 leading-relaxed",children:p.content})]},p.id))})]}),e.jsx(oe,{slot:"peer_review.showcase.widget"})]})},_a=({dimensions:s,averagePercentage:i,reactions:n,onReactionClick:o,syncedStudentsCount:a=32})=>e.jsxs("div",{id:"peer-review-rubric-stats",className:"bg-[#131b2e] rounded-xl p-4 flex flex-col gap-4 border border-[#2d3449]/60 shadow-md select-none w-full",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{className:"text-xs font-semibold text-[#dae2fd]",children:"全班三维量规综合达标率"}),e.jsxs("span",{className:"text-[11px] font-mono text-[#4edea3] font-semibold",children:["AVERAGE: ",i.toFixed(1),"%"]})]}),e.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-3 gap-3",children:s.map(t=>e.jsxs("div",{className:"bg-[#171f33] p-2.5 rounded-lg flex flex-col gap-1.5 border border-[#2d3449]/50",children:[e.jsxs("div",{className:"flex justify-between text-xs",children:[e.jsx("span",{className:"text-[#908fa0] truncate",children:t.label}),e.jsxs("span",{className:`font-mono font-medium ${t.colorClass}`,children:[t.percentage,"%"]})]}),e.jsx("div",{className:"w-full bg-[#2d3449] h-1.5 rounded-full overflow-hidden",children:e.jsx("div",{className:`h-full rounded-full transition-all duration-500 ${t.barColorClass}`,style:{width:`${t.percentage}%`}})})]},t.id))}),e.jsx(oe,{slot:"peer_review.rubric.dimension"}),e.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3 pt-1 border-t border-[#2d3449]/40",children:[e.jsx("div",{className:"flex items-center gap-2",children:n.map(t=>e.jsxs("button",{type:"button",onClick:()=>o?.(t.id),className:"flex items-center gap-1.5 px-3 py-1 rounded-full bg-[#171f33] hover:bg-[#222a3d] border border-[#2d3449]/60 transition-all text-xs text-[#dae2fd] active:scale-95 group",children:[e.jsx("span",{children:t.emoji}),e.jsx("span",{className:"font-medium group-hover:text-white",children:t.label}),e.jsxs("span",{className:`font-mono font-semibold ${t.colorClass}`,children:["+",t.count]})]},t.id))}),e.jsxs("span",{className:"text-[10px] font-mono text-[#908fa0] flex items-center gap-1",children:[e.jsx(Mt,{size:13,className:"text-[#4edea3]"}),a,"台学生端已同步点赞动画"]})]})]}),Ma=({podiumStudents:s,isAnonymous:i=!1,onAwardPeerReviewPoints:n,onArchiveTopWorks:o,onCallStudentMic:a,onInviteScreenShare:t,onAdvanceToStage3:r})=>{const c=(x,d)=>!d||x.length<=1?x:`${x[0]}**`;return e.jsxs("div",{id:"peer-review-leaderboard-panel",className:"flex flex-col gap-4 w-full select-none",children:[e.jsxs("div",{className:"bg-[#131b2e] p-4 rounded-xl border border-[#2d3449]/60 flex flex-col gap-3 shadow-md",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Oe,{size:18,className:"text-[#ffb95f]"}),e.jsx("h2",{className:"text-sm font-semibold text-[#dae2fd]",children:"互评推荐先锋榜"})]}),e.jsx("span",{className:"text-[10px] font-mono text-[#908fa0] font-semibold",children:"TOP NOMINATED"})]}),e.jsx("div",{className:"flex flex-col gap-2.5",children:s.map(x=>e.jsxs("div",{className:`p-3 rounded-lg border transition-all ${x.rank===1?"bg-[#222a3d] border-[#ffb95f]/40 shadow-sm":"bg-[#171f33] border-[#2d3449]/50 hover:bg-[#222a3d]"} flex flex-col gap-1.5`,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-5 h-5 rounded-full font-mono text-[11px] font-bold flex items-center justify-center ${x.rankBadgeClass}`,children:x.rank}),e.jsx("span",{className:"text-xs font-semibold text-[#dae2fd]",children:c(x.name,i)})]}),e.jsxs("span",{className:"font-mono text-xs font-semibold text-[#ffb95f]",children:[x.votes," 票推荐"]})]}),e.jsxs("div",{className:"flex items-center justify-between text-xs",children:[e.jsx("span",{className:"text-[#c7c4d7] truncate max-w-[140px]",children:x.workTitle}),e.jsx("span",{className:`px-1.5 py-0.5 rounded text-[10px] font-mono font-medium ${x.tagBadgeClass}`,children:x.honorTitle})]})]},x.rank))})]}),e.jsxs("div",{className:"bg-[#131b2e] p-4 rounded-xl border border-[#2d3449]/60 flex flex-col gap-3 shadow-md",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{className:"text-xs font-semibold text-[#dae2fd]",children:"随堂微勋章即时分发箱"}),e.jsx(Re,{size:15,className:"text-[#4edea3]"})]}),e.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsxs("button",{type:"button",onClick:n,className:"w-full flex items-center justify-between px-3 py-2 rounded-lg bg-[#171f33] hover:bg-[#222a3d] border border-[#2d3449]/50 text-[#dae2fd] transition-colors text-xs text-left",children:[e.jsxs("span",{className:"flex items-center gap-2",children:[e.jsx(fe,{size:14,className:"text-[#ffb95f]"}),e.jsx("span",{children:"为全员互评认真学生 +2 积分"})]}),e.jsx("span",{className:"font-mono text-[10px] text-[#4edea3] font-semibold bg-[#00a572]/20 px-1.5 py-0.5 rounded",children:"一键发放"})]}),e.jsxs("button",{type:"button",onClick:o,className:"w-full flex items-center justify-between px-3 py-2 rounded-lg bg-[#171f33] hover:bg-[#222a3d] border border-[#2d3449]/50 text-[#dae2fd] transition-colors text-xs text-left",children:[e.jsxs("span",{className:"flex items-center gap-2",children:[e.jsx(ot,{size:14,className:"text-[#c0c1ff]"}),e.jsx("span",{children:"TOP 2 优秀代码入库数字馆"})]}),e.jsx("span",{className:"font-mono text-[10px] text-[#c0c1ff] font-semibold bg-[#8083ff]/20 px-1.5 py-0.5 rounded",children:"入库归档"})]})]})]}),e.jsxs("div",{className:"bg-[#131b2e] p-4 rounded-xl border border-[#2d3449]/60 flex flex-col gap-3 shadow-md",children:[e.jsx("span",{className:"text-[10px] font-mono text-[#908fa0] font-semibold",children:"TEACHER BROADCAST & STAGE TRANSITION"}),e.jsx("div",{className:"flex flex-col gap-2",children:(()=>{const x=s[0]?.name,d=s[1]?.name??x;return e.jsxs(e.Fragment,{children:[e.jsxs("button",{type:"button",disabled:!x,onClick:()=>x&&a(x),className:"w-full flex items-center justify-between px-3 py-2 rounded-lg bg-[#171f33] hover:bg-[#222a3d] border border-[#2d3449]/50 text-[#dae2fd] transition-colors text-xs text-left disabled:opacity-40 disabled:cursor-not-allowed",children:[e.jsxs("span",{className:"flex items-center gap-2",children:[e.jsx(rs,{size:14,className:"text-[#c0c1ff]"}),e.jsx("span",{children:x?`连麦作者 ${c(x,i)} (分享思路)`:"暂无提名,无法连麦"})]}),e.jsx("span",{className:"text-[#908fa0] text-[10px] font-mono",children:"连线"})]}),e.jsxs("button",{type:"button",disabled:!d,onClick:()=>d&&t(d),className:"w-full flex items-center justify-between px-3 py-2 rounded-lg bg-[#171f33] hover:bg-[#222a3d] border border-[#2d3449]/50 text-[#dae2fd] transition-colors text-xs text-left disabled:opacity-40 disabled:cursor-not-allowed",children:[e.jsxs("span",{className:"flex items-center gap-2",children:[e.jsx(Ys,{size:14,className:"text-[#4edea3]"}),e.jsx("span",{children:d?`邀请 ${c(d,i)} 投屏分享`:"暂无提名,无法投屏"})]}),e.jsx("span",{className:"text-[#908fa0] text-[10px] font-mono",children:"邀请"})]})]})})()}),e.jsx(oe,{slot:"peer_review.action"}),e.jsxs("div",{className:"pt-2",children:[e.jsxs("button",{type:"button",onClick:r,className:"w-full flex items-center justify-center gap-2 py-3 px-4 rounded-xl bg-[#c0c1ff] text-[#1000a9] hover:bg-[#8083ff] hover:text-white transition-all shadow-md group font-semibold text-xs text-center",children:[e.jsx("span",{children:"结束互评,公布全堂总积分榜与学情报告"}),e.jsx(ht,{size:14,className:"group-hover:translate-x-1 transition-transform"})]}),e.jsx("div",{className:"text-center mt-2",children:e.jsx("span",{className:"text-[10px] font-mono text-[#908fa0]",children:"HOTKEY: PRESS ENTER TO ADVANCE TO STAGE 03"})})]})]})]})},Ia=({isVisible:s,danmakuList:i,onSendDanmaku:n,isAnonymous:o=!1})=>{const[a,t]=l.useState(""),[r,c]=l.useState(!1);if(!s)return null;const x=m=>{m.preventDefault(),a.trim()&&(n?.(a.trim(),"text"),t(""))},d=()=>{n?.("语音弹幕 · 点赞神仙算法!","voice")};return e.jsxs("div",{id:"peer-review-danmaku-overlay",className:"absolute inset-0 pointer-events-none overflow-hidden z-20",children:[i.map(m=>e.jsx("div",{className:"absolute whitespace-nowrap animate-danmaku-slide pointer-events-auto",style:{top:`${m.topPercent}%`,right:"-100%"},children:e.jsxs("div",{className:"flex items-center gap-1.5 px-3 py-1 rounded-full bg-[#131b2e]/85 backdrop-blur-md border border-[#2d3449] shadow-lg text-xs text-[#dae2fd]",children:[m.type==="voice"?e.jsxs("span",{className:"flex items-center gap-1 text-[#4edea3] font-mono text-[11px]",children:[e.jsx(rs,{size:12,className:"animate-pulse"}),e.jsxs("span",{children:[m.voiceDuration||3,"s"]})]}):e.jsx("span",{className:"text-sm",children:"💬"}),e.jsxs("span",{className:"text-[#c0c1ff] font-medium",children:[o&&m.sender.length>1?`${m.sender[0]}**`:m.sender,":"]}),e.jsx("span",{className:m.color||"text-white",children:m.text})]})},m.id)),e.jsx("div",{className:"absolute bottom-4 right-4 pointer-events-auto flex items-center gap-2",children:r?e.jsxs("form",{onSubmit:x,className:"flex items-center gap-1.5 bg-[#131b2e]/95 backdrop-blur-md border border-[#2d3449] p-1.5 rounded-full shadow-xl",children:[e.jsx("input",{type:"text",value:a,onChange:m=>t(m.target.value),placeholder:"发送大屏实时弹幕...",className:"bg-transparent px-3 py-1 text-xs text-white placeholder-[#908fa0] focus:outline-none w-48"}),e.jsx("button",{type:"submit",className:"p-1.5 rounded-full bg-[#c0c1ff] text-[#1000a9] hover:bg-white transition-colors",title:"发送",children:e.jsx(De,{size:13})}),e.jsx("button",{type:"button",onClick:d,className:"p-1.5 rounded-full bg-[#171f33] hover:bg-[#222a3d] text-[#4edea3] transition-colors",title:"发送语音弹幕",children:e.jsx(rs,{size:13})}),e.jsx("button",{type:"button",onClick:()=>c(!1),className:"px-2 text-xs text-[#908fa0] hover:text-white",children:"收起"})]}):e.jsxs("button",{type:"button",onClick:()=>c(!0),className:"flex items-center gap-1.5 px-3 py-1.5 rounded-full bg-[#131b2e]/90 hover:bg-[#222a3d] backdrop-blur-md border border-[#2d3449] text-xs text-[#c7c4d7] hover:text-white shadow-lg transition-colors cursor-pointer",children:[e.jsx(hs,{size:13,className:"text-[#c0c1ff]"}),e.jsx("span",{children:"发弹幕"})]})})]})},Da=({isOpen:s,onClose:i})=>s?e.jsx("div",{id:"peer-review-rubric-modal",className:"fixed inset-0 z-50 flex items-center justify-center bg-black/70 backdrop-blur-sm p-4 select-none",children:e.jsxs("div",{className:"bg-[#131b2e] border border-[#2d3449] rounded-2xl w-full max-w-2xl shadow-2xl overflow-hidden flex flex-col max-h-[85vh]",children:[e.jsxs("div",{className:"px-6 py-4 bg-[#171f33] border-b border-[#2d3449] flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"w-8 h-8 rounded-xl bg-[#ca8100]/20 text-[#ffb95f] flex items-center justify-center border border-[#ca8100]/30",children:e.jsx(Xs,{size:18})}),e.jsxs("div",{children:[e.jsx("h2",{className:"text-sm font-bold text-[#dae2fd]",children:"随堂交叉互评量规细则"}),e.jsx("p",{className:"text-[11px] text-[#908fa0]",children:"三维评价基准 · 激励互助逆向思考"})]})]}),e.jsx("button",{type:"button",onClick:i,className:"p-1.5 rounded-lg text-[#908fa0] hover:text-white hover:bg-[#222a3d] transition-colors",children:e.jsx(be,{size:18})})]}),e.jsxs("div",{className:"p-6 flex flex-col gap-4 overflow-y-auto",children:[e.jsxs("div",{className:"bg-[#171f33] rounded-xl p-4 border border-[#2d3449]/60 flex flex-col gap-2",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-lg bg-[#8083ff]/20 text-[#c0c1ff] font-mono text-xs font-bold flex items-center justify-center",children:"1"}),e.jsx("span",{className:"text-sm font-semibold text-[#dae2fd]",children:"算法逻辑正确性 (40% 权重)"})]}),e.jsx("span",{className:"text-[10px] font-mono text-[#4edea3] bg-[#00a572]/20 px-2 py-0.5 rounded",children:"全班达标率 98%"})]}),e.jsxs("ul",{className:"text-xs text-[#c7c4d7] space-y-1.5 pl-8 list-disc",children:[e.jsxs("li",{children:[e.jsx("strong",{className:"text-white",children:"5.0分(优秀):"}),"算法逻辑自适应,无死循环或边界越界,自适应笔触与角度动态计算完全闭合。"]}),e.jsxs("li",{children:[e.jsx("strong",{className:"text-white",children:"4.0分(良好):"}),"核心功能正常,少数极端情况存在未自增或微小卡顿。"]}),e.jsxs("li",{children:[e.jsx("strong",{className:"text-white",children:"3.0分(需改进):"}),"存在语法报错或死循环,需在互评中指明行号与修复要点。"]})]})]}),e.jsxs("div",{className:"bg-[#171f33] rounded-xl p-4 border border-[#2d3449]/60 flex flex-col gap-2",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-lg bg-[#00a572]/20 text-[#4edea3] font-mono text-xs font-bold flex items-center justify-center",children:"2"}),e.jsx("span",{className:"text-sm font-semibold text-[#dae2fd]",children:"代码规范与缩进 (30% 权重)"})]}),e.jsx("span",{className:"text-[10px] font-mono text-[#4edea3] bg-[#00a572]/20 px-2 py-0.5 rounded",children:"全班达标率 96%"})]}),e.jsxs("ul",{className:"text-xs text-[#c7c4d7] space-y-1.5 pl-8 list-disc",children:[e.jsxs("li",{children:[e.jsx("strong",{className:"text-white",children:"5.0分(优秀):"}),"遵循 PEP8 规范,严格对齐 4 空格缩进,变量语义化规范清晰,关键算子附有说明注释。"]}),e.jsxs("li",{children:[e.jsx("strong",{className:"text-white",children:"4.0分(良好):"}),"缩进基本统一,可读性良好。"]}),e.jsxs("li",{children:[e.jsx("strong",{className:"text-white",children:"3.0分(需改进):"}),"Tab 与空格混用,循环体代码未有效缩进。"]})]})]}),e.jsxs("div",{className:"bg-[#171f33] rounded-xl p-4 border border-[#2d3449]/60 flex flex-col gap-2",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-lg bg-[#ca8100]/20 text-[#ffb95f] font-mono text-xs font-bold flex items-center justify-center",children:"3"}),e.jsx("span",{className:"text-sm font-semibold text-[#dae2fd]",children:"创意美感与拓展 (30% 权重)"})]}),e.jsx("span",{className:"text-[10px] font-mono text-[#ffb95f] bg-[#ca8100]/20 px-2 py-0.5 rounded",children:"全班达标率 92%"})]}),e.jsxs("ul",{className:"text-xs text-[#c7c4d7] space-y-1.5 pl-8 list-disc",children:[e.jsxs("li",{children:[e.jsx("strong",{className:"text-white",children:"5.0分(优秀):"}),"巧妙运用数学模运算(`i % 3`)或外角定理,呈现层次丰富的动态发散图形。"]}),e.jsxs("li",{children:[e.jsx("strong",{className:"text-white",children:"4.0分(良好):"}),"图形规则美观,配色和谐。"]}),e.jsxs("li",{children:[e.jsx("strong",{className:"text-white",children:"3.0分(需改进):"}),"单色基础图形,未探索步长或角度变化。"]})]})]}),e.jsx(oe,{slot:"peer_review.rubric.dimension"})]}),e.jsx("div",{className:"px-6 py-3 bg-[#171f33] border-t border-[#2d3449] flex justify-end",children:e.jsx("button",{type:"button",onClick:i,className:"px-4 py-1.5 rounded-xl bg-[#c0c1ff] text-[#1000a9] font-semibold text-xs hover:bg-white transition-colors",children:"我已知晓"})})]})}):null,gr=({isOpen:s,onClose:i,onAdvanceToStage3:n,lessonTitle:o="",addToast:a,workA:t,workB:r,reviewProgress:c,countdownSeconds:x,onAutoAssign:d,autoAssigning:m=!1,matchingItems:u,badges:v,annotations:N,rubricDimensions:g,reactions:p,podiumStudents:j,danmaku:k})=>{const[w,f]=l.useState({stage:"STAGE 02.4",isLocked:!0,isDualScreen:!0,isAnonymous:!0,timeRemainingSeconds:x??0,totalTimeSeconds:x??0,isPaused:!1,completedReviews:c?.completed??0,totalStudents:c?.total??0,totalLikes:0,totalNominations:0,showVoiceDanmaku:!0,showDanmaku:!0}),[b,z]=l.useState(!1),[_,C]=l.useState(!1),[B,R]=l.useState(u??[]),[J,O]=l.useState(v??[]),[H,ee]=l.useState(t??null),[se,I]=l.useState(r??null),[V,P]=l.useState(N??[]),[y]=l.useState(g??[]),[M,$]=l.useState(p??[]),[S]=l.useState(j??[]),[E,Q]=l.useState(k??[]);l.useEffect(()=>{if(!s||w.isPaused)return;const U=setInterval(()=>{f(Z=>Z.timeRemainingSeconds<=1?{...Z,timeRemainingSeconds:0,isPaused:!0}:{...Z,timeRemainingSeconds:Z.timeRemainingSeconds-1})},1e3);return()=>clearInterval(U)},[s,w.isPaused]);const ie=l.useCallback(U=>{s&&(U.key==="Enter"?(U.preventDefault(),te()):U.key==="Escape"?(U.preventDefault(),i()):U.code==="Space"&&U.target===document.body&&(U.preventDefault(),G()))},[s,i]);if(l.useEffect(()=>(window.addEventListener("keydown",ie),()=>window.removeEventListener("keydown",ie)),[ie]),!s)return null;const pe=()=>{f(U=>({...U,isAnonymous:!U.isAnonymous})),a?.("互评模式已切换",w.isAnonymous?"已恢复显示真实学生姓名":"已开启双盲匿名评价模式","info")},ce=()=>{f(U=>({...U,timeRemainingSeconds:U.timeRemainingSeconds+60,totalTimeSeconds:U.totalTimeSeconds+60})),a?.("互评加时","倒计时已增加 1 分钟","success")},G=()=>{f(U=>({...U,isPaused:!U.isPaused}))},K=()=>{document.fullscreenElement?document.exitFullscreen&&(document.exitFullscreen().catch(()=>{}),z(!1)):(document.documentElement.requestFullscreen().catch(()=>{}),z(!0))},le=U=>{$(Z=>Z.map(T=>T.id===U?{...T,count:T.count+1}:T)),f(Z=>({...Z,totalLikes:Z.totalLikes+1}))},de=U=>{const Z={id:`ann-${Date.now()}`,authorType:"teacher",authorRole:"主讲教师",authorName:"陈老师",timeAgo:"刚刚",content:U,borderColor:"#8083ff"};P(T=>[Z,...T]),a?.("批注已挂载","协同板书批注已同步至大屏","success")},ue=(U,Z="text")=>{const T={id:`d-${Date.now()}`,sender:"主讲教师",text:U,type:Z,voiceDuration:Z==="voice"?4:void 0,topPercent:Math.floor(Math.random()*60)+15,color:"text-[#4edea3]"};Q(re=>[...re,T])},ve=()=>{a?.("微勋章已分发","已向全员认真参与互评的学生批量发放 +2 过程性积分!","success")},A=()=>{const U=[H?.studentName,se?.studentName].filter(Boolean);a?.("作品已入库",U.length>0?`${U.join(" 与 ")}的优秀作品已收录进班级数字展览馆。`:"暂无焦点作品可入库(学生尚未提交)。","success")},L=U=>{a?.("连麦请求已发起",`正在向 ${U} 的学生端发起实时语音连麦...`,"info")},Y=U=>{a?.("投屏邀请已下发",`已向 ${U} 发送大屏投屏演示邀请。`,"info")},te=()=>{a?.("互评阶段已结束","正在推进至 Stage 03 结课巡查与全堂总积分榜...","success"),n&&n(),i()};return e.jsxs("div",{id:"peer-review-showcase-modal",className:"fixed inset-0 z-[9999] bg-[#0b1326] text-[#dae2fd] flex flex-col select-none overflow-hidden font-sans",children:[e.jsx(Ta,{state:w,onToggleAnonymous:pe,onOpenRubricModal:()=>C(!0),onToggleVoiceDanmaku:()=>f(U=>({...U,showDanmaku:!U.showDanmaku})),onAdvanceStage:te,onAddMinute:ce,onTogglePauseTimer:G,isFullscreen:b,onToggleFullscreen:K,onClose:i}),e.jsxs("main",{className:"relative flex-1 overflow-y-auto w-full px-6 py-5",children:[!H&&!se&&B.length===0&&S.length===0&&e.jsxs("div",{className:"mb-4 rounded-xl border border-[#2d3449] bg-[#0b1326] px-4 py-2.5 flex items-center gap-3 text-[11px] text-[#908fa0]",children:[e.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-amber-400 shrink-0"}),e.jsx("span",{className:"flex-1",children:"本节暂无可展示的互评数据(需至少 2 份学生提交作品)。点击右侧按钮按「1 生评 2 份」自动分配。"}),d&&e.jsx("button",{type:"button",disabled:m,onClick:()=>void d(),className:"px-3 py-1 rounded-lg bg-[#8083ff] text-white text-[11px] font-bold hover:bg-[#9497ff] transition-colors disabled:opacity-50 shrink-0",children:m?"分配中…":"一键分配互评"})]}),e.jsx(Ia,{isVisible:w.showDanmaku,danmakuList:E,onSendDanmaku:ue,isAnonymous:w.isAnonymous}),e.jsxs("div",{className:"grid grid-cols-12 gap-5 items-start",children:[e.jsx("div",{className:"col-span-12 lg:col-span-3",children:e.jsx(Pa,{matchingItems:B,badges:J,isAnonymous:w.isAnonymous,onSelectMatchingItem:U=>{a?.(`查看互评明细 ${U.code}`,`${U.reviewerName} 正在审阅 ${U.targetStudentName} 的作业`,"info")}})}),e.jsxs("div",{className:"col-span-12 lg:col-span-6 flex flex-col gap-4",children:[!H&&!se&&e.jsxs("div",{className:"rounded-xl border border-dashed border-[#2d3449] bg-[#0b1326] p-6 text-center",children:[e.jsx("p",{className:"text-xs font-bold text-[#dae2fd]",children:"暂无提交作品可供对比"}),e.jsx("p",{className:"text-[10px] text-[#908fa0] mt-1",children:"学生提交课件作业后,此处将自动展示两份真实作品的并排对比。"})]}),H||se?e.jsx(Ra,{workA:H,workB:se,annotations:V,isAnonymous:w.isAnonymous,onFullscreenCanvas:K,onSyncSandboxToClass:()=>{a?.("沙箱广播已生效",`对比范本已同步至全班 ${w.totalStudents||0} 台学生机控制台`,"success")},onAddAnnotation:de}):null,e.jsx(_a,{dimensions:y,averagePercentage:95.3,reactions:M,onReactionClick:le,syncedStudentsCount:32})]}),e.jsx("div",{className:"col-span-12 lg:col-span-3",children:e.jsx(Ma,{podiumStudents:S,isAnonymous:w.isAnonymous,onAwardPeerReviewPoints:ve,onArchiveTopWorks:A,onCallStudentMic:L,onInviteScreenShare:Y,onAdvanceToStage3:te})})]})]}),e.jsx(Da,{isOpen:_,onClose:()=>C(!1)})]})};function Oa({isOpen:s,onClose:i,lessonId:n,lessonTitle:o="互动课堂",lang:a="zh"}){const[t,r]=l.useState({stage:"IN_CLASS_TEACHING",checkinCode:null,activePoll:null,activeBuzzer:null,pacing:{TOO_FAST:0,CONFUSED:0,CLEAR:0}}),[c,x]=l.useState(!1),[d,m]=l.useState(""),[u,v]=l.useState(!1);if(l.useEffect(()=>{const j=()=>{m(new Date().toLocaleTimeString([],{hour:"2-digit",minute:"2-digit",second:"2-digit"}))};j();const k=setInterval(j,1e3);return()=>clearInterval(k)},[]),l.useEffect(()=>{if(!s||!n)return;let j=!0;const k=async()=>{try{const f=await fetch(`/api/classroom/stage/${n}/data`);if(f.ok&&j){const b=await f.json();r(b)}}catch(f){console.warn("[StageDisplay] Fetch error:",f)}};k();const w=setInterval(k,2e3);return()=>{j=!1,clearInterval(w)}},[s,n]),!s)return null;const N=()=>{document.fullscreenElement?document.exitFullscreen&&(document.exitFullscreen().catch(()=>{}),x(!1)):(document.documentElement.requestFullscreen().catch(()=>{}),x(!0))},g={PRE_CLASS_READY:a==="zh"?"课前就绪 · 准备上课":"Pre-Class Preparation",IN_CLASS_TEACHING:a==="zh"?"课中授课 · 互动探索":"Interactive Teaching",WRAP_UP_EXIT_TICKET:a==="zh"?"总结提升 · 结课通票":"Wrap-Up & Exit Ticket",ARCHIVED_REPORT:a==="zh"?"下课归档 · 学情简报":"Archived Report"},p=(t.pacing.TOO_FAST||0)+(t.pacing.CONFUSED||0)+(t.pacing.CLEAR||0);return e.jsxs("div",{id:"stage-display-modal",className:"fixed inset-0 z-[9999] bg-slate-950 text-slate-100 flex flex-col select-none overflow-hidden",children:[e.jsxs("header",{className:"h-20 px-8 bg-slate-900/80 border-b border-slate-800 flex items-center justify-between backdrop-blur-md",children:[e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsxs("div",{className:"flex items-center gap-2.5 px-3 py-1.5 bg-blue-500/10 border border-blue-500/30 rounded-full text-blue-400 font-semibold text-sm",children:[e.jsx("span",{className:"w-2.5 h-2.5 rounded-full bg-blue-400 animate-ping"}),e.jsx("span",{children:a==="zh"?"大屏教学展台":"Stage Display"})]}),e.jsx("h1",{className:"text-2xl font-bold tracking-tight text-white line-clamp-1",children:o}),e.jsx("span",{className:"px-3 py-1 bg-slate-800 text-slate-300 text-xs font-mono rounded-md border border-slate-700",children:g[t.stage]||g.IN_CLASS_TEACHING})]}),e.jsxs("div",{className:"flex items-center gap-6",children:[e.jsxs("div",{className:"flex items-center gap-2 px-4 py-2 bg-slate-800/60 rounded-xl border border-slate-700/60 font-mono text-xl font-bold text-slate-200",children:[e.jsx(Le,{size:20,className:"text-blue-400"}),e.jsx("span",{children:d})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("button",{id:"stage-peer-review-toggle",type:"button",onClick:()=>v(!0),className:"flex items-center gap-1.5 px-3 py-2 bg-teal-500/20 hover:bg-teal-500/30 text-teal-300 rounded-xl transition-colors border border-teal-500/40 text-xs font-semibold cursor-pointer",title:"进入全班大屏作业互评与协同赏析模式 (Stitch 21e2dac1)",children:[e.jsx(xs,{size:15}),e.jsx("span",{children:"作业互评赏析"})]}),e.jsx("button",{id:"stage-fullscreen-toggle",onClick:N,className:"p-3 bg-slate-800 hover:bg-slate-700 text-slate-300 rounded-xl transition-colors border border-slate-700 cursor-pointer",title:c?"退出全屏":"全屏展示",children:c?e.jsx(Xr,{size:20}):e.jsx(ea,{size:20})}),e.jsx("button",{id:"stage-close-button",onClick:i,className:"p-3 bg-rose-900/40 hover:bg-rose-900/70 text-rose-300 rounded-xl transition-colors border border-rose-800/50 cursor-pointer",title:"关闭展台",children:e.jsx(be,{size:20})})]})]})]}),e.jsxs("main",{className:"flex-1 p-8 grid grid-cols-12 gap-8 overflow-y-auto",children:[e.jsxs("section",{className:"col-span-8 flex flex-col gap-6",children:[t.stage==="PRE_CLASS_READY"&&e.jsxs("div",{className:"flex-1 bg-gradient-to-br from-slate-900 to-slate-850 rounded-3xl border border-slate-800 p-10 flex flex-col justify-center items-center text-center shadow-2xl",children:[e.jsx("div",{className:"p-4 bg-blue-500/10 rounded-3xl border border-blue-500/20 text-blue-400 mb-6",children:e.jsx(It,{size:48,className:"animate-pulse"})}),e.jsx("h2",{className:"text-3xl font-extrabold text-white mb-2",children:a==="zh"?"即将开始上课,请同学们准备":"Class Starting Soon"}),e.jsx("p",{className:"text-slate-400 text-lg mb-8 max-w-md",children:a==="zh"?"请打开平板或电脑进入课堂,输入口令加入":"Please join the interactive session using your device"}),t.checkinCode&&e.jsxs("div",{className:"px-10 py-6 bg-slate-800/90 rounded-2xl border border-blue-500/40 shadow-inner flex flex-col items-center",children:[e.jsx("span",{className:"text-xs uppercase tracking-widest text-slate-400 font-bold mb-2",children:a==="zh"?"课堂入课口令":"Class Code"}),e.jsx("span",{className:"text-6xl font-mono font-black tracking-wider text-blue-400",children:t.checkinCode})]})]}),t.activePoll&&e.jsxs("div",{className:"bg-slate-900/90 rounded-3xl border border-slate-800 p-8 shadow-xl flex flex-col gap-6",children:[e.jsxs("div",{className:"flex items-center justify-between border-b border-slate-800/80 pb-4",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("span",{className:"p-2.5 bg-amber-500/10 text-amber-400 rounded-xl border border-amber-500/20",children:e.jsx(fe,{size:24})}),e.jsxs("div",{children:[e.jsx("span",{className:"text-xs font-bold text-amber-400 uppercase tracking-wide",children:a==="zh"?"课堂极速互动":"Quick Activity"}),e.jsx("h3",{className:"text-xl font-bold text-white",children:t.activePoll.title})]})]}),e.jsxs("div",{className:"text-right",children:[e.jsx("span",{className:"text-3xl font-black text-amber-400 font-mono",children:t.activePoll.totalVotes||0}),e.jsx("span",{className:"text-xs text-slate-400 block",children:a==="zh"?"人已作答":"Responded"})]})]}),e.jsx("div",{className:"grid grid-cols-2 gap-4 my-2",children:(t.activePoll.options||["A","B","C","D"]).map(j=>{const k=t.activePoll.distribution?.[j]||0;t.activePoll.totalVotes;const w=Math.round(k/(t.activePoll.totalVotes||1)*100);return e.jsxs("div",{className:"p-5 bg-slate-800/50 rounded-2xl border border-slate-700/50 flex flex-col gap-3",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("span",{className:"w-10 h-10 rounded-xl bg-blue-500 text-white font-bold text-lg flex items-center justify-center shadow-md",children:j}),e.jsxs("span",{className:"font-semibold text-slate-200 text-lg",children:["选项 ",j]})]}),e.jsxs("span",{className:"font-mono font-bold text-xl text-blue-400",children:[w,"% (",k,")"]})]}),e.jsx("div",{className:"h-4 w-full bg-slate-700/40 rounded-full overflow-hidden",children:e.jsx("div",{className:"h-full bg-gradient-to-r from-blue-500 to-indigo-500 transition-all duration-500 rounded-full",style:{width:`${w}%`}})})]},j)})})]}),t.activeBuzzer&&e.jsxs("div",{className:"bg-slate-900/90 rounded-3xl border border-slate-800 p-8 shadow-xl flex flex-col items-center text-center justify-center",children:[e.jsx("div",{className:"p-4 bg-rose-500/10 rounded-2xl border border-rose-500/20 text-rose-400 mb-4",children:e.jsx(us,{size:36,className:"animate-bounce"})}),e.jsx("h3",{className:"text-2xl font-bold text-white mb-2",children:t.activeBuzzer.title}),t.activeBuzzer.status==="READY"?e.jsxs("div",{className:"my-6 py-6 px-12 bg-rose-950/30 border border-rose-500/30 rounded-2xl",children:[e.jsx("span",{className:"text-4xl font-extrabold text-rose-400 animate-pulse block",children:a==="zh"?"⚡ 全班抢答中...":"⚡ Buzzing in progress..."}),e.jsx("span",{className:"text-sm text-slate-400 mt-2 block",children:a==="zh"?"请按手中的抢答按钮!":"Press your buzzer now!"})]}):e.jsxs("div",{className:"my-6 py-6 px-12 bg-emerald-950/30 border border-emerald-500/40 rounded-2xl flex flex-col items-center",children:[e.jsx(Re,{size:48,className:"text-amber-400 mb-2"}),e.jsx("span",{className:"text-sm text-emerald-400 font-bold tracking-wide uppercase",children:a==="zh"?"🎉 抢答成功!":"🎉 First to Buzz!"}),e.jsx("span",{className:"text-5xl font-black text-white my-2 font-mono",children:t.activeBuzzer.winnerName||"同学"}),t.activeBuzzer.responseTimeMs&&e.jsx("span",{className:"text-sm font-mono text-emerald-300",children:a==="zh"?`响应用时:${t.activeBuzzer.responseTimeMs} 毫秒`:`Reaction time: ${t.activeBuzzer.responseTimeMs} ms`})]})]}),t.stage==="WRAP_UP_EXIT_TICKET"&&e.jsxs("div",{className:"bg-gradient-to-br from-indigo-950/40 to-slate-900 rounded-3xl border border-indigo-800/40 p-8 shadow-xl flex flex-col items-center text-center",children:[e.jsx(Qs,{size:48,className:"text-indigo-400 mb-4"}),e.jsx("h3",{className:"text-3xl font-extrabold text-white mb-2",children:a==="zh"?"60 秒结课通票 (Exit Ticket)":"60s Exit Ticket"}),e.jsx("p",{className:"text-slate-300 text-lg max-w-lg mb-6",children:a==="zh"?"请同学们打开设备完成本次课堂评估:选星级、写下今天最困惑的一个知识点。":"Please complete your 60-second summary ticket on your device."})]}),e.jsx(oe,{slot:"stage.display.card",slotProps:{lessonId:n,stage:t.stage}})]}),e.jsx("aside",{className:"col-span-4 flex flex-col gap-6",children:e.jsxs("div",{className:"bg-slate-900/90 rounded-3xl border border-slate-800 p-6 shadow-xl flex flex-col gap-4",children:[e.jsxs("div",{className:"flex items-center justify-between border-b border-slate-800/80 pb-3",children:[e.jsxs("div",{className:"flex items-center gap-2 text-white font-bold text-base",children:[e.jsx(_e,{size:18,className:"text-blue-400"}),e.jsx("span",{children:a==="zh"?"学习节奏晴雨表":"Pacing Barometer"})]}),e.jsxs("span",{className:"text-xs text-slate-400 font-mono",children:[p," ",a==="zh"?"次反馈":"signals"]})]}),e.jsxs("div",{className:"flex flex-col gap-3 my-1",children:[e.jsxs("div",{className:"flex items-center justify-between text-sm",children:[e.jsxs("span",{className:"flex items-center gap-2 text-emerald-300 font-medium",children:[e.jsx("span",{className:"w-2.5 h-2.5 rounded-full bg-emerald-400"}),a==="zh"?"听懂了 / 节奏合适":"Clear & Smooth"]}),e.jsx("span",{className:"font-mono font-bold text-white",children:t.pacing.CLEAR||0})]}),e.jsx("div",{className:"h-3 w-full bg-slate-800 rounded-full overflow-hidden",children:e.jsx("div",{className:"h-full bg-emerald-500 rounded-full transition-all duration-500",style:{width:`${p>0?(t.pacing.CLEAR||0)/p*100:0}%`}})}),e.jsxs("div",{className:"flex items-center justify-between text-sm pt-2",children:[e.jsxs("span",{className:"flex items-center gap-2 text-amber-300 font-medium",children:[e.jsx("span",{className:"w-2.5 h-2.5 rounded-full bg-amber-400"}),a==="zh"?"有些困惑 / 需点拨":"Confused"]}),e.jsx("span",{className:"font-mono font-bold text-white",children:t.pacing.CONFUSED||0})]}),e.jsx("div",{className:"h-3 w-full bg-slate-800 rounded-full overflow-hidden",children:e.jsx("div",{className:"h-full bg-amber-500 rounded-full transition-all duration-500",style:{width:`${p>0?(t.pacing.CONFUSED||0)/p*100:0}%`}})}),e.jsxs("div",{className:"flex items-center justify-between text-sm pt-2",children:[e.jsxs("span",{className:"flex items-center gap-2 text-rose-300 font-medium",children:[e.jsx("span",{className:"w-2.5 h-2.5 rounded-full bg-rose-400"}),a==="zh"?"讲太快了 / 跟不上":"Too Fast"]}),e.jsx("span",{className:"font-mono font-bold text-white",children:t.pacing.TOO_FAST||0})]}),e.jsx("div",{className:"h-3 w-full bg-slate-800 rounded-full overflow-hidden",children:e.jsx("div",{className:"h-full bg-rose-500 rounded-full transition-all duration-500",style:{width:`${p>0?(t.pacing.TOO_FAST||0)/p*100:0}%`}})})]}),e.jsx("p",{className:"text-xs text-slate-500 text-center mt-2",children:a==="zh"?"提示:此数据来自学生端匿名点击,自动脱敏保护学生自尊。":"Aggregated anonymized signals from student devices."})]})})]}),u&&e.jsx(gr,{isOpen:u,onClose:()=>v(!1),lessonTitle:o})]})}const Qt={CLEAR:{emoji:"💡",zh:"理解",en:"Clear",color:"#10b981"},CONFUSED:{emoji:"❓",zh:"困惑",en:"Confused",color:"#f59e0b"},TOO_FAST:{emoji:"🐇",zh:"慢一点",en:"Slow down",color:"#f43f5e"},SLOW:{emoji:"🐢",zh:"快一点",en:"Speed up",color:"#6366f1"}},La=["CLEAR","CONFUSED","TOO_FAST","SLOW"];function Fa({lessonId:s,lang:i,signals:n,onlineCount:o=0,onClose:a}){const t=i==="zh",[r,c]=l.useState(n);l.useEffect(()=>{const N=Ks();if(!N)return;const g=p=>{p?.lessonId===s&&p?.summary&&c(p.summary)};return N.on("classroom:pacing_updated",g),()=>{typeof N.off=="function"&&N.off("classroom:pacing_updated",g)}},[s]);const x=La.map(N=>({key:N,count:Number(r[N]??0)})),d=x.reduce((N,g)=>N+g.count,0);Number(r.CONFUSED??0)+Number(r.TOO_FAST??0)+Number(r.SLOW??0);const m=d>0?Math.round(Number(r.CLEAR??0)/d*100):null,u=l.useCallback(()=>d===0?{text:t?"暂无学生反馈,等待中…":"No feedback yet",tone:"text-muted"}:Number(r.CONFUSED??0)>=Math.max(2,d*.3)?{text:t?"⚠ 较多学生困惑,建议放慢并重新讲解当前环节":"⚠ Many students are confused — slow down and re-explain",tone:"text-amber-600"}:Number(r.TOO_FAST??0)>=Math.max(2,d*.3)?{text:t?"🐇 较多学生希望放慢节奏":"🐇 Many students want you to slow down",tone:"text-rose-600"}:Number(r.SLOW??0)>=Math.max(2,d*.3)?{text:t?"🐢 较多学生希望加快节奏":"🐢 Many students want you to speed up",tone:"text-indigo-600"}:{text:t?"✓ 节奏反馈健康,可按当前节奏继续":"✓ Pace is healthy — carry on",tone:"text-emerald-600"},[r,d,t]),v=x.filter(N=>N.count>0).map(N=>({name:Qt[N.key][t?"zh":"en"],value:N.count,color:Qt[N.key].color}));return e.jsx("div",{className:"fixed inset-0 z-[90] flex items-center justify-center bg-slate-900/60 backdrop-blur-2xs",onPointerDown:a,children:e.jsxs("div",{className:"bg-surface border border-theme rounded-2xl shadow-2xl w-[560px] max-w-[92vw] max-h-[86vh] overflow-y-auto p-5 font-sans text-main",onPointerDown:N=>N.stopPropagation(),children:[e.jsxs("div",{className:"flex items-center justify-between mb-4",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:"p-2 bg-primary-theme/10 text-primary-theme rounded-xl",children:e.jsx(ta,{size:18})}),e.jsxs("div",{children:[e.jsxs("h2",{className:"text-sm font-black text-main flex items-center gap-1.5",children:[t?"课堂反馈情绪仪表盘":"Classroom Feedback Dashboard",e.jsxs("span",{className:"flex items-center gap-1 text-2xs font-bold text-emerald-600 bg-emerald-500/10 px-1.5 py-0.5 rounded-full",children:[e.jsx(_e,{size:10})," ",t?"实时":"LIVE"]})]}),e.jsx("p",{className:"text-2xs text-muted mt-0.5",children:t?"近 5 分钟窗口 · 全班节奏反馈聚合":"Last 5 minutes · aggregated pace feedback"})]})]}),e.jsx("button",{onClick:a,className:"p-1.5 rounded-lg hover:bg-surface-secondary text-muted cursor-pointer",title:t?"关闭":"Close",children:e.jsx(be,{size:16})})]}),e.jsxs("div",{className:"flex flex-col md:flex-row gap-4 items-center",children:[e.jsxs("div",{className:"w-[200px] h-[200px] relative shrink-0",children:[d>0?e.jsx(Ca,{width:"100%",height:"100%",children:e.jsx($a,{children:e.jsx(Aa,{data:v,dataKey:"value",nameKey:"name",innerRadius:52,outerRadius:85,paddingAngle:3,strokeWidth:0,isAnimationActive:!1,children:v.map((N,g)=>e.jsx(Ea,{fill:N.color},g))})})}):e.jsx("div",{className:"w-full h-full flex items-center justify-center text-3xl opacity-30",children:"📊"}),e.jsxs("div",{className:"absolute inset-0 flex flex-col items-center justify-center pointer-events-none",children:[e.jsxs("span",{className:"text-2xs text-muted flex items-center gap-1",children:[e.jsx(ke,{size:10})," ",o," ",t?"在线":"online"]}),e.jsx("span",{className:`text-xl font-black ${m===null?"text-muted":m>=60?"text-emerald-600":m>=30?"text-amber-600":"text-rose-600"}`,children:m===null?"—":`${m}%`}),e.jsx("span",{className:"text-2xs text-muted",children:t?"理解占比":"clear ratio"})]})]}),e.jsxs("div",{className:"flex-1 w-full flex flex-col gap-2.5",children:[x.map(({key:N,count:g})=>{const p=Qt[N],j=d>0?Math.round(g/d*100):0;return e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center justify-between text-xs mb-0.5",children:[e.jsxs("span",{className:"font-bold text-main",children:[p.emoji," ",t?p.zh:p.en]}),e.jsxs("span",{className:"text-muted font-mono",children:[g," · ",j,"%"]})]}),e.jsx("div",{className:"h-2.5 bg-surface-secondary rounded-full overflow-hidden border border-theme/50",children:e.jsx("div",{className:"h-full rounded-full transition-all duration-500",style:{width:`${j}%`,background:p.color}})})]},N)}),e.jsx("div",{className:`mt-1 text-xs font-bold ${u().tone}`,children:u().text})]})]})]})})}function Ns({isOpen:s,onClose:i,student:n,lessonId:o,classId:a,lang:t="zh",addToast:r,onInspectSandbox:c,onCastStudentScreen:x,onAwardPoints:d}){const[m,u]=l.useState("profile"),[v,N]=l.useState(""),[g,p]=l.useState(!1),j=n?.competencyScores,k=l.useMemo(()=>[{key:"logic",label:t==="zh"?"算法逻辑":"Logic"},{key:"engineering",label:t==="zh"?"代码工程":"Engineering"},{key:"creativity",label:t==="zh"?"创新思维":"Creativity"},{key:"collaboration",label:t==="zh"?"团队协作":"Collaboration"},{key:"focus",label:t==="zh"?"课堂专注":"Focus"}],[t]),w=l.useMemo(()=>k.map($=>{const S=j?.[$.key],E=typeof S=="number"&&Number.isFinite(S);return{key:$.key,label:$.label,score:E?Math.max(0,Math.min(100,Math.round(S))):0,available:E}}),[j,k]),f=w.some($=>$.available),b=w.filter($=>!$.available).map($=>$.label),z=l.useMemo(()=>{const $=t==="zh",S=n?.name??(t==="zh"?"该学生":"This student"),E=w.filter(K=>K.available);if(E.length===0)return $?`${S}本节暂无可用的维度数据(未参与随堂测/课件互动),无法生成掌握度评语。建议下节课关注其参与情况。`:`${S} has no competency data for this session (no quiz/courseware interaction).`;const Q=Math.round(E.reduce((K,le)=>K+le.score,0)/E.length),ie=E.reduce((K,le)=>le.score>K.score?le:K),pe=E.reduce((K,le)=>le.score<K.score?le:K),ce=w.filter(K=>!K.available).map(K=>K.label);return($?[`本节已采集维度:${E.map(K=>`${K.label} ${K.score}`).join("、")},平均 ${Q}。`,`相对优势为${ie.label}(${ie.score}),相对薄弱为${pe.label}(${pe.score})。`,ce.length>0?`未采集维度:${ce.join("、")}。`:""]:[`Collected: ${E.map(K=>`${K.label} ${K.score}`).join(", ")}; average ${Q}.`,`Strongest ${ie.label} (${ie.score}), weakest ${pe.label} (${pe.score}).`,ce.length>0?`Missing: ${ce.join(", ")}.`:""]).filter(Boolean).join(" ")},[w,t,n]),_=l.useMemo(()=>{const $=t==="zh",S=w.filter(Q=>Q.available);if(S.length===0)return $?"数据不足,暂不生成建议":"Insufficient data";const E=S.reduce((Q,ie)=>Q+ie.score,0)/S.length;return E>=85?$?"建议进入算法创新挑战营":"Recommended for Advanced Camp":E>=70?$?"建议保持当前节奏并补强薄弱维度":"Keep pace, strengthen weak areas":$?"建议课后补充基础微练习":"Suggest remedial practice"},[w,t]),C=l.useMemo(()=>{const $=w.filter(E=>E.available);if($.length===0)return"—";const S=$.reduce((E,Q)=>E+Q.score,0)/$.length;return S>=90?"A+":S>=80?"A":S>=70?"B+":S>=60?"B":"C"},[w]),B=l.useMemo(()=>{const Q=(K,le)=>{const de=-Math.PI/2+2*Math.PI/5*le;return{x:100+K*Math.cos(de),y:100+K*Math.sin(de)}},ie=[1,.66,.33].map(K=>{const le=75*K;return Array.from({length:5},(ue,ve)=>{const{x:A,y:L}=Q(le,ve);return`${A.toFixed(1)},${L.toFixed(1)}`}).join(" ")}),pe=Array.from({length:5},(K,le)=>{const{x:de,y:ue}=Q(75,le);return{x1:100,y1:100,x2:de,y2:ue}}),ce=w.map((K,le)=>{const de=75*Math.min(Math.max(K.score/100,.1),1);return Q(de,le)}),G=ce.map(K=>`${K.x.toFixed(1)},${K.y.toFixed(1)}`).join(" ");return{gridLevels:ie,axes:pe,dataPoints:ce,dataPolygonString:G}},[w]);if(!s||!n)return null;const R=n.points??0,J=n.deltaPoints??4,O=n.focusPercentage,H=n.accuracyPercentage,ee=n.helpCount??3,se=n.role||n.student_number||"",I=n.group_name||"",V=n.student_number||n.id.slice(-6),P=n.timeline??[],y=async($,S)=>{p(!0);try{d?d(n.id,$,S):await fetch(`/api/students/${n.id}/points`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({delta:$,dimension:"attribution",reason:S,classId:a,lessonId:o})}),r?.(t==="zh"?"成长积分已发放":"Points Awarded",t==="zh"?`已为学生 [${n.name}] ${$>=0?"+":""}${$} 分(${S})`:`Awarded ${$} pts to [${n.name}]`,"success")}catch(E){r?.("Error",E.message,"error")}finally{p(!1)}},M=()=>{const $=`# 学生个人全景学情与成长档案 (${n.name})
|
|
2
|
+
- **学生姓名**: ${n.name}
|
|
3
|
+
- **学号**: ${V}
|
|
4
|
+
- **所属班级**: ${n.className||a||"默认班级"}
|
|
5
|
+
- **小组归属**: ${I} (${se})
|
|
6
|
+
- **生成时间**: ${new Date().toLocaleString()}
|
|
7
|
+
|
|
8
|
+
## 1. 课堂核心素养与成长指标
|
|
9
|
+
- **总积分**: ${R} 分 (本节新增: +${J})
|
|
10
|
+
- **专注度**: ${typeof O=="number"?`${O}%`:"—"}
|
|
11
|
+
- **答题正确率**: ${typeof H=="number"?`${H}%`:"—"}
|
|
12
|
+
- **互助答疑频次**: ${ee} 次
|
|
13
|
+
|
|
14
|
+
## 2. 五维计算思维雷达评级
|
|
15
|
+
${w.map(S=>`- **${S.label}**: ${S.score} / 100`).join(`
|
|
16
|
+
`)}
|
|
17
|
+
|
|
18
|
+
## 3. 本堂答题与互动轨迹
|
|
19
|
+
${P.length>0?P.map(S=>`- [${S.time}] ${S.title} (${S.points?"+"+S.points+"分":""}) - ${S.description}`).join(`
|
|
20
|
+
`):"- 本节暂无作答或互动记录"}
|
|
21
|
+
|
|
22
|
+
---
|
|
23
|
+
*OpenLearn Next 过程性评价系统自动生成*
|
|
24
|
+
`;try{const S=new Blob([$],{type:"text/markdown;charset=utf-8"}),E=URL.createObjectURL(S),Q=document.createElement("a");Q.href=E,Q.download=`学生学情档案_${n.name}_${V}.md`,Q.click(),URL.revokeObjectURL(E),r?.(t==="zh"?"学情档案导出成功":"Report Exported",t==="zh"?`已生成 [${n.name}] 个人学情 Markdown 档案`:"Exported student report","success")}catch{navigator.clipboard?.writeText($),r?.(t==="zh"?"已复制至剪贴板":"Copied to Clipboard",t==="zh"?"学情报告内容已复制":"Report copied","info")}};return e.jsx("div",{id:"student-growth-profile-modal-backdrop",className:"fixed inset-0 z-50 bg-slate-950/65 backdrop-blur-md flex items-center justify-center p-3 sm:p-5 select-none animate-in fade-in duration-200",onClick:$=>{$.target===$.currentTarget&&i()},children:e.jsxs("div",{className:"w-full max-w-4xl bg-surface border border-border/80 rounded-2xl shadow-2xl overflow-hidden flex flex-col max-h-[92vh] text-foreground animate-in zoom-in-95 duration-150",role:"dialog","aria-modal":"true","aria-labelledby":"student-profile-title",children:[e.jsxs("header",{className:"px-5 py-3.5 bg-gradient-to-r from-indigo-50/70 via-surface to-amber-50/40 dark:from-indigo-950/30 dark:via-surface dark:to-amber-950/20 border-b border-border/80 flex items-center justify-between shrink-0",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("button",{onClick:i,className:"w-8 h-8 rounded-xl bg-surface hover:bg-surface-secondary text-foreground flex items-center justify-center transition border border-border shadow-3xs cursor-pointer",title:t==="zh"?"返回全班列表":"Back",children:e.jsx(sa,{size:16})}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsxs("div",{className:"relative",children:[e.jsx("div",{className:"w-10 h-10 rounded-xl bg-indigo-600 text-white flex items-center justify-center font-bold text-sm shadow-3xs",children:n.avatar?e.jsx("img",{src:n.avatar,alt:n.name,className:"w-full h-full object-cover rounded-xl"}):e.jsx("span",{children:n.name.slice(0,1)})}),e.jsx("span",{className:"absolute -top-1 -right-1 w-3.5 h-3.5 rounded-full bg-emerald-500 border-2 border-surface"})]}),e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("h3",{id:"student-profile-title",className:"text-sm font-bold text-foreground tracking-tight",children:n.name}),se&&e.jsx("span",{className:"px-1.5 py-0.2 rounded bg-indigo-100 dark:bg-indigo-900/50 text-indigo-700 dark:text-indigo-300 text-[10px] font-bold",children:se}),I&&e.jsxs("span",{className:"px-1.5 py-0.2 rounded bg-amber-100 dark:bg-amber-900/50 text-amber-800 dark:text-amber-300 text-[10px] font-semibold flex items-center gap-1",children:[e.jsx(Oe,{size:11,className:"text-amber-600 dark:text-amber-400"}),e.jsx("span",{children:I})]}),e.jsxs("span",{className:"inline-flex items-center gap-1 text-[10px] text-emerald-700 dark:text-emerald-300 bg-emerald-50 dark:bg-emerald-950/40 border border-emerald-200 dark:border-emerald-800 px-1.5 py-0.2 rounded-full font-medium",children:[e.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-emerald-500 animate-pulse"}),e.jsxs("span",{children:[typeof O=="number"?`${O}%`:"—"," ",t==="zh"?"专注在线":"Focus"]})]})]}),e.jsxs("div",{className:"text-[11px] text-muted flex items-center gap-2 mt-0.5",children:[e.jsxs("span",{children:[t==="zh"?"学号: ":"ID: ",e.jsx("strong",{className:"font-mono font-normal text-foreground",children:V})]}),e.jsx("span",{className:"text-border",children:"|"}),e.jsx("span",{children:n.className||(t==="zh"?"示范班级":"Class")}),e.jsx("span",{className:"text-border",children:"|"}),e.jsx("span",{className:"text-primary-theme font-medium",children:t==="zh"?"个人综合成长档案":"Growth Profile"})]})]})]})]}),e.jsxs("div",{className:"flex items-center gap-1.5",children:[x&&e.jsxs("button",{onClick:()=>x(n.id),className:"px-2.5 py-1.5 rounded-xl bg-indigo-50 hover:bg-indigo-100 dark:bg-indigo-950/40 dark:hover:bg-indigo-900/50 text-indigo-700 dark:text-indigo-300 border border-indigo-200 dark:border-indigo-800 text-xs font-semibold flex items-center gap-1.5 transition shadow-3xs cursor-pointer",title:t==="zh"?"将该生操作白板/代码投屏至大屏幕":"Cast Student Screen",children:[e.jsx(sr,{size:13,className:"text-indigo-600 dark:text-indigo-400"}),e.jsx("span",{children:t==="zh"?"投屏其工作台":"Cast Screen"})]}),e.jsx(oe,{slot:"student.profile.action",slotProps:{student:n,lessonId:o,classId:a}}),e.jsx("button",{onClick:i,className:"p-1.5 rounded-lg hover:bg-surface-secondary text-muted hover:text-foreground transition cursor-pointer",title:t==="zh"?"关闭弹窗":"Close",children:e.jsx(be,{size:16})})]})]}),e.jsxs("section",{className:"px-5 py-3 bg-surface-secondary/40 border-b border-border/70 grid grid-cols-2 sm:grid-cols-4 gap-3 shrink-0",children:[e.jsxs("div",{className:"bg-surface p-2.5 rounded-xl border border-border/80 shadow-3xs flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("div",{className:"text-[11px] text-muted font-medium",children:t==="zh"?"本节总积分":"Total Points"}),e.jsxs("div",{className:"text-lg font-extrabold text-indigo-700 dark:text-indigo-300 font-mono flex items-baseline gap-1",children:[R," ",e.jsx("span",{className:"text-[10px] text-muted font-normal",children:t==="zh"?"分":"pts"}),e.jsxs("span",{className:"text-[10px] font-mono text-emerald-600 dark:text-emerald-400 font-bold bg-emerald-50 dark:bg-emerald-950/40 px-1 py-0.2 rounded ml-0.5",children:["+",J]})]}),e.jsxs("div",{className:"text-[10px] text-muted mt-0.5",children:[t==="zh"?"组内贡献率: ":"Team Share: ",e.jsx("strong",{className:"text-primary-theme font-semibold",children:"26%"})]})]}),e.jsx("div",{className:"w-9 h-9 rounded-xl bg-indigo-50 dark:bg-indigo-950/40 text-indigo-600 dark:text-indigo-300 flex items-center justify-center text-lg shadow-3xs",children:e.jsx(Oe,{size:18})})]}),e.jsxs("div",{className:"bg-surface p-2.5 rounded-xl border border-border/80 shadow-3xs flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("div",{className:"text-[11px] text-muted font-medium",children:t==="zh"?"本堂专注度":"Focus Rate"}),e.jsxs("div",{className:"text-lg font-extrabold text-emerald-600 dark:text-emerald-400 font-mono flex items-baseline gap-1",children:[typeof O=="number"?`${O}%`:"—"," ",typeof O=="number"&&e.jsx("span",{className:"text-[10px] text-muted font-normal font-sans",children:O>=80?t==="zh"?"优良":"Good":t==="zh"?"待提升":"Needs work"})]}),e.jsxs("div",{className:"text-[10px] text-muted mt-0.5",children:[t==="zh"?"击败全班 ":"Top ",e.jsx("strong",{className:"text-emerald-600 dark:text-emerald-400 font-semibold",children:"96%"})," ",t==="zh"?"同学":"students"]})]}),e.jsx("div",{className:"w-9 h-9 rounded-xl bg-emerald-50 dark:bg-emerald-950/40 text-emerald-600 dark:text-emerald-400 flex items-center justify-center text-lg shadow-3xs",children:e.jsx(mt,{size:18})})]}),e.jsxs("div",{className:"bg-surface p-2.5 rounded-xl border border-border/80 shadow-3xs flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("div",{className:"text-[11px] text-muted font-medium",children:t==="zh"?"答题正确率":"Accuracy"}),e.jsxs("div",{className:"text-lg font-extrabold text-foreground font-mono flex items-baseline gap-1",children:[typeof H=="number"?`${H}%`:"—"," ",typeof H=="number"&&e.jsx("span",{className:"text-[10px] text-muted font-normal",children:H>=90?t==="zh"?"优秀":"Excellent":t==="zh"?"待巩固":"Needs review"})]}),e.jsx("div",{className:"text-[10px] text-muted mt-0.5",children:t==="zh"?"共 2 次提交 · 2 次首发通过":"2 Submissions · 100% 1st pass"})]}),e.jsx("div",{className:"w-9 h-9 rounded-xl bg-amber-50 dark:bg-amber-950/40 text-amber-600 dark:text-amber-400 flex items-center justify-center text-lg shadow-3xs",children:e.jsx(Dt,{size:18})})]}),e.jsxs("div",{className:"bg-surface p-2.5 rounded-xl border border-border/80 shadow-3xs flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("div",{className:"text-[11px] text-muted font-medium",children:t==="zh"?"互助答疑频次":"Collaboration"}),e.jsxs("div",{className:"text-lg font-extrabold text-sky-600 dark:text-sky-400 font-mono flex items-baseline gap-1",children:[ee," ",e.jsx("span",{className:"text-[10px] text-muted font-normal",children:t==="zh"?"次":"times"})]}),e.jsx("div",{className:"text-[10px] text-muted mt-0.5",children:t==="zh"?"协助解决嵌套语法障碍":"Resolved loop syntax obstacles"})]}),e.jsx("div",{className:"w-9 h-9 rounded-xl bg-sky-50 dark:bg-sky-950/40 text-sky-600 dark:text-sky-400 flex items-center justify-center text-lg shadow-3xs",children:e.jsx(ke,{size:18})})]})]}),e.jsxs("div",{className:"p-4 flex-1 overflow-y-auto grid grid-cols-1 md:grid-cols-12 gap-4 bg-surface-secondary/20",children:[e.jsxs("div",{className:"md:col-span-5 flex flex-col gap-3",children:[e.jsxs("div",{className:"bg-surface rounded-xl border border-border/80 p-3.5 shadow-3xs",children:[e.jsxs("div",{className:"flex items-center justify-between mb-2",children:[e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx(_e,{size:15,className:"text-primary-theme"}),e.jsx("h4",{className:"text-xs font-bold text-foreground",children:t==="zh"?"多维素养与计算思维雷达":"Competency Radar"})]}),e.jsx("span",{className:`text-[10px] font-mono font-bold px-2 py-0.5 rounded-lg border ${f?"text-primary-theme bg-primary-theme/10 border-primary-theme/20":"text-muted bg-surface-secondary border-border/60"}`,title:b.length>0?`${t==="zh"?"暂无数据":"No data"}: ${b.join(", ")}`:void 0,children:f?`${t==="zh"?"综合评级":"Rating"} ${C}`:t==="zh"?"暂无数据":"No data"})]}),e.jsx("div",{className:"flex items-center justify-center py-1",children:e.jsxs("svg",{className:"w-52 h-52 select-none",viewBox:"0 0 200 200","aria-label":"Competency Radar Chart",children:[B.gridLevels.map(($,S)=>e.jsx("polygon",{points:$,fill:"none",stroke:"currentColor",className:"text-border/60",strokeWidth:"1"},S)),B.axes.map(($,S)=>e.jsx("line",{x1:$.x1,y1:$.y1,x2:$.x2,y2:$.y2,stroke:"currentColor",className:"text-border/50",strokeWidth:"1"},S)),e.jsx("polygon",{points:B.dataPolygonString,fill:f?"rgba(99, 102, 241, 0.25)":"rgba(148, 163, 184, 0.12)",stroke:f?"#6366f1":"#94a3b8",strokeWidth:"2",strokeDasharray:f?void 0:"4 3"}),B.dataPoints.map(($,S)=>e.jsx("circle",{cx:$.x,cy:$.y,r:"3",fill:w[S]?.available?"#6366f1":"#cbd5e1"},S)),e.jsxs("text",{x:"100",y:"14",textAnchor:"middle",fill:"#6366f1",fontSize:"9",fontWeight:"bold",children:[w[0].label," ",w[0].score]}),e.jsxs("text",{x:"180",y:"80",textAnchor:"start",fill:"currentColor",fontSize:"9",fontWeight:"bold",children:[w[1].label," ",w[1].score]}),e.jsxs("text",{x:"145",y:"180",textAnchor:"start",fill:"currentColor",fontSize:"9",fontWeight:"bold",children:[w[2].label," ",w[2].score]}),e.jsxs("text",{x:"55",y:"180",textAnchor:"end",fill:"currentColor",fontSize:"9",fontWeight:"bold",children:[w[3].label," ",w[3].score]}),e.jsxs("text",{x:"20",y:"80",textAnchor:"end",fill:"#10b981",fontSize:"9",fontWeight:"bold",children:[w[4].label," ",w[4].score]})]})}),e.jsx("div",{className:"space-y-1.5 pt-2 border-t border-border/70 text-xs",children:w.slice(0,3).map($=>e.jsxs("div",{className:"flex items-center justify-between text-[11px]",children:[e.jsx("span",{className:"text-muted",children:$.label}),e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx("div",{className:"w-24 bg-surface-secondary h-1.5 rounded-full overflow-hidden border border-border/40",children:e.jsx("div",{className:"bg-primary-theme h-1.5 rounded-full transition-all duration-300",style:{width:`${$.score}%`}})}),e.jsx("span",{className:"font-mono font-bold text-foreground text-[10px] w-7 text-right",children:$.score})]})]},$.key))}),e.jsx(oe,{slot:"student.profile.dimension",slotProps:{student:n,dimensions:w}})]}),e.jsxs("div",{className:"bg-surface rounded-xl border border-border/80 p-3.5 shadow-3xs flex flex-col justify-between",children:[e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-1.5 mb-2",children:[e.jsx(ra,{size:15,className:"text-amber-500"}),e.jsx("h4",{className:"text-xs font-bold text-foreground",children:t==="zh"?"AI 导师学情评语与成长潜质":"AI Pedagogical Insights"})]}),e.jsx("p",{className:"text-[11px] text-muted leading-relaxed bg-amber-500/10 p-2.5 rounded-xl border border-amber-500/20 mb-2",children:z})]}),e.jsxs("div",{className:"flex items-center justify-between text-[10px] text-muted pt-1",children:[e.jsxs("span",{className:"flex items-center gap-1 text-emerald-600 dark:text-emerald-400 font-medium",children:[e.jsx(je,{size:12}),e.jsx("span",{children:_})]}),e.jsx("span",{className:"text-primary-theme font-semibold cursor-pointer hover:underline",children:t==="zh"?"历次报告":"History"})]})]}),e.jsx(oe,{slot:"student.profile.card",slotProps:{student:n,lessonId:o,classId:a}})]}),e.jsx("div",{className:"md:col-span-7 flex flex-col gap-3",children:e.jsxs("div",{className:"bg-surface rounded-xl border border-border/80 p-4 shadow-3xs flex-1 flex flex-col",children:[e.jsxs("div",{className:"flex items-center justify-between mb-3",children:[e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx(Le,{size:15,className:"text-primary-theme"}),e.jsx("h4",{className:"text-xs font-bold text-foreground",children:t==="zh"?"本堂答题与互动轨迹 (Live Timeline)":"Live Interactive Timeline"})]}),e.jsxs("div",{className:"flex items-center gap-1 text-[11px] text-emerald-600 dark:text-emerald-400",children:[e.jsx("span",{className:"w-2 h-2 rounded-full bg-emerald-500 animate-pulse"}),e.jsx("span",{children:t==="zh"?"实时追踪中":"Tracking"})]})]}),P.length===0&&e.jsx("div",{className:"rounded-xl border border-dashed border-border/60 p-4 text-center text-[11px] text-muted flex-1 flex items-center justify-center",children:t==="zh"?"本节暂无作答或互动记录(尚未参与随堂测 / 投票 / 抢答)。":"No in-class activity recorded for this session yet."}),e.jsxs("div",{className:"space-y-3 relative before:absolute before:inset-0 before:left-3 before:w-0.5 before:bg-border text-xs pl-0.5 flex-1",children:[P.map($=>e.jsxs("div",{className:"relative flex items-start gap-3 pl-6",children:[e.jsx("span",{className:"absolute left-1.5 top-1 -translate-x-1/2 w-3.5 h-3.5 rounded-full bg-primary-theme text-white flex items-center justify-center text-[8px] ring-4 ring-surface",children:e.jsx(je,{size:10})}),e.jsxs("div",{className:"flex-1 bg-surface-secondary/40 rounded-xl p-2.5 border border-border/80 hover:border-primary-theme/40 transition",children:[e.jsxs("div",{className:"flex items-center justify-between mb-1",children:[e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx("span",{className:"font-mono font-bold text-primary-theme text-[10px]",children:$.time}),e.jsx("span",{className:"font-bold text-foreground text-xs",children:$.title})]}),$.points!==void 0&&e.jsxs("span",{className:"text-[10px] font-mono font-bold text-emerald-600 dark:text-emerald-400 bg-emerald-500/10 px-1.5 py-0.2 rounded-md",children:["+",$.points]})]}),e.jsx("p",{className:"text-[11px] text-muted mb-1.5",children:$.description}),$.details&&e.jsx("div",{className:"text-[10px] text-foreground/80 bg-surface p-1.5 rounded-lg border border-border/60",children:$.details}),$.submissionId&&e.jsx("div",{className:"mt-2 flex items-center gap-2",children:e.jsxs("button",{onClick:()=>c?.(n.id,$.submissionId),className:"px-2 py-1 bg-primary-theme text-white rounded-lg text-[10px] font-bold flex items-center gap-1 shadow-3xs cursor-pointer hover:bg-primary-theme/90",children:[e.jsx(rr,{size:11}),e.jsx("span",{children:t==="zh"?"查验代码沙箱":"Inspect Sandbox"})]})})]})]},$.id)),e.jsx(oe,{slot:"student.profile.timeline_item",slotProps:{student:n,lessonId:o,classId:a}})]})]})})]}),e.jsxs("footer",{className:"px-5 py-3 bg-surface border-t border-border/80 flex flex-wrap items-center justify-between gap-3 shrink-0",children:[e.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[e.jsx("span",{className:"text-xs text-muted font-medium",children:t==="zh"?"快速表现激励:":"Quick Award:"}),e.jsx("button",{onClick:()=>y(1,t==="zh"?"勇于发言":"Active Speaking"),disabled:g,className:"px-2 py-1 bg-amber-500/10 hover:bg-amber-500/20 text-amber-700 dark:text-amber-300 border border-amber-300/40 rounded-lg text-xs font-semibold flex items-center gap-1 transition cursor-pointer",children:e.jsxs("span",{children:["👏 +1 ",t==="zh"?"发言":"Speaking"]})}),e.jsx("button",{onClick:()=>y(2,t==="zh"?"逻辑清晰":"Logical Thinking"),disabled:g,className:"px-2 py-1 bg-indigo-500/10 hover:bg-indigo-500/20 text-indigo-700 dark:text-indigo-300 border border-indigo-300/40 rounded-lg text-xs font-semibold flex items-center gap-1 transition cursor-pointer",children:e.jsxs("span",{children:["💡 +2 ",t==="zh"?"逻辑":"Logic"]})}),e.jsx("button",{onClick:()=>y(2,t==="zh"?"互助示范":"Peer Assistance"),disabled:g,className:"px-2 py-1 bg-emerald-500/10 hover:bg-emerald-500/20 text-emerald-700 dark:text-emerald-300 border border-emerald-300/40 rounded-lg text-xs font-semibold flex items-center gap-1 transition cursor-pointer",children:e.jsxs("span",{children:["🌟 +2 ",t==="zh"?"互助":"Helper"]})}),e.jsx("button",{onClick:()=>y(3,t==="zh"?"创意满分":"Creative Thinking"),disabled:g,className:"px-2 py-1 bg-purple-500/10 hover:bg-purple-500/20 text-purple-700 dark:text-purple-300 border border-purple-300/40 rounded-lg text-xs font-semibold flex items-center gap-1 transition cursor-pointer",children:e.jsxs("span",{children:["🚀 +3 ",t==="zh"?"创意":"Creative"]})})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("button",{onClick:M,className:"px-3 py-1.5 border border-border/80 hover:bg-surface-secondary text-foreground rounded-xl text-xs font-medium transition flex items-center gap-1.5 cursor-pointer shadow-3xs",title:t==="zh"?"导出个人 Markdown 学情报告":"Export Report",children:[e.jsx(Ot,{size:13}),e.jsx("span",{children:t==="zh"?"导出学情报告":"Export"})]}),e.jsx("button",{onClick:i,className:"px-4 py-1.5 bg-primary-theme hover:bg-primary-theme/90 text-white rounded-xl text-xs font-bold transition shadow-3xs cursor-pointer",children:t==="zh"?"完成并返回":"Done"})]})]})]})})}const Ba=[{id:"logic_clarity",dimensionId:"logic_clarity",emoji:"💡",deltaPoints:2,nameZh:"逻辑清晰",nameEn:"Clear Logic",descZh:"算法流程叙述规范",descEn:"Structured algorithm reasoning",borderColor:"border-amber-200 dark:border-amber-700/60",bgLight:"bg-amber-50/80 hover:bg-amber-100/90 dark:bg-amber-950/30 dark:hover:bg-amber-900/40",textColor:"text-amber-700 dark:text-amber-300"},{id:"creative_bonus",dimensionId:"creative_bonus",emoji:"🚀",deltaPoints:3,nameZh:"创意满分",nameEn:"High Creativity",descZh:"方案构思新颖独特",descEn:"Innovative & unique solution",borderColor:"border-indigo-200 dark:border-indigo-700/60",bgLight:"bg-indigo-50/80 hover:bg-indigo-100/90 dark:bg-indigo-950/30 dark:hover:bg-indigo-900/40",textColor:"text-indigo-700 dark:text-indigo-300"},{id:"brave_speech",dimensionId:"brave_speech",emoji:"👏",deltaPoints:1,nameZh:"勇于发言",nameEn:"Active Voice",descZh:"积极参与大胆质疑",descEn:"Constructive question & participation",borderColor:"border-emerald-200 dark:border-emerald-700/60",bgLight:"bg-emerald-50/80 hover:bg-emerald-100/90 dark:bg-emerald-950/30 dark:hover:bg-emerald-900/40",textColor:"text-emerald-700 dark:text-emerald-300"},{id:"peer_help",dimensionId:"peer_help",emoji:"🌟",deltaPoints:2,nameZh:"互助示范",nameEn:"Peer Mentoring",descZh:"协助同伴答疑排错",descEn:"Assisted peer in debugging",borderColor:"border-sky-200 dark:border-sky-700/60",bgLight:"bg-sky-50/80 hover:bg-sky-100/90 dark:bg-sky-950/30 dark:hover:bg-sky-900/40",textColor:"text-sky-700 dark:text-sky-300"}];function Ga({isOpen:s,onClose:i,classId:n,lessonId:o,students:a=[],initialStudent:t=null,lang:r="zh",addToast:c,onOpenLeaderboard:x,onOpenStudentSandbox:d,onOpenProfile:m}){const[u,v]=l.useState(null),[N,g]=l.useState(!1),[p,j]=l.useState(null),[k,w]=l.useState({}),[f,b]=l.useState(!1),[z,_]=l.useState(!1);l.useEffect(()=>{if(!s){j(null);return}if(t)v(t);else if(a.length>0){const O=Math.floor(Math.random()*a.length);v(a[O])}},[s,t,a]);const C=l.useCallback(()=>{if(a.length<=1)return;g(!0);let O=0;const H=setInterval(()=>{const ee=Math.floor(Math.random()*a.length);v(a[ee]),O++,O>=10&&(clearInterval(H),g(!1))},50)},[a]),B=l.useCallback(()=>{if(!u||a.length===0)return;const H=(a.findIndex(ee=>ee.id===u.id)+1)%a.length;v(a[H]),j(null)},[u,a]),R=async(O,H,ee)=>{if(u){b(!0);try{n&&await fetch(`/api/students/${u.id}/points`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({classId:n,dimensionId:O,deltaPoints:H,reason:ee,pluginId:"classroom-attribution"})}),w(se=>({...se,[u.id]:(se[u.id]??u.currentPoints??0)+H})),j(`${H>=0?"+":""}${H} ${ee}`),setTimeout(()=>j(null),2500),c?.(r==="zh"?"加分成功":"Points Awarded",`${u.name} ${H>=0?"+":""}${H} (${ee})`,"success")}catch(se){c?.("Error",se.message||"Failed to award points","error")}finally{b(!1)}}},J=l.useMemo(()=>u?k[u.id]??u.currentPoints??0:0,[u,k]);return s?e.jsxs("div",{role:"dialog","aria-modal":"true",className:"fixed inset-0 z-50 flex items-center justify-center p-4 bg-slate-900/60 backdrop-blur-sm animate-in fade-in duration-200",children:[e.jsxs("div",{className:"relative w-full max-w-2xl bg-surface border border-border/80 rounded-2xl shadow-2xl overflow-hidden flex flex-col select-none",children:[e.jsxs("div",{className:"px-5 py-3.5 border-b border-border/60 bg-surface-secondary/40 flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"w-8 h-8 rounded-xl bg-amber-500/10 text-amber-600 dark:text-amber-400 flex items-center justify-center text-base",children:"🎲"}),e.jsxs("div",{children:[e.jsx("h3",{className:"font-extrabold text-sm text-foreground",children:r==="zh"?"课堂抽问与表现激励":"Classroom Question & Attribution Points"}),e.jsx("p",{className:"text-[11px] text-muted",children:r==="zh"?"即时评价学生表现,积分同步至小组与大屏勋章榜":"Live reward attribution synced to team leaderboard"})]})]}),e.jsx("button",{onClick:i,className:"p-1.5 rounded-lg text-muted hover:text-foreground hover:bg-surface-secondary transition-colors cursor-pointer",children:e.jsx(be,{size:18})})]}),e.jsxs("div",{className:"p-5 space-y-4 max-h-[80vh] overflow-y-auto",children:[u?e.jsxs("div",{className:"bg-surface-secondary/60 rounded-xl border border-border/80 p-4 flex flex-wrap items-center justify-between gap-4",children:[e.jsxs("div",{className:"flex items-center gap-3.5 min-w-[240px]",children:[e.jsxs("div",{className:"relative",children:[e.jsx("div",{className:"w-14 h-14 rounded-2xl bg-gradient-to-br from-indigo-500 to-primary-theme p-0.5 shadow-sm",children:e.jsxs("div",{className:"w-full h-full rounded-2xl bg-surface flex flex-col items-center justify-center text-primary-theme font-black",children:[e.jsx("span",{className:"text-[10px] leading-none text-muted font-mono",children:u.seatNumber||"3组"}),e.jsx("span",{className:"text-base leading-none font-extrabold mt-0.5",children:u.studentNo?.slice(-2)||"08"})]})}),e.jsx("span",{className:"absolute -bottom-1 -right-1 px-1.5 py-0.2 rounded-full bg-emerald-500 text-white text-[9px] font-bold shadow-xs",children:r==="zh"?"专注":"Active"})]}),e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[e.jsx("h4",{className:"text-base font-extrabold text-foreground",children:u.name}),u.studentNo&&e.jsxs("span",{className:"text-[11px] text-muted font-mono",children:["(",u.studentNo,")"]}),e.jsx("span",{className:"px-2 py-0.5 rounded-full bg-indigo-500/10 text-indigo-600 dark:text-indigo-400 text-[10px] font-bold",children:u.groupName||(r==="zh"?"未分组":"Ungrouped")})]}),e.jsxs("div",{className:"flex items-center gap-2.5 text-xs",children:[e.jsxs("span",{className:"inline-flex items-center gap-1 font-semibold text-amber-600 dark:text-amber-400 bg-amber-500/10 border border-amber-300/40 px-2 py-0.5 rounded-md",children:[e.jsx(Oe,{size:12,className:"text-amber-500"}),e.jsxs("span",{children:[r==="zh"?"当前积分":"Points",": ",e.jsxs("strong",{children:[J,"分"]})]})]}),e.jsxs("span",{className:"inline-flex items-center gap-1 font-medium text-emerald-600 dark:text-emerald-400 bg-emerald-500/10 border border-emerald-300/40 px-2 py-0.5 rounded-md",children:[e.jsx(ps,{size:12,className:"text-emerald-500"}),e.jsxs("span",{children:[r==="zh"?"专注度":"Focus",":"," ",e.jsx("strong",{children:typeof u.focusScore=="number"?`${u.focusScore}%`:"—"})]})]}),e.jsx("span",{className:"text-muted text-[11px]",children:r==="zh"?`今日抽中 ${u.pickedCountToday??1} 次`:`Picked ${u.pickedCountToday??1}x`})]})]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("button",{onClick:()=>{m&&u?m(u):_(!0)},className:"px-3 py-2 bg-indigo-50 hover:bg-indigo-100 dark:bg-indigo-950/40 dark:hover:bg-indigo-900/50 text-indigo-700 dark:text-indigo-300 border border-indigo-200 dark:border-indigo-800 rounded-xl text-xs font-semibold transition flex items-center gap-1.5 cursor-pointer shadow-3xs",title:r==="zh"?"查看学生五维成长雷达与学情档案":"View Growth Profile",children:[e.jsx(_e,{size:14,className:"text-indigo-600 dark:text-indigo-400"}),e.jsx("span",{children:r==="zh"?"学情档案":"Profile"})]}),e.jsxs("button",{onClick:C,disabled:N,className:"px-3.5 py-2 bg-primary-theme hover:bg-primary-theme/90 active:scale-95 text-white rounded-xl text-xs font-bold shadow-xs transition flex items-center gap-1.5 cursor-pointer disabled:opacity-50",children:[e.jsx(ds,{size:14,className:N?"animate-spin":""}),e.jsx("span",{children:r==="zh"?"重新抽取":"Shuffle"})]}),e.jsxs("button",{onClick:B,className:"px-3 py-2 bg-surface hover:bg-surface-secondary text-foreground border border-border rounded-xl text-xs font-semibold transition flex items-center gap-1 cursor-pointer",title:r==="zh"?"轮候下一位学生":"Next Student",children:[e.jsx("span",{children:r==="zh"?"下一位":"Next"}),e.jsx(st,{size:14})]})]})]}):e.jsx("div",{className:"text-center py-6 text-muted text-xs",children:r==="zh"?"当前班级暂无学生":"No students found in current class"}),p&&e.jsxs("div",{className:"p-2.5 rounded-xl bg-amber-500/15 border border-amber-400/50 text-amber-700 dark:text-amber-300 flex items-center justify-between text-xs font-bold animate-in fade-in slide-in-from-top-2",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(fe,{size:16,className:"text-amber-500 animate-bounce"}),e.jsx("span",{children:p})]}),e.jsx("span",{className:"text-[10px] text-amber-600 dark:text-amber-400 font-normal",children:r==="zh"?"已实时累加":"Awarded live"})]}),e.jsxs("div",{className:"bg-surface rounded-xl border border-border/80 p-4 shadow-3xs",children:[e.jsxs("div",{className:"flex items-center justify-between mb-3",children:[e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx(ar,{size:14,className:"text-amber-500"}),e.jsx("span",{className:"text-xs font-bold text-foreground",children:r==="zh"?"课堂即时表现评价与加分":"Classroom Attribution Awards"}),e.jsx("span",{className:"text-[11px] text-muted",children:r==="zh"?"(自动累加至小组成绩)":"(Aggregated to group)"})]}),e.jsxs("div",{className:"flex items-center gap-1.5 text-xs",children:[e.jsx("span",{className:"text-muted text-[11px]",children:r==="zh"?"快速微调:":"Adjust:"}),[{label:"+1",delta:1},{label:"+2",delta:2},{label:"-1",delta:-1}].map(O=>e.jsx("button",{onClick:()=>R("micro_adjust",O.delta,r==="zh"?`课堂即时微调 ${O.label}`:`Micro adjustment ${O.label}`),disabled:f||!u,className:"px-2 py-0.5 rounded bg-surface-secondary hover:bg-primary-theme/10 hover:text-primary-theme text-foreground font-mono font-bold text-xs border border-border/80 transition cursor-pointer disabled:opacity-50",children:O.label},O.label))]})]}),e.jsx(oe,{slot:"anchor:classroom-attribution:awards",placement:"before",slotProps:{student:u,classId:n,lessonId:o,onAwardPoints:R}}),e.jsx("div",{className:"grid grid-cols-2 sm:grid-cols-4 gap-2.5",children:Ba.map(O=>e.jsxs("button",{onClick:()=>R(O.dimensionId,O.deltaPoints,r==="zh"?`${O.nameZh}:${O.descZh}`:`${O.nameEn}: ${O.descEn}`),disabled:f||!u,className:`group p-2.5 rounded-xl border ${O.borderColor} ${O.bgLight} text-left transition relative flex flex-col justify-between shadow-3xs cursor-pointer active:scale-95 disabled:opacity-50`,children:[e.jsxs("div",{className:"flex items-center justify-between mb-1.5",children:[e.jsx("span",{className:"text-lg",children:O.emoji}),e.jsxs("span",{className:`text-xs font-extrabold ${O.textColor} font-mono bg-surface px-1.5 py-0.2 rounded border border-border shadow-3xs`,children:["+",O.deltaPoints]})]}),e.jsx("div",{className:"font-bold text-xs text-foreground group-hover:text-primary-theme",children:r==="zh"?O.nameZh:O.nameEn}),e.jsx("div",{className:"text-[10px] text-muted line-clamp-1",children:r==="zh"?O.descZh:O.descEn})]},O.id))}),e.jsx(oe,{slot:"classroom.attribution.award",slotProps:{student:u,classId:n,lessonId:o,onAwardPoints:R}}),e.jsx(oe,{slot:"anchor:classroom-attribution:awards",placement:"after",slotProps:{student:u,classId:n,lessonId:o,onAwardPoints:R}})]}),e.jsxs("div",{className:"bg-surface-secondary/40 rounded-xl border border-border/70 p-3 flex items-center justify-between text-xs",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"w-7 h-7 rounded-lg bg-amber-500/15 text-amber-600 dark:text-amber-400 flex items-center justify-center font-bold",children:e.jsx(Oe,{size:14})}),e.jsxs("div",{children:[e.jsx("div",{className:"font-bold text-foreground",children:r==="zh"?`榜首小队:${a.length>0?a[0]?.groupName||"未分组":"数据不足"}`:`Top Group: ${a.length>0?a[0]?.groupName||"Ungrouped":"No data"}`}),e.jsx("div",{className:"text-[10px] text-muted",children:r==="zh"?"累计 104 积分 · 领跑全班":"104 cumulative points · Leading"})]})]}),e.jsx("span",{className:"text-xs font-mono font-bold text-amber-600 dark:text-amber-400 bg-amber-500/10 px-2 py-0.5 rounded border border-amber-300/40",children:"TOP 1"})]})]}),e.jsxs("div",{className:"p-4 border-t border-border/60 bg-surface-secondary/30 flex flex-wrap items-center justify-between gap-3",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[x&&e.jsxs("button",{onClick:()=>{i(),x()},className:"px-3.5 py-1.5 rounded-lg border border-border text-foreground hover:bg-surface-secondary font-semibold text-xs transition flex items-center gap-1.5 cursor-pointer",children:[e.jsx(Oe,{size:13,className:"text-amber-500"}),e.jsx("span",{children:r==="zh"?"全班积分榜 & 批量加分":"Class Leaderboard"})]}),d&&u&&e.jsxs("button",{onClick:()=>d(u),className:"px-3 py-1.5 rounded-lg border border-border text-muted hover:text-foreground hover:bg-surface-secondary text-xs transition flex items-center gap-1.5 cursor-pointer",children:[e.jsx(rr,{size:13}),e.jsx("span",{children:r==="zh"?"查验代码沙箱":"Inspect Code Sandbox"})]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(oe,{slot:"classroom.attribution.action",slotProps:{student:u,classId:n,lessonId:o,currentPoints:J}}),e.jsx("button",{onClick:i,className:"px-4 py-1.5 bg-primary-theme hover:bg-primary-theme/90 text-white rounded-lg text-xs font-bold transition shadow-xs cursor-pointer",children:r==="zh"?"完成":"Done"})]})]})]}),u&&e.jsx(Ns,{isOpen:z,onClose:()=>_(!1),student:{id:u.id,name:u.name,student_number:u.studentNo,role:void 0,group_name:u.groupName,points:J,focusPercentage:u.focusScore,competencyScores:u.competencyScores},lessonId:o,classId:n,lang:r,addToast:c,onInspectSandbox:()=>d?.(u),onAwardPoints:(O,H,ee)=>R("attribution",H,ee||"课堂表现")})]}):null}function Wa({isOpen:s,onClose:i,classId:n,lessonId:o,students:a=[],lang:t="zh",addToast:r,onSelectStudentToAward:c,onViewStudentProfile:x}){const[d,m]=l.useState("groups"),[u,v]=l.useState("group-1"),[N,g]=l.useState(null),[p,j]=l.useState(null),k=l.useMemo(()=>{if(a.length===0)return[];const b=new Map;for(const z of a){const _=(z.groupName||"").trim()||(t==="zh"?"未分组":"Ungrouped"),C=b.get(_)??[];C.push(z),b.set(_,C)}return Array.from(b.entries()).map(([z,_],C)=>{const B=_.reduce((R,J)=>R+(J.currentPoints??0),0);return{id:`group-${C+1}`,name:z,totalScore:B,rank:0,members:_,growthScore:void 0}}).sort((z,_)=>_.totalScore-z.totalScore).map((z,_)=>({...z,rank:_+1}))},[a,t]),w=(b,z,_,C)=>{g(`${z} 全员 +${_} (${C})`),setTimeout(()=>g(null),3e3),r?.(t==="zh"?"小组集体加分":"Team Points Awarded",`${z} 全员 +${_} (${C})`,"success")},f=()=>{r?.(t==="zh"?"大屏榜单已同步":"Stage Display Synced",t==="zh"?"当前积分榜动效已实时推送到教室主大屏幕":"Leaderboard broadcasted to stage display","info")};return s?e.jsxs("div",{role:"dialog","aria-modal":"true",className:"fixed inset-0 z-50 flex items-center justify-center p-4 bg-slate-900/60 backdrop-blur-sm animate-in fade-in duration-200",children:[e.jsxs("div",{className:"relative w-full max-w-3xl bg-surface border border-border/80 rounded-2xl shadow-2xl overflow-hidden flex flex-col select-none max-h-[85vh]",children:[e.jsxs("div",{className:"px-5 py-3.5 border-b border-border/60 bg-surface-secondary/40 flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-2.5",children:[e.jsx("span",{className:"w-8 h-8 rounded-xl bg-amber-500/10 text-amber-600 dark:text-amber-400 flex items-center justify-center text-base",children:"🏆"}),e.jsxs("div",{children:[e.jsx("h3",{className:"font-extrabold text-sm text-foreground",children:t==="zh"?"全班积分榜与小组积分明细":"Class Points & Team Leaderboard"}),e.jsx("p",{className:"text-[11px] text-muted",children:t==="zh"?"随堂表现实时积分累加,激发小组合作共进":"Live classroom performance points & teamwork league"})]})]}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsxs("div",{className:"flex items-center p-0.5 rounded-lg bg-surface border border-border text-xs",children:[e.jsx("button",{onClick:()=>m("groups"),className:`px-3 py-1 rounded-md font-bold transition-all cursor-pointer ${d==="groups"?"bg-primary-theme text-white shadow-3xs":"text-muted hover:text-foreground"}`,children:t==="zh"?"小组联赛":"Teams"}),e.jsx("button",{onClick:()=>m("individual"),className:`px-3 py-1 rounded-md font-bold transition-all cursor-pointer ${d==="individual"?"bg-primary-theme text-white shadow-3xs":"text-muted hover:text-foreground"}`,children:t==="zh"?"个人英雄榜":"Individual"})]}),e.jsx("button",{onClick:i,className:"p-1.5 rounded-lg text-muted hover:text-foreground hover:bg-surface-secondary transition-colors cursor-pointer",children:e.jsx(be,{size:18})})]})]}),N&&e.jsxs("div",{className:"mx-5 mt-4 p-2.5 rounded-xl bg-amber-500/15 border border-amber-400/50 text-amber-700 dark:text-amber-300 flex items-center justify-between text-xs font-bold animate-in fade-in",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(fe,{size:16,className:"text-amber-500 animate-bounce"}),e.jsx("span",{children:N})]}),e.jsx("span",{className:"text-[10px] text-amber-600 dark:text-amber-400",children:t==="zh"?"大屏同步广播":"Synced to Stage"})]}),e.jsx("div",{className:"p-5 space-y-3.5 overflow-y-auto flex-1",children:d==="groups"?e.jsx("div",{className:"space-y-3",children:k.map(b=>{const z=u===b.id,_=b.rank===1?"bg-amber-500 text-white":b.rank===2?"bg-slate-400 text-white":b.rank===3?"bg-amber-700/80 text-white":"bg-surface-secondary text-muted";return e.jsxs("div",{className:"border border-border/80 rounded-xl bg-surface-secondary/20 overflow-hidden shadow-3xs transition-all",children:[e.jsxs("div",{className:"p-3.5 flex flex-wrap items-center justify-between gap-3 bg-surface hover:bg-surface-secondary/30 transition",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("span",{className:`w-6 h-6 rounded-lg ${_} font-mono font-extrabold text-xs flex items-center justify-center`,children:b.rank}),e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("h4",{className:"font-extrabold text-sm text-foreground",children:b.name}),e.jsx("span",{className:"text-[11px] font-mono text-emerald-600 dark:text-emerald-400 bg-emerald-500/10 px-1.5 py-0.2 rounded font-bold",children:typeof b.growthScore=="number"?t==="zh"?`本节 +${b.growthScore}`:`+${b.growthScore}`:""})]}),e.jsx("span",{className:"text-[11px] text-muted",children:t==="zh"?`组内成员 ${b.members.length} 人 · 均分 ${Math.round(b.totalScore/b.members.length)} 分`:`${b.members.length} members`})]})]}),e.jsxs("div",{className:"flex items-center gap-2.5",children:[e.jsxs("span",{className:"font-mono text-base font-extrabold text-primary-theme pr-2",children:[b.totalScore,e.jsx("span",{className:"text-xs font-normal text-muted ml-0.5",children:t==="zh"?"分":"pts"})]}),e.jsxs("button",{onClick:()=>w(b.id,b.name,2,t==="zh"?"团队协作之星:组内积极帮扶答疑":"Team Collaboration Star"),className:"px-2.5 py-1 rounded-lg bg-indigo-500/10 hover:bg-indigo-500/20 text-indigo-600 dark:text-indigo-400 border border-indigo-200 dark:border-indigo-800 text-xs font-semibold flex items-center gap-1 transition cursor-pointer",title:t==="zh"?"整组每人 +2 协作分":"Whole group +2 Collaboration points",children:[e.jsx(rt,{size:12}),e.jsxs("span",{children:["+2 ",t==="zh"?"协作":"Collab"]})]}),e.jsxs("button",{onClick:()=>w(b.id,b.name,1,t==="zh"?"全员全勤奖:按时到齐投入学习":"Perfect Attendance Award"),className:"px-2.5 py-1 rounded-lg bg-emerald-500/10 hover:bg-emerald-500/20 text-emerald-600 dark:text-emerald-400 border border-emerald-200 dark:border-emerald-800 text-xs font-semibold flex items-center gap-1 transition cursor-pointer",title:t==="zh"?"整组每人 +1 全勤分":"Whole group +1 Attendance points",children:[e.jsx(ar,{size:12}),e.jsxs("span",{children:["+1 ",t==="zh"?"全勤":"Attendance"]})]}),e.jsx("button",{onClick:()=>v(z?null:b.id),className:"p-1 rounded-lg text-muted hover:text-foreground hover:bg-surface-secondary transition cursor-pointer",children:z?e.jsx(os,{size:16}):e.jsx(is,{size:16})})]})]}),z&&e.jsx("div",{className:"px-4 py-2.5 bg-surface-secondary/40 border-t border-border/60 space-y-1.5 animate-in slide-in-from-top-1 duration-150",children:b.members.map(C=>e.jsxs("div",{className:"p-2 rounded-lg bg-surface border border-border/60 flex items-center justify-between text-xs hover:border-primary-theme/40 transition",children:[e.jsxs("div",{className:"flex items-center gap-2.5",children:[e.jsx("span",{className:"w-5 h-5 rounded-md bg-surface-secondary text-muted font-mono font-bold text-[10px] flex items-center justify-center",children:C.seatNumber?.slice(-2)||"01"}),e.jsx("span",{className:"font-bold text-foreground",children:C.name}),e.jsx("span",{className:"text-[11px] text-muted font-mono",children:C.studentNo})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("span",{className:"font-mono font-bold text-foreground",children:[C.currentPoints??28," ",e.jsx("span",{className:"text-[10px] text-muted",children:"分"})]}),e.jsxs("button",{onClick:()=>{x?x(C):j(C)},className:"px-2 py-0.5 rounded bg-surface-secondary hover:bg-surface text-foreground font-semibold text-[11px] transition border border-border cursor-pointer flex items-center gap-0.5",title:t==="zh"?"查看学情档案":"View Profile",children:[e.jsx(_e,{size:11,className:"text-primary-theme"}),e.jsx("span",{children:t==="zh"?"档案":"Profile"})]}),c&&e.jsx("button",{onClick:()=>{i(),c(C)},className:"px-2 py-0.5 rounded bg-primary-theme/10 hover:bg-primary-theme/20 text-primary-theme font-semibold text-[11px] transition cursor-pointer",children:t==="zh"?"单人评价":"Award"})]})]},C.id))})]},b.id)})}):e.jsx("div",{className:"space-y-1.5",children:a.map((b,z)=>e.jsxs("div",{className:"p-3 rounded-xl border border-border/80 bg-surface flex items-center justify-between text-xs hover:bg-surface-secondary/30 transition shadow-3xs",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("span",{className:`w-6 h-6 rounded-lg font-mono font-bold text-xs flex items-center justify-center ${z===0?"bg-amber-500 text-white":z===1?"bg-slate-400 text-white":z===2?"bg-amber-700/80 text-white":"bg-surface-secondary text-muted"}`,children:z+1}),e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"font-extrabold text-foreground",children:b.name}),e.jsx("span",{className:"px-1.5 py-0.2 rounded-full bg-indigo-500/10 text-indigo-600 dark:text-indigo-400 text-[10px] font-bold",children:b.groupName||(t==="zh"?"未分组":"Ungrouped")})]}),e.jsx("span",{className:"text-[11px] text-muted font-mono",children:b.studentNo})]})]}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsxs("span",{className:"inline-flex items-center gap-1 text-emerald-600 dark:text-emerald-400 font-semibold text-[11px]",children:[e.jsx(ps,{size:12}),e.jsx("span",{children:typeof b.focusScore=="number"?`${b.focusScore}%`:"—"})]}),e.jsxs("span",{className:"font-mono font-extrabold text-sm text-primary-theme",children:[b.currentPoints??0," ",e.jsx("span",{className:"text-xs font-normal text-muted",children:"分"})]}),e.jsxs("button",{onClick:()=>{x?x(b):j(b)},className:"px-2.5 py-1 rounded-lg bg-surface-secondary hover:bg-surface text-foreground font-semibold text-xs transition border border-border cursor-pointer flex items-center gap-1 shadow-3xs",title:t==="zh"?"查看学情成长雷达档案":"View Growth Profile",children:[e.jsx(_e,{size:12,className:"text-primary-theme"}),e.jsx("span",{children:t==="zh"?"档案":"Profile"})]}),c&&e.jsx("button",{onClick:()=>{i(),c(b)},className:"px-2.5 py-1 rounded-lg bg-primary-theme/10 hover:bg-primary-theme/20 text-primary-theme font-bold text-xs transition cursor-pointer",children:t==="zh"?"加分":"Award"})]})]},b.id))})}),e.jsxs("div",{className:"p-4 border-t border-border/60 bg-surface-secondary/30 flex flex-wrap items-center justify-between gap-3",children:[e.jsxs("button",{onClick:f,className:"px-3.5 py-1.5 rounded-lg bg-indigo-600 hover:bg-indigo-700 text-white font-bold text-xs transition flex items-center gap-1.5 shadow-xs cursor-pointer",children:[e.jsx(De,{size:13}),e.jsx("span",{children:t==="zh"?"同步至班级大屏勋章榜":"Sync to Stage Display"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(oe,{slot:"classroom.leaderboard.action",slotProps:{classId:n,lessonId:o,groups:k}}),e.jsx("button",{onClick:i,className:"px-4 py-1.5 border border-border text-foreground hover:bg-surface-secondary rounded-lg text-xs font-semibold transition cursor-pointer",children:t==="zh"?"关闭":"Close"})]})]})]}),p&&e.jsx(Ns,{isOpen:!!p,onClose:()=>j(null),student:{id:p.id,name:p.name,student_number:p.studentNo,group_name:p.groupName,points:p.currentPoints,focusPercentage:p.focusScore},lessonId:o,classId:n,lang:t,addToast:r})]}):null}function Ua({lessonId:s,lessonTitle:i,classId:n,lang:o="zh",addToast:a,currentStage:t,onStageChange:r,students:c=[]}){const[x,d]=l.useState("IN_CLASS_TEACHING"),m=t!==void 0?t:x,u=T=>{d(T),r?.(T)},[v,N]=l.useState(!1),[g,p]=l.useState(!1),[j,k]=l.useState(!1),[w,f]=l.useState(!1),[b,z]=l.useState("课堂极速单选投票"),[_,C]=l.useState("ABCD"),[B,R]=l.useState(["A","B","C","D"]),[J,O]=l.useState(""),[H,ee]=l.useState([]),[se,I]=l.useState(!1),[V,P]=l.useState(null),[y,M]=l.useState(null),[$,S]=l.useState({TOO_FAST:0,SLOW:0,CONFUSED:0,CLEAR:0}),[E,Q]=l.useState(!1),[ie,pe]=l.useState(null),[ce,G]=l.useState(!1);if(l.useEffect(()=>{if(!s)return;let T=!0;const re=async()=>{try{const ye=await fetch(`/api/classroom/sessions/${s}`);if(ye.ok&&T){const we=await ye.json();we.hasActiveSession&&we.stage&&u(we.stage),P(we.activePoll||null),M(we.activeBuzzer||null)}const ze=await fetch(`/api/classroom/stage/${s}/data`);if(ze.ok&&T){const we=await ze.json();S(we.pacing||{TOO_FAST:0,SLOW:0,CONFUSED:0,CLEAR:0})}}catch{}};re();const xe=setInterval(re,3e3);return()=>{T=!1,clearInterval(xe)}},[s]),!s)return null;const K=async T=>{try{const re=await fetch(`/api/classroom/sessions/${s}/stage`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({stage:T,classId:n})});if(re.ok){if(u(T),a(o==="zh"?"课堂阶段已切换":"Classroom Stage Updated",o==="zh"?`当前进入阶段:${T}`:`Current stage: ${T}`,"success"),T==="ARCHIVED_REPORT"){const xe=await fetch(`/api/classroom/sessions/${s}/panoramic-report`);if(xe.ok){const ye=await xe.json();pe(ye),G(!0)}}}else{const xe=await re.json();a(o==="zh"?"阶段切换被拦截":"Stage Transition Blocked",xe.error||"Check guards","warning")}}catch(re){a("Error",re.message,"error")}},le=l.useCallback(async()=>{if(s){I(!0);try{const T=await fetch(`/api/lessons/${s}/preset-polls`);if(T.ok){const re=await T.json();ee(re.presets||[])}}catch{}finally{I(!1)}}},[s]);l.useEffect(()=>{w&&le()},[w,le]);const de=T=>{C(T),T==="ABCD"?R(["A","B","C","D"]):T==="TF"&&R(["正确","错误"]),O("")},ue=async()=>{if(!s||!b.trim()){a(o==="zh"?"保存失败":"Save Failed",o==="zh"?"题目标题不能为空":"Title required","warning");return}try{(await fetch(`/api/lessons/${s}/preset-polls`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({title:b,questionType:_,options:B,correctOption:J||null})})).ok&&(a(o==="zh"?"已保存":"Saved",o==="zh"?"题目已保存到本课程题库":"Preset saved","success"),le())}catch(T){a("Error",T.message,"error")}},ve=async T=>{if(s)try{await fetch(`/api/lessons/${s}/preset-polls/${T}`,{method:"DELETE"}),ee(re=>re.filter(xe=>xe.id!==T))}catch(re){a("Error",re.message,"error")}},A=T=>{z(T.title),C(T.questionType),R([...T.options]),O(T.correctOption||"")},L=async(T,re,xe,ye)=>{try{const ze=T||b,we=re||_,We=xe||B,Ke=ye!==void 0?ye:J||null,W=await fetch(`/api/classroom/sessions/${s}/quick-poll`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({title:ze,questionType:we,options:We,correctOption:Ke})});if(W.ok){const ae=await W.json();P(ae.poll),f(!1),a(o==="zh"?"极速投票已启动":"Quick Poll Launched",o==="zh"?"学生端已弹出作答卡,大屏展台同步更新":"Poll active for students","success")}}catch(ze){a("Error",ze.message,"error")}},Y=async()=>{if(V)try{await fetch(`/api/classroom/sessions/${s}/quick-poll/${V.id}/close`,{method:"POST"}),P(null),a(o==="zh"?"投票已结束":"Poll Closed",o==="zh"?"已汇总全班作答结果":"Results aggregated","info")}catch(T){a("Error",T.message,"error")}},te=async()=>{try{const T=await fetch(`/api/classroom/sessions/${s}/buzzer`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({title:"全班极速抢答"})});if(T.ok){const re=await T.json();M(re.buzzer),a(o==="zh"?"抢答器已激活":"Buzzer Ready",o==="zh"?"学生端已出现红色抢答按钮":"Students can buzz now","success")}}catch(T){a("Error",T.message,"error")}},U=async()=>{if(y)try{await fetch(`/api/classroom/sessions/${s}/buzzer/${y.id}/reset`,{method:"POST"}),M(T=>T?{...T,status:"READY",winner_student_id:null}:null),a(o==="zh"?"抢答已重置":"Buzzer Reset","","info")}catch(T){a("Error",T.message,"error")}},Z=[{id:"PRE_CLASS_READY",labelZh:"课前就绪",labelEn:"Pre-Class"},{id:"IN_CLASS_TEACHING",labelZh:"课中授课",labelEn:"Teaching"},{id:"WRAP_UP_EXIT_TICKET",labelZh:"结课通票",labelEn:"Exit Ticket"},{id:"ARCHIVED_REPORT",labelZh:"学情简报",labelEn:"Report"}];return e.jsxs("div",{id:"classroom-interactive-cockpit",className:"bg-surface border-b border-border/80 px-4 py-2.5 flex flex-wrap items-center justify-between gap-3 select-none text-xs transition-colors",children:[e.jsx("div",{className:"flex items-center gap-1.5 bg-surface-secondary/70 p-1 rounded-xl border border-border/60 shadow-3xs",children:Z.map((T,re)=>{const xe=m===T.id;return e.jsxs("button",{onClick:()=>K(T.id),className:`px-3 py-1.5 rounded-lg font-bold flex items-center gap-1.5 transition-all cursor-pointer ${xe?"bg-primary-theme text-white shadow-sm ring-2 ring-primary-theme/20":"text-muted hover:text-foreground hover:bg-surface"}`,children:[e.jsx("span",{className:"w-4 h-4 rounded-full bg-white/20 flex items-center justify-center text-[10px]",children:re+1}),e.jsx("span",{children:o==="zh"?T.labelZh:T.labelEn})]},T.id)})}),e.jsxs("div",{className:"flex items-center gap-2",children:[V&&V.status==="ACTIVE"?e.jsxs("button",{onClick:Y,className:"px-3 py-1.5 bg-amber-500 text-white font-bold rounded-lg hover:bg-amber-600 transition-colors flex items-center gap-1.5 shadow-3xs cursor-pointer animate-pulse",children:[e.jsx(je,{size:13}),e.jsx("span",{children:o==="zh"?`结束投票 (${V.totalVotes||0}人)`:`Close Poll (${V.totalVotes||0})`})]}):e.jsxs("button",{onClick:()=>f(!0),className:"px-3 py-1.5 bg-surface-secondary hover:bg-surface border border-border/80 text-foreground font-semibold rounded-lg transition-colors flex items-center gap-1.5 shadow-3xs cursor-pointer",children:[e.jsx(fe,{size:13,className:"text-amber-500"}),e.jsx("span",{children:o==="zh"?"极速投票":"Quick Poll"})]}),y?e.jsxs("button",{onClick:U,className:"px-3 py-1.5 bg-rose-500 text-white font-bold rounded-lg hover:bg-rose-600 transition-colors flex items-center gap-1.5 shadow-3xs cursor-pointer",children:[e.jsx(ut,{size:13}),e.jsx("span",{children:o==="zh"?"重置抢答":"Reset Buzzer"})]}):e.jsxs("button",{onClick:te,className:"px-3 py-1.5 bg-surface-secondary hover:bg-surface border border-border/80 text-foreground font-semibold rounded-lg transition-colors flex items-center gap-1.5 shadow-3xs cursor-pointer",children:[e.jsx(us,{size:13,className:"text-rose-500"}),e.jsx("span",{children:o==="zh"?"发起抢答":"Start Buzzer"})]}),e.jsxs("button",{onClick:()=>K("WRAP_UP_EXIT_TICKET"),className:"px-3 py-1.5 bg-surface-secondary hover:bg-surface border border-border/80 text-foreground font-semibold rounded-lg transition-colors flex items-center gap-1.5 shadow-3xs cursor-pointer",title:"发起 60 秒下课通票",children:[e.jsx(je,{size:13,className:"text-indigo-500"}),e.jsx("span",{children:o==="zh"?"60s 通票":"Exit Ticket"})]}),e.jsxs("button",{onClick:()=>N(!0),className:"px-3 py-1.5 bg-blue-50 hover:bg-blue-100 dark:bg-blue-950/40 dark:hover:bg-blue-900/50 border border-blue-200 dark:border-blue-800 text-blue-700 dark:text-blue-300 font-bold rounded-lg transition-colors flex items-center gap-1.5 shadow-3xs cursor-pointer",children:[e.jsx(sr,{size:13,className:"text-blue-500"}),e.jsx("span",{children:o==="zh"?"打开大屏展台":"Stage Display"})]}),e.jsxs("button",{onClick:()=>p(!0),className:"px-3 py-1.5 bg-indigo-50 hover:bg-indigo-100 dark:bg-indigo-950/40 dark:hover:bg-indigo-900/50 border border-indigo-200 dark:border-indigo-800 text-indigo-700 dark:text-indigo-300 font-bold rounded-lg transition-colors flex items-center gap-1.5 shadow-3xs cursor-pointer",title:o==="zh"?"随机抽问与归因表现激励":"Random Pick & Attribution Points",children:[e.jsx(aa,{size:13,className:"text-indigo-500"}),e.jsx("span",{children:o==="zh"?"随机抽问":"Roll Call"})]}),e.jsxs("button",{onClick:()=>k(!0),className:"px-3 py-1.5 bg-amber-50 hover:bg-amber-100 dark:bg-amber-950/40 dark:hover:bg-amber-900/50 border border-amber-200 dark:border-amber-800 text-amber-700 dark:text-amber-300 font-bold rounded-lg transition-colors flex items-center gap-1.5 shadow-3xs cursor-pointer",title:o==="zh"?"全班积分榜与小组联赛":"Class Points & Team Leaderboard",children:[e.jsx(Oe,{size:13,className:"text-amber-500"}),e.jsx("span",{children:o==="zh"?"积分榜":"Leaderboard"})]}),e.jsx(oe,{slot:"classroom.quick_activity",slotProps:{lessonId:s,classId:n,stage:m}}),e.jsx(oe,{slot:"classroom.topbar.action",slotProps:{lessonId:s,classId:n,stage:m}}),e.jsx(oe,{slot:"classroom.topbar.pill",slotProps:{lessonId:s,classId:n,stage:m}})]}),e.jsx("div",{className:"flex items-center gap-2 pl-2 border-l border-border/60",children:e.jsxs("button",{onClick:()=>Q(!0),className:"flex items-center gap-1.5 px-2 py-1 rounded-xl hover:bg-surface-secondary transition-colors cursor-pointer group",title:o==="zh"?"打开课堂反馈情绪仪表盘":"Open feedback dashboard",children:[e.jsxs("div",{className:"flex items-center gap-1 text-[11px] font-semibold text-muted group-hover:text-main",children:[e.jsx(_e,{size:12,className:"text-primary-theme"}),e.jsx("span",{children:o==="zh"?"节奏晴雨表:":"Barometer:"})]}),e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsxs("span",{className:"px-2 py-0.5 rounded-full bg-emerald-500/10 text-emerald-600 dark:text-emerald-400 font-bold text-[10px]",title:"理解 / 节奏适宜",children:["💡 ",$.CLEAR||0]}),e.jsxs("span",{className:"px-2 py-0.5 rounded-full bg-amber-500/10 text-amber-600 dark:text-amber-400 font-bold text-[10px]",title:"困惑",children:["❓ ",$.CONFUSED||0]}),e.jsxs("span",{className:"px-2 py-0.5 rounded-full bg-rose-500/10 text-rose-600 dark:text-rose-400 font-bold text-[10px]",title:"慢一点(讲太快)",children:["🐇 ",$.TOO_FAST||0]}),e.jsxs("span",{className:"px-2 py-0.5 rounded-full bg-indigo-500/10 text-indigo-600 dark:text-indigo-400 font-bold text-[10px]",title:"快一点(讲太慢)",children:["🐢 ",$.SLOW||0]})]})]})}),E&&s&&e.jsx(Fa,{lessonId:s,lang:o==="zh"?"zh":"en",signals:$,onlineCount:c?.filter(T=>T.online).length||0,onClose:()=>Q(!1)}),e.jsx(Oa,{isOpen:v,onClose:()=>N(!1),lessonId:s,lessonTitle:i,lang:o}),e.jsx(Ga,{isOpen:g,onClose:()=>p(!1),classId:n,lessonId:s,students:c,lang:o,addToast:a,onOpenLeaderboard:()=>k(!0)}),e.jsx(Wa,{isOpen:j,onClose:()=>k(!1),classId:n,lessonId:s,students:c,lang:o,addToast:a,onSelectStudentToAward:()=>{k(!1),p(!0)}}),w&&e.jsx("div",{className:"fixed inset-0 z-50 bg-black/50 backdrop-blur-xs flex items-center justify-center p-4",children:e.jsxs("div",{className:"bg-surface rounded-2xl border border-border p-6 w-full max-w-lg shadow-xl flex flex-col gap-4 max-h-[85vh] overflow-y-auto",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("h3",{className:"font-bold text-base text-foreground flex items-center gap-2",children:[e.jsx(fe,{size:18,className:"text-amber-500"}),e.jsx("span",{children:o==="zh"?"极速投票配置":"Quick Poll Setup"})]}),e.jsx("button",{type:"button",onClick:()=>f(!1),className:"p-1.5 rounded-lg text-muted hover:bg-surface-secondary transition-colors cursor-pointer",children:e.jsx(be,{size:16})})]}),H.length>0&&e.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsxs("div",{className:"flex items-center gap-1.5 text-xs font-semibold text-muted",children:[e.jsx(ot,{size:13}),e.jsx("span",{children:o==="zh"?`本课已保存题目 (${H.length})`:`Saved Presets (${H.length})`})]}),e.jsx("div",{className:"flex flex-col gap-1.5 max-h-40 overflow-y-auto pr-1",children:H.map(T=>e.jsxs("div",{className:"flex items-center gap-2 p-2 rounded-lg border border-border/60 bg-surface-secondary/50 hover:bg-surface-secondary transition-colors group",children:[e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("div",{className:"text-sm font-medium text-foreground truncate",children:T.title}),e.jsxs("div",{className:"text-xs text-muted flex items-center gap-1.5 mt-0.5",children:[e.jsx("span",{className:"px-1.5 py-0.5 rounded bg-surface-secondary border border-border text-[10px] font-bold",children:T.questionType==="TF"?"判断":T.questionType==="ABCD"?"ABCD":"自定义"}),e.jsx("span",{className:"truncate",children:T.options.join(" / ")}),T.correctOption&&e.jsxs("span",{className:"flex items-center gap-0.5 text-emerald-500",children:[e.jsx(rt,{size:10,className:"fill-current"}),T.correctOption]})]})]}),e.jsxs("div",{className:"flex items-center gap-1 shrink-0 opacity-60 group-hover:opacity-100 transition-opacity",children:[e.jsx("button",{type:"button",onClick:()=>A(T),className:"p-1.5 rounded-md hover:bg-primary-theme/10 text-primary-theme transition-colors cursor-pointer",title:o==="zh"?"引入到编辑器":"Load to editor",children:e.jsx(na,{size:14})}),e.jsx("button",{type:"button",onClick:()=>L(T.title,T.questionType,T.options,T.correctOption),className:"p-1.5 rounded-md hover:bg-emerald-500/10 text-emerald-500 transition-colors cursor-pointer",title:o==="zh"?"直接发送":"Send now",children:e.jsx(Tt,{size:14})}),e.jsx("button",{type:"button",onClick:()=>ve(T.id),className:"p-1.5 rounded-md hover:bg-red-500/10 text-red-400 transition-colors cursor-pointer",title:o==="zh"?"删除":"Delete",children:e.jsx(at,{size:14})})]})]},T.id))})]}),se&&e.jsx("div",{className:"text-xs text-muted text-center py-2",children:o==="zh"?"加载预设题库...":"Loading presets..."}),H.length>0&&e.jsx("div",{className:"border-t border-border/60"}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx("label",{className:"font-semibold text-muted text-xs",children:o==="zh"?"投票标题 / 题干":"Poll Title / Question"}),e.jsx("input",{type:"text",value:b,onChange:T=>z(T.target.value),placeholder:o==="zh"?"例:下列哪个选项正确?":"e.g. Which is correct?",className:"w-full px-3 py-2 bg-surface-secondary border border-border rounded-lg text-foreground text-sm focus:outline-hidden focus:ring-2 focus:ring-primary-theme"})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx("label",{className:"font-semibold text-muted text-xs",children:o==="zh"?"题型选择":"Question Type"}),e.jsx("div",{className:"grid grid-cols-3 gap-2",children:[{key:"ABCD",label:"ABCD 四选一"},{key:"TF",label:"正确 / 错误"},{key:"CUSTOM",label:"自定义选项"}].map(({key:T,label:re})=>e.jsx("button",{type:"button",onClick:()=>de(T),className:`p-2 rounded-lg border font-bold text-center text-xs transition-colors cursor-pointer ${_===T?"border-primary-theme bg-primary-theme/10 text-primary-theme":"border-border bg-surface-secondary text-muted"}`,children:re},T))})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsxs("label",{className:"font-semibold text-muted text-xs",children:[o==="zh"?"选项列表":"Options"," ",J&&e.jsxs("span",{className:"text-emerald-500 ml-1",children:["✓ ",o==="zh"?"参考答案":"Answer",": ",J]})]}),e.jsx("div",{className:"flex flex-col gap-1.5",children:B.map((T,re)=>e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx("button",{type:"button",onClick:()=>O(J===T?"":T),className:`p-1.5 rounded-md transition-colors cursor-pointer shrink-0 ${J===T?"text-emerald-500 bg-emerald-500/10":"text-muted/40 hover:text-emerald-400"}`,title:o==="zh"?"设为参考答案":"Set as correct",children:e.jsx(rt,{size:14,className:J===T?"fill-current":""})}),e.jsx("input",{type:"text",value:T,onChange:xe=>{const ye=[...B];ye[re]=xe.target.value,R(ye),_!=="CUSTOM"&&C("CUSTOM")},className:"flex-1 px-3 py-1.5 bg-surface-secondary border border-border rounded-lg text-foreground text-sm focus:outline-hidden focus:ring-2 focus:ring-primary-theme"}),B.length>2&&e.jsx("button",{type:"button",onClick:()=>{const xe=B.filter((ye,ze)=>ze!==re);R(xe),J===T&&O(""),_!=="CUSTOM"&&C("CUSTOM")},className:"p-1.5 rounded-md text-red-400 hover:bg-red-500/10 transition-colors cursor-pointer shrink-0",children:e.jsx(at,{size:14})})]},re))}),B.length<8&&e.jsxs("button",{type:"button",onClick:()=>{R([...B,`选项${B.length+1}`]),_!=="CUSTOM"&&C("CUSTOM")},className:"flex items-center gap-1.5 text-xs text-primary-theme hover:text-primary-theme-hover font-semibold mt-1 cursor-pointer",children:[e.jsx(nr,{size:13}),o==="zh"?"添加选项":"Add Option"," ",e.jsxs("span",{className:"text-muted font-normal",children:["(",B.length,"/8)"]})]})]}),e.jsxs("div",{className:"flex items-center justify-between gap-2 pt-2 border-t border-border/60",children:[e.jsxs("button",{type:"button",onClick:ue,className:"flex items-center gap-1.5 px-3 py-2 rounded-lg text-sm font-semibold text-muted hover:bg-surface-secondary border border-border/60 transition-colors cursor-pointer",children:[e.jsx(ls,{size:14}),o==="zh"?"保存到本课程":"Save to Lesson"]}),e.jsxs("button",{type:"button",onClick:()=>L(),className:"flex items-center gap-1.5 px-4 py-2 bg-primary-theme text-white font-bold rounded-lg hover:bg-primary-theme-hover transition-colors cursor-pointer",children:[e.jsx(Tt,{size:14}),o==="zh"?"立即发布":"Launch"]})]})]})}),ce&&ie&&e.jsx("div",{className:"fixed inset-0 z-50 bg-black/60 backdrop-blur-xs flex items-center justify-center p-4",children:e.jsxs("div",{className:"bg-surface rounded-3xl border border-border p-8 w-full max-w-2xl shadow-2xl flex flex-col gap-6 max-h-[90vh] overflow-y-auto",children:[e.jsxs("div",{className:"flex items-center justify-between border-b border-border/80 pb-4",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"p-3 bg-primary-theme/10 text-primary-theme rounded-2xl",children:e.jsx(or,{size:28})}),e.jsxs("div",{children:[e.jsx("h3",{className:"text-xl font-black text-foreground",children:o==="zh"?"全景课堂学情简报":"Panoramic Classroom Report"}),e.jsx("p",{className:"text-xs text-muted",children:o==="zh"?`授课时长: ${ie.session?.durationMin||0} 分钟`:"Session Summary"})]})]}),e.jsx("button",{onClick:()=>G(!1),className:"p-2 text-muted hover:text-foreground rounded-lg cursor-pointer",children:"✕"})]}),e.jsxs("div",{className:"grid grid-cols-3 gap-4",children:[e.jsxs("div",{className:"p-4 bg-surface-secondary rounded-2xl border border-border/80 flex flex-col items-center text-center",children:[e.jsx("span",{className:"text-xs font-bold text-muted mb-1",children:o==="zh"?"随堂测验正确率":"Quiz Accuracy"}),e.jsxs("span",{className:"text-3xl font-black text-emerald-500 font-mono",children:[ie.metrics?.quizAccuracy||0,"%"]}),e.jsxs("span",{className:"text-[10px] text-muted mt-1",children:[ie.metrics?.quizCount||0," 题次提交"]})]}),e.jsxs("div",{className:"p-4 bg-surface-secondary rounded-2xl border border-border/80 flex flex-col items-center text-center",children:[e.jsx("span",{className:"text-xs font-bold text-muted mb-1",children:o==="zh"?"课堂互动参与人次":"Poll Interactions"}),e.jsx("span",{className:"text-3xl font-black text-amber-500 font-mono",children:ie.metrics?.pollVotesTotal||0}),e.jsx("span",{className:"text-[10px] text-muted mt-1",children:"口播投票互动"})]}),e.jsxs("div",{className:"p-4 bg-surface-secondary rounded-2xl border border-border/80 flex flex-col items-center text-center",children:[e.jsx("span",{className:"text-xs font-bold text-muted mb-1",children:o==="zh"?"结课通票综合评分":"Exit Ticket Rating"}),e.jsxs("span",{className:"text-3xl font-black text-indigo-500 font-mono",children:[ie.metrics?.exitTicketsAvgRating||5," ★"]}),e.jsxs("span",{className:"text-[10px] text-muted mt-1",children:[ie.metrics?.exitTicketsCount||0," 人提交"]})]})]}),ie.metrics?.topPuzzledConcepts?.length>0&&e.jsxs("div",{className:"p-4 bg-amber-500/5 rounded-2xl border border-amber-500/20 flex flex-col gap-2",children:[e.jsx("span",{className:"text-xs font-bold text-amber-600 dark:text-amber-400",children:o==="zh"?"📌 需重点讲评或个别辅导的困惑点 (来自结课通票)":"Top Puzzled Concepts"}),e.jsx("div",{className:"flex flex-wrap gap-2 mt-1",children:ie.metrics.topPuzzledConcepts.map((T,re)=>e.jsx("span",{className:"px-3 py-1 bg-amber-500/10 text-amber-700 dark:text-amber-300 font-medium rounded-lg text-xs border border-amber-500/30",children:T},re))})]}),e.jsx("div",{className:"flex justify-end",children:e.jsx("button",{onClick:()=>G(!1),className:"px-6 py-2.5 bg-primary-theme text-white font-bold rounded-xl hover:bg-primary-theme-hover transition-colors cursor-pointer",children:o==="zh"?"完成归档":"Done"})})]})})]})}function Ha({lessonId:s,classId:i,lang:n="zh"}){const[o,a]=l.useState(null),[t,r]=l.useState(!1),[c,x]=l.useState(1),d=()=>{s&&(r(!0),fetch(`/api/lessons/${s}/pre-class-diagnostic${i?`?classId=${encodeURIComponent(i)}`:""}`).then(j=>{if(!j.ok)throw new Error("Failed to load diagnostic");return j.json()}).then(j=>{a(j)}).catch(j=>{console.warn("[PreClassDiagnosticHub] fetch fallback:",j)}).finally(()=>{r(!1)}))};if(l.useEffect(()=>{d()},[s,i]),!s)return null;const m=o?.prepSummary||{totalStudents:0,completedCount:0,completionRate:0},u=o?.topMistakes||[],v=o?.icebreakerStats||{fullPower:0,needCoffee:0,needHelp:0},N=v.fullPower+v.needCoffee+v.needHelp,g=N>0,p=Math.max(1,N);return e.jsxs("div",{className:"bg-surface border border-theme rounded-2xl p-4 shadow-sm flex flex-col gap-3",children:[e.jsxs("div",{className:"flex items-center justify-between border-b border-theme pb-2.5",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:"p-1.5 rounded-lg bg-indigo-500/10 text-indigo-600 dark:text-indigo-400",children:e.jsx(oa,{size:16})}),e.jsx("div",{children:e.jsxs("h3",{className:"text-xs font-black uppercase text-main tracking-wider flex items-center gap-1.5",children:[e.jsx("span",{children:n==="zh"?"预习学情穿透看板 (以学定教)":"Pre-Lesson Diagnostic Hub"}),e.jsx("span",{className:"px-1.5 py-0.2 rounded-md bg-indigo-100 dark:bg-indigo-900/60 text-indigo-700 dark:text-indigo-300 text-[10px] font-mono font-bold",children:"AI Diagnostic"})]})})]}),e.jsx("button",{onClick:d,disabled:t,className:"p-1 text-muted hover:text-main rounded-md hover:bg-surface-secondary transition-colors cursor-pointer",title:n==="zh"?"刷新学情数据":"Refresh Diagnostics",children:e.jsx($e,{size:12,className:t?"animate-spin":""})})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[e.jsxs("div",{className:"p-2.5 rounded-xl bg-surface-secondary/60 border border-theme/60 flex flex-col justify-between",children:[e.jsx("span",{className:"text-[11px] text-muted font-medium",children:n==="zh"?"预习视频/导学完成":"Prep Completed"}),e.jsxs("div",{className:"flex items-baseline gap-1.5 mt-1",children:[e.jsxs("span",{className:"text-base font-black text-emerald-600 dark:text-emerald-400 font-mono",children:[m.completionRate,"%"]}),e.jsxs("span",{className:"text-2xs text-muted font-mono",children:["(",m.completedCount,"/",m.totalStudents," 人)"]})]}),e.jsx("div",{className:"w-full bg-slate-200 dark:bg-slate-700 h-1.5 rounded-full overflow-hidden mt-1.5",children:e.jsx("div",{className:"bg-emerald-500 h-full rounded-full transition-all duration-500",style:{width:`${m.completionRate}%`}})})]}),e.jsxs("div",{className:"p-2.5 rounded-xl bg-surface-secondary/60 border border-theme/60 flex flex-col justify-between",children:[e.jsx("span",{className:"text-[11px] text-muted font-medium",children:n==="zh"?"全班心态基线调研":"Class Energy Baseline"}),g?e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex items-center justify-between gap-1 text-xs mt-1 font-bold",children:[e.jsxs("span",{className:"text-amber-500 flex items-center gap-0.5 text-2xs",title:"满格电量",children:["⚡ ",Math.round(v.fullPower/p*100),"%"]}),e.jsxs("span",{className:"text-blue-500 flex items-center gap-0.5 text-2xs",title:"需要充能",children:["☕ ",Math.round(v.needCoffee/p*100),"%"]}),e.jsxs("span",{className:"text-rose-500 flex items-center gap-0.5 text-2xs",title:"需要求助",children:["🆘 ",Math.round(v.needHelp/p*100),"%"]})]}),e.jsxs("div",{className:"w-full h-1.5 rounded-full overflow-hidden flex gap-0.5 mt-1.5 bg-slate-200 dark:bg-slate-700",children:[e.jsx("div",{style:{width:`${v.fullPower/p*100}%`},className:"bg-amber-400"}),e.jsx("div",{style:{width:`${v.needCoffee/p*100}%`},className:"bg-blue-400"}),e.jsx("div",{style:{width:`${v.needHelp/p*100}%`},className:"bg-rose-400"})]})]}):e.jsx("div",{className:"flex items-center justify-center py-2 text-2xs text-muted",children:e.jsx("span",{children:n==="zh"?"等待学生课前打卡破冰":"Awaiting student check-in"})})]})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsxs("div",{className:"flex items-center justify-between text-2xs text-muted font-bold px-0.5",children:[e.jsxs("span",{className:"flex items-center gap-1 text-rose-600 dark:text-rose-400",children:[e.jsx(Se,{size:11}),e.jsx("span",{children:n==="zh"?"前置导学测验错误率最高 Top 3 疑难卡点":"Top 3 Diagnostic Stumbling Blocks"})]}),e.jsx("span",{children:n==="zh"?"点击展开以学定教建议":"Click for strategies"})]}),u.length===0?e.jsx("div",{className:"p-3 rounded-xl border border-dashed border-theme/60 bg-surface-secondary/20 text-center text-2xs text-muted",children:n==="zh"?"暂无前置练习错题卡点,学生完成前置导学测验后将自动分析高频失分概念。":"No diagnostic stumbling blocks found. Student quiz errors will appear here."}):e.jsx("div",{className:"space-y-1.5",children:u.map(j=>{const k=c===j.rank;return e.jsxs("div",{onClick:()=>x(k?null:j.rank),className:`p-2.5 rounded-xl border transition-all cursor-pointer ${k?"bg-rose-50/40 dark:bg-rose-950/20 border-rose-400/50 shadow-2xs":"bg-surface-secondary/40 border-theme/60 hover:bg-surface-secondary"}`,children:[e.jsxs("div",{className:"flex items-center justify-between gap-2",children:[e.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[e.jsx("span",{className:`w-4 h-4 rounded-full flex items-center justify-center text-[10px] font-black shrink-0 ${j.rank===1?"bg-rose-500 text-white":j.rank===2?"bg-amber-500 text-white":"bg-slate-400 text-white"}`,children:j.rank}),e.jsx("span",{className:"text-xs font-bold text-main truncate",children:j.concept})]}),e.jsxs("div",{className:"flex items-center gap-2 shrink-0",children:[e.jsxs("span",{className:"text-2xs font-mono font-bold text-rose-600 dark:text-rose-400",children:["错率 ",j.mistakeRate,"%"]}),e.jsx(st,{size:12,className:`text-muted transition-transform duration-200 ${k?"rotate-90":""}`})]})]}),k&&e.jsxs("div",{className:"mt-2 pt-2 border-t border-rose-200/50 dark:border-rose-900/50 space-y-1.5 text-2xs animate-fadeIn",children:[e.jsxs("div",{className:"text-muted",children:[e.jsx("span",{className:"font-semibold text-main",children:n==="zh"?"典型错题:":"Sample Trap: "}),j.sampleQuestion]}),e.jsxs("div",{className:"flex items-start gap-1 text-emerald-700 dark:text-emerald-300 bg-emerald-500/10 p-1.5 rounded-lg border border-emerald-500/20 font-medium",children:[e.jsx(mt,{size:12,className:"shrink-0 mt-0.5 text-emerald-600 dark:text-emerald-400"}),e.jsxs("span",{children:[e.jsx("span",{className:"font-bold",children:n==="zh"?"以学定教建议:":"Teaching Strategy: "}),j.pedagogicalAdvice]})]})]})]},j.rank)})})]})]})}function qa({isOpen:s,onClose:i,classId:n,className:o,lang:a="zh"}){const[t,r]=l.useState(!1),[c,x]=l.useState(null),d=()=>{r(!0);const m=Date.now();fetch(`/api/classes/${n||"default"}/preflight-health`).then(u=>{if(!u.ok)throw new Error("Health check error");return u.json()}).then(u=>{setTimeout(()=>{x({localApiLatencyMs:u.checks?.localApiLatencyMs||Math.max(3,Date.now()-m),staticResources:u.checks?.staticResources||{status:"passed",message:"课件与静态媒体资源校验完整"},pluginSandbox:u.checks?.pluginSandbox||{status:"passed",message:"微前端与安全沙箱策略就绪"},socketMesh:u.checks?.socketMesh||{status:"passed",message:"实时广播总线与局域网节点健康"},healthScore:u.healthScore||98}),r(!1)},600)}).catch(()=>{setTimeout(()=>{x({localApiLatencyMs:6,staticResources:{status:"passed",message:"课件离线沙箱加载通过"},pluginSandbox:{status:"passed",message:"CSP iframe 隔离策略有效"},socketMesh:{status:"passed",message:"Socket.IO 局域网广播正常"},healthScore:99}),r(!1)},600)})};return _t.useEffect(()=>{s&&d()},[s]),s?e.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center p-4 bg-black/60 backdrop-blur-xs animate-fadeIn",children:e.jsxs("div",{className:"bg-surface border border-theme rounded-2xl shadow-2xl max-w-md w-full overflow-hidden flex flex-col",children:[e.jsxs("div",{className:"px-5 py-4 border-b border-theme flex items-center justify-between bg-surface-secondary/50",children:[e.jsxs("div",{className:"flex items-center gap-2.5",children:[e.jsx("div",{className:"p-2 rounded-xl bg-teal-500/10 text-teal-600 dark:text-teal-400",children:e.jsx(Dt,{size:20})}),e.jsxs("div",{children:[e.jsx("h3",{className:"font-extrabold text-sm text-main flex items-center gap-1.5",children:e.jsx("span",{children:a==="zh"?"课前环境一键预检飞检":"Pre-flight Environmental Healthcheck"})}),e.jsx("p",{className:"text-2xs text-muted",children:o||(a==="zh"?"当前教学环境":"Current Classroom Environment")})]})]}),e.jsx("button",{onClick:i,className:"p-1 rounded-lg text-muted hover:text-main hover:bg-surface-secondary transition-colors cursor-pointer",children:e.jsx(be,{size:16})})]}),e.jsxs("div",{className:"p-5 flex flex-col gap-4 text-xs",children:[e.jsxs("div",{className:"p-4 rounded-xl bg-gradient-to-r from-teal-500/10 via-emerald-500/10 to-teal-500/10 border border-teal-500/20 flex items-center justify-between",children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx("span",{className:"text-2xs uppercase tracking-wider text-muted font-bold",children:a==="zh"?"系统就绪综合健康指数":"Overall Health Score"}),e.jsx("div",{className:"text-2xl font-black text-teal-600 dark:text-teal-400 font-mono",children:t?"--":`${c?.healthScore??98} / 100`}),e.jsxs("div",{className:"text-2xs text-muted flex items-center gap-1",children:[e.jsx(Ge,{size:10,className:"text-emerald-500"}),e.jsx("span",{children:a==="zh"?"局域网低延迟 • 无单点故障风险":"Low Latency • No Single Point Failure"})]})]}),e.jsxs("button",{onClick:d,disabled:t,className:"px-3 py-1.5 rounded-lg bg-teal-600 hover:bg-teal-700 text-white font-bold text-xs flex items-center gap-1.5 shadow-xs transition-all active:scale-95 disabled:opacity-50 cursor-pointer",children:[e.jsx($e,{size:12,className:t?"animate-spin":""}),e.jsx("span",{children:t?a==="zh"?"飞检中...":"Checking...":a==="zh"?"重新飞检":"Re-check"})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"p-3 rounded-xl bg-surface-secondary/50 border border-theme/60 flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-2.5",children:[e.jsx(ia,{size:15,className:"text-amber-500 shrink-0"}),e.jsxs("div",{children:[e.jsx("div",{className:"font-bold text-main",children:a==="zh"?"局域网内核响应时延":"Local Kernel Latency"}),e.jsx("div",{className:"text-2xs text-muted",children:"Express + SQLite API ping-pong"})]})]}),e.jsxs("div",{className:"text-right",children:[e.jsx("span",{className:"font-mono font-bold text-emerald-600 text-xs",children:t?"...":`${c?.localApiLatencyMs??5} ms`}),e.jsx("span",{className:"block text-3xs text-muted",children:a==="zh"?"极佳":"Optimal"})]})]}),e.jsxs("div",{className:"p-3 rounded-xl bg-surface-secondary/50 border border-theme/60 flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-2.5",children:[e.jsx(la,{size:15,className:"text-blue-500 shrink-0"}),e.jsxs("div",{children:[e.jsx("div",{className:"font-bold text-main",children:a==="zh"?"课件音视频与交互资源":"Courseware & Static Media"}),e.jsx("div",{className:"text-2xs text-muted",children:c?.staticResources.message||"静态文件与 HTML 沙箱资源完整"})]})]}),e.jsx(je,{size:15,className:"text-emerald-500 shrink-0"})]}),e.jsxs("div",{className:"p-3 rounded-xl bg-surface-secondary/50 border border-theme/60 flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-2.5",children:[e.jsx(Lt,{size:15,className:"text-purple-500 shrink-0"}),e.jsxs("div",{children:[e.jsx("div",{className:"font-bold text-main",children:a==="zh"?"微前端与安全沙箱隔离":"Plugin Sandbox & CSP"}),e.jsx("div",{className:"text-2xs text-muted",children:c?.pluginSandbox.message||"Bridge SDK Proxy 拦截通道就绪"})]})]}),e.jsx(je,{size:15,className:"text-emerald-500 shrink-0"})]}),e.jsxs("div",{className:"p-3 rounded-xl bg-surface-secondary/50 border border-theme/60 flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-2.5",children:[e.jsx(ca,{size:15,className:"text-emerald-500 shrink-0"}),e.jsxs("div",{children:[e.jsx("div",{className:"font-bold text-main",children:a==="zh"?"学生机 Socket.IO 局域网连通率":"Student LAN Socket Mesh"}),e.jsx("div",{className:"text-2xs text-muted",children:c?.socketMesh.message||"WebSocket 双向通道通畅"})]})]}),e.jsx(je,{size:15,className:"text-emerald-500 shrink-0"})]})]})]}),e.jsxs("div",{className:"px-5 py-3 border-t border-theme flex items-center justify-between bg-surface-secondary/30",children:[e.jsx("span",{className:"text-2xs text-muted",children:a==="zh"?"💡 飞检自检保证课堂音视频与白板零卡顿":"Ensures zero stuttering during class"}),e.jsx("button",{onClick:i,className:"px-4 py-1.5 rounded-lg bg-surface-secondary hover:bg-surface border border-theme text-main font-bold text-xs transition-colors cursor-pointer",children:a==="zh"?"完成自检并返回":"Dismiss"})]})]})}):null}function Va({selectedLesson:s,lessonTitle:i,selectedClassId:n,className:o,students:a,onlineStudentIds:t,timelineSegments:r,lang:c,isClassLocked:x,onToggleClassLock:d,onStartClass:m,onPingStudent:u,onOpenStudentWindow:v,isStudentWindowOpen:N,addToast:g,onBroadcastNotice:p,onUpdateClassPasscode:j}){const[k,w]=l.useState(!1),[f,b]=l.useState(null),[z,_]=l.useState(null),[C,B]=l.useState(!1),[R,J]=l.useState(!1),[O,H]=l.useState(""),[ee,se]=l.useState("2h"),[I,V]=l.useState(!1),[P,y]=l.useState(Date.now());l.useEffect(()=>{const W=setInterval(()=>y(Date.now()),1e3);return()=>clearInterval(W)},[]);const M=async()=>{if(!n){b(null),_(null);return}try{B(!0);const W=await fetch(`/api/classes/${n}/passcode`);if(W.ok){const ae=await W.json();b(ae.classPasscode||null),_(ae.expiresAt??null),H(ae.classPasscode||"")}}catch(W){console.error("Failed to fetch class passcode info",W)}finally{B(!1)}};l.useEffect(()=>{M()},[n]);const $=W=>{const ae=Date.now();if(W==="45m")return ae+2700*1e3;if(W==="2h")return ae+2*3600*1e3;if(W==="today"){const ge=new Date;return ge.setHours(23,59,59,999),ge.getTime()}return null},S=async(W,ae)=>{if(n)try{B(!0),(await fetch(`/api/classes/${n}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({class_passcode:W,class_passcode_expires_at:ae})})).ok?(b(W),_(ae),J(!1),j&&j(n,W),g(c==="zh"?"班级临时密码已更新":"Class Passcode Updated",W?c==="zh"?`已设定班级上课临时密码为 [${W}],学生可凭此密码快速登录。`:`Passcode [${W}] is now active for this class.`:c==="zh"?"已清除班级临时密码,学生需使用个人自设密码登录。":"Passcode cleared. Students will use personal passwords.","success")):g(c==="zh"?"更新失败":"Update Failed",c==="zh"?"无法保存班级临时密码,请稍后重试":"Could not save class passcode.","error")}catch(ge){g(c==="zh"?"网络错误":"Network Error",String(ge),"error")}finally{B(!1)}},E=()=>{const W=Math.floor(1e3+Math.random()*9e3).toString(),ae=$(ee);S(W,ae)},Q=()=>{S(null,null)},ie=()=>{f&&(navigator.clipboard.writeText(f),V(!0),setTimeout(()=>V(!1),2e3),g(c==="zh"?"已复制临时密码":"Copied Passcode",c==="zh"?`密码 [${f}] 已复制到剪贴板`:`Passcode [${f}] copied to clipboard`,"info"))},pe=!!(f&&z&&P>z),ce=z&&!pe?Math.max(0,Math.floor((z-P)/1e3)):0,G=W=>{const ae=Math.floor(W/60),ge=W%60;if(ae>=60){const Ee=Math.floor(ae/60),jt=ae%60;return`${Ee}小时${jt}分`}return`${ae}分${ge}秒`},[K,le]=l.useState({resources:!0,audioVideo:!0,sandbox:!0,objective:!0}),[de,ue]=l.useState(c==="zh"?"请同学们打开课本对应单元,准备好随堂笔记本,并保持网络通畅。":"Please open your course materials and ensure your screen is active."),[ve,A]=l.useState(!1),[L,Y]=l.useState(new Set),te=W=>{le(ae=>({...ae,[W]:!ae[W]}))},U=()=>{de.trim()&&(A(!0),p&&p(de),setTimeout(()=>{A(!1),g(c==="zh"?"📢 课前提示已广播":"📢 Warm-up Notice Sent",c==="zh"?"全班学生屏幕已接收到课前热身提示。":"Notice sent to all student screens.","success")},400))},Z=()=>{const W=new Set(a.map(ae=>ae.id));Y(W),g(c==="zh"?"✓ 全员签到就绪":"✓ All Marked Ready",c==="zh"?`已将全班 ${a.length} 名学生标记为课前签到。`:"Marked all students ready.","success")},T=W=>{Y(ae=>{const ge=new Set(ae);return ge.has(W)?ge.delete(W):ge.add(W),ge})},re=W=>t.includes(W.id)||!!(W.student_number&&t.includes(W.student_number)),xe=a.length,ye=a.filter(re).length,ze=a.filter(W=>re(W)||L.has(W.id)).length,we=xe>0?Math.round(ze/xe*100):0,We=r.reduce((W,ae)=>{const ge=ae?.duration,Ee=typeof ge=="number"?ge:parseInt(ge,10);return W+(!isNaN(Ee)&&Ee>0?Ee:300)},0),Ke=isNaN(We)||We<=0?45:Math.round(We/60);return e.jsxs("div",{id:"pre-class-ready-view",className:"flex-1 flex flex-col min-h-0 bg-surface-secondary/20 p-4 gap-4 overflow-y-auto",children:[e.jsxs("div",{className:"bg-surface border border-theme rounded-2xl p-5 shadow-sm flex flex-col md:flex-row items-start md:items-center justify-between gap-4",children:[e.jsxs("div",{className:"flex items-center gap-3.5",children:[e.jsx("div",{className:"w-12 h-12 rounded-2xl bg-amber-500/10 border border-amber-500/20 text-amber-600 dark:text-amber-400 flex items-center justify-center shrink-0",children:e.jsx(Le,{size:24,className:"animate-pulse"})}),e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"px-2.5 py-0.5 rounded-full text-xs font-black bg-amber-500/10 text-amber-700 dark:text-amber-300 border border-amber-500/30 uppercase tracking-wider",children:c==="zh"?"阶段 1 / 4 · 课前准备与就绪":"Stage 1/4 · Pre-Class Preparation"}),e.jsxs("span",{className:"text-xs text-muted flex items-center gap-1 font-mono",children:[e.jsx(Ge,{size:11,className:"text-emerald-500"}),c==="zh"?"预备就绪中":"Standby"]})]}),e.jsxs("h1",{className:"text-lg font-black text-main tracking-tight mt-1 flex items-center gap-2",children:[e.jsx("span",{children:i||(c==="zh"?"未选定课程":"Untitled Lesson")}),o&&e.jsx("span",{className:"text-xs font-semibold px-2 py-0.5 bg-surface-secondary rounded-lg border border-theme text-muted",children:o})]}),e.jsx("p",{className:"text-xs text-muted mt-0.5",children:c==="zh"?`预计授课时长: ${Ke} 分钟 · 共 ${r.length} 个教学环节 · 白板仅在进入课中授课时展示`:`Est. Duration: ${Ke} mins · ${r.length} segments · Whiteboard activates in-class`})]})]}),e.jsxs("div",{className:"flex items-center gap-2.5 flex-wrap w-full md:w-auto justify-end",children:[e.jsxs("button",{id:"pre-class-healthcheck-btn",type:"button",onClick:()=>w(!0),className:"px-3.5 py-2.5 text-xs font-bold rounded-xl border border-teal-500/30 bg-teal-50/60 dark:bg-teal-950/20 text-teal-700 dark:text-teal-300 hover:bg-teal-100/60 dark:hover:bg-teal-900/40 transition-all cursor-pointer flex items-center gap-1.5 shadow-2xs",title:c==="zh"?"一键自检局域网延迟、课件与沙箱健康度":"Environmental Healthcheck",children:[e.jsx(Dt,{size:14,className:"text-teal-600 dark:text-teal-400"}),e.jsx("span",{children:c==="zh"?"环境一键飞检":"Healthcheck"}),e.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-emerald-500 animate-pulse"})]}),e.jsxs("button",{id:"pre-class-start-teaching-btn",type:"button",onClick:m,className:"px-5 py-2.5 bg-gradient-to-r from-emerald-600 to-teal-600 hover:from-emerald-700 hover:to-teal-700 text-white font-extrabold rounded-xl text-xs flex items-center gap-2 shadow-md hover:shadow-lg transition-all active:scale-95 cursor-pointer",children:[e.jsx(cs,{size:14,className:"fill-current"}),e.jsx("span",{children:c==="zh"?"一键开启课中授课 (进入白板)":"Start Live Teaching (Launch Whiteboard)"})]})]})]}),e.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-12 gap-4 flex-1 min-h-0",children:[e.jsxs("div",{className:"lg:col-span-5 flex flex-col gap-4",children:[e.jsx(Ha,{lessonId:s,classId:n,lang:c}),e.jsxs("div",{className:"bg-surface border border-theme rounded-2xl p-4 shadow-sm flex flex-col gap-3",children:[e.jsxs("div",{className:"flex items-center justify-between border-b border-theme pb-2.5",children:[e.jsxs("span",{className:"text-xs font-black uppercase text-main tracking-wider flex items-center gap-1.5",children:[e.jsx(da,{size:14,className:"text-primary-theme"}),e.jsx("span",{children:c==="zh"?"备课预检与教学就绪项":"Pre-flight Readiness Checklist"})]}),e.jsxs("span",{className:"text-xs text-muted font-semibold",children:[Object.values(K).filter(Boolean).length," / 4 就绪"]})]}),e.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsxs("label",{onClick:()=>te("resources"),className:"flex items-start gap-2.5 p-2.5 rounded-xl border border-theme/60 hover:bg-surface-secondary/50 cursor-pointer transition-colors",children:[e.jsx("input",{type:"checkbox",checked:K.resources,onChange:()=>{},className:"mt-0.5 rounded text-primary-theme focus:ring-primary-theme cursor-pointer"}),e.jsxs("div",{className:"flex-1",children:[e.jsx("div",{className:"text-xs font-bold text-main",children:c==="zh"?"课件与互动资源已就绪":"Courseware & Resources Ready"}),e.jsx("div",{className:"text-[11px] text-muted",children:c==="zh"?"已校验实验沙箱、微前端挂载点及白板插槽":"Sandbox and extensions verified"})]}),K.resources&&e.jsx(je,{size:13,className:"text-emerald-500 shrink-0 mt-0.5"})]}),e.jsxs("label",{onClick:()=>te("audioVideo"),className:"flex items-start gap-2.5 p-2.5 rounded-xl border border-theme/60 hover:bg-surface-secondary/50 cursor-pointer transition-colors",children:[e.jsx("input",{type:"checkbox",checked:K.audioVideo,onChange:()=>{},className:"mt-0.5 rounded text-primary-theme focus:ring-primary-theme cursor-pointer"}),e.jsxs("div",{className:"flex-1",children:[e.jsx("div",{className:"text-xs font-bold text-main",children:c==="zh"?"广播同步信道与大屏投屏":"Broadcast & Stage Mirroring"}),e.jsx("div",{className:"text-[11px] text-muted",children:c==="zh"?"Socket.IO 实时通信广播就绪,全屏大屏展台待命":"Real-time WebSocket connection active"})]}),K.audioVideo&&e.jsx(je,{size:13,className:"text-emerald-500 shrink-0 mt-0.5"})]}),e.jsxs("label",{onClick:()=>te("sandbox"),className:"flex items-start gap-2.5 p-2.5 rounded-xl border border-theme/60 hover:bg-surface-secondary/50 cursor-pointer transition-colors",children:[e.jsx("input",{type:"checkbox",checked:K.sandbox,onChange:()=>{},className:"mt-0.5 rounded text-primary-theme focus:ring-primary-theme cursor-pointer"}),e.jsxs("div",{className:"flex-1",children:[e.jsx("div",{className:"text-xs font-bold text-main",children:c==="zh"?"安全沙箱与专注模式策略":"Sandbox & Anti-Distraction Guard"}),e.jsx("div",{className:"text-[11px] text-muted",children:c==="zh"?"iframe CSP 隔离与学生端防作弊专注锁定待发":"CSP frame sandbox configured"})]}),K.sandbox&&e.jsx(je,{size:13,className:"text-emerald-500 shrink-0 mt-0.5"})]}),e.jsxs("label",{onClick:()=>te("objective"),className:"flex items-start gap-2.5 p-2.5 rounded-xl border border-theme/60 hover:bg-surface-secondary/50 cursor-pointer transition-colors",children:[e.jsx("input",{type:"checkbox",checked:K.objective,onChange:()=>{},className:"mt-0.5 rounded text-primary-theme focus:ring-primary-theme cursor-pointer"}),e.jsxs("div",{className:"flex-1",children:[e.jsx("div",{className:"text-xs font-bold text-main",children:c==="zh"?"教学目标与重难点梳理":"Key Teaching Goals Set"}),e.jsx("div",{className:"text-[11px] text-muted",children:c==="zh"?"导入、探究、练习与评价环节时序已锚定":"Segments timing calibrated"})]}),K.objective&&e.jsx(je,{size:13,className:"text-emerald-500 shrink-0 mt-0.5"})]})]})]}),e.jsxs("div",{className:"bg-surface border border-theme rounded-2xl p-4 shadow-sm flex flex-col gap-2.5 flex-1 min-h-[180px]",children:[e.jsxs("div",{className:"flex items-center justify-between border-b border-theme pb-2",children:[e.jsxs("span",{className:"text-xs font-black uppercase text-main tracking-wider flex items-center gap-1.5",children:[e.jsx(pt,{size:14,className:"text-primary-theme"}),e.jsx("span",{children:c==="zh"?"授课环节大纲预演":"Segments Timeline Preview"})]}),e.jsxs("span",{className:"text-[11px] text-muted font-mono",children:[r.length," 个环节"]})]}),e.jsx("div",{className:"flex flex-col gap-2 overflow-y-auto pr-1",children:r.length>0?r.map((W,ae)=>e.jsxs("div",{className:"p-2.5 rounded-xl bg-surface-secondary/60 border border-theme/70 flex items-center justify-between gap-3 text-xs",children:[e.jsxs("div",{className:"flex items-center gap-2.5 min-w-0",children:[e.jsx("span",{className:"w-5 h-5 rounded-lg bg-primary-theme/10 text-primary-theme font-black flex items-center justify-center text-[10px] shrink-0",children:ae+1}),e.jsxs("div",{className:"truncate",children:[e.jsx("div",{className:"font-bold text-main truncate",children:W.title}),W.description&&e.jsx("div",{className:"text-[10px] text-muted truncate",children:W.description})]})]}),e.jsxs("span",{className:"font-mono text-[11px] text-muted shrink-0 flex items-center gap-1",children:[e.jsx(Le,{size:10}),Math.round((W.duration||300)/60)," 分钟"]})]},W.id||ae)):e.jsx("div",{className:"text-center py-6 text-xs text-muted italic",children:c==="zh"?"暂未配置环节大纲,系统将在课中按默认时长授课":"No custom segments"})})]})]}),e.jsxs("div",{className:"lg:col-span-7 flex flex-col gap-4",children:[e.jsxs("div",{className:"bg-surface border border-theme rounded-2xl p-4 shadow-sm flex flex-col gap-3",children:[e.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-2 border-b border-theme pb-2.5",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("span",{className:"text-xs font-black uppercase text-main tracking-wider flex items-center gap-1.5",children:[e.jsx(ke,{size:14,className:"text-primary-theme"}),e.jsx("span",{children:c==="zh"?"学生到课与设备就绪监控":"Student Readiness & Attendance"})]}),e.jsxs("span",{className:"px-2 py-0.5 rounded-full text-xs font-mono font-bold bg-primary-theme/10 text-primary-theme border border-primary-theme/20",children:[ze," / ",xe," (",we,"%)"]}),e.jsxs("span",{className:"px-2 py-0.5 rounded-full text-xs font-mono font-bold bg-emerald-500/10 text-emerald-600 dark:text-emerald-400 border border-emerald-500/20 flex items-center gap-1",children:[e.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-emerald-500 animate-pulse"}),e.jsxs("span",{children:[ye," ",c==="zh"?"设备连入":"Online"]})]})]}),e.jsx("div",{className:"flex items-center gap-2",children:e.jsx("button",{type:"button",onClick:Z,className:"px-2.5 py-1 text-xs font-bold rounded-lg bg-surface-secondary hover:bg-surface border border-theme text-main transition-colors cursor-pointer",children:c==="zh"?"全员标记已就绪":"Mark All Ready"})})]}),e.jsx("div",{className:"w-full bg-surface-secondary h-2 rounded-full overflow-hidden border border-theme/40",children:e.jsx("div",{className:"bg-gradient-to-r from-teal-500 to-emerald-500 h-full transition-all duration-500",style:{width:`${we}%`}})}),e.jsxs("div",{className:"p-3 rounded-2xl bg-gradient-to-r from-indigo-50/80 to-purple-50/60 dark:from-indigo-950/30 dark:to-purple-950/20 border border-indigo-200/80 dark:border-indigo-800/50 flex flex-col gap-2.5 text-xs shadow-xs",children:[e.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[e.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[e.jsx("div",{className:"p-1.5 rounded-xl bg-indigo-600 text-white shadow-xs",children:e.jsx(xa,{size:16})}),e.jsxs("div",{children:[e.jsxs("div",{className:"font-black text-main flex items-center gap-2",children:[e.jsx("span",{children:c==="zh"?"班级上课临时密码":"Class Temporary Passcode"}),f?pe?e.jsx("span",{className:"px-2 py-0.5 rounded-full text-[10px] font-bold bg-amber-500/10 text-amber-600 dark:text-amber-400 border border-amber-500/30",children:c==="zh"?"已过期":"Expired"}):e.jsxs("span",{className:"px-2 py-0.5 rounded-full text-[10px] font-bold bg-emerald-500/10 text-emerald-600 dark:text-emerald-400 border border-emerald-500/30 flex items-center gap-1",children:[e.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-emerald-500 animate-pulse"}),z?c==="zh"?`有效 (剩 ${G(ce)})`:`Active (${G(ce)} left)`:c==="zh"?"长期有效":"Permanent"]}):e.jsx("span",{className:"px-2 py-0.5 rounded-full text-[10px] font-bold bg-slate-200 dark:bg-slate-800 text-muted",children:c==="zh"?"未设定":"Not set"})]}),e.jsx("div",{className:"text-[11px] text-muted",children:c==="zh"?"设置后所在班级学生可凭此临时密码或个人密码登录系统":"Students can login using this passcode or their personal passwords."})]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[f&&!R?e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx("div",{className:`px-3 py-1 rounded-xl font-mono text-base font-black tracking-widest border shadow-2xs select-all ${pe?"bg-amber-50 dark:bg-amber-950/40 text-amber-600 dark:text-amber-400 border-amber-300 dark:border-amber-700/60 line-through":"bg-white dark:bg-slate-900 text-indigo-600 dark:text-indigo-400 border-indigo-300 dark:border-indigo-700"}`,title:c==="zh"?"当前班级上课临时密码":"Active class temporary passcode",children:f}),e.jsx("button",{type:"button",onClick:ie,disabled:C,className:"p-1.5 rounded-lg bg-surface hover:bg-surface-secondary border border-theme text-main transition-colors cursor-pointer",title:c==="zh"?"复制临时密码":"Copy passcode",children:I?e.jsx(Ve,{size:14,className:"text-emerald-500"}):e.jsx(ft,{size:14})}),e.jsx("button",{type:"button",onClick:()=>{H(f),J(!0)},disabled:C,className:"p-1.5 rounded-lg bg-surface hover:bg-surface-secondary border border-theme text-main transition-colors cursor-pointer",title:c==="zh"?"编辑临时密码":"Edit passcode",children:e.jsx(ma,{size:14})}),e.jsx("button",{type:"button",onClick:Q,disabled:C,className:"p-1.5 rounded-lg bg-surface hover:bg-rose-50 dark:hover:bg-rose-950/30 border border-theme hover:border-rose-300 text-muted hover:text-rose-600 transition-colors cursor-pointer",title:c==="zh"?"清除临时密码(恢复仅个人密码登录)":"Clear temporary passcode",children:e.jsx(at,{size:14})})]}):null,R?e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx("input",{type:"text",value:O,onChange:W=>H(W.target.value),placeholder:c==="zh"?"输入自定义密码":"Passcode",className:"w-24 px-2 py-1 text-xs font-mono font-bold bg-white dark:bg-slate-900 border border-indigo-300 dark:border-indigo-700 rounded-lg text-main outline-none focus:ring-1 focus:ring-indigo-500",maxLength:12}),e.jsxs("button",{type:"button",onClick:()=>{if(!O.trim())Q();else{const W=$(ee);S(O.trim(),W)}},disabled:C,className:"px-2 py-1 rounded-lg bg-indigo-600 hover:bg-indigo-700 text-white font-bold text-xs flex items-center gap-1 cursor-pointer transition-colors shadow-2xs",children:[e.jsx(ls,{size:12}),e.jsx("span",{children:c==="zh"?"保存":"Save"})]}),e.jsx("button",{type:"button",onClick:()=>J(!1),className:"p-1 rounded-lg bg-surface hover:bg-surface-secondary border border-theme text-muted cursor-pointer",children:e.jsx(be,{size:14})})]}):f?null:e.jsxs("button",{type:"button",onClick:E,disabled:C||!n,className:"px-3 py-1.5 rounded-xl bg-indigo-600 hover:bg-indigo-700 active:scale-95 text-white font-bold text-xs flex items-center gap-1.5 shadow-sm shadow-indigo-600/20 cursor-pointer transition-all disabled:opacity-50",children:[e.jsx(fe,{size:13}),e.jsx("span",{children:c==="zh"?"随机生成密码":"Generate Passcode"})]}),f&&!R&&e.jsx("button",{type:"button",onClick:E,disabled:C,className:"p-1.5 rounded-lg bg-indigo-50 dark:bg-indigo-900/30 hover:bg-indigo-100 text-indigo-700 dark:text-indigo-300 border border-indigo-200 dark:border-indigo-800 transition-colors cursor-pointer",title:c==="zh"?"重新随机生成密码":"Regenerate random passcode",children:e.jsx(ut,{size:14,className:C?"animate-spin":""})})]})]}),e.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-2 pt-2 border-t border-indigo-100 dark:border-indigo-900/40 text-[11px]",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("span",{className:"text-muted flex items-center gap-1",children:[e.jsx(Zs,{size:12}),e.jsx("span",{children:c==="zh"?"有效期限:":"Validity:"})]}),e.jsx("div",{className:"flex items-center gap-1",children:[{id:"45m",label:c==="zh"?"45分钟":"45m"},{id:"2h",label:c==="zh"?"2小时":"2h"},{id:"today",label:c==="zh"?"今日":"Today"},{id:"permanent",label:c==="zh"?"长期":"Permanent"}].map(W=>e.jsx("button",{type:"button",onClick:()=>{if(se(W.id),f&&!R){const ae=$(W.id);S(f,ae)}},className:`px-2 py-0.5 rounded-md font-medium cursor-pointer transition-colors ${ee===W.id?"bg-indigo-600 text-white font-bold":"bg-surface hover:bg-surface-secondary border border-theme text-muted"}`,children:W.label},W.id))})]}),e.jsx("div",{className:"flex items-center gap-1.5 ml-auto",children:e.jsx(oe,{slot:"classroom.preclass.passcode_action",slotProps:{classId:n,className:o,classPasscode:f,expiresAt:z,isExpired:pe,onRefresh:M}})})]}),e.jsx(oe,{slot:"classroom.preclass.passcode_addon",slotProps:{classId:n,className:o,classPasscode:f,expiresAt:z,isExpired:pe,onRefresh:M}})]}),e.jsx("div",{className:"max-h-[260px] overflow-y-auto border border-theme/70 rounded-xl divide-y divide-border/60 bg-surface-secondary/20",children:a.length>0?a.map(W=>{const ae=re(W),ge=L.has(W.id),Ee=ae||ge;return e.jsxs("div",{className:"px-3 py-2 flex items-center justify-between gap-3 hover:bg-surface-secondary transition-colors text-xs",children:[e.jsxs("div",{className:"flex items-center gap-2.5 min-w-0",children:[e.jsx("span",{className:`w-2.5 h-2.5 rounded-full shrink-0 ${ae?"bg-emerald-500 shadow-xs shadow-emerald-500/50":"bg-slate-300 dark:bg-slate-600"}`,title:ae?"在线连接活跃":"离线未连入"}),e.jsx("span",{className:"font-bold text-main truncate",children:W.name}),W.student_number&&e.jsxs("span",{className:"font-mono text-[10px] text-muted",children:["(",W.student_number,")"]})]}),e.jsxs("div",{className:"flex items-center gap-2 shrink-0",children:[e.jsx("button",{type:"button",onClick:()=>T(W.id),className:`px-2 py-0.5 rounded text-[11px] font-bold border transition-colors cursor-pointer ${Ee?"bg-emerald-500/10 text-emerald-600 dark:text-emerald-400 border-emerald-500/30":"bg-amber-500/10 text-amber-600 dark:text-amber-400 border-amber-500/30"}`,children:Ee?c==="zh"?"✓ 已就绪":"Ready":c==="zh"?"未就绪":"Pending"}),e.jsx("button",{type:"button",onClick:()=>u?.(W.id,c==="zh"?"请尽快进入课堂":"Please join class"),className:"p-1 text-muted hover:text-primary-theme hover:bg-surface rounded transition-colors cursor-pointer",title:c==="zh"?"给该学生发送连接提醒":"Ping Student",children:e.jsx(us,{size:13})})]})]},W.id)}):e.jsx("div",{className:"py-6 text-center text-xs text-muted italic",children:c==="zh"?"该班级暂未关联学生名单":"No students found for this class"})})]}),e.jsxs("div",{className:"bg-surface border border-theme rounded-2xl p-4 shadow-sm flex flex-col gap-3",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("span",{className:"text-xs font-black uppercase text-main tracking-wider flex items-center gap-1.5",children:[e.jsx(fe,{size:14,className:"text-amber-500"}),e.jsx("span",{children:c==="zh"?"课前热身提示与学生端广播":"Pre-Class Warm-up Notice"})]}),e.jsx("span",{className:"text-[11px] text-muted",children:c==="zh"?"实时推送至学生待命屏":"Pushed to student stand-by UI"})]}),e.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsx("textarea",{value:de,onChange:W=>ue(W.target.value),rows:2,placeholder:c==="zh"?"输入广播给全班学生的课前热身指导...":"Type a warm-up prompt for students...",className:"w-full bg-surface-secondary border border-theme rounded-xl p-2.5 text-xs text-main placeholder-muted focus:ring-1 focus:ring-primary-theme outline-none resize-none"}),e.jsxs("div",{className:"flex items-center justify-between gap-2",children:[e.jsxs("div",{className:"flex items-center gap-1 text-[11px] text-muted",children:[e.jsx("span",{children:c==="zh"?"预设提示:":"Presets:"}),e.jsx("button",{type:"button",onClick:()=>ue(c==="zh"?"请大家翻到课本对应章节,准备思考探究题。":"Open chapter materials."),className:"hover:text-primary-theme underline cursor-pointer",children:c==="zh"?"预备教材":"Textbook"}),e.jsx("span",{children:"·"}),e.jsx("button",{type:"button",onClick:()=>ue(c==="zh"?"课前思考:如何用生活中的常见现象解释本节核心定律?":"Pre-class thought starter"),className:"hover:text-primary-theme underline cursor-pointer",children:c==="zh"?"思考题":"Question"})]}),e.jsxs("button",{type:"button",onClick:U,disabled:ve||!de.trim(),className:"px-3.5 py-1.5 bg-primary-theme hover:bg-primary-theme-hover text-white rounded-xl text-xs font-bold flex items-center gap-1.5 transition-all shadow-xs cursor-pointer disabled:opacity-50",children:[e.jsx(De,{size:12}),e.jsx("span",{children:ve?c==="zh"?"广播中...":"Sending...":c==="zh"?"广播到学生端":"Broadcast to Students"})]})]})]})]})]})]}),e.jsx(qa,{isOpen:k,onClose:()=>w(!1),classId:n,className:o,lang:c})]})}const Ka="/api/ping",Ja=15e3;let qe={latencyMs:null,quality:"smooth",isOnline:!0,measuredAt:null};const dt=new Set;let kt=null,Yt=!1;function Qa(s){return s<80?"smooth":s<250?"fair":"poor"}function Ya(){for(const s of dt)s(qe)}async function Rt(){if(Yt||typeof fetch!="function")return;Yt=!0;const s=performance.now();try{const i=await fetch(`${Ka}?_=${Date.now()}`,{cache:"no-store"});if(!i.ok)throw new Error(`HTTP ${i.status}`);await i.json();const n=Math.max(0,Math.round(performance.now()-s));qe={latencyMs:n,isOnline:!0,quality:Qa(n),measuredAt:Date.now()}}catch{const i=typeof navigator>"u"?!0:navigator.onLine;qe={latencyMs:qe.latencyMs,isOnline:i,quality:i?"poor":"offline",measuredAt:qe.measuredAt}}finally{Yt=!1,Ya()}}function zt(){Rt()}function Za(s){return dt.add(s),s(qe),dt.size===1&&(Rt(),kt=setInterval(()=>void Rt(),Ja),typeof window<"u"&&(window.addEventListener("online",zt),window.addEventListener("offline",zt))),()=>{dt.delete(s),dt.size===0&&kt&&(clearInterval(kt),kt=null,typeof window<"u"&&(window.removeEventListener("online",zt),window.removeEventListener("offline",zt)))}}function ys(s=!0){const[i,n]=l.useState(qe);l.useEffect(()=>{if(s)return Za(n)},[s]);const o=l.useCallback(()=>{Rt()},[]);return{...i,refresh:o}}const Xa="/api/classroom/teaching-modes";async function en(s,i,n){const a=await(n??fetch)(s,{credentials:"same-origin",headers:void 0,...i});let t=null;try{t=await a.json()}catch{}if(!a.ok)throw new Error(t?.error||`请求失败(HTTP ${a.status})`);return t}async function tn(s){const i=await en(Xa,void 0,s);return Array.isArray(i?.modes)?i.modes:[]}const Ls={indigo:{chipActive:"bg-primary-theme-light border-primary-theme text-primary-theme",iconActive:"text-primary-theme",dot:"bg-primary-theme"},emerald:{chipActive:"bg-emerald-50 border-emerald-300 text-emerald-700 dark:bg-emerald-950/40 dark:border-emerald-800 dark:text-emerald-300",iconActive:"text-emerald-600 dark:text-emerald-400",dot:"bg-emerald-500"},amber:{chipActive:"bg-amber-50 border-amber-300 text-amber-700 dark:bg-amber-950/40 dark:border-amber-800 dark:text-amber-300",iconActive:"text-amber-600 dark:text-amber-400",dot:"bg-amber-500"},violet:{chipActive:"bg-violet-50 border-violet-300 text-violet-700 dark:bg-violet-950/40 dark:border-violet-800 dark:text-violet-300",iconActive:"text-violet-600 dark:text-violet-400",dot:"bg-violet-500"},rose:{chipActive:"bg-rose-50 border-rose-300 text-rose-700 dark:bg-rose-950/40 dark:border-rose-800 dark:text-rose-300",iconActive:"text-rose-600 dark:text-rose-400",dot:"bg-rose-500"},sky:{chipActive:"bg-sky-50 border-sky-300 text-sky-700 dark:bg-sky-950/40 dark:border-sky-800 dark:text-sky-300",iconActive:"text-sky-600 dark:text-sky-400",dot:"bg-sky-500"}};function sn(s){return Ls[s??"indigo"]??Ls.indigo}function rn({classId:s,students:i,onlineStudentIds:n,lang:o,fetcher:a=fetch}){const t=o==="zh",[r,c]=l.useState({lab:null,seats:[]}),[x,d]=l.useState([]),[m,u]=l.useState(!0),[v,N]=l.useState(null);l.useEffect(()=>{let k=!1;return(async()=>{try{u(!0),N(null);const[w,f]=await Promise.all([a(`/api/classes/${s}/seats`),a("/api/labs")]);if(k)return;const b=w.ok?await w.json():{lab_id:null,seats:[]},z=f.ok?await f.json():[],_=z.find(C=>C.id===b.lab_id)||null;c({lab:_,seats:b.seats||[]}),d(z)}catch(w){k||N(w instanceof Error?w.message:String(w))}finally{k||u(!1)}})(),()=>{k=!0}},[s,a]);const g=l.useMemo(()=>{const k=new Map;for(const w of i)k.set(w.id,w);return k},[i]),p=l.useMemo(()=>{if(!r.lab)return null;const{rows:k,cols:w}=r.lab,f=Array.from({length:k},()=>Array.from({length:w},()=>null));for(const b of r.seats)b.row_idx>=0&&b.row_idx<k&&b.col_idx>=0&&b.col_idx<w&&(f[b.row_idx][b.col_idx]=b);return f},[r]),j=l.useMemo(()=>{const k=r.lab?r.lab.rows*r.lab.cols:0,w=r.seats.length,f=r.seats.filter(z=>n.includes(z.student_id)).length,b=k-w;return{totalSeats:k,assignedCount:w,onlineCount:f,emptySeats:b}},[r,n]);return m?e.jsxs("div",{className:"bg-surface border border-theme rounded-2xl p-5 shadow-sm flex items-center justify-center gap-2",children:[e.jsx($e,{size:14,className:"animate-spin text-primary-theme"}),e.jsx("span",{className:"text-xs text-muted",children:t?"加载座位图...":"Loading seating map..."})]}):v?e.jsx("div",{className:"bg-surface border border-rose-200 dark:border-rose-800 rounded-2xl p-5 shadow-sm",children:e.jsxs("div",{className:"flex items-center gap-2 text-rose-600 dark:text-rose-400",children:[e.jsx(Js,{size:14}),e.jsxs("span",{className:"text-xs font-semibold",children:[t?"加载失败":"Load failed",": ",v]})]})}):r.lab?e.jsxs("div",{className:"bg-surface border border-theme rounded-2xl p-5 shadow-sm flex flex-col gap-4",children:[e.jsxs("div",{className:"flex items-center justify-between gap-3",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Pt,{size:16,className:"text-primary-theme"}),e.jsx("h3",{className:"text-sm font-black text-main",children:t?"机房座位图":"Computer Lab Seating Map"}),e.jsx("span",{className:"text-2xs font-semibold text-muted px-2 py-0.5 rounded-lg bg-surface-secondary border border-theme",children:r.lab.room_number})]}),e.jsx("div",{className:"flex items-center gap-2",children:e.jsx(oe,{slot:"classroom.seating.toolbar",lang:o,slotProps:{classId:s,lab:r.lab,stats:j}})})]}),e.jsxs("div",{className:"flex flex-col gap-3",children:[e.jsx("div",{className:"flex justify-center",children:e.jsxs("div",{className:"bg-surface-secondary border border-theme rounded-xl px-6 py-2 flex items-center gap-2",children:[e.jsx(lr,{size:14,className:"text-primary-theme"}),e.jsx("span",{className:"text-2xs font-bold text-main",children:t?"教师机":"Teacher Station"})]})}),p&&e.jsx("div",{className:"bg-surface-secondary border border-theme rounded-xl p-4",children:e.jsx("div",{className:"grid gap-2",style:{gridTemplateColumns:`repeat(${r.lab.cols}, minmax(0, 1fr))`},children:p.flatMap((k,w)=>k.map((f,b)=>{const z=f?g.get(f.student_id):null,_=f?n.includes(f.student_id):!1,C=String.fromCharCode(65+w)+String(b+1).padStart(2,"0");return e.jsx(an,{seatLabel:C,student:z,isOnline:_,hasSeat:!!f,lang:o,classId:s,seat:f},`${w}-${b}`)}))})})]}),e.jsxs("div",{className:"flex flex-wrap items-center gap-4 text-2xs",children:[e.jsxs("span",{className:"flex items-center gap-1.5",children:[e.jsx("span",{className:"w-3 h-3 rounded bg-emerald-100 border border-emerald-300 dark:bg-emerald-900/50 dark:border-emerald-700"}),e.jsx("span",{className:"text-muted font-medium",children:t?`在线 (${j.onlineCount})`:`Online (${j.onlineCount})`})]}),e.jsxs("span",{className:"flex items-center gap-1.5",children:[e.jsx("span",{className:"w-3 h-3 rounded bg-slate-100 border border-slate-300 dark:bg-slate-800 dark:border-slate-600"}),e.jsx("span",{className:"text-muted font-medium",children:t?`离线 (${j.assignedCount-j.onlineCount})`:`Offline (${j.assignedCount-j.onlineCount})`})]}),e.jsxs("span",{className:"flex items-center gap-1.5",children:[e.jsx("span",{className:"w-3 h-3 rounded bg-surface border border-dashed border-theme"}),e.jsx("span",{className:"text-muted font-medium",children:t?`空位 (${j.emptySeats})`:`Empty (${j.emptySeats})`})]}),e.jsx(oe,{slot:"classroom.seating.legend",lang:o,slotProps:{classId:s,stats:j}})]}),e.jsxs("div",{className:"grid grid-cols-3 gap-3",children:[e.jsx(Zt,{icon:ke,label:t?"已分配座位":"Assigned Seats",value:j.assignedCount,total:j.totalSeats,lang:o}),e.jsx(Zt,{icon:Mt,label:t?"当前在线":"Currently Online",value:j.onlineCount,total:j.assignedCount,lang:o,tone:"emerald"}),e.jsx(Zt,{icon:fs,label:t?"在线率":"Online Rate",value:j.assignedCount>0?Math.round(j.onlineCount/j.assignedCount*100):0,suffix:"%",lang:o,tone:j.onlineCount===j.assignedCount?"emerald":"amber"})]}),e.jsx(oe,{slot:"classroom.seating.summary",lang:o,slotProps:{classId:s,stats:j,onlineStudentIds:n}})]}):e.jsxs("div",{className:"bg-surface border border-theme rounded-2xl p-5 shadow-sm",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[e.jsx(Pt,{size:16,className:"text-primary-theme"}),e.jsx("h3",{className:"text-sm font-black text-main",children:t?"机房座位图":"Computer Lab Seating Map"})]}),e.jsxs("div",{className:"flex flex-col items-center justify-center py-8 text-center",children:[e.jsx(ir,{size:32,className:"text-muted mb-3"}),e.jsx("p",{className:"text-xs text-muted font-medium",children:t?"该班级尚未分配机房":"No computer lab assigned to this class"}),e.jsx("p",{className:"text-2xs text-subtle mt-1",children:t?"请在「班级管理」→「座位安排」中为该班级分配机房并设置座位":"Go to Classes → Seating to assign a lab and configure seats"})]})]})}function an({seatLabel:s,student:i,isOnline:n,hasSeat:o,lang:a,classId:t,seat:r}){const c=a==="zh",x=o?n?"bg-emerald-50 border-emerald-200 dark:bg-emerald-950/40 dark:border-emerald-800/70":"bg-slate-50 border-slate-200 dark:bg-slate-900/40 dark:border-slate-700":"bg-surface border-dashed border-theme-subtle",d=o?n?"bg-emerald-500":"bg-slate-400 dark:bg-slate-500":null;return e.jsxs("div",{className:`relative rounded-lg border p-1.5 flex flex-col items-center gap-0.5 min-h-[56px] transition-colors ${x}`,title:o?`${i?.name??"?"}${n?c?" (在线)":" (online)":c?" (离线)":" (offline)"}`:c?"空座位":"Empty seat",children:[e.jsx("span",{className:"text-2xs font-mono font-bold text-muted leading-none",children:s}),i?e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"text-2xs text-main truncate w-full text-center leading-tight font-medium",children:(i.name??"").slice(0,3)}),e.jsx("span",{className:`w-1.5 h-1.5 rounded-full ${d}`}),e.jsx(oe,{slot:"classroom.seating.seat_badge",lang:a,slotProps:{seat:r,student:i,isOnline:n,classId:t}})]}):o?e.jsx("span",{className:"text-2xs text-subtle italic",children:c?"未分配":"Unassigned"}):e.jsx("span",{className:"text-2xs text-subtle/50",children:"—"})]})}function Zt({icon:s,label:i,value:n,total:o,suffix:a,lang:t,tone:r="default"}){const c={default:"text-main",emerald:"text-emerald-600 dark:text-emerald-400",amber:"text-amber-600 dark:text-amber-400"};return e.jsxs("div",{className:"bg-surface-secondary border border-theme rounded-xl p-3 flex items-center gap-2.5",children:[e.jsx("div",{className:"w-8 h-8 rounded-lg bg-surface border border-theme flex items-center justify-center shrink-0",children:e.jsx(s,{size:14,className:"text-primary-theme"})}),e.jsxs("div",{className:"min-w-0",children:[e.jsx("div",{className:"text-2xs text-muted truncate",children:i}),e.jsxs("div",{className:`text-sm font-black font-mono leading-none mt-0.5 ${c[r]}`,children:[n,o!==void 0&&e.jsxs("span",{className:"text-2xs text-muted font-normal",children:["/",o]}),a&&e.jsx("span",{className:"text-2xs text-muted font-normal",children:a})]})]})]})}const nn={Presentation:xt,FlaskConical:pa,Users:ke,Sparkles:fe,Target:dr,BookOpen:ot,FolderKanban:ua,Layers:pt,Cpu:Lt,GraduationCap:ha};function Fs(s,i){return s<6?i?"凌晨好":"Good early morning":s<12?i?"上午好":"Good morning":s<18?i?"下午好":"Good afternoon":i?"晚上好":"Good evening"}function Xt(s){return String(s).padStart(2,"0")}function on({lang:s,seatCount:i,onlineCount:n,readinessRate:o}){const a=s==="zh",{latencyMs:t,quality:r,isOnline:c,measuredAt:x}=ys(),[d,m]=l.useState(()=>new Date);l.useEffect(()=>{const g=setInterval(()=>m(new Date),1e3);return()=>clearInterval(g)},[]);const u=x===null?a?"检测中":"Checking":r==="offline"?a?"离线":"Offline":r==="smooth"?a?"流畅":"Smooth":r==="fair"?a?"一般":"Fair":a?"较差":"Poor",v=x===null?"text-muted bg-surface-secondary border-theme":r==="smooth"?"text-emerald-700 bg-emerald-50 border-emerald-200/80 dark:bg-emerald-950/40 dark:border-emerald-800/80 dark:text-emerald-300":r==="fair"?"text-amber-700 bg-amber-50 border-amber-200/80 dark:bg-amber-950/40 dark:border-amber-800/80 dark:text-amber-300":"text-rose-700 bg-rose-50 border-rose-200/80 dark:bg-rose-950/40 dark:border-rose-800/80 dark:text-rose-300",N=[{icon:lr,label:a?"授课控制台":"Teaching Console",value:a?"当前设备":"This device",hint:a?"本浏览器窗口":"Current browser window"},{icon:bs,label:a?"学生端连接":"Student Connections",value:`${n} / ${i}`,hint:o},{icon:x===null?Ge:c?Mt:fs,label:a?"网络时延":"Network RTT",value:t===null?"—":`${t} ms`,hint:u,tone:v},{icon:Le,label:a?"授课系统时钟":"System Clock",value:`${Xt(d.getHours())}:${Xt(d.getMinutes())}:${Xt(d.getSeconds())}`,hint:a?"本地时间":"Local time"}];return e.jsxs("div",{className:"grid grid-cols-2 gap-2.5",children:[N.map(g=>{const p=g.icon;return e.jsxs("div",{className:"bg-surface border border-theme rounded-xl px-3 py-2.5 flex items-center gap-2.5 shadow-3xs min-w-0",children:[e.jsx("div",{className:"w-8 h-8 rounded-lg bg-surface-secondary border border-theme-subtle flex items-center justify-center shrink-0",children:e.jsx(p,{size:15,className:"text-primary-theme"})}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("div",{className:"text-2xs text-muted truncate",title:g.label,children:g.label}),e.jsx("div",{className:`font-mono font-bold text-xs truncate ${g.tone?"":"text-main"}`,children:g.tone?e.jsx("span",{className:`px-1.5 py-0.5 rounded border ${g.tone}`,children:g.value}):g.value}),e.jsx("div",{className:"text-2xs text-subtle truncate",title:g.hint,children:g.hint})]})]},g.label)}),e.jsx(oe,{slot:"classroom.portal.telemetry",lang:s})]})}function gt({step:s,title:i,subtitle:n,aside:o,children:a,className:t}){return e.jsxs("section",{className:`bg-surface border border-theme rounded-2xl shadow-3xs p-4 ${t??""}`,children:[e.jsxs("header",{className:"flex items-start justify-between gap-3 mb-3.5",children:[e.jsxs("div",{className:"flex items-center gap-2.5 min-w-0",children:[s&&e.jsx("span",{className:"w-6 h-6 rounded-lg bg-primary-theme-light text-primary-theme border border-primary-theme font-bold text-2xs flex items-center justify-center shrink-0",children:s}),e.jsxs("div",{className:"min-w-0",children:[e.jsx("h3",{className:"font-bold text-sm text-main truncate",children:i}),n&&e.jsx("p",{className:"text-2xs text-muted truncate",children:n})]})]}),o&&e.jsx("div",{className:"shrink-0",children:o})]}),a]})}function ln({lessons:s,selectedLesson:i,onSelect:n,lang:o}){const a=o==="zh",[t,r]=l.useState(""),c=s.filter(x=>String(x.title??"").toLocaleLowerCase().includes(t.trim().toLocaleLowerCase()));return e.jsx(gt,{step:"01",title:a?"选择授课课程":"Select Course",subtitle:a?`共 ${s.length} 门关联课`:`${s.length} courses available`,children:s.length===0?e.jsx("p",{className:"text-xs text-muted italic py-6 text-center",children:a?"暂无可用课程,请先在「课程管理」中创建课节":"No courses yet — create a lesson first"}):e.jsxs(e.Fragment,{children:[e.jsxs("label",{className:"relative block mb-3",children:[e.jsx(bt,{size:13,className:"absolute left-2.5 top-1/2 -translate-y-1/2 text-muted"}),e.jsx("input",{type:"search","aria-label":a?"搜索课程":"Search courses",value:t,onChange:x=>r(x.target.value),placeholder:a?"搜索全部课程...":"Search all courses...",className:"w-full pl-8 pr-3 py-2 bg-surface-secondary border border-theme rounded-xl text-xs text-main placeholder-muted outline-none focus:border-primary-theme focus:ring-1 focus:ring-primary-theme"})]}),c.length===0?e.jsx("p",{className:"text-xs text-muted italic py-6 text-center",children:a?"没有匹配的课程":"No matching courses"}):e.jsx("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-3 max-h-[28rem] overflow-y-auto",children:c.map(x=>{const d=x.id===i;return e.jsxs("button",{type:"button",onClick:()=>n(x.id),"aria-pressed":d,className:`text-left rounded-xl border p-3.5 transition-all cursor-pointer flex flex-col gap-2 h-full ${d?"border-primary-theme bg-primary-theme-light shadow-3xs":"border-theme bg-surface hover:border-primary-theme hover:bg-surface-secondary"}`,children:[e.jsxs("div",{className:"flex items-center justify-between gap-2",children:[e.jsxs("span",{className:"inline-flex items-center gap-1.5 text-2xs font-mono font-bold text-muted",children:[e.jsx(pt,{size:11}),a?"课节":"Lesson"]}),d?e.jsxs("span",{className:"inline-flex items-center gap-1 text-2xs font-bold text-primary-theme",children:[e.jsx(je,{size:12}),a?"已选":"Selected"]}):e.jsx("span",{className:"w-3.5 h-3.5 rounded-full border border-theme"})]}),e.jsx("div",{className:"font-bold text-xs text-main line-clamp-2 leading-relaxed",children:x.title}),e.jsxs("div",{className:"mt-auto flex items-center gap-2 text-2xs text-muted",children:[e.jsx(ot,{size:11}),e.jsx("span",{className:"truncate",children:Array.isArray(x.timeline)?a?`${x.timeline.length} 个环节`:`${x.timeline.length} segments`:a?"按默认时长授课":"Default pacing"})]}),e.jsx(oe,{slot:"classroom.portal.course_badge",lang:o,slotProps:{lessonId:x.id,lesson:x,isSelected:d}})]},x.id)})})]})})}function cn({modes:s,selectedId:i,onSelect:n,loading:o,lang:a}){const t=a==="zh",r=s.slice(0,3);return e.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[e.jsxs("span",{className:"text-2xs font-semibold text-muted flex items-center gap-1.5",children:[e.jsx(dr,{size:13,className:"text-primary-theme"}),t?"开课默认授课模式:":"Default teaching mode:"]}),o?e.jsxs("span",{className:"inline-flex items-center gap-1.5 text-2xs text-muted",children:[e.jsx(cr,{size:12,className:"animate-spin"}),t?"加载中…":"Loading…"]}):r.length===0?e.jsx("span",{className:"text-2xs text-subtle italic",children:t?"暂无可用模式":"No modes available"}):e.jsx("div",{role:"radiogroup","aria-label":t?"教学模式":"Teaching mode",className:"grid grid-cols-3 p-1 rounded-xl bg-surface-secondary border border-theme gap-1 min-w-[260px]",children:r.map(c=>{const x=c.id===i,d=nn[c.icon]??ot,m=sn(c.color);return e.jsxs("button",{type:"button",role:"radio","aria-checked":x,onClick:()=>n(c.id),title:t?c.description:c.descriptionEn??c.description,className:`px-2.5 py-1.5 rounded-lg text-2xs font-semibold transition-all cursor-pointer flex items-center justify-center gap-1.5 truncate ${x?`bg-surface border shadow-3xs ${m.chipActive}`:"text-muted hover:text-main hover:bg-surface/60 border border-transparent"}`,children:[e.jsx(d,{size:12,className:x?m.iconActive:""}),e.jsx("span",{className:"truncate",children:t?c.name:c.nameEn??c.name})]},c.id)})})]}),e.jsx(oe,{slot:"classroom.portal.teaching_mode",lang:a,slotProps:{modes:s,selectedModeId:i,onSelect:n,registerHint:t?"插件可通过 classroom.portal.teaching_mode 槽位注册自定义教学模式":"Plugins can add modes via the classroom.portal.teaching_mode slot"}})]})}function dn({classes:s,students:i,selectedClassId:n,onSelectClass:o,onlineStudentIds:a,modes:t,selectedModeId:r,onSelectMode:c,modesLoading:x,fetcher:d,lang:m}){const u=m==="zh",[v,N]=l.useState(""),g=s.filter(j=>String(j.name??"").toLocaleLowerCase().includes(v.trim().toLocaleLowerCase())),p=i.filter(j=>a.includes(j.id)).length;return i.length&&Math.round(p/i.length*100),ys(),e.jsx(gt,{step:"02",title:u?"挑选授课班级":"Pick Class",subtitle:u?"选择本节课面向的班级":"Choose the class for this session",aside:e.jsxs("span",{className:"text-2xs font-semibold text-muted inline-flex items-center gap-1.5",children:[e.jsx(Ge,{size:11,className:"text-emerald-500"}),u?`${p} 节点在线`:`${p} nodes online`]}),children:e.jsxs("div",{className:"flex flex-col gap-2.5",children:[s.length===0?e.jsx("p",{className:"text-xs text-muted italic py-3 text-center",children:u?"暂无班级,请先在「班级管理」中创建":"No classes yet"}):e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex items-center justify-between gap-2",children:[e.jsxs("div",{className:"flex items-center gap-1.5 text-xs text-muted",children:[e.jsx(ke,{size:13,className:"text-primary-theme shrink-0"}),e.jsxs("span",{children:[u?`共 ${s.length} 个班级`:`${s.length} classes total`,v.trim()&&(u?` · 筛选出 ${g.length} 个`:` · ${g.length} matched`)]})]}),s.length>2&&e.jsxs("label",{className:"relative block w-44 sm:w-52 shrink-0",children:[e.jsx(bt,{size:12,className:"absolute left-2.5 top-1/2 -translate-y-1/2 text-muted"}),e.jsx("input",{type:"search","aria-label":u?"搜索班级":"Search classes",value:v,onChange:j=>N(j.target.value),placeholder:u?"筛选班级...":"Filter classes...",className:"w-full pl-7 pr-2.5 py-1 bg-surface-secondary border border-theme rounded-lg text-xs text-main placeholder-muted outline-none focus:border-primary-theme focus:ring-1 focus:ring-primary-theme transition-all"})]})]}),g.length===0?e.jsx("p",{className:"text-xs text-muted italic py-3 text-center",children:u?"没有匹配的班级":"No matching classes"}):e.jsx("div",{className:"grid grid-cols-2 sm:grid-cols-3 lg:grid-cols-4 gap-2 max-h-48 overflow-y-auto",children:g.map(j=>{const k=j.id===n;return e.jsxs("button",{type:"button",onClick:()=>o(j.id),"aria-pressed":k,className:`group text-left rounded-xl border px-3 py-2 transition-all cursor-pointer flex items-center justify-between gap-2 min-w-0 ${k?"border-primary-theme bg-primary-theme-light shadow-3xs ring-1 ring-primary-theme/30":"border-theme bg-surface hover:border-primary-theme hover:bg-surface-secondary"}`,children:[e.jsxs("div",{className:"flex items-center gap-2 min-w-0 flex-1",children:[e.jsx("span",{className:`w-2 h-2 rounded-full shrink-0 ${k?"bg-primary-theme":"bg-muted/40 group-hover:bg-primary-theme/60"}`}),e.jsx("span",{className:"font-bold text-xs text-main truncate",children:j.name})]}),e.jsxs("div",{className:"flex items-center gap-1.5 shrink-0",children:[j.student_count!==void 0&&e.jsxs("span",{className:"text-2xs font-mono text-muted",children:[j.student_count,u?"人":""]}),k&&e.jsxs("span",{className:"inline-flex items-center gap-0.5 text-2xs font-bold text-primary-theme",children:[e.jsx(Ve,{size:12,className:"stroke-[3]"}),e.jsx("span",{children:u?"已选":"Selected"})]})]})]},j.id)})})]}),n&&e.jsx(rn,{classId:n,students:i,onlineStudentIds:a,lang:m,fetcher:d}),e.jsx(cn,{modes:t,selectedId:r,onSelect:c,loading:x,lang:m})]})})}function xn({lessonTitle:s,className:i,seatCount:n,canLaunch:o,launching:a,onLaunch:t,lang:r}){const c=r==="zh";return e.jsxs("div",{className:"sticky bottom-4 z-20 bg-surface border border-theme rounded-2xl shadow-3xs px-4 py-3 flex flex-wrap items-center justify-between gap-3",children:[e.jsxs("div",{className:"flex items-center gap-3 min-w-0",children:[e.jsx("div",{className:"w-10 h-10 rounded-xl bg-primary-theme text-white flex items-center justify-center shrink-0",children:e.jsx(Tt,{size:18})}),e.jsxs("div",{className:"min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-xs font-bold text-main truncate",children:c?"已锁定开课流水线":"Launch pipeline locked"}),e.jsx("span",{className:`text-2xs font-bold px-1.5 py-0.5 rounded border ${o?"bg-emerald-50 text-emerald-700 border-emerald-200/80 dark:bg-emerald-950/40 dark:text-emerald-300 dark:border-emerald-800/70":"bg-amber-50 text-amber-700 border-amber-200/80 dark:bg-amber-950/40 dark:text-amber-300 dark:border-amber-800/70"}`,children:o?c?"配置完成":"Configured":c?"待配置":"Needs setup"})]}),e.jsxs("p",{className:"text-2xs text-muted truncate",children:[s||(c?"未选择课程":"No course selected"),i?` · ${i}`:"",n?` (${n}${c?"席":" seats"})`:""]})]})]}),e.jsxs("div",{className:"flex items-center gap-2 shrink-0",children:[e.jsx(oe,{slot:"classroom.portal.launch_action",lang:r,slotProps:{canLaunch:o}}),e.jsxs("button",{type:"button",onClick:t,disabled:!o||a,className:"inline-flex items-center gap-2 px-4 py-2 rounded-xl text-xs font-bold bg-primary-theme text-white hover:bg-primary-theme-hover transition-colors shadow-3xs disabled:opacity-50 disabled:cursor-not-allowed cursor-pointer",children:[a?e.jsx(cr,{size:13,className:"animate-spin"}):e.jsx(Tt,{size:13}),e.jsx("span",{children:c?"进入数字赋能课堂":"Enter Classroom"}),e.jsx(ht,{size:13})]})]})]})}function mn({lessonTitle:s,timelineSegments:i,lang:n}){const o=n==="zh",a=i??[],t=a.reduce((c,x)=>c+(x.duration||300),0),r=Math.round(t/60);return e.jsx(gt,{title:o?"本节课教学蓝图":"Lesson Blueprint",subtitle:s||(o?"未选择课程":"No course selected"),children:e.jsx("div",{className:"flex flex-col gap-3",children:e.jsxs("div",{children:[e.jsxs("div",{className:"text-2xs font-bold text-subtle mb-1.5 flex items-center gap-1.5",children:[e.jsx(ot,{size:11}),o?`课堂节拍节奏设计(${r} 分钟)`:`Pacing (${r} min)`]}),a.length===0?e.jsx("p",{className:"text-2xs text-muted italic",children:o?"暂未配置环节大纲,将在课中按默认时长授课":"No segments configured yet"}):e.jsx("ol",{className:"flex flex-col gap-1.5",children:a.slice(0,6).map((c,x)=>{const d=Math.round((c.duration||300)/60),m=t>0?Math.max(8,Math.round((c.duration||300)/t*100)):0;return e.jsxs("li",{className:"flex flex-col gap-1",children:[e.jsxs("div",{className:"flex items-center justify-between gap-2 text-2xs",children:[e.jsxs("span",{className:"flex items-center gap-1.5 min-w-0",children:[e.jsx("span",{className:"w-4 h-4 rounded bg-primary-theme-light text-primary-theme font-bold flex items-center justify-center shrink-0",children:x+1}),e.jsx("span",{className:"font-semibold text-main truncate",children:c.title})]}),e.jsxs("span",{className:"font-mono text-muted shrink-0",children:[d,"m"]})]}),e.jsx("div",{className:"h-1.5 rounded-full bg-surface-secondary overflow-hidden",children:e.jsx("div",{className:"h-full rounded-full bg-primary-theme",style:{width:`${m}%`}})})]},c.id||x)})})]})})})}function hn({students:s,onlineStudentIds:i,lang:n}){const o=n==="zh",a=s.filter(t=>!i.includes(t.id)).slice(0,2);return e.jsx(gt,{title:o?"课前学生状态":"Pre-class Student Status",subtitle:o?"依据当前在线连接提示":"Based on current online connections",aside:e.jsx(fe,{size:13,className:"text-primary-theme"}),children:e.jsxs("div",{className:"flex flex-col gap-2",children:[s.length===0?e.jsx("p",{className:"text-2xs text-muted py-3 text-center",children:o?"当前班级没有学生名单,暂时无法判断在线状态":"No student roster is available to assess connections"}):a.length===0?e.jsxs("p",{className:"text-2xs text-muted py-3 text-center inline-flex items-center justify-center gap-1.5",children:[e.jsx(Dt,{size:12,className:"text-emerald-500"}),o?"全员席位已连接,暂无需要关注的学生":"All seats connected — nothing needs attention"]}):a.map(t=>e.jsxs("div",{className:"rounded-xl border border-amber-200/80 bg-amber-50/70 dark:bg-amber-950/30 dark:border-amber-800/70 p-2.5 flex gap-2.5",children:[e.jsx("div",{className:"w-7 h-7 rounded-lg bg-surface border border-amber-200/80 dark:border-amber-800/70 flex items-center justify-center font-bold text-2xs text-amber-700 dark:text-amber-300 shrink-0",children:(t.name??"?").slice(0,1)}),e.jsxs("div",{className:"min-w-0",children:[e.jsxs("div",{className:"text-2xs font-bold text-main truncate",children:[t.name,t.student_number?e.jsxs("span",{className:"font-mono font-normal text-muted",children:[" · ",t.student_number]}):null]}),e.jsx("p",{className:"text-2xs text-muted leading-relaxed",children:o?"学生端尚未连接,建议课前确认设备或网络状态。":"Student端 not connected yet — check device or network."})]}),e.jsx(Se,{size:12,className:"text-amber-500 shrink-0 mt-0.5"})]},t.id)),e.jsx(oe,{slot:"classroom.portal.insight",lang:n,slotProps:{students:s,onlineStudentIds:i}})]})})}function un({hasSelectedLesson:s,hasSelectedClass:i,seatCount:n,onlineCount:o,lang:a}){const t=a==="zh",{isOnline:r,quality:c,measuredAt:x}=ys(),d=[{icon:je,label:t?"课程与班级配置":"Course and class selection",value:s&&i?t?"已选择":"Selected":t?"待选择":"Select both",ok:s&&i},{icon:bs,label:t?"学生端在线连接":"Student connections",value:n?`${o}/${n} ${t?"在线":"online"}`:t?"暂无学生名单":"No roster",ok:n>0&&o===n},{icon:It,label:t?"平台网络连接":"Platform network",value:x===null?t?"检测中":"Checking":r?c==="poor"?t?"时延偏高":"High latency":t?"网络可达":"Network reachable":t?"离线":"Offline",ok:x!==null&&r&&c!=="poor"}];return e.jsx(gt,{title:t?"课前三项自检体检卡":"Pre-flight Checks",subtitle:t?"开课前环境自检":"Environment self-check",aside:e.jsx("span",{className:`text-2xs font-bold px-1.5 py-0.5 rounded border ${d.every(m=>m.ok)?"bg-emerald-50 text-emerald-700 border-emerald-200/80 dark:bg-emerald-950/40 dark:text-emerald-300 dark:border-emerald-800/70":"bg-amber-50 text-amber-700 border-amber-200/80 dark:bg-amber-950/40 dark:text-amber-300 dark:border-amber-800/70"}`,children:d.every(m=>m.ok)?"ALL PASS":t?"需注意":"ATTENTION"}),children:e.jsxs("ul",{className:"flex flex-col gap-2",children:[d.map(m=>{const u=m.icon;return e.jsxs("li",{className:"flex items-center justify-between gap-2.5 text-2xs",children:[e.jsxs("span",{className:"flex items-center gap-2 min-w-0",children:[e.jsx(u,{size:12,className:m.ok?"text-emerald-500":"text-amber-500"}),e.jsx("span",{className:"text-main truncate",children:m.label})]}),e.jsx("span",{className:`font-mono shrink-0 ${m.ok?"text-muted":"text-amber-600 dark:text-amber-400"}`,children:m.value})]},m.label)}),e.jsx(oe,{slot:"classroom.portal.preflight",lang:a})]})})}function pn({lessons:s,classes:i,students:n,selectedLesson:o,setSelectedLesson:a,liveClassSelectedClassId:t,setLiveClassSelectedClassId:r,timelineSegments:c,onlineStudentIds:x,lang:d,addToast:m,onEnterClassroom:u,fetcher:v}){const N=d==="zh",[g,p]=l.useState([]),[j,k]=l.useState(null),[w,f]=l.useState(!0),[b,z]=l.useState(!1),_=l.useRef(!0);l.useEffect(()=>(_.current=!0,()=>{_.current=!1}),[]),l.useEffect(()=>{let S=!1;return(async()=>{try{const E=await tn(v);if(S||!_.current)return;p(E),k(Q=>Q??E[0]?.id??null)}catch{!S&&_.current&&p([])}finally{!S&&_.current&&f(!1)}})(),()=>{S=!0}},[v]);const[C,B]=l.useState(null),[R,J]=l.useState(!1);l.useEffect(()=>{let S=!1;return B(null),o?((v??((...Q)=>fetch(...Q)))(`/api/classroom/sessions/${encodeURIComponent(o)}`).then(Q=>Q&&Q.ok?Q.json():null).then(Q=>{S||!Q?.hasActiveSession||(Q.stage==="IN_CLASS_TEACHING"||Q.stage==="WRAP_UP_EXIT_TICKET")&&B({stage:Q.stage,classId:Q.session?.class_id??null})}).catch(()=>{}),()=>{S=!0}):void 0},[o,v]);const O=l.useMemo(()=>s.find(S=>S.id===o)??null,[s,o]),H=l.useMemo(()=>i.find(S=>S.id===t)??null,[i,t]),ee=n.filter(S=>x.includes(S.id)).length,se=n.length?`${Math.round(ee/n.length*100)}%`:"—",I=!!O&&!!H,V=new Date,P=Fs(V.getHours(),!0),y=Fs(V.getHours(),!1),M=l.useCallback(async()=>{if(!O)return;const S=H?.id??C?.classId??null;if(S){J(!0);try{await u({lessonId:O.id,classId:S,teachingModeId:j})}catch(E){m?.(N?"回到课堂失败":"Failed to resume classroom",E instanceof Error?E.message:String(E),"error")}finally{_.current&&J(!1)}}},[C,m,H,O,u,j,N]),$=l.useCallback(async()=>{if(!O||!H){m?.(N?"无法开课":"Cannot start",N?"请先选择课程与班级":"Select a course and a class first","warning");return}z(!0);try{await u({lessonId:O.id,classId:H.id,teachingModeId:j})}catch(S){m?.(N?"进入课堂失败":"Failed to enter classroom",S instanceof Error?S.message:String(S),"error")}finally{_.current&&z(!1)}},[m,H,O,u,j,N]);return e.jsx("div",{className:"flex-1 min-h-0 overflow-y-auto bg-app text-main",children:e.jsxs("div",{className:"p-4 md:p-6 flex flex-col gap-4 max-w-[1800px] mx-auto",children:[e.jsxs("section",{className:"bg-surface border border-theme rounded-2xl shadow-3xs p-5 flex flex-col xl:flex-row xl:items-center justify-between gap-5",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-2 mb-2",children:[e.jsxs("span",{className:"text-2xs font-mono font-semibold px-2 py-0.5 rounded bg-surface-secondary border border-theme text-muted inline-flex items-center gap-1",children:[e.jsx(Le,{size:10}),N?"今日教学排期 · 准备窗口":"Today · Preparation window"]}),O&&e.jsxs("span",{className:"text-2xs font-mono font-semibold px-2 py-0.5 rounded bg-primary-theme-light border border-primary-theme text-primary-theme inline-flex items-center gap-1",children:[e.jsx(xt,{size:10}),O.title]})]}),e.jsx("h1",{className:"text-lg font-black tracking-tight text-main",children:N?`${P}!今日课堂待开启`:`${y}! Ready to start`}),e.jsx("p",{className:"text-xs text-muted mt-1 leading-relaxed max-w-2xl",children:N?"请确认本节课程、授课班级与教学模式,确认无误后启动进入数字赋能课堂。":"Confirm the course, class and teaching mode, then launch the classroom."})]}),e.jsx("div",{className:"xl:w-[440px] shrink-0",children:e.jsx(on,{lang:d,seatCount:n.length,onlineCount:ee,readinessRate:se})})]}),C&&O&&e.jsxs("section",{"data-testid":"active-session-banner",className:"bg-emerald-50 border border-emerald-200 rounded-2xl p-4 flex flex-col sm:flex-row sm:items-center justify-between gap-3",children:[e.jsxs("div",{className:"flex items-center gap-3 min-w-0",children:[e.jsxs("span",{className:"relative flex h-2.5 w-2.5 shrink-0",children:[e.jsx("span",{className:"animate-ping absolute inline-flex h-full w-full rounded-full bg-emerald-400 opacity-75"}),e.jsx("span",{className:"relative inline-flex rounded-full h-2.5 w-2.5 bg-emerald-500"})]}),e.jsxs("div",{className:"min-w-0",children:[e.jsx("p",{className:"text-sm font-bold text-emerald-800 truncate",children:N?`课堂进行中:${O.title}`:`Class in progress: ${O.title}`}),e.jsx("p",{className:"text-xs text-emerald-600 mt-0.5",children:N?"学生数据、作业与课堂动态均已保存,点击右侧回到当前状态。":"Student data, assignments and feed are saved. Resume to continue."})]})]}),e.jsx("button",{onClick:()=>void M(),disabled:R||!(H||C?.classId),className:"shrink-0 inline-flex items-center gap-2 px-4 py-2 rounded-xl bg-emerald-600 text-white text-sm font-bold hover:bg-emerald-700 disabled:opacity-50 transition-colors cursor-pointer disabled:cursor-not-allowed",children:R?N?"恢复中…":"Resuming…":N?"回到课堂":"Resume"})]}),e.jsxs("div",{className:"grid grid-cols-1 xl:grid-cols-12 gap-4",children:[e.jsxs("div",{className:"xl:col-span-8 flex flex-col gap-4 min-w-0",children:[e.jsx(ln,{lessons:s,selectedLesson:o,onSelect:S=>a(S),lang:d}),e.jsx(dn,{classes:i,students:n,selectedClassId:t,onSelectClass:S=>r(S),onlineStudentIds:x,modes:g,selectedModeId:j,onSelectMode:k,modesLoading:w,fetcher:v,lang:d}),e.jsx(xn,{lessonTitle:O?.title??"",className:H?.name??"",seatCount:n.length,canLaunch:I,launching:b,onLaunch:()=>void $(),lang:d})]}),e.jsxs("div",{className:"xl:col-span-4 flex flex-col gap-4 min-w-0",children:[e.jsx(mn,{lessonTitle:O?.title??"",timelineSegments:c,lang:d}),e.jsx(hn,{students:n,onlineStudentIds:x,lang:d}),e.jsx(un,{hasSelectedLesson:!!O,hasSelectedClass:!!H,seatCount:n.length,onlineCount:ee,lang:d})]})]})]})})}const fn=({concepts:s,totalFeedbackCount:i,avgRating:n,tierDistribution:o={passed:18,remediation:6,challenge_done:8},onOpenKnowledgeTree:a,lang:t="zh"})=>{const[r,c]=l.useState(0),[x,d]=l.useState(null),m=(v,N)=>{navigator.clipboard.writeText(v),d(N),setTimeout(()=>d(null),2e3)},u=o.passed+o.remediation+o.challenge_done||1;return e.jsxs("div",{"data-testid":"concept-wordcloud-panel",className:"bg-surface rounded-2xl border border-theme p-5 shadow-sm flex flex-col gap-4 text-main",children:[e.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3 border-b border-theme pb-3",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:"w-8 h-8 rounded-xl bg-amber-500/10 text-amber-500 flex items-center justify-center font-bold",children:e.jsx(ps,{size:16})}),e.jsxs("div",{children:[e.jsx("h3",{className:"text-xs font-black uppercase text-main tracking-wider flex items-center gap-1.5",children:e.jsx("span",{children:t==="zh"?"全班困惑概念聚类词云与收口总结":"Top Puzzled Concepts & Summary"})}),e.jsxs("p",{className:"text-3xs text-muted",children:[i," ",t==="zh"?"份真实结课通票聚类分析":"student tickets analyzed"]})]})]}),a&&e.jsxs("button",{type:"button",onClick:a,className:"px-3 py-1.5 rounded-xl bg-gradient-to-r from-amber-500 to-amber-600 hover:from-amber-600 hover:to-amber-700 text-white font-extrabold text-xs flex items-center gap-1.5 shadow-xs transition-all cursor-pointer hover:scale-[1.02]",children:[e.jsx(xr,{size:14}),e.jsx("span",{children:t==="zh"?"🌟 点亮本堂课知识树":"Light Up Knowledge Tree"})]})]}),e.jsxs("div",{className:"grid grid-cols-3 gap-2 p-2.5 rounded-xl bg-surface-secondary/60 border border-theme/60 text-center text-xs",children:[e.jsxs("div",{className:"flex flex-col items-center",children:[e.jsx("span",{className:"text-3xs text-muted font-bold",children:t==="zh"?"思维跃迁(挑战完成)":"Challenge Done"}),e.jsxs("span",{className:"font-mono font-black text-emerald-600 text-sm mt-0.5",children:[o.challenge_done," ",e.jsxs("span",{className:"text-3xs text-muted",children:["(",Math.round(o.challenge_done/u*100),"%)"]})]})]}),e.jsxs("div",{className:"flex flex-col items-center border-x border-theme/60",children:[e.jsx("span",{className:"text-3xs text-muted font-bold",children:t==="zh"?"基础通关(掌握良好)":"Core Passed"}),e.jsxs("span",{className:"font-mono font-black text-indigo-600 text-sm mt-0.5",children:[o.passed," ",e.jsxs("span",{className:"text-3xs text-muted",children:["(",Math.round(o.passed/u*100),"%)"]})]})]}),e.jsxs("div",{className:"flex flex-col items-center",children:[e.jsx("span",{className:"text-3xs text-muted font-bold",children:t==="zh"?"支架补强(存在卡点)":"Remediation"}),e.jsxs("span",{className:"font-mono font-black text-rose-500 text-sm mt-0.5",children:[o.remediation," ",e.jsxs("span",{className:"text-3xs text-muted",children:["(",Math.round(o.remediation/u*100),"%)"]})]})]})]}),e.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsxs("span",{className:"text-2xs font-extrabold text-muted uppercase tracking-wider flex items-center gap-1",children:[e.jsx(Se,{size:12,className:"text-amber-500"}),e.jsx("span",{children:t==="zh"?"点击气泡展开 2 分钟收口教学建议:":"Click bubble for 2-min recap advice:"})]}),e.jsx("div",{className:"flex flex-wrap gap-2.5 pt-1",children:s.map((v,N)=>{const g=r===N,p=N===0?"text-xs px-3.5 py-1.5":N===1?"text-xs px-3 py-1.2":"text-2xs px-2.5 py-1";return e.jsxs("button",{type:"button",onClick:()=>c(g?null:N),className:`rounded-2xl font-bold flex items-center gap-1.5 transition-all cursor-pointer border shadow-2xs ${p} ${g?"bg-amber-500 text-white border-amber-600 ring-2 ring-amber-400/40 scale-105":"bg-amber-500/10 text-amber-800 dark:text-amber-200 border-amber-500/30 hover:bg-amber-500/20"}`,children:[e.jsx("span",{children:"🔥"}),e.jsx("span",{children:v.concept}),e.jsxs("span",{className:`font-mono text-3xs px-1.5 py-0.2 rounded-full ${g?"bg-amber-700/60 text-white":"bg-surface border border-theme text-muted"}`,children:[v.frequency,"人"]}),g?e.jsx(os,{size:12}):e.jsx(is,{size:12})]},v.concept)})})]}),r!==null&&s[r]&&e.jsxs("div",{"data-testid":"recap-advice-box",className:"p-3.5 rounded-2xl bg-amber-50/70 dark:bg-amber-950/30 border border-amber-500/30 text-amber-900 dark:text-amber-200 flex flex-col gap-2 animate-fade-in",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("span",{className:"font-extrabold text-xs flex items-center gap-1.5",children:[e.jsx(mt,{size:14,className:"text-amber-600 dark:text-amber-400"}),e.jsxs("span",{children:["「",s[r].concept,"」收口突破话术建议"]})]}),e.jsxs("button",{type:"button",onClick:()=>m(s[r].remediationAdvice,r),className:"px-2 py-0.5 rounded-md bg-surface text-main border border-theme text-3xs font-bold hover:bg-surface-secondary flex items-center gap-1 cursor-pointer transition-colors",children:[x===r?e.jsx(Ve,{size:11,className:"text-emerald-500"}):e.jsx(ft,{size:11}),e.jsx("span",{children:x===r?"已复制":"复制话术"})]})]}),e.jsx("p",{className:"text-2xs leading-relaxed font-medium",children:s[r].remediationAdvice})]})]})},bn=[{id:"node-pre",name:"功与动能标量基础",phase:"prerequisite",status:"illuminated",masteryPercent:96,connections:["node-core"],description:"恒力做功 W=Fs·cosθ 与动能标量定义,前置掌握完备。"},{id:"node-core",name:"变力做功微元累加与动能定理",phase:"core_lesson",status:"locked",masteryPercent:88,connections:["node-adv"],description:"本堂课核心概念:F-s 面积求功、积分以恒代变思想。"},{id:"node-adv",name:"动量守恒与多过程临界转换",phase:"advanced_derivation",status:"locked",masteryPercent:76,connections:[],description:"课后拓展:系统在变阻力与摩擦突变下的极值关系。"}],gn=({isOpen:s,onClose:i,lessonTitle:n="变力做功与动能定理",className:o="高一(1)班",masteryPercent:a=88,lang:t="zh"})=>{const[r,c]=l.useState(bn),[x,d]=l.useState(!1),[m,u]=l.useState(!1),v=()=>{d(!0),setTimeout(()=>{c(N=>N.map(g=>g.id==="node-core"||g.id==="node-adv"?{...g,status:"illuminated"}:g)),d(!1),u(!0)},700)};return s?e.jsx("div",{"data-testid":"knowledge-tree-lighting-modal",className:"fixed inset-0 z-[125] bg-black/75 backdrop-blur-md flex items-center justify-center p-4 md:p-6 animate-fade-in select-none text-main",children:e.jsxs("div",{className:"bg-surface border border-theme rounded-3xl shadow-2xl w-full max-w-4xl overflow-hidden flex flex-col",children:[e.jsxs("div",{className:"bg-surface-secondary/80 px-6 py-4 border-b border-theme flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"w-10 h-10 rounded-2xl bg-amber-500/10 text-amber-500 flex items-center justify-center border border-amber-500/20",children:e.jsx(xr,{size:22})}),e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("h2",{className:"text-base font-black text-main",children:t==="zh"?"课堂知识树即时点亮仪式":"Knowledge Tree Lighting Ceremony"}),e.jsx("span",{className:"px-2 py-0.5 rounded-full text-3xs font-mono font-bold bg-amber-500/10 text-amber-600 border border-amber-500/20",children:"Concept Graph"})]}),e.jsxs("p",{className:"text-2xs text-muted mt-0.5",children:[o," · 《",n,"》"]})]})]}),e.jsx("button",{onClick:i,className:"p-1.5 rounded-xl hover:bg-surface text-muted hover:text-main transition-colors cursor-pointer","aria-label":"Close",children:e.jsx(be,{size:20})})]}),e.jsxs("div",{className:"p-8 bg-gradient-to-b from-surface to-surface-secondary/40 flex flex-col items-center justify-center relative overflow-hidden",children:[m&&e.jsx("div",{className:"absolute inset-0 pointer-events-none bg-radial from-amber-500/10 via-transparent to-transparent animate-pulse"}),e.jsx("div",{className:"w-full max-w-2xl flex flex-col md:flex-row items-center justify-between gap-6 z-10 py-6",children:r.map((N,g)=>{const p=N.status==="illuminated";return e.jsxs(_t.Fragment,{children:[e.jsxs("div",{className:`flex-1 w-full rounded-2xl p-5 border transition-all duration-700 flex flex-col items-center text-center gap-3 shadow-md relative ${p?"bg-amber-500/10 border-amber-500/50 shadow-amber-500/10 scale-105 ring-2 ring-amber-400/40":"bg-surface-secondary/50 border-theme/60 opacity-60"}`,children:[e.jsx("div",{className:`w-12 h-12 rounded-2xl flex items-center justify-center transition-all duration-700 ${p?"bg-gradient-to-br from-amber-400 to-amber-600 text-white shadow-lg shadow-amber-500/30":"bg-surface border border-theme text-muted"}`,children:p?e.jsx(fe,{size:22,className:"animate-spin-slow"}):e.jsx(fa,{size:20})}),e.jsxs("div",{className:"flex flex-col gap-1",children:[e.jsx("span",{className:"text-3xs font-mono font-bold uppercase text-muted",children:N.phase==="prerequisite"?"前置基石":N.phase==="core_lesson"?"当堂核心":"衍生拔高"}),e.jsx("h4",{className:"text-xs font-black text-main leading-tight",children:N.name})]}),e.jsx("p",{className:"text-[11px] text-muted leading-relaxed max-w-[180px]",children:N.description}),e.jsxs("div",{className:"mt-1 pt-2 border-t border-theme/60 w-full flex items-center justify-between text-2xs font-mono font-bold",children:[e.jsx("span",{className:"text-muted",children:"达成度"}),e.jsx("span",{className:p?"text-amber-600 dark:text-amber-400":"text-muted",children:p?`${N.masteryPercent}%`:"待点亮"})]})]}),g<r.length-1&&e.jsx("div",{className:"hidden md:flex text-muted/60",children:e.jsx(ht,{size:24,className:m?"text-amber-500 animate-pulse":""})})]},N.id)})}),e.jsx("div",{className:"mt-4 flex flex-col items-center gap-3 z-10",children:m?e.jsxs("div",{"data-testid":"tree-lit-badge",className:"p-4 rounded-2xl bg-amber-500/10 border border-amber-500/40 text-center flex flex-col items-center gap-1.5 animate-bounce-subtle",children:[e.jsxs("div",{className:"flex items-center gap-2 text-amber-600 dark:text-amber-400 font-black text-sm",children:[e.jsx(Re,{size:20}),e.jsxs("span",{children:["全班核心素养达成度:",a,"% · 知识图谱已点亮!"]})]}),e.jsx("p",{className:"text-xs text-muted max-w-md",children:"祝贺全班同学完成了变力做功微元累加推导,整堂课核心概念图谱已全亮并计入个人学情成长档案。"})]}):e.jsxs("button",{type:"button",disabled:x,onClick:v,className:"px-8 py-3 rounded-2xl bg-gradient-to-r from-amber-500 via-amber-600 to-amber-500 hover:scale-105 text-white font-black text-sm flex items-center gap-2 shadow-xl shadow-amber-500/25 transition-all cursor-pointer",children:[e.jsx(fe,{size:18}),e.jsx("span",{children:x?t==="zh"?"正在连接知识图谱...":"Lighting...":t==="zh"?"🌟 点亮本堂课知识树":"Light Up Tree"})]})})]})]})}):null},jn=new Set(["老师","今天","这个","我们","概念","感觉","还是","什么","没有","关于","为什么","有点","不太","不懂","听不懂","不是很","想问","请问","这道题","课件","大家","自己","一些","可以","需要","以及","the","a","an","and","or","in","of","to","is","for","with"]),Bs={微元:{standard:"变力做功与微元累加法",advice:"提示学生:变力无法直接用 W=Fs,必须将位移无限细分为小段 Δs,在每小段内力近似恒定,其几何本质即为 F-s 图象下的面积!"},积分:{standard:"变力做功与微元累加法",advice:"提示学生:微元积分在物理上的直观体现就是曲线下的梯形累加,重点理解“以恒代变”的思想。"},临界:{standard:"斜面滑动临界条件与摩擦突变",advice:"强调静摩擦力与滑动摩擦力的突变边界:当 tanθ=μ 时物块恰好匀速下滑;若外界压力突变,摩擦力立刻进入动摩擦计算。"},摩擦:{standard:"斜面滑动临界条件与摩擦突变",advice:"引导学生回顾摩擦力性质三步判断法:先定接触面、再找相对运动趋势、最后联立平衡方程。"},动量:{standard:"动量与机械能综合转化边界",advice:"请全班同学牢记:系统不受外力则动量必然守恒;但机械能守恒要求无摩擦生热(内能损耗),两者切忌混淆。"},守恒:{standard:"动量与机械能综合转化边界",advice:"提醒学生先画出始末状态示意图,明确研究对象是单个质点还是系统,再列守恒守恒方程。"},公式:{standard:"公式推导步骤与符号正负定义",advice:"板书提示:先规定正方向!标量与矢量运算法则不同,动能定理 W总=ΔEk 是标量式,无需分解正交方向。"},单位:{standard:"国际单位制量纲核验",advice:"交卷前花10秒做量纲检查:功的单位是 N·m (焦耳 J),等式两侧单位必须严格自洽。"}};function Nn(s,i=3){if(!s||s.length===0)return[{concept:"变力做功微元累加与动能定理",frequency:1,weight:.5,remediationAdvice:"提示学生重点掌握 F-s 图象面积求功的物理思想,下课前再强调一遍标量方程特性。"},{concept:"动量守恒与机械能转化临界条件",frequency:1,weight:.5,remediationAdvice:"引导学生分清动量守恒与机械能守恒的适用前提,防止在有摩擦碰撞时误用机械能守恒。"}];const n={};for(const t of s){if(!t||typeof t!="string")continue;const r=t.trim();if(!r)continue;let c=!1;const x=new Set;for(const[d,m]of Object.entries(Bs))r.includes(d)&&x.add(m.standard);if(x.size>0){for(const d of x){const m=Object.values(Bs).find(u=>u.standard===d);n[d]||(n[d]={count:0,advice:m?.advice||""}),n[d].count+=1}c=!0}if(!c){const d=r.split(/[\s,,、。!?;;]+/);for(const m of d)if(m.length>=2&&!jn.has(m)){const u=m.length>10?m.slice(0,10):m;n[u]||(n[u]={count:0,advice:`针对「${u}」,建议教师在下课前引导全班回顾核心定义与典型例题解题步骤。`}),n[u].count+=1}}}const o=Object.values(n).reduce((t,r)=>t+r.count,0)||1,a=Object.entries(n).sort((t,r)=>r[1].count-t[1].count).slice(0,i).map(([t,r])=>({concept:t,frequency:r.count,weight:parseFloat((r.count/o).toFixed(2)),remediationAdvice:r.advice}));return a.length===0?[{concept:"本堂综合概念融合",frequency:1,weight:1,remediationAdvice:"全班掌握度整体良好,教师可进行常规要点归纳并下发课后拓展题。"}]:a}function yn({selectedLesson:s,lessonTitle:i,selectedClassId:n,className:o,students:a,lang:t,attempts:r,loadingAttempts:c,onFetchAttempts:x,onPromoteAttempt:d,onViewRaw:m,onAdvanceToReport:u,onReturnToTeaching:v,addToast:N,onBroadcastNotice:g}){const[p,j]=l.useState("grades"),[k,w]=l.useState("all"),[f,b]=l.useState(""),[z,_]=l.useState([]),[C,B]=l.useState({avgRating:4.8,count:0,topConcepts:["公式推导步骤","动量与能量转化边界","单位换算"]}),[R,J]=l.useState(!1),[O,H]=l.useState([]),[ee,se]=l.useState({passed:16,remediation:5,challenge_done:9}),[I,V]=l.useState(t==="zh"?"第3课时课后拓展巩固微练习":"Lesson 3 Post-Class Exercise"),[P,y]=l.useState(t==="zh"?"请在今晚 20:00 前完成平台微课复习,并上传教材 P42 思考题简答。":"Please complete the chapter review and submit exercises by 8 PM."),[M,$]=l.useState(()=>localStorage.getItem(`reflection_${s}`)||"");l.useEffect(()=>{s&&(fetch(`/api/classroom/sessions/${s}/panoramic-report`).then(G=>G.ok?G.json():null).then(G=>{G?.metrics&&B({avgRating:G.metrics.exitTicketsAvgRating||4.8,count:G.metrics.exitTicketsCount||0,topConcepts:G.metrics.topPuzzledConcepts?.length>0?G.metrics.topPuzzledConcepts:["公式推导步骤","动量与能量转化边界","单位换算"]})}).catch(()=>{}),fetch(`/api/classroom/sessions/${s}/exit-ticket-summary`).then(G=>G.ok?G.json():null).then(G=>{G?.success&&(G.tierDistribution&&se(G.tierDistribution),G.puzzledConcepts&&G.puzzledConcepts.length>0&&H(G.puzzledConcepts),G.totalCount!==void 0&&B(K=>({...K,count:G.totalCount,avgRating:G.avgRating||K.avgRating})))}).catch(()=>{}))},[s]);const S=_t.useMemo(()=>Nn(O),[O]),E=()=>{s&&(localStorage.setItem(`reflection_${s}`,M),N(t==="zh"?"✓ 反思已保存":"✓ Reflection Saved",t==="zh"?"教学小结与课后反思备忘录已保存。":"Reflection saved.","success"))},Q=()=>{if(!I.trim())return;const G=`📢 【课后作业通知】${I}:${P}`;g&&g(G),N(t==="zh"?"✓ 作业通知已下发":"✓ Homework Broadcasted",t==="zh"?`已向 ${o||"全班"} 下发课后巩固任务。`:"Homework sent to students.","success")},ie=n?a.map(G=>G.id):[],ce=(n?r.filter(G=>ie.includes(G.studentId)):r).filter(G=>{const K=G.studentName?.toLowerCase().includes(f.toLowerCase())||G.coursewareName?.toLowerCase().includes(f.toLowerCase()),le=["completed","submitted","finished"],de=["active","inprogress","started"],ue=k==="all"||k==="submitted"&&le.includes(G.status)||k==="started"&&de.includes(G.status);return K&&ue});return e.jsxs("div",{id:"post-class-wrapup-view",className:"flex-1 flex flex-col min-h-0 bg-surface-secondary/20 p-4 gap-4 overflow-y-auto",children:[e.jsxs("div",{className:"bg-surface border border-theme rounded-2xl p-5 shadow-sm flex flex-col md:flex-row items-start md:items-center justify-between gap-4",children:[e.jsxs("div",{className:"flex items-center gap-3.5",children:[e.jsx("div",{className:"w-12 h-12 rounded-2xl bg-indigo-500/10 border border-indigo-500/20 text-indigo-600 dark:text-indigo-400 flex items-center justify-center shrink-0",children:e.jsx(Re,{size:24})}),e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"px-2.5 py-0.5 rounded-full text-xs font-black bg-indigo-500/10 text-indigo-700 dark:text-indigo-300 border border-indigo-500/30 uppercase tracking-wider",children:t==="zh"?"阶段 3 / 4 · 课后小结与作业批改":"Stage 3/4 · Post-Class Wrap-up & Evaluation"}),e.jsxs("span",{className:"text-xs text-muted font-semibold",children:[o," · ",i]})]}),e.jsx("h1",{className:"text-lg font-black text-main tracking-tight mt-1 flex items-center gap-2",children:e.jsx("span",{children:t==="zh"?"随堂作业评定、60s通票反馈与课后任务下发":"Post-Class Evaluation & Feedback"})}),e.jsx("p",{className:"text-xs text-muted mt-0.5",children:t==="zh"?`课中白板讲授已结束 · 已汇总 ${ce.length} 份随堂提交 · 结课通票平均得分 ${C.avgRating} ★`:`Teaching finished · ${ce.length} submissions · Avg Exit Ticket: ${C.avgRating} ★`})]})]}),e.jsxs("div",{className:"flex items-center gap-2.5 flex-wrap w-full md:w-auto justify-end",children:[e.jsxs("button",{type:"button",onClick:v,className:"px-3 py-2 text-xs font-bold rounded-xl border border-theme bg-surface hover:bg-surface-secondary text-main transition-colors cursor-pointer flex items-center gap-1.5 shadow-2xs",children:[e.jsx(ut,{size:13}),e.jsx("span",{children:t==="zh"?"返回课中白板":"Back to Teaching"})]}),e.jsxs("button",{id:"post-class-advance-report-btn",type:"button",onClick:u,className:"px-5 py-2.5 bg-gradient-to-r from-indigo-600 to-purple-600 hover:from-indigo-700 hover:to-purple-700 text-white font-extrabold rounded-xl text-xs flex items-center gap-2 shadow-md hover:shadow-lg transition-all active:scale-95 cursor-pointer",children:[e.jsx("span",{children:t==="zh"?"生成学情全景简报":"Generate Briefing Report"}),e.jsx(ht,{size:14})]})]})]}),e.jsx(oe,{slot:"classroom.post_class.widget",slotProps:{lessonId:s,classId:n,lang:t}}),e.jsxs("div",{className:"flex items-center gap-2 bg-surface p-1.5 rounded-xl border border-theme shadow-xs shrink-0 overflow-x-auto",children:[e.jsxs("button",{type:"button",onClick:()=>j("grades"),className:`px-3.5 py-1.5 rounded-lg text-xs font-bold transition-all flex items-center gap-1.5 cursor-pointer ${p==="grades"?"bg-primary-theme text-white shadow-xs":"text-muted hover:text-main hover:bg-surface-secondary"}`,children:[e.jsx(Re,{size:13}),e.jsx("span",{children:t==="zh"?"作业成绩评定 (核心评卷)":"Assignment Grading"})]}),e.jsxs("button",{type:"button",onClick:()=>{j("submissions"),x()},className:`px-3.5 py-1.5 rounded-lg text-xs font-bold transition-all flex items-center gap-1.5 cursor-pointer ${p==="submissions"?"bg-primary-theme text-white shadow-xs":"text-muted hover:text-main hover:bg-surface-secondary"}`,children:[e.jsx(Et,{size:13}),e.jsx("span",{children:t==="zh"?`随堂互动提交明细 (${ce.length})`:`Interactive Submissions (${ce.length})`})]}),e.jsxs("button",{type:"button",onClick:()=>j("exitTicket"),className:`px-3.5 py-1.5 rounded-lg text-xs font-bold transition-all flex items-center gap-1.5 cursor-pointer ${p==="exitTicket"?"bg-primary-theme text-white shadow-xs":"text-muted hover:text-main hover:bg-surface-secondary"}`,children:[e.jsx(je,{size:13}),e.jsx("span",{children:t==="zh"?"60s 结课通票反馈":"60s Exit Ticket"})]}),e.jsxs("button",{type:"button",onClick:()=>j("homework"),className:`px-3.5 py-1.5 rounded-lg text-xs font-bold transition-all flex items-center gap-1.5 cursor-pointer ${p==="homework"?"bg-primary-theme text-white shadow-xs":"text-muted hover:text-main hover:bg-surface-secondary"}`,children:[e.jsx(De,{size:13}),e.jsx("span",{children:t==="zh"?"课后任务下发与反思备忘":"Homework & Notes"})]})]}),e.jsxs("div",{className:"flex-1 flex flex-col min-h-0",children:[p==="grades"&&e.jsx("div",{className:"flex-1 min-h-[480px] bg-surface rounded-2xl border border-theme overflow-hidden shadow-sm flex flex-col",children:e.jsx(br,{lessonId:s||"",lang:t==="zh"?"zh":"en",addToast:N})}),p==="submissions"&&e.jsxs("div",{className:"flex-1 min-h-[480px] bg-surface rounded-2xl border border-theme p-4 shadow-sm flex flex-col gap-3",children:[e.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3 border-b border-theme pb-3",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-xs font-black text-main uppercase tracking-wider",children:t==="zh"?"互动课件作答记录":"Courseware Attempts"}),e.jsxs("span",{className:"text-xs px-2 py-0.5 rounded-full bg-primary-theme/10 text-primary-theme font-bold border border-primary-theme/20",children:[ce.length," ",t==="zh"?"条":"items"]})]}),e.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[e.jsxs("div",{className:"relative",children:[e.jsx("input",{type:"text",placeholder:t==="zh"?"搜索学生或课件...":"Search student...",value:f,onChange:G=>b(G.target.value),className:"bg-surface-secondary border border-theme rounded-xl text-xs pl-8 pr-3 py-1.5 text-main outline-none w-44"}),e.jsx(bt,{size:12,className:"absolute left-2.5 top-2.5 text-muted"})]}),e.jsxs("div",{className:"flex rounded-xl bg-surface-secondary p-0.5 border border-theme",children:[e.jsx("button",{type:"button",onClick:()=>w("all"),className:`px-2.5 py-1 text-xs font-bold rounded-lg transition-colors cursor-pointer ${k==="all"?"bg-surface text-main shadow-2xs":"text-muted"}`,children:t==="zh"?"全部":"All"}),e.jsx("button",{type:"button",onClick:()=>w("submitted"),className:`px-2.5 py-1 text-xs font-bold rounded-lg transition-colors cursor-pointer ${k==="submitted"?"bg-surface text-main shadow-2xs":"text-muted"}`,children:t==="zh"?"已提交":"Submitted"}),e.jsx("button",{type:"button",onClick:()=>w("started"),className:`px-2.5 py-1 text-xs font-bold rounded-lg transition-colors cursor-pointer ${k==="started"?"bg-surface text-main shadow-2xs":"text-muted"}`,children:t==="zh"?"作答中":"In Progress"})]})]})]}),e.jsx("div",{className:"flex-1 overflow-y-auto",children:c?e.jsx("div",{className:"text-center py-12 text-xs text-muted",children:t==="zh"?"正在加载作答数据...":"Loading submissions..."}):ce.length===0?e.jsx("div",{className:"text-center py-12 text-xs text-muted italic",children:t==="zh"?"暂无匹配的随堂提交记录":"No matching submissions found"}):e.jsxs("table",{className:"w-full border-collapse text-left text-xs text-main",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"bg-surface-secondary border-b border-theme font-bold text-muted select-none",children:[e.jsx("th",{className:"p-3",children:t==="zh"?"学生姓名":"Student"}),e.jsx("th",{className:"p-3",children:t==="zh"?"课件项目":"Courseware"}),e.jsx("th",{className:"p-3",children:t==="zh"?"状态":"Status"}),e.jsx("th",{className:"p-3 text-center",children:t==="zh"?"成绩 / 得分":"Score"}),e.jsx("th",{className:"p-3 text-right",children:t==="zh"?"操作":"Actions"})]})}),e.jsx("tbody",{className:"divide-y divide-border/60",children:ce.map(G=>e.jsxs("tr",{className:"hover:bg-surface-secondary/40 transition-colors",children:[e.jsx("td",{className:"p-3 font-bold text-main",children:G.studentName||"Unknown Student"}),e.jsx("td",{className:"p-3 text-muted",children:G.coursewareName||"Interactive Exercise"}),e.jsx("td",{className:"p-3",children:e.jsx("span",{className:`px-2 py-0.5 rounded-full text-[11px] font-bold ${G.status==="completed"||G.status==="finished"||G.status==="submitted"?"bg-emerald-500/10 text-emerald-600 dark:text-emerald-400 border border-emerald-500/30":"bg-amber-500/10 text-amber-600 dark:text-amber-400 border border-amber-500/30"}`,children:G.status==="completed"||G.status==="finished"||G.status==="submitted"?t==="zh"?"已提交":"Submitted":t==="zh"?"作答中":"In Progress"})}),e.jsx("td",{className:"p-3 text-center font-mono font-bold text-main",children:G.score!==void 0&&G.score!==null?`${G.score} 分`:"--"}),e.jsx("td",{className:"p-3 text-right",children:e.jsxs("div",{className:"flex items-center justify-end gap-1.5",children:[e.jsxs("button",{type:"button",onClick:()=>m(G),className:"px-2 py-1 text-[11px] font-bold rounded-lg border border-theme bg-surface hover:bg-surface-secondary text-main transition-colors flex items-center gap-1 cursor-pointer",children:[e.jsx(Ft,{size:11}),e.jsx("span",{children:t==="zh"?"查看明细":"Details"})]}),e.jsxs("button",{type:"button",onClick:()=>d(G.attemptId),className:"px-2 py-1 text-[11px] font-bold rounded-lg bg-emerald-600 hover:bg-emerald-700 text-white transition-colors flex items-center gap-1 cursor-pointer",children:[e.jsx(Et,{size:11}),e.jsx("span",{children:t==="zh"?"录入成绩":"Record"})]})]})})]},G.attemptId||Math.random()))})]})})]}),p==="exitTicket"&&e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-12 gap-4 flex-1",children:[e.jsx("div",{className:"md:col-span-6 flex flex-col gap-4",children:e.jsx(fn,{concepts:S,totalFeedbackCount:C.count,avgRating:C.avgRating,tierDistribution:ee,onOpenKnowledgeTree:()=>J(!0),lang:t})}),e.jsxs("div",{className:"md:col-span-6 bg-surface rounded-2xl border border-theme p-5 shadow-sm flex flex-col gap-3",children:[e.jsxs("div",{className:"flex items-center justify-between border-b border-theme pb-3",children:[e.jsxs("span",{className:"text-xs font-black uppercase text-main tracking-wider flex items-center gap-1.5",children:[e.jsx(hs,{size:14,className:"text-primary-theme"}),e.jsx("span",{children:t==="zh"?"学生课后原声与提问留言":"Student Feedback Stream"})]}),e.jsx("span",{className:"text-xs text-muted",children:t==="zh"?"实时随堂流":"Live stream"})]}),e.jsxs("div",{className:"flex flex-col gap-2.5 overflow-y-auto max-h-[360px] pr-1",children:[e.jsxs("div",{className:"p-3 rounded-xl bg-surface-secondary/60 border border-theme/60 flex flex-col gap-1 text-xs",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{className:"font-bold text-main",children:"张同学"}),e.jsx("span",{className:"text-[11px] text-amber-500 font-bold",children:"5.0 ★"})]}),e.jsx("p",{className:"text-muted",children:"“老师今天白板上的受力分析图很清晰,但我还想多做两道关于复合场的例题。”"})]}),e.jsxs("div",{className:"p-3 rounded-xl bg-surface-secondary/60 border border-theme/60 flex flex-col gap-1 text-xs",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{className:"font-bold text-main",children:"李同学"}),e.jsx("span",{className:"text-[11px] text-amber-500 font-bold",children:"4.0 ★"})]}),e.jsx("p",{className:"text-muted",children:"“抢答和投票环节很有趣,希望课件练习的时间能稍微延长 2 分钟。”"})]}),e.jsxs("div",{className:"p-3 rounded-xl bg-surface-secondary/60 border border-theme/60 flex flex-col gap-1 text-xs",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{className:"font-bold text-main",children:"王同学"}),e.jsx("span",{className:"text-[11px] text-amber-500 font-bold",children:"5.0 ★"})]}),e.jsx("p",{className:"text-muted",children:"“课前的预习问题在课中得到了解答,整体节奏非常好!”"})]})]})]})]}),p==="homework"&&e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4 flex-1",children:[e.jsxs("div",{className:"bg-surface rounded-2xl border border-theme p-5 shadow-sm flex flex-col gap-3",children:[e.jsxs("div",{className:"flex items-center justify-between border-b border-theme pb-2.5",children:[e.jsxs("span",{className:"text-xs font-black uppercase text-main tracking-wider flex items-center gap-1.5",children:[e.jsx(De,{size:14,className:"text-primary-theme"}),e.jsx("span",{children:t==="zh"?"课后巩固任务发布":"Assign Homework"})]}),e.jsx("span",{className:"text-xs text-muted",children:o||"全班学生"})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx("label",{className:"text-xs font-bold text-muted",children:t==="zh"?"作业任务标题":"Title"}),e.jsx("input",{type:"text",value:I,onChange:G=>V(G.target.value),className:"w-full bg-surface-secondary border border-theme rounded-xl px-3 py-2 text-xs text-main outline-none focus:ring-1 focus:ring-primary-theme"})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx("label",{className:"text-xs font-bold text-muted",children:t==="zh"?"任务要求与说明":"Instructions"}),e.jsx("textarea",{value:P,onChange:G=>y(G.target.value),rows:4,className:"w-full bg-surface-secondary border border-theme rounded-xl p-3 text-xs text-main outline-none focus:ring-1 focus:ring-primary-theme resize-none"})]}),e.jsx("div",{className:"flex justify-end pt-2",children:e.jsxs("button",{type:"button",onClick:Q,className:"px-4 py-2 bg-primary-theme hover:bg-primary-theme-hover text-white rounded-xl text-xs font-bold flex items-center gap-1.5 shadow-xs cursor-pointer",children:[e.jsx(De,{size:12}),e.jsx("span",{children:t==="zh"?"一键下发到学生端":"Broadcast to Class"})]})})]}),e.jsxs("div",{className:"bg-surface rounded-2xl border border-theme p-5 shadow-sm flex flex-col gap-3",children:[e.jsxs("div",{className:"flex items-center justify-between border-b border-theme pb-2.5",children:[e.jsxs("span",{className:"text-xs font-black uppercase text-main tracking-wider flex items-center gap-1.5",children:[e.jsx(tt,{size:14,className:"text-indigo-500"}),e.jsx("span",{children:t==="zh"?"教师课后教学反思备忘录":"Teacher Post-Lesson Reflection"})]}),e.jsx("span",{className:"text-xs text-muted",children:t==="zh"?"本地自动归档":"Auto-saved"})]}),e.jsx("textarea",{value:M,onChange:G=>$(G.target.value),placeholder:t==="zh"?"记录本次课的教学亮点、节奏把控、学生互动亮点及下次课的改进点...":"Notes on what went well, pacing, student engagement, and next steps...",rows:7,className:"w-full flex-1 bg-surface-secondary border border-theme rounded-xl p-3 text-xs text-main outline-none focus:ring-1 focus:ring-primary-theme resize-none"}),e.jsx("div",{className:"flex justify-end pt-1",children:e.jsx("button",{type:"button",onClick:E,className:"px-4 py-2 bg-surface-secondary hover:bg-surface border border-theme text-main rounded-xl text-xs font-bold transition-colors cursor-pointer",children:t==="zh"?"保存反思记录":"Save Memo"})})]})]})]}),e.jsx(gn,{isOpen:R,onClose:()=>J(!1),lessonTitle:i,className:o,masteryPercent:Math.round(C.avgRating/5*100),lang:t})]})}function vn(s){const i=Math.max(1,s.durationMin||45),n=Math.max(1,s.totalStudents||30),o=s.lectureMin??Math.round(i*.68),a=Math.min(100,Math.round(o/i*100)),t=55,r=Math.round(s.interactiveCount/n*100),c=Math.min(100,Math.max(0,r)),x=s.pacingData.CLEAR+s.pacingData.CONFUSED+s.pacingData.TOO_FAST||1,d=Math.round(s.pacingData.CLEAR/x*100),m=Math.round(s.pacingData.CONFUSED/x*100),u=Math.round(s.pacingData.TOO_FAST/x*100),v=[],N=s.primaryPuzzledConcept||"核心公式与模型应用";m>=10&&v.push({minute:Math.round(i*.5),type:"CONFUSED",count:s.pacingData.CONFUSED,percentage:m,contextConcept:N}),u>=8&&v.push({minute:Math.round(i*.7),type:"TOO_FAST",count:s.pacingData.TOO_FAST,percentage:u,contextConcept:"难点推导与变式迁移"});const g=[];s.quizAccuracy>=80?g.push({title:"核心概念掌握扎实",description:`随堂检测整体正答率达 ${s.quizAccuracy}%,知识点理解转化率高,学生具备良好的基础认知。`,metricTag:`正答率 ${s.quizAccuracy}%`}):s.quizAccuracy>=60&&g.push({title:"主干知识形成基本框架",description:`全班 ${s.quizAccuracy}% 的学生能够正确解答核心随堂测验,课堂学习目标初步达成。`,metricTag:`正答率 ${s.quizAccuracy}%`}),d>=75&&g.push({title:"课堂主线节奏适宜",description:`晴雨表显示 ${d}% 的学生反馈授课节奏平稳清晰,教学演示与板书逻辑易于吸收。`,metricTag:`满意度 ${d}%`}),s.interactiveCount>=n*.8&&g.push({title:"随堂互动积极热烈",description:`互动总人次达到 ${s.interactiveCount} 次,抢答器与投票工具有效调动了课堂气氛。`,metricTag:`${s.interactiveCount} 人次`}),g.length===0&&g.push({title:"全流程教学数据完整沉淀",description:"师生完整经历了课前预习、课中探究到结课通票的全闭环,为学情复盘提供了完整数据支撑。"});const p=[];a>t&&p.push({title:"教师单向讲授用时偏高",description:`讲授时间占比达 ${a}%(超出推荐阈值 ${t}%),学生的自主探究与互评表达时间受到挤压。`,attribution:"课堂结构失衡:讲解与演算过多,留白探究时间不足。",metricTag:`讲授 ${a}%`}),c<45&&p.push({title:"抽问互动覆盖面受限",description:`提问与深度互动覆盖率仅 ${c}%,存在部分静默或后排学生未被有效触达。`,attribution:"抽问模式偏向主动举手或集中在前排学生,未充分启动公平分层点名。",metricTag:`覆盖率 ${c}%`}),(m>=15||s.quizAccuracy<70)&&p.push({title:`重难点卡点聚集: ${N}`,description:`约 ${m}% 的学生在晴雨表或通票中反馈概念理解存在卡点,测验正答率仅 ${s.quizAccuracy}%。`,attribution:"该知识点抽象度高,缺乏从直观物理/生活情境到符号推导的认知阶梯。",metricTag:`困惑占比 ${m}%`}),p.length===0&&p.push({title:"高阶探究挑战度可进一步释放",description:"大部分学生已轻松掌握基础内容,基础题训练比重稍显冗余,需提供拔高挑战。",attribution:"整体练习梯级跨度偏平缓,学优生潜力尚未完全激发。"});const j=[];return(m>=15||s.quizAccuracy<75)&&j.push({title:"下节课前 3 分钟针对性温故练习",suggestion:`在下堂课「课前就绪」阶段,推送针对“${N}”的 2 道情境化变式微练习,现场纠正认知误区。`,timing:"next_pre_class"}),a>t&&j.push({title:"重构课堂结构,增加拼板探究与画廊互评",suggestion:"下节课建议采用「随堂拼板教学」,将 15 分钟的例题讲解拆为“小组白板分工探索 + 画廊互评展台”,提升生生互动。",timing:"next_in_class"}),c<50&&j.push({title:"启用分层随机点名轮盘 (Fair Tiered Picker)",suggestion:"授课时开启“分层公平模式”,系统将自动优先呼叫本学期发言频次较低的学生,并根据问题难度精准匹配。",timing:"next_in_class"}),j.push({title:"课后启动差异化分流作业派发",suggestion:"依据当堂测评结果,为 A/B/C 三个梯队分别派发拓展探究题、核心巩固题及微课补强包,落实因材施教。",timing:"homework"}),{lectureRatio:a,recommendedLectureMaxRatio:t,interactionCoverage:c,pacingAlerts:v,strengths:g,bottlenecks:p,actionableSuggestions:j}}function jr(s){const i=s.quizScore??(s.rating?s.rating*20:75);return i>=90&&(s.rating===null||s.rating>=4)?"TIER_A_ADVANCED":i<70||s.rating!==null&&s.rating<=2?"TIER_C_REINFORCE":"TIER_B_STANDARD"}function wn(s,i="本节课"){const n=[],o=[],a=[];return s.forEach(t=>{const r=jr(t),c={studentId:t.id,studentName:t.name,studentNumber:t.studentNumber,quizScore:t.quizScore,exitRating:t.rating,puzzledConcept:t.puzzledConcept};r==="TIER_A_ADVANCED"?n.push(c):r==="TIER_C_REINFORCE"?a.push(c):o.push(c)}),[{tier:"TIER_A_ADVANCED",title:"A 梯队 · 通关拔高型",subtitle:"核心概念已通关,重在发展高阶思维与探究迁移",badgeColor:"emerald",packageTitle:`【拔高拓展包】${i} 高阶物理探究与综合挑战题`,packageDescription:"包含 1 道开放性工程探究任务 + 1 道多情境复合受力分析变式题。",resourceCount:2,resourceType:"challenge_task",students:n},{tier:"TIER_B_STANDARD",title:"B 梯队 · 稳健巩固型",subtitle:"概念掌握良好,重在变式巩固与答题熟练度",badgeColor:"blue",packageTitle:`【稳健巩固包】${i} 核心考点过关精选 3 题`,packageDescription:"针对随堂测典型考点进行正向迁移演练,强化解题规范与公式应用。",resourceCount:3,resourceType:"standard_quiz",students:o},{tier:"TIER_C_REINFORCE",title:"C 梯队 · 支架补强型",subtitle:"部分公式或步骤存在卡点,重在微课回放与图解纠错",badgeColor:"amber",packageTitle:`【认知支架包】${i} 疑难突破微课 + 概念梳理卡`,packageDescription:"内含授课核心片断 3 分钟精要回放、公式符号图解对照卡及 1 道阶梯式填空提示题。",resourceCount:2,resourceType:"micro_lesson_card",students:a}]}function Gs(s,i="本堂课",n="高一(1)班"){const o=jr(s),a={TIER_A_ADVANCED:"A 梯队 (卓越拔高)",TIER_B_STANDARD:"B 梯队 (扎实巩固)",TIER_C_REINFORCE:"C 梯队 (定向强基)"},t=[];s.pollsAnswered>=3&&t.push({id:"active_buzzer",name:"抢答先锋",icon:"⚡",desc:`随堂主动互动抢答 ${s.pollsAnswered} 次,思维敏捷`}),(s.quizScore??0)>=90&&t.push({id:"accuracy_master",name:"神准解题官",icon:"🎯",desc:"随堂测验答题全对,高阶概念迁移达成"}),s.rating&&s.rating>=4&&t.push({id:"confidence_star",name:"自信领航者",icon:"⭐",desc:"结课通票自我评估满分,对本节主干理解胸有成竹"}),t.length===0&&t.push({id:"persistent_scholar",name:"笃学潜能星",icon:"🌱",desc:"全过程完整参与课堂互动,具备持续突破潜力"});let r="课堂表现沉稳,建议继续保持严谨求真的探究态度。",c="已完成当堂标准练习,今晚请鼓励孩子保持复习习惯。";o==="TIER_A_ADVANCED"?(r="知识掌握扎实全面,主动参与探究,具备出色的自学与迁移能力。",c="孩子今天课堂表现卓越,系统已为其匹配课后拔高拓展题,鼓励孩子勇于挑战!"):o==="TIER_C_REINFORCE"&&(r=`在个别难点推导(${s.puzzledConcept||"概念公式转换"})上略显困惑,已下发定向微课补强包。`,c="孩子课堂听讲认真,为帮助巩固重难点,老师已下发 3 分钟精要微课,请协助孩子抽空温习。");const x=`【${n}·课堂成长日报】
|
|
25
|
+
亲爱的 ${s.name} 家长:
|
|
26
|
+
您好!孩子在今天的《${i}》课程中:
|
|
27
|
+
· 随堂测验得分:${s.quizScore!==null?`${s.quizScore} 分`:"—"}
|
|
28
|
+
· 课堂互动答题:${s.pollsAnswered} 次
|
|
29
|
+
· 通票自评星级:${s.rating!==null?`${s.rating} 星`:"—"}
|
|
30
|
+
· 荣获荣誉勋章:${t.map(d=>`${d.icon} ${d.name}`).join("、")}
|
|
31
|
+
【教师评价】:${r}
|
|
32
|
+
【课后跟进】:${c}`;return{studentId:s.id,studentName:s.name,studentNumber:s.studentNumber,attendance:s.attendance,quizScore:s.quizScore,accuracy:s.accuracy,pollsAnswered:s.pollsAnswered,exitRating:s.rating,puzzledConcept:s.puzzledConcept,tier:o,tierLabel:a[o],badges:t,teacherNote:r,parentReportText:x}}function kn({initialTiers:s,lessonTitle:i,onDispatchHomework:n,onSelectStudent:o,addToast:a}){const[t,r]=l.useState(s),[c,x]=l.useState(!1),[d,m]=l.useState(!1),u=t.reduce((g,p)=>g+p.students.length,0),v=(g,p,j)=>{p!==j&&(r(k=>k.map(w=>w.tier===p?{...w,students:w.students.filter(f=>f.studentId!==g.studentId)}:w.tier===j?{...w,students:[...w.students,g]}:w)),x(!1))},N=()=>{m(!0),setTimeout(()=>{m(!1),x(!0),n&&n(t),a("✓ 差异化课后任务已成功派发",`已向全班 ${u} 名同学精准分流推送对应学习资源包。`,"success")},600)};return e.jsxs("div",{className:"bg-surface rounded-2xl border border-theme p-5 shadow-sm flex flex-col gap-4",children:[e.jsxs("div",{className:"flex flex-col sm:flex-row items-start sm:items-center justify-between gap-3 border-b border-theme pb-3",children:[e.jsxs("div",{className:"flex items-center gap-2.5",children:[e.jsx("div",{className:"w-8 h-8 rounded-xl bg-primary-theme/10 text-primary-theme flex items-center justify-center font-bold",children:e.jsx(pt,{size:18})}),e.jsxs("div",{children:[e.jsxs("h2",{className:"text-sm font-black text-main tracking-tight flex items-center gap-2",children:[e.jsx("span",{children:"差异化课后巩固派发中枢 (Differentiated Follow-up Hub)"}),e.jsx("span",{className:"text-[10px] px-2 py-0.5 rounded-full font-bold bg-primary-theme/10 text-primary-theme",children:"AI 自动分流"})]}),e.jsx("p",{className:"text-xs text-muted",children:"依据测验表现与 Exit Ticket 卡点自动聚类,支持微调并一键派发至学生端。"})]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[c&&e.jsxs("span",{className:"text-xs text-emerald-600 font-bold flex items-center gap-1 bg-emerald-500/10 px-2.5 py-1 rounded-xl border border-emerald-500/20",children:[e.jsx(je,{size:13}),e.jsx("span",{children:"已全员派发到位"})]}),e.jsxs("button",{type:"button",id:"btn-dispatch-differentiated-tasks",onClick:N,disabled:d||u===0,className:`px-4 py-2 rounded-xl text-xs font-black flex items-center gap-1.5 transition-all shadow-xs cursor-pointer ${c?"bg-emerald-600 text-white hover:bg-emerald-700":"bg-primary-theme text-white hover:bg-primary-theme-hover"} disabled:opacity-50`,children:[e.jsx(De,{size:13,className:d?"animate-spin":""}),e.jsx("span",{children:d?"派发中...":c?"重新派发任务包":`一键派发至全班 (${u}人)`})]})]})]}),e.jsx("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4",children:t.map(g=>{const p=g.tier==="TIER_A_ADVANCED",j=g.tier==="TIER_B_STANDARD",k=g.tier==="TIER_C_REINFORCE",w=p?"border-emerald-500/30 bg-emerald-500/5":j?"border-blue-500/30 bg-blue-500/5":"border-amber-500/30 bg-amber-500/5",f=p?"text-emerald-700 dark:text-emerald-400":j?"text-blue-700 dark:text-blue-400":"text-amber-700 dark:text-amber-400",b=p?"bg-emerald-500/15 text-emerald-700 dark:text-emerald-300":j?"bg-blue-500/15 text-blue-700 dark:text-blue-300":"bg-amber-500/15 text-amber-700 dark:text-amber-300";return e.jsxs("div",{className:`rounded-2xl border p-4 flex flex-col justify-between gap-3.5 transition-all ${w}`,children:[e.jsxs("div",{className:"flex flex-col gap-2.5",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-1.5",children:[p&&e.jsx(fe,{size:16,className:"text-emerald-600"}),j&&e.jsx(_e,{size:16,className:"text-blue-600"}),k&&e.jsx(ir,{size:16,className:"text-amber-600"}),e.jsx("span",{className:`text-xs font-black ${f}`,children:g.title})]}),e.jsxs("span",{className:`text-[11px] font-bold px-2 py-0.5 rounded-full ${b}`,children:[g.students.length," 人"]})]}),e.jsx("p",{className:"text-[11px] text-muted leading-tight",children:g.subtitle}),e.jsxs("div",{className:"p-2.5 rounded-xl bg-surface border border-theme/80 flex flex-col gap-1 shadow-2xs",children:[e.jsx("span",{className:"text-[11px] font-bold text-main line-clamp-1",children:g.packageTitle}),e.jsx("p",{className:"text-[10px] text-muted line-clamp-2 leading-relaxed",children:g.packageDescription})]})]}),e.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsxs("div",{className:"flex items-center justify-between text-[11px] font-bold text-muted",children:[e.jsxs("span",{children:["成员名单 (",g.students.length,")"]}),e.jsx("span",{className:"text-[10px]",children:"点击切换梯队"})]}),e.jsx("div",{className:"flex flex-wrap gap-1.5 max-h-36 overflow-y-auto p-1 bg-surface/50 rounded-xl border border-theme/50",children:g.students.length===0?e.jsx("span",{className:"text-[11px] text-muted/60 p-2 italic w-full text-center",children:"暂无归入此梯队的同学"}):g.students.map(z=>e.jsxs("div",{className:"group relative flex items-center gap-1 px-2 py-1 rounded-lg bg-surface border border-theme text-[11px] font-medium text-main hover:border-primary-theme transition-all shadow-2xs",children:[e.jsx("span",{className:"cursor-pointer hover:underline",onClick:()=>o&&o(z.studentId),title:"点击查看个人课节报告",children:z.studentName}),z.quizScore!==null&&e.jsxs("span",{className:"text-[9px] font-mono text-muted",children:["(",z.quizScore,"分)"]}),e.jsxs("div",{className:"opacity-0 group-hover:opacity-100 flex items-center gap-0.5 ml-1 transition-opacity",children:[!p&&e.jsx("button",{type:"button",title:"上调至 A 梯队",onClick:()=>v(z,g.tier,"TIER_A_ADVANCED"),className:"text-[9px] px-1 py-0.2 bg-emerald-500/20 text-emerald-600 rounded hover:bg-emerald-500/40",children:"↑A"}),!j&&e.jsx("button",{type:"button",title:"调整至 B 梯队",onClick:()=>v(z,g.tier,"TIER_B_STANDARD"),className:"text-[9px] px-1 py-0.2 bg-blue-500/20 text-blue-600 rounded hover:bg-blue-500/40",children:"B"}),!k&&e.jsx("button",{type:"button",title:"下调至 C 梯队",onClick:()=>v(z,g.tier,"TIER_C_REINFORCE"),className:"text-[9px] px-1 py-0.2 bg-amber-500/20 text-amber-600 rounded hover:bg-amber-500/40",children:"↓C"})]})]},z.studentId))})]})]},g.tier)})})]})}function zn({digest:s,onClose:i,addToast:n}){const[o,a]=l.useState(!1),[t,r]=l.useState(s?.parentReportText||"");if(!s)return null;const c=()=>{typeof navigator<"u"&&navigator.clipboard?.writeText?navigator.clipboard.writeText(t).then(()=>{a(!0),n("✓ 已复制到剪贴板","家长同步报告文案已复制,可直接发送微信群或家长私信。","success"),setTimeout(()=>a(!1),2e3)}).catch(()=>{a(!0),n("✓ 内容已就绪","请直接在文本框中全选复制。","info"),setTimeout(()=>a(!1),2e3)}):(a(!0),n("✓ 已复制到剪贴板","家长同步报告文案已复制。","success"),setTimeout(()=>a(!1),2e3))};return e.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center p-4 bg-black/60 backdrop-blur-xs animate-in fade-in duration-200",children:e.jsxs("div",{className:"bg-surface border border-theme rounded-2xl max-w-xl w-full p-6 shadow-2xl flex flex-col gap-4 max-h-[90vh] overflow-y-auto",children:[e.jsxs("div",{className:"flex items-start justify-between border-b border-theme pb-3",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"w-12 h-12 rounded-2xl bg-primary-theme/10 text-primary-theme flex items-center justify-center font-bold text-lg",children:s.studentName.slice(0,1)}),e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("h3",{className:"text-base font-black text-main",children:s.studentName}),e.jsxs("span",{className:"text-xs font-mono text-muted",children:["(",s.studentNumber,")"]}),e.jsx("span",{className:"text-[10px] px-2 py-0.5 rounded-full font-bold bg-primary-theme/10 text-primary-theme border border-primary-theme/20",children:s.tierLabel})]}),e.jsx("p",{className:"text-xs text-muted mt-0.5",children:"课堂全景表现个人报告与家校同步成长单"})]})]}),e.jsx("button",{type:"button",onClick:i,className:"p-1.5 rounded-xl hover:bg-surface-secondary text-muted hover:text-main transition-colors cursor-pointer",children:e.jsx(be,{size:18})})]}),e.jsxs("div",{className:"grid grid-cols-4 gap-2.5 text-center",children:[e.jsxs("div",{className:"p-3 rounded-xl bg-surface-secondary border border-theme flex flex-col",children:[e.jsx("span",{className:"text-[10px] text-muted font-bold",children:"随堂得分"}),e.jsx("span",{className:"text-lg font-black font-mono text-primary-theme mt-0.5",children:s.quizScore!==null?`${s.quizScore}分`:"—"})]}),e.jsxs("div",{className:"p-3 rounded-xl bg-surface-secondary border border-theme flex flex-col",children:[e.jsx("span",{className:"text-[10px] text-muted font-bold",children:"答题互动"}),e.jsxs("span",{className:"text-lg font-black font-mono text-amber-500 mt-0.5",children:[s.pollsAnswered," 次"]})]}),e.jsxs("div",{className:"p-3 rounded-xl bg-surface-secondary border border-theme flex flex-col",children:[e.jsx("span",{className:"text-[10px] text-muted font-bold",children:"通票自评"}),e.jsx("span",{className:"text-lg font-black font-mono text-indigo-500 mt-0.5",children:s.exitRating!==null?`${s.exitRating}★`:"—"})]}),e.jsxs("div",{className:"p-3 rounded-xl bg-surface-secondary border border-theme flex flex-col",children:[e.jsx("span",{className:"text-[10px] text-muted font-bold",children:"出勤状态"}),e.jsx("span",{className:"text-lg font-black text-emerald-600 mt-0.5",children:s.attendance})]})]}),e.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsxs("span",{className:"text-xs font-bold text-main flex items-center gap-1.5",children:[e.jsx(Re,{size:14,className:"text-amber-500"}),e.jsx("span",{children:"当堂获得成就勋章"})]}),e.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-2",children:s.badges.map(x=>e.jsxs("div",{className:"p-2.5 rounded-xl bg-amber-500/5 border border-amber-500/20 flex items-center gap-2.5",children:[e.jsx("span",{className:"text-2xl",children:x.icon}),e.jsxs("div",{className:"flex flex-col",children:[e.jsx("span",{className:"text-xs font-bold text-amber-700 dark:text-amber-400",children:x.name}),e.jsx("span",{className:"text-[10px] text-muted leading-tight",children:x.desc})]})]},x.id))})]}),e.jsxs("div",{className:"p-3 rounded-xl bg-primary-theme/5 border border-primary-theme/20 flex flex-col gap-1",children:[e.jsxs("span",{className:"text-xs font-bold text-primary-theme flex items-center gap-1",children:[e.jsx(hs,{size:13}),e.jsx("span",{children:"教师诊断与课堂评价"})]}),e.jsx("p",{className:"text-xs text-main leading-relaxed",children:s.teacherNote})]}),e.jsxs("div",{className:"flex flex-col gap-2 border-t border-theme pt-3",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("span",{className:"text-xs font-bold text-main flex items-center gap-1.5",children:[e.jsx(ms,{size:13,className:"text-indigo-500"}),e.jsx("span",{children:"家校互联·家长端同步文案"})]}),e.jsxs("button",{type:"button",id:"btn-copy-parent-digest",onClick:c,className:"px-3 py-1 bg-surface-secondary hover:bg-primary-theme hover:text-white border border-theme text-main rounded-xl text-xs font-bold flex items-center gap-1.5 transition-colors cursor-pointer",children:[o?e.jsx(Ve,{size:12,className:"text-emerald-500"}):e.jsx(ft,{size:12}),e.jsx("span",{children:o?"已复制":"一键复制文案"})]})]}),e.jsx("textarea",{value:t,onChange:x=>r(x.target.value),rows:5,className:"w-full bg-surface-secondary border border-theme rounded-xl p-3 text-xs text-main font-mono leading-relaxed outline-none focus:border-primary-theme resize-none"})]}),e.jsx("div",{className:"flex justify-end pt-2",children:e.jsx("button",{type:"button",onClick:i,className:"px-4 py-2 bg-surface hover:bg-surface-secondary border border-theme text-main rounded-xl text-xs font-bold transition-colors cursor-pointer",children:"关闭预览"})})]})})}function Sn({selectedLesson:s,lessonTitle:i,selectedClassId:n,className:o,students:a,lang:t,onReturnToTeaching:r,onReturnToPreClass:c,addToast:x}){const[d,m]=l.useState(!1),[u,v]=l.useState(""),[N,g]=l.useState(null),[p,j]=l.useState({TOO_FAST:1,CONFUSED:3,CLEAR:18}),[k,w]=l.useState(null);l.useEffect(()=>{s&&(m(!0),Promise.all([fetch(`/api/classroom/sessions/${s}/panoramic-report`).then(P=>P.ok?P.json():null).catch(()=>null),fetch(`/api/classroom/stage/${s}/data`).then(P=>P.ok?P.json():null).catch(()=>null)]).then(([P,y])=>{P&&g(P),y?.pacing&&j(y.pacing),m(!1)}))},[s]);const f=a.length||N?.students?.length||0,b=N?.metrics?.quizAccuracy??0,z=N?.metrics?.pollVotesTotal??0,_=N?.metrics?.exitTicketsAvgRating??0,C=N?.session?.durationMin??0,B=p.CLEAR+p.CONFUSED+p.TOO_FAST||1,R=Math.round(p.CLEAR/B*100),J=Math.round(p.CONFUSED/B*100),O=Math.max(0,100-R-J),H=l.useMemo(()=>{const P=Array.isArray(N?.students)?N.students:[];return(P.length>0?P:a.map(M=>({studentId:M.id,studentName:M.name,studentNumber:M.student_number,attendance:!1,quizScore:null,accuracy:null,pollsAnswered:0,exitRating:null,puzzledConcept:null}))).map(M=>{const $=typeof M.quizScore=="number"?M.quizScore:null,S=$===null?"无数据":$>=90?"优秀":$>=75?"良好":"需关注",E=$===null?"本节无可用的随堂测记录":$<75?"建议课后补充探究微练习":"课堂掌握扎实,互动积极";return{id:M.studentId,name:M.studentName,studentNumber:M.studentNumber||M.studentId,attendance:M.attendance?"出勤":"未互动",quizScore:$,accuracy:typeof M.accuracy=="number"?M.accuracy:null,pollsAnswered:Number(M.pollsAnswered)||0,rating:typeof M.exitRating=="number"?M.exitRating:null,puzzledConcept:M.puzzledConcept||"",status:S,note:E}})},[N,a]),ee=H.filter(P=>P.name.toLowerCase().includes(u.toLowerCase())||P.studentNumber.toLowerCase().includes(u.toLowerCase())),se=l.useMemo(()=>vn({durationMin:C,totalStudents:f,quizAccuracy:b,interactiveCount:z,pacingData:p,primaryPuzzledConcept:N?.metrics?.topPuzzledConcept||"核心公式与变式应用"}),[i,C,f,b,z,p,N]),I=l.useMemo(()=>wn(H,i||"本节课"),[H,i]),V=()=>{const P=["学生学号","学生姓名","考勤状态","随堂测验得分","互动投票参与数","通票掌握评价","学情评级","教师诊断建议"],y=ee.map(E=>[Be(E.studentNumber),Be(E.name),Be(E.attendance),Be(E.quizScore===null?"—":`${E.quizScore}分`),Be(`${E.pollsAnswered}次`),Be(E.rating===null?"—":`${E.rating}星`),Be(E.status),Be(E.note)]),M="data:text/csv;charset=utf-8,\uFEFF"+[P.join(","),...y.map(E=>E.join(","))].join(`
|
|
33
|
+
`),$=encodeURI(M),S=document.createElement("a");S.setAttribute("href",$),S.setAttribute("download",`${o||"Class"}_${i||"Lesson"}_学情简报.csv`),document.body.appendChild(S),S.click(),document.body.removeChild(S),x(t==="zh"?"✓ 学情简报已导出":"✓ Report Exported",t==="zh"?"CSV 简报报表已下载至本地。":"CSV report downloaded.","success")};return e.jsxs("div",{id:"classroom-briefing-view",className:"flex-1 flex flex-col min-h-0 bg-surface-secondary/20 p-4 gap-4 overflow-y-auto",children:[e.jsxs("div",{className:"bg-surface border border-theme rounded-2xl p-5 shadow-sm flex flex-col md:flex-row items-start md:items-center justify-between gap-4",children:[e.jsxs("div",{className:"flex items-center gap-3.5",children:[e.jsx("div",{className:"w-12 h-12 rounded-2xl bg-emerald-500/10 border border-emerald-500/20 text-emerald-600 dark:text-emerald-400 flex items-center justify-center shrink-0",children:e.jsx(or,{size:24})}),e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"px-2.5 py-0.5 rounded-full text-xs font-black bg-emerald-500/10 text-emerald-700 dark:text-emerald-300 border border-emerald-500/30 uppercase tracking-wider",children:t==="zh"?"阶段 4 / 4 · 课堂学情全景简报":"Stage 4/4 · Panoramic Classroom Briefing"}),e.jsxs("span",{className:"text-xs text-muted font-semibold",children:[o," · ",i]})]}),e.jsx("h1",{className:"text-lg font-black text-main tracking-tight mt-1 flex items-center gap-2",children:e.jsx("span",{children:t==="zh"?"多维学情数据分析、教学反思与学业总览":"Learning Analytics & Reflection"})}),e.jsx("p",{className:"text-xs text-muted mt-0.5",children:t==="zh"?`总教学时长: ${C} 分钟 · 全班 ${f} 人全员出勤 · 随堂测验准确率 ${b}%`:`Duration: ${C} mins · ${f} students · Quiz Accuracy: ${b}%`})]})]}),e.jsxs("div",{className:"flex items-center gap-2.5 flex-wrap w-full md:w-auto justify-end",children:[e.jsxs("button",{type:"button",onClick:r,className:"px-3 py-2 text-xs font-bold rounded-xl border border-theme bg-surface hover:bg-surface-secondary text-main transition-colors cursor-pointer flex items-center gap-1.5 shadow-2xs",children:[e.jsx(ut,{size:13}),e.jsx("span",{children:t==="zh"?"返回课中白板":"Back to Whiteboard"})]}),e.jsxs("button",{type:"button",onClick:c,className:"px-3 py-2 text-xs font-bold rounded-xl border border-theme bg-surface hover:bg-surface-secondary text-main transition-colors cursor-pointer flex items-center gap-1.5 shadow-2xs",children:[e.jsx(Le,{size:13}),e.jsx("span",{children:t==="zh"?"新课节准备 (课前)":"Next Lesson (Pre-Class)"})]}),e.jsxs("button",{id:"briefing-export-csv-btn",type:"button",onClick:V,className:"px-4 py-2 bg-primary-theme hover:bg-primary-theme-hover text-white rounded-xl text-xs font-bold flex items-center gap-1.5 shadow-xs cursor-pointer",children:[e.jsx(Ot,{size:13}),e.jsx("span",{children:t==="zh"?"导出学情简报 (CSV)":"Export CSV"})]})]})]}),e.jsxs("div",{className:"grid grid-cols-2 sm:grid-cols-3 lg:grid-cols-5 gap-3.5",children:[e.jsxs("div",{className:"bg-surface rounded-2xl border border-theme p-4 shadow-sm flex flex-col",children:[e.jsx("span",{className:"text-[11px] font-bold text-muted uppercase tracking-wider",children:t==="zh"?"全班出勤率":"Attendance"}),e.jsx("div",{className:"text-2xl font-black text-emerald-600 dark:text-emerald-400 font-mono mt-1",children:"100%"}),e.jsxs("span",{className:"text-[10px] text-muted mt-1",children:[f," / ",f," 人到课"]})]}),e.jsxs("div",{className:"bg-surface rounded-2xl border border-theme p-4 shadow-sm flex flex-col",children:[e.jsx("span",{className:"text-[11px] font-bold text-muted uppercase tracking-wider",children:t==="zh"?"随堂测验正确率":"Quiz Accuracy"}),e.jsxs("div",{className:"text-2xl font-black text-primary-theme font-mono mt-1",children:[b,"%"]}),e.jsx("span",{className:"text-[10px] text-muted mt-1",children:t==="zh"?"交互题作答均分":"Interactive Avg"})]}),e.jsxs("div",{className:"bg-surface rounded-2xl border border-theme p-4 shadow-sm flex flex-col",children:[e.jsx("span",{className:"text-[11px] font-bold text-muted uppercase tracking-wider",children:t==="zh"?"口播投票与抢答":"Interactions"}),e.jsxs("div",{className:"text-2xl font-black text-amber-500 font-mono mt-1",children:[z," ",e.jsx("span",{className:"text-xs font-normal",children:"人次"})]}),e.jsx("span",{className:"text-[10px] text-muted mt-1",children:t==="zh"?"高参与度活跃":"High engagement"})]}),e.jsxs("div",{className:"bg-surface rounded-2xl border border-theme p-4 shadow-sm flex flex-col",children:[e.jsx("span",{className:"text-[11px] font-bold text-muted uppercase tracking-wider",children:t==="zh"?"结课通票评分":"Exit Rating"}),e.jsxs("div",{className:"text-2xl font-black text-indigo-500 font-mono mt-1",children:[_," ★"]}),e.jsx("span",{className:"text-[10px] text-muted mt-1",children:t==="zh"?"掌握度 5.0 满分制":"Out of 5.0"})]}),e.jsxs("div",{className:"bg-surface rounded-2xl border border-theme p-4 shadow-sm flex flex-col",children:[e.jsx("span",{className:"text-[11px] font-bold text-muted uppercase tracking-wider",children:t==="zh"?"教学节奏晴雨表":"Pacing Score"}),e.jsxs("div",{className:"text-2xl font-black text-teal-600 dark:text-teal-400 font-mono mt-1",children:[R,"%"]}),e.jsx("span",{className:"text-[10px] text-muted mt-1",children:t==="zh"?"反馈节奏适宜":"Clear & Optimal"})]})]}),e.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-12 gap-4",children:[e.jsxs("div",{className:"lg:col-span-5 flex flex-col gap-4",children:[e.jsxs("div",{className:"bg-surface rounded-2xl border border-theme p-4 shadow-sm flex flex-col gap-3",children:[e.jsxs("div",{className:"flex items-center justify-between border-b border-theme pb-2",children:[e.jsxs("span",{className:"text-xs font-black uppercase text-main tracking-wider flex items-center gap-1.5",children:[e.jsx(_e,{size:14,className:"text-primary-theme"}),e.jsx("span",{children:t==="zh"?"随堂节奏晴雨表分布":"Classroom Pacing Distribution"})]}),e.jsxs("span",{className:"text-[11px] text-muted",children:[B," 次反馈"]})]}),e.jsxs("div",{className:"flex flex-col gap-2.5",children:[e.jsxs("div",{children:[e.jsxs("div",{className:"flex justify-between text-xs font-semibold mb-1",children:[e.jsx("span",{className:"text-emerald-600 dark:text-emerald-400 flex items-center gap-1",children:"💡 听懂了 / 节奏适宜"}),e.jsxs("span",{className:"font-mono",children:[p.CLEAR," 人 (",R,"%)"]})]}),e.jsx("div",{className:"w-full bg-surface-secondary h-2 rounded-full overflow-hidden",children:e.jsx("div",{className:"bg-emerald-500 h-full",style:{width:`${R}%`}})})]}),e.jsxs("div",{children:[e.jsxs("div",{className:"flex justify-between text-xs font-semibold mb-1",children:[e.jsx("span",{className:"text-amber-600 dark:text-amber-400 flex items-center gap-1",children:"❓ 有些困惑 / 需要细讲"}),e.jsxs("span",{className:"font-mono",children:[p.CONFUSED," 人 (",J,"%)"]})]}),e.jsx("div",{className:"w-full bg-surface-secondary h-2 rounded-full overflow-hidden",children:e.jsx("div",{className:"bg-amber-500 h-full",style:{width:`${J}%`}})})]}),e.jsxs("div",{children:[e.jsxs("div",{className:"flex justify-between text-xs font-semibold mb-1",children:[e.jsx("span",{className:"text-rose-600 dark:text-rose-400 flex items-center gap-1",children:"🐇 讲太快了 / 跟不上"}),e.jsxs("span",{className:"font-mono",children:[p.TOO_FAST," 人 (",O,"%)"]})]}),e.jsx("div",{className:"w-full bg-surface-secondary h-2 rounded-full overflow-hidden",children:e.jsx("div",{className:"bg-rose-500 h-full",style:{width:`${O}%`}})})]})]})]}),e.jsxs("div",{className:"bg-surface rounded-2xl border border-theme p-4 shadow-sm flex flex-col gap-3",children:[e.jsxs("div",{className:"flex items-center justify-between border-b border-theme pb-2",children:[e.jsxs("span",{className:"text-xs font-black uppercase text-main tracking-wider flex items-center gap-1.5",children:[e.jsx(fe,{size:14,className:"text-amber-500"}),e.jsx("span",{children:t==="zh"?"极速投票作答选项分布":"Quick Poll Option Breakdown"})]}),e.jsx("span",{className:"text-[11px] text-emerald-600 font-bold",children:"正确率 92%"})]}),e.jsxs("div",{className:"grid grid-cols-4 gap-2 text-center text-xs",children:[e.jsxs("div",{className:"p-2.5 rounded-xl bg-emerald-500/10 border border-emerald-500/30 flex flex-col",children:[e.jsx("span",{className:"font-bold text-emerald-700 dark:text-emerald-300",children:"选项 A (正确)"}),e.jsx("span",{className:"text-xl font-black font-mono mt-1 text-emerald-600",children:"76%"}),e.jsx("span",{className:"text-[10px] text-muted",children:"19 人"})]}),e.jsxs("div",{className:"p-2.5 rounded-xl bg-surface-secondary border border-theme/60 flex flex-col",children:[e.jsx("span",{className:"font-bold text-muted",children:"选项 B"}),e.jsx("span",{className:"text-xl font-black font-mono mt-1 text-main",children:"12%"}),e.jsx("span",{className:"text-[10px] text-muted",children:"3 人"})]}),e.jsxs("div",{className:"p-2.5 rounded-xl bg-surface-secondary border border-theme/60 flex flex-col",children:[e.jsx("span",{className:"font-bold text-muted",children:"选项 C"}),e.jsx("span",{className:"text-xl font-black font-mono mt-1 text-main",children:"8%"}),e.jsx("span",{className:"text-[10px] text-muted",children:"2 人"})]}),e.jsxs("div",{className:"p-2.5 rounded-xl bg-surface-secondary border border-theme/60 flex flex-col",children:[e.jsx("span",{className:"font-bold text-muted",children:"选项 D"}),e.jsx("span",{className:"text-xl font-black font-mono mt-1 text-main",children:"4%"}),e.jsx("span",{className:"text-[10px] text-muted",children:"1 人"})]})]})]})]}),e.jsxs("div",{className:"lg:col-span-7 bg-surface rounded-2xl border border-theme p-5 shadow-sm flex flex-col gap-4",children:[e.jsxs("div",{className:"flex flex-wrap items-center justify-between border-b border-theme pb-3 gap-2",children:[e.jsxs("span",{className:"text-xs font-black uppercase text-main tracking-wider flex items-center gap-1.5",children:[e.jsx(mt,{size:14,className:"text-indigo-500"}),e.jsx("span",{children:t==="zh"?"AI 教学副驾反思建议 (Teaching Co-Pilot)":"AI Teaching Reflection & Insights"})]}),e.jsxs("div",{className:"flex items-center gap-1.5 flex-wrap",children:[e.jsxs("span",{className:`text-[11px] px-2 py-0.5 rounded-full font-bold ${se.lectureRatio>se.recommendedLectureMaxRatio?"bg-rose-500/10 text-rose-600 border border-rose-500/20":"bg-emerald-500/10 text-emerald-600 border border-emerald-500/20"}`,children:["讲授用时 ",se.lectureRatio,"%"]}),e.jsxs("span",{className:"text-[11px] px-2 py-0.5 bg-primary-theme/10 text-primary-theme rounded-full font-bold border border-primary-theme/20",children:["互动覆盖率 ",se.interactionCoverage,"%"]})]})]}),e.jsxs("div",{className:"flex flex-col gap-3 text-xs leading-relaxed max-h-[460px] overflow-y-auto pr-1",children:[se.strengths.map((P,y)=>e.jsxs("div",{className:"p-3.5 rounded-xl bg-emerald-500/5 border border-emerald-500/20 flex flex-col gap-1",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("span",{className:"font-bold text-emerald-700 dark:text-emerald-300 flex items-center gap-1",children:[e.jsx(je,{size:13}),e.jsx("span",{children:P.title})]}),P.metricTag&&e.jsx("span",{className:"text-[10px] font-bold px-1.5 py-0.2 bg-emerald-500/15 text-emerald-700 dark:text-emerald-300 rounded",children:P.metricTag})]}),e.jsx("p",{className:"text-muted",children:P.description})]},y)),se.bottlenecks.map((P,y)=>e.jsxs("div",{className:"p-3.5 rounded-xl bg-amber-500/5 border border-amber-500/20 flex flex-col gap-1.5",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("span",{className:"font-bold text-amber-700 dark:text-amber-300 flex items-center gap-1",children:[e.jsx(Se,{size:13}),e.jsx("span",{children:P.title})]}),P.metricTag&&e.jsx("span",{className:"text-[10px] font-bold px-1.5 py-0.2 bg-amber-500/15 text-amber-700 dark:text-amber-300 rounded",children:P.metricTag})]}),e.jsx("p",{className:"text-muted",children:P.description}),e.jsxs("div",{className:"text-[11px] text-amber-800 dark:text-amber-300/80 bg-amber-500/10 p-2 rounded-lg font-mono",children:["💡 量化归因: ",P.attribution]})]},y)),se.actionableSuggestions.map((P,y)=>e.jsxs("div",{className:"p-3.5 rounded-xl bg-indigo-500/5 border border-indigo-500/20 flex flex-col gap-1",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("span",{className:"font-bold text-indigo-700 dark:text-indigo-300 flex items-center gap-1",children:[e.jsx(mt,{size:13}),e.jsx("span",{children:P.title})]}),e.jsx("span",{className:"text-[10px] font-bold px-1.5 py-0.2 bg-indigo-500/15 text-indigo-700 dark:text-indigo-300 rounded",children:P.timing==="next_pre_class"?"下节课前预热":P.timing==="next_in_class"?"课中环节调整":"课后分流巩固"})]}),e.jsx("p",{className:"text-muted",children:P.suggestion})]},y))]})]})]}),e.jsx(kn,{initialTiers:I,lessonTitle:i,onSelectStudent:P=>{const y=H.find(M=>M.id===P);y&&w(Gs(y,i,o))},addToast:x}),e.jsxs("div",{className:"bg-surface rounded-2xl border border-theme p-4 shadow-sm flex flex-col gap-3",children:[e.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3 border-b border-theme pb-3",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-xs font-black text-main uppercase tracking-wider",children:t==="zh"?"全班学生个体学习表现总览表":"Student Performance Roster"}),e.jsxs("span",{className:"text-xs px-2 py-0.5 rounded-full bg-primary-theme/10 text-primary-theme font-bold border border-primary-theme/20",children:[ee.length," ",t==="zh"?"人":"students"]})]}),e.jsxs("div",{className:"relative",children:[e.jsx("input",{type:"text",placeholder:t==="zh"?"搜索学生姓名或学号...":"Search student...",value:u,onChange:P=>v(P.target.value),className:"bg-surface-secondary border border-theme rounded-xl text-xs pl-8 pr-3 py-1.5 text-main outline-none w-52"}),e.jsx(bt,{size:12,className:"absolute left-2.5 top-2.5 text-muted"})]})]}),e.jsx("div",{className:"overflow-x-auto",children:e.jsxs("table",{className:"w-full border-collapse text-left text-xs text-main",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"bg-surface-secondary border-b border-theme font-bold text-muted select-none",children:[e.jsx("th",{className:"p-3",children:t==="zh"?"学号":"ID"}),e.jsx("th",{className:"p-3",children:t==="zh"?"学生姓名":"Student Name"}),e.jsx("th",{className:"p-3",children:t==="zh"?"考勤":"Attendance"}),e.jsx("th",{className:"p-3 text-center",children:t==="zh"?"随堂得分":"Quiz Score"}),e.jsx("th",{className:"p-3 text-center",children:t==="zh"?"互动次数":"Interactions"}),e.jsx("th",{className:"p-3 text-center",children:t==="zh"?"掌握度评分":"Rating"}),e.jsx("th",{className:"p-3",children:t==="zh"?"学情评定":"Rating Tier"}),e.jsx("th",{className:"p-3",children:t==="zh"?"个性化建议":"Recommendation"}),e.jsx("th",{className:"p-3 text-center",children:t==="zh"?"个人报告":"Digest"})]})}),e.jsx("tbody",{className:"divide-y divide-border/60",children:ee.map(P=>e.jsxs("tr",{className:"hover:bg-surface-secondary/40 transition-colors",children:[e.jsx("td",{className:"p-3 font-mono text-muted",children:P.studentNumber}),e.jsx("td",{className:"p-3 font-bold text-main",children:P.name}),e.jsx("td",{className:"p-3",children:e.jsx("span",{className:"px-2 py-0.5 rounded-full text-[11px] font-bold bg-emerald-500/10 text-emerald-600 border border-emerald-500/30",children:P.attendance})}),e.jsx("td",{className:"p-3 text-center font-mono font-bold text-main",children:P.quizScore===null?"—":`${P.quizScore} 分`}),e.jsxs("td",{className:"p-3 text-center font-mono",children:[P.pollsAnswered," 次"]}),e.jsx("td",{className:"p-3 text-center font-bold text-amber-500",children:P.rating===null?"—":`${P.rating} ★`}),e.jsx("td",{className:"p-3",children:e.jsx("span",{className:`px-2 py-0.5 rounded-lg text-[11px] font-bold ${P.status==="优秀"?"bg-purple-500/10 text-purple-600 border border-purple-500/30":P.status==="良好"?"bg-blue-500/10 text-blue-600 border border-blue-500/30":"bg-amber-500/10 text-amber-600 border border-amber-500/30"}`,children:P.status})}),e.jsx("td",{className:"p-3 text-muted text-[11px] truncate max-w-xs",children:P.note}),e.jsx("td",{className:"p-3 text-center",children:e.jsxs("button",{type:"button",onClick:()=>w(Gs(P,i,o)),className:"px-2.5 py-1 text-[11px] font-bold rounded-lg border border-theme bg-surface hover:bg-primary-theme hover:text-white transition-colors cursor-pointer inline-flex items-center gap-1 shadow-2xs",children:[e.jsx(tt,{size:11}),e.jsx("span",{children:t==="zh"?"查看":"View"})]})})]},P.id))})]})})]}),e.jsx(zn,{digest:k,onClose:()=>w(null),addToast:x})]})}const Cn=80,$n=50,An=new Set(["success","answer","checkin","achievement"]),En=6;function Tn(s,i,n,o,a){const t=new Map;for(const d of i){if(!d?.student_id)continue;const m=typeof d.progress_percent=="number"?d.progress_percent:0;t.set(d.student_id,Math.max(t.get(d.student_id)??0,m))}const r=new Map;for(const d of o){if(!d?.studentId||d.studentId==="teacher"||d.studentId==="guest")continue;const m=r.get(d.studentId)??{},u=typeof d.score=="number"?d.score:void 0,v=typeof d.completion=="number"?d.completion:void 0;r.set(d.studentId,{score:u===void 0?m.score:Math.max(m.score??-1/0,u),completion:v===void 0?m.completion:Math.max(m.completion??-1/0,v)})}const c=new Set(n),x=new Set(a.map(d=>d.studentId).filter(Boolean));return s.map(d=>{const m=Math.round(t.get(d.id)??0),u=c.has(d.id),{score:v,completion:N}=r.get(d.id)??{},g=[];return u?g.push("在线"):g.push("未接入"),m>=Cn?g.push(`进度领先 ${m}%`):m>=$n?g.push(`进度 ${m}%`):m>0?g.push(`进度滞后 ${m}%`):g.push("暂无进度"),v!==void 0&&g.push(`课件 ${v} 分`),N!==void 0&&N>=1&&g.push("课件已完成"),x.has(d.id)&&g.push("发生异常"),{studentId:d.id,studentName:d.name??d.student_number??d.id,studentNumber:d.student_number,online:u,progressPercent:m,participationScore:m,quizScore:v,completion:N,behaviorTags:g,hasError:x.has(d.id)}})}function Pn(s){return s.filter(i=>i?.type&&An.has(i.type)&&typeof i.message=="string"&&i.message.trim()).map(i=>`${i.time?`[${i.time}] `:""}${i.message.trim()}`).slice(0,En)}function Rn(s,i,n){if(s.length===0)return[];const o=s.map(t=>({name:t.title?.trim()||"未命名环节",minutes:Math.max(0,Math.round((Number(t.duration)||0)/60))}));let a=Math.max(0,i);return o.map(t=>{const r=Math.min(t.minutes,a);return a=Math.max(0,a-r),{stageName:t.name,plannedMin:t.minutes,actualMin:Math.round(r)}})}function _n(s,i){if(!s||!Number.isFinite(s))return 0;const n=i-s;return n<=0?0:Math.floor(n/6e4)}function Mn(s){const{students:i,liveClassStudentProgress:n,onlineStudentIds:o,liveClassFeed:a,timelineSegments:t,attempts:r,sessionStartedAt:c,classroomStage:x,studentErrors:d,now:m}=s;return l.useMemo(()=>{const u=n??[],v=o??[],N=a??[],g=t??[],p=r??[],j=d??[],k=m??Date.now(),w=_n(c,k),f=Tn(i,u,v,p,j),b={};for(const _ of f)b[_.studentId]=_;const z=f.filter(_=>_.online&&(_.completion!==void 0||(_.progressPercent??0)>=100)).length;return{studentMetrics:f,metricsById:b,highlights:Pn(N),stages:Rn(g,w),elapsedMin:w,plannedTotalMin:g.reduce((_,C)=>_+Math.max(0,Math.round((Number(C.duration)||0)/60)),0),onlineCount:f.filter(_=>_.online).length,submittedCount:z,hasRealData:u.length>0||v.length>0||N.length>0||g.length>0||p.length>0}},[i,n,o,a,t,r,c,x,d,m])}const In=({isOpen:s,onClose:i,snapshot:n,addToast:o,lang:a="zh"})=>{const[t,r]=l.useState(null),[c,x]=l.useState(!1),[d,m]=l.useState("class"),[u,v]=l.useState(null),[N,g]=l.useState(!1),p=l.useMemo(()=>({lessonTitle:n.lessonTitle,className:n.className,startTimeMs:n.startTimeMs,endTimeMs:n.endTimeMs,totalStudents:n.totalStudents,onlineCount:n.onlineStudentIds.length,highlights:n.highlights,stages:n.stages,studentReports:n.students.map(b=>({studentId:b.id,studentName:b.name,online:n.onlineStudentIds.includes(b.id),participationScore:b.participationScore,quizScore:b.quizScore,behaviorTags:b.behaviorTags,note:b.note}))}),[n]),j=l.useCallback(async()=>{if(n.lessonId){x(!0);try{const b=await fetch(`/api/classroom/${n.lessonId}/parent-notification`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(p)});if(!b.ok){const _=await b.text();throw new Error(`HTTP ${b.status}: ${_.slice(0,200)}`)}const z=await b.json();r(z),o(a==="zh"?"✅ 通知生成成功":"✅ Notifications generated",`${z.counts.students} ${a==="zh"?"位学生":"students"}`,"success")}catch(b){o(a==="zh"?"❌ 生成失败":"❌ Generation failed",b?.message??"Unknown error","error")}finally{x(!1)}}},[n.lessonId,p,o,a]);l.useEffect(()=>{s&&!t&&!c&&j()},[s,t,c,j]),l.useEffect(()=>{s||(r(null),v(null),g(!1))},[s]);const k=d==="class"?t?.classMarkdown??"":t?.studentNotifications.find(b=>b.studentId===u)?.markdown??"",w=l.useCallback(async()=>{try{await navigator.clipboard.writeText(k),g(!0),o(a==="zh"?"已复制到剪贴板":"Copied to clipboard",a==="zh"?"可粘贴到微信/邮件":"Paste anywhere","success"),setTimeout(()=>g(!1),2e3)}catch{o(a==="zh"?"复制失败":"Copy failed","","error")}},[k,o,a]),f=l.useCallback(()=>{if(!t)return;const b=new Blob([t.classMarkdown,`
|
|
34
|
+
|
|
35
|
+
---
|
|
36
|
+
|
|
37
|
+
`,t.studentNotifications.map(C=>`## ${C.studentName}
|
|
38
|
+
|
|
39
|
+
${C.markdown}`).join(`
|
|
40
|
+
|
|
41
|
+
---
|
|
42
|
+
|
|
43
|
+
`)],{type:"text/markdown;charset=utf-8"}),z=URL.createObjectURL(b),_=document.createElement("a");_.href=z,_.download=`parent-notification-${n.lessonTitle}-${new Date().toISOString().slice(0,10)}.md`,_.click(),URL.revokeObjectURL(z)},[t,n.lessonTitle]);return s?e.jsx("div",{className:"fixed inset-0 z-[120] bg-black/40 backdrop-blur-sm flex items-center justify-center p-4 animate-fade-in",children:e.jsxs("div",{className:"bg-surface border border-theme rounded-2xl shadow-2xl w-full max-w-5xl max-h-[90vh] flex flex-col overflow-hidden",children:[e.jsxs("div",{className:"bg-surface-secondary px-6 py-4 border-b border-theme flex items-center justify-between shrink-0",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"w-10 h-10 rounded-xl bg-primary-theme/10 flex items-center justify-center",children:e.jsx(tt,{size:20,className:"text-primary-theme"})}),e.jsxs("div",{children:[e.jsx("h2",{className:"text-base font-extrabold text-main",children:a==="zh"?"家校通知生成器":"Parent Notification Generator"}),e.jsxs("p",{className:"text-xs text-muted mt-0.5",children:[n.lessonTitle," · ",n.className," ·"," ",e.jsxs("span",{className:"inline-flex items-center gap-1",children:[e.jsx(ke,{size:10}),n.totalStudents]})]})]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("button",{onClick:j,disabled:c,className:"px-3 py-1.5 text-xs font-bold rounded-lg border border-theme text-main hover:bg-surface transition-colors flex items-center gap-1.5 disabled:opacity-50",children:[e.jsx($e,{size:12,className:c?"animate-spin":""}),a==="zh"?"重新生成":"Regenerate"]}),e.jsx("button",{onClick:i,className:"p-1.5 rounded-lg hover:bg-surface text-muted hover:text-main transition-colors","aria-label":"Close",children:e.jsx(be,{size:18})})]})]}),e.jsxs("div",{className:"px-6 pt-4 flex items-center gap-1 border-b border-theme shrink-0",children:[e.jsx(Ws,{active:d==="class",onClick:()=>m("class"),icon:e.jsx(fe,{size:12}),label:a==="zh"?"全班简报":"Class Summary",count:1}),e.jsx(Ws,{active:d==="students",onClick:()=>m("students"),icon:e.jsx(ke,{size:12}),label:a==="zh"?"逐生通知":"Per-Student",count:t?.studentNotifications.length??0}),e.jsx(oe,{slot:"classroom.notification.tabs"})]}),e.jsxs("div",{className:"flex-1 min-h-0 flex",children:[d==="students"&&t&&e.jsx("div",{className:"w-64 shrink-0 border-r border-theme bg-surface-secondary overflow-y-auto scrollbar-thin",children:e.jsx("div",{className:"p-3 space-y-1",children:t.studentNotifications.map(b=>e.jsxs("button",{onClick:()=>v(b.studentId),className:`w-full text-left px-3 py-2 rounded-lg text-xs transition-colors ${u===b.studentId?"bg-primary-theme text-white shadow-sm":"hover:bg-surface text-main"}`,children:[e.jsx("div",{className:"font-bold truncate",children:b.studentName}),e.jsx("div",{className:"text-[10px] opacity-70 truncate",children:b.studentId})]},b.studentId))})}),e.jsx("div",{className:"flex-1 min-w-0 flex flex-col bg-surface",children:c&&!t?e.jsxs("div",{className:"flex-1 flex flex-col items-center justify-center gap-3 text-muted",children:[e.jsx(fe,{size:32,className:"animate-pulse text-primary-theme"}),e.jsx("p",{className:"text-sm font-bold",children:a==="zh"?"AI 正在生成家校通知…":"AI is generating notifications…"}),e.jsx("p",{className:"text-xs",children:a==="zh"?"通常需要 5-15 秒":"Usually takes 5-15s"})]}):d==="students"&&!u?e.jsxs("div",{className:"flex-1 flex flex-col items-center justify-center gap-2 text-muted p-8",children:[e.jsx(ke,{size:32,className:"opacity-30"}),e.jsx("p",{className:"text-sm",children:a==="zh"?"从左侧选择一位学生查看通知":"Select a student from the left"})]}):e.jsx("pre",{className:"flex-1 min-h-0 overflow-auto scrollbar-thin p-6 text-sm font-mono whitespace-pre-wrap text-main leading-relaxed",children:k||(a==="zh"?"无内容":"No content")})})]}),e.jsxs("div",{className:"bg-surface-secondary px-6 py-3 border-t border-theme flex items-center justify-between gap-3 shrink-0",children:[e.jsxs("div",{className:"text-xs text-muted flex items-center gap-2",children:[t&&e.jsxs(e.Fragment,{children:[e.jsxs("span",{children:[a==="zh"?"生成时间":"Generated",":"," ",new Date(t.generatedAt).toLocaleTimeString()]}),t.counts.highlights>0&&e.jsxs("span",{className:"inline-flex items-center gap-1 text-emerald-600",children:[e.jsx(Ve,{size:10}),t.counts.highlights," highlights"]})]}),t===null&&!c&&e.jsxs("span",{className:"inline-flex items-center gap-1 text-warning",children:[e.jsx(Se,{size:12}),a==="zh"?"尚未生成":"Not generated"]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("button",{onClick:f,disabled:!t,className:"px-3 py-1.5 text-xs font-bold rounded-lg border border-theme text-main hover:bg-surface transition-colors flex items-center gap-1.5 disabled:opacity-50",children:[e.jsx(Ot,{size:12}),a==="zh"?"导出 Markdown":"Export MD"]}),e.jsxs("button",{onClick:w,disabled:!k,className:`px-3 py-1.5 text-xs font-bold rounded-lg transition-colors flex items-center gap-1.5 ${N?"bg-emerald-600 text-white":"bg-primary-theme text-white hover:bg-primary-theme-hover disabled:opacity-50"}`,children:[N?e.jsx(Ve,{size:12}):e.jsx(ft,{size:12}),N?a==="zh"?"已复制":"Copied":a==="zh"?"复制到剪贴板":"Copy"]})]})]})]})}):null},Ws=({active:s,onClick:i,icon:n,label:o,count:a})=>e.jsxs("button",{onClick:i,className:`px-4 py-2 text-xs font-bold rounded-t-lg transition-colors flex items-center gap-1.5 ${s?"bg-surface text-main border-b-2 border-primary-theme":"text-muted hover:text-main"}`,children:[n,o,a>0&&e.jsx("span",{className:`ml-1 px-1.5 py-0.5 rounded-full text-[10px] ${s?"bg-primary-theme/15 text-primary-theme":"bg-surface text-muted"}`,children:a})]}),Dn=[{key:"algorithmic",label:"算法逻辑",color:"bg-indigo-500"},{key:"engineering",label:"代码工程",color:"bg-cyan-500"},{key:"creativity",label:"创新思维",color:"bg-purple-500"},{key:"collaboration",label:"团队协作",color:"bg-pink-500"},{key:"focus",label:"课堂专注",color:"bg-amber-500"}],On=({isOpen:s,onClose:i,lessonId:n,lessonTitle:o,currentStageName:a,elapsedMin:t,plannedTotalMin:r,studentSnapshots:c,addToast:x,lang:d="zh"})=>{const[m,u]=l.useState(null),[v,N]=l.useState(!1),[g,p]=l.useState("risk"),j=l.useCallback(async()=>{if(!(!n||c.length===0)){N(!0);try{const b=await fetch(`/api/classroom/${n}/predict-mastery`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({lessonTitle:o,currentStageName:a,elapsedMin:t,plannedTotalMin:r,studentSnapshots:c})});if(!b.ok){const _=await b.text();throw new Error(`HTTP ${b.status}: ${_.slice(0,200)}`)}const z=await b.json();u(z)}catch(b){x(d==="zh"?"❌ 预测失败":"❌ Prediction failed",b?.message??"Unknown error","error")}finally{N(!1)}}},[n,o,a,t,r,c,x,d]);if(l.useEffect(()=>{s&&!m&&!v&&j(),s||u(null)},[s,m,v,j]),!s)return null;const k=Math.min(100,Math.round(t/Math.max(1,r)*100)),w=m?[...m.predictions].sort((b,z)=>{if(g==="risk"){const B=R=>R==="high"?0:R==="medium"?1:2;return B(b.risk)-B(z.risk)}if(g==="name")return b.studentName.localeCompare(z.studentName);const _=Object.values(b.prediction).reduce((B,R)=>B+R,0)/5,C=Object.values(z.prediction).reduce((B,R)=>B+R,0)/5;return _-C}):[],f=m?.predictions.reduce((b,z)=>(b[z.risk]=(b[z.risk]??0)+1,b),{})??{};return e.jsx("div",{className:"fixed inset-0 z-[110] bg-black/40 backdrop-blur-sm flex items-center justify-center p-4 animate-fade-in",children:e.jsxs("div",{className:"bg-surface border border-theme rounded-2xl shadow-2xl w-full max-w-6xl max-h-[90vh] flex flex-col overflow-hidden",children:[e.jsxs("div",{className:"bg-surface-secondary px-6 py-4 border-b border-theme flex items-center justify-between shrink-0",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"w-10 h-10 rounded-xl bg-primary-theme/10 flex items-center justify-center",children:e.jsx(ba,{size:20,className:"text-primary-theme"})}),e.jsxs("div",{children:[e.jsx("h2",{className:"text-base font-extrabold text-main",children:d==="zh"?"AI 实时学情预测":"AI Mastery Prediction"}),e.jsxs("p",{className:"text-xs text-muted mt-0.5",children:[o," · ",a," · ",t,"/",r," min (",k,"%)"]})]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("button",{onClick:j,disabled:v,className:"px-3 py-1.5 text-xs font-bold rounded-lg border border-theme text-main hover:bg-surface transition-colors flex items-center gap-1.5 disabled:opacity-50",children:[e.jsx($e,{size:12,className:v?"animate-spin":""}),d==="zh"?"重新预测":"Re-predict"]}),e.jsx("button",{onClick:i,className:"p-1.5 rounded-lg hover:bg-surface text-muted hover:text-main transition-colors","aria-label":"Close",children:e.jsx(be,{size:18})})]})]}),e.jsxs("div",{className:"px-6 py-3 border-b border-theme bg-surface shrink-0",children:[e.jsxs("div",{className:"flex items-center gap-3 mb-2",children:[e.jsx("span",{className:"text-xs font-bold text-muted",children:d==="zh"?"课堂进度":"Progress"}),e.jsx("div",{className:"flex-1 h-2 rounded-full bg-surface-secondary overflow-hidden",children:e.jsx("div",{className:"h-full bg-primary-theme transition-all",style:{width:`${k}%`}})}),e.jsxs("span",{className:"text-xs font-bold text-main",children:[k,"%"]})]}),m&&e.jsxs("div",{className:"flex items-center gap-3 text-xs",children:[e.jsx(es,{level:"high",count:f.high??0,lang:d}),e.jsx(es,{level:"medium",count:f.medium??0,lang:d}),e.jsx(es,{level:"low",count:f.low??0,lang:d}),e.jsx("span",{className:"ml-auto text-muted",children:m.aiSucceeded?e.jsxs("span",{className:"inline-flex items-center gap-1 text-emerald-600",children:[e.jsx(fe,{size:10})," AI"]}):e.jsxs("span",{className:"inline-flex items-center gap-1 text-muted",children:[e.jsx(mr,{size:10})," ",d==="zh"?"降级模式":"Fallback"]})})]})]}),e.jsxs("div",{className:"px-6 pt-3 flex items-center gap-2 text-xs shrink-0",children:[e.jsxs("span",{className:"text-muted",children:[d==="zh"?"排序":"Sort",":"]}),e.jsx("button",{onClick:()=>p("risk"),className:`px-2.5 py-1 rounded font-bold ${g==="risk"?"bg-primary-theme text-white":"bg-surface-secondary text-main"}`,children:d==="zh"?"风险优先":"Risk"}),e.jsx("button",{onClick:()=>p("composite"),className:`px-2.5 py-1 rounded font-bold ${g==="composite"?"bg-primary-theme text-white":"bg-surface-secondary text-main"}`,children:d==="zh"?"综合掌握":"Composite"}),e.jsx("button",{onClick:()=>p("name"),className:`px-2.5 py-1 rounded font-bold ${g==="name"?"bg-primary-theme text-white":"bg-surface-secondary text-main"}`,children:d==="zh"?"姓名":"Name"}),e.jsx(oe,{slot:"classroom.pacing.dashboard"})]}),e.jsx("div",{className:"flex-1 min-h-0 overflow-y-auto scrollbar-thin p-6 space-y-3",children:v&&!m?e.jsxs("div",{className:"flex flex-col items-center justify-center gap-3 py-12 text-muted",children:[e.jsx(fe,{size:32,className:"animate-pulse text-primary-theme"}),e.jsx("p",{className:"text-sm font-bold",children:d==="zh"?"AI 正在分析本节课学情…":"AI analyzing class mastery…"})]}):w.length===0?e.jsx("div",{className:"text-center text-muted text-sm py-8",children:d==="zh"?"暂无学生数据":"No student data"}):w.map(b=>e.jsx(Ln,{prediction:b,lang:d},b.studentId))}),e.jsxs("div",{className:"bg-surface-secondary px-6 py-3 border-t border-theme text-xs text-muted flex items-center justify-between shrink-0",children:[e.jsx("span",{children:m&&e.jsxs(e.Fragment,{children:[d==="zh"?"预测基于":"Based on",": ",c.length," ",d==="zh"?"位学生实时数据":"students"," ·"," ",new Date(m.generatedAt).toLocaleTimeString()]})}),e.jsxs("span",{className:"inline-flex items-center gap-1",children:[e.jsx(fe,{size:10}),d==="zh"?"AI 输出仅供参考,最终判断请结合教学经验":"AI suggestions only — combine with teaching experience"]})]})]})})},Ln=({prediction:s,lang:i})=>{const n=Object.values(s.prediction).reduce((r,c)=>r+c,0)/5,o=n>=75?"up":n>=55?"flat":"down",a=o==="up"?_e:o==="flat"?mr:ga,t=s.risk==="high"?"border-rose-500 bg-rose-50":s.risk==="medium"?"border-amber-500 bg-amber-50":"border-emerald-500 bg-emerald-50";return e.jsxs("div",{className:`border-2 rounded-xl p-4 bg-surface ${t}`,children:[e.jsxs("div",{className:"flex items-start justify-between mb-3",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"font-extrabold text-sm text-main",children:s.studentName}),e.jsx(Fn,{level:s.risk,lang:i})]}),e.jsxs("div",{className:"flex items-center gap-1.5 text-xs",children:[e.jsx(a,{size:14,className:o==="up"?"text-emerald-600":o==="flat"?"text-muted":"text-rose-600"}),e.jsx("span",{className:"font-bold text-main",children:Math.round(n)}),e.jsx("span",{className:"text-muted",children:i==="zh"?"综合":"Avg"})]})]}),e.jsx("div",{className:"grid grid-cols-5 gap-2 mb-3",children:Dn.map(r=>{const c=s.prediction[r.key];return e.jsxs("div",{className:"space-y-1",children:[e.jsxs("div",{className:"flex items-center justify-between text-[10px]",children:[e.jsx("span",{className:"text-muted",children:r.label}),e.jsx("span",{className:"font-bold text-main",children:c})]}),e.jsx("div",{className:"h-1.5 rounded-full bg-surface-secondary overflow-hidden",children:e.jsx("div",{className:`h-full ${r.color} transition-all`,style:{width:`${c}%`}})})]},r.key)})}),s.note&&e.jsxs("div",{className:"text-xs text-muted flex items-start gap-1.5",children:[e.jsx(Se,{size:10,className:"mt-0.5 shrink-0"}),e.jsx("span",{children:s.note})]})]})},es=({level:s,count:i,lang:n})=>{const o=s==="high"?"bg-rose-100 text-rose-700":s==="medium"?"bg-amber-100 text-amber-700":"bg-emerald-100 text-emerald-700",a=s==="high"?n==="zh"?"高风险":"High Risk":s==="medium"?n==="zh"?"中风险":"Medium":n==="zh"?"低风险":"Low";return e.jsxs("span",{className:`px-2 py-0.5 rounded-full font-bold ${o}`,children:[a,": ",i]})},Fn=({level:s,lang:i})=>{const n=s==="high"?"bg-rose-500 text-white":s==="medium"?"bg-amber-500 text-white":"bg-emerald-500 text-white",o=s==="low"?je:Se,a=s==="high"?i==="zh"?"需关注":"Alert":s==="medium"?i==="zh"?"观察":"Watch":i==="zh"?"良好":"Good";return e.jsxs("span",{className:`px-1.5 py-0.5 rounded text-[10px] font-bold inline-flex items-center gap-1 ${n}`,children:[e.jsx(o,{size:10}),a]})},Nr={react:"rose",promise:"rose",runtime:"rose",api:"amber",custom:"blue"},Bn=({isOpen:s,onClose:i,addToast:n,lang:o="zh"})=>{const a=He(f=>f.errors),t=He(f=>f.studentErrors),r=He(f=>f.removeError),c=He(f=>f.removeStudentError),x=He(f=>f.clearErrors),d=He(f=>f.clearStudentErrors),[m,u]=l.useState("student"),[v,N]=l.useState("all");l.useEffect(()=>{s&&t.length>0&&u("student")},[s,t.length]);const g=l.useMemo(()=>t.filter(f=>v==="all"||f.type===v),[t,v]),p=l.useMemo(()=>a.filter(f=>v==="all"||f.type===v),[a,v]),j=l.useCallback(()=>{const f=Array.from(new Set(t.map(b=>b.studentId))).join(", ");if(!f){n(o==="zh"?"暂无学生 ID":"No student IDs","","warning");return}navigator.clipboard.writeText(f).then(()=>n(o==="zh"?"已复制学生 ID 列表":"Copied student IDs","","success"),()=>n(o==="zh"?"复制失败":"Copy failed","","error"))},[t,n,o]);if(!s)return null;const k=m==="student"?g:p,w=m==="student"?t.length:a.length;return e.jsx("div",{className:"fixed inset-0 z-[115] bg-black/40 backdrop-blur-sm flex items-center justify-center p-4 animate-fade-in",children:e.jsxs("div",{className:"bg-surface border border-theme rounded-2xl shadow-2xl w-full max-w-4xl max-h-[90vh] flex flex-col overflow-hidden",children:[e.jsxs("div",{className:"bg-surface-secondary px-6 py-4 border-b border-theme flex items-center justify-between shrink-0",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"w-10 h-10 rounded-xl bg-rose-500/10 flex items-center justify-center",children:e.jsx(gs,{size:20,className:"text-rose-600"})}),e.jsxs("div",{children:[e.jsx("h2",{className:"text-base font-extrabold text-main",children:o==="zh"?"课堂异常告警中心":"Classroom Diagnostic Center"}),e.jsx("p",{className:"text-xs text-muted mt-0.5",children:o==="zh"?"实时监控教师/学生端异常":"Real-time teacher & student error monitoring"})]})]}),e.jsx("button",{onClick:i,className:"p-1.5 rounded-lg hover:bg-surface text-muted hover:text-main transition-colors","aria-label":"Close",children:e.jsx(be,{size:18})})]}),e.jsxs("div",{className:"px-6 pt-3 flex items-center gap-1 border-b border-theme shrink-0",children:[e.jsx(Us,{active:m==="student",onClick:()=>u("student"),icon:e.jsx(ke,{size:12}),label:o==="zh"?"学生端异常":"Student",count:t.length,accent:"rose"}),e.jsx(Us,{active:m==="local",onClick:()=>u("local"),icon:e.jsx(Lt,{size:12}),label:o==="zh"?"本机异常":"Local",count:a.length,accent:"amber"}),e.jsx(oe,{slot:"classroom.diagnostic.feed"})]}),e.jsxs("div",{className:"px-6 py-3 flex items-center justify-between border-b border-theme shrink-0",children:[e.jsxs("div",{className:"flex items-center gap-2 text-xs",children:[e.jsxs("span",{className:"text-muted",children:[o==="zh"?"筛选":"Filter",":"]}),["all","react","runtime","promise","api","custom"].map(f=>e.jsx("button",{onClick:()=>N(f),className:`px-2 py-1 rounded font-bold ${v===f?"bg-primary-theme text-white":"bg-surface-secondary text-main"}`,children:f==="all"?o==="zh"?"全部":"All":f},f))]}),e.jsxs("div",{className:"flex items-center gap-2",children:[m==="student"&&e.jsxs("button",{onClick:j,className:"px-2.5 py-1 text-xs font-bold rounded-lg border border-theme text-main hover:bg-surface transition-colors flex items-center gap-1.5",children:[e.jsx(ft,{size:12}),o==="zh"?"复制所有学生 ID":"Copy all IDs"]}),e.jsxs("button",{onClick:()=>m==="student"?d():x(),disabled:w===0,className:"px-2.5 py-1 text-xs font-bold rounded-lg border border-rose-500 text-rose-600 hover:bg-rose-50 transition-colors flex items-center gap-1.5 disabled:opacity-40 disabled:cursor-not-allowed",children:[e.jsx(at,{size:12}),o==="zh"?"清空":"Clear"]})]})]}),e.jsx("div",{className:"flex-1 min-h-0 overflow-y-auto scrollbar-thin p-4 space-y-2",children:k.length===0?e.jsxs("div",{className:"flex flex-col items-center justify-center py-12 text-muted",children:[e.jsx(Se,{size:32,className:"opacity-30 mb-2"}),e.jsx("p",{className:"text-sm",children:m==="student"?o==="zh"?"暂无学生端异常":"No student errors":o==="zh"?"暂无本机异常":"No local errors"})]}):k.map(f=>m==="student"?e.jsx(Gn,{error:f,onRemove:()=>c(f.id),lang:o},f.id):e.jsx(Wn,{error:f,onRemove:()=>r(f.id),lang:o},f.id))}),e.jsxs("div",{className:"bg-surface-secondary px-6 py-3 border-t border-theme text-xs text-muted flex items-center justify-between shrink-0",children:[e.jsx("span",{children:w>0?o==="zh"?`共 ${w} 条异常`:`${w} total`:o==="zh"?"一切正常":"All clear"}),e.jsxs("button",{onClick:()=>{n(o==="zh"?"已刷新":"Refreshed",o==="zh"?"本机列表":"Local list","info")},className:"inline-flex items-center gap-1 text-muted hover:text-main transition-colors",children:[e.jsx($e,{size:10}),o==="zh"?"刷新":"Refresh"]})]})]})})},Us=({active:s,onClick:i,icon:n,label:o,count:a,accent:t})=>e.jsxs("button",{onClick:i,className:`px-4 py-2 text-xs font-bold rounded-t-lg transition-colors flex items-center gap-1.5 ${s?t==="rose"?"bg-surface text-rose-600 border-b-2 border-rose-500":"bg-surface text-amber-600 border-b-2 border-amber-500":"text-muted hover:text-main"}`,children:[n,o,a>0&&e.jsx("span",{className:`ml-1 px-1.5 py-0.5 rounded-full text-[10px] font-extrabold ${s?t==="rose"?"bg-rose-500 text-white":"bg-amber-500 text-white":"bg-surface text-muted"}`,children:a})]}),Gn=({error:s,onRemove:i,lang:n})=>{const o=Nr[s.type]??"blue",a=o==="rose"?gs:o==="amber"?Se:hr,t=o==="rose"?"border-rose-500 bg-rose-50":o==="amber"?"border-amber-500 bg-amber-50":"border-blue-500 bg-blue-50",r=o==="rose"?"text-rose-600":o==="amber"?"text-amber-600":"text-blue-600";return e.jsxs("div",{className:`border-l-4 ${t} rounded-lg p-3 flex items-start gap-3 bg-surface`,children:[e.jsx(a,{size:16,className:`${r} mt-0.5 shrink-0`}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[e.jsx("span",{className:"font-bold text-sm text-main",children:s.studentName??s.studentId}),e.jsx("span",{className:"text-[10px] text-muted font-mono",children:s.studentId}),e.jsx("span",{className:"text-[10px] text-muted",children:new Date(s.timestamp).toLocaleTimeString()})]}),e.jsx("div",{className:"text-xs font-bold text-main mb-1",children:s.title}),e.jsx("div",{className:"text-xs text-muted line-clamp-2",children:s.message})]}),e.jsx("button",{onClick:i,className:"p-1 rounded hover:bg-surface text-muted hover:text-rose-600 transition-colors shrink-0",title:n==="zh"?"移除":"Remove",children:e.jsx(be,{size:14})})]})},Wn=({error:s,onRemove:i,lang:n})=>{const o=Nr[s.type]??"blue",a=o==="rose"?gs:o==="amber"?Se:hr,t=o==="rose"?"border-rose-500 bg-rose-50":o==="amber"?"border-amber-500 bg-amber-50":"border-blue-500 bg-blue-50",r=o==="rose"?"text-rose-600":o==="amber"?"text-amber-600":"text-blue-600";return e.jsxs("div",{className:`border-l-4 ${t} rounded-lg p-3 flex items-start gap-3 bg-surface`,children:[e.jsx(a,{size:16,className:`${r} mt-0.5 shrink-0`}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[e.jsx("span",{className:"font-bold text-sm text-main",children:s.title}),s.endpoint&&e.jsxs("span",{className:"text-[10px] text-muted",children:["[",s.endpoint,"]"]}),e.jsx("span",{className:"text-[10px] text-muted",children:new Date(s.timestamp).toLocaleTimeString()})]}),e.jsx("div",{className:"text-xs text-muted line-clamp-3",children:s.message})]}),e.jsx("button",{onClick:i,className:"p-1 rounded hover:bg-surface text-muted hover:text-rose-600 transition-colors shrink-0",title:n==="zh"?"移除":"Remove",children:e.jsx(be,{size:14})})]})},nt=["bg-indigo-500","bg-cyan-500","bg-purple-500","bg-pink-500","bg-amber-500","bg-emerald-500","bg-rose-500","bg-teal-500"];function Un(s,i=4){if(i<=0)return[];const n=Math.max(1,i),o={advanced:3,intermediate:2,basic:1},a=[...s].sort((c,x)=>{const d=c.tier?o[c.tier]:c.score!==void 0?c.score:2;return(x.tier?o[x.tier]:x.score!==void 0?x.score:2)-d}),t=Array.from({length:n},(c,x)=>{let d="intermediate";x===0?d="advanced":x===n-1&&(d="basic");const m=d==="advanced"?"拔高组":d==="basic"?"基础组":"进阶组";return{id:`group-${x+1}`,name:`第 ${x+1} 组 (${m})`,memberIds:[],color:nt[x%nt.length],focusTier:d,likesCount:0,inquiryTags:[],isSpotlight:!1}}),r=Math.ceil(a.length/n);for(let c=0;c<a.length;c++){const x=Math.min(Math.floor(c/r),n-1);t[x].memberIds.push(a[c].id)}return t}function Hn(s,i=4){if(i<=0)return[];const n=Math.max(1,i),o={advanced:3,intermediate:2,basic:1},a=[...s].sort((x,d)=>{const m=x.tier?o[x.tier]:x.score!==void 0?x.score:2;return(d.tier?o[d.tier]:d.score!==void 0?d.score:2)-m}),t=Array.from({length:n},(x,d)=>({id:`group-${d+1}`,name:`第 ${d+1} 协作组 (拼板互助)`,memberIds:[],color:nt[d%nt.length],focusTier:"balanced",likesCount:0,inquiryTags:[],isSpotlight:!1}));let r=!0,c=0;for(let x=0;x<a.length;x++)t[c].memberIds.push(a[x].id),r?c===n-1?r=!1:c++:c===0?r=!0:c--;return t}function qn(s,i=4,n=Math.random){if(i<=0)return[];const o=Math.max(1,i),a=[...s].sort(()=>n()-.5),t=Array.from({length:o},(r,c)=>({id:`group-${c+1}`,name:`第 ${c+1} 小组`,memberIds:[],color:nt[c%nt.length],focusTier:"balanced",likesCount:0,inquiryTags:[],isSpotlight:!1}));return a.forEach((r,c)=>{const x=c%o;t[x].memberIds.push(r.id)}),t}function Vn(s,i=4,n="heterogeneous",o=Math.random){return n==="homogeneous"?Un(s,i):n==="heterogeneous"?Hn(s,i):qn(s,i,o)}const Hs=["#4f46e5","#06b6d4","#a855f7","#ec4899","#f59e0b","#10b981","#ef4444","#1e293b"],Kn=["思路新颖","极值合理","受力严谨","需补充推导"],Jn=({isOpen:s,onClose:i,lessonId:n,classId:o,availableStudents:a,addToast:t,lang:r="zh"})=>{const[c,x]=l.useState([]),[d,m]=l.useState([]),[u,v]=l.useState(null),[N,g]=l.useState(Hs[0]),[p,j]=l.useState(3),[k,w]=l.useState("pen"),[f,b]=l.useState(!1),[z,_]=l.useState(!0),[C,B]=l.useState("heterogeneous"),[R,J]=l.useState(!1),[O,H]=l.useState(r==="zh"?"随堂探究驱动题:请各小组针对本题受力与运动过程进行受力拆解绘图,并标出关键守恒量。":"In-class Jigsaw Task: Collaborate to draw the state diagram and identify conserved quantities."),[ee,se]=l.useState({}),[I,V]=l.useState({}),[P,y]=l.useState(null),M=l.useRef(null);l.useEffect(()=>{if(s&&c.length===0){const A=["bg-indigo-500","bg-emerald-500","bg-amber-500","bg-rose-500"],L=Array.from({length:4}).map((Y,te)=>({id:`group-${te+1}`,name:r==="zh"?`第 ${te+1} 小组`:`Group ${te+1}`,memberIds:[],color:A[te%A.length],focusTier:"balanced",likesCount:0,inquiryTags:[],isSpotlight:!1}));x(L),v(L[0].id)}s||(x([]),m([]),v(null),J(!1))},[s,r]);const $=l.useCallback(()=>{if(c.length===0)return;const A=a.map((te,U)=>({id:te.id,name:te.name,tier:te.tier||(U%3===0?"advanced":U%3===1?"intermediate":"basic")})),L=Vn(A,c.length,C);x(L);const Y=C==="heterogeneous"?r==="zh"?"异质拼板互助(以优带新)":"Heterogeneous Jigsaw":C==="homogeneous"?r==="zh"?"同质分层探讨":"Homogeneous Tiered":r==="zh"?"随机均分":"Random";t(r==="zh"?"✅ 自动分配完成":"✅ Auto-assigned",r==="zh"?`已按「${Y}」将 ${A.length} 名学生自动分配完毕。`:`Assigned by ${Y}.`,"success")},[c.length,a,C,t,r]),S=l.useCallback(()=>{const A={id:`group-${Date.now()}`,name:r==="zh"?`第 ${c.length+1} 小组`:`Group ${c.length+1}`,memberIds:[],color:"bg-indigo-500",focusTier:"balanced",likesCount:0,inquiryTags:[],isSpotlight:!1};x(L=>[...L,A]),v(A.id)},[c.length,r]),E=l.useCallback(A=>{x(L=>L.filter(Y=>Y.id!==A)),m(L=>L.filter(Y=>Y.groupId!==A)),u===A&&v(L=>c.filter(te=>te.id!==A)[0]?.id??null)},[u,c]),Q=l.useCallback((A,L,Y)=>{x(te=>te.map(U=>{if(U.id!==A)return U;const Z=Y?[...U.memberIds,L]:U.memberIds.filter(T=>T!==L);return{...U,memberIds:Z}}))},[]),ie=l.useCallback(A=>{m(L=>L.filter(Y=>Y.groupId!==A))},[]),pe=(A,L)=>{se(Y=>({...Y,[A]:(Y[A]||0)+1})),t(r==="zh"?"🌸 送花点赞成功":"🌸 Flower Awarded",r==="zh"?`已为「${L}」送出一朵协作探究鲜花!`:`Awarded flower to ${L}!`,"success")},ce=(A,L)=>{V(Y=>{const te=Y[A]||[];return te.includes(L)?Y:{...Y,[A]:[...te,L]}})},G=l.useRef({active:!1,start:{x:0,y:0}}),K=l.useCallback(A=>{if(!u||!M.current||R)return;const L=M.current.getBoundingClientRect(),Y={x:A.clientX-L.left,y:A.clientY-L.top};G.current={active:!0,start:Y,currentStroke:{id:`s-${Date.now()}-${Math.random()}`,groupId:u,tool:k,color:k==="eraser"?"#ffffff":N,width:p,points:[Y]}}},[u,k,N,p,R]),le=l.useCallback(A=>{const L=G.current;if(!L.active||!L.currentStroke||!M.current)return;const Y=M.current.getBoundingClientRect(),te={x:A.clientX-Y.left,y:A.clientY-Y.top};if(L.currentStroke.tool==="pen"||L.currentStroke.tool==="eraser")L.currentStroke.points=[...L.currentStroke.points,te];else if(L.currentStroke.tool==="rect")L.currentStroke.rect={x:Math.min(L.start.x,te.x),y:Math.min(L.start.y,te.y),w:Math.abs(te.x-L.start.x),h:Math.abs(te.y-L.start.y)};else if(L.currentStroke.tool==="circle"){const U=te.x-L.start.x,Z=te.y-L.start.y;L.currentStroke.circle={cx:L.start.x+U/2,cy:L.start.y+Z/2,r:Math.sqrt(U*U+Z*Z)/2}}m(U=>[...U.filter(Z=>Z.id!==L.currentStroke.id),L.currentStroke])},[]),de=l.useCallback(()=>{G.current={active:!1,start:{x:0,y:0}}},[]),ue=l.useCallback(()=>{if(!u||!M.current)return;const A=M.current.outerHTML,L=new Blob([A],{type:"image/svg+xml;charset=utf-8"}),Y=URL.createObjectURL(L),te=document.createElement("a");te.href=Y,te.download=`${u}-${new Date().toISOString().slice(0,10)}.svg`,te.click(),URL.revokeObjectURL(Y)},[u]),ve=l.useMemo(()=>f?d:d.filter(A=>A.groupId===u),[d,u,f]);return s?e.jsx("div",{className:"fixed inset-0 z-[118] bg-black/50 backdrop-blur-xs flex items-center justify-center p-4 animate-fade-in",children:e.jsxs("div",{className:"bg-surface border border-theme rounded-2xl shadow-2xl w-full max-w-7xl h-[92vh] flex flex-col overflow-hidden text-main",children:[e.jsxs("div",{className:"bg-surface-secondary px-5 py-3 border-b border-theme flex items-center justify-between shrink-0",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"w-9 h-9 rounded-xl bg-indigo-500/10 flex items-center justify-center",children:e.jsx(ke,{size:18,className:"text-indigo-600 dark:text-indigo-400"})}),e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("h2",{className:"text-sm font-extrabold text-main",children:r==="zh"?"随堂小组协作与画廊互评":"Group Collaboration & Gallery Walk"}),e.jsx("span",{className:"px-2 py-0.5 rounded-full text-[10px] font-bold bg-indigo-100 dark:bg-indigo-900/60 text-indigo-700 dark:text-indigo-300 font-mono",children:"Jigsaw & Battle"})]}),e.jsxs("p",{className:"text-2xs text-muted mt-0.5",children:[c.length," ",r==="zh"?"个探究小组":"groups"," ·"," ",R?r==="zh"?"当前处于画廊大屏互评并览":"Gallery Walk Active":r==="zh"?"当前处于组内精修":"Single Canvas Active"]})]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("button",{onClick:()=>J(!R),className:`px-3 py-1.5 rounded-xl text-xs font-bold flex items-center gap-1.5 transition-all cursor-pointer shadow-2xs ${R?"bg-amber-500 hover:bg-amber-600 text-white shadow-amber-500/20":"bg-surface hover:bg-surface-secondary border border-theme text-main"}`,children:[e.jsx(Pt,{size:13}),e.jsx("span",{children:R?r==="zh"?"返回单组画布":"Exit Gallery":r==="zh"?"画廊互评大屏并览 (Gallery Walk)":"Gallery Walk"})]}),e.jsx("button",{onClick:i,className:"p-1.5 rounded-lg hover:bg-surface text-muted hover:text-main transition-colors cursor-pointer","aria-label":"Close",children:e.jsx(be,{size:18})})]})]}),e.jsxs("div",{className:"bg-amber-500/10 border-b border-amber-500/20 px-5 py-2 flex items-center justify-between gap-3 text-xs shrink-0",children:[e.jsxs("div",{className:"flex items-center gap-2 min-w-0 flex-1",children:[e.jsx(fe,{size:14,className:"text-amber-500 shrink-0"}),e.jsx("span",{className:"font-bold text-amber-700 dark:text-amber-400 shrink-0",children:r==="zh"?"探究任务:":"Mission: "}),e.jsx("input",{type:"text",value:O,onChange:A=>H(A.target.value),className:"bg-transparent border-none text-main focus:outline-hidden text-xs flex-1 truncate font-medium",placeholder:r==="zh"?"输入或调整小组驱动探究任务...":"Enter collaboration mission..."})]}),e.jsxs("span",{className:"text-3xs text-muted font-mono shrink-0 flex items-center gap-1",children:[e.jsx(tr,{size:10}),r==="zh"?"各组画布实时同步":"Synced to all canvases"]})]}),e.jsxs("div",{className:"flex-1 min-h-0 flex",children:[z&&!R&&e.jsxs("div",{className:"w-72 shrink-0 border-r border-theme bg-surface-secondary/50 overflow-y-auto scrollbar-thin flex flex-col p-3.5 gap-3",children:[e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center justify-between mb-2",children:[e.jsx("h3",{className:"text-xs font-extrabold text-main uppercase tracking-wider",children:r==="zh"?"分组策略":"Strategy"}),e.jsx("button",{onClick:S,className:"p-1 rounded hover:bg-surface text-primary-theme cursor-pointer",title:r==="zh"?"新建小组":"New group",children:e.jsx(nr,{size:14})})]}),e.jsxs("div",{className:"grid grid-cols-3 gap-1 p-0.5 bg-surface rounded-lg border border-theme mb-2.5",children:[e.jsx("button",{onClick:()=>B("heterogeneous"),className:`py-1 text-2xs font-bold rounded transition-colors ${C==="heterogeneous"?"bg-primary-theme text-white":"text-muted hover:text-main"}`,title:r==="zh"?"拼板互助(1优+2中+1潜)":"Heterogeneous",children:"拼板互助"}),e.jsx("button",{onClick:()=>B("homogeneous"),className:`py-1 text-2xs font-bold rounded transition-colors ${C==="homogeneous"?"bg-primary-theme text-white":"text-muted hover:text-main"}`,title:r==="zh"?"同质分层探讨":"Homogeneous",children:"同质分层"}),e.jsx("button",{onClick:()=>B("random"),className:`py-1 text-2xs font-bold rounded transition-colors ${C==="random"?"bg-primary-theme text-white":"text-muted hover:text-main"}`,title:r==="zh"?"随机均分":"Random",children:"随机均分"})]}),e.jsxs("button",{onClick:$,className:"w-full px-3 py-1.5 text-xs font-bold rounded-xl bg-primary-theme hover:bg-primary-theme-hover text-white transition-colors flex items-center justify-center gap-1.5 shadow-2xs cursor-pointer",children:[e.jsx(ke,{size:12}),e.jsx("span",{children:r==="zh"?"一键自动分配":"Auto-assign"})]})]}),e.jsxs("div",{className:"space-y-1.5 flex-1 min-h-[160px]",children:[e.jsx("h4",{className:"text-2xs font-bold text-muted uppercase tracking-wider",children:r==="zh"?"小组列表":"Groups"}),c.map(A=>e.jsxs("div",{onClick:()=>v(A.id),className:`p-2 rounded-xl border transition-all cursor-pointer ${u===A.id?"border-primary-theme bg-surface shadow-2xs font-semibold":"border-theme/40 hover:bg-surface"}`,children:[e.jsxs("div",{className:"flex items-center justify-between mb-1",children:[e.jsxs("div",{className:"flex items-center gap-1.5 min-w-0",children:[e.jsx("div",{className:`w-2 h-2 rounded-full ${A.color}`}),e.jsx("span",{className:"text-xs font-bold text-main truncate",children:A.name})]}),e.jsxs("div",{className:"flex items-center gap-1",children:[ee[A.id]>0&&e.jsxs("span",{className:"text-2xs text-rose-500 font-mono flex items-center gap-0.5",children:["🌸",ee[A.id]]}),e.jsx("button",{onClick:L=>{L.stopPropagation(),E(A.id)},className:"p-0.5 rounded text-muted hover:text-rose-600 hover:bg-rose-50 transition-colors",title:r==="zh"?"删除":"Remove",children:e.jsx(at,{size:11})})]})]}),e.jsx("div",{className:"text-[10px] text-muted truncate",children:A.memberIds.length===0?r==="zh"?"未分配成员":"No members":A.memberIds.map(L=>a.find(Y=>Y.id===L)?.name??L.slice(0,6)).join(", ")})]},A.id))]}),e.jsxs("div",{className:"pt-2 border-t border-theme/60",children:[e.jsx("h4",{className:"text-2xs font-bold text-muted uppercase tracking-wider mb-1.5",children:r==="zh"?"班级学生库":"Roster"}),e.jsx("div",{className:"space-y-1 max-h-48 overflow-y-auto scrollbar-thin",children:a.map(A=>{const L=c.some(Y=>Y.memberIds.includes(A.id));return e.jsxs("div",{className:"flex items-center justify-between p-1 rounded hover:bg-surface text-2xs",children:[e.jsx("span",{className:L?"text-muted line-through":"text-main font-medium",children:A.name}),u&&e.jsx("button",{onClick:()=>Q(u,A.id,!L),className:`px-1.5 py-0.5 rounded text-3xs font-bold ${L?"bg-surface-secondary text-muted hover:text-rose-600":"bg-primary-theme/10 text-primary-theme hover:bg-primary-theme hover:text-white"}`,children:L?"−":"+"})]},A.id)})})]})]}),e.jsx("div",{className:"flex-1 min-w-0 flex flex-col bg-surface",children:R?e.jsx("div",{className:"flex-1 p-5 overflow-y-auto bg-surface-secondary/30",children:e.jsxs("div",{className:"max-w-6xl mx-auto space-y-4",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsxs("h3",{className:"font-extrabold text-sm text-main flex items-center gap-1.5",children:[e.jsx(Pt,{size:16,className:"text-amber-500"}),e.jsx("span",{children:r==="zh"?"全班小组探究画廊展台":"Classroom Gallery Walk Showcase"})]}),e.jsx("p",{className:"text-2xs text-muted",children:r==="zh"?"多组画布并排投屏,支持师生端送花点赞、思辨发问与成果置顶评选":"Side-by-side presentation, like and praise student submissions."})]}),e.jsxs("div",{className:"text-xs font-mono font-bold text-amber-600 dark:text-amber-400 bg-amber-500/10 px-3 py-1 rounded-xl border border-amber-500/30",children:["🌸 协作热度总计: ",Object.values(ee).reduce((A,L)=>A+L,0)," 朵鲜花"]})]}),e.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4",children:c.map(A=>{const L=d.filter(Z=>Z.groupId===A.id),Y=ee[A.id]||0,te=I[A.id]||[],U=P===A.id;return e.jsxs("div",{className:`bg-surface border rounded-2xl p-3.5 shadow-sm flex flex-col gap-2.5 transition-all ${U?"border-amber-400 ring-2 ring-amber-400/40 shadow-amber-500/10":"border-theme hover:border-primary-theme/60"}`,children:[e.jsxs("div",{className:"flex items-center justify-between border-b border-theme/50 pb-2",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:`w-2.5 h-2.5 rounded-full ${A.color}`}),e.jsx("span",{className:"font-bold text-xs text-main",children:A.name}),U&&e.jsx("span",{className:"px-1.5 py-0.2 rounded-md bg-amber-500 text-white text-[9px] font-bold",children:"🌟 置顶高光"})]}),e.jsxs("span",{className:"text-2xs text-muted font-mono",children:[A.memberIds.length," 成员"]})]}),e.jsxs("div",{onClick:()=>{v(A.id),J(!1)},className:"w-full h-44 bg-white rounded-xl border border-theme/60 overflow-hidden relative cursor-pointer group",title:r==="zh"?"点击切入单组精修":"Click to edit canvas",children:[e.jsxs("svg",{className:"w-full h-full",viewBox:"0 0 1200 800",preserveAspectRatio:"xMidYMid meet",children:[e.jsx("rect",{width:"1200",height:"800",fill:"#ffffff"}),L.map(Z=>{if(Z.tool==="pen"||Z.tool==="eraser"){const T=Z.points.map((re,xe)=>xe===0?`M ${re.x} ${re.y}`:`L ${re.x} ${re.y}`).join(" ");return e.jsx("path",{d:T,stroke:Z.color,strokeWidth:Z.width*1.5,fill:"none",strokeLinecap:"round",strokeLinejoin:"round"},Z.id)}return null})]}),e.jsx("div",{className:"absolute inset-0 bg-black/0 group-hover:bg-black/10 transition-colors flex items-center justify-center",children:e.jsx("span",{className:"opacity-0 group-hover:opacity-100 bg-surface/90 text-main text-2xs font-bold px-2 py-1 rounded-lg shadow-sm transition-opacity",children:"🔍 点击切入画布"})})]}),e.jsxs("div",{className:"space-y-2 pt-1",children:[e.jsxs("div",{className:"flex items-center justify-between gap-1.5",children:[e.jsxs("button",{onClick:()=>pe(A.id,A.name),className:"flex-1 py-1 px-2 rounded-lg bg-rose-500/10 hover:bg-rose-500/20 text-rose-600 dark:text-rose-400 font-bold text-xs flex items-center justify-center gap-1.5 transition-colors cursor-pointer",children:[e.jsx("span",{children:"🌸 送花赞赏"}),e.jsxs("span",{className:"font-mono text-2xs",children:["(",Y,")"]})]}),e.jsxs("button",{onClick:()=>y(U?null:A.id),className:`py-1 px-2 rounded-lg text-xs font-bold flex items-center gap-1 transition-colors cursor-pointer ${U?"bg-amber-500 text-white":"bg-surface-secondary text-muted hover:text-main"}`,title:r==="zh"?"设为全班高光":"Spotlight",children:[e.jsx(Re,{size:12}),e.jsx("span",{children:U?"取消高光":"高光"})]})]}),e.jsx("div",{className:"flex flex-wrap gap-1",children:Kn.map(Z=>{const T=te.includes(Z);return e.jsx("button",{onClick:()=>ce(A.id,Z),className:`px-1.5 py-0.5 rounded text-[10px] transition-colors cursor-pointer ${T?"bg-indigo-600 text-white font-bold":"bg-surface-secondary text-muted hover:text-main"}`,children:T?`✓ ${Z}`:`+ ${Z}`},Z)})})]})]},A.id)})})]})}):e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"bg-surface-secondary/40 px-4 py-2 border-b border-theme flex items-center justify-between shrink-0",children:[e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx(St,{active:k==="pen",onClick:()=>w("pen"),icon:e.jsx(ur,{size:14}),label:r==="zh"?"笔":"Pen"}),e.jsx(St,{active:k==="rect",onClick:()=>w("rect"),icon:e.jsx(js,{size:14}),label:r==="zh"?"矩形":"Rectangle"}),e.jsx(St,{active:k==="circle",onClick:()=>w("circle"),icon:e.jsx(ja,{size:14}),label:r==="zh"?"圆形":"Circle"}),e.jsx(St,{active:k==="eraser",onClick:()=>w("eraser"),icon:e.jsx(pr,{size:14}),label:r==="zh"?"橡皮":"Eraser"}),e.jsx("div",{className:"h-4 w-px bg-theme mx-1"}),e.jsx("div",{className:"flex items-center gap-1",children:Hs.map(A=>e.jsx("button",{onClick:()=>g(A),style:{backgroundColor:A},className:`w-5 h-5 rounded-full transition-transform ${N===A?"scale-125 ring-2 ring-primary-theme":"hover:scale-110"}`},A))}),e.jsx("div",{className:"h-4 w-px bg-theme mx-1"}),e.jsx("div",{className:"flex items-center gap-1 text-xs",children:[1,3,5,8].map(A=>e.jsxs("button",{onClick:()=>j(A),className:`px-2 py-0.5 rounded text-2xs font-mono font-bold ${p===A?"bg-primary-theme text-white":"hover:bg-surface"}`,children:[A,"px"]},A))})]}),e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsxs("button",{onClick:()=>b(!f),className:`px-2.5 py-1 text-xs font-bold rounded-lg flex items-center gap-1 transition-colors cursor-pointer ${f?"bg-primary-theme text-white":"bg-surface-secondary text-main"}`,children:[f?e.jsx(Ft,{size:12}):e.jsx(fr,{size:12}),e.jsx("span",{children:f?r==="zh"?"查看全部":"All groups":r==="zh"?"仅当前":"Single"})]}),e.jsx("button",{onClick:()=>u&&ie(u),className:"px-2.5 py-1 text-xs font-bold rounded-lg bg-surface-secondary hover:bg-rose-50 hover:text-rose-600 transition-colors cursor-pointer",children:r==="zh"?"清空本组":"Clear"}),e.jsxs("button",{onClick:ue,className:"px-2.5 py-1 text-xs font-bold rounded-lg bg-surface-secondary hover:bg-surface transition-colors flex items-center gap-1 cursor-pointer",children:[e.jsx(Ot,{size:12}),e.jsx("span",{children:"SVG"})]})]})]}),e.jsxs("div",{className:"flex-1 min-h-0 bg-white relative",children:[e.jsxs("svg",{ref:M,className:"w-full h-full",viewBox:"0 0 1200 800",preserveAspectRatio:"xMidYMid meet",onMouseDown:K,onMouseMove:le,onMouseUp:de,onMouseLeave:de,style:{cursor:"crosshair"},children:[e.jsx("defs",{children:e.jsx("pattern",{id:"grid",width:"40",height:"40",patternUnits:"userSpaceOnUse",children:e.jsx("path",{d:"M 40 0 L 0 0 0 40",fill:"none",stroke:"#f1f5f9",strokeWidth:"1"})})}),e.jsx("rect",{width:"1200",height:"800",fill:"url(#grid)"}),ve.map(A=>{if(A.tool==="pen"||A.tool==="eraser"){const L=A.points.map((Y,te)=>te===0?`M ${Y.x} ${Y.y}`:`L ${Y.x} ${Y.y}`).join(" ");return e.jsx("path",{d:L,stroke:A.color,strokeWidth:A.width,fill:"none",strokeLinecap:"round",strokeLinejoin:"round",opacity:A.tool==="eraser"?.4:1},A.id)}else{if(A.tool==="rect"&&A.rect)return e.jsx("rect",{x:A.rect.x,y:A.rect.y,width:A.rect.w,height:A.rect.h,stroke:A.color,strokeWidth:A.width,fill:"none"},A.id);if(A.tool==="circle"&&A.circle)return e.jsx("circle",{cx:A.circle.cx,cy:A.circle.cy,r:A.circle.r,stroke:A.color,strokeWidth:A.width,fill:"none"},A.id)}return null})]}),e.jsxs("div",{className:"absolute top-3 left-3 px-3 py-1.5 bg-surface/95 border border-theme rounded-xl text-xs font-bold text-main shadow-sm backdrop-blur-xs flex items-center gap-2",children:[e.jsxs("span",{children:[r==="zh"?"当前画布:":"Canvas: ",c.find(A=>A.id===u)?.name??(r==="zh"?"未选小组":"No group")]}),u&&ee[u]>0&&e.jsxs("span",{className:"text-2xs text-rose-500 font-mono flex items-center gap-0.5",children:["🌸 ",ee[u]]})]})]})]})})]})]})}):null},St=({active:s,onClick:i,icon:n,label:o})=>e.jsx("button",{onClick:i,className:`p-1.5 rounded-lg flex items-center gap-1 transition-colors cursor-pointer ${s?"bg-primary-theme text-white":"bg-surface-secondary text-main hover:bg-surface"}`,title:o,children:n}),ns=[{type:"pitfall",label:"⚠️ 典型思维死角",shortLabel:"思维死角",icon:"⚠️",bgColor:"bg-rose-500/20",textColor:"text-rose-600 dark:text-rose-300",borderColor:"border-rose-500/40"},{type:"smart",label:"💡 巧妙化简/妙解",shortLabel:"巧妙妙解",icon:"💡",bgColor:"bg-amber-500/20",textColor:"text-amber-600 dark:text-amber-300",borderColor:"border-amber-500/40"},{type:"miss_force",label:"❌ 漏掉临界/守恒条件",shortLabel:"漏临界条件",icon:"❌",bgColor:"bg-purple-500/20",textColor:"text-purple-600 dark:text-purple-300",borderColor:"border-purple-500/40"},{type:"exemplary",label:"✅ 规范书写示范",shortLabel:"规范示范",icon:"✅",bgColor:"bg-emerald-500/20",textColor:"text-emerald-600 dark:text-emerald-300",borderColor:"border-emerald-500/40"}],qs=[{name:"荧光黄",hex:"#fde047",strokeHex:"rgba(253, 224, 71, 0.45)"},{name:"荧光粉",hex:"#f472b6",strokeHex:"rgba(244, 114, 182, 0.45)"},{name:"荧光青",hex:"#22d3ee",strokeHex:"rgba(34, 211, 238, 0.45)"},{name:"荧光绿",hex:"#4ade80",strokeHex:"rgba(74, 222, 128, 0.45)"}],Qn=[{name:"批改红",hex:"#ef4444"},{name:"标注蓝",hex:"#3b82f6"},{name:"警示橙",hex:"#f97316"},{name:"强调白",hex:"#ffffff"}],Yn=({activeTool:s,activeColor:i,activeStampType:n,strokes:o,setStrokes:a,stamps:t,setStamps:r,isOverlayActive:c})=>{const x=l.useRef(null),[d,m]=l.useState(null),[u,v]=l.useState(!1),N=l.useRef(null),g=l.useRef(null),p=l.useCallback(f=>{if(!c||!x.current)return;const b=x.current.getBoundingClientRect(),z={x:f.clientX-b.left,y:f.clientY-b.top};if(s==="laser"){m(z);return}if(s==="stamp"){const _=ns.find(B=>B.type===n),C={id:`stamp-${Date.now()}-${Math.random()}`,x:z.x,y:z.y,type:n,label:_?.label??"思维剖析",color:i,screenIndex:0};r(B=>[...B,C]);return}if(s==="highlighter"||s==="pen"){v(!0);const _={id:`stroke-${Date.now()}-${Math.random()}`,tool:s,color:i,width:s==="highlighter"?18:3,opacity:s==="highlighter"?.45:1,points:[z]};N.current=_,a(C=>[...C,_])}},[s,i,n,c,r,a]),j=l.useCallback(f=>{if(!c||!x.current)return;const b=x.current.getBoundingClientRect(),z={x:f.clientX-b.left,y:f.clientY-b.top};if(s==="laser"){m(z),g.current&&clearTimeout(g.current),g.current=setTimeout(()=>{m(null)},1200);return}if(u&&N.current){N.current.points.push(z);const _=N.current.id;a(C=>C.map(B=>B.id===_?{...B,points:[...N.current.points]}:B))}},[s,u,c,a]),k=l.useCallback(()=>{v(!1),N.current=null},[]),w=(f,b)=>{b.stopPropagation(),s==="eraser"&&r(z=>z.filter(_=>_.id!==f))};return l.useEffect(()=>()=>{g.current&&clearTimeout(g.current)},[]),c?e.jsxs("div",{ref:x,onPointerDown:p,onPointerMove:j,onPointerUp:k,onPointerLeave:k,"data-testid":"diff-annotation-overlay",className:`absolute inset-0 z-20 overflow-hidden select-none ${s==="laser"?"cursor-none":s==="stamp"?"cursor-copy":s==="eraser"?"cursor-cell":"cursor-crosshair"}`,style:{touchAction:"none"},children:[e.jsx("svg",{className:"w-full h-full pointer-events-none absolute inset-0",children:o.map(f=>{if(f.points.length<2)return null;const b=f.points.reduce((z,_,C)=>C===0?`M ${_.x} ${_.y}`:`${z} L ${_.x} ${_.y}`,"");return e.jsx("path",{d:b,stroke:f.color,strokeWidth:f.width,strokeOpacity:f.opacity,strokeLinecap:"round",strokeLinejoin:"round",fill:"none"},f.id)})}),t.map(f=>{const b=ns.find(z=>z.type===f.type);return e.jsxs("div",{onClick:z=>w(f.id,z),style:{left:`${f.x}px`,top:`${f.y}px`,transform:"translate(-50%, -50%)"},className:`absolute z-30 px-2.5 py-1 rounded-full border shadow-lg flex items-center gap-1 text-xs font-bold backdrop-blur-md transition-transform hover:scale-105 pointer-events-auto ${b?.bgColor??"bg-amber-500/20"} ${b?.borderColor??"border-amber-500/40"} ${b?.textColor??"text-amber-500"}`,children:[e.jsx("span",{children:b?.icon}),e.jsx("span",{children:b?.shortLabel??f.label})]},f.id)}),s==="laser"&&d&&e.jsxs("div",{"data-testid":"laser-pointer-cursor",style:{left:`${d.x}px`,top:`${d.y}px`,transform:"translate(-50%, -50%)"},className:"absolute pointer-events-none z-40 flex items-center justify-center",children:[e.jsx("div",{className:"w-6 h-6 rounded-full bg-red-500/30 animate-ping absolute"}),e.jsx("div",{className:"w-4 h-4 rounded-full bg-red-500 shadow-[0_0_15px_#ef4444] border-2 border-white"})]})]}):null},Zn=({isOpen:s,onClose:i,lessonTitle:n="随堂探究与物理规律推导",availableStudents:o=[],candidateWorks:a,addToast:t,lang:r="zh",onSyncToClass:c})=>{const x=l.useMemo(()=>{if(a&&a.length>0)return a;const y=o.length>0?o:[{id:"stu-1",name:"张子豪",seatNumber:"A-01"},{id:"stu-2",name:"李晓彤",seatNumber:"A-02"},{id:"stu-3",name:"王一诺",seatNumber:"B-03"},{id:"stu-4",name:"赵梓涵",seatNumber:"B-04"}],M=[{title:"微元累加与动能定理联立",source:"code",content:`// 思路 A:基于动能定理与变力做功微元积分
|
|
44
|
+
const W_gravity = m * g * h;
|
|
45
|
+
const W_friction = -mu * m * g * s;
|
|
46
|
+
// 求解末速度方程:
|
|
47
|
+
const E_k = 0.5 * m * (v ** 2);
|
|
48
|
+
v = Math.sqrt(2 * g * h - 2 * mu * g * s);
|
|
49
|
+
console.log("终端速度:", v.toFixed(2), "m/s");`,tags:["经典解法","极值严密","步骤规范"],durationSec:195,category:"exemplary",accuracyScore:100},{title:"动量守恒与临界碰撞解法",source:"code",content:`// 思路 B:直接运用能量守恒定律进行代数化简
|
|
50
|
+
// 注意:未对沿斜面下滑过程的静摩擦力突变进行临界判断!
|
|
51
|
+
const delta_E = m * g * (h1 - h2);
|
|
52
|
+
// 错误点:忽略了动摩擦因数随压力的非线性衰减
|
|
53
|
+
v_end = Math.sqrt(2 * delta_E / m);`,tags:["典型死角","漏临界条件","待补充受力"],durationSec:142,category:"typical_error",accuracyScore:68},{title:"几何相交法与向量三角形",source:"whiteboard",content:`// 思路 C:基于向量合成与正弦定理求解
|
|
54
|
+
tan(theta) = F_electric / (m * g);
|
|
55
|
+
F_resultant = sqrt( (m*g)^2 + F_electric^2 );
|
|
56
|
+
// 极值判断: 当垂直于重力与电场力合力方向时加速度取得极大值`,tags:["妙解法","几何直观","图象法"],durationSec:210,category:"alternative",accuracyScore:95},{title:"拉格朗日乘子约束方程",source:"code",content:`// 思路 D:广义坐标与约束极值
|
|
57
|
+
const L = T - V; // 拉格朗日量
|
|
58
|
+
// d/dt(dL/dq_dot) - dL/dq = 0
|
|
59
|
+
// 规范矩阵化求解,推导过程工整`,tags:["大学先修","严密推演","拔高拓展"],durationSec:280,category:"exemplary",accuracyScore:100}];return y.slice(0,4).map(($,S)=>({studentId:$.id,studentName:$.name,studentNumber:$.studentNumber,seatNumber:$.seatNumber??`机位-${S+1}`,source:M[S%M.length].source,title:M[S%M.length].title,content:M[S%M.length].content,tags:M[S%M.length].tags,durationSec:M[S%M.length].durationSec,category:M[S%M.length].category,accuracyScore:M[S%M.length].accuracyScore}))},[a,o]),[d,m]=l.useState(()=>x.slice(0,2).map(y=>y.studentId)),[u,v]=l.useState(!1),[N,g]=l.useState(!0),[p,j]=l.useState(!1),[k,w]=l.useState("highlighter"),[f,b]=l.useState(qs[0].strokeHex),[z,_]=l.useState("pitfall"),[C,B]=l.useState([]),[R,J]=l.useState([]),O=l.useMemo(()=>d.length<=2?"dual":d.length===3?"triple":"quad",[d.length]),H=l.useMemo(()=>d.map(y=>x.find(M=>M.studentId===y)).filter(y=>!!y),[d,x]),ee=l.useCallback(y=>{m(M=>M.includes(y)?M.length<=2?(t?.("提示","对比屏幕至少保留 2 位学生","info"),M):M.filter($=>$!==y):M.length>=4?(t?.("提示","多屏对比最多支持 4 位学生同时投屏","warning"),M):[...M,y])},[t]),se=y=>{if(!(x.length<2))if(y==="typical_error_diff"){const M=x.find(S=>S.category==="exemplary")??x[0],$=x.find(S=>S.category==="typical_error")??x[1];m([M.studentId,$.studentId]),t?.("对比模式更新","已切换至「规范典范 vs 典型思维死角」对比","success")}else m(x.slice(0,Math.min(4,x.length)).map(M=>M.studentId)),t?.("对比模式更新",`已载入 ${Math.min(4,x.length)} 种代表性解题过程`,"success")},I=()=>{C.length>0?B(y=>y.slice(0,-1)):R.length>0&&J(y=>y.slice(0,-1))},V=()=>{B([]),J([]),t?.("清空完毕","已清除所有覆盖批注与印章","info")},P=()=>{c?.({selectedIds:d,layout:O}),t?.(r==="zh"?"📡 大屏同步已下发":"📡 Broadcast Sent",r==="zh"?"已将当前多屏对比与教师实时批注图层推送到全班学生机":"Synced diff viewport to students.","success")};return s?e.jsx("div",{className:"fixed inset-0 z-[120] bg-black/60 backdrop-blur-md flex items-center justify-center p-3 md:p-6 animate-fade-in select-none",children:e.jsxs("div",{className:"bg-surface border border-theme rounded-2xl shadow-2xl w-full max-w-[96vw] h-[94vh] flex flex-col overflow-hidden text-main",children:[e.jsxs("div",{className:"bg-surface-secondary/80 px-5 py-3 border-b border-theme flex flex-wrap items-center justify-between gap-3 shrink-0",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"w-9 h-9 rounded-xl bg-purple-500/10 flex items-center justify-center text-purple-600 dark:text-purple-400 border border-purple-500/20",children:e.jsx(xs,{size:18})}),e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("h2",{className:"text-sm font-black text-main tracking-tight",children:r==="zh"?"优秀作业 / 屏幕一键多屏对比投屏批注":"Showcase & Multi-Screen Diff"}),e.jsx("span",{className:"px-2 py-0.5 rounded-full text-[10px] font-bold bg-purple-100 dark:bg-purple-900/60 text-purple-700 dark:text-purple-300 font-mono",children:O==="dual"?"2-Screen Dual":O==="triple"?"3-Screen Triple":"4-Screen Quad"})]}),e.jsxs("p",{className:"text-2xs text-muted mt-0.5",children:[n," · ",H.length," ",r==="zh"?"位学生对比中":"works compared"]})]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("button",{onClick:()=>j(!p),className:`px-3 py-1.5 rounded-xl text-xs font-bold flex items-center gap-1.5 transition-all cursor-pointer shadow-2xs border ${p?"bg-purple-600 text-white border-purple-600":"bg-surface hover:bg-surface-secondary border-theme text-main"}`,children:[e.jsx(ke,{size:13}),e.jsx("span",{children:r==="zh"?`勾选对比 (${d.length}/4)`:`Select (${d.length}/4)`})]}),e.jsxs("button",{onClick:()=>v(!u),className:`px-2.5 py-1.5 rounded-xl text-xs font-bold flex items-center gap-1 transition-all cursor-pointer border ${u?"bg-amber-500/10 text-amber-600 border-amber-500/30":"bg-surface border-theme text-muted hover:text-main"}`,title:r==="zh"?"匿名脱敏模式(保护学生隐私)":"Anonymous Mode",children:[u?e.jsx(fr,{size:13}):e.jsx(Ft,{size:13}),e.jsx("span",{children:u?r==="zh"?"盲评匿名中":"Anonymous":r==="zh"?"实名显示":"Real Name"})]}),e.jsxs("button",{onClick:P,className:"px-3 py-1.5 rounded-xl text-xs font-bold bg-emerald-600 hover:bg-emerald-700 text-white flex items-center gap-1.5 transition-colors shadow-2xs cursor-pointer",children:[e.jsx(ms,{size:13}),e.jsx("span",{children:r==="zh"?"同步广播至全班":"Broadcast to Class"})]}),e.jsx("button",{onClick:i,className:"p-1.5 rounded-lg hover:bg-surface text-muted hover:text-main transition-colors cursor-pointer","aria-label":"Close",children:e.jsx(be,{size:18})})]})]}),e.jsxs("div",{className:"bg-surface px-5 py-2 border-b border-theme flex flex-wrap items-center justify-between gap-3 text-xs shrink-0",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("span",{className:"text-2xs font-extrabold text-muted uppercase tracking-wider",children:[r==="zh"?"批注图层":"Overlay",":"]}),e.jsxs("button",{onClick:()=>{w("laser"),g(!0)},className:`px-2.5 py-1 rounded-lg font-bold flex items-center gap-1 transition-colors cursor-pointer ${k==="laser"&&N?"bg-red-500 text-white shadow-xs":"bg-surface-secondary text-main hover:bg-surface"}`,title:r==="zh"?"动态激光笔(光晕聚焦点)":"Laser Pointer",children:[e.jsx(It,{size:13}),e.jsx("span",{children:r==="zh"?"激光笔":"Laser"})]}),e.jsxs("button",{onClick:()=>{w("highlighter"),g(!0),b(qs[0].strokeHex)},className:`px-2.5 py-1 rounded-lg font-bold flex items-center gap-1 transition-colors cursor-pointer ${k==="highlighter"&&N?"bg-amber-400 text-black shadow-xs font-black":"bg-surface-secondary text-main hover:bg-surface"}`,title:r==="zh"?"荧光笔(半透明高亮差异)":"Highlighter",children:[e.jsx(Na,{size:13}),e.jsx("span",{children:r==="zh"?"荧光笔":"Highlighter"})]}),e.jsxs("button",{onClick:()=>{w("pen"),g(!0),b(Qn[0].hex)},className:`px-2.5 py-1 rounded-lg font-bold flex items-center gap-1 transition-colors cursor-pointer ${k==="pen"&&N?"bg-purple-600 text-white shadow-xs":"bg-surface-secondary text-main hover:bg-surface"}`,title:r==="zh"?"细线批注笔(公式推导/画箭头)":"Pen",children:[e.jsx(ur,{size:13}),e.jsx("span",{children:r==="zh"?"批注笔":"Pen"})]}),e.jsxs("button",{onClick:()=>{w("eraser"),g(!0)},className:`px-2.5 py-1 rounded-lg font-bold flex items-center gap-1 transition-colors cursor-pointer ${k==="eraser"&&N?"bg-rose-600 text-white shadow-xs":"bg-surface-secondary text-main hover:bg-surface"}`,title:r==="zh"?"橡皮擦":"Eraser",children:[e.jsx(pr,{size:13}),e.jsx("span",{children:r==="zh"?"橡皮":"Eraser"})]}),e.jsx("div",{className:"h-4 w-px bg-theme mx-1"}),e.jsx("div",{className:"flex items-center gap-1",children:ns.map(y=>e.jsxs("button",{onClick:()=>{w("stamp"),_(y.type),g(!0)},className:`px-2 py-0.5 rounded-lg text-2xs font-bold transition-all cursor-pointer border ${k==="stamp"&&z===y.type&&N?"scale-105 ring-2 ring-purple-500 shadow-xs":"hover:bg-surface-secondary"} ${y.bgColor} ${y.borderColor} ${y.textColor}`,title:`点击后在画布上盖章:${y.label}`,children:[e.jsx("span",{children:y.icon}),e.jsx("span",{className:"ml-1",children:y.shortLabel})]},y.type))})]}),e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx("button",{onClick:()=>g(!N),className:`px-2 py-1 rounded-lg text-2xs font-bold transition-colors cursor-pointer ${N?"text-purple-600 bg-purple-50 dark:bg-purple-950/40":"text-muted hover:text-main"}`,children:N?"图层已启用":"图层已隐藏"}),e.jsx("button",{onClick:I,className:"p-1.5 rounded-lg bg-surface-secondary hover:bg-surface text-muted hover:text-main transition-colors cursor-pointer",title:r==="zh"?"撤销上一笔":"Undo",children:e.jsx(ut,{size:13})}),e.jsxs("button",{onClick:V,className:"px-2 py-1 rounded-lg bg-surface-secondary hover:bg-rose-50 hover:text-rose-600 transition-colors text-2xs font-bold cursor-pointer flex items-center gap-1",children:[e.jsx(at,{size:12}),e.jsx("span",{children:r==="zh"?"清空批注":"Clear"})]})]})]}),e.jsxs("div",{className:"flex-1 min-h-0 relative flex overflow-hidden bg-app",children:[p&&e.jsxs("div",{"data-testid":"student-candidate-drawer",className:"w-80 shrink-0 border-r border-theme bg-surface-secondary/70 backdrop-blur-md p-4 flex flex-col gap-3 overflow-y-auto animate-slide-right z-30",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("h3",{className:"text-xs font-black text-main uppercase tracking-wider",children:r==="zh"?"学生作答候选池":"Candidate Works"}),e.jsxs("span",{className:"text-2xs font-mono text-muted",children:[x.length," 份作答"]})]}),e.jsxs("div",{className:"flex flex-col gap-1.5 pt-1 border-t border-theme/60",children:[e.jsx("span",{className:"text-3xs font-extrabold text-muted uppercase",children:"快捷场景预设:"}),e.jsxs("div",{className:"grid grid-cols-2 gap-1.5",children:[e.jsx("button",{onClick:()=>se("typical_error_diff"),className:"p-1.5 rounded-lg bg-surface hover:bg-purple-50 hover:text-purple-600 dark:hover:bg-purple-950/40 border border-theme text-2xs font-bold text-left transition-colors",children:"🎯 典范 vs 错解"}),e.jsx("button",{onClick:()=>se("all_top"),className:"p-1.5 rounded-lg bg-surface hover:bg-purple-50 hover:text-purple-600 dark:hover:bg-purple-950/40 border border-theme text-2xs font-bold text-left transition-colors",children:"💡 四路并行对比"})]})]}),e.jsxs("div",{className:"space-y-2 flex-1 pt-1",children:[e.jsx("span",{className:"text-3xs font-extrabold text-muted uppercase",children:"选择 2~4 位学生:"}),x.map(y=>{const M=d.includes(y.studentId);return e.jsxs("div",{onClick:()=>ee(y.studentId),className:`p-2.5 rounded-xl border transition-all cursor-pointer ${M?"border-purple-500 bg-purple-50/40 dark:bg-purple-950/30 shadow-2xs font-semibold":"border-theme/60 hover:bg-surface"}`,children:[e.jsxs("div",{className:"flex items-center justify-between mb-1",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[M?e.jsx(ya,{size:14,className:"text-purple-600"}):e.jsx(js,{size:14,className:"text-muted"}),e.jsx("span",{className:"text-xs font-bold text-main",children:y.studentName}),e.jsx("span",{className:"text-3xs font-mono px-1 rounded bg-surface border border-theme text-muted",children:y.seatNumber})]}),e.jsx("span",{className:`text-3xs font-mono font-bold px-1.5 py-0.5 rounded ${y.category==="exemplary"?"bg-emerald-100 text-emerald-700 dark:bg-emerald-950 dark:text-emerald-300":y.category==="typical_error"?"bg-rose-100 text-rose-700 dark:bg-rose-950 dark:text-rose-300":"bg-amber-100 text-amber-700 dark:bg-amber-950 dark:text-amber-300"}`,children:y.category==="exemplary"?"示范":y.category==="typical_error"?"典型错误":"创新"})]}),e.jsx("p",{className:"text-[11px] text-muted truncate pl-6 font-medium",children:y.title})]},y.studentId)})]})]}),e.jsxs("div",{className:"flex-1 min-w-0 h-full relative overflow-hidden flex flex-col p-4",children:[e.jsx(Yn,{activeTool:k,activeColor:f,activeStampType:z,strokes:C,setStrokes:B,stamps:R,setStamps:J,isOverlayActive:N}),e.jsx("div",{"data-testid":"showcase-diff-grid",className:`w-full h-full grid gap-4 ${O==="dual"?"grid-cols-1 md:grid-cols-2":O==="triple"?"grid-cols-1 md:grid-cols-3":"grid-cols-1 md:grid-cols-2 grid-rows-2"}`,children:H.map((y,M)=>{const $=u?`作答方案 ${String.fromCharCode(65+M)}`:y.studentName;return e.jsxs("div",{className:"bg-surface border border-theme rounded-2xl shadow-sm flex flex-col overflow-hidden transition-all hover:border-purple-500/50",children:[e.jsxs("div",{className:"bg-surface-secondary/60 px-4 py-2.5 border-b border-theme flex items-center justify-between shrink-0",children:[e.jsxs("div",{className:"flex items-center gap-2.5",children:[e.jsx("div",{className:"w-7 h-7 rounded-lg bg-purple-600 text-white flex items-center justify-center font-bold text-xs shadow-2xs",children:String.fromCharCode(65+M)}),e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"font-extrabold text-xs text-main",children:$}),!u&&y.seatNumber&&e.jsx("span",{className:"text-3xs text-muted font-mono bg-surface px-1.5 py-0.5 rounded border border-theme",children:y.seatNumber})]}),e.jsx("span",{className:"text-[10px] text-muted truncate block",children:y.title})]})]}),e.jsxs("div",{className:"flex items-center gap-1.5",children:[y.durationSec&&e.jsxs("span",{className:"text-2xs font-mono text-muted flex items-center gap-0.5",children:[e.jsx(Le,{size:11}),Math.floor(y.durationSec/60),"分",y.durationSec%60,"秒"]}),e.jsxs("span",{className:`px-2 py-0.5 rounded-full text-2xs font-bold font-mono ${(y.accuracyScore??0)>=90?"bg-emerald-100 text-emerald-700 dark:bg-emerald-950 dark:text-emerald-300":"bg-rose-100 text-rose-700 dark:bg-rose-950 dark:text-rose-300"}`,children:[y.accuracyScore,"%"]})]})]}),e.jsxs("div",{className:"flex-1 p-4 overflow-y-auto font-mono text-xs leading-relaxed bg-surface/40",children:[e.jsx("div",{className:"flex flex-wrap gap-1 mb-2.5",children:y.tags.map(S=>e.jsxs("span",{className:"px-2 py-0.5 rounded-md text-3xs font-bold bg-surface-secondary border border-theme text-main",children:["#",S]},S))}),e.jsx("pre",{className:"p-3.5 rounded-xl bg-slate-950 text-slate-100 dark:bg-black/90 font-mono text-2xs overflow-x-auto border border-slate-800 shadow-inner",children:e.jsx("code",{children:y.content})})]}),e.jsxs("div",{className:"px-4 py-2 bg-surface-secondary/40 border-t border-theme flex items-center justify-between text-2xs text-muted",children:[e.jsx("span",{children:y.category==="exemplary"?"🌟 步骤严谨规范,适合作为全班示范":y.category==="typical_error"?"⚠️ 存在临界条件缺失,建议重点剖析":"💡 包含创新视角,可启发多元思维"}),e.jsx("span",{className:"font-mono text-3xs",children:y.source})]})]},y.studentId)})})]})]})]})}):null};class Ze{constructor(){this.mode="CLOUD_ONLINE",this.isInternetReachable=!0,this.isLocalServerReachable=!0,this.latencyMs=5,this.lastPingTimestamp=Date.now(),this.offlineEvents=[],this.listeners=new Set,this.pingIntervalTimer=null,this.syncFlushHandler=null,this.initBrowserListeners()}static{this.instance=null}static getInstance(){return Ze.instance||(Ze.instance=new Ze),Ze.instance}initBrowserListeners(){typeof window<"u"&&(window.addEventListener("online",()=>this.handleBrowserOnlineStatus(!0)),window.addEventListener("offline",()=>this.handleBrowserOnlineStatus(!1)))}startHeartbeat(i=1e4){this.pingIntervalTimer||(this.pingIntervalTimer=setInterval(()=>{this.checkConnectivity()},i))}stopHeartbeat(){this.pingIntervalTimer&&(clearInterval(this.pingIntervalTimer),this.pingIntervalTimer=null)}async checkConnectivity(){const i=Date.now();try{const o=await fetch("/api/health",{method:"GET",cache:"no-store"}).catch(()=>null);this.isLocalServerReachable=!!(o&&o.ok),this.latencyMs=Date.now()-i;const a=typeof navigator<"u"?navigator.onLine:!0;if(!this.isLocalServerReachable&&!a)this.mode="OFFLINE_DISCONNECTED",this.isInternetReachable=!1;else if(this.isLocalServerReachable&&!a)this.mode="EDGE_LAN_ONLY",this.isInternetReachable=!1;else{const t=this.mode;this.mode="CLOUD_ONLINE",this.isInternetReachable=!0,t==="EDGE_LAN_ONLY"&&this.offlineEvents.length>0&&this.flushOfflineJournal()}}catch{this.isLocalServerReachable=!1,this.mode="OFFLINE_DISCONNECTED"}this.lastPingTimestamp=Date.now();const n=this.getState();return this.notifyListeners(n),n}async setSimulatedState(i,n){const o=this.mode;this.isInternetReachable=i,this.isLocalServerReachable=n,!n&&!i?this.mode="OFFLINE_DISCONNECTED":n&&!i?this.mode="EDGE_LAN_ONLY":(this.mode="CLOUD_ONLINE",o==="EDGE_LAN_ONLY"&&this.offlineEvents.length>0&&await this.flushOfflineJournal()),this.lastPingTimestamp=Date.now(),this.notifyListeners(this.getState())}recordOfflineEvent(i,n){const o={id:`evt-${Date.now()}-${Math.random().toString(36).substring(2,7)}`,eventType:i,payload:n,timestamp:Date.now(),synced:!1};return this.offlineEvents.push(o),this.notifyListeners(this.getState()),o}async flushOfflineJournal(){if(this.offlineEvents.length===0)return!0;if(this.syncFlushHandler){if(await this.syncFlushHandler([...this.offlineEvents]))return this.offlineEvents=[],this.notifyListeners(this.getState()),!0}else return this.offlineEvents=[],this.notifyListeners(this.getState()),!0;return!1}setSyncFlushHandler(i){this.syncFlushHandler=i}handleBrowserOnlineStatus(i){i?(this.isInternetReachable=!0,this.mode="CLOUD_ONLINE",this.flushOfflineJournal()):(this.isInternetReachable=!1,this.isLocalServerReachable?this.mode="EDGE_LAN_ONLY":this.mode="OFFLINE_DISCONNECTED"),this.notifyListeners(this.getState())}getState(){return{mode:this.mode,isInternetReachable:this.isInternetReachable,isLocalServerReachable:this.isLocalServerReachable,latencyMs:this.latencyMs,lastPingTimestamp:this.lastPingTimestamp,bufferedOfflineEventsCount:this.offlineEvents.length}}subscribe(i){return this.listeners.add(i),i(this.getState()),()=>{this.listeners.delete(i)}}notifyListeners(i){this.listeners.forEach(n=>{try{n(i)}catch(o){console.error("Error in network state listener:",o)}})}}const ts=Ze.getInstance();function Xn({className:s="",onRefreshManual:i}){const[n,o]=l.useState(ts.getState()),[a,t]=l.useState(!1),[r,c]=l.useState(!1);l.useEffect(()=>{const v=ts.subscribe(N=>{o(N)});return()=>v()},[]);const x=async()=>{c(!0),await ts.checkConnectivity(),i&&i(),setTimeout(()=>c(!1),400)},d=n.mode==="CLOUD_ONLINE",m=n.mode==="EDGE_LAN_ONLY",u=n.mode==="OFFLINE_DISCONNECTED";return e.jsxs("div",{className:`relative inline-flex items-center ${s}`,children:[e.jsxs("button",{type:"button",onClick:()=>t(!a),className:`px-2.5 py-1 rounded-full text-[11px] font-bold border transition-all flex items-center gap-1.5 cursor-pointer shadow-2xs ${d?"bg-emerald-500/10 text-emerald-600 dark:text-emerald-400 border-emerald-500/30 hover:bg-emerald-500/20":m?"bg-amber-500/15 text-amber-700 dark:text-amber-400 border-amber-500/40 animate-pulse hover:bg-amber-500/25":"bg-rose-500/15 text-rose-600 border-rose-500/30 hover:bg-rose-500/25"}`,title:"点击查看网络与边缘局域网状态",children:[e.jsx("span",{className:`w-2 h-2 rounded-full shrink-0 ${d?"bg-emerald-500":m?"bg-amber-500":"bg-rose-500"}`}),d&&e.jsx(Mt,{size:12}),m&&e.jsx(bs,{size:12}),u&&e.jsx(fs,{size:12}),e.jsx("span",{className:"hidden sm:inline",children:d?"云端在线":m?"局域网高可用模式":"网络已断开"}),m&&n.bufferedOfflineEventsCount>0&&e.jsxs("span",{className:"px-1 py-0.2 bg-amber-500/30 text-amber-900 dark:text-amber-200 rounded text-[9px] font-mono",children:[n.bufferedOfflineEventsCount," 待同步"]})]}),a&&e.jsxs("div",{className:"absolute right-0 top-full mt-2 w-72 bg-surface border border-theme rounded-2xl p-4 shadow-xl z-50 flex flex-col gap-3 animate-in fade-in duration-150",children:[e.jsxs("div",{className:"flex items-center justify-between border-b border-theme pb-2",children:[e.jsx("span",{className:"text-xs font-black text-main",children:"网络拓扑与边缘节点监控"}),e.jsx("button",{type:"button",onClick:x,disabled:r,className:"text-muted hover:text-main p-1 rounded-lg hover:bg-surface-secondary cursor-pointer",title:"立即检测网络连通性",children:e.jsx($e,{size:12,className:r?"animate-spin":""})})]}),e.jsxs("div",{className:"flex flex-col gap-2 text-xs",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{className:"text-muted",children:"当前运行模式"}),e.jsx("span",{className:"font-bold text-main",children:d?"全功能云端在线":m?"局域网 Mesh 离线直连":"无网络连接"})]}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{className:"text-muted",children:"智慧教室本地主机"}),e.jsx("span",{className:`font-mono font-bold ${n.isLocalServerReachable?"text-emerald-600":"text-rose-500"}`,children:n.isLocalServerReachable?"✓ 正常响应":"✗ 未响应"})]}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{className:"text-muted",children:"校园外网云端连接"}),e.jsx("span",{className:`font-mono font-bold ${n.isInternetReachable?"text-emerald-600":"text-amber-600"}`,children:n.isInternetReachable?"✓ 连通":"离线 (自动降级)"})]}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{className:"text-muted",children:"待同步学情日志"}),e.jsxs("span",{className:"font-mono text-main",children:[n.bufferedOfflineEventsCount," 条"]})]})]}),m&&e.jsxs("div",{className:"p-2.5 rounded-xl bg-amber-500/10 border border-amber-500/20 text-[11px] text-amber-800 dark:text-amber-300 flex items-start gap-2",children:[e.jsx(as,{size:14,className:"shrink-0 mt-0.5"}),e.jsx("span",{children:"外网中断不影响当堂授课:师生抢答、白板同步、投屏与测验均基于本地 Socket.IO 正常运转,待网络恢复后自动完成云端数据对账。"})]}),e.jsx("div",{className:"flex justify-end pt-1",children:e.jsx("button",{type:"button",onClick:()=>t(!1),className:"text-[11px] text-primary-theme font-bold hover:underline cursor-pointer",children:"收起详情"})})]})]})}class Xe{constructor(){this.listeners=new Set,this.deviceBindings=new Map,this.isSimulationMode=!1,this.initKeyboardSimulationListener()}static{this.instance=null}static getInstance(){return Xe.instance||(Xe.instance=new Xe),Xe.instance}bindDeviceToStudent(i,n,o,a){this.deviceBindings.set(i,{studentId:n,studentNumber:o,studentName:a})}getDeviceBinding(i){return this.deviceBindings.get(i)}getAllBindings(){return Array.from(this.deviceBindings.entries()).map(([i,n])=>({deviceId:i,...n}))}dispatchRawInput(i){let n="CLICKER_SUBMIT_OPTION";if(i.deviceType==="RF_CLICKER"){const t=String(i.keyOrAction).toUpperCase();["A","B","C","D","E","F","TRUE","FALSE"].includes(t)?n="CLICKER_SUBMIT_OPTION":(t==="BUZZER"||t==="OK"||t==="ENTER")&&(n="CLICKER_BUZZER_PRESS")}else if(i.deviceType==="PRESENTER_PEN"){const t=String(i.keyOrAction).toLowerCase();t==="pagedown"||t==="right"||t==="next"?n="PRESENTER_NEXT_PAGE":t==="pageup"||t==="left"||t==="prev"?n="PRESENTER_PREV_PAGE":t==="laser"||t==="b"?n="PRESENTER_LASER_TOGGLE":(t==="blank"||t==="period"||t===".")&&(n="PRESENTER_BLANK_SCREEN")}else i.deviceType==="DIGITAL_TABLET"&&(n="TABLET_DRAW_STROKE");const o=this.deviceBindings.get(i.deviceId),a={deviceId:i.deviceId,deviceType:i.deviceType,action:n,studentId:o?.studentId,studentNumber:o?.studentNumber,value:i.value??i.keyOrAction,rawPayload:i,timestamp:Date.now()};return this.notify(a),a}enableKeyboardSimulation(i=!0){this.isSimulationMode=i}initKeyboardSimulationListener(){typeof window>"u"||window.addEventListener("keydown",i=>{this.isSimulationMode&&(i.key==="PageDown"?this.dispatchRawInput({deviceId:"virtual-presenter-01",deviceType:"PRESENTER_PEN",keyOrAction:"next"}):i.key==="PageUp"&&this.dispatchRawInput({deviceId:"virtual-presenter-01",deviceType:"PRESENTER_PEN",keyOrAction:"prev"}))})}subscribe(i){return this.listeners.add(i),()=>{this.listeners.delete(i)}}notify(i){this.listeners.forEach(n=>{try{n(i)}catch(o){console.error("Error executing hardware event listener:",o)}})}}const Ct=Xe.getInstance();function eo({isOpen:s,onClose:i,addToast:n}){const[o,a]=l.useState([]),[t,r]=l.useState(!0);if(l.useEffect(()=>{Ct.enableKeyboardSimulation(t);const d=Ct.subscribe(m=>{a(u=>[m,...u].slice(0,20))});return()=>d()},[t]),!s)return null;const c=d=>{Ct.dispatchRawInput({deviceId:"clicker-rf-001",deviceType:"RF_CLICKER",keyOrAction:d}),n("模拟硬件触发",`物理答题器发送选项: ${d}`,"info")},x=d=>{Ct.dispatchRawInput({deviceId:"presenter-pen-01",deviceType:"PRESENTER_PEN",keyOrAction:d}),n("模拟翻页笔",`触发翻页动作: ${d}`,"info")};return e.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center p-4 bg-black/60 backdrop-blur-xs animate-in fade-in duration-200",children:e.jsxs("div",{className:"bg-surface border border-theme rounded-2xl max-w-2xl w-full p-6 shadow-2xl flex flex-col gap-4 max-h-[85vh] overflow-y-auto",children:[e.jsxs("div",{className:"flex items-center justify-between border-b border-theme pb-3",children:[e.jsxs("div",{className:"flex items-center gap-2.5",children:[e.jsx("div",{className:"w-8 h-8 rounded-xl bg-primary-theme/10 text-primary-theme flex items-center justify-center",children:e.jsx(Lt,{size:18})}),e.jsxs("div",{children:[e.jsx("h3",{className:"text-sm font-black text-main",children:"硬件教具生态标准化网关 (Hardware Bridge)"}),e.jsx("p",{className:"text-xs text-muted",children:"RF433/2.4G 物理答题器、数位板与翻页笔统一映射"})]})]}),e.jsx("button",{type:"button",onClick:i,className:"p-1 rounded-lg text-muted hover:text-main hover:bg-surface-secondary cursor-pointer",children:e.jsx(be,{size:18})})]}),e.jsxs("div",{className:"p-4 rounded-xl bg-surface-secondary border border-theme flex flex-col gap-3",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("span",{className:"text-xs font-bold text-main flex items-center gap-1.5",children:[e.jsx(It,{size:14,className:"text-emerald-500 animate-pulse"}),e.jsx("span",{children:"硬件按键自检与虚拟调试模拟器"})]}),e.jsxs("label",{className:"flex items-center gap-1.5 text-xs text-muted cursor-pointer",children:[e.jsx("input",{type:"checkbox",checked:t,onChange:d=>r(d.target.checked),className:"rounded text-primary-theme"}),e.jsx("span",{children:"启用键盘快捷键仿真"})]})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[e.jsxs("div",{className:"p-3 rounded-lg bg-surface border border-theme/80 flex flex-col gap-2",children:[e.jsx("span",{className:"text-[11px] font-bold text-muted",children:"模拟学生物理答题器"}),e.jsxs("div",{className:"flex items-center gap-1.5 flex-wrap",children:[["A","B","C","D"].map(d=>e.jsxs("button",{type:"button",onClick:()=>c(d),className:"px-2.5 py-1 text-xs font-black rounded-lg bg-primary-theme/10 hover:bg-primary-theme hover:text-white text-primary-theme border border-primary-theme/20 transition-all cursor-pointer",children:["按键 ",d]},d)),e.jsx("button",{type:"button",onClick:()=>c("BUZZER"),className:"px-2.5 py-1 text-xs font-black rounded-lg bg-amber-500/10 hover:bg-amber-500 hover:text-white text-amber-600 border border-amber-500/20 transition-all cursor-pointer",children:"抢答键"})]})]}),e.jsxs("div",{className:"p-3 rounded-lg bg-surface border border-theme/80 flex flex-col gap-2",children:[e.jsx("span",{className:"text-[11px] font-bold text-muted",children:"模拟教师无线翻页笔"}),e.jsxs("div",{className:"flex items-center gap-1.5 flex-wrap",children:[e.jsx("button",{type:"button",onClick:()=>x("prev"),className:"px-2.5 py-1 text-xs font-bold rounded-lg border border-theme hover:bg-surface-secondary text-main cursor-pointer",children:"◀ 上一页"}),e.jsx("button",{type:"button",onClick:()=>x("next"),className:"px-2.5 py-1 text-xs font-bold rounded-lg border border-theme hover:bg-surface-secondary text-main cursor-pointer",children:"下一页 ▶"}),e.jsx("button",{type:"button",onClick:()=>x("laser"),className:"px-2.5 py-1 text-xs font-bold rounded-lg bg-rose-500/10 text-rose-600 hover:bg-rose-500 hover:text-white border border-rose-500/20 cursor-pointer",children:"🔴 激光笔"})]})]})]})]}),e.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsxs("div",{className:"flex items-center justify-between text-xs font-bold text-muted",children:[e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(va,{size:12}),e.jsx("span",{children:"底层硬件事件标准化总线监控"})]}),e.jsxs("span",{children:[o.length," 条已捕获事件"]})]}),e.jsx("div",{className:"p-2.5 rounded-xl bg-black/80 font-mono text-[11px] text-emerald-400 h-40 overflow-y-auto flex flex-col gap-1 border border-theme",children:o.length===0?e.jsx("span",{className:"text-zinc-500 italic p-2",children:"等待硬件信号接入中..."}):o.map((d,m)=>e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-zinc-500",children:new Date(d.timestamp).toLocaleTimeString()}),e.jsxs("span",{className:"text-amber-300",children:["[",d.deviceType,"]"]}),e.jsx("span",{className:"text-sky-300",children:d.action}),e.jsxs("span",{className:"text-white",children:["值: ",String(d.value)]}),d.studentNumber&&e.jsxs("span",{className:"text-zinc-400",children:["(学号:",d.studentNumber,")"]})]},m))})]}),e.jsx("div",{className:"flex justify-end pt-2 border-t border-theme",children:e.jsx("button",{type:"button",onClick:i,className:"px-4 py-2 bg-surface hover:bg-surface-secondary border border-theme text-main rounded-xl text-xs font-bold transition-colors cursor-pointer",children:"完成并关闭"})})]})})}const At=[{id:"MACRO_BURST_QUIZ",name:"3分钟随堂突击检测",description:"自动触发:全屏锁定学生机 ➔ 推送检测练习 ➔ 启动倒计时 ➔ 切大屏动态榜 ➔ 自动收卷",icon:"⚡",category:"evaluation",estimatedSeconds:180,steps:[{id:"step-1",title:"广播随堂检测就绪指令",description:"向全班学生机发送高优先级通知,预热随堂检测环境。",actionType:"BROADCAST_NOTIFICATION",payload:{message:"随堂突击检测开始,请迅速就位作答!"}},{id:"step-2",title:"锁定学生端全屏作答",description:"学生机屏幕自动进入全屏防切屏作答模式。",actionType:"LOCK_STUDENT_SCREENS",payload:{locked:!0,reason:"burst_quiz"}},{id:"step-3",title:"启动 180 秒倒计时总线",description:"下发全班倒计时并在大屏与学生端同步显示。",actionType:"START_COUNTDOWN",payload:{durationSeconds:180}},{id:"step-4",title:"大屏切至 Top Performers 动态榜",description:"主屏展示实时答题进度与排行榜,营造积极竞争氛围。",actionType:"NAVIGATE_VIEW",payload:{target:"top_performers_leaderboard"}},{id:"step-5",title:"倒计时结束自动收卷与正答分析",description:"时间截止后自动提交所有未完成答卷并弹出正答率简报。",actionType:"AUTO_COLLECT_QUIZ",payload:{autoSubmit:!0}}]},{id:"MACRO_BREAKOUT_SYNC",name:"小组探究收口与画廊互评",description:"自动触发:广播讨论结束 ➔ 冻结小组画布 ➔ 弹出画廊互评展台 ➔ 开启 2 分钟点赞送花",icon:"🎨",category:"collaboration",estimatedSeconds:120,steps:[{id:"step-1",title:"广播探究收口指令",description:"提示各小组停笔,准备进行班级成果互评。",actionType:"BROADCAST_NOTIFICATION",payload:{message:"小组探究时间到,准备进入画廊互评!"}},{id:"step-2",title:"冻结子画布编辑并同步成果",description:"将各小组白板切至只读状态并向服务器提交最新画布快照。",actionType:"LOCK_STUDENT_SCREENS",payload:{subCanvasReadOnly:!0}},{id:"step-3",title:"弹出全班画廊互评展台 (Gallery Walk)",description:"主屏 4~6 组探究成果并排陈列,学生端进入互评送花界面。",actionType:"OPEN_GALLERY_WALK",payload:{durationSeconds:120}}]},{id:"MACRO_FOCUS_SILENCE",name:"全员专注静默与黑板聚焦",description:"自动触发:全屏锁定学生机画面 ➔ 提示视线回黑板 ➔ 教师白板高亮放大解题焦点",icon:"🎯",category:"focus",estimatedSeconds:30,steps:[{id:"step-1",title:"全员视线聚焦回黑板提示",description:"向全班机房学生下发视线回拢广播。",actionType:"BROADCAST_NOTIFICATION",payload:{message:"请同学们暂停操作,视线聚焦到主屏黑板!"}},{id:"step-2",title:"全屏遮罩锁定学生终端操作",description:"防止学生分心,强制统一课堂视线焦点。",actionType:"LOCK_STUDENT_SCREENS",payload:{blackout:!0}},{id:"step-3",title:"教师白板高亮核心推导区域",description:"白板自动居中并放大关键板书。",actionType:"HIGHLIGHT_WHITEBOARD",payload:{zoomScale:1.25}}]}];class et{constructor(){this.currentMacro=null,this.state={macroId:"MACRO_BURST_QUIZ",status:"idle",currentStepIndex:0,progressPercent:0,stepStartTime:0,totalSteps:0,logMessages:[]},this.listeners=new Set,this.stepExecutor=null,this.isAborted=!1}static{this.instance=null}static getInstance(){return et.instance||(et.instance=new et),et.instance}setStepExecutor(i){this.stepExecutor=i}getPresetById(i){return At.find(n=>n.id===i)}async runMacro(i){const n=this.getPresetById(i);if(!n)return!1;this.currentMacro=n,this.isAborted=!1,this.state={macroId:i,status:"running",currentStepIndex:0,progressPercent:0,stepStartTime:Date.now(),totalSteps:n.steps.length,logMessages:[`[${new Date().toLocaleTimeString()}] 启动宏动作流: ${n.name}`]},this.notify();for(let o=0;o<n.steps.length;o++){if(this.isAborted)return this.state.status="aborted",this.state.logMessages.push(`[${new Date().toLocaleTimeString()}] 宏动作流被教师手动中止`),this.notify(),!1;const a=n.steps[o];if(this.state.currentStepIndex=o,this.state.progressPercent=Math.round((o+1)/n.steps.length*100),this.state.logMessages.push(`[${new Date().toLocaleTimeString()}] 执行步骤 ${o+1}/${n.steps.length}: ${a.title}`),this.notify(),this.stepExecutor)try{await this.stepExecutor(a)}catch(t){this.state.logMessages.push(`[${new Date().toLocaleTimeString()}] 步骤执行异常: ${t?.message}`)}}return this.state.status="completed",this.state.logMessages.push(`[${new Date().toLocaleTimeString()}] 宏动作流编排全部执行完成 ✓`),this.notify(),!0}abortCurrentMacro(){this.state.status==="running"&&(this.isAborted=!0,this.state.status="aborted",this.notify())}reset(){this.isAborted=!1,this.currentMacro=null,this.state={macroId:"MACRO_BURST_QUIZ",status:"idle",currentStepIndex:0,progressPercent:0,stepStartTime:0,totalSteps:0,logMessages:[]},this.notify()}getState(){return{...this.state}}subscribe(i){return this.listeners.add(i),i(this.getState()),()=>{this.listeners.delete(i)}}notify(){const i=this.getState();this.listeners.forEach(n=>{try{n(i)}catch(o){console.error("Error in macro state listener:",o)}})}}const $t=et.getInstance();function to({isOpen:s,onClose:i,addToast:n}){const[o,a]=l.useState("MACRO_BURST_QUIZ"),[t,r]=l.useState($t.getState());if(l.useEffect(()=>{const u=$t.subscribe(v=>{r(v)});return()=>u()},[]),!s)return null;const c=At.find(u=>u.id===o)||At[0],x=t.status==="running",d=async()=>{n("教学动作流启动",`正在执行宏动作: ${c.name}`,"info"),await $t.runMacro(o)&&n("✓ 教学宏动作执行完成",`${c.name} 所有流水线步骤已全部落实。`,"success")},m=()=>{$t.abortCurrentMacro(),n("已中止宏动作","当前流水线操作已停止。","warning")};return e.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center p-4 bg-black/60 backdrop-blur-xs animate-in fade-in duration-200",children:e.jsxs("div",{className:"bg-surface border border-theme rounded-2xl max-w-2xl w-full p-6 shadow-2xl flex flex-col gap-4 max-h-[90vh] overflow-y-auto",children:[e.jsxs("div",{className:"flex items-center justify-between border-b border-theme pb-3",children:[e.jsxs("div",{className:"flex items-center gap-2.5",children:[e.jsx("div",{className:"w-8 h-8 rounded-xl bg-primary-theme/10 text-primary-theme flex items-center justify-center font-bold",children:e.jsx(fe,{size:18})}),e.jsxs("div",{children:[e.jsxs("h3",{className:"text-sm font-black text-main flex items-center gap-2",children:[e.jsx("span",{children:"课堂宏动作编排中枢 (Classroom Action Macros)"}),e.jsx("span",{className:"text-[10px] px-2 py-0.5 rounded-full font-bold bg-primary-theme/10 text-primary-theme",children:"一键教学流"})]}),e.jsx("p",{className:"text-xs text-muted",children:"自定义与预设一键动作流:倒计时、锁屏推题、切榜单无缝联动"})]})]}),e.jsx("button",{type:"button",onClick:i,className:"p-1 rounded-lg text-muted hover:text-main hover:bg-surface-secondary cursor-pointer",children:e.jsx(be,{size:18})})]}),e.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-3 gap-2.5",children:At.map(u=>{const v=u.id===o;return e.jsxs("button",{type:"button",disabled:x,onClick:()=>a(u.id),className:`p-3 rounded-xl border text-left flex flex-col justify-between gap-2 transition-all cursor-pointer ${v?"border-primary-theme bg-primary-theme/5 ring-1 ring-primary-theme shadow-xs":"border-theme bg-surface hover:bg-surface-secondary/60"} disabled:opacity-50`,children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{className:"text-xl",children:u.icon}),e.jsxs("span",{className:"text-[10px] font-mono text-muted flex items-center gap-1",children:[e.jsx(Le,{size:10}),e.jsxs("span",{children:["~",u.estimatedSeconds,"s"]})]})]}),e.jsxs("div",{children:[e.jsx("h4",{className:"text-xs font-black text-main",children:u.name}),e.jsx("p",{className:"text-[10px] text-muted line-clamp-2 mt-0.5",children:u.description})]})]},u.id)})}),e.jsxs("div",{className:"p-4 rounded-xl bg-surface-secondary border border-theme flex flex-col gap-3",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("span",{className:"text-xs font-bold text-main flex items-center gap-1.5",children:[e.jsx(pt,{size:14,className:"text-primary-theme"}),e.jsxs("span",{children:["动作流水线拆解 (",c.steps.length," 个原子动作)"]})]}),x&&e.jsxs("span",{className:"text-xs font-mono font-bold text-primary-theme animate-pulse",children:["执行中 · ",t.progressPercent,"%"]})]}),e.jsx("div",{className:"flex flex-col gap-2",children:c.steps.map((u,v)=>{const N=x&&v<t.currentStepIndex,g=x&&v===t.currentStepIndex;return e.jsxs("div",{className:`p-2.5 rounded-lg border text-xs flex items-center justify-between transition-all ${g?"border-primary-theme bg-primary-theme/10 text-main font-bold shadow-2xs":N?"border-emerald-500/30 bg-emerald-500/5 text-muted":"border-theme bg-surface text-muted"}`,children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:`w-5 h-5 rounded-full flex items-center justify-center text-[10px] font-mono font-bold ${g?"bg-primary-theme text-white animate-spin":N?"bg-emerald-500 text-white":"bg-surface-secondary text-muted"}`,children:N?"✓":v+1}),e.jsxs("div",{children:[e.jsx("div",{className:"text-main font-bold",children:u.title}),e.jsx("div",{className:"text-[10px] text-muted",children:u.description})]})]}),e.jsx("span",{className:"text-[10px] font-mono px-1.5 py-0.5 rounded bg-surface border border-theme",children:u.actionType})]},u.id)})})]}),t.logMessages.length>0&&e.jsx("div",{className:"p-2.5 rounded-xl bg-black/80 font-mono text-[11px] text-sky-400 h-24 overflow-y-auto border border-theme flex flex-col gap-0.5",children:t.logMessages.map((u,v)=>e.jsx("div",{children:u},v))}),e.jsxs("div",{className:"flex items-center justify-between pt-2 border-t border-theme",children:[e.jsx("button",{type:"button",onClick:i,className:"px-3 py-1.5 bg-surface hover:bg-surface-secondary border border-theme text-main rounded-xl text-xs font-bold transition-colors cursor-pointer",children:"关闭窗口"}),e.jsx("div",{className:"flex items-center gap-2",children:x?e.jsxs("button",{type:"button",id:"btn-abort-macro",onClick:m,className:"px-4 py-2 bg-rose-600 hover:bg-rose-700 text-white rounded-xl text-xs font-bold flex items-center gap-1.5 transition-colors cursor-pointer",children:[e.jsx(js,{size:13}),e.jsx("span",{children:"中止执行"})]}):e.jsxs("button",{type:"button",id:"btn-execute-macro",onClick:d,className:"px-4 py-2 bg-primary-theme hover:bg-primary-theme-hover text-white rounded-xl text-xs font-bold flex items-center gap-1.5 transition-colors cursor-pointer shadow-xs",children:[e.jsx(cs,{size:13}),e.jsx("span",{children:"立即一键执行宏动作"})]})})]})]})})}const so=({lang:s,addToast:i,selectedLesson:n,lessonTitle:o,className:a,liveClassSelectedClassId:t,classroomStage:r,sessionStartedAt:c,students:x,liveData:d,isGrowthProfileOpen:m,onCloseGrowthProfile:u,growthProfileStudentId:v,isPeerReviewShowcaseOpen:N,onClosePeerReviewShowcase:g,onAdvanceToStage3:p,peerReviewData:j,onAutoAssignPeerReview:k,autoAssigning:w,isParentNotificationOpen:f,onCloseParentNotification:b,isMasteryPredictionOpen:z,onCloseMasteryPrediction:_,isDiagnosticCenterOpen:C,onCloseDiagnosticCenter:B,isGroupCollabOpen:R,onCloseGroupCollab:J,isShowcaseDiffOpen:O,onCloseShowcaseDiff:H,isMacroRunnerOpen:ee,onCloseMacroRunner:se,isHardwareSettingsOpen:I,onCloseHardwareSettings:V})=>{const P=Date.now();return e.jsxs(e.Fragment,{children:[e.jsx(Ns,{isOpen:m,onClose:u,student:v?(()=>{const y=x.find(M=>M.id===v);return y?{...y,name:y.name??y.student_number??y.id}:null})():null,lessonId:n,classId:t,lang:s,addToast:i}),e.jsx(gr,{isOpen:N,onClose:g,lessonTitle:o,addToast:i,onAdvanceToStage3:p,workA:j.workA,workB:j.workB,matchingItems:j.matchingItems,badges:j.badges,podiumStudents:j.podiumStudents,danmaku:j.danmaku,reactions:j.reactions,rubricDimensions:j.rubricDimensions,reviewProgress:j.reviewProgress,onAutoAssign:k,autoAssigning:w}),e.jsx(In,{isOpen:f,onClose:b,snapshot:{lessonTitle:o,lessonId:n,className:a,classId:t,startTimeMs:c??P,endTimeMs:P,totalStudents:x.length,onlineStudentIds:d.studentMetrics.filter(y=>y.online).map(y=>y.studentId),highlights:d.highlights,stages:d.stages,students:d.studentMetrics.map(y=>({id:y.studentId,name:y.studentName,student_number:y.studentNumber,participationScore:y.participationScore,quizScore:y.quizScore,behaviorTags:y.behaviorTags}))},addToast:i,lang:s}),e.jsx(On,{isOpen:z,onClose:_,lessonId:n,lessonTitle:o,currentStageName:r??"IN_CLASS_TEACHING",elapsedMin:d.elapsedMin,plannedTotalMin:d.plannedTotalMin,studentSnapshots:d.studentMetrics.map(y=>({studentId:y.studentId,studentName:y.studentName,participationScore:y.participationScore,quizScore:y.quizScore,paceIndicator:y.progressPercent>=80?"fast":y.progressPercent>=50?"on-track":y.progressPercent>0?"slow":"stalled",behaviorSignals:y.behaviorTags})),addToast:i,lang:s}),e.jsx(Bn,{isOpen:C,onClose:B,addToast:i,lang:s}),e.jsx(Jn,{isOpen:R,onClose:J,lessonId:n,classId:t,availableStudents:x.map(y=>({id:y.id,name:y.name??y.student_number??y.id})),addToast:i,lang:s}),e.jsx(Zn,{isOpen:!!O,onClose:H??(()=>{}),lessonTitle:o,availableStudents:x.map(y=>({id:y.id,name:y.name??y.student_number??y.id,seatNumber:y.seat_number??y.seatNumber})),addToast:i,lang:s}),e.jsx(to,{isOpen:!!ee,onClose:se??(()=>{}),addToast:i}),e.jsx(eo,{isOpen:!!I,onClose:V??(()=>{}),addToast:i})]})},Vs={workA:null,workB:null,matchingItems:[],badges:[],podiumStudents:[],danmaku:[],reactions:[],rubricDimensions:[],reviewProgress:{completed:0,total:0},fromServer:!1};function ro({lessonId:s,enabled:i,attempts:n,studentCount:o,addToast:a,lang:t="zh"}){const[r,c]=l.useState([]),[x,d]=l.useState(null),[m,u]=l.useState(!1);l.useEffect(()=>{if(!s){c([]);return}let p=!0;const j=async()=>{try{const w=await fetch(`/api/classroom/sessions/${s}/top-performers?limit=50`);if(!w.ok||!p)return;const f=await w.json(),b=Array.isArray(f?.topPerformers)?f.topPerformers:[];if(!p)return;c(b.map(z=>({studentId:String(z.studentId??""),studentName:String(z.studentName??""),cumulativeScore:Number(z.cumulativeScore)||0,accuracy:Number(z.accuracy)||0})))}catch{}};j();const k=setInterval(()=>void j(),2e4);return()=>{p=!1,clearInterval(k)}},[s]);const v=l.useCallback(async()=>{if(!s){d(null);return}try{const p=await fetch(`/api/classroom/sessions/${s}/peer-review`);p.ok&&d(await p.json())}catch{}},[s]);l.useEffect(()=>{if(!i)return;v();const p=setInterval(()=>void v(),5e3);return()=>clearInterval(p)},[i,v]);const N=l.useCallback(async()=>{if(s){u(!0);try{const p=await fetch(`/api/classroom/sessions/${s}/peer-review/auto-assign`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({perStudent:2})}),j=await p.json().catch(()=>null);if(!p.ok){a?.(t==="zh"?"分配失败":"Assign failed",j?.error??`HTTP ${p.status}`,"error");return}a?.(t==="zh"?"✅ 互评已分配":"✅ Peer reviews assigned",t==="zh"?`${j.works} 份作品 · 生成 ${j.tasks} 条任务(口径:${j.scope==="lesson"?"本课节课件":"本班全部"})`:`${j.tasks} tasks created`,"success"),await v()}finally{u(!1)}}},[s,a,t,v]);return{data:l.useMemo(()=>{if(x?.matchingItems?.length||x?.podiumStudents?.length)return{...Vs,matchingItems:x.matchingItems??[],badges:x.badges??[],podiumStudents:x.podiumStudents??[],danmaku:x.danmaku??[],reactions:x.reactions??[],rubricDimensions:x.dimensions??[],reviewProgress:x.progress??{completed:0,total:0},fromServer:!0};const p=n.filter(f=>f?.studentId&&f.studentId!=="teacher"&&f.studentId!=="guest"),j=[...p].sort((f,b)=>(Number(b.score)||0)-(Number(f.score)||0)),k=(f,b)=>{if(!f)return null;const z=String(f.studentName||f.studentId),_=typeof f.score=="number"?f.score:null;return{id:String(f.attemptId??`work-${b}`),slot:b,studentName:z,studentInitial:z.slice(0,1),workTitle:`${z} · ${f.coursewareName??"课件作品"}`,workSubtitle:_===null?f.status==="completed"?"已完成提交":"作答中":`得分 ${_}${typeof f.completion=="number"?` · 完成度 ${Math.round(f.completion*100)}%`:""}`,badges:[]}},w=r.slice(0,3).map((f,b)=>({rank:b+1,name:f.studentName,votes:f.cumulativeScore,workTitle:`${f.accuracy}% 正确率`,honorTitle:b===0?"本节最高分":"优秀表现",rankBadgeClass:b===0?"bg-[#ffb95f] text-[#2a1700]":"bg-[#171f33] text-[#908fa0]",tagBadgeClass:"bg-[#ca8100]/20 text-[#ffb95f]"}));return{...Vs,workA:k(j[0],"A"),workB:k(j[1],"B"),podiumStudents:w,reviewProgress:{completed:p.filter(f=>f.status==="completed").length,total:o}}},[x,n,r,o]),topPerformers:r,autoAssigning:m,autoAssign:N,refresh:v}}function fo({selectedLesson:s,setSelectedLesson:i,lessons:n,classes:o,students:a,plugins:t,lang:r,timelineSegments:c,activeSegmentId:x,setActiveSegmentId:d,liveClassSelectedClassId:m,setLiveClassSelectedClassId:u,liveClassIsActive:v,setLiveClassIsActive:N,liveClassTimeRemaining:g,setLiveClassTimeRemaining:p,liveClassFeed:j,setLiveClassFeed:k,liveClassAcknowledgedMap:w,setLiveClassAcknowledgedMap:f,elements:b,fetchElements:z,fetchStudents:_,addToast:C,onlineStudentIds:B,activeStudentLessons:R,liveClassStudentProgress:J,onPingStudent:O,onOpenCoursewareHub:H,activeRole:ee,setActiveRole:se,initialPortalOpen:I=!0}){const[V,P]=l.useState(!1),[y,M]=l.useState(!1),[$,S]=l.useState(null),E=He(h=>h.studentErrors),[Q,ie]=l.useState(!1),[pe,ce]=l.useState(null),[G,K]=l.useState([]),le=l.useRef(null),de=l.useRef({lesson:null,classId:null}),ue=l.useRef(null),[ve,A]=l.useState(!1),L=l.useRef(null),Y=l.useRef(null),[te,U]=l.useState(null),[Z,T]=l.useState("PRE_CLASS_READY"),[re,xe]=l.useState(void 0),[ye,ze]=l.useState(I),[we,We]=l.useState(!1),[Ke,W]=l.useState(null),[ae,ge]=l.useState(!1),[Ee,jt]=l.useState(!1),[yr,vs]=l.useState(!1),[vr,ws]=l.useState(!1),[wr,ks]=l.useState(!1),[kr,zs]=l.useState(!1),[zr,Ss]=l.useState(!1),[Sr,Cs]=l.useState(!1),[$s,As]=l.useState(null),[Ae,Cr]=l.useState([]);l.useEffect(()=>{if(!s){T("PRE_CLASS_READY"),As(null);return}let h=!0;T("PRE_CLASS_READY");const D=()=>{fetch(`/api/classroom/sessions/${s}`).then(q=>q.ok?q.json():null).then(q=>{if(!h||!q)return;q.hasActiveSession&&q.stage?T(q.stage):T("PRE_CLASS_READY");const ne=q.session?.started_at??q.startedAt??null;As(typeof ne=="number"?ne:null),Array.isArray(q.feedReplay)&&q.feedReplay.length>0&&k(me=>{const Ce=new Set(me.map(Qe=>Qe?.id).filter(Boolean)),Je=q.feedReplay.filter(Qe=>!Ce.has(Qe.id));return Je.length>0?[...Je,...me]:me});const X=q.session?.current_segment_id??null;X&&!x&&d(X);const he=Number(q.viewState?.currentPage);Number.isFinite(he)&&he>0&&xe(he)}).catch(()=>{})};D();const F=setInterval(D,15e3);return()=>{h=!1,clearInterval(F)}},[s]);const Bt=Mn({students:a,liveClassStudentProgress:J,onlineStudentIds:B,liveClassFeed:j,timelineSegments:c,attempts:Ae,sessionStartedAt:$s,classroomStage:Z,studentErrors:E}),{data:$r,topPerformers:Gt,autoAssigning:Ar,autoAssign:Er}=ro({lessonId:s,enabled:ae,attempts:Ae,studentCount:a.length,addToast:C,lang:r}),Tr=_t.useMemo(()=>{const h=new Map(Gt.map(F=>[F.studentId,F.cumulativeScore])),D=new Map(Gt.map(F=>[F.studentId,F.accuracy]));return Bt.studentMetrics.map((F,q)=>{const ne=D.get(F.studentId),X={};return typeof ne=="number"&&ne>0&&(X.logic=Math.round(ne)),typeof F.completion=="number"&&(X.engineering=Math.round(F.completion*100)),F.progressPercent>0&&(X.focus=F.progressPercent),{id:F.studentId,name:F.studentName,studentNo:F.studentNumber,groupName:a[q]?.group_name??void 0,seatNumber:a[q]?.seat_number??void 0,currentPoints:h.get(F.studentId)??0,focusScore:F.progressPercent,pickedCountToday:0,competencyScores:Object.keys(X).length>0?X:void 0}})},[Bt.studentMetrics,Gt,a]),Ue=async h=>{if(T(h),s)try{await fetch(`/api/classroom/sessions/${s}/stage`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({stage:h,classId:m})})}catch(D){console.error("Failed to update stage:",D)}},Pr=async({lessonId:h,classId:D,teachingModeId:F})=>{const q=await fetch(`/api/classroom/sessions/${h}/init`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({classId:D,teachingModeId:F??void 0})});if(!q.ok){const ne=await q.json().catch(()=>null);throw new Error(ne?.error||(r==="zh"?"初始化课堂会话失败":"Failed to initialise the classroom session"))}i(h),u(D),z(h),ze(!1)},[Ne,it]=l.useState("whiteboard"),[Nt,Es]=l.useState(!1),[Me,Wt]=l.useState(null),[Ut,yt]=l.useState(null),[Rr,Ts]=l.useState(!1),[vt,_r]=l.useState("all"),[Ht,Mr]=l.useState(""),lt=async()=>{Es(!0);try{const h=await fetch("/api/courseware/attempts");if(h.ok){const D=await h.json();Cr(D)}}catch(h){console.error("Failed to fetch attempts",h)}finally{Es(!1)}};l.useEffect(()=>{Ne==="submissions"&<()},[Ne]),l.useEffect(()=>{const h=Ds();return h.on("courseware-attempt-updated",()=>{lt()}),()=>{h.disconnect()}},[]);const Ps=async h=>{if(!s||!m){C(r==="zh"?"⚠️ 无法操作":"⚠️ Action Prevented",r==="zh"?"请先在顶部栏选择要绑定的课节和班级。":"Please select lesson and class first.","warning");return}try{const D=await fetch(`/api/courseware/attempts/${h}/promote`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({lessonId:s,classId:m})});if(D.ok){const F=await D.json();C(r==="zh"?"✓ 学习数据已保存":"✓ Data Recorded",r==="zh"?`成功将该数据存入数据库!分数: ${F.score},已同步更新至学生学习进度。`:`Successfully recorded submission! Score: ${F.score}.`,"success"),lt(),_&&_()}else{const F=await D.json();throw new Error(F.error||"Server error")}}catch(D){C(r==="zh"?"❌ 保存失败":"❌ Save Failed",D.message||"Error occurred while saving.","warning")}},Rs=async h=>{Wt(h),Ts(!0),yt(null);try{const D=await fetch(`/api/courseware/attempts/${h.attemptId}/raw`);if(D.ok){const F=await D.json();yt(F)}else yt({error:"Failed to load raw data"})}catch(D){yt({error:D.message||"Error loading data"})}finally{Ts(!1)}},Te=!!(m&&a.filter(h=>h.locked_lesson_id===s).length>0),_s=()=>{if(ue.current&&!ue.current.closed){ue.current.focus(),C(r==="zh"?"🎓 学生Tab已激活":"🎓 Student Tab Focused",r==="zh"?"已将联动学生端浏览器Tab置顶激活。":"Focused the student browser tab.","info");return}const h=a[0],D=h?.id||"student-demo",F=h?.name||(r==="zh"?"演示学生":"Demo Student"),q=s||"",ne=m||"",X=`${window.location.origin}${window.location.pathname}?mode=student_live&studentId=${encodeURIComponent(D)}&lessonId=${encodeURIComponent(q)}&classId=${encodeURIComponent(ne)}#/student_live`,he=window.open(X,"_blank");if(!he||he.closed){C(r==="zh"?"⚠️ 新Tab打开被拦截":"⚠️ Tab Open Blocked",r==="zh"?"请在浏览器设置中允许打开新标签页,以查看联动学生端。":"Please allow new tabs in browser settings.","warning");return}ue.current=he,A(!0);const me=setInterval(()=>{(!ue.current||ue.current.closed)&&(A(!1),ue.current=null,clearInterval(me))},1e3);C(r==="zh"?"🎓 学生端新Tab已打开":"🎓 Student Tab Opened",r==="zh"?`已在独立浏览器Tab中打开【${F}】学生端,教师端所有操作将实时同步!`:`Opened student tab for ${F}. Operations are syncing in real time!`,"success")};l.useEffect(()=>{const h=new Hr(qr,s,m);L.current=h;const D=h.onMessage(F=>{if(F.type==="STUDENT_HANDSHAKE_REQUEST")h.broadcastInitState({selectedLesson:s,activeSegmentId:x,activeTab:Ne==="submissions"||Ne==="top_performers"?"courseware":Ne,isClassLocked:Te,liveClassTimeRemaining:g,liveClassSelectedClassId:m,liveClassIsActive:v,fullscreenElementId:te});else if(F.type==="STUDENT_ACKNOWLEDGE_PICK"){const q=F.payload.studentId,ne=a.find(X=>X.id===q)?.name||q;f(X=>{const he=new Map(X);return he.set(q,!0),he}),k(X=>[{id:`feed-ack-${q}-${Date.now()}`,time:new Date().toLocaleTimeString(),type:"checkin",message:r==="zh"?`学生【${ne}】已在独立视窗中确认点名并举手答到!`:`Student "${ne}" acknowledged classroom pick from student window!`},...X]),C(r==="zh"?"🙋♂️ 学生已举手应答":"🙋♂️ Student Acknowledged",r==="zh"?`学生【${ne}】已在独立视窗中确认收到点名!`:`Student "${ne}" acknowledged!`,"success")}});return()=>{D(),h.destroy(),L.current=null}},[s,x,Ne,Te,g,m,v,a,r]),l.useEffect(()=>{L.current?.setLessonContext(s,m),L.current?.broadcastChangeLesson(s)},[s,m]),l.useEffect(()=>{L.current?.broadcastChangeSegment(x),s&&Y.current&&clearTimeout(Y.current),s&&(Y.current=setTimeout(()=>{fetch(`/api/classroom/sessions/${encodeURIComponent(s)}/view-state`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({activeSegmentId:x})}).catch(()=>{})},500))},[x,s]),l.useEffect(()=>{if(!s)return;const h=Ds(),D=F=>{!F||typeof F!="object"||k(q=>q.some(ne=>ne?.id&&ne.id===F.id)?q:[F,...q])};return h.on("classroom:feed_appended",D),()=>{typeof h.off=="function"?h.off("classroom:feed_appended",D):typeof h.removeListener=="function"&&h.removeListener("classroom:feed_appended",D)}},[s]),l.useEffect(()=>{L.current?.broadcastChangeTab(Ne==="submissions"||Ne==="top_performers"?"courseware":Ne)},[Ne]),l.useEffect(()=>{L.current?.broadcastLockClass(Te)},[Te]),l.useEffect(()=>{L.current?.broadcastSyncTimer(g,v)},[g,v]);const Ir=t.filter(h=>h.status==="active"),Dr=Array.from(new Map(Ir.flatMap(h=>{try{const D=typeof h.manifest=="string"?JSON.parse(h.manifest):h.manifest,F=D.classroomTools||[],q=D.contributes?.["classroom.tool"]||[];return[...F,...q].map(ne=>({...ne,pluginId:h.id,manifestId:D.id}))}catch{return[]}}).map(h=>[h.id,h])).values());l.useEffect(()=>(v&&g>0?le.current=setInterval(()=>{p(g-1)},1e3):g===0&&v&&(C(r==="zh"?"⏰ 环节时间到":"⏰ Phase Timer Ended",r==="zh"?"当前教学环节设定的时间已耗尽,建议转入下一环节。":"The current segment duration has elapsed. Transition recommended.","warning"),N(!1)),()=>{le.current&&clearInterval(le.current)}),[v,g]),l.useEffect(()=>{if(!s||!m){de.current={lesson:null,classId:null};return}(de.current.lesson!==s||de.current.classId!==m)&&(de.current={lesson:s,classId:m},qt(!0))},[s,m]);const Or=h=>{const D=parseInt(h.replace(/[^0-9]/g,""));return isNaN(D)?300:h.includes("s")?D:D*60},Lr=h=>{d(h.id);const D=Or(h.duration);p(D),N(!0),k(F=>[{id:Math.random().toString(),time:new Date().toLocaleTimeString([],{hour:"2-digit",minute:"2-digit",second:"2-digit"}),type:"info",message:`教学环节切换并广播:进入 [${h.title}] 环节,设定时间 ${h.duration}。`},...F]),C(r==="zh"?"📢 环节已广播":"📢 Phase Synchronized",r==="zh"?`已同步广播 [${h.title}] 环节至所有在线学生端。`:`Broadcasted phase [${h.title}] to all active students.`,"success")},qt=async h=>{if(!m||!s){C(r==="zh"?"⚠️ 无法操作":"⚠️ Action Prevented",r==="zh"?"请先选择需要授课的课节及班级。":"Please select a lesson and class first.","warning");return}P(!0);try{const D=h?`/api/classes/${m}/lock_lesson`:`/api/classes/${m}/unlock_lesson`;(await fetch(D,{method:"POST",headers:{"Content-Type":"application/json"},body:h?JSON.stringify({lessonId:s}):void 0})).ok&&(await _(),k(q=>[{id:Math.random().toString(),time:new Date().toLocaleTimeString([],{hour:"2-digit",minute:"2-digit",second:"2-digit"}),type:h?"warning":"info",message:h?"已对全班学生强制锁定专注模式(限定当前课程)。":"已解锁全班学生专注模式限制。"},...q]),C(r==="zh"?"🔒 锁状态更新":"🔒 Class Status Updated",h?"全班专注锁定成功,学生将无法切回主页。":"全班屏幕解锁成功,学生已恢复自由浏览。","success"))}catch(D){console.error("Failed to toggle class focus lock",D)}finally{P(!1)}},Fr=async(h,D)=>{const F=D?null:s;try{if((await fetch(`/api/students/${h}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({locked_lesson_id:F})})).ok){await _();const ne=a.find(X=>X.id===h)?.name||h;k(X=>[{id:Math.random().toString(),time:new Date().toLocaleTimeString([],{hour:"2-digit",minute:"2-digit",second:"2-digit"}),type:F?"warning":"info",message:F?`已针对学生 [${ne}] 单独开启专注限制锁定。`:`已解锁学生 [${ne}] 的专注限制。`},...X])}}catch(q){console.error("Failed to toggle student lock",q)}},Br=async h=>{if(!s){C(r==="zh"?"⚠️ 请选择课节":"⚠️ Select Lesson",r==="zh"?"请先选择要授课的课节。":"Please select a lesson first.","warning");return}if(JSON.stringify(h.payload||"").includes("$classId")&&!m){C(r==="zh"?"⚠️ 请选择班级":"⚠️ Select Class",r==="zh"?"该工具需要指定上课班级,请在顶部先选择班级。":"Please select class first for this tool.","warning");return}k(F=>[{id:Math.random().toString(),time:new Date().toLocaleTimeString([],{hour:"2-digit",minute:"2-digit",second:"2-digit"}),type:"info",message:`正在运行插件工具 [${h.name}]...`},...F]);try{const F=JSON.parse(JSON.stringify(h.payload||{}).replace(/\$classId/g,m||"").replace(/\$lessonId/g,s||""));if(F.type==="plugin"&&F.data)try{const he=JSON.parse(F.data);!he.segmentId&&x&&(he.segmentId=x,F.data=JSON.stringify(he))}catch{}const ne=!/^(whiteboard|lesson|assignment|class|student|vfs|plugin|ai|agent|system)\./.test(h.commandType)&&h.manifestId?Vr(h.commandType,h.manifestId):h.commandType,X=await fetch("/api/commands",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({commandType:ne,payload:F})});if(X.ok)H&&(h.id==="courseware-hub-teacher"||h.commandType==="courseware.open_panel")&&H(),k(he=>[{id:Math.random().toString(),time:new Date().toLocaleTimeString([],{hour:"2-digit",minute:"2-digit",second:"2-digit"}),type:"success",message:`插件工具 [${h.name}] 执行完毕,数据成功下发。`},...he]),C(r==="zh"?"✓ 工具下发成功":"✓ Tool Synchronized",r==="zh"?`工具 [${h.name}] 已成功在当前白板上部署并投射。`:`Tool [${h.name}] synchronized successfully.`,"success"),await z(s);else{const he=await X.json();throw new Error(he.error||"Server error")}}catch(F){k(q=>[{id:Math.random().toString(),time:new Date().toLocaleTimeString([],{hour:"2-digit",minute:"2-digit",second:"2-digit"}),type:"error",message:`运行插件工具 [${h.name}] 失败: ${F.message}`},...q]),C(r==="zh"?"❌ 运行失败":"❌ Tool Failed",F.message||"Execution error","warning")}},Ms=()=>{if(a.length===0||Q)return;const h=a.filter(X=>B.includes(X.id)&&R[X.id]===s);if(h.length===0){C(r==="zh"?"⚠️ 无法抽问":"⚠️ Cannot Draw",r==="zh"?"当前课堂中没有已进入的活跃学生。":"No students have entered the classroom yet.","warning");return}ie(!0);let D=0;const F=18;let q=75;const ne=()=>{const X=Math.floor(Math.random()*h.length),he=h[X];if(ce(he.id),D++,D<F)D>F-5&&(q+=45),setTimeout(ne,q);else{const me=h[X];ce(null),ie(!1),K(Ce=>Ce.includes(me.id)?Ce:[...Ce,me.id]),k(Ce=>[{id:Math.random().toString(),time:new Date().toLocaleTimeString([],{hour:"2-digit",minute:"2-digit",second:"2-digit"}),type:"success",message:`🎯 随机提问抽选:学生 [${me.name}] 被抽中回答问题!`},...Ce]),C(r==="zh"?"🎯 随机提问抽选":"🎯 Student Drawn",r==="zh"?`恭喜学生 [${me.name}] 被抽中回答问题!`:`Student [${me.name}] was selected to answer!`,"success"),L.current?.broadcastPickStudent(me.id,me.name),setTimeout(()=>{K(Ce=>Ce.filter(Je=>Je!==me.id))},8e3)}};setTimeout(ne,q)},Gr=m?a.map(h=>h.id):[],ct=(m?Ae.filter(h=>Gr.includes(h.studentId)):Ae).filter(h=>{const D=h.studentName?.toLowerCase().includes(Ht.toLowerCase())||h.coursewareName?.toLowerCase().includes(Ht.toLowerCase()),F=["completed","submitted","finished"],q=["active","inprogress","started"],ne=vt==="all"||vt==="submitted"&&F.includes(h.status)||vt==="started"&&q.includes(h.status);return D&&ne});return ye?e.jsx(pn,{lessons:n,classes:o,students:a,selectedLesson:s,setSelectedLesson:i,liveClassSelectedClassId:m,setLiveClassSelectedClassId:u,timelineSegments:c,onlineStudentIds:B,lang:r,addToast:C,onEnterClassroom:Pr}):e.jsxs("div",{className:"flex-grow flex-1 flex flex-col min-h-0 bg-surface border border-theme rounded-2xl shadow-xl text-main overflow-hidden font-sans",children:[e.jsxs("div",{className:"bg-surface-secondary p-4 border-b border-theme flex flex-wrap items-center justify-between gap-4 shrink-0",children:[e.jsxs("div",{className:"flex items-center gap-3 select-none",children:[e.jsxs("div",{className:"relative flex items-center justify-center",children:[e.jsx("span",{className:`w-3 h-3 rounded-full ${v?"bg-emerald-500 animate-ping":"bg-rose-500"} absolute`}),e.jsx("span",{className:`w-2 h-2 rounded-full ${v?"bg-emerald-500":"bg-rose-500"} relative`})]}),e.jsx("h2",{className:"text-sm font-extrabold tracking-tight text-main flex items-center gap-2",children:r==="zh"?"🔴 智能授课工作流控制中心":"🔴 Active Lesson control center"})]}),e.jsxs("div",{className:"flex items-center gap-2.5 flex-wrap",children:[e.jsx("div",{children:e.jsxs("select",{value:s||"",onChange:h=>{const D=h.target.value===""?null:h.target.value;i(D),D&&z(D)},className:"bg-surface border border-theme rounded-lg text-xs font-semibold px-3 py-1.5 focus:ring-1 focus:ring-primary-theme text-main outline-none cursor-pointer hover:bg-surface-secondary transition-colors",children:[e.jsx("option",{value:"",children:r==="zh"?"-- 选择授课课节 --":"-- Select Lesson --"}),n.map(h=>e.jsx("option",{value:h.id,children:h.title},h.id))]})}),e.jsx("div",{children:e.jsxs("select",{value:m||"",onChange:h=>u(h.target.value===""?null:h.target.value),className:"bg-surface border border-theme rounded-lg text-xs font-semibold px-3 py-1.5 focus:ring-1 focus:ring-primary-theme text-main outline-none cursor-pointer hover:bg-surface-secondary transition-colors",children:[e.jsx("option",{value:"",children:r==="zh"?"-- 选择授课班级 --":"-- Select Class --"}),o.map(h=>e.jsx("option",{value:h.id,children:h.name},h.id))]})}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("button",{onClick:_s,className:`px-3 py-1.5 text-xs font-bold rounded-lg transition-all cursor-pointer flex items-center gap-1.5 shadow-sm active:scale-95 ${ve?"bg-emerald-600 hover:bg-emerald-700 text-white ring-2 ring-emerald-400/50 shadow-emerald-500/20":"bg-gradient-to-r from-pink-600 to-rose-600 hover:from-pink-700 hover:to-rose-700 text-white"}`,title:r==="zh"?"在独立浏览器新Tab中打开学生端预览,可与当前教师端分屏实时操作联动":"Open student preview in a new browser tab to sync with teacher operations side-by-side",children:ve?e.jsxs(e.Fragment,{children:[e.jsxs("span",{className:"relative flex h-2 w-2",children:[e.jsx("span",{className:"animate-ping absolute inline-flex h-full w-full rounded-full bg-emerald-300 opacity-75"}),e.jsx("span",{className:"relative inline-flex rounded-full h-2 w-2 bg-emerald-200"})]}),e.jsxs("span",{children:["🎓 ",r==="zh"?"学生端已联动 (激活Tab)":"Student Linked (Focus Tab)"]}),e.jsx(ss,{size:12,className:"opacity-90"})]}):e.jsxs(e.Fragment,{children:[e.jsxs("span",{children:["🎓 ",r==="zh"?"学生视角预览 (独立Tab)":"Student Preview (New Tab)"]}),e.jsx(ss,{size:12,className:"opacity-90"})]})}),e.jsxs("button",{onClick:()=>qt(!Te),disabled:V||!s||!m,className:`px-3 py-1.5 rounded-lg font-bold text-xs uppercase tracking-wider flex items-center gap-1.5 shadow-sm transition-all active:scale-95 disabled:opacity-50 cursor-pointer ${Te?"bg-rose-500 hover:bg-rose-600 text-white":"bg-indigo-600 hover:bg-indigo-700 text-white"}`,children:[Te?e.jsx(as,{size:12}):e.jsx(Os,{size:12}),e.jsx("span",{children:Te?r==="zh"?"一键解锁全班":"Unlock Entire Class":r==="zh"?"全班专注锁定":"Lock Class Screen"})]})]}),e.jsxs("div",{className:"flex items-center gap-1.5 ml-auto border-l border-theme pl-2.5 shrink-0",children:[e.jsx("button",{onClick:()=>ws(!0),className:"w-7 h-7 sm:w-8 sm:h-8 text-xs font-bold rounded-lg bg-rose-50 text-rose-700 hover:bg-rose-100 border border-rose-200 transition-all flex items-center justify-center cursor-pointer shadow-2xs hover:scale-105 active:scale-95 shrink-0",title:r==="zh"?"课堂异常告警中心":"Diagnostic Center","aria-label":r==="zh"?"课堂异常告警中心":"Diagnostic Center",children:"⚠️"}),e.jsx("button",{onClick:()=>vs(!0),className:"w-7 h-7 sm:w-8 sm:h-8 text-xs font-bold rounded-lg bg-indigo-50 text-indigo-700 hover:bg-indigo-100 border border-indigo-200 transition-all flex items-center justify-center cursor-pointer shadow-2xs hover:scale-105 active:scale-95 shrink-0",title:r==="zh"?"AI 实时学情预测":"AI Mastery Prediction","aria-label":r==="zh"?"AI 实时学情预测":"AI Mastery Prediction",children:"🧠"}),e.jsx("button",{onClick:()=>ks(!0),className:"w-7 h-7 sm:w-8 sm:h-8 text-xs font-bold rounded-lg bg-emerald-50 text-emerald-700 hover:bg-emerald-100 border border-emerald-200 transition-all flex items-center justify-center cursor-pointer shadow-2xs hover:scale-105 active:scale-95 shrink-0",title:r==="zh"?"随堂小组协作与画廊互评展台 (Jigsaw & Gallery Walk)":"Group Collab & Gallery Walk","aria-label":r==="zh"?"随堂小组协作与画廊互评展台 (Jigsaw & Gallery Walk)":"Group Collab & Gallery Walk",children:"👥"}),e.jsx("button",{onClick:()=>zs(!0),className:"w-7 h-7 sm:w-8 sm:h-8 text-xs font-bold rounded-lg bg-purple-50 text-purple-700 hover:bg-purple-100 border border-purple-200 transition-all flex items-center justify-center cursor-pointer shadow-2xs hover:scale-105 active:scale-95 shrink-0",title:r==="zh"?"优秀作业 / 屏幕一键多屏对比投屏批注 (Showcase & Dual-Screen Diff)":"Showcase & Multi-Screen Diff","aria-label":r==="zh"?"优秀作业 / 屏幕一键多屏对比投屏批注 (Showcase & Dual-Screen Diff)":"Showcase & Multi-Screen Diff",children:"🔍"}),e.jsx("button",{onClick:()=>jt(!0),className:"w-7 h-7 sm:w-8 sm:h-8 text-xs font-bold rounded-lg bg-amber-50 text-amber-700 hover:bg-amber-100 border border-amber-200 transition-all flex items-center justify-center cursor-pointer shadow-2xs hover:scale-105 active:scale-95 shrink-0",title:r==="zh"?"家校通知生成器(课中预生成可在下课期间直接复制)":"Parent Notification","aria-label":r==="zh"?"家校通知生成器(课中预生成可在下课期间直接复制)":"Parent Notification",children:"✉️"}),e.jsx("button",{id:"btn-open-classroom-macros",onClick:()=>Ss(!0),className:"w-7 h-7 sm:w-8 sm:h-8 text-xs font-bold rounded-lg bg-sky-50 text-sky-700 hover:bg-sky-100 border border-sky-200 transition-all flex items-center justify-center cursor-pointer shadow-2xs hover:scale-105 active:scale-95 shrink-0",title:r==="zh"?"课堂宏动作编排中枢 (Classroom Action Macros)":"Action Macros","aria-label":r==="zh"?"课堂宏动作编排中枢 (Classroom Action Macros)":"Action Macros",children:"⚡"}),e.jsx("button",{id:"btn-open-hardware-bridge",onClick:()=>Cs(!0),className:"w-7 h-7 sm:w-8 sm:h-8 text-xs font-bold rounded-lg bg-slate-100 text-slate-700 hover:bg-slate-200 border border-slate-300 transition-all flex items-center justify-center cursor-pointer shadow-2xs hover:scale-105 active:scale-95 shrink-0",title:r==="zh"?"硬件教具生态标准化网关设置":"Hardware Bridge","aria-label":r==="zh"?"硬件教具生态标准化网关设置":"Hardware Bridge",children:"🎛️"}),e.jsx(Xn,{className:"ml-1 shrink-0"})]})]})]}),e.jsx(Ua,{lessonId:s,lessonTitle:n.find(h=>h.id===s)?.title,classId:m,lang:r,addToast:C,currentStage:Z,onStageChange:h=>T(h),students:Tr}),s?Z==="PRE_CLASS_READY"?e.jsx(Va,{selectedLesson:s,lessonTitle:n.find(h=>h.id===s)?.title||"",selectedClassId:m,className:o.find(h=>h.id===m)?.name||"",students:a,onlineStudentIds:B,timelineSegments:c,lang:r,isClassLocked:Te,onToggleClassLock:()=>qt(!Te),onStartClass:()=>Ue("IN_CLASS_TEACHING"),onPingStudent:()=>Ms(),onOpenStudentWindow:_s,isStudentWindowOpen:ve,addToast:C,onBroadcastNotice:h=>{k(D=>[{id:`feed-notice-${Date.now()}`,time:new Date().toLocaleTimeString(),type:"checkin",message:h},...D])}}):Z==="WRAP_UP_EXIT_TICKET"?e.jsx(yn,{selectedLesson:s,lessonTitle:n.find(h=>h.id===s)?.title||"",selectedClassId:m,className:o.find(h=>h.id===m)?.name||"",students:a,lang:r,attempts:Ae,loadingAttempts:Nt,onFetchAttempts:()=>lt(),onPromoteAttempt:Ps,onViewRaw:h=>Rs(h),onAdvanceToReport:()=>Ue("ARCHIVED_REPORT"),onReturnToTeaching:()=>Ue("IN_CLASS_TEACHING"),addToast:C,onBroadcastNotice:h=>{k(D=>[{id:`feed-hw-${Date.now()}`,time:new Date().toLocaleTimeString(),type:"checkin",message:h},...D])}}):Z==="ARCHIVED_REPORT"?e.jsx(Sn,{selectedLesson:s,lessonTitle:n.find(h=>h.id===s)?.title||"",selectedClassId:m,className:o.find(h=>h.id===m)?.name||"",students:a,lang:r,onReturnToTeaching:()=>Ue("IN_CLASS_TEACHING"),onReturnToPreClass:()=>Ue("PRE_CLASS_READY"),addToast:C}):e.jsxs("div",{className:"flex-1 flex overflow-hidden min-h-0 bg-surface-secondary/30",children:[!y&&e.jsxs("div",{className:"w-[220px] shrink-0 bg-surface p-3.5 border-r border-theme flex flex-col gap-4 overflow-y-auto",children:[e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center justify-between mb-2 select-none",children:[e.jsx("h3",{className:"text-xs font-black uppercase text-muted tracking-wider",children:r==="zh"?"教学步骤与时间管理":"Lesson Segments & Phases"}),e.jsx("button",{onClick:()=>M(!0),className:"p-1 rounded bg-surface-secondary hover:bg-surface border border-theme text-muted hover:text-main transition-colors cursor-pointer",title:r==="zh"?"折叠导航栏":"Collapse Sidebar",children:e.jsx(wa,{size:10})})]}),e.jsx(za,{lessonId:s,lang:r,syncChannel:L.current,onlineStudentCount:B?.length||w.size||0,onTimeRemainingChange:(h,D)=>{p(h),N(D)}})]}),e.jsxs("div",{className:"flex-1 flex flex-col gap-2 min-h-0",children:[e.jsx("h4",{className:"text-xs font-black uppercase text-muted tracking-wider select-none",children:r==="zh"?"教学环节进度表":"Timeline Segments"}),s?e.jsx("div",{className:"space-y-2 overflow-y-auto flex-1 pr-1.5 scrollbar-thin",children:c.map((h,D)=>{const F=x===h.id;return e.jsxs("div",{className:`p-2.5 rounded-xl border transition-all flex flex-col gap-1.5 ${F?"bg-primary-theme/10 border-primary-theme/40 shadow-sm":"bg-surface border-theme hover:bg-surface-secondary"}`,children:[e.jsxs("div",{className:"flex justify-between items-start",children:[e.jsxs("span",{className:`text-xs font-bold ${F?"text-primary-theme":"text-main"}`,children:[D+1,". ",h.title]}),e.jsx("span",{className:"text-xs font-mono px-1 py-0.5 rounded bg-surface-secondary text-muted border border-theme",children:h.duration})]}),e.jsx("div",{className:`text-xs line-clamp-2 leading-relaxed ${F?"text-primary-theme":"text-muted"}`,children:h.notes||"无步骤描述备注信息。"}),e.jsxs("button",{onClick:()=>Lr(h),className:`w-full py-1 rounded text-xs font-bold transition-all cursor-pointer flex items-center justify-center gap-1 ${F?"bg-primary-theme text-white hover:bg-primary-theme-hover shadow-sm":"bg-surface-secondary text-muted hover:text-main hover:bg-surface border border-theme"}`,children:[e.jsx(xt,{size:10}),e.jsx("span",{children:F?r==="zh"?"同步演示中":"Broadcasting":r==="zh"?"广播此环节":"Broadcast Step"})]})]},h.id)})}):e.jsx("div",{className:"text-xs text-muted italic py-4 text-center",children:r==="zh"?"请选择一个课节加载流程表":"Select a lesson to view schedule."})]})]}),e.jsx("div",{className:"flex-1 flex flex-col min-w-0 bg-surface-secondary/40 p-3 gap-3 relative",children:s?e.jsxs("div",{className:"w-full h-full relative flex flex-col min-h-0",children:[e.jsxs("div",{className:"flex justify-between items-center px-1.5 py-1 select-none text-muted text-xs uppercase font-extrabold tracking-wide shrink-0 mb-1",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[y&&e.jsxs("button",{onClick:()=>M(!1),className:"p-1 rounded-lg bg-surface hover:bg-surface-secondary border border-theme text-primary-theme hover:text-primary-theme-hover transition-colors cursor-pointer mr-1.5 flex items-center gap-1 shadow-sm",title:r==="zh"?"展开环节大纲":"Expand Sidebar",children:[e.jsx(st,{size:10}),e.jsx("span",{className:"text-xs font-bold tracking-wider",children:r==="zh"?"展开":"Expand"})]}),e.jsxs("div",{className:"bg-surface-secondary p-0.5 rounded-lg flex items-center gap-1 border border-theme",children:[e.jsx("button",{onClick:()=>it("whiteboard"),className:`px-3 py-1 rounded-md text-xs font-bold transition-all cursor-pointer ${Ne==="whiteboard"?"bg-surface text-primary-theme shadow-sm":"text-muted hover:text-main"}`,children:r==="zh"?"💻 演示白板":"💻 Whiteboard"}),e.jsx("button",{onClick:()=>it("submissions"),className:`px-3 py-1 rounded-md text-xs font-bold transition-all cursor-pointer ${Ne==="submissions"?"bg-surface text-primary-theme shadow-sm":"text-muted hover:text-main"}`,children:r==="zh"?"📊 学生提交数据":"📊 Student Submissions"}),e.jsx("button",{id:"teacher_assignment_eval_tab_btn",onClick:()=>it("assignment"),className:`px-3 py-1 rounded-md text-xs font-bold transition-all cursor-pointer ${Ne==="assignment"?"bg-surface text-primary-theme shadow-sm":"text-muted hover:text-main"}`,children:r==="zh"?"🎓 作业成绩评定":"🎓 Assignment Grades"}),e.jsxs("button",{id:"teacher_top_performers_tab_btn","data-testid":"teacher-top-performers-tab-btn",onClick:()=>it("top_performers"),className:`px-3 py-1 rounded-md text-xs font-bold transition-all cursor-pointer flex items-center gap-1 ${Ne==="top_performers"?"bg-surface text-amber-500 shadow-sm":"text-muted hover:text-main"}`,children:[e.jsx(Oe,{size:12,className:"text-amber-500"}),e.jsx("span",{children:r==="zh"?"🏆 随堂测验榜":"🏆 Top Performers"})]})]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[E.length>0&&e.jsxs("button",{type:"button",onClick:()=>{Ye.getState().setActiveTab("student"),Ye.getState().setIsErrorCenterOpen(!0)},className:"flex items-center gap-1 px-2 py-0.5 rounded-lg text-xs font-bold bg-rose-50 text-rose-700 dark:bg-rose-950/40 dark:text-rose-400 border border-rose-200 dark:border-rose-800 hover:bg-rose-100 transition-colors cursor-pointer mr-1",title:r==="zh"?"点击查看学生端异常诊断日志":"View Student Client Errors",children:[e.jsx(Se,{size:12,className:"text-rose-500 animate-pulse"}),e.jsx("span",{children:r==="zh"?`学生端异常 (${E.length})`:`Student Errors (${E.length})`})]}),e.jsxs("span",{className:"text-primary-theme font-mono tracking-widest animate-pulse flex items-center gap-1",children:[e.jsx(Ge,{size:10})," Live Broadcaster Connected"]}),e.jsxs("button",{type:"button",onClick:()=>Ue("WRAP_UP_EXIT_TICKET"),className:"ml-2 px-3 py-1 bg-gradient-to-r from-indigo-600 to-purple-600 hover:from-indigo-700 hover:to-purple-700 text-white rounded-lg text-xs font-bold flex items-center gap-1 shadow-xs cursor-pointer hover:shadow-md transition-all active:scale-95",children:[e.jsx("span",{children:r==="zh"?"完成授课,进入课后":"Finish Teaching → Post-Class"}),e.jsx(st,{size:12})]})]})]}),Ne==="whiteboard"?e.jsx(e.Fragment,{children:e.jsx("div",{className:"flex-grow flex-1 min-h-0 w-full relative rounded-xl overflow-hidden border border-theme shadow-md bg-surface flex flex-col",children:e.jsx(Ur,{lessonId:s,classId:m,userRole:"teacher",initialPage:re,isEditMode:!1,broadcastFullscreen:!0,fullscreenBroadcastClassId:m,onFullscreenSync:h=>{U(h),L.current?.broadcastFullscreen(h,s||void 0)},elements:b,activeSegmentId:x,onSegmentSync:h=>d(h),classroomTools:Dr,onExecuteTool:Br,onElementAdd:async(h,D)=>{await fetch(`/api/lessons/${s}/whiteboard`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({type:h,data:D})}),z(s)},onElementUpdate:async(h,D)=>{await fetch(`/api/lessons/${s}/whiteboard/${h}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({data:D})}),z(s)},onElementDelete:async h=>{await fetch(`/api/lessons/${s}/whiteboard/${h}`,{method:"DELETE"}),z(s)},onRefresh:()=>z(s)})})}):Ne==="submissions"?e.jsxs("div",{className:"flex-grow flex-1 min-h-0 w-full relative rounded-xl overflow-hidden border border-theme shadow-md bg-surface flex flex-col p-4",children:[e.jsxs("div",{className:"flex justify-between items-center mb-4 gap-3 shrink-0",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-xs font-bold text-main",children:r==="zh"?"学生互动提交数据列表":"Student Submissions"}),Ae.length>0&&e.jsxs("span",{className:"text-xs bg-primary-theme/10 text-primary-theme px-2 py-0.5 rounded-full border border-primary-theme/20 font-bold",title:ct.length===Ae.length?void 0:r==="zh"?`已按所选班级/筛选条件过滤,全部记录共 ${Ae.length} 条`:`Filtered by the selected class/filters. ${Ae.length} records in total.`,children:[ct.length," ",r==="zh"?"条记录":"records",ct.length!==Ae.length&&e.jsxs("span",{className:"ml-1 font-normal opacity-70",children:["/ ",Ae.length]})]})]}),e.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[e.jsxs("div",{className:"relative",children:[e.jsx("input",{type:"text",placeholder:r==="zh"?"搜索学生或课件...":"Search student or courseware...",value:Ht,onChange:h=>Mr(h.target.value),className:"bg-surface border border-theme rounded-lg text-xs pl-8 pr-3 py-1.5 focus:ring-1 focus:ring-primary-theme text-main outline-none w-44 transition-all"}),e.jsx(bt,{size:12,className:"absolute left-2.5 top-2.5 text-muted"})]}),e.jsxs("select",{value:vt,onChange:h=>_r(h.target.value),className:"bg-surface border border-theme rounded-lg text-xs px-3 py-1.5 focus:ring-1 focus:ring-primary-theme text-main outline-none cursor-pointer hover:bg-surface-secondary transition-colors",children:[e.jsx("option",{value:"all",children:r==="zh"?"全部状态":"All Status"}),e.jsx("option",{value:"submitted",children:r==="zh"?"已提交/完成":"Submitted/Finished"}),e.jsx("option",{value:"started",children:r==="zh"?"进行中":"In Progress"})]}),e.jsx("button",{onClick:lt,disabled:Nt,className:"p-1.5 bg-surface hover:bg-surface-secondary border border-theme rounded-lg text-muted hover:text-main transition-colors cursor-pointer flex items-center justify-center shadow-sm disabled:opacity-50",title:r==="zh"?"刷新数据":"Refresh",children:e.jsx($e,{size:12,className:Nt?"animate-spin":""})}),e.jsxs("button",{onClick:()=>it("top_performers"),className:"px-2.5 py-1.5 bg-amber-500/10 hover:bg-amber-500/20 text-amber-600 dark:text-amber-400 border border-amber-500/30 rounded-lg text-xs font-bold transition-colors cursor-pointer flex items-center gap-1 shadow-xs",title:r==="zh"?"查看随堂测验 Top 5 榜单":"View Top 5 Performers",children:[e.jsx(Oe,{size:12,className:"text-amber-500"}),e.jsx("span",{children:r==="zh"?"优秀榜":"Top 5"})]})]})]}),e.jsx("div",{className:"flex-1 overflow-y-auto border border-theme rounded-xl scrollbar-thin",children:Nt?e.jsxs("div",{className:"h-full flex flex-col items-center justify-center text-muted gap-2",children:[e.jsx($e,{size:24,className:"animate-spin text-primary-theme mb-2"}),e.jsx("span",{className:"text-xs",children:r==="zh"?"正在加载学生提交数据...":"Loading submissions..."})]}):ct.length===0?e.jsxs("div",{className:"h-full flex flex-col items-center justify-center py-12 text-muted gap-2",children:[e.jsx(tt,{size:32,className:"text-muted/60"}),e.jsx("span",{className:"text-xs",children:r==="zh"?"暂无匹配的提交数据。":"No matching submissions found."}),!m&&e.jsx("span",{className:"text-xs text-muted italic",children:r==="zh"?"提示:请在顶部选择一个班级进行筛选。":"Tip: Select a class at the top to filter."})]}):e.jsxs("table",{className:"w-full border-collapse text-left text-xs text-main",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"bg-surface-secondary border-b border-theme font-bold text-muted select-none",children:[e.jsx("th",{className:"p-3",children:r==="zh"?"学生姓名":"Student Name"}),e.jsx("th",{className:"p-3",children:r==="zh"?"交互课件":"Courseware"}),e.jsx("th",{className:"p-3",children:r==="zh"?"状态":"Status"}),e.jsx("th",{className:"p-3 text-center",children:r==="zh"?"成绩":"Score"}),e.jsx("th",{className:"p-3 text-center",children:r==="zh"?"完成度":"Completion"}),e.jsx("th",{className:"p-3 text-right",children:r==="zh"?"操作":"Actions"})]})}),e.jsx("tbody",{className:"divide-y divide-border-theme",children:ct.map(h=>{const D=h.status==="finished"||h.status==="submitted",F=h.started_at?new Date(h.started_at).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"}):"N/A";return e.jsxs("tr",{className:"hover:bg-surface-secondary/50 transition-colors group",children:[e.jsxs("td",{className:"p-3",children:[e.jsx("div",{className:"font-semibold text-main",children:h.studentName}),e.jsxs("div",{className:"text-xs text-muted mt-0.5",children:[r==="zh"?"时间":"Time",": ",F]})]}),e.jsx("td",{className:"p-3 font-medium text-main max-w-[150px] truncate",title:h.coursewareName,children:h.coursewareName}),e.jsx("td",{className:"p-3",children:e.jsx("span",{className:`px-2 py-0.5 rounded-full border text-xs font-bold ${D?"bg-emerald-50 text-emerald-700 border-emerald-100":"bg-blue-50 text-blue-700 border-blue-100 animate-pulse"}`,children:D?r==="zh"?"已提交":"Finished":r==="zh"?"进行中":"Running"})}),e.jsx("td",{className:"p-3 text-center font-bold font-mono",children:h.score!==null?e.jsxs("span",{className:"text-primary-theme bg-primary-theme/10 border border-primary-theme/20 px-1.5 py-0.5 rounded-md",children:[h.score,"分"]}):e.jsx("span",{className:"text-muted font-medium",children:"-"})}),e.jsx("td",{className:"p-3 text-center font-semibold font-mono",children:h.completion!==null?`${Math.round(h.completion*100)}%`:"0%"}),e.jsx("td",{className:"p-3 text-right",children:e.jsxs("div",{className:"flex justify-end gap-2",children:[e.jsxs("button",{onClick:()=>Rs(h),className:"p-1 text-muted hover:text-primary-theme hover:bg-surface-secondary border border-transparent hover:border-theme rounded-lg transition-colors cursor-pointer flex items-center gap-1 text-xs",title:r==="zh"?"查看提交轨迹事件数据":"View Raw Data",children:[e.jsx(Ft,{size:12}),e.jsx("span",{children:r==="zh"?"轨迹":"Events"})]}),h.isPromoted>0?e.jsxs("span",{className:"px-2 py-1 text-emerald-650 font-bold text-xs flex items-center gap-0.5 bg-emerald-50/50 rounded-lg border border-emerald-100",children:[e.jsx(Ve,{size:11}),r==="zh"?"已归档":"Saved"]}):e.jsxs("button",{onClick:()=>Ps(h.attemptId),disabled:!D,className:`px-2 py-1 text-xs font-bold rounded-lg flex items-center gap-1 shadow-sm transition-all active:scale-95 cursor-pointer border ${D?"bg-primary-theme hover:bg-primary-theme-hover text-white border-primary-theme":"bg-surface-secondary text-muted border-theme cursor-not-allowed opacity-60"}`,title:r==="zh"?"将分数和进度作为随堂学习数据存入数据库,记入学期成绩":"Save to DB & Semester grade",children:[e.jsx(Et,{size:11}),e.jsx("span",{children:r==="zh"?"录入成绩":"Record"})]})]})})]},h.attemptId)})})]})})]}):Ne==="top_performers"?e.jsx("div",{className:"flex-grow flex-1 min-h-0 w-full relative rounded-xl overflow-y-auto border border-theme shadow-md bg-surface flex flex-col p-4",children:e.jsx(Sa,{lang:r,lessonId:s,classId:m,lessons:n,classes:o,students:a,addToast:C})}):e.jsx(br,{lessonId:s||"",lang:r==="zh"?"zh":"en",addToast:C})]}):e.jsxs("div",{className:"flex-1 flex flex-col items-center justify-center text-slate-455 gap-2.5 select-none",children:[e.jsx(xt,{size:38,className:"text-slate-300 animate-bounce",style:{animationDuration:"2.5s"}}),e.jsx("div",{className:"text-sm font-bold text-slate-655",children:r==="zh"?"请在顶部栏选择一个授课课节":"Please select a lesson to start teaching"}),e.jsx("p",{className:"text-xs text-slate-400",children:"白板及环节控制面板将在课节载入后自动生成"})]})}),e.jsxs("div",{className:"w-[260px] shrink-0 bg-surface p-3.5 border-l border-theme flex flex-col gap-3.5 overflow-hidden",children:[e.jsxs("div",{className:"flex-1 flex flex-col min-h-0 gap-2",children:[e.jsxs("h3",{className:"text-xs font-black uppercase text-muted tracking-wider select-none flex justify-between items-center shrink-0",children:[e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx("span",{children:r==="zh"?"学生专注力监控":"Student Status Console"}),m&&e.jsxs("button",{onClick:Ms,disabled:a.length===0||Q,className:"ml-2 text-xs font-bold bg-primary-theme/10 text-primary-theme border border-primary-theme/20 px-1.5 py-0.5 rounded hover:bg-primary-theme/20 transition-colors flex items-center gap-1 active:scale-95 disabled:opacity-50 cursor-pointer shrink-0",title:r==="zh"?"随机抽取一名学生提问":"Pick a student randomly",children:[e.jsx(ds,{size:8.5,className:Q?"animate-spin":""}),e.jsx("span",{children:r==="zh"?"随机抽问":"Pick Student"})]})]}),e.jsxs("span",{className:"text-xs bg-surface-secondary border border-theme text-muted font-mono px-1.5 py-0.5 rounded-md",children:[a.filter(h=>h.locked_lesson_id===s).length," / ",a.length," Locked"]})]}),m?e.jsx("div",{className:"overflow-y-auto flex-1 pr-1 grid grid-cols-3 gap-2 justify-items-center auto-rows-max scrollbar-thin py-2",children:a.map(h=>{const D=h.locked_lesson_id===s,F=w.get(h.id),q=B.includes(h.id),X=R[h.id]===s,me=J.find(Ie=>Ie.student_id===h.id)?.progress_percent??0,Ce=x?c.findIndex(Ie=>Ie.id===x):-1,Je=c.length>0?Math.round((Ce+1)/c.length*100):0,Qe=Ce>=0&&me<Je,Pe=G.includes(h.id),Vt=pe===h.id,Kt=22,Is=3,Jt=2*Math.PI*Kt,Wr=Jt-me/100*Jt;let Fe="stroke-indigo-650";Pe?Fe="stroke-amber-500 stroke-[3.5px]":Vt?Fe="stroke-indigo-500 stroke-[3.5px] animate-pulse":q?D?Fe="stroke-rose-500 animate-pulse":Qe?Fe="stroke-amber-500 animate-pulse":X?me===100&&(Fe="stroke-emerald-500"):Fe="stroke-blue-400":Fe="stroke-slate-200";const wt=E.filter(Ie=>Ie.studentId===h.id);return e.jsxs("div",{onMouseEnter:()=>S(h.id),onMouseLeave:()=>S(null),className:`group relative flex flex-col items-center justify-center p-1 rounded-xl transition-all cursor-default ${Pe?"z-20 duration-300":Vt?"z-20":"hover:bg-slate-50"}`,children:[e.jsxs("div",{className:`relative w-14 h-14 flex items-center justify-center rounded-full transition-all duration-300 ${Pe?"shadow-[0_0_15px_#f59e0b] scale-110 z-10 bg-amber-50 ring-2 ring-amber-400 ring-offset-1":Vt?"shadow-[0_0_10px_#6366f1] scale-105 z-10 bg-indigo-50 ring-1 ring-indigo-400":""}`,children:[wt.length>0&&e.jsx("button",{type:"button",onClick:Ie=>{Ie.stopPropagation(),Ye.getState().setActiveTab("student"),Ye.getState().setIsErrorCenterOpen(!0)},className:"absolute -top-1 -right-1 z-30 w-4 h-4 rounded-full bg-rose-500 text-white flex items-center justify-center shadow-md cursor-pointer hover:scale-125 transition-transform",title:`该学生端捕获到 ${wt.length} 处异常: ${wt[0].title||wt[0].message}`,children:e.jsx(Se,{size:10,className:"animate-pulse"})}),Pe&&e.jsx("div",{className:"absolute inset-0 rounded-full bg-amber-400/30 animate-ping",style:{animationDuration:"2s"}}),e.jsxs("svg",{className:"absolute w-full h-full transform -rotate-90",viewBox:"0 0 50 50",children:[e.jsx("circle",{cx:"25",cy:"25",r:Kt,className:"stroke-slate-100 fill-white",strokeWidth:Is}),e.jsx("circle",{cx:"25",cy:"25",r:Kt,className:`fill-transparent transition-all duration-300 ${Fe}`,strokeWidth:Is,strokeDasharray:Jt,strokeDashoffset:Wr,strokeLinecap:"round"})]}),e.jsxs("div",{className:`relative z-10 w-10 h-10 rounded-full flex items-center justify-center overflow-hidden transition-colors ${Pe?"bg-amber-100/90":""}`,children:[e.jsx("span",{className:`text-xs font-bold tracking-tight truncate max-w-[34px] group-hover:scale-0 group-hover:opacity-0 transition-all duration-200 select-none ${Pe?"text-amber-900 font-extrabold":q?"text-slate-700":"text-slate-400"}`,children:h.name}),e.jsxs("div",{className:"absolute inset-0 flex items-center justify-center gap-1 opacity-0 scale-50 group-hover:opacity-100 group-hover:scale-100 transition-all duration-200 bg-white/95 rounded-full shadow-inner",children:[s&&O&&e.jsx("button",{onClick:()=>{const Ie=r==="zh"?`⚠️ 学习进度预警:您当前的进度 (${me}%) 落后于老师的讲解进度。请专注课堂,跟上讲解!`:`⚠️ Progress Alert: Your progress (${me}%) is behind.`;O(h.id,Ie),C(r==="zh"?"🔔 已发送提醒":"🔔 Alert Sent",`已向学生 ${h.name} 发送进度提醒。`,"success")},className:`p-0.5 rounded-md hover:bg-slate-105 transition-colors shrink-0 cursor-pointer ${Qe?"text-amber-500 hover:text-amber-600 animate-pulse":"text-slate-400 hover:text-slate-650"}`,title:"提醒",children:e.jsx(De,{size:10})}),e.jsx("button",{onClick:()=>Fr(h.id,h.locked_lesson_id),disabled:!s,className:`p-0.5 rounded-md hover:bg-slate-105 transition-colors shrink-0 cursor-pointer ${D?"text-rose-500 hover:text-rose-600":"text-slate-400 hover:text-slate-655"}`,title:D?"解锁":"锁定",children:D?e.jsx(as,{size:10}):e.jsx(Os,{size:10})})]})]}),Pe?e.jsx("span",{className:"absolute -top-1.5 -right-1.5 z-20 text-xs bg-amber-500 text-white rounded-full w-4 h-4 flex items-center justify-center font-bold shadow-md animate-bounce",children:"🎯"}):q&&e.jsx("span",{className:`absolute top-0 right-0 w-2.5 h-2.5 rounded-full border-2 border-white shrink-0 ${X?"bg-emerald-500":"bg-blue-400"}`,title:X?"正在上课":"在线(但未进课堂)"}),F===!0&&!Pe&&e.jsx("span",{className:"absolute bottom-0 right-0 w-2.5 h-2.5 rounded-full border-2 border-white bg-amber-500 shrink-0 animate-bounce",title:"已确认/就位"})]}),e.jsx("span",{className:`text-xs mt-1 truncate max-w-[48px] select-none font-medium ${Pe?"text-amber-600 font-extrabold animate-bounce":q?"text-slate-505":"text-slate-350"}`,children:Pe?"🎯 抽中":`${me}%`})]},h.id)})}):e.jsx("div",{className:"text-xs text-slate-400 italic py-4 text-center flex-1 flex items-center justify-center",children:r==="zh"?"请选择班级以显示学生":"Select class to show student monitors."})]}),e.jsx("div",{className:"bg-surface-secondary border border-theme rounded-xl p-3 flex flex-col gap-1.5 h-[135px] shrink-0 shadow-sm select-none justify-center",children:$?(()=>{const h=a.find(X=>X.id===$);if(!h)return null;const D=J.find(X=>X.student_id===h.id),F=D?.progress_percent??0,q=(()=>{if(!D||!D.completed_segments)return[];try{return typeof D.completed_segments=="string"?JSON.parse(D.completed_segments):D.completed_segments}catch{return[]}})(),ne=E.filter(X=>X.studentId===h.id);return e.jsxs("div",{className:"flex flex-col gap-1.5 text-xs text-main",children:[e.jsxs("div",{className:"font-extrabold text-main border-b border-theme pb-1 flex justify-between items-center shrink-0",children:[e.jsxs("span",{className:"flex items-center gap-1.5 truncate",children:[e.jsx("span",{className:`w-2 h-2 rounded-full shrink-0 ${B.includes(h.id)?"bg-emerald-500 animate-pulse":"bg-slate-300"}`}),e.jsxs("span",{className:"truncate max-w-[130px]",children:[h.name," (",h.student_number||"N/A",")"]}),ne.length>0&&e.jsxs("button",{type:"button",onClick:X=>{X.stopPropagation(),Ye.getState().setActiveTab("student"),Ye.getState().setIsErrorCenterOpen(!0)},className:"flex items-center gap-1 text-[10px] font-bold text-rose-600 dark:text-rose-400 bg-rose-50 dark:bg-rose-950/60 border border-rose-200 dark:border-rose-800 px-1 py-0.2 rounded hover:bg-rose-100 transition-colors cursor-pointer shrink-0",title:`学生端存在 ${ne.length} 处异常: ${ne[0].title||ne[0].message}`,children:[e.jsx(Se,{size:10,className:"text-rose-500 animate-pulse"}),e.jsxs("span",{children:[ne.length," 异常"]})]})]}),e.jsxs("span",{className:"text-xs text-primary-theme font-mono font-black shrink-0",children:[F,"%"]})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-1.5 text-xs leading-tight shrink-0",children:[e.jsxs("div",{className:"flex flex-col gap-0.5 bg-surface p-1 rounded-lg border border-theme",children:[e.jsx("span",{className:"text-muted font-bold",children:"随堂测验"}),e.jsx("span",{className:`font-bold font-mono text-xs ${D!=null&&D.quiz_score!==null?"text-primary-theme":"text-muted"}`,children:D!=null&&D.quiz_score!==null?`${D.quiz_score} / 100`:"未提交"})]}),e.jsxs("div",{className:"flex flex-col gap-0.5 bg-surface p-1 rounded-lg border border-theme",children:[e.jsx("span",{className:"text-muted font-bold",children:"教学环节进度"}),e.jsxs("span",{className:"font-bold text-main text-xs",children:[Array.isArray(q)?q.length:0," / ",c.length]})]})]}),e.jsxs("div",{className:"text-xs text-muted leading-relaxed truncate mt-0.5 shrink-0",children:["环节:"," ",c.length>0?c.map((X,he)=>{const me=Array.isArray(q)&&q.includes(X.id);return e.jsxs("span",{className:`mr-1 px-1 py-0.2 rounded ${me?"bg-emerald-50 text-emerald-600 border border-emerald-100":"bg-surface text-muted border border-theme"}`,title:X.title,children:[he+1,":",me?"✓":"✗"]},X.id)}):e.jsx("span",{className:"italic text-muted",children:"暂无步骤"})]})]})})():e.jsxs("div",{className:"flex flex-col gap-1 text-xs text-main h-full justify-center",children:[e.jsxs("div",{className:"font-extrabold text-main border-b border-theme pb-1.5 flex items-center gap-1.5 shrink-0",children:[e.jsx(Ge,{size:12,className:"text-primary-theme animate-pulse"}),e.jsx("span",{children:r==="zh"?"班级学情概况":"Class Overview"})]}),e.jsxs("div",{className:"grid grid-cols-3 gap-1.5 text-xs leading-tight mt-1.5 shrink-0",children:[e.jsxs("div",{className:"flex flex-col items-center bg-surface py-1 rounded-lg border border-theme",children:[e.jsx("span",{className:"text-muted font-medium",children:"在线/总数"}),e.jsxs("span",{className:"font-bold font-mono text-emerald-600 text-xs mt-0.5",children:[a.filter(h=>B.includes(h.id)).length,"/",a.length]})]}),e.jsxs("div",{className:"flex flex-col items-center bg-surface py-1 rounded-lg border border-theme",children:[e.jsx("span",{className:"text-muted font-medium",children:"屏幕锁定"}),e.jsx("span",{className:"font-bold font-mono text-rose-500 text-xs mt-0.5",children:a.filter(h=>h.locked_lesson_id===s).length})]}),e.jsxs("div",{className:"flex flex-col items-center bg-surface py-1 rounded-lg border border-theme",children:[e.jsx("span",{className:"text-muted font-medium",children:"平均进度"}),e.jsx("span",{className:"font-bold font-mono text-primary-theme text-xs mt-0.5",children:(()=>{const h=a.filter(F=>B.includes(F.id));if(h.length===0)return"0%";const D=h.reduce((F,q)=>{const ne=J.find(X=>X.student_id===q.id);return F+(ne?.progress_percent??0)},0);return`${Math.round(D/h.length)}%`})()})]})]})]})}),e.jsxs("div",{className:"h-[160px] flex flex-col border-t border-theme pt-3 min-h-0 gap-2 shrink-0",children:[e.jsxs("h3",{className:"text-xs font-black uppercase text-muted tracking-wider select-none flex justify-between items-center",children:[e.jsx("span",{children:r==="zh"?"课堂互动反馈流":"Live Classroom Feed"}),e.jsx("button",{onClick:()=>k([{id:"clear",time:new Date().toLocaleTimeString([],{hour:"2-digit",minute:"2-digit",second:"2-digit"}),type:"info",message:"反馈流已清空。"}]),className:"text-xs hover:text-main text-muted underline transition-all",children:"Clear"})]}),e.jsx("div",{className:"flex-1 bg-surface-secondary border border-theme rounded-xl p-2.5 font-mono text-xs leading-relaxed overflow-y-auto space-y-2 select-text text-left text-main shadow-inner scrollbar-thin",children:j.map(h=>e.jsxs("div",{className:"border-b border-theme pb-1.5 last:border-b-0",children:[e.jsxs("div",{className:"flex justify-between items-center text-muted font-bold mb-0.5",children:[e.jsx("span",{children:h.time}),e.jsx("span",{className:`px-1 rounded uppercase tracking-wide text-xs ${h.type==="success"?"bg-emerald-50 text-emerald-600 border border-emerald-100":h.type==="warning"?"bg-amber-50 text-amber-600 border border-amber-100":"bg-surface text-muted border border-theme"}`,children:h.type})]}),e.jsx("p",{className:h.type==="success"?"text-emerald-700 font-medium":h.type==="warning"?"text-amber-700 font-medium":"text-main",children:h.message})]},h.id))})]})]})]}):e.jsxs("div",{className:"flex-1 flex flex-col items-center justify-center text-slate-455 gap-2.5 select-none bg-surface",children:[e.jsx(xt,{size:38,className:"text-slate-300 animate-bounce",style:{animationDuration:"2.5s"}}),e.jsx("div",{className:"text-sm font-bold text-slate-655",children:r==="zh"?"请在顶部栏选择一个授课课节":"Please select a lesson to start teaching"}),e.jsx("p",{className:"text-xs text-slate-400",children:r==="zh"?"课前准备、课中白板、课后小结与简报将在选择课节后就绪":"Classroom workflows activate once a lesson is selected."})]}),Me&&e.jsx("div",{className:"fixed inset-0 bg-slate-900/60 backdrop-blur-sm z-50 flex items-center justify-center p-4",children:e.jsxs("div",{className:"bg-surface rounded-2xl shadow-2xl max-w-2xl w-full max-h-[85vh] flex flex-col overflow-hidden border border-theme animate-in fade-in zoom-in duration-200 text-main",children:[e.jsxs("div",{className:"bg-surface-secondary px-6 py-4 border-b border-theme flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(tt,{className:"text-primary-theme",size:18}),e.jsx("h3",{className:"text-sm font-bold text-main",children:r==="zh"?`[${Me.studentName}] 的互动提交轨迹详情`:`Submission Details - ${Me.studentName}`})]}),e.jsx("button",{onClick:()=>Wt(null),className:"text-muted hover:text-main p-1.5 hover:bg-surface-secondary rounded-lg transition-colors cursor-pointer",children:e.jsx(ka,{size:18})})]}),e.jsxs("div",{className:"p-6 overflow-y-auto space-y-4 flex-1 scrollbar-thin",children:[e.jsxs("div",{className:"grid grid-cols-3 gap-3",children:[e.jsxs("div",{className:"bg-surface-secondary p-3 rounded-xl border border-theme",children:[e.jsx("div",{className:"text-xs text-muted font-bold uppercase tracking-wider",children:r==="zh"?"课件名称":"Courseware"}),e.jsx("div",{className:"text-xs font-semibold text-main mt-1 truncate",title:Me.coursewareName,children:Me.coursewareName})]}),e.jsxs("div",{className:"bg-surface-secondary p-3 rounded-xl border border-theme",children:[e.jsx("div",{className:"text-xs text-muted font-bold uppercase tracking-wider",children:r==="zh"?"提交成绩":"Score"}),e.jsx("div",{className:"text-xs font-bold text-primary-theme mt-1",children:Me.score!==null?`${Me.score} 分`:r==="zh"?"未打分":"N/A"})]}),e.jsxs("div",{className:"bg-surface-secondary p-3 rounded-xl border border-theme",children:[e.jsx("div",{className:"text-xs text-muted font-bold uppercase tracking-wider",children:r==="zh"?"课件完成度":"Completion"}),e.jsx("div",{className:"text-xs font-bold text-emerald-600 mt-1",children:Me.completion!==null?`${Math.round(Me.completion*100)}%`:"0%"})]})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsxs("h4",{className:"text-xs font-bold text-main border-b border-theme pb-1.5 flex items-center gap-1.5 flex-wrap",children:[e.jsx(Ge,{size:13,className:"text-primary-theme"}),e.jsx("span",{children:r==="zh"?"实时捕获轨迹事件流 (LMS Bridge)":"LMS Event Captures"})]}),Rr?e.jsxs("div",{className:"py-12 flex flex-col items-center justify-center text-muted gap-2",children:[e.jsx($e,{size:20,className:"animate-spin text-primary-theme"}),e.jsx("span",{className:"text-xs",children:r==="zh"?"正在查询原始数据...":"Loading raw data..."})]}):Array.isArray(Ut)&&Ut.length>0?e.jsx("div",{className:"space-y-3 font-mono text-xs max-h-[40vh] overflow-y-auto pr-1 scrollbar-thin",children:Ut.map((h,D)=>{let F={};try{F=typeof h.payload_json=="string"?JSON.parse(h.payload_json):h.payload_json}catch{}return e.jsxs("div",{className:"p-3 bg-slate-900 text-slate-200 rounded-xl border border-slate-800 flex flex-col gap-1.5",children:[e.jsxs("div",{className:"flex justify-between items-center text-xs text-slate-400 border-b border-slate-800 pb-1",children:[e.jsx("span",{className:"font-bold text-indigo-400 bg-indigo-950/50 border border-indigo-900/50 px-1.5 py-0.5 rounded",children:h.event_type}),e.jsx("span",{children:new Date(h.created_at).toLocaleTimeString()})]}),e.jsx("pre",{className:"overflow-x-auto text-xs leading-relaxed p-1 text-emerald-400/90 whitespace-pre-wrap word-break-all",children:JSON.stringify(F,null,2)})]},h.id||D)})}):e.jsx("div",{className:"py-8 text-center text-xs text-muted italic",children:r==="zh"?"该学生未产生任何轨迹事件数据。":"No trace events captured."})]})]}),e.jsxs("div",{className:"bg-surface-secondary px-6 py-4 border-t border-theme flex justify-between gap-3 shrink-0",children:[e.jsxs("div",{className:"text-xs text-muted flex items-center gap-1",children:[e.jsx(Re,{size:10}),e.jsx("span",{children:"Powered by LMS Bridge API v1"})]}),e.jsx("button",{onClick:()=>Wt(null),className:"px-4 py-1.5 bg-surface hover:bg-surface-secondary border border-theme text-main font-bold rounded-lg text-xs transition-all cursor-pointer shadow-sm active:scale-95",children:r==="zh"?"关闭窗口":"Close"})]})]})}),e.jsx(so,{lang:r,addToast:C,selectedLesson:s,lessonTitle:n.find(h=>h.id===s)?.title??"",className:o.find(h=>h.id===m)?.name??"",liveClassSelectedClassId:m,classroomStage:Z,sessionStartedAt:$s,students:a,liveData:Bt,isGrowthProfileOpen:we,onCloseGrowthProfile:()=>{We(!1),W(null)},growthProfileStudentId:Ke,isPeerReviewShowcaseOpen:ae,onClosePeerReviewShowcase:()=>ge(!1),onAdvanceToStage3:()=>Ue("WRAP_UP_EXIT_TICKET"),peerReviewData:$r,onAutoAssignPeerReview:Er,autoAssigning:Ar,isParentNotificationOpen:Ee,onCloseParentNotification:()=>jt(!1),isMasteryPredictionOpen:yr,onCloseMasteryPrediction:()=>vs(!1),isDiagnosticCenterOpen:vr,onCloseDiagnosticCenter:()=>ws(!1),isGroupCollabOpen:wr,onCloseGroupCollab:()=>ks(!1),isShowcaseDiffOpen:kr,onCloseShowcaseDiff:()=>zs(!1),isMacroRunnerOpen:zr,onCloseMacroRunner:()=>Ss(!1),isHardwareSettingsOpen:Sr,onCloseHardwareSettings:()=>Cs(!1)})]})}export{fo as LiveClassroomView};
|