openlearn-next 0.7.6 → 0.7.8
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 +66 -150
- package/dist/assets/{AcademicYearFilter-DUUGpDKt.js → AcademicYearFilter-Dm3no4Nb.js} +1 -1
- package/dist/assets/ActivityWorkspaceWidget-BXS1IamH.js +1 -0
- package/dist/assets/{AdminDirectoryView-DL9zZi-_.js → AdminDirectoryView-479SfYyD.js} +2 -2
- package/dist/assets/{AssessmentCenter-B2JzXBGe.js → AssessmentCenter-CJ-pchOQ.js} +1 -1
- package/dist/assets/{AssignmentFilePreview-Bk751Blz.js → AssignmentFilePreview-wjnrKjsp.js} +1 -1
- package/dist/assets/{BatchPickerModal-9ekXDUUj.js → BatchPickerModal-JvoD-1pF.js} +1 -1
- package/dist/assets/{ClassesView-PCt8I3MU.js → ClassesView-CB8q2kW0.js} +12 -12
- package/dist/assets/ClassroomCountdownWidget-BqzBpAvi.js +2 -0
- package/dist/assets/{CloudDriveModal-Mp59sr-C.js → CloudDriveModal-DHxOnL4m.js} +1 -1
- package/dist/assets/ComputerLabView-BEDe7WiU.js +1 -0
- package/dist/assets/CourseManagement-BjxQC6sq.js +1 -0
- package/dist/assets/{CourseWizardModal-B7-e8otR.js → CourseWizardModal-D3UPFtT_.js} +2 -2
- package/dist/assets/{CoursewareHubPanel-DLjH-UzF.js → CoursewareHubPanel-CqJqcZGs.js} +1 -1
- package/dist/assets/{Dashboard-D3LXLQNC.js → Dashboard-C3BaEHIG.js} +2 -2
- package/dist/assets/{ExportWeightModal-vd7XgaJ0.js → ExportWeightModal-iF0pVevG.js} +1 -1
- package/dist/assets/{HelpTour-BLuiS8rr.js → HelpTour-6ChRqWnB.js} +1 -1
- package/dist/assets/{HelpView-C4BHoNqR.js → HelpView-D3iYhzBz.js} +2 -2
- package/dist/assets/ImportLessonsModal-BOwj7ezj.js +1 -0
- package/dist/assets/{ImportModal-H5s5MyZY.js → ImportModal-DAHGdI9h.js} +1 -1
- package/dist/assets/{InteractiveCoursewareViewer-D9GzG28E.js → InteractiveCoursewareViewer-DX9xnk6j.js} +1 -1
- package/dist/assets/InteractiveWhiteboard-41mi9keH.js +65 -0
- package/dist/assets/LazyCourseware-DKyUHXaE.js +2 -0
- package/dist/assets/LazyWhiteboard-fXS2P44c.js +2 -0
- package/dist/assets/LessonEditorView-Dx-hOKtt.js +1 -0
- package/dist/assets/LiveClassroomView-m0hKdcVK.js +61 -0
- package/dist/assets/NotificationDetailModal-C2tg_IoJ.js +1 -0
- package/dist/assets/PluginView-BPRUpCjV.js +77 -0
- package/dist/assets/{ProcessLogsModal-_BwkmJVw.js → ProcessLogsModal-CULHzXp7.js} +1 -1
- package/dist/assets/{QuizGeneratorModal-DiItok6z.js → QuizGeneratorModal-CYxngpW9.js} +1 -1
- package/dist/assets/StudentAssignmentEvalPanel-Dfe4IOs5.js +1 -0
- package/dist/assets/{StudentAssignmentView-UK_7_MF3.js → StudentAssignmentView-IfRo3yJk.js} +1 -1
- package/dist/assets/StudentLessonView-Dw2uxBhq.js +1 -0
- package/dist/assets/StudentView-DVYUSrVU.js +2 -0
- package/dist/assets/{SystemResourceLibraryModal-dEdNKbk2.js → SystemResourceLibraryModal-BhbpfIBt.js} +1 -1
- package/dist/assets/TeacherView-CZjIejet.js +2 -0
- package/dist/assets/{TimetableView-AkReskNG.js → TimetableView-CupOIfEy.js} +1 -1
- package/dist/assets/{UTIF-4E-wdh3X.js → UTIF-BtQhea94.js} +1 -1
- package/dist/assets/index-BDFyco9S.css +1 -0
- package/dist/assets/index-BiHQqzdm.js +131 -0
- package/dist/assets/{index.es-WXdI0L-F.js → index.es-CijVATXs.js} +1 -1
- package/dist/assets/{pluginParsers-k90WUDrU.js → pluginParsers-C9W6GBVx.js} +1 -1
- package/dist/assets/{student-workspace-BDw1i4Vl.js → student-workspace-CsbA8Cs4.js} +1 -1
- package/dist/assets/{vendor-charts-SrpBsvM3.js → vendor-charts-skggaP9D.js} +1 -1
- package/dist/assets/{vendor-icons-hc6MjYFv.js → vendor-icons-DaYNfRAc.js} +2 -2
- package/dist/assets/{vendor-konva-Dne0Z-WC.js → vendor-konva-BOuJWFuE.js} +1 -1
- package/dist/assets/{vendor-pdf-By0fofA0.js → vendor-pdf-DVWGghIL.js} +3 -3
- package/dist/assets/{vendor-pptx-EjNUtdws.js → vendor-pptx-BqU7v5zS.js} +5 -5
- package/dist/assets/{vendor-react-Kv_JATwr.js → vendor-react-DHoBZpn2.js} +2 -2
- package/dist/assets/{vendor-utils-aM7aYvPP.js → vendor-utils-BxOuk3id.js} +1 -1
- package/dist/env-validation.cjs +7 -1
- package/dist/index.html +6 -6
- package/dist/server.cjs +343 -37
- package/migrations/044_students_gender.sql +8 -0
- package/migrations/README.md +1 -0
- package/migrations/schema-golden.json +3 -2
- package/package.json +2 -2
- package/dist/assets/ActivityWorkspaceWidget-0DUqiqFK.js +0 -1
- package/dist/assets/ClassroomCountdownWidget-HxelcHUp.js +0 -2
- package/dist/assets/ComputerLabView-FStILvFC.js +0 -1
- package/dist/assets/CourseManagement-BQw2idgZ.js +0 -1
- package/dist/assets/ImportLessonsModal-Y6uIIemO.js +0 -1
- package/dist/assets/InteractiveWhiteboard-DswIV-ES.js +0 -65
- package/dist/assets/LazyCourseware-BEoTTg5h.js +0 -2
- package/dist/assets/LazyWhiteboard-CMBBxnFX.js +0 -2
- package/dist/assets/LessonEditorView-BgJtG8Ks.js +0 -1
- package/dist/assets/LiveClassroomView-Czwt5WW-.js +0 -61
- package/dist/assets/NotificationDetailModal-D42vEs3S.js +0 -1
- package/dist/assets/PluginView-BcOWIjLu.js +0 -77
- package/dist/assets/StudentAssignmentEvalPanel-DHoZc3g0.js +0 -1
- package/dist/assets/StudentLessonView-C11Qkdi_.js +0 -1
- package/dist/assets/StudentView-j0hx3IOi.js +0 -2
- package/dist/assets/TeacherView-COZw2tFl.js +0 -2
- package/dist/assets/index-DN3E-Fmw.js +0 -131
- package/dist/assets/index-DPky2leG.css +0 -1
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import{r as c,j as e}from"./vendor-react-
|
|
1
|
+
import{r as c,j as e}from"./vendor-react-DHoBZpn2.js";import{A as xe,m as H,l as me,b as ue,E as K}from"./index-BiHQqzdm.js";import{b5 as he,X as re,aD as U,au as pe,B as G,aA as ge,h as fe,U as W,V as le,D as be,c as je,Z as ie,an as Ne,u as oe,a3 as de,R as ve,a9 as we,aC as ye,b6 as Se,T as ke,b7 as Ce,ae as ze,e as De,b0 as V,G as Pe,b8 as Me,g as Le,a4 as Te,aY as Ae,b as $e,aa as X,j as Y,ad as Ie}from"./vendor-icons-DaYNfRAc.js";import{a as J,A as Ee,C as Fe,X as Z,Y as ee,T as se,b as _e,e as te,B as Oe,f as Be,g as Re}from"./vendor-charts-skggaP9D.js";import{C as qe,T as ae}from"./ClassroomCountdownWidget-BqzBpAvi.js";import"./vendor-utils-BxOuk3id.js";import"./vendor-pdf-DVWGghIL.js";import"./vendor-motion-BFAPOs-b.js";function Ge({classes:s,lessons:b,lang:w,onScheduleClass:h,onGenerateAssignment:g,onCreateLesson:N}){const[o,y]=c.useState(!1),[p,C]=c.useState("menu"),[v,P]=c.useState(""),[k,M]=c.useState(""),[L,T]=c.useState(""),[A,z]=c.useState(""),[m,$]=c.useState(""),[I,f]=c.useState(""),[S,_]=c.useState(""),[O,D]=c.useState(!1),[E,a]=c.useState(!1),[i,x]=c.useState(null),r={zh:{quickActions:"快捷操作指令",quickDesc:"无需切换页面,在此直接向教育总线或班级下发运行调度命令。",scheduleClass:"排课计划调度",scheduleDesc:"为班级分配课程段并指定授课时间",generateAssignment:"生成 AI 测验任务",generateDesc:"利用代理模型为班级定制专属能力题目",createLesson:"注册教学课件",createDesc:"发布新的富文本 Markdown 教材大纲",back:"返回上级",confirm:"确认并下发指令",classSelect:"选择目标班级",lessonSelect:"选择关联课件",dateSelect:"授课日期选择",assignmentTopic:"测验主题方向 / 核心知识点",assignmentTopicPlaceholder:"例: 一元二次方程,光合作用,牛顿运动定律等...",lessonTitle:"课件名称(大纲标题)",lessonTitlePlaceholder:"例: 量子力学初步 / 物理实验基础",lessonContent:"详细授课内容 (Markdown 支持)",successScheduled:"排课成功!总线已捕获日程数据。",successAssignment:"AI 测验任务成功生成,稍后同步。",successLesson:"新课件发布成功!画板白板可直接拖拽加载。",emptyClasses:"未检测到活跃班级",emptyLessons:"未检测到可用课件",loadingBus:"内核微服务运行中...",genericError:"网络或核指令总线调用失败,请重试"},en:{quickActions:"Quick Actions",quickDesc:"Deploy scheduler and class orchestration bus commands instantly from here.",scheduleClass:"Schedule Lesson Period",scheduleDesc:"Assign a lesson package and scheduled date to an active class",generateAssignment:"Generate AI Assignment",generateDesc:"Deploy agent workflows to design tailored student test cases",createLesson:"Register Lesson Curriculum",createDesc:"Publish new rich Markdown-based whiteboard syllabus",back:"Back",confirm:"Execute Command",classSelect:"Select Class",lessonSelect:"Select Lesson Template",dateSelect:"Choose Scheduled Date",assignmentTopic:"Assignment Topic / Target Knowledge",assignmentTopicPlaceholder:"e.g., Quadratic equations, Photosynthesis, Newtonian gravity...",lessonTitle:"Lesson Curriculum Title",lessonTitlePlaceholder:"e.g., Intro to Quantum Mechanics",lessonContent:"Whiteboard Curriculum Content (Markdown)",successScheduled:"Success! Dynamic class schedule updated.",successAssignment:"Success! AI is compiling custom quiz structures.",successLesson:"Success! Ready to orchestrate inside classroom sandbox.",emptyClasses:"No classes discovered",emptyLessons:"No lessons discovered",loadingBus:"Interfacing core services...",genericError:"System bus execute command failure, please retry"}}[w],n=()=>{P(""),M(""),T(""),z(""),$(""),f(""),_(""),x(null),a(!1),D(!1)},l=()=>{switch(p){case"schedule":return r.successScheduled;case"assignment":return r.successAssignment;case"lesson":return r.successLesson;default:return""}},d=t=>{n(),C(t),s.length>0&&(P(s[0].id),z(s[0].id)),b.length>0&&M(b[0].id),t==="lesson"&&_(`# 新课件名称
|
|
2
2
|
|
|
3
3
|
## 教学目标
|
|
4
4
|
- 掌握核心考点
|
|
5
5
|
- 熟练完成基础物理实验
|
|
6
6
|
|
|
7
7
|
## 课堂探究
|
|
8
|
-
这里写课本的主要讲授要点。`)},u=async t=>{t.preventDefault(),P(!0),x(null);try{let j=!1;if(p==="schedule"){if(!v||!k||!L){x("Please complete all form fields."),P(!1);return}j=await h(v,k,L)}else if(p==="assignment"){if(!$||!m.trim()){x("Please specify target class and a valid topic."),P(!1);return}j=await g($,m.trim())}else if(p==="lesson"){if(!I.trim()||!S.trim()){x("Title and Content can not be empty."),P(!1);return}j=await N(I.trim(),S.trim())}j?(a(!0),setTimeout(()=>{a(!1),C("menu")},2200)):x(r.genericError)}catch(j){x(j.message||r.genericError)}finally{P(!1)}};return e.jsxs("div",{id:"quick-actions-fab-container",className:"absolute bottom-8 right-8 z-40 flex flex-col items-end",children:[e.jsx(xe,{children:o&&e.jsxs(H.div,{initial:{opacity:0,y:15,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:15,scale:.95},transition:{duration:.18},className:"mb-4 w-[360px] sm:w-[420px] bg-white border border-gray-200 rounded-2xl shadow-xl overflow-hidden flex flex-col focus:outline-none",id:"quick-actions-popup-card",children:[e.jsxs("div",{className:"bg-indigo-600 px-5 py-4 text-white flex items-center justify-between shadow-inner",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(he,{size:18,className:"animate-pulse"}),e.jsx("h3",{className:"font-bold text-sm tracking-wide",children:r.quickActions})]}),e.jsx("button",{onClick:()=>{y(!1),C("menu")},className:"text-white/80 hover:text-white hover:bg-white/15 p-1 rounded-full transition-all focus:outline-none",title:"Close Portal",children:e.jsx(re,{size:16})})]}),e.jsxs("div",{className:"p-5 max-h-[480px] overflow-y-auto bg-gray-50/50",children:[p==="menu"&&e.jsxs("div",{className:"space-y-4",children:[e.jsx("p",{className:"text-xs text-gray-500 leading-relaxed font-medium bg-indigo-50/50 border border-indigo-100 p-2.5 rounded-lg mb-4",children:r.quickDesc}),e.jsxs("div",{onClick:()=>d("schedule"),className:"flex items-start gap-3.5 p-3.5 bg-white border border-gray-200 hover:border-indigo-400 hover:shadow-md rounded-xl cursor-pointer transition-all hover:scale-101 group",id:"action-schedule-class",children:[e.jsx("div",{className:"p-2.5 bg-indigo-50 text-indigo-600 rounded-lg group-hover:bg-indigo-600 group-hover:text-white transition-colors duration-200",children:e.jsx(U,{size:18})}),e.jsxs("div",{className:"flex-1",children:[e.jsx("h4",{className:"text-xs font-bold text-gray-800 flex items-center gap-1 group-hover:text-indigo-600 transition-colors uppercase tracking-wider",children:r.scheduleClass}),e.jsx("p",{className:"text-xs text-gray-500 mt-1 leading-relaxed",children:r.scheduleDesc})]})]}),e.jsxs("div",{onClick:()=>d("assignment"),className:"flex items-start gap-3.5 p-3.5 bg-white border border-gray-200 hover:border-purple-400 hover:shadow-md rounded-xl cursor-pointer transition-all hover:scale-101 group",id:"action-generate-assignment",children:[e.jsx("div",{className:"p-2.5 bg-purple-50 text-purple-600 rounded-lg group-hover:bg-purple-600 group-hover:text-white transition-colors duration-200",children:e.jsx(pe,{size:18})}),e.jsxs("div",{className:"flex-1",children:[e.jsx("h4",{className:"text-xs font-bold text-gray-800 flex items-center gap-1 group-hover:text-purple-600 transition-colors uppercase tracking-wider",children:r.generateAssignment}),e.jsx("p",{className:"text-xs text-gray-500 mt-1 leading-relaxed",children:r.generateDesc})]})]}),e.jsxs("div",{onClick:()=>d("lesson"),className:"flex items-start gap-3.5 p-3.5 bg-white border border-gray-200 hover:border-emerald-400 hover:shadow-md rounded-xl cursor-pointer transition-all hover:scale-101 group",id:"action-create-lesson",children:[e.jsx("div",{className:"p-2.5 bg-emerald-50 text-emerald-600 rounded-lg group-hover:bg-emerald-600 group-hover:text-white transition-colors duration-200",children:e.jsx(G,{size:18})}),e.jsxs("div",{className:"flex-1",children:[e.jsx("h4",{className:"text-xs font-bold text-gray-800 flex items-center gap-1 group-hover:text-emerald-600 transition-colors uppercase tracking-wider",children:r.createLesson}),e.jsx("p",{className:"text-xs text-gray-500 mt-1 leading-relaxed",children:r.createDesc})]})]})]}),p!=="menu"&&e.jsxs("div",{className:"relative",children:[e.jsxs("button",{onClick:()=>C("menu"),className:"flex items-center gap-1.5 text-xs text-gray-500 hover:text-indigo-600 font-semibold mb-4 cursor-pointer focus:outline-none",id:"action-back-button",children:[e.jsx(ge,{size:14}),e.jsx("span",{children:r.back})]}),E?e.jsxs(H.div,{initial:{scale:.95},animate:{scale:1},className:"flex flex-col items-center justify-center py-10 text-center",children:[e.jsx(fe,{size:48,className:"text-green-500 animate-bounce mb-3"}),e.jsx("h4",{className:"font-bold text-green-800 text-sm",children:l()}),e.jsx("p",{className:"text-xs text-gray-400 mt-1",children:"Returning to action console..."})]}):e.jsxs("form",{onSubmit:u,className:"space-y-4",children:[i&&e.jsxs("div",{className:"p-3 bg-red-50 border border-red-200 rounded-lg text-red-600 text-xs font-semibold",children:["⚠️ ",i]}),p==="schedule"&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsxs("label",{className:"text-xs font-bold text-gray-600 flex items-center gap-1",children:[e.jsx(W,{size:12})," ",r.classSelect]}),s.length===0?e.jsx("p",{className:"text-xs italic text-red-500",children:r.emptyClasses}):e.jsx("select",{value:v,onChange:t=>D(t.target.value),className:"w-full bg-white border border-gray-200 rounded-lg p-2.5 text-xs focus:ring-2 focus:ring-indigo-500 text-gray-700 font-medium",children:s.map(t=>e.jsx("option",{value:t.id,children:t.name},t.id))})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsxs("label",{className:"text-xs font-bold text-gray-600 flex items-center gap-1",children:[e.jsx(G,{size:12})," ",r.lessonSelect]}),b.length===0?e.jsx("p",{className:"text-xs italic text-red-500",children:r.emptyLessons}):e.jsx("select",{value:k,onChange:t=>M(t.target.value),className:"w-full bg-white border border-gray-200 rounded-lg p-2.5 text-xs focus:ring-2 focus:ring-indigo-500 text-gray-700 font-medium",children:b.map(t=>e.jsx("option",{value:t.id,children:t.title},t.id))})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsxs("label",{className:"text-xs font-bold text-gray-600 flex items-center gap-1",children:[e.jsx(U,{size:12})," ",r.dateSelect]}),e.jsx("input",{type:"date",value:L,onChange:t=>T(t.target.value),className:"w-full bg-white border border-gray-200 rounded-lg p-2.5 text-xs focus:ring-2 focus:ring-indigo-500 text-gray-700 font-medium",required:!0})]})]}),p==="assignment"&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsxs("label",{className:"text-xs font-bold text-gray-600 flex items-center gap-1",children:[e.jsx(W,{size:12})," ",r.classSelect]}),s.length===0?e.jsx("p",{className:"text-xs italic text-red-500",children:r.emptyClasses}):e.jsx("select",{value:$,onChange:t=>z(t.target.value),className:"w-full bg-white border border-gray-200 rounded-lg p-2.5 text-xs focus:ring-2 focus:ring-indigo-500 text-gray-700 font-medium",children:s.map(t=>e.jsx("option",{value:t.id,children:t.name},t.id))})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsxs("label",{className:"text-xs font-bold text-gray-600 flex items-center gap-1",children:[e.jsx(le,{size:12})," ",r.assignmentTopic]}),e.jsx("input",{type:"text",value:m,onChange:t=>A(t.target.value),placeholder:r.assignmentTopicPlaceholder,className:"w-full bg-white border border-gray-200 rounded-lg p-2.5 text-xs focus:ring-2 focus:ring-indigo-500 text-gray-700 font-medium",required:!0})]})]}),p==="lesson"&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsxs("label",{className:"text-xs font-bold text-gray-600 flex items-center gap-1",children:[e.jsx(be,{size:12})," ",r.lessonTitle]}),e.jsx("input",{type:"text",value:I,onChange:t=>f(t.target.value),placeholder:r.lessonTitlePlaceholder,className:"w-full bg-white border border-gray-200 rounded-lg p-2.5 text-xs focus:ring-2 focus:ring-indigo-500 text-gray-700 font-medium",required:!0})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsxs("label",{className:"text-xs font-bold text-gray-600 flex items-center gap-1",children:[e.jsx(G,{size:12})," ",r.lessonContent]}),e.jsx("textarea",{value:S,onChange:t=>_(t.target.value),rows:5,className:"w-full bg-white border border-gray-200 rounded-lg p-2.5 text-xs focus:ring-2 focus:ring-indigo-500 font-mono text-gray-700",required:!0})]})]}),e.jsx("button",{type:"submit",disabled:O||p==="schedule"&&(s.length===0||b.length===0)||p==="assignment"&&s.length===0,className:"w-full bg-indigo-600 hover:bg-indigo-700 text-white font-bold text-xs py-2.5 px-4 rounded-xl flex items-center justify-center gap-2 cursor-pointer transition-all shadow-md active:scale-98 disabled:opacity-50",children:O?e.jsxs(e.Fragment,{children:[e.jsx(je,{size:14,className:"animate-spin"}),e.jsx("span",{children:r.loadingBus})]}):e.jsxs(e.Fragment,{children:[e.jsx(ie,{size:13}),e.jsx("span",{children:r.confirm})]})})]})]})]})]})}),e.jsxs("button",{onClick:()=>{y(!o),C("menu")},className:"w-14 h-14 bg-indigo-600 hover:bg-indigo-700 text-white rounded-full flex items-center justify-center shadow-lg hover:shadow-indigo-200 hover:shadow-2xl transition-all duration-250 cursor-pointer active:scale-95 focus:outline-none relative group",title:"Trigger Education OS Quick Scheduler Command Panel",id:"quick-actions-fab-button",children:[e.jsx("span",{className:"absolute inline-flex h-full w-full rounded-full bg-purple-400 opacity-20 group-hover:animate-ping"}),e.jsx(H.div,{animate:{rotate:o?135:0},transition:{duration:.2},className:"flex items-center justify-center text-white",children:e.jsx(Ne,{size:24,strokeWidth:2.8})})]})]})}function ne({lang:s="zh",lessons:b=[],classes:w=[],schedules:h=[],students:g=[],addToast:N}){const[o,y]=c.useState(""),[p,C]=c.useState(15),[v,D]=c.useState(!1),[k,M]=c.useState(!1),[L,T]=c.useState(!1),[$,z]=c.useState([]),[m,A]=c.useState({currentEngagement:0,moodStatus:"CALM",moodLabel:s==="zh"?"等待课堂数据…":"Waiting for classroom data…",moodEmoji:"⏳",totalInteractions:0,interactionFrequencyPerMin:"0",pulseDistribution:{clearCount:0,confusedCount:0,tooFastCount:0,total:0,clearPercent:0,confusedPercent:0,tooFastPercent:0}}),[I,f]=c.useState([]);c.useEffect(()=>{if(!o&&b.length>0){const a=h.find(i=>i.status!=="cancelled");a?.lesson_id?y(a.lesson_id):y(b[0].id)}},[b,h,o]);const S=c.useCallback(async()=>{if(o){M(!0);try{const a=await fetch(`/api/classroom/sessions/${o}/mood-tracker?minutes=${p}`);if(a.ok){const i=await a.json();i.success&&i.timeline?(A(i.metrics),f(i.timeline)):f([])}else f([])}catch{f([])}finally{M(!1)}}},[o,p]);c.useCallback(a=>{const i=[],x=Date.now();for(let r=a-1;r>=0;r--){const n=x-r*60*1e3,l=new Date(n),d=`${l.getHours().toString().padStart(2,"0")}:${l.getMinutes().toString().padStart(2,"0")}`,u=72+Math.sin(r*.5)*12,t=Math.max(0,Math.round(2+Math.cos(r*.8)*3));i.push({time:d,timestamp:n,engagement:Math.min(100,Math.max(30,Math.round(u))),energy:Math.min(100,Math.max(20,Math.round(55+t*9))),interactions:t,clear:Math.round(t*.7),confused:Math.round(t*.2),tooFast:Math.round(t*.1)})}f(i)},[]),c.useEffect(()=>{S()},[S]),c.useEffect(()=>{const a=l=>{if(l.lessonId===o||!l.lessonId){S();const d=new Date,u=`${d.getHours().toString().padStart(2,"0")}:${d.getMinutes().toString().padStart(2,"0")}:${d.getSeconds().toString().padStart(2,"0")}`;z(t=>[{id:`pulse_${Date.now()}`,text:s==="zh"?"收到学生节奏脉搏反馈":"Student submitted pacing pulse",time:u,type:"clear"},...t.slice(0,5)])}},i=l=>{if(l.lessonId===o||!l.lessonId){S();const d=new Date,u=`${d.getHours().toString().padStart(2,"0")}:${d.getMinutes().toString().padStart(2,"0")}:${d.getSeconds().toString().padStart(2,"0")}`;z(t=>[{id:`poll_${Date.now()}`,text:`${l.latestVoter||(s==="zh"?"学生":"Student")} ${s==="zh"?"参与了随堂投票":"voted in poll"}`,time:u,type:"poll"},...t.slice(0,5)])}},x=l=>{if(l.lessonId===o||!l.lessonId){S();const d=new Date,u=`${d.getHours().toString().padStart(2,"0")}:${d.getMinutes().toString().padStart(2,"0")}:${d.getSeconds().toString().padStart(2,"0")}`;z(t=>[{id:`buzzer_${Date.now()}`,text:`⚡ ${l.winnerStudentName||"Student"} ${s==="zh"?"抢答命中":"buzzed in"} (${l.responseTimeMs}ms)`,time:u,type:"fast"},...t.slice(0,5)])}};let r=null;const n=me(l=>{r?.(),l.on("classroom:pacing_updated",a),l.on("classroom:quick_poll_updated",i),l.on("classroom:buzzer_winner",x),r=()=>{typeof l.off=="function"&&(l.off("classroom:pacing_updated",a),l.off("classroom:quick_poll_updated",i),l.off("classroom:buzzer_winner",x))}});return()=>{n(),r?.()}},[o,S,s]),c.useEffect(()=>{if(!v)return;const a=setInterval(()=>{f(i=>{if(i.length===0)return i;const x=Date.now(),r=new Date(x),n=`${r.getHours().toString().padStart(2,"0")}:${r.getMinutes().toString().padStart(2,"0")}`,l=i[i.length-1],d=Math.round((Math.random()-.45)*6),u=Math.min(98,Math.max(45,l.engagement+d)),t=Math.floor(Math.random()*5),j=Math.round(t*.75),B=Math.round(t*.2),F=Math.max(0,t-j-B),q={time:n,timestamp:x,engagement:u,energy:Math.min(100,Math.max(30,50+t*12)),interactions:t,clear:j,confused:B,tooFast:F};return[...i.slice(1),q]}),A(i=>{const x=Math.round((Math.random()-.45)*3),r=Math.min(96,Math.max(50,i.currentEngagement+x));return{...i,currentEngagement:r,totalInteractions:i.totalInteractions+1}})},4e3);return()=>clearInterval(a)},[v]);const _=async()=>{if(o){T(!0);try{(await fetch(`/api/classroom/sessions/${o}/pulse-check`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({prompt:s==="zh"?"当前讲解节奏如何?请按下脉搏按钮反馈":"How is current pacing? Send your pulse",durationSec:30})})).ok?N?.(s==="zh"?"脉搏检测已下发":"Pulse Check Dispatched",s==="zh"?"已向全体听课学生弹出 30s 课堂节奏自检晴雨表":"30-second pulse check sent to students","success"):N?.(s==="zh"?"提示":"Notice",s==="zh"?"脉搏指令已广播至本地课堂":"Pulse check broadcasted locally","info")}catch{N?.(s==="zh"?"脉搏指令广播":"Pulse Broadcasted",s==="zh"?"已通过 WebSocket 广播脉搏信号":"Broadcasted pulse signal via WebSocket","info")}finally{T(!1)}}},O=c.useMemo(()=>{const a=m.pulseDistribution;return[{name:s==="zh"?"听懂了 (Clear)":"Clear",percent:a.clearPercent,count:a.clearCount,color:"#10b981"},{name:s==="zh"?"有疑问 (Confused)":"Confused",percent:a.confusedPercent,count:a.confusedCount,color:"#f59e0b"},{name:s==="zh"?"讲太快 (Too Fast)":"Too Fast",percent:a.tooFastPercent,count:a.tooFastCount,color:"#ef4444"}]},[m.pulseDistribution,s]),P=b.find(a=>a.id===o),E=c.useMemo(()=>{const{currentEngagement:a,pulseDistribution:i}=m;return i.confusedPercent>25?{type:"warning",text:s==="zh"?"⚠️ 超过 25% 学生反馈理解受阻,建议暂停并使用白板重绘核心公式或做针对性互动提问。":"⚠️ >25% students confused. Pause and re-explain key concept on whiteboard."}:i.tooFastPercent>20?{type:"caution",text:s==="zh"?"⚡ 约 20% 学生跟不上当前语速或换页节奏,建议稍加减速,并留出 15 秒消化提问时间。":"⚡ Pacing too fast. Slow down and give 15s pause for note-taking."}:a>=80?{type:"success",text:s==="zh"?"🌟 课堂进入高专注黄金区间(心流状态)!建议趁热打铁,推送随堂探究或随堂测验。":"🌟 Optimal Flow detected! High focus. Great moment to launch interactive quiz."}:{type:"info",text:s==="zh"?"💡 专注度平稳,可穿插抢答(Buzzer)或快速单选投票以进一步激活课堂互动。":"💡 Steady attention. Consider triggering a Buzzer or Quick Poll to boost energy."}},[m,s]);return e.jsxs("div",{id:"classroom-mood-tracker-container",className:"bg-white border border-slate-200/80 rounded-2xl p-5 shadow-sm flex flex-col gap-5 transition-all duration-300",children:[e.jsxs("div",{className:"flex flex-col lg:flex-row items-start lg:items-center justify-between gap-4 border-b border-slate-100 pb-4",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"w-10 h-10 rounded-xl bg-gradient-to-tr from-indigo-500 to-teal-400 text-white flex items-center justify-center shadow-xs shrink-0",children:e.jsx(oe,{size:20,className:"animate-pulse"})}),e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[e.jsxs("span",{className:"text-xs font-black uppercase tracking-wider text-indigo-700 bg-indigo-50 border border-indigo-100/60 px-2.5 py-0.5 rounded-full flex items-center gap-1.5",children:[e.jsx(de,{size:12,className:"text-rose-500 animate-ping"}),e.jsx("span",{children:s==="zh"?"实时课堂专注度与情绪晴雨表":"REAL-TIME CLASSROOM MOOD"})]}),e.jsxs("span",{className:"text-xs font-bold px-2 py-0.5 rounded-full bg-slate-100 text-slate-700 flex items-center gap-1",children:[e.jsx("span",{children:m.moodEmoji}),e.jsx("span",{children:m.moodLabel})]})]}),e.jsx("h2",{className:"text-base font-extrabold text-slate-800 tracking-tight mt-1 flex items-center gap-2",children:e.jsx("span",{children:P?P.title:s==="zh"?"活跃课堂":"Active Lesson"})})]})]}),e.jsxs("div",{className:"flex items-center gap-2 flex-wrap w-full lg:w-auto justify-end",children:[e.jsx("select",{id:"mood-tracker-lesson-select","aria-label":s==="zh"?"选择要查看的课节":"Select lesson to view",value:o,onChange:a=>y(a.target.value),className:"text-xs font-bold bg-slate-50 border border-slate-200 rounded-xl px-2.5 py-2 text-slate-700 focus:ring-2 focus:ring-indigo-500 outline-none cursor-pointer",children:b.map(a=>e.jsxs("option",{value:a.id,children:["📖 ",a.title]},a.id))}),e.jsx("div",{className:"flex items-center bg-slate-100 p-0.5 rounded-xl border border-slate-200/60 text-xs font-bold text-slate-600",children:[5,15,30].map(a=>e.jsxs("button",{type:"button",onClick:()=>C(a),className:`px-2.5 py-1.5 rounded-lg transition-all cursor-pointer ${p===a?"bg-white text-indigo-700 shadow-2xs":"hover:text-slate-900"}`,children:[a,"m"]},a))}),e.jsxs("button",{id:"mood-tracker-sim-btn",type:"button",onClick:()=>D(!v),className:`px-3 py-2 text-xs font-bold rounded-xl border transition-all cursor-pointer flex items-center gap-1.5 shadow-2xs ${v?"bg-amber-500/10 text-amber-700 border-amber-500/30 ring-2 ring-amber-500/20":"bg-slate-50 text-slate-600 border-slate-200 hover:bg-slate-100"}`,title:s==="zh"?"开启/关闭实时模拟数据流 (在暂无学生连入时快速预览曲线波动)":"Toggle simulated live telemetry flow",children:[e.jsx(le,{size:13,className:v?"text-amber-600 animate-spin":"text-slate-400"}),e.jsx("span",{children:v?s==="zh"?"实时模拟中":"Simulating":s==="zh"?"模拟数据流":"Simulate"})]}),e.jsxs("button",{id:"mood-tracker-trigger-pulse-btn",type:"button",onClick:_,disabled:L,className:"px-3.5 py-2 bg-gradient-to-r from-indigo-600 to-teal-600 hover:from-indigo-700 hover:to-teal-700 text-white rounded-xl text-xs font-extrabold flex items-center gap-1.5 shadow-xs transition-all active:scale-95 cursor-pointer disabled:opacity-50",children:[e.jsx(ie,{size:13}),e.jsx("span",{children:s==="zh"?"发起30s即时脉搏检":"Instant Pulse Check"})]}),e.jsx("button",{type:"button",onClick:S,disabled:k,className:"p-2 text-slate-500 hover:text-indigo-600 hover:bg-slate-100 rounded-xl transition-colors cursor-pointer",title:s==="zh"?"刷新数据":"Refresh",children:e.jsx(ve,{size:14,className:k?"animate-spin text-indigo-600":""})})]})]}),e.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-3.5",children:[e.jsxs("div",{className:"bg-gradient-to-br from-indigo-50/50 to-teal-50/30 border border-indigo-100/70 rounded-xl p-3.5 flex flex-col justify-between shadow-3xs",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("span",{className:"text-xs font-extrabold text-indigo-700 uppercase tracking-wider flex items-center gap-1",children:[e.jsx(we,{size:13}),e.jsx("span",{children:s==="zh"?"综合专注指数":"Engagement Index"})]}),e.jsx("span",{className:"text-xs font-bold text-emerald-600 bg-emerald-100/60 px-1.5 py-0.5 rounded-md",children:m.currentEngagement>=70?"Optimal":"Standard"})]}),e.jsxs("div",{className:"mt-2 flex items-baseline gap-2",children:[e.jsxs("span",{className:"text-3xl font-black text-slate-850 tracking-tight font-mono",children:[m.currentEngagement,"%"]}),e.jsx("span",{className:"text-xs text-slate-450 font-medium",children:"/ 100"})]}),e.jsx("div",{className:"w-full bg-slate-200/60 rounded-full h-1.5 mt-2 overflow-hidden",children:e.jsx("div",{className:"bg-gradient-to-r from-indigo-500 to-teal-400 h-1.5 rounded-full transition-all duration-500",style:{width:`${m.currentEngagement}%`}})})]}),e.jsxs("div",{className:"bg-gradient-to-br from-amber-50/50 to-orange-50/30 border border-amber-100/70 rounded-xl p-3.5 flex flex-col justify-between shadow-3xs",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("span",{className:"text-xs font-extrabold text-amber-700 uppercase tracking-wider flex items-center gap-1",children:[e.jsx(ye,{size:13}),e.jsx("span",{children:s==="zh"?"互动触发频度":"Interaction Rate"})]}),e.jsxs("span",{className:"text-xs font-bold text-amber-700 bg-amber-100/60 px-1.5 py-0.5 rounded-md",children:[m.totalInteractions," ",s==="zh"?"次":"acts"]})]}),e.jsxs("div",{className:"mt-2 flex items-baseline gap-2",children:[e.jsx("span",{className:"text-3xl font-black text-slate-850 tracking-tight font-mono",children:m.interactionFrequencyPerMin}),e.jsx("span",{className:"text-xs text-slate-450 font-medium",children:"req / min"})]}),e.jsx("p",{className:"text-2xs text-slate-455 mt-2 truncate",children:s==="zh"?"包含投票、抢答与节奏反馈":"Polls, Buzzers & Pacing"})]}),e.jsxs("div",{className:"bg-gradient-to-br from-emerald-50/50 to-green-50/30 border border-emerald-100/70 rounded-xl p-3.5 flex flex-col justify-between shadow-3xs",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("span",{className:"text-xs font-extrabold text-emerald-700 uppercase tracking-wider flex items-center gap-1",children:[e.jsx(Se,{size:13}),e.jsx("span",{children:s==="zh"?"听懂顺畅率":"Pulse Clarity"})]}),e.jsxs("span",{className:"text-xs font-bold text-emerald-700 bg-emerald-100/60 px-1.5 py-0.5 rounded-md",children:[m.pulseDistribution.clearCount," ",s==="zh"?"人次":"clear"]})]}),e.jsxs("div",{className:"mt-2 flex items-baseline gap-2",children:[e.jsxs("span",{className:"text-3xl font-black text-slate-850 tracking-tight font-mono text-emerald-600",children:[m.pulseDistribution.clearPercent,"%"]}),e.jsx("span",{className:"text-xs text-slate-450 font-medium",children:s==="zh"?"理解无障碍":"comprehension"})]}),e.jsx("div",{className:"w-full bg-slate-200/60 rounded-full h-1.5 mt-2 overflow-hidden",children:e.jsx("div",{className:"bg-emerald-500 h-1.5 rounded-full transition-all duration-500",style:{width:`${m.pulseDistribution.clearPercent}%`}})})]}),e.jsxs("div",{className:"bg-gradient-to-br from-rose-50/50 to-pink-50/30 border border-rose-100/70 rounded-xl p-3.5 flex flex-col justify-between shadow-3xs",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("span",{className:"text-xs font-extrabold text-rose-700 uppercase tracking-wider flex items-center gap-1",children:[e.jsx(ke,{size:13}),e.jsx("span",{children:s==="zh"?"疑问/过快预警":"Confusion Signals"})]}),e.jsxs("span",{className:"text-xs font-bold text-rose-700 bg-rose-100/60 px-1.5 py-0.5 rounded-md",children:[m.pulseDistribution.confusedCount+m.pulseDistribution.tooFastCount," ",s==="zh"?"信号":"signals"]})]}),e.jsxs("div",{className:"mt-2 flex items-baseline gap-2",children:[e.jsxs("span",{className:"text-3xl font-black text-slate-850 tracking-tight font-mono text-rose-600",children:[m.pulseDistribution.confusedPercent+m.pulseDistribution.tooFastPercent,"%"]}),e.jsx("span",{className:"text-xs text-slate-450 font-medium",children:s==="zh"?"需重点关注":"need attention"})]}),e.jsxs("p",{className:"text-2xs text-rose-600/80 mt-2 truncate font-semibold",children:[m.pulseDistribution.confusedCount," ",s==="zh"?"存疑":"confused"," ·"," ",m.pulseDistribution.tooFastCount," ",s==="zh"?"偏快":"fast"]})]})]}),e.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-12 gap-5 items-stretch",children:[e.jsxs("div",{className:"lg:col-span-8 bg-slate-50/60 border border-slate-200/70 rounded-2xl p-4 flex flex-col min-h-[300px]",children:[e.jsxs("div",{className:"flex items-center justify-between mb-3",children:[e.jsxs("div",{children:[e.jsxs("span",{className:"text-xs font-black text-slate-800 uppercase tracking-wider flex items-center gap-1.5",children:[e.jsx(Ce,{size:14,className:"text-indigo-600"}),e.jsx("span",{children:s==="zh"?"课堂专注度与能量动态走势":"Engagement & Energy Dynamics"})]}),e.jsx("p",{className:"text-xs text-slate-450 mt-0.5",children:s==="zh"?`以分钟为切片的动态能量波(基准线 70% 为最佳心流区间,过去 ${p} 分钟)`:"1-minute interval dynamic waveform (70% optimal flow baseline)"})]}),e.jsxs("div",{className:"flex items-center gap-3 text-2xs font-bold",children:[e.jsxs("span",{className:"flex items-center gap-1 text-teal-700",children:[e.jsx("span",{className:"w-2.5 h-2.5 rounded-full bg-teal-500 inline-block"}),s==="zh"?"专注度 (Engagement %)":"Engagement %"]}),e.jsxs("span",{className:"flex items-center gap-1 text-indigo-700",children:[e.jsx("span",{className:"w-2.5 h-2.5 rounded-full bg-indigo-500 inline-block"}),s==="zh"?"能量波 (Energy Wave)":"Energy Wave"]})]})]}),e.jsx("div",{className:"flex-1 w-full h-[230px] min-h-[220px]",children:e.jsx(J,{width:"100%",height:"100%",children:e.jsxs(Ee,{data:I,margin:{top:10,right:10,left:-20,bottom:0},children:[e.jsxs("defs",{children:[e.jsxs("linearGradient",{id:"engagementGradient",x1:"0",y1:"0",x2:"0",y2:"1",children:[e.jsx("stop",{offset:"5%",stopColor:"#14b8a6",stopOpacity:.4}),e.jsx("stop",{offset:"95%",stopColor:"#14b8a6",stopOpacity:0})]}),e.jsxs("linearGradient",{id:"energyGradient",x1:"0",y1:"0",x2:"0",y2:"1",children:[e.jsx("stop",{offset:"5%",stopColor:"#6366f1",stopOpacity:.3}),e.jsx("stop",{offset:"95%",stopColor:"#6366f1",stopOpacity:0})]})]}),e.jsx(Fe,{strokeDasharray:"3 3",vertical:!1,stroke:"#e2e8f0"}),e.jsx(Z,{dataKey:"time",tick:{fontSize:11,fill:"#64748b"},stroke:"#cbd5e1",tickLine:!1}),e.jsx(ee,{domain:[20,100],tick:{fontSize:11,fill:"#64748b"},stroke:"#cbd5e1",tickLine:!1}),e.jsx(se,{content:({active:a,payload:i})=>{if(a&&i&&i.length){const x=i[0].payload;return e.jsxs("div",{className:"bg-slate-900 text-white rounded-xl p-3 text-xs shadow-xl border border-slate-750 flex flex-col gap-1 min-w-[170px]",children:[e.jsxs("div",{className:"flex items-center justify-between border-b border-slate-700 pb-1 font-mono text-slate-300",children:[e.jsxs("span",{children:["⏱️ ",x.time]}),e.jsxs("span",{className:"text-emerald-400 font-bold",children:[x.engagement,"% 专注"]})]}),e.jsxs("div",{className:"flex items-center justify-between mt-1 text-slate-200",children:[e.jsx("span",{children:"⚡ 课堂能量波:"}),e.jsxs("span",{className:"font-bold text-indigo-400",children:[x.energy,"%"]})]}),e.jsxs("div",{className:"flex items-center justify-between text-slate-300",children:[e.jsx("span",{children:"🎯 互动操作次数:"}),e.jsxs("span",{className:"font-bold",children:[x.interactions," 次"]})]}),e.jsxs("div",{className:"border-t border-slate-800 pt-1 mt-1 flex justify-between text-2xs text-slate-400",children:[e.jsxs("span",{className:"text-emerald-400",children:["听懂: ",x.clear]}),e.jsxs("span",{className:"text-amber-400",children:["存疑: ",x.confused]}),e.jsxs("span",{className:"text-rose-400",children:["过快: ",x.tooFast]})]})]})}return null}}),e.jsx(_e,{y:70,stroke:"#10b981",strokeDasharray:"4 4",label:{value:s==="zh"?"黄金心流区间 70%":"Optimal Flow 70%",fill:"#059669",fontSize:10,position:"insideTopLeft"}}),e.jsx(te,{type:"monotone",dataKey:"engagement",name:"Engagement",stroke:"#0d9488",strokeWidth:2.5,fillOpacity:1,fill:"url(#engagementGradient)"}),e.jsx(te,{type:"monotone",dataKey:"energy",name:"Energy",stroke:"#6366f1",strokeWidth:2,fillOpacity:1,fill:"url(#energyGradient)"})]})})})]}),e.jsxs("div",{className:"lg:col-span-4 bg-slate-50/60 border border-slate-200/70 rounded-2xl p-4 flex flex-col justify-between min-h-[300px]",children:[e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center justify-between mb-2",children:[e.jsxs("span",{className:"text-xs font-black text-slate-800 uppercase tracking-wider flex items-center gap-1.5",children:[e.jsx(ze,{size:14,className:"text-teal-600"}),e.jsx("span",{children:s==="zh"?"学生脉搏反馈占比":"Pulse Distribution"})]}),e.jsxs("span",{className:"text-xs text-slate-500 font-bold",children:[m.pulseDistribution.total," ",s==="zh"?"总票数":"total"]})]}),e.jsx("p",{className:"text-xs text-slate-450 mb-3",children:s==="zh"?"30秒极速自检晴雨表反馈结构":"Direct student pacing signal distribution"}),e.jsx("div",{className:"h-[120px] w-full",children:e.jsx(J,{width:"100%",height:"100%",children:e.jsxs(Oe,{data:O,layout:"vertical",margin:{top:0,right:30,left:10,bottom:0},children:[e.jsx(Z,{type:"number",domain:[0,100],hide:!0}),e.jsx(ee,{type:"category",dataKey:"name",tick:{fontSize:11,fill:"#334155",fontWeight:600},width:85,axisLine:!1,tickLine:!1}),e.jsx(se,{formatter:(a,i,x)=>[`${a}% (${x.payload.count}人次)`,"占比"]}),e.jsx(Be,{dataKey:"percent",radius:[0,8,8,0],barSize:18,children:O.map((a,i)=>e.jsx(qe,{fill:a.color},`cell-${i}`))})]})})})]}),e.jsxs("div",{className:"mt-3 border-t border-slate-200/70 pt-3",children:[e.jsx("span",{className:"text-2xs font-bold uppercase tracking-wider text-slate-450 block mb-1.5",children:s==="zh"?"最新动态流水":"Latest Live Signals"}),$.length===0?e.jsx("div",{className:"text-2xs text-slate-400 py-1 italic",children:s==="zh"?"等待学生端点击晴雨表或参与抢答投票...":"Listening for live student signals or polls..."}):e.jsx("div",{className:"space-y-1.5 max-h-[70px] overflow-y-auto pr-1",children:$.map(a=>e.jsxs("div",{className:"flex items-center justify-between text-2xs py-1 px-2 bg-white rounded-lg border border-slate-200/60 shadow-3xs",children:[e.jsx("span",{className:"font-semibold text-slate-700 truncate max-w-[160px]",children:a.text}),e.jsx("span",{className:"font-mono text-slate-400 shrink-0",children:a.time})]},a.id))})]})]})]}),e.jsxs("div",{className:`p-3.5 rounded-xl border flex items-center gap-3 transition-all ${E.type==="warning"?"bg-amber-500/10 border-amber-500/30 text-amber-900":E.type==="caution"?"bg-rose-500/10 border-rose-500/30 text-rose-900":"bg-emerald-500/10 border-emerald-500/30 text-emerald-900"}`,children:[e.jsx("div",{className:"w-8 h-8 rounded-lg bg-white/80 flex items-center justify-center shrink-0 shadow-3xs",children:e.jsx(Pe,{size:18,className:E.type==="warning"?"text-amber-600":E.type==="caution"?"text-rose-600":"text-emerald-600"})}),e.jsxs("div",{className:"flex-1 text-xs",children:[e.jsx("span",{className:"font-bold mr-1.5",children:s==="zh"?"AI 教学节奏诊断建议:":"Teaching Pace Advice:"}),e.jsx("span",{children:E.text})]})]})]})}function We({classDashboardMap:s,classes:b,lang:w}){const h=w==="zh",g=c.useMemo(()=>{const o=Object.keys(s);if(o.length===0)return null;let y=0,p=0,C=0,v=0,D=0,k=0;for(const $ of o){const z=s[$];if(!z)continue;const m=z.performance??[],A=z.rollcallStats??[];for(const f of m)f.score!=null&&!isNaN(Number(f.score))&&(y+=Number(f.score),p++);const I=new Map;for(const f of m)(f.submission_status==="submitted"||f.score!=null)&&I.set(f.student_id,!0);C+=A.length||0,v+=I.size;for(const f of A)D+=f.count??0,k++}const M=p>0?Math.round(y/p):null,L=C>0?Math.round(v/C*100):null,T=k>0?(D/k).toFixed(1):null;return{avgGrade:M,attendanceRate:L,participationScore:T,classCount:o.length}},[s]);if(!g)return 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-3",children:[e.jsx(V,{size:16,className:"text-primary-theme"}),e.jsx("h3",{className:"text-sm font-black text-main",children:h?"班级综合数据概览":"Class Summary Stats"})]}),e.jsx("p",{className:"text-xs text-muted text-center py-6",children:h?"暂无班级数据,展开班级卡片后将自动加载":"No class data yet — expand a class card to load data"})]});const N=[{icon:De,label:h?"平均成绩":"Average Grade",value:g.avgGrade!=null?`${g.avgGrade}`:"—",suffix:g.avgGrade!=null?h?"分":"pts":"",hint:h?"基于已评分作业":"Based on graded assignments",tone:"text-emerald-700 bg-emerald-50 border-emerald-200/80 dark:bg-emerald-950/40 dark:border-emerald-800/70 dark:text-emerald-300",iconBg:"bg-emerald-100 dark:bg-emerald-900/50"},{icon:W,label:h?"出勤提交率":"Submission Rate",value:g.attendanceRate!=null?`${g.attendanceRate}`:"—",suffix:g.attendanceRate!=null?"%":"",hint:h?"至少提交过一次作业的学生占比":"Students with at least one submission",tone:"text-blue-700 bg-blue-50 border-blue-200/80 dark:bg-blue-950/40 dark:border-blue-800/70 dark:text-blue-300",iconBg:"bg-blue-100 dark:bg-blue-900/50"},{icon:de,label:h?"课堂参与频次":"Participation Freq.",value:g.participationScore??"—",suffix:g.participationScore!=null?h?"次/人":"/student":"",hint:h?"平均点名回答次数":"Average rollcall picks per student",tone:"text-amber-700 bg-amber-50 border-amber-200/80 dark:bg-amber-950/40 dark:border-amber-800/70 dark:text-amber-300",iconBg:"bg-amber-100 dark:bg-amber-900/50"}];return e.jsxs("div",{className:"bg-surface border border-theme rounded-2xl p-5 shadow-sm",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(V,{size:16,className:"text-primary-theme"}),e.jsx("h3",{className:"text-sm font-black text-main",children:h?"班级综合数据概览":"Class Summary Stats"})]}),e.jsx("span",{className:"text-2xs font-semibold text-muted px-2 py-0.5 rounded-lg bg-surface-secondary border border-theme",children:h?`已加载 ${g.classCount} 个班级`:`${g.classCount} class(es) loaded`})]}),e.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-3 gap-3",children:N.map(o=>{const y=o.icon;return e.jsxs("div",{className:"rounded-xl border border-theme bg-surface-secondary p-4 flex items-start gap-3",children:[e.jsx("div",{className:`w-9 h-9 rounded-lg ${o.iconBg} border border-theme flex items-center justify-center shrink-0`,children:e.jsx(y,{size:16,className:o.tone.split(" ")[0]})}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("div",{className:"text-2xs text-muted font-medium truncate",children:o.label}),e.jsxs("div",{className:"flex items-baseline gap-1 mt-0.5",children:[e.jsx("span",{className:`text-lg font-black font-mono leading-none ${o.tone.split(" ")[0]}`,children:o.value}),o.suffix&&e.jsx("span",{className:"text-2xs text-muted font-medium",children:o.suffix})]}),e.jsx("div",{className:"text-2xs text-subtle mt-1 truncate",children:o.hint})]})]},o.label)})})]})}function Ze(){const{lang:s,t:b,lessons:w,classes:h,students:g,todaySchedules:N,approvals:o,processes:y,isApprovalsCollapsed:p,setIsApprovalsCollapsed:C,isProcessesCollapsed:v,setIsProcessesCollapsed:D,scoreOverrides:k,setScoreOverrides:M,handleApprove:L,handleReject:T,showLogs:$,setShowLogs:z,processLogsContent:m,showProcessLogs:A,fetchProcessLogs:I,setShowProcessLogs:f,addToast:S,handleQuickScheduleClass:_,handleQuickGenerateAssignment:O,handleQuickCreateLesson:P,classDashboardMap:E}=ue(),[a,i]=c.useState("overview"),[x,r]=c.useState(null);return e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex-1 flex flex-col gap-6 h-full overflow-y-auto pr-2",children:[e.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-3 pb-1 border-b border-theme/50",children:[e.jsxs("div",{className:"flex items-center gap-1.5 bg-surface-secondary p-1 rounded-xl border border-theme w-fit",children:[e.jsxs("button",{id:"teacher-dashboard-overview-tab","data-testid":"teacher-dashboard-overview-tab",onClick:()=>i("overview"),className:`px-3.5 py-1.5 rounded-lg text-xs font-bold flex items-center gap-2 transition-all cursor-pointer ${a==="overview"?"bg-surface text-primary-theme shadow-xs":"text-muted hover:text-main"}`,children:[e.jsx(Me,{size:14}),e.jsx("span",{children:s==="zh"?"综合总览":"Overview"})]}),e.jsxs("button",{id:"teacher-dashboard-classroom-tab","data-testid":"teacher-dashboard-classroom-tab",onClick:()=>i("classroom"),className:`px-3.5 py-1.5 rounded-lg text-xs font-bold flex items-center gap-2 transition-all cursor-pointer ${a==="classroom"?"bg-surface text-primary-theme shadow-xs":"text-muted hover:text-main"}`,children:[e.jsx(Le,{size:14}),e.jsx("span",{children:s==="zh"?"课堂互动 (Classroom)":"Classroom"}),e.jsx("span",{className:"w-2 h-2 rounded-full bg-amber-500 animate-pulse"})]})]}),e.jsx("div",{className:"flex items-center gap-2 text-xs text-muted",children:e.jsxs("span",{className:"font-medium",children:[s==="zh"?"当前视图:":"View:"," ",e.jsx("span",{className:"text-main font-bold",children:a==="overview"?s==="zh"?"日常综合总览":"Overview":s==="zh"?"课堂随堂优秀榜与态势追踪":"Classroom Top Performers & Flow"})]})})]}),a==="classroom"?e.jsxs("div",{className:"flex flex-col gap-6",children:[e.jsx(We,{classDashboardMap:E,classes:h,lang:s}),e.jsxs("div",{className:"bg-surface border border-theme rounded-2xl p-5 shadow-sm",children:[e.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-3 mb-3",children:[e.jsxs("div",{children:[e.jsxs("h3",{className:"text-sm font-black text-main flex items-center gap-2",children:[e.jsx(Te,{size:16,className:"text-primary-theme"}),e.jsx("span",{children:s==="zh"?"课堂全班倒计时调度与广播":"Classroom Countdown Dispatcher"})]}),e.jsx("p",{className:"text-xs text-muted",children:s==="zh"?"实时向所有学生端同步广播任务倒计时,支持随堂测验、分组探究与限时答题":"Broadcast real-time countdown to connected students with presets and third-party plugin extensions"})]}),w.length>0&&e.jsx("div",{className:"flex items-center gap-2",children:e.jsx("select",{value:x||w[0]?.id||"",onChange:n=>r(n.target.value),className:"px-3 py-1.5 bg-surface-secondary border border-theme rounded-xl text-xs font-semibold text-main outline-none focus:ring-2 focus:ring-primary-theme cursor-pointer",children:w.map(n=>e.jsx("option",{value:n.id,children:n.title},n.id))})})]}),e.jsx(Re,{lessonId:x||w[0]?.id||null,lang:s,compact:!1,onlineStudentCount:g.length})]}),e.jsx(ae,{lang:s,lessons:w,classes:h,schedules:N,students:g,addToast:S}),e.jsx(ne,{lang:s,lessons:w,classes:h,schedules:N,students:g,addToast:(n,l,d)=>S(n,l,d??"info")})]}):e.jsxs(e.Fragment,{children:[(()=>{const n=t=>{if(t.status==="cancelled"||t.status==="holiday")return!1;if(!t.time_slot)return!0;try{const j=t.time_slot.split("-");if(j.length<2)return!0;const B=j[1].trim(),[F,q]=B.split(":").map(Number),R=new Date,Q=R.getHours(),ce=R.getMinutes();return!(Q>F||Q===F&&ce>=q)}catch{return!0}},l=N.filter(n),d=N.length-l.length;N.filter(t=>t.status==="cancelled"||t.status==="holiday");const u=l[0];return e.jsxs("div",{className:"bg-white border border-slate-200/80 rounded-2xl p-5 text-slate-800 shadow-sm flex flex-col md:flex-row justify-between items-stretch gap-6 transition-all duration-300",children:[e.jsx("div",{className:"flex-1 flex flex-col justify-between bg-slate-50/50 rounded-xl p-4.5 border border-slate-200/60 min-h-[160px]",children:u?e.jsxs("div",{className:"flex-1 flex flex-col justify-between",children:[e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"bg-amber-400 text-slate-950 text-xs font-extrabold px-2.5 py-0.5 rounded-full uppercase tracking-wider animate-pulse shadow-xs",children:s==="zh"?"下一堂面授课":"NEXT CLASS"}),e.jsx("span",{className:"font-mono text-xs text-indigo-700 font-bold bg-indigo-50 px-2 py-0.5 rounded-md border border-indigo-100/30",children:u.time_slot})]}),e.jsx("h3",{className:"text-lg md:text-xl font-extrabold tracking-tight mt-3 text-slate-800 line-clamp-2",title:u.lesson_title,children:u.lesson_title}),e.jsxs("p",{className:"text-xs text-slate-500 mt-2 font-medium",children:["📍 ",u.class_name," ",u.classroom&&` | 教室: ${u.classroom}`," ",u.teacher_name&&` | 教师: ${u.teacher_name}`]})]}),u.notes&&e.jsxs("div",{className:"mt-3 text-xs italic text-indigo-700 bg-indigo-50/60 p-2 rounded-lg border border-indigo-100/40 truncate",title:u.notes,children:["* ",u.notes]})]}):e.jsxs("div",{className:"flex-1 flex flex-col justify-center items-center text-center py-6 select-none",children:[e.jsx("span",{className:"text-3xl animate-bounce",children:"☕"}),e.jsx("h3",{className:"text-base font-extrabold text-slate-850 mt-2",children:s==="zh"?"今日课程已全部结束":"All Classes Finished"}),e.jsx("p",{className:"text-xs text-slate-455 mt-1 max-w-[280px]",children:s==="zh"?"接下来暂无排定课次,您可以休息调整。":"No remaining schedules today. Take a rest!"})]})}),e.jsxs("div",{className:"w-full md:w-[300px] lg:w-[350px] flex flex-col gap-3",children:[e.jsxs("div",{className:"flex justify-between items-center border-b border-slate-200/80 pb-2",children:[e.jsxs("span",{className:"text-xs uppercase font-extrabold tracking-wider text-indigo-600 flex items-center gap-1.5",children:["📅 ",s==="zh"?"今日面授排课流":"TODAY'S SCHEDULES"]}),e.jsx("span",{className:"text-xs text-slate-500 font-medium",children:s==="zh"?`共 ${N.length} 节 | 已下课 ${d} 节`:`Total ${N.length} | Done ${d}`})]}),N.length===0?e.jsxs("div",{className:"flex-1 flex items-center justify-center text-xs font-bold text-slate-450 py-6",children:["☕ ",s==="zh"?"今日暂无排定课次":"No schedules configured."]}):e.jsx("div",{className:"space-y-2 max-h-[150px] overflow-y-auto pr-1",children:N.map(t=>{const j=u&&t.id===u.id,B=l.some(R=>R.id===t.id)&&!j,F=t.status==="cancelled"||t.status==="holiday",q=!j&&!B&&!F;return e.jsxs("div",{className:`flex items-center justify-between text-xs py-1 border-b border-slate-100 last:border-b-0 ${q?"bg-slate-50/70":""}`,children:[e.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[e.jsx("span",{className:"font-mono text-xs text-slate-500 shrink-0",children:t.time_slot}),e.jsx("span",{className:`font-bold truncate max-w-[120px] lg:max-w-[150px] ${j?"text-indigo-700":q||F?"text-slate-500":"text-slate-700"} ${F?"line-through":""}`,title:t.lesson_title,children:t.lesson_title}),e.jsxs("span",{className:"text-xs text-slate-500 truncate max-w-[60px] lg:max-w-[80px]",children:["(",t.class_name,")"]})]}),e.jsxs("div",{className:"shrink-0 ml-2",children:[j&&e.jsx("span",{className:"bg-amber-400 text-slate-950 font-extrabold text-xs px-1.5 py-0.5 rounded uppercase scale-90 inline-block animate-pulse shadow-xs",children:"进行"}),q&&e.jsx("span",{className:"bg-slate-200 text-slate-700 text-xs px-1.5 py-0.5 rounded font-bold",children:"已完"}),B&&e.jsx("span",{className:"bg-indigo-50 text-indigo-700 text-xs px-1.5 py-0.5 rounded font-medium border border-indigo-100/50",children:"待上"}),F&&e.jsx("span",{className:"bg-rose-50 text-rose-600 text-xs px-1.5 py-0.5 rounded font-bold border border-rose-100/50",children:"停课"})]})]},t.id)})})]})]})})(),e.jsx(K,{slot:"teacher.dashboard.widget"}),e.jsx(ae,{lang:s,lessons:w,classes:h,schedules:N,students:g,addToast:S}),e.jsx(ne,{lang:s,lessons:w,classes:h,schedules:N,students:g,addToast:(n,l,d)=>S(n,l,d??"info")}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-5",children:[e.jsxs("div",{className:"bg-gradient-to-br from-indigo-50/60 to-indigo-100/10 border border-indigo-100/60 rounded-2xl p-5 shadow-xs flex items-center justify-between hover:shadow-sm hover:-translate-y-0.5 transition-all duration-300",children:[e.jsxs("div",{className:"flex flex-col gap-1",children:[e.jsx("span",{className:"text-xs font-bold text-indigo-655 uppercase tracking-wider",children:s==="zh"?"课程数量":"Total Courses"}),e.jsx("span",{className:"text-3xl font-extrabold text-slate-800 tracking-tight leading-none mt-1",children:w.length})]}),e.jsx("div",{className:"p-3 bg-indigo-500/10 text-indigo-600 rounded-xl",children:e.jsx(G,{size:24})})]}),e.jsxs("div",{className:"bg-gradient-to-br from-pink-50/60 to-pink-100/10 border border-pink-100/60 rounded-2xl p-5 shadow-xs flex items-center justify-between hover:shadow-sm hover:-translate-y-0.5 transition-all duration-300",children:[e.jsxs("div",{className:"flex flex-col gap-1",children:[e.jsx("span",{className:"text-xs font-bold text-pink-600 uppercase tracking-wider",children:s==="zh"?"班级数量":"Total Classes"}),e.jsx("span",{className:"text-3xl font-extrabold text-slate-800 tracking-tight leading-none mt-1",children:h.length})]}),e.jsx("div",{className:"p-3 bg-pink-500/10 text-pink-600 rounded-xl",children:e.jsx($e,{size:24})})]}),e.jsxs("div",{className:"bg-gradient-to-br from-emerald-50/60 to-emerald-100/10 border border-emerald-100/60 rounded-2xl p-5 shadow-xs flex items-center justify-between hover:shadow-sm hover:-translate-y-0.5 transition-all duration-300",children:[e.jsxs("div",{className:"flex flex-col gap-1",children:[e.jsx("span",{className:"text-xs font-bold text-emerald-650 uppercase tracking-wider",children:s==="zh"?"学生数量":"Total Students"}),e.jsx("span",{className:"text-3xl font-extrabold text-slate-800 tracking-tight leading-none mt-1",children:g.length})]}),e.jsx("div",{className:"p-3 bg-emerald-500/10 text-emerald-600 rounded-xl",children:e.jsx(W,{size:24})})]})]}),e.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-6 items-start",children:[e.jsxs("div",{className:"bg-white border border-rose-100 rounded-2xl shadow-sm flex flex-col transition-all duration-300",children:[e.jsxs("div",{onClick:()=>C(!p),className:"p-4 border-b border-rose-50 flex items-center justify-between cursor-pointer select-none hover:bg-rose-50/20 rounded-t-2xl transition-colors",children:[e.jsxs("h3",{className:"font-extrabold text-sm md:text-base text-rose-700 flex items-center gap-2",children:[e.jsx(Ae,{size:18}),b.approvals,o.length>0&&e.jsx("span",{className:"bg-rose-100 text-rose-700 text-xs px-2 py-0.5 rounded-full font-bold ml-1",children:o.length})]}),e.jsx("div",{className:"text-rose-400 hover:text-rose-600 transition-colors",children:p?e.jsx(X,{size:18}):e.jsx(Y,{size:18})})]}),!p&&e.jsx("div",{className:"flex-1 overflow-y-auto p-3 max-h-[350px]",children:o.length===0?e.jsx("div",{className:"text-center p-8 text-xs md:text-sm text-slate-400 font-medium",children:b.noApprovals}):o.map(n=>{let l={};try{l=JSON.parse(n.payload||"{}")}catch{}const d=n.command_type==="ai.apply_grade",u=k[n.id]!==void 0?k[n.id]:l.score||0;return e.jsxs("div",{className:"w-full p-4 rounded-xl text-sm bg-slate-55 border border-slate-100 mb-3 shadow-3xs flex flex-col gap-3 hover:border-rose-150 transition-colors",children:[e.jsxs("div",{children:[e.jsx("div",{className:"font-extrabold text-slate-800 mb-1",children:n.command_type==="ai.apply_grade"?"🎓 Evaluate Submission":n.command_type}),e.jsx("div",{className:"text-xs text-slate-500 font-mono mb-2 line-clamp-2 bg-white border border-slate-100 p-2 rounded-lg",title:n.payload,children:d?`Feedback: ${l.feedback}`:n.payload})]}),d&&e.jsxs("div",{className:"bg-white border border-slate-150 p-2 rounded-xl flex items-center justify-between gap-3",children:[e.jsx("label",{className:"text-xs font-bold text-slate-700",children:"Modify Score:"}),e.jsx("input",{type:"number",className:"w-20 border border-slate-200 rounded-lg px-2 py-1 text-xs focus:ring-2 focus:ring-indigo-500 outline-none transition-all",value:u,onChange:t=>M(j=>({...j,[n.id]:parseInt(t.target.value)||0}))})]}),e.jsxs("div",{className:"flex gap-2 justify-end mt-1",children:[e.jsxs("button",{onClick:()=>L(n.id,d&&k[n.id]!==void 0?{score:k[n.id]}:void 0),className:"p-1.5 px-3.5 bg-rose-600 hover:bg-rose-700 text-white rounded-lg font-bold text-xs flex items-center gap-1.5 shadow-sm transition-all animate-none",children:[e.jsx(Ie,{size:14})," ",b.approve]}),e.jsxs("button",{onClick:()=>T(n.id),className:"p-1.5 px-3.5 bg-slate-100 hover:bg-slate-200 text-slate-750 rounded-lg font-bold text-xs flex items-center gap-1.5 shadow-3xs transition-all",children:[e.jsx(re,{size:14})," ",b.reject]})]})]},n.id)})})]}),e.jsxs("div",{className:"bg-white border border-slate-200/60 rounded-2xl shadow-sm flex flex-col transition-all duration-300",children:[e.jsxs("div",{onClick:()=>D(!v),className:"p-4 border-b border-slate-100 flex items-center justify-between cursor-pointer select-none hover:bg-slate-50/20 rounded-t-2xl transition-colors",children:[e.jsxs("h3",{className:"font-extrabold text-sm md:text-base text-slate-700 flex items-center gap-2",children:[e.jsx(oe,{size:18,className:"text-indigo-500"}),b.processes,y.length>0&&e.jsx("span",{className:"bg-indigo-50 text-indigo-700 text-xs px-2 py-0.5 rounded-full font-bold ml-1",children:y.length})]}),e.jsx("div",{className:"text-slate-400 hover:text-slate-650 transition-colors",children:v?e.jsx(X,{size:18}):e.jsx(Y,{size:18})})]}),!v&&e.jsx("div",{className:"flex-1 overflow-y-auto p-3 max-h-[350px]",children:y.length===0?e.jsx("div",{className:"text-center p-8 text-xs md:text-sm text-slate-400 font-medium",children:b.noProcesses}):y.map(n=>e.jsxs("div",{className:"w-full p-4 rounded-xl text-sm bg-slate-50 border border-slate-100 mb-3 shadow-3xs flex flex-col gap-2.5 hover:border-indigo-150 transition-colors",children:[e.jsxs("div",{className:"flex items-center justify-between mb-1",children:[e.jsx("span",{className:"font-extrabold text-slate-800 truncate",title:n.name,children:n.name}),e.jsx("span",{className:`text-xs uppercase px-2 py-0.5 rounded-full font-bold ${n.status==="running"?"bg-blue-100 text-blue-700":n.status==="completed"?"bg-emerald-100 text-emerald-700":n.status==="failed"?"bg-rose-100 text-rose-700":"bg-slate-200 text-slate-700"}`,children:n.status})]}),e.jsxs("div",{className:"flex justify-between items-center mt-1",children:[e.jsxs("span",{className:"text-xs text-slate-400 font-mono",children:["PID: ",n.id]}),e.jsx("button",{onClick:()=>f(n.id),className:"text-xs font-bold text-indigo-650 hover:text-indigo-850 transition-colors",children:b.processLogs})]})]},n.id))})]})]})]}),e.jsx(K,{slot:"teacher.panel",slotProps:{lang:s,lessons:w,classes:h,students:g}})]}),e.jsx(Ge,{classes:h,lessons:w,lang:s,onScheduleClass:_,onGenerateAssignment:async(n,l)=>!!await O(n,l,l),onCreateLesson:async(n,l)=>!!await P(n,l)})]})}export{Ze as Dashboard};
|
|
8
|
+
这里写课本的主要讲授要点。`)},u=async t=>{t.preventDefault(),D(!0),x(null);try{let j=!1;if(p==="schedule"){if(!v||!k||!L){x("Please complete all form fields."),D(!1);return}j=await h(v,k,L)}else if(p==="assignment"){if(!A||!m.trim()){x("Please specify target class and a valid topic."),D(!1);return}j=await g(A,m.trim())}else if(p==="lesson"){if(!I.trim()||!S.trim()){x("Title and Content can not be empty."),D(!1);return}j=await N(I.trim(),S.trim())}j?(a(!0),setTimeout(()=>{a(!1),C("menu")},2200)):x(r.genericError)}catch(j){x(j.message||r.genericError)}finally{D(!1)}};return e.jsxs("div",{id:"quick-actions-fab-container",className:"absolute bottom-8 right-8 z-40 flex flex-col items-end",children:[e.jsx(xe,{children:o&&e.jsxs(H.div,{initial:{opacity:0,y:15,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:15,scale:.95},transition:{duration:.18},className:"mb-4 w-[360px] sm:w-[420px] bg-white border border-gray-200 rounded-2xl shadow-xl overflow-hidden flex flex-col focus:outline-none",id:"quick-actions-popup-card",children:[e.jsxs("div",{className:"bg-indigo-600 px-5 py-4 text-white flex items-center justify-between shadow-inner",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(he,{size:18,className:"animate-pulse"}),e.jsx("h3",{className:"font-bold text-sm tracking-wide",children:r.quickActions})]}),e.jsx("button",{onClick:()=>{y(!1),C("menu")},className:"text-white/80 hover:text-white hover:bg-white/15 p-1 rounded-full transition-all focus:outline-none",title:"Close Portal",children:e.jsx(re,{size:16})})]}),e.jsxs("div",{className:"p-5 max-h-[480px] overflow-y-auto bg-gray-50/50",children:[p==="menu"&&e.jsxs("div",{className:"space-y-4",children:[e.jsx("p",{className:"text-xs text-gray-500 leading-relaxed font-medium bg-indigo-50/50 border border-indigo-100 p-2.5 rounded-lg mb-4",children:r.quickDesc}),e.jsxs("div",{onClick:()=>d("schedule"),className:"flex items-start gap-3.5 p-3.5 bg-white border border-gray-200 hover:border-indigo-400 hover:shadow-md rounded-xl cursor-pointer transition-all hover:scale-101 group",id:"action-schedule-class",children:[e.jsx("div",{className:"p-2.5 bg-indigo-50 text-indigo-600 rounded-lg group-hover:bg-indigo-600 group-hover:text-white transition-colors duration-200",children:e.jsx(U,{size:18})}),e.jsxs("div",{className:"flex-1",children:[e.jsx("h4",{className:"text-xs font-bold text-gray-800 flex items-center gap-1 group-hover:text-indigo-600 transition-colors uppercase tracking-wider",children:r.scheduleClass}),e.jsx("p",{className:"text-xs text-gray-500 mt-1 leading-relaxed",children:r.scheduleDesc})]})]}),e.jsxs("div",{onClick:()=>d("assignment"),className:"flex items-start gap-3.5 p-3.5 bg-white border border-gray-200 hover:border-purple-400 hover:shadow-md rounded-xl cursor-pointer transition-all hover:scale-101 group",id:"action-generate-assignment",children:[e.jsx("div",{className:"p-2.5 bg-purple-50 text-purple-600 rounded-lg group-hover:bg-purple-600 group-hover:text-white transition-colors duration-200",children:e.jsx(pe,{size:18})}),e.jsxs("div",{className:"flex-1",children:[e.jsx("h4",{className:"text-xs font-bold text-gray-800 flex items-center gap-1 group-hover:text-purple-600 transition-colors uppercase tracking-wider",children:r.generateAssignment}),e.jsx("p",{className:"text-xs text-gray-500 mt-1 leading-relaxed",children:r.generateDesc})]})]}),e.jsxs("div",{onClick:()=>d("lesson"),className:"flex items-start gap-3.5 p-3.5 bg-white border border-gray-200 hover:border-emerald-400 hover:shadow-md rounded-xl cursor-pointer transition-all hover:scale-101 group",id:"action-create-lesson",children:[e.jsx("div",{className:"p-2.5 bg-emerald-50 text-emerald-600 rounded-lg group-hover:bg-emerald-600 group-hover:text-white transition-colors duration-200",children:e.jsx(G,{size:18})}),e.jsxs("div",{className:"flex-1",children:[e.jsx("h4",{className:"text-xs font-bold text-gray-800 flex items-center gap-1 group-hover:text-emerald-600 transition-colors uppercase tracking-wider",children:r.createLesson}),e.jsx("p",{className:"text-xs text-gray-500 mt-1 leading-relaxed",children:r.createDesc})]})]})]}),p!=="menu"&&e.jsxs("div",{className:"relative",children:[e.jsxs("button",{onClick:()=>C("menu"),className:"flex items-center gap-1.5 text-xs text-gray-500 hover:text-indigo-600 font-semibold mb-4 cursor-pointer focus:outline-none",id:"action-back-button",children:[e.jsx(ge,{size:14}),e.jsx("span",{children:r.back})]}),E?e.jsxs(H.div,{initial:{scale:.95},animate:{scale:1},className:"flex flex-col items-center justify-center py-10 text-center",children:[e.jsx(fe,{size:48,className:"text-green-500 animate-bounce mb-3"}),e.jsx("h4",{className:"font-bold text-green-800 text-sm",children:l()}),e.jsx("p",{className:"text-xs text-gray-400 mt-1",children:"Returning to action console..."})]}):e.jsxs("form",{onSubmit:u,className:"space-y-4",children:[i&&e.jsxs("div",{className:"p-3 bg-red-50 border border-red-200 rounded-lg text-red-600 text-xs font-semibold",children:["⚠️ ",i]}),p==="schedule"&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsxs("label",{className:"text-xs font-bold text-gray-600 flex items-center gap-1",children:[e.jsx(W,{size:12})," ",r.classSelect]}),s.length===0?e.jsx("p",{className:"text-xs italic text-red-500",children:r.emptyClasses}):e.jsx("select",{value:v,onChange:t=>P(t.target.value),className:"w-full bg-white border border-gray-200 rounded-lg p-2.5 text-xs focus:ring-2 focus:ring-indigo-500 text-gray-700 font-medium",children:s.map(t=>e.jsx("option",{value:t.id,children:t.name},t.id))})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsxs("label",{className:"text-xs font-bold text-gray-600 flex items-center gap-1",children:[e.jsx(G,{size:12})," ",r.lessonSelect]}),b.length===0?e.jsx("p",{className:"text-xs italic text-red-500",children:r.emptyLessons}):e.jsx("select",{value:k,onChange:t=>M(t.target.value),className:"w-full bg-white border border-gray-200 rounded-lg p-2.5 text-xs focus:ring-2 focus:ring-indigo-500 text-gray-700 font-medium",children:b.map(t=>e.jsx("option",{value:t.id,children:t.title},t.id))})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsxs("label",{className:"text-xs font-bold text-gray-600 flex items-center gap-1",children:[e.jsx(U,{size:12})," ",r.dateSelect]}),e.jsx("input",{type:"date",value:L,onChange:t=>T(t.target.value),className:"w-full bg-white border border-gray-200 rounded-lg p-2.5 text-xs focus:ring-2 focus:ring-indigo-500 text-gray-700 font-medium",required:!0})]})]}),p==="assignment"&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsxs("label",{className:"text-xs font-bold text-gray-600 flex items-center gap-1",children:[e.jsx(W,{size:12})," ",r.classSelect]}),s.length===0?e.jsx("p",{className:"text-xs italic text-red-500",children:r.emptyClasses}):e.jsx("select",{value:A,onChange:t=>z(t.target.value),className:"w-full bg-white border border-gray-200 rounded-lg p-2.5 text-xs focus:ring-2 focus:ring-indigo-500 text-gray-700 font-medium",children:s.map(t=>e.jsx("option",{value:t.id,children:t.name},t.id))})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsxs("label",{className:"text-xs font-bold text-gray-600 flex items-center gap-1",children:[e.jsx(le,{size:12})," ",r.assignmentTopic]}),e.jsx("input",{type:"text",value:m,onChange:t=>$(t.target.value),placeholder:r.assignmentTopicPlaceholder,className:"w-full bg-white border border-gray-200 rounded-lg p-2.5 text-xs focus:ring-2 focus:ring-indigo-500 text-gray-700 font-medium",required:!0})]})]}),p==="lesson"&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsxs("label",{className:"text-xs font-bold text-gray-600 flex items-center gap-1",children:[e.jsx(be,{size:12})," ",r.lessonTitle]}),e.jsx("input",{type:"text",value:I,onChange:t=>f(t.target.value),placeholder:r.lessonTitlePlaceholder,className:"w-full bg-white border border-gray-200 rounded-lg p-2.5 text-xs focus:ring-2 focus:ring-indigo-500 text-gray-700 font-medium",required:!0})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsxs("label",{className:"text-xs font-bold text-gray-600 flex items-center gap-1",children:[e.jsx(G,{size:12})," ",r.lessonContent]}),e.jsx("textarea",{value:S,onChange:t=>_(t.target.value),rows:5,className:"w-full bg-white border border-gray-200 rounded-lg p-2.5 text-xs focus:ring-2 focus:ring-indigo-500 font-mono text-gray-700",required:!0})]})]}),e.jsx("button",{type:"submit",disabled:O||p==="schedule"&&(s.length===0||b.length===0)||p==="assignment"&&s.length===0,className:"w-full bg-indigo-600 hover:bg-indigo-700 text-white font-bold text-xs py-2.5 px-4 rounded-xl flex items-center justify-center gap-2 cursor-pointer transition-all shadow-md active:scale-98 disabled:opacity-50",children:O?e.jsxs(e.Fragment,{children:[e.jsx(je,{size:14,className:"animate-spin"}),e.jsx("span",{children:r.loadingBus})]}):e.jsxs(e.Fragment,{children:[e.jsx(ie,{size:13}),e.jsx("span",{children:r.confirm})]})})]})]})]})]})}),e.jsxs("button",{onClick:()=>{y(!o),C("menu")},className:"w-14 h-14 bg-indigo-600 hover:bg-indigo-700 text-white rounded-full flex items-center justify-center shadow-lg hover:shadow-indigo-200 hover:shadow-2xl transition-all duration-250 cursor-pointer active:scale-95 focus:outline-none relative group",title:"Trigger Education OS Quick Scheduler Command Panel",id:"quick-actions-fab-button",children:[e.jsx("span",{className:"absolute inline-flex h-full w-full rounded-full bg-purple-400 opacity-20 group-hover:animate-ping"}),e.jsx(H.div,{animate:{rotate:o?135:0},transition:{duration:.2},className:"flex items-center justify-center text-white",children:e.jsx(Ne,{size:24,strokeWidth:2.8})})]})]})}function ne({lang:s="zh",lessons:b=[],classes:w=[],schedules:h=[],students:g=[],addToast:N}){const[o,y]=c.useState(""),[p,C]=c.useState(15),[v,P]=c.useState(!1),[k,M]=c.useState(!1),[L,T]=c.useState(!1),[A,z]=c.useState([]),[m,$]=c.useState({currentEngagement:0,moodStatus:"CALM",moodLabel:s==="zh"?"等待课堂数据…":"Waiting for classroom data…",moodEmoji:"⏳",totalInteractions:0,interactionFrequencyPerMin:"0",pulseDistribution:{clearCount:0,confusedCount:0,tooFastCount:0,total:0,clearPercent:0,confusedPercent:0,tooFastPercent:0}}),[I,f]=c.useState([]);c.useEffect(()=>{if(!o&&b.length>0){const a=h.find(i=>i.status!=="cancelled");a?.lesson_id?y(a.lesson_id):y(b[0].id)}},[b,h,o]);const S=c.useCallback(async()=>{if(o){M(!0);try{const a=await fetch(`/api/classroom/sessions/${o}/mood-tracker?minutes=${p}`);if(a.ok){const i=await a.json();i.success&&i.timeline?($(i.metrics),f(i.timeline)):f([])}else f([])}catch{f([])}finally{M(!1)}}},[o,p]);c.useCallback(a=>{const i=[],x=Date.now();for(let r=a-1;r>=0;r--){const n=x-r*60*1e3,l=new Date(n),d=`${l.getHours().toString().padStart(2,"0")}:${l.getMinutes().toString().padStart(2,"0")}`,u=72+Math.sin(r*.5)*12,t=Math.max(0,Math.round(2+Math.cos(r*.8)*3));i.push({time:d,timestamp:n,engagement:Math.min(100,Math.max(30,Math.round(u))),energy:Math.min(100,Math.max(20,Math.round(55+t*9))),interactions:t,clear:Math.round(t*.7),confused:Math.round(t*.2),tooFast:Math.round(t*.1)})}f(i)},[]),c.useEffect(()=>{S()},[S]),c.useEffect(()=>{const a=l=>{if(l.lessonId===o||!l.lessonId){S();const d=new Date,u=`${d.getHours().toString().padStart(2,"0")}:${d.getMinutes().toString().padStart(2,"0")}:${d.getSeconds().toString().padStart(2,"0")}`;z(t=>[{id:`pulse_${Date.now()}`,text:s==="zh"?"收到学生节奏脉搏反馈":"Student submitted pacing pulse",time:u,type:"clear"},...t.slice(0,5)])}},i=l=>{if(l.lessonId===o||!l.lessonId){S();const d=new Date,u=`${d.getHours().toString().padStart(2,"0")}:${d.getMinutes().toString().padStart(2,"0")}:${d.getSeconds().toString().padStart(2,"0")}`;z(t=>[{id:`poll_${Date.now()}`,text:`${l.latestVoter||(s==="zh"?"学生":"Student")} ${s==="zh"?"参与了随堂投票":"voted in poll"}`,time:u,type:"poll"},...t.slice(0,5)])}},x=l=>{if(l.lessonId===o||!l.lessonId){S();const d=new Date,u=`${d.getHours().toString().padStart(2,"0")}:${d.getMinutes().toString().padStart(2,"0")}:${d.getSeconds().toString().padStart(2,"0")}`;z(t=>[{id:`buzzer_${Date.now()}`,text:`⚡ ${l.winnerStudentName||"Student"} ${s==="zh"?"抢答命中":"buzzed in"} (${l.responseTimeMs}ms)`,time:u,type:"fast"},...t.slice(0,5)])}};let r=null;const n=me(l=>{r?.(),l.on("classroom:pacing_updated",a),l.on("classroom:quick_poll_updated",i),l.on("classroom:buzzer_winner",x),r=()=>{typeof l.off=="function"&&(l.off("classroom:pacing_updated",a),l.off("classroom:quick_poll_updated",i),l.off("classroom:buzzer_winner",x))}});return()=>{n(),r?.()}},[o,S,s]),c.useEffect(()=>{if(!v)return;const a=setInterval(()=>{f(i=>{if(i.length===0)return i;const x=Date.now(),r=new Date(x),n=`${r.getHours().toString().padStart(2,"0")}:${r.getMinutes().toString().padStart(2,"0")}`,l=i[i.length-1],d=Math.round((Math.random()-.45)*6),u=Math.min(98,Math.max(45,l.engagement+d)),t=Math.floor(Math.random()*5),j=Math.round(t*.75),B=Math.round(t*.2),F=Math.max(0,t-j-B),R={time:n,timestamp:x,engagement:u,energy:Math.min(100,Math.max(30,50+t*12)),interactions:t,clear:j,confused:B,tooFast:F};return[...i.slice(1),R]}),$(i=>{const x=Math.round((Math.random()-.45)*3),r=Math.min(96,Math.max(50,i.currentEngagement+x));return{...i,currentEngagement:r,totalInteractions:i.totalInteractions+1}})},4e3);return()=>clearInterval(a)},[v]);const _=async()=>{if(o){T(!0);try{(await fetch(`/api/classroom/sessions/${o}/pulse-check`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({prompt:s==="zh"?"当前讲解节奏如何?请按下脉搏按钮反馈":"How is current pacing? Send your pulse",durationSec:30})})).ok?N?.(s==="zh"?"脉搏检测已下发":"Pulse Check Dispatched",s==="zh"?"已向全体听课学生弹出 30s 课堂节奏自检晴雨表":"30-second pulse check sent to students","success"):N?.(s==="zh"?"提示":"Notice",s==="zh"?"脉搏指令已广播至本地课堂":"Pulse check broadcasted locally","info")}catch{N?.(s==="zh"?"脉搏指令广播":"Pulse Broadcasted",s==="zh"?"已通过 WebSocket 广播脉搏信号":"Broadcasted pulse signal via WebSocket","info")}finally{T(!1)}}},O=c.useMemo(()=>{const a=m.pulseDistribution;return[{name:s==="zh"?"听懂了 (Clear)":"Clear",percent:a.clearPercent,count:a.clearCount,color:"#10b981"},{name:s==="zh"?"有疑问 (Confused)":"Confused",percent:a.confusedPercent,count:a.confusedCount,color:"#f59e0b"},{name:s==="zh"?"讲太快 (Too Fast)":"Too Fast",percent:a.tooFastPercent,count:a.tooFastCount,color:"#ef4444"}]},[m.pulseDistribution,s]),D=b.find(a=>a.id===o),E=c.useMemo(()=>{const{currentEngagement:a,pulseDistribution:i}=m;return i.confusedPercent>25?{type:"warning",text:s==="zh"?"⚠️ 超过 25% 学生反馈理解受阻,建议暂停并使用白板重绘核心公式或做针对性互动提问。":"⚠️ >25% students confused. Pause and re-explain key concept on whiteboard."}:i.tooFastPercent>20?{type:"caution",text:s==="zh"?"⚡ 约 20% 学生跟不上当前语速或换页节奏,建议稍加减速,并留出 15 秒消化提问时间。":"⚡ Pacing too fast. Slow down and give 15s pause for note-taking."}:a>=80?{type:"success",text:s==="zh"?"🌟 课堂进入高专注黄金区间(心流状态)!建议趁热打铁,推送随堂探究或随堂测验。":"🌟 Optimal Flow detected! High focus. Great moment to launch interactive quiz."}:{type:"info",text:s==="zh"?"💡 专注度平稳,可穿插抢答(Buzzer)或快速单选投票以进一步激活课堂互动。":"💡 Steady attention. Consider triggering a Buzzer or Quick Poll to boost energy."}},[m,s]);return e.jsxs("div",{id:"classroom-mood-tracker-container",className:"bg-white border border-slate-200/80 rounded-2xl p-5 shadow-sm flex flex-col gap-5 transition-all duration-300",children:[e.jsxs("div",{className:"flex flex-col lg:flex-row items-start lg:items-center justify-between gap-4 border-b border-slate-100 pb-4",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"w-10 h-10 rounded-xl bg-gradient-to-tr from-indigo-500 to-teal-400 text-white flex items-center justify-center shadow-xs shrink-0",children:e.jsx(oe,{size:20,className:"animate-pulse"})}),e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[e.jsxs("span",{className:"text-xs font-black uppercase tracking-wider text-indigo-700 bg-indigo-50 border border-indigo-100/60 px-2.5 py-0.5 rounded-full flex items-center gap-1.5",children:[e.jsx(de,{size:12,className:"text-rose-500 animate-ping"}),e.jsx("span",{children:s==="zh"?"实时课堂专注度与情绪晴雨表":"REAL-TIME CLASSROOM MOOD"})]}),e.jsxs("span",{className:"text-xs font-bold px-2 py-0.5 rounded-full bg-slate-100 text-slate-700 flex items-center gap-1",children:[e.jsx("span",{children:m.moodEmoji}),e.jsx("span",{children:m.moodLabel})]})]}),e.jsx("h2",{className:"text-base font-extrabold text-slate-800 tracking-tight mt-1 flex items-center gap-2",children:e.jsx("span",{children:D?D.title:s==="zh"?"活跃课堂":"Active Lesson"})})]})]}),e.jsxs("div",{className:"flex items-center gap-2 flex-wrap w-full lg:w-auto justify-end",children:[e.jsx("select",{id:"mood-tracker-lesson-select","aria-label":s==="zh"?"选择要查看的课节":"Select lesson to view",value:o,onChange:a=>y(a.target.value),className:"text-xs font-bold bg-slate-50 border border-slate-200 rounded-xl px-2.5 py-2 text-slate-700 focus:ring-2 focus:ring-indigo-500 outline-none cursor-pointer",children:b.map(a=>e.jsxs("option",{value:a.id,children:["📖 ",a.title]},a.id))}),e.jsx("div",{className:"flex items-center bg-slate-100 p-0.5 rounded-xl border border-slate-200/60 text-xs font-bold text-slate-600",children:[5,15,30].map(a=>e.jsxs("button",{type:"button",onClick:()=>C(a),className:`px-2.5 py-1.5 rounded-lg transition-all cursor-pointer ${p===a?"bg-white text-indigo-700 shadow-2xs":"hover:text-slate-900"}`,children:[a,"m"]},a))}),e.jsxs("button",{id:"mood-tracker-sim-btn",type:"button",onClick:()=>P(!v),className:`px-3 py-2 text-xs font-bold rounded-xl border transition-all cursor-pointer flex items-center gap-1.5 shadow-2xs ${v?"bg-amber-500/10 text-amber-700 border-amber-500/30 ring-2 ring-amber-500/20":"bg-slate-50 text-slate-600 border-slate-200 hover:bg-slate-100"}`,title:s==="zh"?"开启/关闭实时模拟数据流 (在暂无学生连入时快速预览曲线波动)":"Toggle simulated live telemetry flow",children:[e.jsx(le,{size:13,className:v?"text-amber-600 animate-spin":"text-slate-400"}),e.jsx("span",{children:v?s==="zh"?"实时模拟中":"Simulating":s==="zh"?"模拟数据流":"Simulate"})]}),e.jsxs("button",{id:"mood-tracker-trigger-pulse-btn",type:"button",onClick:_,disabled:L,className:"px-3.5 py-2 bg-gradient-to-r from-indigo-600 to-teal-600 hover:from-indigo-700 hover:to-teal-700 text-white rounded-xl text-xs font-extrabold flex items-center gap-1.5 shadow-xs transition-all active:scale-95 cursor-pointer disabled:opacity-50",children:[e.jsx(ie,{size:13}),e.jsx("span",{children:s==="zh"?"发起30s即时脉搏检":"Instant Pulse Check"})]}),e.jsx("button",{type:"button",onClick:S,disabled:k,className:"p-2 text-slate-500 hover:text-indigo-600 hover:bg-slate-100 rounded-xl transition-colors cursor-pointer",title:s==="zh"?"刷新数据":"Refresh",children:e.jsx(ve,{size:14,className:k?"animate-spin text-indigo-600":""})})]})]}),e.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-3.5",children:[e.jsxs("div",{className:"bg-gradient-to-br from-indigo-50/50 to-teal-50/30 border border-indigo-100/70 rounded-xl p-3.5 flex flex-col justify-between shadow-3xs",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("span",{className:"text-xs font-extrabold text-indigo-700 uppercase tracking-wider flex items-center gap-1",children:[e.jsx(we,{size:13}),e.jsx("span",{children:s==="zh"?"综合专注指数":"Engagement Index"})]}),e.jsx("span",{className:"text-xs font-bold text-emerald-600 bg-emerald-100/60 px-1.5 py-0.5 rounded-md",children:m.currentEngagement>=70?"Optimal":"Standard"})]}),e.jsxs("div",{className:"mt-2 flex items-baseline gap-2",children:[e.jsxs("span",{className:"text-3xl font-black text-slate-850 tracking-tight font-mono",children:[m.currentEngagement,"%"]}),e.jsx("span",{className:"text-xs text-slate-450 font-medium",children:"/ 100"})]}),e.jsx("div",{className:"w-full bg-slate-200/60 rounded-full h-1.5 mt-2 overflow-hidden",children:e.jsx("div",{className:"bg-gradient-to-r from-indigo-500 to-teal-400 h-1.5 rounded-full transition-all duration-500",style:{width:`${m.currentEngagement}%`}})})]}),e.jsxs("div",{className:"bg-gradient-to-br from-amber-50/50 to-orange-50/30 border border-amber-100/70 rounded-xl p-3.5 flex flex-col justify-between shadow-3xs",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("span",{className:"text-xs font-extrabold text-amber-700 uppercase tracking-wider flex items-center gap-1",children:[e.jsx(ye,{size:13}),e.jsx("span",{children:s==="zh"?"互动触发频度":"Interaction Rate"})]}),e.jsxs("span",{className:"text-xs font-bold text-amber-700 bg-amber-100/60 px-1.5 py-0.5 rounded-md",children:[m.totalInteractions," ",s==="zh"?"次":"acts"]})]}),e.jsxs("div",{className:"mt-2 flex items-baseline gap-2",children:[e.jsx("span",{className:"text-3xl font-black text-slate-850 tracking-tight font-mono",children:m.interactionFrequencyPerMin}),e.jsx("span",{className:"text-xs text-slate-450 font-medium",children:"req / min"})]}),e.jsx("p",{className:"text-2xs text-slate-455 mt-2 truncate",children:s==="zh"?"包含投票、抢答与节奏反馈":"Polls, Buzzers & Pacing"})]}),e.jsxs("div",{className:"bg-gradient-to-br from-emerald-50/50 to-green-50/30 border border-emerald-100/70 rounded-xl p-3.5 flex flex-col justify-between shadow-3xs",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("span",{className:"text-xs font-extrabold text-emerald-700 uppercase tracking-wider flex items-center gap-1",children:[e.jsx(Se,{size:13}),e.jsx("span",{children:s==="zh"?"听懂顺畅率":"Pulse Clarity"})]}),e.jsxs("span",{className:"text-xs font-bold text-emerald-700 bg-emerald-100/60 px-1.5 py-0.5 rounded-md",children:[m.pulseDistribution.clearCount," ",s==="zh"?"人次":"clear"]})]}),e.jsxs("div",{className:"mt-2 flex items-baseline gap-2",children:[e.jsxs("span",{className:"text-3xl font-black text-slate-850 tracking-tight font-mono text-emerald-600",children:[m.pulseDistribution.clearPercent,"%"]}),e.jsx("span",{className:"text-xs text-slate-450 font-medium",children:s==="zh"?"理解无障碍":"comprehension"})]}),e.jsx("div",{className:"w-full bg-slate-200/60 rounded-full h-1.5 mt-2 overflow-hidden",children:e.jsx("div",{className:"bg-emerald-500 h-1.5 rounded-full transition-all duration-500",style:{width:`${m.pulseDistribution.clearPercent}%`}})})]}),e.jsxs("div",{className:"bg-gradient-to-br from-rose-50/50 to-pink-50/30 border border-rose-100/70 rounded-xl p-3.5 flex flex-col justify-between shadow-3xs",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("span",{className:"text-xs font-extrabold text-rose-700 uppercase tracking-wider flex items-center gap-1",children:[e.jsx(ke,{size:13}),e.jsx("span",{children:s==="zh"?"疑问/过快预警":"Confusion Signals"})]}),e.jsxs("span",{className:"text-xs font-bold text-rose-700 bg-rose-100/60 px-1.5 py-0.5 rounded-md",children:[m.pulseDistribution.confusedCount+m.pulseDistribution.tooFastCount," ",s==="zh"?"信号":"signals"]})]}),e.jsxs("div",{className:"mt-2 flex items-baseline gap-2",children:[e.jsxs("span",{className:"text-3xl font-black text-slate-850 tracking-tight font-mono text-rose-600",children:[m.pulseDistribution.confusedPercent+m.pulseDistribution.tooFastPercent,"%"]}),e.jsx("span",{className:"text-xs text-slate-450 font-medium",children:s==="zh"?"需重点关注":"need attention"})]}),e.jsxs("p",{className:"text-2xs text-rose-600/80 mt-2 truncate font-semibold",children:[m.pulseDistribution.confusedCount," ",s==="zh"?"存疑":"confused"," ·"," ",m.pulseDistribution.tooFastCount," ",s==="zh"?"偏快":"fast"]})]})]}),e.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-12 gap-5 items-stretch",children:[e.jsxs("div",{className:"lg:col-span-8 bg-slate-50/60 border border-slate-200/70 rounded-2xl p-4 flex flex-col min-h-[300px]",children:[e.jsxs("div",{className:"flex items-center justify-between mb-3",children:[e.jsxs("div",{children:[e.jsxs("span",{className:"text-xs font-black text-slate-800 uppercase tracking-wider flex items-center gap-1.5",children:[e.jsx(Ce,{size:14,className:"text-indigo-600"}),e.jsx("span",{children:s==="zh"?"课堂专注度与能量动态走势":"Engagement & Energy Dynamics"})]}),e.jsx("p",{className:"text-xs text-slate-450 mt-0.5",children:s==="zh"?`以分钟为切片的动态能量波(基准线 70% 为最佳心流区间,过去 ${p} 分钟)`:"1-minute interval dynamic waveform (70% optimal flow baseline)"})]}),e.jsxs("div",{className:"flex items-center gap-3 text-2xs font-bold",children:[e.jsxs("span",{className:"flex items-center gap-1 text-teal-700",children:[e.jsx("span",{className:"w-2.5 h-2.5 rounded-full bg-teal-500 inline-block"}),s==="zh"?"专注度 (Engagement %)":"Engagement %"]}),e.jsxs("span",{className:"flex items-center gap-1 text-indigo-700",children:[e.jsx("span",{className:"w-2.5 h-2.5 rounded-full bg-indigo-500 inline-block"}),s==="zh"?"能量波 (Energy Wave)":"Energy Wave"]})]})]}),e.jsx("div",{className:"flex-1 w-full h-[230px] min-h-[220px]",children:e.jsx(J,{width:"100%",height:"100%",children:e.jsxs(Ee,{data:I,margin:{top:10,right:10,left:-20,bottom:0},children:[e.jsxs("defs",{children:[e.jsxs("linearGradient",{id:"engagementGradient",x1:"0",y1:"0",x2:"0",y2:"1",children:[e.jsx("stop",{offset:"5%",stopColor:"#14b8a6",stopOpacity:.4}),e.jsx("stop",{offset:"95%",stopColor:"#14b8a6",stopOpacity:0})]}),e.jsxs("linearGradient",{id:"energyGradient",x1:"0",y1:"0",x2:"0",y2:"1",children:[e.jsx("stop",{offset:"5%",stopColor:"#6366f1",stopOpacity:.3}),e.jsx("stop",{offset:"95%",stopColor:"#6366f1",stopOpacity:0})]})]}),e.jsx(Fe,{strokeDasharray:"3 3",vertical:!1,stroke:"#e2e8f0"}),e.jsx(Z,{dataKey:"time",tick:{fontSize:12,fill:"#64748b"},stroke:"#cbd5e1",tickLine:!1}),e.jsx(ee,{domain:[20,100],tick:{fontSize:12,fill:"#64748b"},stroke:"#cbd5e1",tickLine:!1}),e.jsx(se,{content:({active:a,payload:i})=>{if(a&&i&&i.length){const x=i[0].payload;return e.jsxs("div",{className:"bg-slate-900 text-white rounded-xl p-3 text-xs shadow-xl border border-slate-750 flex flex-col gap-1 min-w-[170px]",children:[e.jsxs("div",{className:"flex items-center justify-between border-b border-slate-700 pb-1 font-mono text-slate-300",children:[e.jsxs("span",{children:["⏱️ ",x.time]}),e.jsxs("span",{className:"text-emerald-400 font-bold",children:[x.engagement,"% 专注"]})]}),e.jsxs("div",{className:"flex items-center justify-between mt-1 text-slate-200",children:[e.jsx("span",{children:"⚡ 课堂能量波:"}),e.jsxs("span",{className:"font-bold text-indigo-400",children:[x.energy,"%"]})]}),e.jsxs("div",{className:"flex items-center justify-between text-slate-300",children:[e.jsx("span",{children:"🎯 互动操作次数:"}),e.jsxs("span",{className:"font-bold",children:[x.interactions," 次"]})]}),e.jsxs("div",{className:"border-t border-slate-800 pt-1 mt-1 flex justify-between text-2xs text-slate-400",children:[e.jsxs("span",{className:"text-emerald-400",children:["听懂: ",x.clear]}),e.jsxs("span",{className:"text-amber-400",children:["存疑: ",x.confused]}),e.jsxs("span",{className:"text-rose-400",children:["过快: ",x.tooFast]})]})]})}return null}}),e.jsx(_e,{y:70,stroke:"#10b981",strokeDasharray:"4 4",label:{value:s==="zh"?"黄金心流区间 70%":"Optimal Flow 70%",fill:"#059669",fontSize:12,position:"insideTopLeft"}}),e.jsx(te,{type:"monotone",dataKey:"engagement",name:"Engagement",stroke:"#0d9488",strokeWidth:2.5,fillOpacity:1,fill:"url(#engagementGradient)"}),e.jsx(te,{type:"monotone",dataKey:"energy",name:"Energy",stroke:"#6366f1",strokeWidth:2,fillOpacity:1,fill:"url(#energyGradient)"})]})})})]}),e.jsxs("div",{className:"lg:col-span-4 bg-slate-50/60 border border-slate-200/70 rounded-2xl p-4 flex flex-col justify-between min-h-[300px]",children:[e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center justify-between mb-2",children:[e.jsxs("span",{className:"text-xs font-black text-slate-800 uppercase tracking-wider flex items-center gap-1.5",children:[e.jsx(ze,{size:14,className:"text-teal-600"}),e.jsx("span",{children:s==="zh"?"学生脉搏反馈占比":"Pulse Distribution"})]}),e.jsxs("span",{className:"text-xs text-slate-500 font-bold",children:[m.pulseDistribution.total," ",s==="zh"?"总票数":"total"]})]}),e.jsx("p",{className:"text-xs text-slate-450 mb-3",children:s==="zh"?"30秒极速自检晴雨表反馈结构":"Direct student pacing signal distribution"}),e.jsx("div",{className:"h-[120px] w-full",children:e.jsx(J,{width:"100%",height:"100%",children:e.jsxs(Oe,{data:O,layout:"vertical",margin:{top:0,right:30,left:10,bottom:0},children:[e.jsx(Z,{type:"number",domain:[0,100],hide:!0}),e.jsx(ee,{type:"category",dataKey:"name",tick:{fontSize:12,fill:"#334155",fontWeight:600},width:85,axisLine:!1,tickLine:!1}),e.jsx(se,{formatter:(a,i,x)=>[`${a}% (${x.payload.count}人次)`,"占比"]}),e.jsx(Be,{dataKey:"percent",radius:[0,8,8,0],barSize:18,children:O.map((a,i)=>e.jsx(Re,{fill:a.color},`cell-${i}`))})]})})})]}),e.jsxs("div",{className:"mt-3 border-t border-slate-200/70 pt-3",children:[e.jsx("span",{className:"text-2xs font-bold uppercase tracking-wider text-slate-450 block mb-1.5",children:s==="zh"?"最新动态流水":"Latest Live Signals"}),A.length===0?e.jsx("div",{className:"text-2xs text-slate-400 py-1 italic",children:s==="zh"?"等待学生端点击晴雨表或参与抢答投票...":"Listening for live student signals or polls..."}):e.jsx("div",{className:"space-y-1.5 max-h-[70px] overflow-y-auto pr-1",children:A.map(a=>e.jsxs("div",{className:"flex items-center justify-between text-2xs py-1 px-2 bg-white rounded-lg border border-slate-200/60 shadow-3xs",children:[e.jsx("span",{className:"font-semibold text-slate-700 truncate max-w-[160px]",children:a.text}),e.jsx("span",{className:"font-mono text-slate-400 shrink-0",children:a.time})]},a.id))})]})]})]}),e.jsxs("div",{className:`p-3.5 rounded-xl border flex items-center gap-3 transition-all ${E.type==="warning"?"bg-amber-500/10 border-amber-500/30 text-amber-900":E.type==="caution"?"bg-rose-500/10 border-rose-500/30 text-rose-900":"bg-emerald-500/10 border-emerald-500/30 text-emerald-900"}`,children:[e.jsx("div",{className:"w-8 h-8 rounded-lg bg-white/80 flex items-center justify-center shrink-0 shadow-3xs",children:e.jsx(De,{size:18,className:E.type==="warning"?"text-amber-600":E.type==="caution"?"text-rose-600":"text-emerald-600"})}),e.jsxs("div",{className:"flex-1 text-xs",children:[e.jsx("span",{className:"font-bold mr-1.5",children:s==="zh"?"AI 教学节奏诊断建议:":"Teaching Pace Advice:"}),e.jsx("span",{children:E.text})]})]})]})}function We({classDashboardMap:s,classes:b,lang:w}){const h=w==="zh",g=c.useMemo(()=>{const o=Object.keys(s);if(o.length===0)return null;let y=0,p=0,C=0,v=0,P=0,k=0;for(const A of o){const z=s[A];if(!z)continue;const m=z.performance??[],$=z.rollcallStats??[];for(const f of m)f.score!=null&&!isNaN(Number(f.score))&&(y+=Number(f.score),p++);const I=new Map;for(const f of m)(f.submission_status==="submitted"||f.score!=null)&&I.set(f.student_id,!0);C+=$.length||0,v+=I.size;for(const f of $)P+=f.count??0,k++}const M=p>0?Math.round(y/p):null,L=C>0?Math.round(v/C*100):null,T=k>0?(P/k).toFixed(1):null;return{avgGrade:M,attendanceRate:L,participationScore:T,classCount:o.length}},[s]);if(!g)return 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-3",children:[e.jsx(V,{size:16,className:"text-primary-theme"}),e.jsx("h3",{className:"text-sm font-black text-main",children:h?"班级综合数据概览":"Class Summary Stats"})]}),e.jsx("p",{className:"text-xs text-muted text-center py-6",children:h?"暂无班级数据,展开班级卡片后将自动加载":"No class data yet — expand a class card to load data"})]});const N=[{icon:Pe,label:h?"平均成绩":"Average Grade",value:g.avgGrade!=null?`${g.avgGrade}`:"—",suffix:g.avgGrade!=null?h?"分":"pts":"",hint:h?"基于已评分作业":"Based on graded assignments",tone:"text-emerald-700 bg-emerald-50 border-emerald-200/80 dark:bg-emerald-950/40 dark:border-emerald-800/70 dark:text-emerald-300",iconBg:"bg-emerald-100 dark:bg-emerald-900/50"},{icon:W,label:h?"出勤提交率":"Submission Rate",value:g.attendanceRate!=null?`${g.attendanceRate}`:"—",suffix:g.attendanceRate!=null?"%":"",hint:h?"至少提交过一次作业的学生占比":"Students with at least one submission",tone:"text-blue-700 bg-blue-50 border-blue-200/80 dark:bg-blue-950/40 dark:border-blue-800/70 dark:text-blue-300",iconBg:"bg-blue-100 dark:bg-blue-900/50"},{icon:de,label:h?"课堂参与频次":"Participation Freq.",value:g.participationScore??"—",suffix:g.participationScore!=null?h?"次/人":"/student":"",hint:h?"平均点名回答次数":"Average rollcall picks per student",tone:"text-amber-700 bg-amber-50 border-amber-200/80 dark:bg-amber-950/40 dark:border-amber-800/70 dark:text-amber-300",iconBg:"bg-amber-100 dark:bg-amber-900/50"}];return e.jsxs("div",{className:"bg-surface border border-theme rounded-2xl p-5 shadow-sm",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(V,{size:16,className:"text-primary-theme"}),e.jsx("h3",{className:"text-sm font-black text-main",children:h?"班级综合数据概览":"Class Summary Stats"})]}),e.jsx("span",{className:"text-2xs font-semibold text-muted px-2 py-0.5 rounded-lg bg-surface-secondary border border-theme",children:h?`已加载 ${g.classCount} 个班级`:`${g.classCount} class(es) loaded`})]}),e.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-3 gap-3",children:N.map(o=>{const y=o.icon;return e.jsxs("div",{className:"rounded-xl border border-theme bg-surface-secondary p-4 flex items-start gap-3",children:[e.jsx("div",{className:`w-9 h-9 rounded-lg ${o.iconBg} border border-theme flex items-center justify-center shrink-0`,children:e.jsx(y,{size:16,className:o.tone.split(" ")[0]})}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("div",{className:"text-2xs text-muted font-medium truncate",children:o.label}),e.jsxs("div",{className:"flex items-baseline gap-1 mt-0.5",children:[e.jsx("span",{className:`text-lg font-black font-mono leading-none ${o.tone.split(" ")[0]}`,children:o.value}),o.suffix&&e.jsx("span",{className:"text-2xs text-muted font-medium",children:o.suffix})]}),e.jsx("div",{className:"text-2xs text-subtle mt-1 truncate",children:o.hint})]})]},o.label)})})]})}function Ze(){const{lang:s,t:b,lessons:w,classes:h,students:g,todaySchedules:N,approvals:o,processes:y,isApprovalsCollapsed:p,setIsApprovalsCollapsed:C,isProcessesCollapsed:v,setIsProcessesCollapsed:P,scoreOverrides:k,setScoreOverrides:M,handleApprove:L,handleReject:T,showLogs:A,setShowLogs:z,processLogsContent:m,showProcessLogs:$,fetchProcessLogs:I,setShowProcessLogs:f,addToast:S,handleQuickScheduleClass:_,handleQuickGenerateAssignment:O,handleQuickCreateLesson:D,classDashboardMap:E}=ue(),[a,i]=c.useState("overview"),[x,r]=c.useState(null);return e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex-1 flex flex-col gap-6 h-full overflow-y-auto pr-2",children:[e.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-3 pb-1 border-b border-theme/50",children:[e.jsxs("div",{className:"flex items-center gap-1.5 bg-surface-secondary p-1 rounded-xl border border-theme w-fit",children:[e.jsxs("button",{id:"teacher-dashboard-overview-tab","data-testid":"teacher-dashboard-overview-tab",onClick:()=>i("overview"),className:`px-3.5 py-1.5 rounded-lg text-xs font-bold flex items-center gap-2 transition-all cursor-pointer ${a==="overview"?"bg-surface text-primary-theme shadow-xs":"text-muted hover:text-main"}`,children:[e.jsx(Me,{size:14}),e.jsx("span",{children:s==="zh"?"综合总览":"Overview"})]}),e.jsxs("button",{id:"teacher-dashboard-classroom-tab","data-testid":"teacher-dashboard-classroom-tab",onClick:()=>i("classroom"),className:`px-3.5 py-1.5 rounded-lg text-xs font-bold flex items-center gap-2 transition-all cursor-pointer ${a==="classroom"?"bg-surface text-primary-theme shadow-xs":"text-muted hover:text-main"}`,children:[e.jsx(Le,{size:14}),e.jsx("span",{children:s==="zh"?"课堂互动 (Classroom)":"Classroom"}),e.jsx("span",{className:"w-2 h-2 rounded-full bg-amber-500 animate-pulse"})]})]}),e.jsx("div",{className:"flex items-center gap-2 text-xs text-muted",children:e.jsxs("span",{className:"font-medium",children:[s==="zh"?"当前视图:":"View:"," ",e.jsx("span",{className:"text-main font-bold",children:a==="overview"?s==="zh"?"日常综合总览":"Overview":s==="zh"?"课堂随堂优秀榜与态势追踪":"Classroom Top Performers & Flow"})]})})]}),a==="classroom"?e.jsxs("div",{className:"flex flex-col gap-6",children:[e.jsx(We,{classDashboardMap:E,classes:h,lang:s}),e.jsxs("div",{className:"bg-surface border border-theme rounded-2xl p-5 shadow-sm",children:[e.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-3 mb-3",children:[e.jsxs("div",{children:[e.jsxs("h3",{className:"text-sm font-black text-main flex items-center gap-2",children:[e.jsx(Te,{size:16,className:"text-primary-theme"}),e.jsx("span",{children:s==="zh"?"课堂全班倒计时调度与广播":"Classroom Countdown Dispatcher"})]}),e.jsx("p",{className:"text-xs text-muted",children:s==="zh"?"实时向所有学生端同步广播任务倒计时,支持随堂测验、分组探究与限时答题":"Broadcast real-time countdown to connected students with presets and third-party plugin extensions"})]}),w.length>0&&e.jsx("div",{className:"flex items-center gap-2",children:e.jsx("select",{value:x||w[0]?.id||"",onChange:n=>r(n.target.value),className:"px-3 py-1.5 bg-surface-secondary border border-theme rounded-xl text-xs font-semibold text-main outline-none focus:ring-2 focus:ring-primary-theme cursor-pointer",children:w.map(n=>e.jsx("option",{value:n.id,children:n.title},n.id))})})]}),e.jsx(qe,{lessonId:x||w[0]?.id||null,lang:s,compact:!1,onlineStudentCount:g.length})]}),e.jsx(ae,{lang:s,lessons:w,classes:h,schedules:N,students:g,addToast:S}),e.jsx(ne,{lang:s,lessons:w,classes:h,schedules:N,students:g,addToast:(n,l,d)=>S(n,l,d??"info")})]}):e.jsxs(e.Fragment,{children:[(()=>{const n=t=>{if(t.status==="cancelled"||t.status==="holiday")return!1;if(!t.time_slot)return!0;try{const j=t.time_slot.split("-");if(j.length<2)return!0;const B=j[1].trim(),[F,R]=B.split(":").map(Number),q=new Date,Q=q.getHours(),ce=q.getMinutes();return!(Q>F||Q===F&&ce>=R)}catch{return!0}},l=N.filter(n),d=N.length-l.length;N.filter(t=>t.status==="cancelled"||t.status==="holiday");const u=l[0];return e.jsxs("div",{className:"bg-white border border-slate-200/80 rounded-2xl p-5 text-slate-800 shadow-sm flex flex-col md:flex-row justify-between items-stretch gap-6 transition-all duration-300",children:[e.jsx("div",{className:"flex-1 flex flex-col justify-between bg-slate-50/50 rounded-xl p-4.5 border border-slate-200/60 min-h-[160px]",children:u?e.jsxs("div",{className:"flex-1 flex flex-col justify-between",children:[e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"bg-amber-400 text-slate-950 text-xs font-extrabold px-2.5 py-0.5 rounded-full uppercase tracking-wider animate-pulse shadow-xs",children:s==="zh"?"下一堂面授课":"NEXT CLASS"}),e.jsx("span",{className:"font-mono text-xs text-indigo-700 font-bold bg-indigo-50 px-2 py-0.5 rounded-md border border-indigo-100/30",children:u.time_slot})]}),e.jsx("h3",{className:"text-lg md:text-xl font-extrabold tracking-tight mt-3 text-slate-800 line-clamp-2",title:u.lesson_title,children:u.lesson_title}),e.jsxs("p",{className:"text-xs text-slate-500 mt-2 font-medium",children:["📍 ",u.class_name," ",u.classroom&&` | 教室: ${u.classroom}`," ",u.teacher_name&&` | 教师: ${u.teacher_name}`]})]}),u.notes&&e.jsxs("div",{className:"mt-3 text-xs italic text-indigo-700 bg-indigo-50/60 p-2 rounded-lg border border-indigo-100/40 truncate",title:u.notes,children:["* ",u.notes]})]}):e.jsxs("div",{className:"flex-1 flex flex-col justify-center items-center text-center py-6 select-none",children:[e.jsx("span",{className:"text-3xl animate-bounce",children:"☕"}),e.jsx("h3",{className:"text-base font-extrabold text-slate-850 mt-2",children:s==="zh"?"今日课程已全部结束":"All Classes Finished"}),e.jsx("p",{className:"text-xs text-slate-455 mt-1 max-w-[280px]",children:s==="zh"?"接下来暂无排定课次,您可以休息调整。":"No remaining schedules today. Take a rest!"})]})}),e.jsxs("div",{className:"w-full md:w-[300px] lg:w-[350px] flex flex-col gap-3",children:[e.jsxs("div",{className:"flex justify-between items-center border-b border-slate-200/80 pb-2",children:[e.jsxs("span",{className:"text-xs uppercase font-extrabold tracking-wider text-indigo-600 flex items-center gap-1.5",children:["📅 ",s==="zh"?"今日面授排课流":"TODAY'S SCHEDULES"]}),e.jsx("span",{className:"text-xs text-slate-500 font-medium",children:s==="zh"?`共 ${N.length} 节 | 已下课 ${d} 节`:`Total ${N.length} | Done ${d}`})]}),N.length===0?e.jsxs("div",{className:"flex-1 flex items-center justify-center text-xs font-bold text-slate-450 py-6",children:["☕ ",s==="zh"?"今日暂无排定课次":"No schedules configured."]}):e.jsx("div",{className:"space-y-2 max-h-[150px] overflow-y-auto pr-1",children:N.map(t=>{const j=u&&t.id===u.id,B=l.some(q=>q.id===t.id)&&!j,F=t.status==="cancelled"||t.status==="holiday",R=!j&&!B&&!F;return e.jsxs("div",{className:`flex items-center justify-between text-xs py-1 border-b border-slate-100 last:border-b-0 ${R?"bg-slate-50/70":""}`,children:[e.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[e.jsx("span",{className:"font-mono text-xs text-slate-500 shrink-0",children:t.time_slot}),e.jsx("span",{className:`font-bold truncate max-w-[120px] lg:max-w-[150px] ${j?"text-indigo-700":R||F?"text-slate-500":"text-slate-700"} ${F?"line-through":""}`,title:t.lesson_title,children:t.lesson_title}),e.jsxs("span",{className:"text-xs text-slate-500 truncate max-w-[60px] lg:max-w-[80px]",children:["(",t.class_name,")"]})]}),e.jsxs("div",{className:"shrink-0 ml-2",children:[j&&e.jsx("span",{className:"bg-amber-400 text-slate-950 font-extrabold text-xs px-1.5 py-0.5 rounded uppercase scale-90 inline-block animate-pulse shadow-xs",children:"进行"}),R&&e.jsx("span",{className:"bg-slate-200 text-slate-700 text-xs px-1.5 py-0.5 rounded font-bold",children:"已完"}),B&&e.jsx("span",{className:"bg-indigo-50 text-indigo-700 text-xs px-1.5 py-0.5 rounded font-medium border border-indigo-100/50",children:"待上"}),F&&e.jsx("span",{className:"bg-rose-50 text-rose-600 text-xs px-1.5 py-0.5 rounded font-bold border border-rose-100/50",children:"停课"})]})]},t.id)})})]})]})})(),e.jsx(K,{slot:"teacher.dashboard.widget"}),e.jsx(ae,{lang:s,lessons:w,classes:h,schedules:N,students:g,addToast:S}),e.jsx(ne,{lang:s,lessons:w,classes:h,schedules:N,students:g,addToast:(n,l,d)=>S(n,l,d??"info")}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-5",children:[e.jsxs("div",{className:"bg-gradient-to-br from-indigo-50/60 to-indigo-100/10 border border-indigo-100/60 rounded-2xl p-5 shadow-xs flex items-center justify-between hover:shadow-sm hover:-translate-y-0.5 transition-all duration-300",children:[e.jsxs("div",{className:"flex flex-col gap-1",children:[e.jsx("span",{className:"text-xs font-bold text-indigo-655 uppercase tracking-wider",children:s==="zh"?"课程数量":"Total Courses"}),e.jsx("span",{className:"text-3xl font-extrabold text-slate-800 tracking-tight leading-none mt-1",children:w.length})]}),e.jsx("div",{className:"p-3 bg-indigo-500/10 text-indigo-600 rounded-xl",children:e.jsx(G,{size:24})})]}),e.jsxs("div",{className:"bg-gradient-to-br from-pink-50/60 to-pink-100/10 border border-pink-100/60 rounded-2xl p-5 shadow-xs flex items-center justify-between hover:shadow-sm hover:-translate-y-0.5 transition-all duration-300",children:[e.jsxs("div",{className:"flex flex-col gap-1",children:[e.jsx("span",{className:"text-xs font-bold text-pink-600 uppercase tracking-wider",children:s==="zh"?"班级数量":"Total Classes"}),e.jsx("span",{className:"text-3xl font-extrabold text-slate-800 tracking-tight leading-none mt-1",children:h.length})]}),e.jsx("div",{className:"p-3 bg-pink-500/10 text-pink-600 rounded-xl",children:e.jsx(Ae,{size:24})})]}),e.jsxs("div",{className:"bg-gradient-to-br from-emerald-50/60 to-emerald-100/10 border border-emerald-100/60 rounded-2xl p-5 shadow-xs flex items-center justify-between hover:shadow-sm hover:-translate-y-0.5 transition-all duration-300",children:[e.jsxs("div",{className:"flex flex-col gap-1",children:[e.jsx("span",{className:"text-xs font-bold text-emerald-650 uppercase tracking-wider",children:s==="zh"?"学生数量":"Total Students"}),e.jsx("span",{className:"text-3xl font-extrabold text-slate-800 tracking-tight leading-none mt-1",children:g.length})]}),e.jsx("div",{className:"p-3 bg-emerald-500/10 text-emerald-600 rounded-xl",children:e.jsx(W,{size:24})})]})]}),e.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-6 items-start",children:[e.jsxs("div",{className:"bg-white border border-rose-100 rounded-2xl shadow-sm flex flex-col transition-all duration-300",children:[e.jsxs("div",{onClick:()=>C(!p),className:"p-4 border-b border-rose-50 flex items-center justify-between cursor-pointer select-none hover:bg-rose-50/20 rounded-t-2xl transition-colors",children:[e.jsxs("h3",{className:"font-extrabold text-sm md:text-base text-rose-700 flex items-center gap-2",children:[e.jsx($e,{size:18}),b.approvals,o.length>0&&e.jsx("span",{className:"bg-rose-100 text-rose-700 text-xs px-2 py-0.5 rounded-full font-bold ml-1",children:o.length})]}),e.jsx("div",{className:"text-rose-400 hover:text-rose-600 transition-colors",children:p?e.jsx(X,{size:18}):e.jsx(Y,{size:18})})]}),!p&&e.jsx("div",{className:"flex-1 overflow-y-auto p-3 max-h-[350px]",children:o.length===0?e.jsx("div",{className:"text-center p-8 text-xs md:text-sm text-slate-400 font-medium",children:b.noApprovals}):o.map(n=>{let l={};try{l=JSON.parse(n.payload||"{}")}catch{}const d=n.command_type==="ai.apply_grade",u=k[n.id]!==void 0?k[n.id]:l.score||0;return e.jsxs("div",{className:"w-full p-4 rounded-xl text-sm bg-slate-55 border border-slate-100 mb-3 shadow-3xs flex flex-col gap-3 hover:border-rose-150 transition-colors",children:[e.jsxs("div",{children:[e.jsx("div",{className:"font-extrabold text-slate-800 mb-1",children:n.command_type==="ai.apply_grade"?"🎓 Evaluate Submission":n.command_type}),e.jsx("div",{className:"text-xs text-slate-500 font-mono mb-2 line-clamp-2 bg-white border border-slate-100 p-2 rounded-lg",title:n.payload,children:d?`Feedback: ${l.feedback}`:n.payload})]}),d&&e.jsxs("div",{className:"bg-white border border-slate-150 p-2 rounded-xl flex items-center justify-between gap-3",children:[e.jsx("label",{className:"text-xs font-bold text-slate-700",children:"Modify Score:"}),e.jsx("input",{type:"number",className:"w-20 border border-slate-200 rounded-lg px-2 py-1 text-xs focus:ring-2 focus:ring-indigo-500 outline-none transition-all",value:u,onChange:t=>M(j=>({...j,[n.id]:parseInt(t.target.value)||0}))})]}),e.jsxs("div",{className:"flex gap-2 justify-end mt-1",children:[e.jsxs("button",{onClick:()=>L(n.id,d&&k[n.id]!==void 0?{score:k[n.id]}:void 0),className:"p-1.5 px-3.5 bg-rose-600 hover:bg-rose-700 text-white rounded-lg font-bold text-xs flex items-center gap-1.5 shadow-sm transition-all animate-none",children:[e.jsx(Ie,{size:14})," ",b.approve]}),e.jsxs("button",{onClick:()=>T(n.id),className:"p-1.5 px-3.5 bg-slate-100 hover:bg-slate-200 text-slate-750 rounded-lg font-bold text-xs flex items-center gap-1.5 shadow-3xs transition-all",children:[e.jsx(re,{size:14})," ",b.reject]})]})]},n.id)})})]}),e.jsxs("div",{className:"bg-white border border-slate-200/60 rounded-2xl shadow-sm flex flex-col transition-all duration-300",children:[e.jsxs("div",{onClick:()=>P(!v),className:"p-4 border-b border-slate-100 flex items-center justify-between cursor-pointer select-none hover:bg-slate-50/20 rounded-t-2xl transition-colors",children:[e.jsxs("h3",{className:"font-extrabold text-sm md:text-base text-slate-700 flex items-center gap-2",children:[e.jsx(oe,{size:18,className:"text-indigo-500"}),b.processes,y.length>0&&e.jsx("span",{className:"bg-indigo-50 text-indigo-700 text-xs px-2 py-0.5 rounded-full font-bold ml-1",children:y.length})]}),e.jsx("div",{className:"text-slate-400 hover:text-slate-650 transition-colors",children:v?e.jsx(X,{size:18}):e.jsx(Y,{size:18})})]}),!v&&e.jsx("div",{className:"flex-1 overflow-y-auto p-3 max-h-[350px]",children:y.length===0?e.jsx("div",{className:"text-center p-8 text-xs md:text-sm text-slate-400 font-medium",children:b.noProcesses}):y.map(n=>e.jsxs("div",{className:"w-full p-4 rounded-xl text-sm bg-slate-50 border border-slate-100 mb-3 shadow-3xs flex flex-col gap-2.5 hover:border-indigo-150 transition-colors",children:[e.jsxs("div",{className:"flex items-center justify-between mb-1",children:[e.jsx("span",{className:"font-extrabold text-slate-800 truncate",title:n.name,children:n.name}),e.jsx("span",{className:`text-xs uppercase px-2 py-0.5 rounded-full font-bold ${n.status==="running"?"bg-blue-100 text-blue-700":n.status==="completed"?"bg-emerald-100 text-emerald-700":n.status==="failed"?"bg-rose-100 text-rose-700":"bg-slate-200 text-slate-700"}`,children:n.status})]}),e.jsxs("div",{className:"flex justify-between items-center mt-1",children:[e.jsxs("span",{className:"text-xs text-slate-400 font-mono",children:["PID: ",n.id]}),e.jsx("button",{onClick:()=>f(n.id),className:"text-xs font-bold text-indigo-650 hover:text-indigo-850 transition-colors",children:b.processLogs})]})]},n.id))})]})]})]}),e.jsx(K,{slot:"teacher.panel",slotProps:{lang:s,lessons:w,classes:h,students:g}})]}),e.jsx(Ge,{classes:h,lessons:w,lang:s,onScheduleClass:_,onGenerateAssignment:async(n,l)=>!!await O(n,l,l),onCreateLesson:async(n,l)=>!!await D(n,l)})]})}export{Ze as Dashboard};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as e}from"./vendor-react-
|
|
1
|
+
import{j as e}from"./vendor-react-DHoBZpn2.js";import{m as z}from"./index-BiHQqzdm.js";import{aZ as k,a_ as C,aK as S,av as $,J as A}from"./vendor-icons-DaYNfRAc.js";import"./vendor-utils-BxOuk3id.js";import"./vendor-pdf-DVWGghIL.js";import"./vendor-motion-BFAPOs-b.js";import"./vendor-charts-skggaP9D.js";function _({isExportWeightModalOpen:f,setIsExportWeightModalOpen:x,lang:s,quizzesWeight:g,setQuizzesWeight:h,assignmentsWeight:m,setAssignmentsWeight:b,handleQuizzesWeightChange:p,handleAssignmentsWeightChange:j,customCategoryOverrides:u,setCustomCategoryOverrides:y,classDashboardMap:i,exportClassId:r,exportClassName:N,csvPreviewData:n,handleExportGrades:v}){return f?e.jsx("div",{className:"fixed inset-0 bg-gray-900/40 backdrop-blur-sm flex items-center justify-center p-6 z-50",children:e.jsxs(z.div,{initial:{opacity:0,scale:.95},animate:{opacity:1,scale:1},exit:{opacity:0,scale:.95},className:"bg-white border text-gray-900 border-gray-200 rounded-2xl shadow-2xl w-full max-w-2xl flex flex-col overflow-hidden max-h-[85vh]",children:[e.jsxs("div",{className:"p-4 border-b border-gray-100 flex items-center justify-between bg-gray-50/80 shrink-0",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(k,{className:"text-indigo-600 font-sans",size:20}),e.jsx("h2",{className:"font-bold text-gray-800 text-lg font-sans",children:s==="zh"?"导出成绩权重设置":"Grade Export & Weighting Settings"})]}),e.jsx("button",{onClick:()=>x(!1),className:"text-gray-400 hover:text-gray-600 font-bold p-1 hover:bg-gray-200 rounded transition-colors text-lg",children:"×"})]}),e.jsxs("div",{className:"flex-1 overflow-y-auto p-6 space-y-6",children:[e.jsx("div",{className:"bg-indigo-50 border border-indigo-150 rounded-xl p-4 text-indigo-800 text-xs font-sans leading-relaxed",children:s==="zh"?"您可以自定义测验与作业在期末成绩(平均分)中的计算权重。系统已根据测验名和内容自动对课程内容进行分类,您可以在下方手动微调分类。":"Customize the calculation weight of quizzes and assignments in the calculated average score. The system automatically classifies items, but you can manually override categorized groups below."}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("h3",{className:"font-bold text-sm text-gray-800 flex items-center gap-2 font-sans",children:[e.jsx(C,{size:16,className:"text-indigo-500 font-sans"}),s==="zh"?"定义成绩占比权重":"Define Weighting Percentages"]}),e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4 bg-gray-50 p-4 rounded-xl border border-gray-100 font-sans",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{className:"text-xs font-semibold text-gray-700",children:s==="zh"?"测验权重 (Quizzes)":"Quizzes Weight"}),e.jsxs("span",{className:"text-xs font-bold text-indigo-600 bg-indigo-50 px-2 py-0.5 rounded border border-indigo-100",children:[g,"%"]})]}),e.jsx("input",{type:"range","aria-label":s==="zh"?"随堂测验权重":"Quizzes weight",min:"0",max:"100",value:g,onChange:t=>p(Number(t.target.value)),className:"w-full h-1.5 bg-gray-200 rounded-lg appearance-none cursor-pointer accent-indigo-600"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{className:"text-xs font-semibold text-gray-700",children:s==="zh"?"作业权重 (Assignments)":"Assignments Weight"}),e.jsxs("span",{className:"text-xs font-bold text-indigo-600 bg-indigo-50 px-2 py-0.5 rounded border border-indigo-100",children:[m,"%"]})]}),e.jsx("input",{type:"range","aria-label":s==="zh"?"作业权重":"Assignments weight",min:"0",max:"100",value:m,onChange:t=>j(Number(t.target.value)),className:"w-full h-1.5 bg-gray-200 rounded-lg appearance-none cursor-pointer accent-indigo-600"})]})]}),e.jsxs("div",{className:"flex justify-end gap-2",children:[e.jsx("button",{type:"button",onClick:()=>{h(50),b(50)},className:"text-xs text-gray-500 hover:text-gray-700 bg-white border border-gray-200 hover:bg-gray-50 font-bold px-2.5 py-1 rounded transition-colors cursor-pointer",children:s==="zh"?"均衡配比 50/50":"Balance 50/50"}),e.jsx("button",{type:"button",onClick:()=>{h(40),b(60)},className:"text-xs text-gray-500 hover:text-gray-700 bg-white border border-gray-200 hover:bg-gray-50 font-bold px-2.5 py-1 rounded transition-colors cursor-pointer",children:s==="zh"?"推荐配比 40/60":"Recommend 40/60"})]})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsxs("h3",{className:"font-bold text-sm text-gray-800 flex items-center justify-between font-sans",children:[e.jsxs("span",{className:"flex items-center gap-2",children:[e.jsx(S,{size:16,className:"text-indigo-500"}),s==="zh"?"期末考核项目微调":"Item Categorization Overrides"]}),e.jsx("span",{className:"text-xs text-gray-400 font-medium font-sans",children:s==="zh"?`共 ${i[r]?.assignments?.length||0} 项`:`${i[r]?.assignments?.length||0} items total`})]}),e.jsxs("div",{className:"border border-gray-150 rounded-xl overflow-hidden divide-y divide-gray-100 max-h-60 overflow-y-auto bg-white shadow-inner",children:[(i[r]?.assignments||[]).map(t=>{const d=t.content&&t.content.startsWith('{"quizType":"mcq_learning_objectives"'),l=t.title&&(t.title.toLowerCase().includes("quiz")||t.title.toLowerCase().includes("test")||t.title.includes("测验")||t.title.includes("测试")),o=d||l?"quiz":"assignment",a=u[t.id]||o;return e.jsxs("div",{className:"p-3 flex items-center justify-between gap-4 font-sans hover:bg-gray-50/50 transition-colors",children:[e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("div",{className:"font-semibold text-xs text-gray-800 truncate",title:t.title,children:t.title}),e.jsx("div",{className:"text-xs text-gray-400 truncate mt-0.5",children:t.description||(s==="zh"?"无描述信息":"No description provided")})]}),e.jsxs("div",{className:"flex border border-gray-200 rounded-lg p-0.5 bg-gray-50 shrink-0",children:[e.jsx("button",{type:"button",onClick:()=>y(c=>({...c,[t.id]:"quiz"})),className:`px-2.5 py-1 text-xs font-bold rounded-md transition-all cursor-pointer ${a==="quiz"?"bg-indigo-600 text-white shadow":"text-gray-500 hover:text-gray-800 hover:bg-gray-100"}`,children:s==="zh"?"测验":"Quiz"}),e.jsx("button",{type:"button",onClick:()=>y(c=>({...c,[t.id]:"assignment"})),className:`px-2.5 py-1 text-xs font-bold rounded-md transition-all cursor-pointer ${a==="assignment"?"bg-emerald-600 text-white shadow":"text-gray-500 hover:text-gray-800 hover:bg-gray-100"}`,children:s==="zh"?"作业":"Assignment"})]})]},t.id)}),(!i[r]?.assignments||i[r].assignments.length===0)&&e.jsx("div",{className:"p-8 text-center text-xs text-gray-400 italic",children:s==="zh"?"此班级暂未创建任何考核项目":"No graded items exist in this class."})]})]}),n&&n.rows.length>0&&e.jsxs("div",{className:"space-y-3 pt-2",children:[e.jsxs("h3",{className:"font-bold text-sm text-gray-800 flex items-center justify-between font-sans",children:[e.jsxs("span",{className:"flex items-center gap-2",children:[e.jsx($,{size:16,className:"text-emerald-500"}),s==="zh"?"CSV 实时成绩表预览 (前5行数据)":"Live CSV Grade Preview (First 5 Rows)"]}),e.jsx("span",{className:"text-xs bg-emerald-50 text-emerald-700 border border-emerald-100 font-bold px-2 py-0.5 rounded shadow-xs font-sans",children:s==="zh"?`展示 5 / ${n.totalStudents} 名学生`:`Showing 5 of ${n.totalStudents} students`})]}),e.jsx("div",{className:"border border-gray-150 rounded-xl overflow-hidden bg-white shadow-xs max-w-full",children:e.jsx("div",{className:"overflow-x-auto max-h-56 overflow-y-auto",children:e.jsxs("table",{className:"w-full border-collapse text-left",children:[e.jsx("thead",{children:e.jsx("tr",{className:"bg-gray-50 border-b border-gray-150 sticky top-0 z-10",children:n.headers.map((t,d)=>{const l=t.includes("Average")||t.includes("Avg")||t.includes("Score"),o=t.includes("Weighted");return e.jsx("th",{className:`p-2.5 text-xs font-bold tracking-wider uppercase border-r border-gray-150 whitespace-nowrap font-sans font-semibold ${o?"text-indigo-700 bg-indigo-50/70 border-indigo-150 font-bold":l?"text-emerald-700 bg-emerald-50/70":"text-gray-500"}`,children:t},d)})})}),e.jsx("tbody",{className:"divide-y divide-gray-100",children:n.rows.map((t,d)=>e.jsx("tr",{className:"hover:bg-gray-50/50 transition-colors font-mono text-xs",children:t.map((l,o)=>{const a=n.headers[o]||"",c=a.includes("Weighted"),w=a.includes("Average")||a.includes("Avg")||a.includes("Score");return e.jsx("td",{className:`p-2 border-r border-gray-100 font-mono text-xs text-gray-700 whitespace-nowrap text-center ${c?"bg-indigo-50/30 font-bold text-indigo-700 border-indigo-100":w?"bg-emerald-50/10 font-semibold text-emerald-800":o<2?"text-left font-sans font-medium":""}`,children:l},o)})},d))})]})})}),e.jsx("p",{className:"text-xs text-gray-400 font-sans italic",children:s==="zh"?"* 改变上方权重占比或调整项目分类时,此预览与计算结果会立即实时刷新。":"* Calculations and layout values in this preview refresh dynamically as you tweak sliders and overrides."})]})]}),e.jsxs("div",{className:"p-4 border-t border-gray-100 bg-gray-50/85 flex justify-end gap-2.5 shrink-0",children:[e.jsx("button",{type:"button",onClick:()=>x(!1),className:"px-4 py-2 text-xs font-semibold border border-gray-300 text-gray-700 bg-white rounded-lg hover:bg-gray-100 transition-colors cursor-pointer",children:s==="zh"?"取消":"Cancel"}),e.jsxs("button",{type:"button",disabled:!i[r]?.assignments||i[r].assignments.length===0,onClick:()=>{v(r,N,g,m,u),x(!1)},className:"px-4 py-2 text-xs font-bold bg-indigo-600 text-white border border-indigo-700 rounded-lg hover:bg-indigo-700 hover:shadow shadow-sm transition-all flex items-center gap-1.5 cursor-pointer disabled:opacity-50 disabled:cursor-not-allowed",children:[e.jsx(A,{size:14}),s==="zh"?"导出 CSV 成绩表":"Export Grade Sheet"]})]})]})}):null}export{_ as ExportWeightModal};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r,j as e}from"./vendor-react-
|
|
1
|
+
import{r,j as e}from"./vendor-react-DHoBZpn2.js";import{V as b,X as R,n as T,aT as W,k as B}from"./vendor-icons-DaYNfRAc.js";import"./vendor-utils-BxOuk3id.js";function A({isOpen:x,onClose:l,lang:s,onSeedSuccess:z,onJumpTab:N}){const[n,h]=r.useState(0),[v,w]=r.useState(!1),[F,y]=r.useState(null),[k,I]=r.useState(null),[S,p]=r.useState({display:"none"}),[C,m]=r.useState({display:"none"}),L=r.useRef(null),d=[{targetId:"",title:s==="zh"?"欢迎来到 OpenLearn Next V2 平台!":"Welcome to OpenLearn Next V2!",content:s==="zh"?"本平台为数字课堂提供智能白板与教学插件生态托管。下面我们将通过 4 步带您快速完成初始化并体验一堂数字互动课程。":"Welcome! This platform provides interactive whiteboards and educational plugin hosting. Let's set up your first class in 4 quick steps."},{targetId:"nav_btn_admin_directory",title:s==="zh"?"第 1 步:一键初始化示例课程":"Step 1: Initialize Example Class",content:s==="zh"?"在开始授课前,我们需要一个授课班级。请点击下方的按钮,系统将自动在数据库中为您建立示例班级、添加 5 名演示学生(小明、小红等),并自动排定一节今日的白板创意编程示范课!":"Before teaching, we need a classroom session. Click the button below to seed a demo class, add 5 sample students (Xiao Ming, Xiao Hong, etc.), and schedule today's creative programming class!",actionable:!0},{targetId:"navigation_sidebar",title:s==="zh"?"第 2 步:了解系统导航菜单":"Step 2: Tour System Navigation",content:s==="zh"?"初始化成功后,您可以在「系统导航」的「班级管理」中查看学生名册及座位表,或在「课程管理」中编辑白板教案。在「插件中心」中,您还可以安装/停用丰富的第三方小工具。":'After setup, explore the sidebar! Use "Classes & Students" to manage student profiles, "Courses" to edit whiteboards, and "Plugins" to manage tools.'},{targetId:"nav_btn_live_class",title:s==="zh"?"第 3 步:进入互动课堂开启体验":"Step 3: Launch Live Classroom",content:s==="zh"?"一切就绪!点击下方的「一键开课并进入课堂」,系统将为您自动进入示范课堂并展开互动白板。您可以在白板上下发测验、进行实时统计,学生端也将实时接收广播。":'All set! Click "Launch Classroom" to enter the live room. You can draw on the whiteboard, push quizzes, and view live stats, while student clients auto-sync.'}],E=async()=>{w(!0);try{const i=await fetch("/api/admin/seed-demo",{method:"POST"});if(i.ok){const t=await i.json();t.success&&(I({classId:t.classId,className:"人工智能与创意编程示范班"}),z({classId:t.classId,scheduleId:t.scheduleId,lessonId:t.lessonId}),setTimeout(()=>{h(2)},1500))}else{const t=await i.json().catch(()=>({error:"未知错误"}));y(s==="zh"?`初始化失败:${t.error||"请检查服务器日志"}`:`Failed: ${t.error||"Check server logs"}`)}}catch(i){console.error("Failed to seed demo data:",i),y(s==="zh"?`网络错误:${i.message||"请检查服务器是否运行"}`:`Network error: ${i.message||"Check if server is running"}`)}finally{w(!1)}},_=()=>{localStorage.setItem("edu_os_tour_completed","true"),N("live_class"),l()};if(r.useEffect(()=>{if(!x)return;const i=d[n];if(!i||!i.targetId){p({display:"none"}),m({position:"fixed",top:"50%",left:"50%",transform:"translate(-50%, -50%)",zIndex:1e4,width:"420px",maxWidth:"90vw"});return}const t=()=>{const j=document.getElementById(i.targetId);if(!j){p({display:"none"}),m({position:"fixed",top:"50%",left:"50%",transform:"translate(-50%, -50%)",zIndex:1e4,width:"420px",maxWidth:"90vw"});return}const o=j.getBoundingClientRect(),c=6;p({display:"block",position:"fixed",top:`${o.top-c}px`,left:`${o.left-c}px`,width:`${o.width+c*2}px`,height:`${o.height+c*2}px`,boxShadow:"0 0 0 9999px rgba(15, 23, 42, 0.65)",border:"2px dashed #6366f1",borderRadius:"12px",zIndex:9999,pointerEvents:"none",transition:"all 0.25s cubic-bezier(0.4, 0, 0.2, 1)"});const u=360;let f=o.left+o.width+16,g=o.top;f+u>window.innerWidth&&(f=Math.max(16,o.left-u-16)),g+240>window.innerHeight&&(g=Math.max(16,window.innerHeight-250)),m({display:"block",position:"fixed",top:`${g}px`,left:`${f}px`,width:`${u}px`,zIndex:1e4,transition:"all 0.25s cubic-bezier(0.4, 0, 0.2, 1)"})};t(),window.addEventListener("resize",t),window.addEventListener("scroll",t,!0);const $=setInterval(t,300);return()=>{window.removeEventListener("resize",t),window.removeEventListener("scroll",t,!0),clearInterval($)}},[x,n]),!x)return null;const a=d[n];return e.jsxs("div",{className:"fixed inset-0 overflow-hidden select-none",style:{zIndex:9998},children:[a&&!a.targetId&&e.jsx("div",{className:"fixed inset-0 bg-slate-900/65 backdrop-blur-2xs transition-opacity",onClick:l}),e.jsx("div",{style:S}),e.jsxs("div",{ref:L,style:C,className:"bg-white rounded-2xl border border-slate-150/60 shadow-2xl p-5 md:p-6 text-gray-900 font-sans flex flex-col justify-between",children:[e.jsxs("div",{children:[e.jsxs("div",{className:"flex justify-between items-start mb-3",children:[e.jsxs("h3",{className:"font-extrabold text-sm md:text-base text-gray-900 flex items-center gap-1.5 leading-tight",children:[e.jsx(b,{size:16,className:"text-indigo-500 animate-pulse shrink-0"}),a.title]}),e.jsx("button",{onClick:l,className:"text-gray-400 hover:text-gray-600 rounded-lg p-0.5 transition-colors cursor-pointer",children:e.jsx(R,{size:16})})]}),e.jsx("p",{className:"text-xs md:text-sm text-gray-600 leading-relaxed font-medium mb-5 whitespace-pre-wrap",children:a.content}),a.actionable&&e.jsx("div",{className:"bg-slate-50 border border-slate-200/80 rounded-xl p-3.5 mb-5 flex flex-col items-center justify-center",children:k?e.jsxs("div",{className:"flex items-center gap-2 text-emerald-600 text-xs font-bold animate-bounce",children:[e.jsx(T,{size:12,className:"fill-emerald-600"}),s==="zh"?"示范课程与学生名册初始化成功!":"Demo classes successfully initialized!"]}):e.jsx("button",{onClick:E,disabled:v,className:"w-full flex items-center justify-center gap-1.5 py-2.5 px-4 bg-indigo-600 hover:bg-indigo-700 text-white font-bold text-xs md:text-sm rounded-lg hover:shadow-md transition-all cursor-pointer disabled:bg-indigo-400",children:v?e.jsxs("span",{className:"flex items-center gap-1.5",children:[e.jsxs("svg",{className:"animate-spin h-4 w-4 text-white",fill:"none",viewBox:"0 0 24 24",children:[e.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),e.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]}),s==="zh"?"正在创建数据库记录...":"Initializing DB records..."]}):e.jsxs(e.Fragment,{children:[e.jsx(b,{size:14,className:"animate-pulse"}),s==="zh"?"一键初始化示范数据":"Initialize Example Data"]})})})]}),e.jsxs("div",{className:"flex items-center justify-between border-t border-slate-100 pt-4 shrink-0",children:[e.jsx("div",{className:"flex items-center gap-1.5",children:d.map((i,t)=>e.jsx("div",{className:`h-1.5 rounded-full transition-all duration-300 ${t===n?"w-4 bg-indigo-600":"w-1.5 bg-slate-200"}`},t))}),e.jsxs("div",{className:"flex items-center gap-2",children:[n>0?e.jsxs("button",{onClick:()=>h(i=>i-1),className:"flex items-center gap-1 px-3 py-1.5 border border-slate-200 rounded-lg text-xs font-semibold text-slate-600 hover:bg-slate-50 transition-colors cursor-pointer",children:[e.jsx(W,{size:12}),s==="zh"?"上一步":"Back"]}):e.jsx("button",{onClick:l,className:"px-3 py-1.5 border border-slate-200 rounded-lg text-xs font-semibold text-slate-500 hover:bg-slate-50 transition-colors cursor-pointer",children:s==="zh"?"跳过向导":"Skip Tour"}),n<d.length-1?e.jsxs("button",{onClick:()=>h(i=>i+1),className:"flex items-center gap-1 px-3 py-1.5 bg-slate-900 text-white rounded-lg text-xs font-semibold hover:bg-slate-800 transition-colors cursor-pointer",children:[s==="zh"?"下一步":"Next",e.jsx(B,{size:12})]}):e.jsxs("button",{onClick:_,className:"flex items-center gap-1 px-4 py-1.5 bg-indigo-600 hover:bg-indigo-700 text-white rounded-lg text-xs font-bold shadow-sm transition-colors cursor-pointer",children:[s==="zh"?"结束引导并开课":"Launch Classroom",e.jsx(b,{size:12})]})]})]})]})]})}export{A as HelpTour};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import{r as m,j as e}from"./vendor-react-
|
|
2
|
-
这是一个通过命令创建的组件或段落。`:n[r]=d.description||"示例参数"}),JSON.stringify(n,null,2)},te=({registeredCommands:t,onRefresh:n})=>{const[r,d]=m.useState(""),[l,g]=m.useState("all"),[h,w]=m.useState(null),[y,f]=m.useState({}),[A,b]=m.useState({}),k=[{id:"all",name:"全部命令",icon:J},{id:"edu",name:"教学与画板",icon:C},{id:"mgmt",name:"班级与学生",icon:P},{id:"vfs",name:"虚拟文件系统",icon:L},{id:"proc",name:"进程控制",icon:N},{id:"ai",name:"AI 规划生成",icon:B},{id:"plugin",name:"第三方插件",icon:S}],I=m.useMemo(()=>{const s={};for(const a of t)s[a.id]=se(a.inputSchema);return s},[t]),T=s=>y[s]??I[s]??"{}",z=t.filter(s=>{const a=l==="all"||O(s.commandType)===l,i=r===""||s.commandType.toLowerCase().includes(r.toLowerCase())||s.description&&s.description.toLowerCase().includes(r.toLowerCase())||s.id.toLowerCase().includes(r.toLowerCase());return a&&i}),c=async(s,a)=>{b(i=>({...i,[a]:{success:!1,loading:!0}}));try{const i=T(a);let p={};try{p=JSON.parse(i)}catch(x){b(u=>({...u,[a]:{success:!1,error:`JSON 语法解析错误: ${x.message}`,loading:!1}}));return}const o=await fetch("/api/commands/execute",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({commandType:s,payload:p})}),j=await o.json();o.ok&&j.success?(b(x=>({...x,[a]:{success:!0,data:j.result,loading:!1}})),n()):b(x=>({...x,[a]:{success:!1,error:j.error||"执行命令失败",loading:!1}}))}catch(i){b(p=>({...p,[a]:{success:!1,error:i.message,loading:!1}}))}};return e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"p-4 border-b border-gray-100 bg-gray-50/50 flex flex-col gap-4 shrink-0 col-span-1",children:[e.jsxs("div",{className:"relative",children:[e.jsx(N,{className:"absolute left-3.5 top-1/2 -translate-y-1/2 text-gray-400",size:16}),e.jsx("input",{type:"text",placeholder:"通过命令类型、描述或 Action ID 搜索活跃指令...",value:r,onChange:s=>d(s.target.value),className:"w-full pl-10 pr-4 py-2.5 bg-white border border-gray-200 rounded-xl text-sm focus:outline-none focus:ring-2 focus:ring-indigo-500 focus:border-transparent transition-all shadow-sm"})]}),e.jsx("div",{className:"flex flex-wrap gap-2",children:k.map(s=>{const a=s.icon,i=l===s.id;return e.jsxs("button",{onClick:()=>g(s.id),className:`flex items-center gap-1.5 px-3.5 py-1.5 rounded-full text-xs font-semibold transition-all ${i?"bg-indigo-600 text-white shadow shadow-indigo-200 scale-102 font-bold":"bg-white text-gray-600 hover:text-gray-900 border border-gray-200 hover:border-gray-300"}`,children:[e.jsx(a,{size:13}),e.jsx("span",{children:s.name}),s.id==="all"?e.jsx("span",{className:`ml-1 text-xs px-1.5 py-0.2 rounded-full ${i?"bg-indigo-700/80 text-white":"bg-gray-100 text-gray-500"}`,children:t.length}):null]},s.id)})})]}),e.jsx("div",{className:"flex-1 overflow-y-auto p-6 bg-gray-50/30",children:z.length===0?e.jsxs("div",{className:"flex flex-col items-center justify-center p-12 text-gray-400",children:[e.jsx(q,{size:48,className:"text-gray-300 mb-4 animate-pulse"}),e.jsx("h3",{className:"font-semibold text-gray-700",children:"没有找到匹配的指令"}),e.jsx("p",{className:"text-xs text-gray-500 mt-1",children:"请尝试清空查询条件或检查当前的插件状态"})]}):e.jsx("div",{"data-testid":"command-grid",role:"list",className:"grid grid-cols-1 md:grid-cols-2 xl:grid-cols-3 gap-4 max-w-[1600px] mx-auto",children:z.map(s=>{const a=h===s.id,i=O(s.commandType),p=s.isHighRisk,o=A[s.id],j=`command-panel-${s.id}`;return e.jsxs("div",{role:"listitem","data-testid":`command-card-${s.id}`,"data-expanded":a?"true":"false",className:`flex flex-col bg-white rounded-xl border transition-all duration-200 overflow-hidden shadow-sm hover:shadow ${a?"col-span-full":""} ${a?"border-indigo-400 ring-1 ring-indigo-100":p?"border-orange-200 hover:border-orange-300":"border-gray-200 hover:border-indigo-200"}`,children:[e.jsxs("button",{type:"button",onClick:()=>{w(a?null:s.id)},"aria-expanded":a,"aria-controls":j,className:`w-full flex-1 text-left p-4 flex flex-col gap-2.5 cursor-pointer hover:bg-gray-50/30 transition-colors select-none focus:outline-none focus-visible:ring-2 focus-visible:ring-indigo-500 focus-visible:ring-inset rounded-xl ${a?"bg-indigo-50/40":""}`,children:[e.jsxs("div",{className:"flex items-start gap-2.5 min-w-0",children:[e.jsx("div",{className:`p-2 rounded-lg shrink-0 ${p?"bg-orange-50 text-orange-600":"bg-indigo-50 text-indigo-600"}`,children:i==="vfs"?e.jsx(L,{size:18}):i==="edu"?e.jsx(C,{size:18}):i==="mgmt"?e.jsx(P,{size:18}):i==="proc"?e.jsx(N,{size:18}):i==="ai"?e.jsx(B,{size:18}):e.jsx(S,{size:18})}),e.jsx("span",{className:"font-mono font-bold text-sm bg-gray-100 text-gray-800 px-2 py-0.5 rounded border border-gray-200 min-w-0 break-all",children:s.commandType})]}),e.jsxs("div",{className:"flex flex-wrap items-center gap-1.5",children:[p&&e.jsx("span",{className:"text-xs bg-red-100 text-red-700 border border-red-200 rounded font-extrabold px-1.5 py-0.5 uppercase tracking-wide flex items-center gap-0.5",children:"⚠️ 高风险操作"}),e.jsxs("span",{className:"text-xs bg-indigo-50 text-indigo-700 border border-indigo-100 rounded-full px-2 py-0.5 max-w-full truncate",children:["🔒 ",s.capabilityRequired||"无公开权限"]})]}),e.jsx("p",{className:"text-gray-600 text-xs font-medium line-clamp-2 min-h-[2rem]",children:s.description||"(该命令没有描述)"}),e.jsxs("div",{className:"mt-auto flex items-center justify-between gap-2 pt-1",children:[e.jsxs("span",{className:"text-xs text-subtle font-mono truncate min-w-0",title:`ID: ${s.id}`,children:["ID: ",s.id]}),e.jsxs("span",{className:`text-xs px-3 py-1 rounded-lg font-semibold border transition-all flex items-center gap-1 shrink-0 ${a?"bg-indigo-50 border-indigo-200 text-indigo-700":"bg-gray-100 text-gray-700 border-gray-200"}`,children:[a?"折叠面板":"交互调试 Shell",e.jsx(G,{size:12,className:`transform transition-transform ${a?"rotate-90":""}`})]})]})]}),a&&e.jsxs("div",{id:j,className:"border-t border-gray-100 bg-gray-50/50 p-5 space-y-4",children:[e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[e.jsxs("div",{className:"bg-white rounded-lg border border-gray-200 p-4",children:[e.jsxs("h4",{className:"text-xs font-bold text-gray-700 uppercase tracking-widest mb-3 flex items-center gap-1.5 border-b border-gray-100 pb-2",children:[e.jsx(F,{size:12,className:"text-gray-400"}),"入参规范 (JSON Schema Definition)"]}),s.inputSchema?.properties?e.jsx("div",{className:"space-y-3 font-mono text-xs",children:Object.keys(s.inputSchema.properties).map(x=>{const u=s.inputSchema.properties[x],R=s.inputSchema.required?.includes(x);return e.jsxs("div",{className:"flex flex-col gap-1 border-b border-gray-50 last:border-b-0 pb-1.5",children:[e.jsxs("div",{className:"flex items-baseline gap-1.5",children:[e.jsx("span",{className:"text-indigo-600 font-semibold",children:x}),e.jsxs("span",{className:"text-subtle text-xs",children:["(",u.type,")"]}),R&&e.jsx("span",{className:"text-red-700 text-xs font-bold bg-red-50 border border-red-200 rounded px-1",children:"REQUIRED"})]}),u.description&&e.jsx("span",{className:"text-gray-500 font-sans leading-relaxed text-xs",children:u.description})]},x)})}):e.jsx("p",{className:"text-xs text-gray-400 italic",children:"该命令不需要接收任何入参负载 (Payload)。"})]}),e.jsxs("div",{className:"bg-white rounded-lg border border-gray-200 p-4 flex flex-col",children:[e.jsxs("h4",{className:"text-xs font-bold text-gray-700 uppercase tracking-widest mb-3 flex items-center gap-1.5 border-b border-gray-100 pb-2 justify-between",children:[e.jsxs("span",{className:"flex items-center gap-1.5",children:[e.jsx(N,{size:12,className:"text-gray-400"}),"Payload 调试区"]}),e.jsx("button",{onClick:()=>{f(x=>({...x,[s.id]:I[s.id]??"{}"}))},className:"text-xs text-indigo-600 hover:underline hover:text-indigo-800 uppercase tracking-wider",children:"恢复默认模版"})]}),e.jsx("label",{htmlFor:`command-payload-${s.id}`,className:"text-xs font-semibold text-subtle block mb-1",children:"Payload JSON:"}),e.jsx("textarea",{id:`command-payload-${s.id}`,value:T(s.id),onChange:x=>{const u=x.target.value;f(R=>({...R,[s.id]:u}))},rows:6,className:"w-full font-mono text-xs p-2.5 bg-gray-900 text-indigo-300 border border-gray-800 rounded-lg focus:ring-2 focus:ring-indigo-500 focus:outline-none resize-none leading-relaxed flex-1 shadow-inner"}),e.jsx("div",{className:"mt-3 flex justify-end",children:e.jsx("button",{onClick:()=>c(s.commandType,s.id),disabled:o?.loading,className:`px-4 py-2 text-xs font-bold font-sans text-white hover:shadow-md active:scale-95 transition-all flex items-center gap-1.5 rounded-lg ${p?"bg-red-600 hover:bg-red-700":"bg-indigo-600 hover:bg-indigo-700 focus:ring-2 focus:ring-indigo-500"} disabled:opacity-50`,children:o?.loading?e.jsxs(e.Fragment,{children:[e.jsx(D,{size:13,className:"animate-spin"}),e.jsx("span",{children:"内核正在调度总线..."})]}):e.jsxs(e.Fragment,{children:[e.jsx(M,{size:13}),e.jsx("span",{children:"提交执行指令 (Deploy Command)"})]})})})]})]}),o&&e.jsxs("div",{className:`p-4 rounded-xl border flex flex-col font-mono text-xs leading-relaxed relative ${o.loading?"bg-gray-50 border-gray-200":o.success?"bg-green-50/50 border-green-200 text-green-900":"bg-red-50/50 border-red-200 text-red-900"}`,children:[e.jsx("div",{className:"absolute top-2 right-3 uppercase text-xs font-bold text-gray-400",children:"Console Output log"}),e.jsx("div",{className:"font-bold flex items-center gap-1.5 mb-1 bg-transparent border-0 p-0 text-xs text-neutral-800",children:o.loading?e.jsx("span",{className:"text-gray-500",children:"⏳ COMMAND QUEUED..."}):o.success?e.jsxs("span",{className:"text-green-700 flex items-center gap-1",children:[e.jsx(Q,{size:14})," STATUS: 200 SUCCESS (Action Completed)"]}):e.jsxs("span",{className:"text-red-700 flex items-center gap-1",children:[e.jsx(V,{size:14})," STATUS: 500 INTERNAL_BUS_ERROR"]})}),!o.loading&&e.jsx("pre",{className:"mt-2 p-3 bg-gray-900/95 text-gray-200 rounded-lg overflow-x-auto border border-gray-800 shadow-inner max-h-56 select-all font-mono",children:o.success?JSON.stringify(o.data,null,2):o.error})]})]})]},s.id)})})})]})},re=({pluginGuideMd:t,loadingMd:n,copiedId:r,handleCopy:d,pluginBoilerplateCode:l,pluginInteractiveCode:g,pluginExamCode:h})=>e.jsx("div",{className:"flex-1 overflow-y-auto p-6 bg-slate-50/50",children:e.jsxs("div",{className:"max-w-5xl mx-auto space-y-6",children:[n?e.jsxs("div",{className:"flex flex-col items-center justify-center p-12 bg-white rounded-2xl border border-gray-200",children:[e.jsx(D,{size:32,className:"animate-spin text-indigo-600 mb-2"}),e.jsx("span",{className:"text-xs text-gray-500 font-semibold",children:"正在从服务器拉取 SDK 文档..."})]}):t?e.jsx("div",{className:"bg-white rounded-2xl border border-gray-200 p-8 shadow-sm prose prose-slate max-w-none text-xs leading-relaxed",children:e.jsx($,{children:t})}):null,e.jsxs("div",{className:"bg-white rounded-2xl border border-indigo-100 p-6 shadow-sm flex flex-col md:flex-row gap-5 items-start",children:[e.jsx("div",{className:"p-4 bg-indigo-50 text-indigo-600 rounded-2xl shrink-0",children:e.jsx(S,{size:28})}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("h3",{className:"text-base font-bold text-gray-900",children:"Openlearn Next 插件开发指南 & API 参考"}),e.jsxs("p",{className:"text-xs text-gray-600 leading-relaxed",children:["Openlearn Next 基于 ",e.jsx("span",{className:"font-semibold text-indigo-600",children:"CommandBus(命令总线)"})," +"," ",e.jsx("span",{className:"font-semibold text-indigo-600",children:"EventBus(事件总线)"})," 微内核架构。 插件通过标准 ESM 模块导出 ",e.jsx("code",{className:"bg-gray-100 text-rose-600 px-1 rounded text-xs",children:"activate(ctx)"})," 函数接收"," ",e.jsx("span",{className:"font-semibold",children:"PluginContext"}),", 进而访问 7 大内核服务。本页提供完整的 API 参考、参数说明和可运行示例。"]}),e.jsxs("div",{className:"flex flex-wrap gap-2 pt-1",children:[e.jsx("span",{className:"text-xs bg-indigo-50 text-indigo-700 border border-indigo-100 px-2 py-0.5 rounded-full font-medium",children:"🔄 DI 依赖注入"}),e.jsx("span",{className:"text-xs bg-emerald-50 text-emerald-700 border border-emerald-100 px-2 py-0.5 rounded-full font-medium",children:"🔒 能力安全模型"}),e.jsx("span",{className:"text-xs bg-amber-50 text-amber-700 border border-amber-100 px-2 py-0.5 rounded-full font-medium",children:"⚡ 热重载 + Worker 隔离"}),e.jsx("span",{className:"text-xs bg-rose-50 text-rose-700 border border-rose-100 px-2 py-0.5 rounded-full font-medium",children:"📦 ESM + CommonJS 双格式"}),e.jsx("span",{className:"text-xs bg-sky-50 text-sky-700 border border-sky-100 px-2 py-0.5 rounded-full font-medium",children:"🆔 别名生命周期 (Alias Lifecycle)"}),e.jsx("span",{className:"text-xs bg-teal-50 text-teal-700 border border-teal-100 px-2 py-0.5 rounded-full font-medium",children:"🛡️ Worker Storage 安全隔离"})]})]})]}),e.jsxs("div",{className:"bg-white rounded-2xl border border-gray-200 overflow-hidden shadow-sm",children:[e.jsxs("div",{className:"px-5 py-4 bg-gray-50 border-b border-gray-100 flex flex-col sm:flex-row sm:items-center justify-between gap-2",children:[e.jsxs("div",{className:"flex items-start gap-2",children:[e.jsx("div",{className:"p-1.5 bg-indigo-50 text-indigo-600 rounded",children:e.jsx(_,{size:16})}),e.jsxs("div",{children:[e.jsx("h4",{className:"text-xs font-bold text-gray-900",children:"示例 1:思维导图插件 — 注册 Action + 处理器 + 发布事件"}),e.jsx("p",{className:"text-xs text-gray-500 mt-0.5",children:"演示 ctx.services 解构、Action 注册、createCommand 创建信封、eventBus.publish 发布事件"})]})]}),e.jsxs("button",{onClick:()=>d("tpl1",l),className:`px-3 py-1.5 rounded-lg text-xs font-semibold flex items-center gap-1.5 transition-all shadow-sm shrink-0 ${r==="tpl1"?"bg-emerald-50 text-emerald-700 border border-emerald-250":"bg-white text-indigo-600 border border-indigo-150 hover:bg-indigo-50"}`,children:[r==="tpl1"?e.jsx(E,{size:12}):e.jsx(v,{size:12}),e.jsx("span",{children:r==="tpl1"?"已复制!":"复制代码"})]})]}),e.jsx("pre",{className:"text-xs font-mono p-5 bg-gray-950 text-gray-200 overflow-x-auto leading-relaxed max-h-[360px] shadow-inner select-all",children:l})]}),e.jsxs("div",{className:"bg-white rounded-2xl border border-gray-200 overflow-hidden shadow-sm",children:[e.jsxs("div",{className:"px-5 py-4 bg-gray-50 border-b border-gray-100 flex flex-col sm:flex-row sm:items-center justify-between gap-2",children:[e.jsxs("div",{className:"flex items-start gap-2",children:[e.jsx("div",{className:"p-1.5 bg-emerald-50 text-emerald-600 rounded",children:e.jsx(_,{size:16})}),e.jsxs("div",{children:[e.jsx("h4",{className:"text-xs font-bold text-gray-900",children:"示例 2:AI 作业批改插件 — 演示 AI + 事件订阅 + 存储 + DI"}),e.jsx("p",{className:"text-xs text-gray-500 mt-0.5",children:"演示 ctx.resolve 获取数据库、services.ai 生成文本、services.storage 持久化、eventBus 订阅"})]})]}),e.jsxs("button",{onClick:()=>d("tpl2",g),className:`px-3 py-1.5 rounded-lg text-xs font-semibold flex items-center gap-1.5 transition-all shadow-sm shrink-0 ${r==="tpl2"?"bg-emerald-50 text-emerald-700 border border-emerald-250":"bg-white text-emerald-600 border border-emerald-150 hover:bg-emerald-50"}`,children:[r==="tpl2"?e.jsx(E,{size:12}):e.jsx(v,{size:12}),e.jsx("span",{children:r==="tpl2"?"已复制!":"复制代码"})]})]}),e.jsx("pre",{className:"text-xs font-mono p-5 bg-gray-950 text-gray-200 overflow-x-auto leading-relaxed max-h-[360px] shadow-inner select-all",children:g})]}),e.jsxs("div",{className:"bg-white rounded-2xl border border-gray-200 overflow-hidden shadow-sm",children:[e.jsxs("div",{className:"px-5 py-4 bg-gray-50 border-b border-gray-100 flex flex-col sm:flex-row sm:items-center justify-between gap-2",children:[e.jsxs("div",{className:"flex items-start gap-2",children:[e.jsx("div",{className:"p-1.5 bg-amber-50 text-amber-600 rounded",children:e.jsx(_,{size:16})}),e.jsxs("div",{children:[e.jsx("h4",{className:"text-xs font-bold text-gray-900",children:"示例 3:考试系统插件 — 演示 ctx.db 自建表 + deactivate 清理"}),e.jsx("p",{className:"text-xs text-gray-500 mt-0.5",children:"演示 ctx.db.ensureTable 建表、ctx.db.table 获取带前缀表名、deactivate 生命周期"})]})]}),e.jsxs("button",{onClick:()=>d("tpl3",h),className:`px-3 py-1.5 rounded-lg text-xs font-semibold flex items-center gap-1.5 transition-all shadow-sm shrink-0 ${r==="tpl3"?"bg-emerald-50 text-emerald-700 border border-emerald-250":"bg-white text-amber-600 border border-amber-150 hover:bg-amber-50"}`,children:[r==="tpl3"?e.jsx(E,{size:12}):e.jsx(v,{size:12}),e.jsx("span",{children:r==="tpl3"?"已复制!":"复制代码"})]})]}),e.jsx("pre",{className:"text-xs font-mono p-5 bg-gray-950 text-gray-200 overflow-x-auto leading-relaxed max-h-[360px] shadow-inner select-all",children:h})]})]})}),ae=({copiedId:t,handleCopy:n})=>e.jsx("div",{className:"flex-1 overflow-y-auto p-6 bg-slate-50/50",children:e.jsxs("div",{className:"max-w-5xl mx-auto space-y-8",children:[e.jsxs("div",{className:"bg-gradient-to-r from-indigo-900 to-indigo-950 rounded-2xl p-6 text-white shadow-md flex flex-col md:flex-row gap-5 items-start",children:[e.jsx("div",{className:"p-4 bg-indigo-500/20 text-indigo-300 border border-indigo-500/30 rounded-2xl shrink-0",children:e.jsx(C,{size:32})}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs("h3",{className:"text-lg font-bold text-white flex items-center gap-2",children:["Openlearn Next 核心系统主要特性使用教程",e.jsx("span",{className:"text-xs bg-indigo-500/30 text-indigo-200 border border-indigo-500/50 px-2 py-0.5 rounded-full font-normal",children:"v2.1.0 LTS"})]}),e.jsx("p",{className:"text-xs text-indigo-200 leading-relaxed",children:"本指南为教育实验操作系统 (Openlearn Next) 的深度使用手册。详细阐述如何使用内核指令管理班级与学生、基于大纲结构化推进课件时间轴、在互动白板中动态注入脑图和测验元素、启动全屏锁定与签到的教学控制流,以及编写并集成支持 AI 成绩回传的 HTML Applet 实验组件。"}),e.jsxs("div",{className:"flex flex-wrap gap-2 pt-1",children:[e.jsx("span",{className:"text-xs bg-indigo-800/40 text-indigo-150 border border-indigo-700/50 px-2 py-0.5 rounded-full font-medium",children:"🏫 班级与学生指令集"}),e.jsx("span",{className:"text-xs bg-emerald-800/40 text-emerald-150 border border-emerald-700/50 px-2 py-0.5 rounded-full font-medium",children:"📋 课程大纲时间轴同步"}),e.jsx("span",{className:"text-xs bg-amber-800/40 text-amber-150 border border-amber-700/50 px-2 py-0.5 rounded-full font-medium",children:"🎨 协作白板指令渲染"}),e.jsx("span",{className:"text-xs bg-sky-800/40 text-sky-150 border border-sky-700/50 px-2 py-0.5 rounded-full font-medium",children:"🚀 postMessage 成绩监听"})]})]})]}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[e.jsxs("div",{className:"bg-white rounded-2xl border border-gray-200 shadow-sm p-6 space-y-4 hover:shadow-md transition-all flex flex-col justify-between",children:[e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-3 border-b border-gray-100 pb-3 text-indigo-600 font-bold",children:[e.jsx("div",{className:"p-2 bg-indigo-50 rounded-xl",children:e.jsx(P,{size:20})}),e.jsxs("div",{children:[e.jsx("h4",{className:"text-sm text-gray-900",children:"1. 使用核心指令管理班级与学生"}),e.jsx("p",{className:"text-xs text-gray-400 font-normal mt-0.5",children:"Administrative CLI & Capability Model"})]})]}),e.jsxs("p",{className:"text-xs text-gray-600 leading-relaxed mt-3",children:["Openlearn Next 采用权限隔离的",e.jsx("strong",{children:"能力安全模型 (Capability Model)"}),"。任何行政、学籍以及课表排期修改,底层最终都会被封装为非对称的内核指令,经由分布式指令总线进行安全校验与事务落库。"]}),e.jsxs("div",{className:"p-3 bg-indigo-50/50 rounded-xl border border-indigo-100 text-xs text-indigo-900 space-y-1.5 mt-3",children:[e.jsx("span",{className:"font-bold block",children:"🔒 核心访问权限声明 (RBAC Capabilities):"}),e.jsxs("ul",{className:"list-disc list-inside space-y-1 text-gray-600 text-xs",children:[e.jsxs("li",{children:[e.jsx("code",{className:"bg-white/80 px-1 rounded border border-indigo-150",children:"class:write"}),":允许创建/删除行政班级。"]}),e.jsxs("li",{children:[e.jsx("code",{className:"bg-white/80 px-1 rounded border border-indigo-150",children:"student:write"}),":允许注册学生、修改学籍或修改设备锁定状态。"]}),e.jsxs("li",{children:[e.jsx("code",{className:"bg-white/80 px-1 rounded border border-indigo-150",children:"schedule:write"}),":允许编排课程,或临时将某一日期的课程替换为星期几的常规课表。"]})]})]})]}),e.jsxs("div",{className:"space-y-3 font-mono text-xs mt-4",children:[e.jsxs("div",{className:"bg-gray-50 rounded-xl p-3 border border-gray-150 relative",children:[e.jsxs("div",{className:"flex justify-between items-center mb-1",children:[e.jsx("span",{className:"text-indigo-600 font-bold",children:"A. 创建班级 (class.create)"}),e.jsx("button",{onClick:()=>n("guide_cmd_class",`{
|
|
1
|
+
import{r as m,j as e}from"./vendor-react-DHoBZpn2.js";import{M as $,E as W,c as U,e as H}from"./index-BiHQqzdm.js";import{av as N,ba as J,B as C,U as P,aY as L,au as B,P as S,b as q,k as G,u as V,c as D,f as M,h as F,X as Q,b_ as _,ad as E,D as v,ap as Y,V as K,aQ as X,ar as Z,e as ee}from"./vendor-icons-DaYNfRAc.js";import"./vendor-utils-BxOuk3id.js";import"./vendor-pdf-DVWGghIL.js";import"./vendor-motion-BFAPOs-b.js";import"./vendor-charts-skggaP9D.js";const O=t=>t.startsWith("vfs.")?"vfs":t.startsWith("lesson.")||t.startsWith("whiteboard.")?"edu":t.startsWith("class.")||t.startsWith("student.")||t.startsWith("assignment.")||t.startsWith("attendance.")||t.startsWith("schedule.")?"mgmt":t.startsWith("process.")?"proc":t.startsWith("ai.")?"ai":"plugin",se=t=>{if(!t||t.type!=="OBJECT")return"{}";const n={};return t.properties&&Object.keys(t.properties).forEach(r=>{const d=t.properties[r];d.type==="ARRAY"?n[r]=d.items?.type==="STRING"?["选项 A","选项 B","选项 C"]:[]:d.type==="INTEGER"||d.type==="NUMBER"?n[r]=100:d.type==="BOOLEAN"?n[r]=!0:r.toLowerCase().includes("id")?n[r]="auto-id-or-current":r.toLowerCase().includes("name")?n[r]="测试名称":r.toLowerCase().includes("content")?n[r]=`# 初始内容
|
|
2
|
+
这是一个通过命令创建的组件或段落。`:n[r]=d.description||"示例参数"}),JSON.stringify(n,null,2)},te=({registeredCommands:t,onRefresh:n})=>{const[r,d]=m.useState(""),[l,g]=m.useState("all"),[h,w]=m.useState(null),[y,f]=m.useState({}),[A,b]=m.useState({}),k=[{id:"all",name:"全部命令",icon:J},{id:"edu",name:"教学与画板",icon:C},{id:"mgmt",name:"班级与学生",icon:P},{id:"vfs",name:"虚拟文件系统",icon:L},{id:"proc",name:"进程控制",icon:N},{id:"ai",name:"AI 规划生成",icon:B},{id:"plugin",name:"第三方插件",icon:S}],I=m.useMemo(()=>{const s={};for(const a of t)s[a.id]=se(a.inputSchema);return s},[t]),T=s=>y[s]??I[s]??"{}",z=t.filter(s=>{const a=l==="all"||O(s.commandType)===l,i=r===""||s.commandType.toLowerCase().includes(r.toLowerCase())||s.description&&s.description.toLowerCase().includes(r.toLowerCase())||s.id.toLowerCase().includes(r.toLowerCase());return a&&i}),c=async(s,a)=>{b(i=>({...i,[a]:{success:!1,loading:!0}}));try{const i=T(a);let p={};try{p=JSON.parse(i)}catch(x){b(u=>({...u,[a]:{success:!1,error:`JSON 语法解析错误: ${x.message}`,loading:!1}}));return}const o=await fetch("/api/commands/execute",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({commandType:s,payload:p})}),j=await o.json();o.ok&&j.success?(b(x=>({...x,[a]:{success:!0,data:j.result,loading:!1}})),n()):b(x=>({...x,[a]:{success:!1,error:j.error||"执行命令失败",loading:!1}}))}catch(i){b(p=>({...p,[a]:{success:!1,error:i.message,loading:!1}}))}};return e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"p-4 border-b border-gray-100 bg-gray-50/50 flex flex-col gap-4 shrink-0 col-span-1",children:[e.jsxs("div",{className:"relative",children:[e.jsx(N,{className:"absolute left-3.5 top-1/2 -translate-y-1/2 text-gray-400",size:16}),e.jsx("input",{type:"text",placeholder:"通过命令类型、描述或 Action ID 搜索活跃指令...",value:r,onChange:s=>d(s.target.value),className:"w-full pl-10 pr-4 py-2.5 bg-white border border-gray-200 rounded-xl text-sm focus:outline-none focus:ring-2 focus:ring-indigo-500 focus:border-transparent transition-all shadow-sm"})]}),e.jsx("div",{className:"flex flex-wrap gap-2",children:k.map(s=>{const a=s.icon,i=l===s.id;return e.jsxs("button",{onClick:()=>g(s.id),className:`flex items-center gap-1.5 px-3.5 py-1.5 rounded-full text-xs font-semibold transition-all ${i?"bg-indigo-600 text-white shadow shadow-indigo-200 scale-102 font-bold":"bg-white text-gray-600 hover:text-gray-900 border border-gray-200 hover:border-gray-300"}`,children:[e.jsx(a,{size:13}),e.jsx("span",{children:s.name}),s.id==="all"?e.jsx("span",{className:`ml-1 text-xs px-1.5 py-0.2 rounded-full ${i?"bg-indigo-700/80 text-white":"bg-gray-100 text-gray-500"}`,children:t.length}):null]},s.id)})})]}),e.jsx("div",{className:"flex-1 overflow-y-auto p-6 bg-gray-50/30",children:z.length===0?e.jsxs("div",{className:"flex flex-col items-center justify-center p-12 text-gray-400",children:[e.jsx(q,{size:48,className:"text-gray-300 mb-4 animate-pulse"}),e.jsx("h3",{className:"font-semibold text-gray-700",children:"没有找到匹配的指令"}),e.jsx("p",{className:"text-xs text-gray-500 mt-1",children:"请尝试清空查询条件或检查当前的插件状态"})]}):e.jsx("div",{"data-testid":"command-grid",role:"list",className:"grid grid-cols-1 md:grid-cols-2 xl:grid-cols-3 gap-4 max-w-[1600px] mx-auto",children:z.map(s=>{const a=h===s.id,i=O(s.commandType),p=s.isHighRisk,o=A[s.id],j=`command-panel-${s.id}`;return e.jsxs("div",{role:"listitem","data-testid":`command-card-${s.id}`,"data-expanded":a?"true":"false",className:`flex flex-col bg-white rounded-xl border transition-all duration-200 overflow-hidden shadow-sm hover:shadow ${a?"col-span-full":""} ${a?"border-indigo-400 ring-1 ring-indigo-100":p?"border-orange-200 hover:border-orange-300":"border-gray-200 hover:border-indigo-200"}`,children:[e.jsxs("button",{type:"button",onClick:()=>{w(a?null:s.id)},"aria-expanded":a,"aria-controls":j,className:`w-full flex-1 text-left p-4 flex flex-col gap-2.5 cursor-pointer hover:bg-gray-50/30 transition-colors select-none focus:outline-none focus-visible:ring-2 focus-visible:ring-indigo-500 focus-visible:ring-inset rounded-xl ${a?"bg-indigo-50/40":""}`,children:[e.jsxs("div",{className:"flex items-start gap-2.5 min-w-0",children:[e.jsx("div",{className:`p-2 rounded-lg shrink-0 ${p?"bg-orange-50 text-orange-600":"bg-indigo-50 text-indigo-600"}`,children:i==="vfs"?e.jsx(L,{size:18}):i==="edu"?e.jsx(C,{size:18}):i==="mgmt"?e.jsx(P,{size:18}):i==="proc"?e.jsx(N,{size:18}):i==="ai"?e.jsx(B,{size:18}):e.jsx(S,{size:18})}),e.jsx("span",{className:"font-mono font-bold text-sm bg-gray-100 text-gray-800 px-2 py-0.5 rounded border border-gray-200 min-w-0 break-all",children:s.commandType})]}),e.jsxs("div",{className:"flex flex-wrap items-center gap-1.5",children:[p&&e.jsx("span",{className:"text-xs bg-red-100 text-red-700 border border-red-200 rounded font-extrabold px-1.5 py-0.5 uppercase tracking-wide flex items-center gap-0.5",children:"⚠️ 高风险操作"}),e.jsxs("span",{className:"text-xs bg-indigo-50 text-indigo-700 border border-indigo-100 rounded-full px-2 py-0.5 max-w-full truncate",children:["🔒 ",s.capabilityRequired||"无公开权限"]})]}),e.jsx("p",{className:"text-gray-600 text-xs font-medium line-clamp-2 min-h-[2rem]",children:s.description||"(该命令没有描述)"}),e.jsxs("div",{className:"mt-auto flex items-center justify-between gap-2 pt-1",children:[e.jsxs("span",{className:"text-xs text-subtle font-mono truncate min-w-0",title:`ID: ${s.id}`,children:["ID: ",s.id]}),e.jsxs("span",{className:`text-xs px-3 py-1 rounded-lg font-semibold border transition-all flex items-center gap-1 shrink-0 ${a?"bg-indigo-50 border-indigo-200 text-indigo-700":"bg-gray-100 text-gray-700 border-gray-200"}`,children:[a?"折叠面板":"交互调试 Shell",e.jsx(G,{size:12,className:`transform transition-transform ${a?"rotate-90":""}`})]})]})]}),a&&e.jsxs("div",{id:j,className:"border-t border-gray-100 bg-gray-50/50 p-5 space-y-4",children:[e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[e.jsxs("div",{className:"bg-white rounded-lg border border-gray-200 p-4",children:[e.jsxs("h4",{className:"text-xs font-bold text-gray-700 uppercase tracking-widest mb-3 flex items-center gap-1.5 border-b border-gray-100 pb-2",children:[e.jsx(V,{size:12,className:"text-gray-400"}),"入参规范 (JSON Schema Definition)"]}),s.inputSchema?.properties?e.jsx("div",{className:"space-y-3 font-mono text-xs",children:Object.keys(s.inputSchema.properties).map(x=>{const u=s.inputSchema.properties[x],R=s.inputSchema.required?.includes(x);return e.jsxs("div",{className:"flex flex-col gap-1 border-b border-gray-50 last:border-b-0 pb-1.5",children:[e.jsxs("div",{className:"flex items-baseline gap-1.5",children:[e.jsx("span",{className:"text-indigo-600 font-semibold",children:x}),e.jsxs("span",{className:"text-subtle text-xs",children:["(",u.type,")"]}),R&&e.jsx("span",{className:"text-red-700 text-xs font-bold bg-red-50 border border-red-200 rounded px-1",children:"REQUIRED"})]}),u.description&&e.jsx("span",{className:"text-gray-500 font-sans leading-relaxed text-xs",children:u.description})]},x)})}):e.jsx("p",{className:"text-xs text-gray-400 italic",children:"该命令不需要接收任何入参负载 (Payload)。"})]}),e.jsxs("div",{className:"bg-white rounded-lg border border-gray-200 p-4 flex flex-col",children:[e.jsxs("h4",{className:"text-xs font-bold text-gray-700 uppercase tracking-widest mb-3 flex items-center gap-1.5 border-b border-gray-100 pb-2 justify-between",children:[e.jsxs("span",{className:"flex items-center gap-1.5",children:[e.jsx(N,{size:12,className:"text-gray-400"}),"Payload 调试区"]}),e.jsx("button",{onClick:()=>{f(x=>({...x,[s.id]:I[s.id]??"{}"}))},className:"text-xs text-indigo-600 hover:underline hover:text-indigo-800 uppercase tracking-wider",children:"恢复默认模版"})]}),e.jsx("label",{htmlFor:`command-payload-${s.id}`,className:"text-xs font-semibold text-subtle block mb-1",children:"Payload JSON:"}),e.jsx("textarea",{id:`command-payload-${s.id}`,value:T(s.id),onChange:x=>{const u=x.target.value;f(R=>({...R,[s.id]:u}))},rows:6,className:"w-full font-mono text-xs p-2.5 bg-gray-900 text-indigo-300 border border-gray-800 rounded-lg focus:ring-2 focus:ring-indigo-500 focus:outline-none resize-none leading-relaxed flex-1 shadow-inner"}),e.jsx("div",{className:"mt-3 flex justify-end",children:e.jsx("button",{onClick:()=>c(s.commandType,s.id),disabled:o?.loading,className:`px-4 py-2 text-xs font-bold font-sans text-white hover:shadow-md active:scale-95 transition-all flex items-center gap-1.5 rounded-lg ${p?"bg-red-600 hover:bg-red-700":"bg-indigo-600 hover:bg-indigo-700 focus:ring-2 focus:ring-indigo-500"} disabled:opacity-50`,children:o?.loading?e.jsxs(e.Fragment,{children:[e.jsx(D,{size:13,className:"animate-spin"}),e.jsx("span",{children:"内核正在调度总线..."})]}):e.jsxs(e.Fragment,{children:[e.jsx(M,{size:13}),e.jsx("span",{children:"提交执行指令 (Deploy Command)"})]})})})]})]}),o&&e.jsxs("div",{className:`p-4 rounded-xl border flex flex-col font-mono text-xs leading-relaxed relative ${o.loading?"bg-gray-50 border-gray-200":o.success?"bg-green-50/50 border-green-200 text-green-900":"bg-red-50/50 border-red-200 text-red-900"}`,children:[e.jsx("div",{className:"absolute top-2 right-3 uppercase text-xs font-bold text-gray-400",children:"Console Output log"}),e.jsx("div",{className:"font-bold flex items-center gap-1.5 mb-1 bg-transparent border-0 p-0 text-xs text-neutral-800",children:o.loading?e.jsx("span",{className:"text-gray-500",children:"⏳ COMMAND QUEUED..."}):o.success?e.jsxs("span",{className:"text-green-700 flex items-center gap-1",children:[e.jsx(F,{size:14})," STATUS: 200 SUCCESS (Action Completed)"]}):e.jsxs("span",{className:"text-red-700 flex items-center gap-1",children:[e.jsx(Q,{size:14})," STATUS: 500 INTERNAL_BUS_ERROR"]})}),!o.loading&&e.jsx("pre",{className:"mt-2 p-3 bg-gray-900/95 text-gray-200 rounded-lg overflow-x-auto border border-gray-800 shadow-inner max-h-56 select-all font-mono",children:o.success?JSON.stringify(o.data,null,2):o.error})]})]})]},s.id)})})})]})},re=({pluginGuideMd:t,loadingMd:n,copiedId:r,handleCopy:d,pluginBoilerplateCode:l,pluginInteractiveCode:g,pluginExamCode:h})=>e.jsx("div",{className:"flex-1 overflow-y-auto p-6 bg-slate-50/50",children:e.jsxs("div",{className:"max-w-5xl mx-auto space-y-6",children:[n?e.jsxs("div",{className:"flex flex-col items-center justify-center p-12 bg-white rounded-2xl border border-gray-200",children:[e.jsx(D,{size:32,className:"animate-spin text-indigo-600 mb-2"}),e.jsx("span",{className:"text-xs text-gray-500 font-semibold",children:"正在从服务器拉取 SDK 文档..."})]}):t?e.jsx("div",{className:"bg-white rounded-2xl border border-gray-200 p-8 shadow-sm prose prose-slate max-w-none text-xs leading-relaxed",children:e.jsx($,{children:t})}):null,e.jsxs("div",{className:"bg-white rounded-2xl border border-indigo-100 p-6 shadow-sm flex flex-col md:flex-row gap-5 items-start",children:[e.jsx("div",{className:"p-4 bg-indigo-50 text-indigo-600 rounded-2xl shrink-0",children:e.jsx(S,{size:28})}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("h3",{className:"text-base font-bold text-gray-900",children:"Openlearn Next 插件开发指南 & API 参考"}),e.jsxs("p",{className:"text-xs text-gray-600 leading-relaxed",children:["Openlearn Next 基于 ",e.jsx("span",{className:"font-semibold text-indigo-600",children:"CommandBus(命令总线)"})," +"," ",e.jsx("span",{className:"font-semibold text-indigo-600",children:"EventBus(事件总线)"})," 微内核架构。 插件通过标准 ESM 模块导出 ",e.jsx("code",{className:"bg-gray-100 text-rose-600 px-1 rounded text-xs",children:"activate(ctx)"})," 函数接收"," ",e.jsx("span",{className:"font-semibold",children:"PluginContext"}),", 进而访问 7 大内核服务。本页提供完整的 API 参考、参数说明和可运行示例。"]}),e.jsxs("div",{className:"flex flex-wrap gap-2 pt-1",children:[e.jsx("span",{className:"text-xs bg-indigo-50 text-indigo-700 border border-indigo-100 px-2 py-0.5 rounded-full font-medium",children:"🔄 DI 依赖注入"}),e.jsx("span",{className:"text-xs bg-emerald-50 text-emerald-700 border border-emerald-100 px-2 py-0.5 rounded-full font-medium",children:"🔒 能力安全模型"}),e.jsx("span",{className:"text-xs bg-amber-50 text-amber-700 border border-amber-100 px-2 py-0.5 rounded-full font-medium",children:"⚡ 热重载 + Worker 隔离"}),e.jsx("span",{className:"text-xs bg-rose-50 text-rose-700 border border-rose-100 px-2 py-0.5 rounded-full font-medium",children:"📦 ESM + CommonJS 双格式"}),e.jsx("span",{className:"text-xs bg-sky-50 text-sky-700 border border-sky-100 px-2 py-0.5 rounded-full font-medium",children:"🆔 别名生命周期 (Alias Lifecycle)"}),e.jsx("span",{className:"text-xs bg-teal-50 text-teal-700 border border-teal-100 px-2 py-0.5 rounded-full font-medium",children:"🛡️ Worker Storage 安全隔离"})]})]})]}),e.jsxs("div",{className:"bg-white rounded-2xl border border-gray-200 overflow-hidden shadow-sm",children:[e.jsxs("div",{className:"px-5 py-4 bg-gray-50 border-b border-gray-100 flex flex-col sm:flex-row sm:items-center justify-between gap-2",children:[e.jsxs("div",{className:"flex items-start gap-2",children:[e.jsx("div",{className:"p-1.5 bg-indigo-50 text-indigo-600 rounded",children:e.jsx(_,{size:16})}),e.jsxs("div",{children:[e.jsx("h4",{className:"text-xs font-bold text-gray-900",children:"示例 1:思维导图插件 — 注册 Action + 处理器 + 发布事件"}),e.jsx("p",{className:"text-xs text-gray-500 mt-0.5",children:"演示 ctx.services 解构、Action 注册、createCommand 创建信封、eventBus.publish 发布事件"})]})]}),e.jsxs("button",{onClick:()=>d("tpl1",l),className:`px-3 py-1.5 rounded-lg text-xs font-semibold flex items-center gap-1.5 transition-all shadow-sm shrink-0 ${r==="tpl1"?"bg-emerald-50 text-emerald-700 border border-emerald-250":"bg-white text-indigo-600 border border-indigo-150 hover:bg-indigo-50"}`,children:[r==="tpl1"?e.jsx(E,{size:12}):e.jsx(v,{size:12}),e.jsx("span",{children:r==="tpl1"?"已复制!":"复制代码"})]})]}),e.jsx("pre",{className:"text-xs font-mono p-5 bg-gray-950 text-gray-200 overflow-x-auto leading-relaxed max-h-[360px] shadow-inner select-all",children:l})]}),e.jsxs("div",{className:"bg-white rounded-2xl border border-gray-200 overflow-hidden shadow-sm",children:[e.jsxs("div",{className:"px-5 py-4 bg-gray-50 border-b border-gray-100 flex flex-col sm:flex-row sm:items-center justify-between gap-2",children:[e.jsxs("div",{className:"flex items-start gap-2",children:[e.jsx("div",{className:"p-1.5 bg-emerald-50 text-emerald-600 rounded",children:e.jsx(_,{size:16})}),e.jsxs("div",{children:[e.jsx("h4",{className:"text-xs font-bold text-gray-900",children:"示例 2:AI 作业批改插件 — 演示 AI + 事件订阅 + 存储 + DI"}),e.jsx("p",{className:"text-xs text-gray-500 mt-0.5",children:"演示 ctx.resolve 获取数据库、services.ai 生成文本、services.storage 持久化、eventBus 订阅"})]})]}),e.jsxs("button",{onClick:()=>d("tpl2",g),className:`px-3 py-1.5 rounded-lg text-xs font-semibold flex items-center gap-1.5 transition-all shadow-sm shrink-0 ${r==="tpl2"?"bg-emerald-50 text-emerald-700 border border-emerald-250":"bg-white text-emerald-600 border border-emerald-150 hover:bg-emerald-50"}`,children:[r==="tpl2"?e.jsx(E,{size:12}):e.jsx(v,{size:12}),e.jsx("span",{children:r==="tpl2"?"已复制!":"复制代码"})]})]}),e.jsx("pre",{className:"text-xs font-mono p-5 bg-gray-950 text-gray-200 overflow-x-auto leading-relaxed max-h-[360px] shadow-inner select-all",children:g})]}),e.jsxs("div",{className:"bg-white rounded-2xl border border-gray-200 overflow-hidden shadow-sm",children:[e.jsxs("div",{className:"px-5 py-4 bg-gray-50 border-b border-gray-100 flex flex-col sm:flex-row sm:items-center justify-between gap-2",children:[e.jsxs("div",{className:"flex items-start gap-2",children:[e.jsx("div",{className:"p-1.5 bg-amber-50 text-amber-600 rounded",children:e.jsx(_,{size:16})}),e.jsxs("div",{children:[e.jsx("h4",{className:"text-xs font-bold text-gray-900",children:"示例 3:考试系统插件 — 演示 ctx.db 自建表 + deactivate 清理"}),e.jsx("p",{className:"text-xs text-gray-500 mt-0.5",children:"演示 ctx.db.ensureTable 建表、ctx.db.table 获取带前缀表名、deactivate 生命周期"})]})]}),e.jsxs("button",{onClick:()=>d("tpl3",h),className:`px-3 py-1.5 rounded-lg text-xs font-semibold flex items-center gap-1.5 transition-all shadow-sm shrink-0 ${r==="tpl3"?"bg-emerald-50 text-emerald-700 border border-emerald-250":"bg-white text-amber-600 border border-amber-150 hover:bg-amber-50"}`,children:[r==="tpl3"?e.jsx(E,{size:12}):e.jsx(v,{size:12}),e.jsx("span",{children:r==="tpl3"?"已复制!":"复制代码"})]})]}),e.jsx("pre",{className:"text-xs font-mono p-5 bg-gray-950 text-gray-200 overflow-x-auto leading-relaxed max-h-[360px] shadow-inner select-all",children:h})]})]})}),ae=({copiedId:t,handleCopy:n})=>e.jsx("div",{className:"flex-1 overflow-y-auto p-6 bg-slate-50/50",children:e.jsxs("div",{className:"max-w-5xl mx-auto space-y-8",children:[e.jsxs("div",{className:"bg-gradient-to-r from-indigo-900 to-indigo-950 rounded-2xl p-6 text-white shadow-md flex flex-col md:flex-row gap-5 items-start",children:[e.jsx("div",{className:"p-4 bg-indigo-500/20 text-indigo-300 border border-indigo-500/30 rounded-2xl shrink-0",children:e.jsx(C,{size:32})}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs("h3",{className:"text-lg font-bold text-white flex items-center gap-2",children:["Openlearn Next 核心系统主要特性使用教程",e.jsx("span",{className:"text-xs bg-indigo-500/30 text-indigo-200 border border-indigo-500/50 px-2 py-0.5 rounded-full font-normal",children:"v2.1.0 LTS"})]}),e.jsx("p",{className:"text-xs text-indigo-200 leading-relaxed",children:"本指南为教育实验操作系统 (Openlearn Next) 的深度使用手册。详细阐述如何使用内核指令管理班级与学生、基于大纲结构化推进课件时间轴、在互动白板中动态注入脑图和测验元素、启动全屏锁定与签到的教学控制流,以及编写并集成支持 AI 成绩回传的 HTML Applet 实验组件。"}),e.jsxs("div",{className:"flex flex-wrap gap-2 pt-1",children:[e.jsx("span",{className:"text-xs bg-indigo-800/40 text-indigo-150 border border-indigo-700/50 px-2 py-0.5 rounded-full font-medium",children:"🏫 班级与学生指令集"}),e.jsx("span",{className:"text-xs bg-emerald-800/40 text-emerald-150 border border-emerald-700/50 px-2 py-0.5 rounded-full font-medium",children:"📋 课程大纲时间轴同步"}),e.jsx("span",{className:"text-xs bg-amber-800/40 text-amber-150 border border-amber-700/50 px-2 py-0.5 rounded-full font-medium",children:"🎨 协作白板指令渲染"}),e.jsx("span",{className:"text-xs bg-sky-800/40 text-sky-150 border border-sky-700/50 px-2 py-0.5 rounded-full font-medium",children:"🚀 postMessage 成绩监听"})]})]})]}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[e.jsxs("div",{className:"bg-white rounded-2xl border border-gray-200 shadow-sm p-6 space-y-4 hover:shadow-md transition-all flex flex-col justify-between",children:[e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-3 border-b border-gray-100 pb-3 text-indigo-600 font-bold",children:[e.jsx("div",{className:"p-2 bg-indigo-50 rounded-xl",children:e.jsx(P,{size:20})}),e.jsxs("div",{children:[e.jsx("h4",{className:"text-sm text-gray-900",children:"1. 使用核心指令管理班级与学生"}),e.jsx("p",{className:"text-xs text-gray-400 font-normal mt-0.5",children:"Administrative CLI & Capability Model"})]})]}),e.jsxs("p",{className:"text-xs text-gray-600 leading-relaxed mt-3",children:["Openlearn Next 采用权限隔离的",e.jsx("strong",{children:"能力安全模型 (Capability Model)"}),"。任何行政、学籍以及课表排期修改,底层最终都会被封装为非对称的内核指令,经由分布式指令总线进行安全校验与事务落库。"]}),e.jsxs("div",{className:"p-3 bg-indigo-50/50 rounded-xl border border-indigo-100 text-xs text-indigo-900 space-y-1.5 mt-3",children:[e.jsx("span",{className:"font-bold block",children:"🔒 核心访问权限声明 (RBAC Capabilities):"}),e.jsxs("ul",{className:"list-disc list-inside space-y-1 text-gray-600 text-xs",children:[e.jsxs("li",{children:[e.jsx("code",{className:"bg-white/80 px-1 rounded border border-indigo-150",children:"class:write"}),":允许创建/删除行政班级。"]}),e.jsxs("li",{children:[e.jsx("code",{className:"bg-white/80 px-1 rounded border border-indigo-150",children:"student:write"}),":允许注册学生、修改学籍或修改设备锁定状态。"]}),e.jsxs("li",{children:[e.jsx("code",{className:"bg-white/80 px-1 rounded border border-indigo-150",children:"schedule:write"}),":允许编排课程,或临时将某一日期的课程替换为星期几的常规课表。"]})]})]})]}),e.jsxs("div",{className:"space-y-3 font-mono text-xs mt-4",children:[e.jsxs("div",{className:"bg-gray-50 rounded-xl p-3 border border-gray-150 relative",children:[e.jsxs("div",{className:"flex justify-between items-center mb-1",children:[e.jsx("span",{className:"text-indigo-600 font-bold",children:"A. 创建班级 (class.create)"}),e.jsx("button",{onClick:()=>n("guide_cmd_class",`{
|
|
3
3
|
"name": "高三一班",
|
|
4
4
|
"description": "物理实验班"
|
|
5
5
|
}`),className:"text-xs text-indigo-600 hover:underline hover:text-indigo-800 font-sans",children:t==="guide_cmd_class"?"已复制":"复制参数"})]}),e.jsx("pre",{className:"text-xs text-gray-500 overflow-x-auto whitespace-pre-wrap leading-relaxed",children:`{
|