openlearn-next 0.4.2 → 0.6.0
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 +21 -20
- package/dist/assets/ActivityWorkspaceWidget-_6XMBAcc.js +1 -0
- package/dist/assets/AdminDirectoryView-BufUF-sk.js +5 -0
- package/dist/assets/{BatchPickerModal-BpWu0Lil.js → BatchPickerModal-CES2DlPx.js} +1 -1
- package/dist/assets/ClassesView-BLvRJKcc.js +24 -0
- package/dist/assets/ClassroomCountdownWidget-DfKotHP8.js +2 -0
- package/dist/assets/{CloudDriveModal-DEQ1nkNk.js → CloudDriveModal-CLe4I18S.js} +1 -1
- package/dist/assets/ComputerLabView-CPnWWguS.js +1 -0
- package/dist/assets/CourseManagement-BSR61ggI.js +1 -0
- package/dist/assets/CourseWizardModal-D2m3PG7k.js +3 -0
- package/dist/assets/CoursewareHubPanel-gqjte-Pv.js +1 -0
- package/dist/assets/Dashboard-BPBJd0QR.js +8 -0
- package/dist/assets/ExportWeightModal-C3gIzDaP.js +1 -0
- package/dist/assets/HelpTour-B-RKDb1-.js +1 -0
- package/dist/assets/{HelpView-CtzdqhBq.js → HelpView-Bk64VK-J.js} +12 -12
- package/dist/assets/ImportLessonsModal-DUGpcZV3.js +1 -0
- package/dist/assets/ImportModal-ChY_Y5DZ.js +1 -0
- package/dist/assets/InteractiveCoursewareViewer-B9wvha7w.js +1 -0
- package/dist/assets/InteractiveWhiteboard-FPrze5CJ.js +78 -0
- package/dist/assets/LazyCourseware-BV5nOs5y.js +2 -0
- package/dist/assets/LazyWhiteboard-Cy5DdYnO.js +2 -0
- package/dist/assets/LessonEditorView-3SyplRhr.js +1 -0
- package/dist/assets/LiveClassroomView-CX7SUnmx.js +61 -0
- package/dist/assets/{NotificationDetailModal-Baqnc5pU.js → NotificationDetailModal-BBATA8Lh.js} +1 -1
- package/dist/assets/{PluginView-CCbIuZ24.js → PluginView-D5jMNscn.js} +5 -5
- package/dist/assets/ProcessLogsModal-DfKPVIYe.js +1 -0
- package/dist/assets/{QuizGeneratorModal-BBEDssp7.js → QuizGeneratorModal-CbRirQId.js} +1 -1
- package/dist/assets/StudentAssignmentView-ucXAOac9.js +1 -0
- package/dist/assets/StudentLessonView-CW6FYMtd.js +13 -0
- package/dist/assets/StudentView-Bxrut8tS.js +2 -0
- package/dist/assets/SystemResourceLibraryModal-CXdrWHDL.js +1 -0
- package/dist/assets/TeacherView-DXg0boJH.js +2 -0
- package/dist/assets/TimetableView-DPABkaFX.js +6 -0
- package/dist/assets/index-B3W5zons.css +1 -0
- package/dist/assets/index-B6wtREUD.js +221 -0
- package/dist/assets/{index.es-C5eWEO4o.js → index.es-DvJa33KC.js} +1 -1
- package/dist/assets/{vendor-charts-qLbgF1eL.js → vendor-charts-DGsG2RUv.js} +1 -1
- package/dist/assets/{vendor-icons-BRmhY6fg.js → vendor-icons-CyfamhaC.js} +2 -2
- package/dist/assets/{vendor-konva-CEOq4dcl.js → vendor-konva-DBWwlLTb.js} +1 -1
- package/dist/assets/{vendor-pdf-D7rGevI1.js → vendor-pdf-D0UGJOgo.js} +49 -49
- package/dist/assets/{vendor-pptx-C5-U7ieS.js → vendor-pptx-D4btWy5L.js} +8 -8
- package/dist/assets/{vendor-react-B0t7H3hh.js → vendor-react-CZ1I7IcM.js} +1 -1
- package/dist/assets/{vendor-utils-m0Urvtws.js → vendor-utils-B6R8dnOe.js} +1 -1
- package/dist/index.html +13 -10
- package/dist/server.cjs +19224 -11247
- package/package.json +11 -4
- package/dist/assets/AdminDirectoryView-DY--WM5Z.js +0 -1
- package/dist/assets/ClassesView-KbHEqJto.js +0 -22
- package/dist/assets/ClassroomCountdownWidget-96WFRO9A.js +0 -2
- package/dist/assets/ComputerLabView-1qWDNRQ2.js +0 -1
- package/dist/assets/CourseManagement-D3ZpxY0l.js +0 -1
- package/dist/assets/CourseWizardModal-Ck_-M8pk.js +0 -3
- package/dist/assets/CoursewareHubPanel-CaEizhxl.js +0 -1
- package/dist/assets/Dashboard-CYbpbofV.js +0 -8
- package/dist/assets/ExportWeightModal-DW2bu9Zz.js +0 -1
- package/dist/assets/HelpTour-CMJbbGne.js +0 -1
- package/dist/assets/ImportLessonsModal-jBuIK453.js +0 -1
- package/dist/assets/ImportModal-D7L-KNhZ.js +0 -1
- package/dist/assets/InteractiveCoursewareViewer-Bj7ahXMs.js +0 -1
- package/dist/assets/InteractiveWhiteboard-B7JcJvDu.js +0 -77
- package/dist/assets/LazyCourseware-CuiPxhDg.js +0 -2
- package/dist/assets/LazyWhiteboard-BJwCEZAU.js +0 -2
- package/dist/assets/LessonEditorView-DFrOp2qp.js +0 -1
- package/dist/assets/LiveClassroomView-BZ5nGee3.js +0 -59
- package/dist/assets/ProcessLogsModal-DmFXg9mG.js +0 -1
- package/dist/assets/StudentAssignmentView-DgIjUsXz.js +0 -1
- package/dist/assets/StudentLessonView-CBJbI5x6.js +0 -1
- package/dist/assets/StudentPreviewModal-Bh8OZs0t.js +0 -1
- package/dist/assets/StudentView--uGxc5TJ.js +0 -2
- package/dist/assets/SystemResourceLibraryModal-BVCclcqA.js +0 -1
- package/dist/assets/TeacherView-D4Zsc0eZ.js +0 -2
- package/dist/assets/TimetableView-BQG-rEb5.js +0 -6
- package/dist/assets/index-BKBCBKvy.js +0 -217
- package/dist/assets/index-CvGu7LSj.css +0 -1
|
@@ -0,0 +1,221 @@
|
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/StudentView-Bxrut8tS.js","assets/vendor-react-CZ1I7IcM.js","assets/vendor-utils-B6R8dnOe.js","assets/vendor-icons-CyfamhaC.js","assets/vendor-motion-BFAPOs-b.js","assets/TeacherView-DXg0boJH.js","assets/ImportModal-ChY_Y5DZ.js","assets/CourseWizardModal-D2m3PG7k.js","assets/ImportLessonsModal-DUGpcZV3.js","assets/QuizGeneratorModal-CbRirQId.js","assets/ProcessLogsModal-DfKPVIYe.js","assets/CloudDriveModal-CLe4I18S.js","assets/LazyCourseware-BV5nOs5y.js","assets/SystemResourceLibraryModal-CXdrWHDL.js","assets/BatchPickerModal-CES2DlPx.js","assets/ExportWeightModal-C3gIzDaP.js","assets/NotificationDetailModal-BBATA8Lh.js","assets/HelpTour-B-RKDb1-.js","assets/CoursewareHubPanel-gqjte-Pv.js","assets/ActivityWorkspaceWidget-_6XMBAcc.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{r as f,j as r,R as De,g as wl,u as Kf,b as Zf,d as ti,h as ni,J as Io,i as Ao,k as Yf}from"./vendor-react-CZ1I7IcM.js";import{G as Vs,S as Xf,U as vl,C as Us,a as as,L as si,A as Hs,b as em,c as Pt,K as Sl,d as sr,X as Ie,e as tm,T as un,P as jl,I as ri,f as hn,g as kl,h as nm,i as sm,j as rm,H as im,F as _i,M as om,k as cs,l as ii,m as Di,n as Cl,o as it,p as qs,q as Mi,r as Nl,s as am,t as zo,u as lm,W as Ws,v as cm,w as ot,B as rr,x as oi,y as dm,z as El,D as Lo,E as Pl,J as um,N as hm,R as Oi,O as Tl,Q as fm,V as mm,Y as $i,Z as pm,_ as Il,$ as gm,a0 as ir,a1 as fn,a2 as ai,a3 as Ro,a4 as li,a5 as rt,a6 as xm,a7 as Al,a8 as zl,a9 as Ll,aa as bm,ab as an,ac as ym,ad as wm,ae as vm,af as Sm,ag as jm,ah as Rl,ai as _l,aj as km,ak as Dl,al as ci,am as Cm,an as gr,ao as Es,ap as Nm,aq as Em,ar as Pm,as as Tm,at as Im,au as Am,av as zm,aw as Lm,ax as Rm,ay as _m,az as or,aA as Dm,aB as Mm,aC as Om}from"./vendor-icons-CyfamhaC.js";import{e as $t,f as pn,h as Fi}from"./vendor-utils-B6R8dnOe.js";import{v as ar}from"./vendor-pptx-D4btWy5L.js";import{_ as $e}from"./vendor-pdf-D0UGJOgo.js";import{i as xr,g as $m,s as Ml,a as Bi,b as Ol,c as _o,d as Fm,e as Bm,f as Vm,h as Um,r as Hm,j as qm,k as $l,l as Wm,m as Gm,n as Qm,o as Jm,S as Km,H as Zm,F as Tt,p as Ym,q as Xm,t as Fl,u as Gs,v as Do,w as ut,x as Bl,y as ep,z as Mo,A as tp,B as Qs,C as di,D as Oo,E as np,G as sp,I as St,J as rp,K as ip,L as op,M as $o,N as ap,O as lp,P as Fo,Q as cp,R as dp,T as Ps,U as up,V as hp,W as Vl,X as fp,Y as mp}from"./vendor-motion-BFAPOs-b.js";import{R as Bo}from"./vendor-charts-DGsG2RUv.js";const Vi=f.createContext(null);function ms({value:t,children:e}){return r.jsx(Vi.Provider,{value:t,children:e})}function Xk(){const t=f.useContext(Vi);if(!t)throw new Error("useAppData must be used within <AppDataProvider>");return t}function Ft(){return f.useContext(Vi)}function ln(t){return Array.isArray(t)?t:t&&typeof t=="object"&&Array.isArray(t.data)?t.data:[]}const pp=De.memo(function({onLoginSuccess:e,lang:n}){const[s,i]=f.useState("teacher"),[o,a]=f.useState(null),[l,c]=f.useState(""),[d,h]=f.useState(""),[m,p]=f.useState(""),[u,g]=f.useState(!1),[x,w]=f.useState([]),[v,S]=f.useState(""),[b,C]=f.useState(""),[N,y]=f.useState(""),[P,L]=f.useState(""),[_,O]=f.useState(!1);f.useEffect(()=>{(async()=>{try{const D=await fetch("/api/students?pageSize=all");if(D.ok){const I=ln(await D.json());w(I),I.length>0&&S(I[0].id)}}catch(D){console.warn("Failed to fetch student roster for login selection:",D)}})()},[]),f.useEffect(()=>{(async()=>{try{const D=await fetch("/api/site-settings");if(D.ok){const I=await D.json();a(I)}}catch(D){console.warn("Failed to fetch site settings for login branding:",D)}})()},[]);const T=async R=>{if(R.preventDefault(),!l.trim()||!d){p(n==="zh"?"请输入完整的用户名和密码。":"Please fill in both key fields.");return}try{p(""),g(!0);const D=await fetch("/api/auth/login",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({entrance:"teacher",username:l.trim(),password:d})});if(D.ok){const I=await D.json();e(I.session)}else{const I=await D.json();p(I.error||(n==="zh"?"用户名或密码不正确":"Invalid username or password"))}}catch{p(n==="zh"?"网络连接异常,请重试":"Network communication failure. Please try again.")}finally{g(!1)}},A=async R=>{R.preventDefault();const D=v||b.trim();if(!D){L(n==="zh"?"请选择或输入学号/学生标识。":"Please select or enter your Student ID.");return}if(!N.trim()){L(n==="zh"?"请输入个人密码或临时班级密码。":"Please enter your personal password or temporary class passcode.");return}try{L(""),O(!0);const I=await fetch("/api/auth/login",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({entrance:"student",studentId:D,password:N.trim()})});if(I.ok){const $=await I.json();e($.session)}else{const $=await I.json();L($.error||(n==="zh"?"找不到该学生记录":"Student record not found"))}}catch{L(n==="zh"?"网络连接异常,请重试":"Network connection failure. Please try again.")}finally{O(!1)}};return r.jsxs("div",{className:"min-h-screen bg-slate-900 flex flex-col items-center justify-center p-4 relative overflow-hidden font-sans",id:"login_page_container",children:[r.jsx("div",{className:"absolute top-[-10%] left-[-10%] w-[40rem] h-[40rem] rounded-full bg-indigo-500/10 blur-3xl -z-10"}),r.jsx("div",{className:"absolute bottom-[-10%] right-[-10%] w-[35rem] h-[35rem] rounded-full bg-violet-500/10 blur-3xl -z-10"}),r.jsxs("div",{className:"w-full max-w-md bg-slate-950/85 backdrop-blur-md rounded-2xl border border-slate-800 shadow-2xl p-6 sm:p-8",id:"login_card",children:[r.jsxs("div",{className:"text-center mb-8",children:[o?.logoUrl?r.jsx("img",{src:o.logoUrl,alt:o.siteName||"logo",className:"inline-block h-16 w-16 object-contain mb-4 rounded-xl"}):r.jsx("div",{className:"inline-flex items-center justify-center p-3 bg-gradient-to-tr from-indigo-500 to-indigo-600 rounded-2xl shadow-lg border border-indigo-400/20 mb-4 text-white",children:r.jsx(Vs,{size:32})}),r.jsxs("h1",{className:"text-2xl sm:text-3xl font-black text-white tracking-tight flex items-center justify-center gap-2",children:[o?.siteName||"OpenLearn Next"," ",r.jsx("span",{className:"text-indigo-400 font-medium text-xs bg-indigo-500/20 px-2 py-0.5 rounded-full border border-indigo-400/20",children:"V2.0"})]}),r.jsx("p",{className:"text-slate-400 text-xs sm:text-sm mt-2",children:o?.slogan||(n==="zh"?"下一代智能数字化学习系统":"Next-Generation Intelligent Digital Learning Platform")})]}),r.jsxs("div",{className:"flex bg-slate-900 p-1 rounded-xl border border-slate-800 gap-1 mb-6",children:[r.jsxs("button",{onClick:()=>i("teacher"),className:`flex-1 py-2.5 rounded-lg text-xs font-bold transition-all duration-200 flex items-center justify-center gap-2 focus:outline-none ${s==="teacher"?"bg-indigo-600 text-white shadow-md":"text-slate-400 hover:text-slate-200 hover:bg-slate-800/40"}`,children:[r.jsx(Xf,{size:14}),n==="zh"?"教师与管理端":"Teacher / Staff Portal"]}),r.jsxs("button",{onClick:()=>i("student"),className:`flex-1 py-2.5 rounded-lg text-xs font-bold transition-all duration-200 flex items-center justify-center gap-2 focus:outline-none ${s==="student"?"bg-indigo-600 text-white shadow-md":"text-slate-400 hover:text-slate-200 hover:bg-slate-800/40"}`,children:[r.jsx(vl,{size:14}),n==="zh"?"学生自助端":"Student Self-Service"]})]}),s==="teacher"?r.jsxs("form",{onSubmit:T,className:"space-y-4",children:[m&&r.jsxs("div",{className:"p-3 bg-red-950/50 border border-red-800 text-red-300 text-xs rounded-xl flex items-center gap-2",children:[r.jsx(Us,{size:15,className:"shrink-0"}),r.jsx("span",{children:m})]}),r.jsxs("div",{className:"space-y-1.5",children:[r.jsxs("label",{className:"text-xs font-medium text-slate-400 flex items-center gap-1.5",children:[r.jsx(as,{size:13}),n==="zh"?"教工账户名 / username":"Staff Username"]}),r.jsx("input",{type:"text",value:l,onChange:R=>c(R.target.value),placeholder:n==="zh"?"输入教工账户名":"Enter staff username",className:"w-full bg-slate-900 border border-slate-800 focus:border-indigo-500 focus:ring-1 focus:ring-indigo-500 rounded-xl text-xs sm:text-sm p-3 text-white outline-none placeholder-slate-500 transition-colors",required:!0})]}),r.jsxs("div",{className:"space-y-1.5",children:[r.jsxs("label",{className:"text-xs font-medium text-slate-400 flex items-center gap-1.5",children:[r.jsx(si,{size:13}),n==="zh"?"输入登录密码 / password":"Access Password"]}),r.jsx("input",{type:"password",value:d,onChange:R=>h(R.target.value),placeholder:n==="zh"?"输入登录密码":"Enter access password",className:"w-full bg-slate-900 border border-slate-800 focus:border-indigo-500 focus:ring-1 focus:ring-indigo-500 rounded-xl text-xs sm:text-sm p-3 text-white outline-none placeholder-slate-500 transition-colors",required:!0})]}),r.jsxs("button",{type:"submit",disabled:u,className:"w-full mt-6 bg-gradient-to-r from-indigo-600 to-violet-600 hover:from-indigo-500 hover:to-violet-500 disabled:opacity-50 text-white font-bold py-3 px-4 rounded-xl text-xs sm:text-sm flex items-center justify-center gap-2 transition-all duration-200 cursor-pointer shadow-lg shadow-indigo-600/20 active:scale-[0.98]",children:[r.jsx("span",{children:u?n==="zh"?"鉴权登录中...":"Authorizing...":n==="zh"?"安全验证登录":"Authorized Sign In"}),r.jsx(Hs,{size:15})]})]}):r.jsxs("form",{onSubmit:A,className:"space-y-4",children:[P&&r.jsxs("div",{className:"p-3 bg-red-950/50 border border-red-800 text-red-300 text-xs rounded-xl flex items-center gap-2",children:[r.jsx(Us,{size:15,className:"shrink-0"}),r.jsx("span",{children:P})]}),x.length>0?r.jsxs("div",{className:"space-y-1.5",children:[r.jsxs("label",{className:"text-xs font-medium text-slate-400 flex items-center gap-1.5",children:[r.jsx(Vs,{size:14}),n==="zh"?"从学生花名册中快速选择":"Quick Access Student Select"]}),r.jsx("select",{value:v,onChange:R=>{S(R.target.value),C("")},className:"w-full bg-slate-900 border border-slate-800 focus:border-indigo-500 focus:ring-1 focus:ring-indigo-500 rounded-xl text-xs sm:text-sm p-3 text-white outline-none transition-colors cursor-pointer",children:x.map(R=>r.jsxs("option",{value:R.id,children:[R.name," (",R.student_number||R.id,")"]},R.id))}),r.jsx("p",{className:"text-xs text-slate-500 font-medium",children:n==="zh"?"✨ 在沙盒调试中,你可以直接下拉选择已有的学生账户一键登录为该生。":"✨ Sandbox help: Quick select existing students on file to simulate as student."})]}):null,r.jsxs("div",{className:"relative flex py-2 items-center",children:[r.jsx("div",{className:"flex-grow border-t border-slate-850"}),r.jsx("span",{className:"flex-shrink mx-3 text-xs font-bold text-slate-500 uppercase tracking-wider",children:n==="zh"?"或手动输入学号":"Or input key manually"}),r.jsx("div",{className:"flex-grow border-t border-slate-850"})]}),r.jsxs("div",{className:"space-y-1.5",children:[r.jsxs("label",{className:"text-xs font-medium text-slate-400 flex items-center gap-1.5",children:[r.jsx(as,{size:13}),n==="zh"?"学号 / Student ID":"Student Access Key"]}),r.jsx("input",{type:"text",value:b,onChange:R=>{C(R.target.value),S("")},placeholder:n==="zh"?"手工输入您的特有学号":"Enter specific numeric ID code",className:"w-full bg-slate-900 border border-slate-800 focus:border-indigo-500 focus:ring-1 focus:ring-indigo-500 rounded-xl text-xs sm:text-sm p-3 text-white outline-none placeholder-slate-500 transition-colors"})]}),r.jsxs("div",{className:"space-y-1.5",children:[r.jsxs("label",{className:"text-xs font-medium text-slate-400 flex items-center gap-1.5",children:[r.jsx(si,{size:13}),n==="zh"?"个人密码 / 临时班级密码":"Personal Password / Class Passcode"]}),r.jsx("input",{type:"password",required:!0,value:N,onChange:R=>y(R.target.value),placeholder:n==="zh"?"输入个人密码或临时班级密码":"Enter personal password or class passcode",className:"w-full bg-slate-900 border border-slate-800 focus:border-indigo-500 focus:ring-1 focus:ring-indigo-500 rounded-xl text-xs sm:text-sm p-3 text-white outline-none placeholder-slate-500 transition-colors"})]}),r.jsxs("button",{type:"submit",disabled:_,className:"w-full mt-6 bg-gradient-to-r from-indigo-600 to-violet-600 hover:from-indigo-500 hover:to-violet-500 disabled:opacity-50 text-white font-bold py-3 px-4 rounded-xl text-xs sm:text-sm flex items-center justify-center gap-2 transition-all duration-200 cursor-pointer shadow-lg shadow-indigo-600/20 active:scale-[0.98]",children:[r.jsx("span",{children:_?n==="zh"?"正在连接学生终端...":"Entering Desk...":n==="zh"?"登录学生智慧桌面":"Login Interactive Desk"}),r.jsx(Hs,{size:15})]})]})]})]})});function gp({lang:t,username:e,onDone:n,onLogout:s}){const[i,o]=f.useState(""),[a,l]=f.useState(""),[c,d]=f.useState(""),[h,m]=f.useState(null),[p,u]=f.useState(!1),g=t==="zh",x=()=>!i||!a||!c?g?"请填写完整":"All fields are required":a.length<8?g?"新密码至少 8 位":"Password must be at least 8 characters long":!/[a-zA-Z]/.test(a)||!/[0-9]/.test(a)?g?"新密码需同时包含字母和数字":"Password must contain both letters and numbers":a===i?g?"新密码不能与当前密码相同":"New password must differ from the current one":a!==c?g?"两次输入的新密码不一致":"Passwords do not match":null,w=async()=>{const S=x();if(S){m(S);return}u(!0),m(null);try{const b=await fetch("/api/auth/change-password",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({oldPassword:i,newPassword:a})}),C=await b.json().catch(()=>({}));if(!b.ok){m(C.error||(g?"修改失败,请重试":"Change failed, please retry"));return}n()}catch{m(g?"网络异常,请重试":"Network error, please retry")}finally{u(!1)}},v="w-full px-3 py-2 rounded-lg bg-white border border-slate-300 text-sm text-slate-800 focus:outline-none focus:ring-2 focus:ring-indigo-500 focus:border-transparent";return r.jsx("div",{className:"min-h-screen bg-slate-900 flex flex-col items-center justify-center p-4 font-sans",children:r.jsxs("div",{className:"w-full max-w-md bg-white rounded-2xl shadow-xl p-6",children:[r.jsxs("div",{className:"flex items-center gap-3 mb-1",children:[r.jsx("div",{className:"p-2 rounded-lg bg-amber-100",children:r.jsx(em,{size:20,className:"text-amber-600"})}),r.jsx("h1",{className:"text-lg font-bold text-slate-800",children:g?"安全要求:修改默认密码":"Security: Change Default Password"})]}),r.jsx("p",{className:"text-xs text-slate-500 leading-relaxed mb-5",children:g?`当前账号${e?`(${e})`:""}仍在使用初始默认密码,存在被接管的风险。请设置新密码后继续使用平台;修改前所有数据变更已被暂时冻结。`:`This account${e?` (${e})`:""} still uses the initial default password. Set a new password to continue; data changes are frozen until then.`}),r.jsxs("div",{className:"space-y-3",children:[r.jsxs("div",{children:[r.jsx("label",{className:"block text-xs font-medium text-slate-600 mb-1",children:g?"当前密码":"Current password"}),r.jsx("input",{type:"password",value:i,onChange:S=>o(S.target.value),className:v,autoComplete:"current-password"})]}),r.jsxs("div",{children:[r.jsx("label",{className:"block text-xs font-medium text-slate-600 mb-1",children:g?"新密码(至少 8 位,含字母和数字)":"New password (8+ chars, letters & numbers)"}),r.jsx("input",{type:"password",value:a,onChange:S=>l(S.target.value),className:v,autoComplete:"new-password"})]}),r.jsxs("div",{children:[r.jsx("label",{className:"block text-xs font-medium text-slate-600 mb-1",children:g?"确认新密码":"Confirm new password"}),r.jsx("input",{type:"password",value:c,onChange:S=>d(S.target.value),className:v,autoComplete:"new-password"})]})]}),h&&r.jsx("div",{"data-testid":"force-change-error",className:"mt-3 text-xs text-red-600 bg-red-50 border border-red-200 rounded-lg px-3 py-2",children:h}),r.jsxs("button",{type:"button",onClick:w,disabled:p,"data-testid":"force-change-submit",className:"mt-5 w-full flex items-center justify-center gap-2 px-4 py-2.5 rounded-lg bg-indigo-600 hover:bg-indigo-700 disabled:opacity-60 text-white text-sm font-semibold transition-colors cursor-pointer",children:[p?r.jsx(Pt,{size:16,className:"animate-spin"}):r.jsx(Sl,{size:16}),g?"修改密码并继续":"Change password and continue"]}),r.jsxs("button",{type:"button",onClick:s,className:"mt-2 w-full flex items-center justify-center gap-2 px-4 py-2 rounded-lg text-slate-500 hover:text-slate-700 hover:bg-slate-100 text-xs font-medium transition-colors cursor-pointer",children:[r.jsx(sr,{size:13}),g?"退出登录":"Log out"]})]})})}async function xp(){const t=await fetch("/api/lessons?pageSize=all");return t.ok?{ok:!0,data:await t.json()}:{ok:!1}}async function bp(t){const e=await fetch("/api/lessons",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)});return e.ok?{ok:!0,data:await e.json().catch(()=>({}))}:{ok:!1}}async function yp(t){const e=await fetch(`/api/lessons/${t}`,{method:"DELETE"});return e.ok?{ok:!0,data:await e.json().catch(()=>({}))}:{ok:!1,data:await e.json().catch(()=>({}))}}async function wp(t){const e=await fetch(`/api/lessons/${t}/clone`,{method:"POST"});return e.ok?{ok:!0,data:await e.json().catch(()=>({}))}:{ok:!1,data:await e.json().catch(()=>({}))}}async function vp(t){const e=await fetch(`/api/lessons/${t}/whiteboard`);return e.ok?{ok:!0,data:await e.json()}:{ok:!1}}async function Sp(){const t=await fetch("/api/classes?pageSize=all");return t.ok?{ok:!0,data:await t.json()}:{ok:!1}}async function jp(){const t=await fetch("/api/students?pageSize=all");return t.ok?{ok:!0,data:await t.json()}:{ok:!1}}async function kp(t){const e=await fetch(`/api/classes/${t}/students`);return e.ok?{ok:!0,data:await e.json()}:{ok:!1}}const Ye=$t(t=>({lang:"zh",activeRole:"teacher",teacherTab:"live_class",profileOpen:!1,isCourseWizardOpen:!1,isImportLessonsOpen:!1,isQuizGeneratorOpen:!1,isSystemResourceLibraryOpen:!1,batchPicker:null,isExportWeightModalOpen:!1,toasts:[],siteInfo:{siteName:"",slogan:"",logoUrl:null},setLang:e=>t({lang:e}),setActiveRole:e=>t({activeRole:e}),setTeacherTab:e=>t({teacherTab:e}),setProfileOpen:e=>t({profileOpen:e}),setIsCourseWizardOpen:e=>t({isCourseWizardOpen:e}),setIsImportLessonsOpen:e=>t({isImportLessonsOpen:e}),setIsQuizGeneratorOpen:e=>t({isQuizGeneratorOpen:e}),setIsSystemResourceLibraryOpen:e=>t({isSystemResourceLibraryOpen:e}),setBatchPicker:e=>t({batchPicker:e}),setIsExportWeightModalOpen:e=>t({isExportWeightModalOpen:e}),addToast:e=>t(n=>({toasts:[...n.toasts,e]})),removeToast:e=>t(n=>({toasts:n.toasts.filter(s=>s.id!==e)})),setSiteInfo:e=>t({siteInfo:e})})),Cp=t=>pn(Ye,t),Ne=$t(t=>({lang:Ye.getState().lang,session:null,lessons:[],selectedLesson:null,elements:[],classes:[],students:[],liveClassSelectedClassId:null,liveClassIsActive:!1,teacherTab:Ye.getState().teacherTab,aiProviders:[],plugins:[],registeredCommands:[],events:[],approvals:[],processes:[],vfsNodes:[],todaySchedules:[],computerLabs:[],dbConnected:!1,sessionLoading:!0,classStudentsMap:{},classDashboardMap:{},studentProgressMap:{},classSchedulesMap:{},scheduleAttendanceMap:{},assignmentSubmissionsMap:{},classAssignmentsMap:{},classProgressMap:{},classSeats:{lab_id:null,seats:[]},onlineStudentIds:[],activeStudentLessons:{},liveClassFeed:[],liveClassTimeRemaining:0,liveClassAcknowledgedMap:new Map,liveClassStudentProgress:[],studentDashboardData:null,notifications:[],toasts:Ye.getState().toasts,siteInfo:Ye.getState().siteInfo,setLang:e=>{Ye.getState().setLang(e),t({lang:e})},setSession:e=>t({session:e}),setLessons:e=>t(n=>({lessons:typeof e=="function"?e(n.lessons):e})),setSelectedLesson:e=>t({selectedLesson:e}),setElements:e=>t({elements:e}),setClasses:e=>t({classes:e}),setStudents:e=>t({students:e}),setLiveClassSelectedClassId:e=>t({liveClassSelectedClassId:e}),setLiveClassIsActive:e=>t({liveClassIsActive:e}),setTeacherTab:e=>{Ye.getState().setTeacherTab(e),t({teacherTab:e})},loadLessons:async()=>{try{const{ok:e,data:n}=await xp();if(e){const s=ln(n);t(i=>({lessons:s,selectedLesson:i.selectedLesson??(s.length>0?s[0].id:i.selectedLesson)}))}}catch(e){console.warn("Failed to fetch lessons",e)}},loadClasses:async()=>{try{const{ok:e,data:n}=await Sp();e&&t({classes:ln(n)})}catch(e){console.warn("Failed to fetch classes",e)}},loadStudents:async()=>{try{const{ok:e,data:n}=await jp();e&&t({students:ln(n)})}catch(e){console.warn("Failed to fetch students",e)}},setAiProviders:e=>t({aiProviders:e}),setPlugins:e=>t({plugins:e}),setRegisteredCommands:e=>t({registeredCommands:e}),setEvents:e=>t({events:e}),setApprovals:e=>t({approvals:e}),setProcesses:e=>t({processes:e}),setVfsNodes:e=>t({vfsNodes:e}),setTodaySchedules:e=>t({todaySchedules:e}),setComputerLabs:e=>t({computerLabs:e}),setDbConnected:e=>t({dbConnected:e}),setSessionLoading:e=>t({sessionLoading:e}),setClassStudents:(e,n)=>t(s=>({classStudentsMap:{...s.classStudentsMap,[e]:n}})),setClassDashboard:(e,n)=>t(s=>({classDashboardMap:{...s.classDashboardMap,[e]:n}})),setStudentProgress:(e,n)=>t(s=>({studentProgressMap:{...s.studentProgressMap,[e]:n}})),setClassSchedules:(e,n)=>t(s=>({classSchedulesMap:{...s.classSchedulesMap,[e]:n}})),setScheduleAttendance:(e,n)=>t(s=>({scheduleAttendanceMap:{...s.scheduleAttendanceMap,[e]:n}})),setAssignmentSubmissions:(e,n)=>t(s=>({assignmentSubmissionsMap:{...s.assignmentSubmissionsMap,[e]:n}})),setClassAssignments:(e,n)=>t(s=>({classAssignmentsMap:{...s.classAssignmentsMap,[e]:n}})),setClassProgress:(e,n)=>t(s=>({classProgressMap:{...s.classProgressMap,[e]:n}})),setClassSeats:e=>t({classSeats:e}),setOnlineStudentIds:e=>t({onlineStudentIds:e}),setActiveStudentLessons:e=>t({activeStudentLessons:e}),setLiveClassFeed:e=>t({liveClassFeed:e}),appendLiveClassFeed:e=>t(n=>({liveClassFeed:[...n.liveClassFeed.slice(-49),e]})),setLiveClassTimeRemaining:e=>t({liveClassTimeRemaining:e}),setLiveClassAcknowledgedMap:e=>t({liveClassAcknowledgedMap:e}),setLiveClassStudentProgress:e=>t({liveClassStudentProgress:e}),setStudentDashboardData:e=>t({studentDashboardData:e}),setNotifications:e=>t({notifications:e}),addToast:e=>{Ye.getState().addToast(e),t({toasts:Ye.getState().toasts})},removeToast:e=>{Ye.getState().removeToast(e),t({toasts:Ye.getState().toasts})},setSiteInfo:e=>{Ye.getState().setSiteInfo(e),t({siteInfo:e})}})),ue=t=>pn(Ne,t);class Np{constructor(){this.handlers=new Map,this.subscribers=new Map,this.middlewares=[],this.activeModals=[],this.modalListeners=new Set,this.registerBuiltinHandlers()}async dispatch(e,n){const s="act_"+Math.random().toString(36).slice(2,10),i={action:e,sourcePluginId:n?.sourcePluginId,timestamp:Date.now(),correlationId:s},o=async()=>{const c=this.handlers.get(e.type);if(c&&c.size>0){const d=Array.from(c);if(d.length===1)return await d[0](i);const h=await Promise.all(d.map(m=>m(i)));if(e.type==="host:refresh"){const m=new Set;for(const p of h)p&&Array.isArray(p.refreshed)&&p.refreshed.forEach(u=>m.add(u));return{success:!0,refreshed:Array.from(m)}}return h[h.length-1]}};let l=(async()=>{let c=-1;const d=async h=>{if(h<=c)throw new Error("next() called multiple times in middleware");if(c=h,h<this.middlewares.length){const m=this.middlewares[h];return m(i,()=>d(h+1))}return o()};return d(0)})();if(n?.timeoutMs&&n.timeoutMs>0){let c;const d=new Promise((h,m)=>{c=setTimeout(()=>{m(new Error(`Action "${e.type}" timed out after ${n.timeoutMs}ms`))},n.timeoutMs)});l=Promise.race([l,d]).finally(()=>{clearTimeout(c)})}try{const c=await l;return this.notifySubscribers(i,c,void 0),c}catch(c){throw this.notifySubscribers(i,void 0,c),c}}registerHandler(e,n){this.handlers.has(e)||this.handlers.set(e,new Set);const s=this.handlers.get(e);return s.add(n),{dispose:()=>{s.delete(n),s.size===0&&this.handlers.delete(e)}}}subscribe(e,n){this.subscribers.has(e)||this.subscribers.set(e,new Set);const s=this.subscribers.get(e);return s.add(n),{dispose:()=>{s.delete(n),s.size===0&&this.subscribers.delete(e)}}}use(e){return this.middlewares.push(e),{dispose:()=>{const n=this.middlewares.indexOf(e);n!==-1&&this.middlewares.splice(n,1)}}}getActiveModals(){return[...this.activeModals]}subscribeModals(e){return this.modalListeners.add(e),e(this.getActiveModals()),{dispose:()=>{this.modalListeners.delete(e)}}}resolveModal(e,n){const s=this.activeModals.findIndex(i=>i.id===e);if(s!==-1){const[i]=this.activeModals.splice(s,1);i.resolve(n),this.notifyModalListeners()}}closeAllModals(){for(;this.activeModals.length>0;)this.activeModals.pop().resolve({closed:!0,confirmed:!1});this.notifyModalListeners()}notifyModalListeners(){const e=this.getActiveModals();this.modalListeners.forEach(n=>{try{n(e)}catch(s){console.error("[HostActionDispatcher] Error notifying modal listener:",s)}})}createScopedDispatcher(e){return{dispatch:(n,s)=>this.dispatch(n,{sourcePluginId:e,...s}),registerHandler:(n,s)=>this.registerHandler(n,s),subscribe:(n,s)=>this.subscribe(n,s),use:n=>this.use(n)}}registerBuiltinHandlers(){this.registerHandler("host:refresh",async e=>{const s=e.action.payload.target,i=[];try{const a=Ne.getState();(s==="classes"||s==="all")&&typeof a.loadClasses=="function"&&(await a.loadClasses(),i.push("classes")),(s==="lessons"||s==="all")&&typeof a.loadLessons=="function"&&(await a.loadLessons(),i.push("lessons")),(s==="students"||s==="all")&&typeof a.loadStudents=="function"&&(await a.loadStudents(),i.push("students"))}catch(a){console.warn("[HostActionDispatcher] Builtin refresh failed:",a)}return{success:!0,refreshed:i}}),this.registerHandler("host:modal:confirm",e=>{const n=e.action.payload,s=n.id||"modal_confirm_"+Math.random().toString(36).slice(2,9);return new Promise(i=>{const o={id:s,type:"confirm",title:n.title,message:n.message,confirmText:n.confirmText,cancelText:n.cancelText,variant:n.variant||"primary",sourcePluginId:e.sourcePluginId,createdAt:Date.now(),resolve:a=>{const l=typeof a?.confirmed=="boolean"?a.confirmed:!1;i({confirmed:l})}};this.activeModals.push(o),this.notifyModalListeners()})}),this.registerHandler("host:modal:open",e=>{const n=e.action.payload,s=n.id||"modal_open_"+Math.random().toString(36).slice(2,9);return new Promise(i=>{const o={id:s,type:"open",title:n.title,content:n.content,size:n.size||"md",showCloseButton:n.showCloseButton!==!1,closableByBackdrop:n.closableByBackdrop!==!1,actions:n.actions,sourcePluginId:e.sourcePluginId,createdAt:Date.now(),resolve:a=>{i({actionId:a?.actionId,closed:a?.closed??!0})}};this.activeModals.push(o),this.notifyModalListeners()})}),this.registerHandler("host:modal:close",e=>{const n=e.action.payload;if(n.id)this.resolveModal(n.id,n.result??{closed:!0});else if(this.activeModals.length>0){const s=this.activeModals[this.activeModals.length-1];this.resolveModal(s.id,n.result??{closed:!0})}return{closed:!0}}),this.registerHandler("host:toast",e=>{const n=e.action.payload,s="toast_"+Math.random().toString(36).slice(2,9);try{Ne.getState().addToast({id:s,title:n.title,message:n.message,type:n.type||"info"})}catch(o){console.warn("[HostActionDispatcher] Failed to add toast:",o)}return{delivered:!0}}),this.registerHandler("host:navigate",e=>{const n=e.action.payload;try{Ne.getState().setTeacherTab(n.tab)}catch(i){console.warn("[HostActionDispatcher] Failed to navigate:",i)}return{navigated:!0}})}notifySubscribers(e,n,s){const i=o=>{o&&o.forEach(a=>{try{a(e,n,s)}catch(l){console.error("[HostActionDispatcher] Subscriber threw error:",l)}})};i(this.subscribers.get(e.action.type)),i(this.subscribers.get("*"))}}const Ul=new Np,Ep=({dispatcher:t})=>{const e=t||Ul,[n,s]=f.useState([]);if(f.useEffect(()=>{const x=e;if(typeof x.subscribeModals=="function"){const w=x.subscribeModals(v=>{s([...v])});return()=>{w.dispose()}}},[e]),f.useEffect(()=>{if(n.length===0)return;const x=w=>{if(w.key==="Escape"){const v=n[n.length-1],S=e;S.resolveModal&&(v.type==="confirm"?S.resolveModal(v.id,{confirmed:!1}):S.resolveModal(v.id,{closed:!0}))}};return window.addEventListener("keydown",x),()=>window.removeEventListener("keydown",x)},[n,e]),n.length===0)return null;const i=n[n.length-1],o=e,a=()=>{o.resolveModal?.(i.id,{confirmed:!0})},l=()=>{o.resolveModal?.(i.id,{confirmed:!1})},c=()=>{i.type==="confirm"?o.resolveModal?.(i.id,{confirmed:!1}):o.resolveModal?.(i.id,{closed:!0})},d=(x,w)=>{o.resolveModal?.(i.id,{actionId:x,closed:!!w})},m={sm:"max-w-sm",md:"max-w-md",lg:"max-w-xl",xl:"max-w-3xl",full:"max-w-5xl"}[i.size||"md"]||"max-w-md",p=()=>{switch(i.variant){case"danger":return r.jsx("div",{className:"w-10 h-10 rounded-full bg-red-100 text-red-600 flex items-center justify-center shrink-0",children:r.jsx(un,{size:20})});case"warning":return r.jsx("div",{className:"w-10 h-10 rounded-full bg-amber-100 text-amber-600 flex items-center justify-center shrink-0",children:r.jsx(Us,{size:20})});case"primary":default:return r.jsx("div",{className:"w-10 h-10 rounded-full bg-indigo-100 text-indigo-600 flex items-center justify-center shrink-0",children:r.jsx(tm,{size:20})})}},u=()=>{switch(i.variant){case"danger":return"bg-red-600 hover:bg-red-700 text-white shadow-xs focus:ring-red-500";case"warning":return"bg-amber-600 hover:bg-amber-700 text-white shadow-xs focus:ring-amber-500";case"primary":default:return"bg-indigo-600 hover:bg-indigo-700 text-white shadow-xs focus:ring-indigo-500"}},g=x=>{switch(x){case"danger":return"bg-red-600 hover:bg-red-700 text-white";case"secondary":return"bg-gray-100 hover:bg-gray-200 text-gray-700";case"ghost":return"hover:bg-gray-100 text-gray-600";case"primary":default:return"bg-indigo-600 hover:bg-indigo-700 text-white"}};return r.jsx("div",{role:"dialog","aria-modal":"true","aria-labelledby":"host-modal-title",className:"fixed inset-0 z-50 flex items-center justify-center p-4 bg-black/50 backdrop-blur-xs transition-opacity",onClick:x=>{x.target===x.currentTarget&&i.closableByBackdrop!==!1&&c()},children:r.jsxs("div",{className:`w-full ${m} bg-white rounded-2xl shadow-2xl border border-gray-100 overflow-hidden flex flex-col transform transition-all animate-in fade-in zoom-in-95 duration-150`,onClick:x=>x.stopPropagation(),children:[r.jsxs("div",{className:"flex items-center justify-between px-6 py-4 border-b border-gray-100",children:[r.jsxs("div",{className:"flex items-center gap-3",children:[i.type==="confirm"&&p(),r.jsx("h3",{id:"host-modal-title",className:"text-base font-bold text-gray-900 truncate",children:i.title})]}),i.showCloseButton!==!1&&r.jsx("button",{onClick:c,className:"p-1.5 text-gray-400 hover:text-gray-600 hover:bg-gray-100 rounded-lg transition-colors cursor-pointer","aria-label":"关闭",children:r.jsx(Ie,{size:18})})]}),r.jsx("div",{className:"px-6 py-4 overflow-y-auto max-h-[70vh]",children:i.type==="confirm"?r.jsx("p",{className:"text-sm text-gray-600 leading-relaxed",children:i.message}):i.content}),r.jsx("div",{className:"flex items-center justify-end gap-2.5 px-6 py-3.5 bg-gray-50/80 border-t border-gray-100",children:i.type==="confirm"?r.jsxs(r.Fragment,{children:[r.jsx("button",{onClick:l,className:"px-4 py-2 text-xs font-bold text-gray-600 bg-white border border-gray-200 hover:bg-gray-50 rounded-xl transition-all cursor-pointer shadow-2xs",children:i.cancelText||"取消"}),r.jsx("button",{onClick:a,className:`px-4 py-2 text-xs font-bold rounded-xl transition-all cursor-pointer focus:outline-hidden focus:ring-2 focus:ring-offset-2 ${u()}`,children:i.confirmText||"确定"})]}):i.actions&&i.actions.length>0?i.actions.map(x=>r.jsx("button",{onClick:()=>d(x.actionId,x.isClose),className:`px-4 py-2 text-xs font-bold rounded-xl transition-all cursor-pointer ${g(x.variant)}`,children:x.label},x.actionId)):r.jsx("button",{onClick:c,className:"px-4 py-2 text-xs font-bold text-gray-600 bg-white border border-gray-200 hover:bg-gray-50 rounded-xl transition-all cursor-pointer shadow-2xs",children:"关闭"})})]})})},Ui=f.createContext(null);function Pp({children:t,host:e}){return r.jsxs(Ui.Provider,{value:e,children:[t,r.jsx(Ep,{dispatcher:e?.getDispatcher?.()})]})}function Tp(){const t=f.useContext(Ui);if(!t)throw new Error("usePluginHost must be used within PluginHostProvider");return t}function Ip(){return f.useContext(Ui)}const Hl="openlearn:dashboardVisibility";function Ap(){try{const t=localStorage.getItem(Hl);if(t)return new Map(JSON.parse(t))}catch{}return new Map}function Vo(t){try{localStorage.setItem(Hl,JSON.stringify([...t.entries()]))}catch{}}const Le=Fi()((t,e)=>({activePlugins:[],extensionPoints:new Map,services:null,dashboardVisibility:Ap(),initialized:!1,initialize:n=>t({services:n,initialized:!0}),addPlugin:n=>t(s=>({activePlugins:[...s.activePlugins,n]})),removePlugin:n=>t(s=>({activePlugins:s.activePlugins.filter(i=>i.id!==n)})),updatePluginState:(n,s)=>t(i=>({activePlugins:i.activePlugins.map(o=>o.id===n?{...o,state:s}:o)})),registerExtensionPoint:(n,s)=>t(i=>{const o=i.extensionPoints.get(n)??[];if(o.find(c=>c.id===s.id)){const c=new Map(i.extensionPoints);return c.set(n,o.map(d=>d.id===s.id?s:d)),{extensionPoints:c}}const l=new Map(i.extensionPoints);return l.set(n,[...o,s]),{extensionPoints:l}}),unregisterExtensionPoint:(n,s)=>t(i=>{const o=i.extensionPoints.get(n);if(!o)return i;const a=o.filter(c=>c.id!==s),l=new Map(i.extensionPoints);return a.length===0?l.delete(n):l.set(n,a),{extensionPoints:l}}),unregisterPluginExtensionPoints:n=>t(s=>{const i=new Map(s.extensionPoints);for(const[o,a]of i){const l=a.filter(c=>c.pluginId!==n);l.length===0?i.delete(o):i.set(o,l)}return{extensionPoints:i}}),getExtensions:n=>[...e().extensionPoints.get(n)??[]].sort((i,o)=>(i.position??100)-(o.position??100)),setDashboardVisibility:(n,s)=>t(i=>{const o=new Map(i.dashboardVisibility);return o.set(n,s),Vo(o),{dashboardVisibility:o}}),setDashboardVisibilityBatch:n=>t(s=>{const i=new Map(s.dashboardVisibility);for(const[o,a]of n)i.set(o,a);return Vo(i),{dashboardVisibility:i}})}));function zp(t){return t.startsWith("http://")||t.startsWith("https://")||t.startsWith("data:image/")||t.startsWith("/")||t.startsWith("./")||/\.(svg|png|jpe?g|webp|gif|ico)(\?.*)?$/i.test(t)}function Lp(t){return!(!t||t.length>8||/^[a-zA-Z0-9_-]+$/.test(t))}function Rp(t){if(!t)return null;const e=ri;if(e[t])return e[t];const n=t.split(/[-_\s]+/).map(s=>s.charAt(0).toUpperCase()+s.slice(1)).join("");return e[n]?e[n]:null}function Gn({icon:t,size:e=18,className:n="shrink-0",fallback:s=jl,alt:i=""}){const[o,a]=f.useState(!1);if(!t)return r.jsx(s,{size:e,className:n});if(typeof t=="function"||typeof t=="object"&&t!==null&&"$$typeof"in t){const l=t;return r.jsx(l,{size:e,className:n})}if(typeof t=="string"){const l=t.trim();if(!l)return r.jsx(s,{size:e,className:n});if(zp(l))return o?r.jsx(s,{size:e,className:n}):r.jsx("img",{src:l,alt:i,style:{width:`${e}px`,height:`${e}px`},className:`object-contain rounded-xs ${n}`,onError:()=>a(!0),loading:"lazy"});if(Lp(l))return r.jsx("span",{className:`inline-flex items-center justify-center font-normal leading-none select-none ${n}`,style:{fontSize:`${Math.round(e*.95)}px`,width:`${e}px`,height:`${e}px`},"aria-hidden":!i,title:i,children:l});const c=Rp(l);if(c)return r.jsx(c,{size:e,className:n})}return r.jsx(s,{size:e,className:n})}function Kt(){return r.jsx("div",{className:"w-full h-32 bg-gray-100 rounded-xl animate-pulse flex items-center justify-center",children:r.jsxs("div",{className:"flex flex-col items-center gap-2",children:[r.jsx(Pt,{size:24,className:"text-gray-400 animate-spin"}),r.jsx("span",{className:"text-xs text-gray-400",children:"Loading..."})]})})}const ql=3,_p=300*1e3,Js=new Map;function Dp(t){const e=Date.now(),n=Js.get(t);if(!n||e-n.lastAt>_p)return Js.set(t,{count:1,lastAt:e,blown:!1}),{shouldBreak:!1,count:1};n.count+=1,n.lastAt=e;const s=n.count>=ql;return s&&(n.blown=!0),{shouldBreak:s,count:n.count}}function Mp(t){Js.delete(t)}function Uo(t){return Js.get(t)?.blown??!1}class Zt extends De.Component{constructor(e){super(e),this.state={hasError:!1},this.props=e}componentDidCatch(e){const n=this.props.pluginId;if(!n)return;const{shouldBreak:s,count:i}=Dp(n);if(console.error(`[ExtensionBreaker] Plugin "${n}" frontend crash #${i}/${ql}`+(s?" — 达到熔断阈值,自动停用":""),e?.message?.slice(0,120)),s)try{this.props.onBreakerTrip?.(n)}catch(o){console.error("[ExtensionBreaker] breaker trip callback failed:",o)}}static getDerivedStateFromError(){return{hasError:!0}}componentDidMount(){this.props.pluginId&&Mp(this.props.pluginId)}render(){return this.state.hasError?this.props.fallback??null:this.props.children}}function Ho({ext:t,route:e,slotProps:n,slot:s}){const i=De.useRef(null),o=JSON.stringify(n||{});De.useEffect(()=>{i.current&&typeof t.render=="function"&&(i.current.innerHTML="",Promise.resolve(t.render(i.current,{route:e,...n})).catch(console.error))},[t,e,o]);const l=s==="teacher.dashboard.widget"?"h-auto":"h-full min-h-0";return r.jsx("div",{ref:i,className:`w-full ${l}`})}const br=new WeakMap;function Yt(t){const e=t.component,n=br.get(e);if(n)return n;if(e.__isLazyFactory===!0){const s=De.lazy(e);return br.set(e,s),s}return br.set(e,e),e}function jt(t,e,n){if(n)return n;if(!t||typeof t.getDispatcher!="function")return;const s=t.getDispatcher();return typeof s?.createScopedDispatcher=="function"?s.createScopedDispatcher(e):s}function Oe({slot:t,fallback:e,lang:n,route:s,slotProps:i,placement:o}){const a=De.useRef(new Set),l=Ip(),c=Le(u=>u.activePlugins),d=Le(u=>u.dashboardVisibility),h=ue(u=>u.selectedLesson),m=ue(u=>u.liveClassSelectedClassId);if(!l)return e??null;let p=l.getExtensions(t);if(o&&(p=p.filter(u=>(u.placement??"after")===o)),p.length===0)return null;if(t==="class.tab"&&i?.renderType==="button")return r.jsx(r.Fragment,{children:p.map(u=>{const g=`plugin:${u.pluginId}/${u.id}`,x=i?.classActiveTab===g,w=u.title||u.label||u.id,v=c.find(b=>b.id===u.pluginId),S=u.icon||v?.icon;return r.jsxs("button",{onClick:b=>{b.stopPropagation(),i?.setClassActiveTab?.(g)},className:`py-1.5 px-3 rounded-lg text-xs font-semibold flex items-center justify-center gap-1.5 transition-all duration-200 cursor-pointer ${x?"bg-white text-indigo-600 shadow-xs font-bold border border-slate-200/50":"text-slate-500 hover:text-slate-800 hover:bg-white/40"}`,title:w,children:[r.jsx(Gn,{icon:S,size:12,className:"shrink-0",alt:w}),r.jsx("span",{children:w})]},`${u.pluginId}/${u.id}`)})});if(t==="class.tab"&&i?.renderType==="panel"){const u=i?.classActiveTab,g=p.find(x=>`plugin:${x.pluginId}/${x.id}`===u);return g?r.jsx(Zt,{pluginId:g.pluginId,fallback:r.jsx("div",{className:"bg-red-50 border border-red-200 rounded-lg p-4 text-sm text-red-700",children:"扩展 Tab 加载失败"}),children:r.jsx(f.Suspense,{fallback:r.jsx(Kt,{}),children:De.createElement(Yt(g),{classId:i?.classId,students:i?.students,lang:i?.lang,dispatcher:jt(l,g.pluginId,i?.dispatcher),...g.slotProps})})},`${g.pluginId}/${g.id}`):null}if(t==="timetable.tab"&&i?.renderType==="button")return r.jsx(r.Fragment,{children:p.map(u=>{const g=`plugin:${u.pluginId}/${u.id}`,x=i?.timetableActiveTab===g,w=u.title||u.label||u.id,v=c.find(b=>b.id===u.pluginId),S=u.icon||v?.icon;return r.jsxs("button",{onClick:b=>{b.stopPropagation(),i?.setTimetableActiveTab?.(g)},className:`px-3 py-1.5 rounded-lg text-xs font-semibold tracking-wide transition-all cursor-pointer flex items-center gap-1.5 ${x?"bg-white text-indigo-700 shadow-sm font-bold":"text-gray-500 hover:text-gray-800"}`,title:w,children:[r.jsx(Gn,{icon:S,size:14,className:"shrink-0",alt:w}),r.jsx("span",{children:w})]},`${u.pluginId}/${u.id}`)})});if(t==="timetable.tab"&&i?.renderType==="panel"){const u=i?.timetableActiveTab,g=p.find(x=>`plugin:${x.pluginId}/${x.id}`===u);return g?r.jsx(Zt,{pluginId:g.pluginId,fallback:r.jsx("div",{className:"bg-red-50 border border-red-200 rounded-lg p-4 text-sm text-red-700",children:"课表扩展 Tab 加载失败"}),children:r.jsx(f.Suspense,{fallback:r.jsx(Kt,{}),children:De.createElement(Yt(g),{classes:i?.classes,lessons:i?.lessons,lang:i?.lang,onSchedulesUpdated:i?.onSchedulesUpdated,onClassesUpdated:i?.onClassesUpdated,dispatcher:jt(l,g.pluginId,i?.dispatcher),...g.slotProps})})},`${g.pluginId}/${g.id}`):null}if(t==="admin.tab"&&i?.renderType==="button")return r.jsx(r.Fragment,{children:p.map(u=>{const g=`plugin:${u.pluginId}/${u.id}`,x=i?.adminActiveTab===g,w=u.title||u.label||u.id,v=c.find(b=>b.id===u.pluginId),S=u.icon||v?.icon;return r.jsxs("button",{onClick:b=>{b.stopPropagation(),i?.setAdminActiveTab?.(g)},className:`px-3.5 py-1.5 text-xs font-bold rounded-lg flex items-center gap-1.5 transition-all cursor-pointer ${x?"bg-white text-indigo-700 shadow-xs":"text-gray-500 hover:text-gray-800"}`,title:w,children:[r.jsx(Gn,{icon:S,size:14,className:"shrink-0",alt:w}),r.jsx("span",{children:w})]},`${u.pluginId}/${u.id}`)})});if(t==="admin.tab"&&i?.renderType==="panel"){const u=i?.adminActiveTab,g=p.find(x=>`plugin:${x.pluginId}/${x.id}`===u);return g?r.jsx(Zt,{pluginId:g.pluginId,fallback:r.jsx("div",{className:"bg-red-50 border border-red-200 rounded-lg p-4 text-sm text-red-700",children:"管理后台扩展 Tab 加载失败"}),children:r.jsx(f.Suspense,{fallback:r.jsx(Kt,{}),children:De.createElement(Yt(g),{currentUserId:i?.currentUserId,currentUserRole:i?.currentUserRole,lang:i?.lang,siteInfo:i?.siteInfo,aiProviders:i?.aiProviders,dispatcher:jt(l,g.pluginId,i?.dispatcher),...g.slotProps})})},`${g.pluginId}/${g.id}`):null}if(t==="student.profile.tab"&&i?.renderType==="button")return r.jsx(r.Fragment,{children:p.map(u=>{const g=`plugin:${u.pluginId}/${u.id}`,x=i?.studentActiveTab===g,w=u.title||u.label||u.id,v=c.find(b=>b.id===u.pluginId),S=u.icon||v?.icon;return r.jsxs("button",{onClick:b=>{b.stopPropagation(),i?.setStudentActiveTab?.(g)},className:`px-3 py-1.5 text-xs font-bold rounded-lg flex items-center gap-1.5 transition-all cursor-pointer ${x?"bg-surface text-primary-theme shadow-xs border border-theme/60":"text-muted hover:text-main"}`,title:w,children:[r.jsx(Gn,{icon:S,size:14,className:"shrink-0",alt:w}),r.jsx("span",{children:w})]},`${u.pluginId}/${u.id}`)})});if(t==="student.profile.tab"&&i?.renderType==="panel"){const u=i?.studentActiveTab,g=p.find(x=>`plugin:${x.pluginId}/${x.id}`===u);return g?r.jsx(Zt,{pluginId:g.pluginId,fallback:r.jsx("div",{className:"bg-red-50 border border-red-200 rounded-lg p-4 text-sm text-red-700",children:"学生画像扩展 Tab 加载失败"}),children:r.jsx(f.Suspense,{fallback:r.jsx(Kt,{}),children:De.createElement(Yt(g),{student:i?.student,lessonId:i?.lessonId,classId:i?.classId,lang:i?.lang,progressHistory:i?.progressHistory,dispatcher:jt(l,g.pluginId,i?.dispatcher),...g.slotProps})})},`${g.pluginId}/${g.id}`):null}if(t==="teacher.tab"&&i?.renderType==="button"){const u=[...p].sort((g,x)=>(g.position??100)-(x.position??100));return r.jsx(r.Fragment,{children:u.map(g=>{const x=`${g.pluginId}/${g.id}`,w=i?.teacherTab===x,v=g.title||g.label||g.id,S=c.find(C=>C.id===g.pluginId),b=g.icon||S?.icon;return r.jsxs("button",{onClick:()=>i?.setTeacherTab?.(x),id:`nav_btn_${x.replace(/[^a-zA-Z0-9_-]/g,"_")}`,className:`flex items-center gap-2.5 px-2.5 py-2 transition-colors text-sm font-medium rounded-xl cursor-pointer ${w?"bg-primary-theme-light text-primary-theme font-bold":"text-muted hover:bg-surface-secondary hover:text-main"} ${i?.mainNavCollapsed?"justify-center px-2":""}`,title:v,children:[r.jsx(Gn,{icon:b,size:18,className:"shrink-0",alt:v}),r.jsx("span",{className:i?.mainNavCollapsed?"hidden":"hidden md:block truncate",children:v})]},`${g.pluginId}/${g.id}`)})})}if(t==="whiteboard.renderer"){const u=i?.elementType;if(!u)return null;const g=p.find(v=>{const S=v;return S.targetType===u||v.id===u||v.route===u||`${v.pluginId}/${v.id}`===u||S.slotProps?.elementType===u||S.slotProps?.targetType===u});if(!g)return null;if(Uo(g.pluginId))return a.current.has(g.pluginId)||(a.current.add(g.pluginId),console.warn(`[ExtensionBreaker] Plugin "${g.pluginId}" 已熔断(连续崩溃 ≥3 次),跳过渲染。重新激活插件可恢复。`)),null;const x=typeof g.component=="function",w=typeof g.render=="function";return!x&&!w?null:r.jsx(Zt,{pluginId:g.pluginId,onBreakerTrip:v=>{l.deactivatePlugin(v).catch(S=>console.error(`[ExtensionBreaker] auto-deactivate "${v}" failed:`,S))},fallback:e??r.jsx("div",{className:"bg-red-50 border border-red-200 rounded-lg p-2 text-xs text-red-600 flex items-center justify-center",children:r.jsx("span",{children:n==="zh"?"自定义图元加载失败":"Custom object failed to load"})}),children:r.jsx(f.Suspense,{fallback:e??r.jsx(Kt,{}),children:x?De.createElement(Yt(g),{...g.slotProps,...i,dispatcher:jt(l,g.pluginId,i?.dispatcher)}):r.jsx(Ho,{ext:g,route:g.route||s,slotProps:{...g.slotProps,...i,dispatcher:jt(l,g.pluginId,i?.dispatcher)},slot:t})})},`${g.pluginId}/${g.id}`)}return r.jsx(r.Fragment,{children:p.map(u=>{const g=typeof u.component=="function",x=typeof u.render=="function";return t==="teacher.dashboard.widget"&&d.get(u.pluginId)===!1||!g&&!x?null:Uo(u.pluginId)?(a.current.has(u.pluginId)||(a.current.add(u.pluginId),console.warn(`[ExtensionBreaker] Plugin "${u.pluginId}" 已熔断(连续崩溃 ≥3 次),跳过渲染。重新激活插件可恢复。`)),null):r.jsx(Zt,{pluginId:u.pluginId,onBreakerTrip:w=>{l.deactivatePlugin(w).catch(v=>console.error(`[ExtensionBreaker] auto-deactivate "${w}" failed:`,v))},fallback:r.jsx("div",{className:"bg-red-50 border border-red-200 rounded-lg p-4 text-sm text-red-700",children:r.jsx("p",{children:n==="zh"?"扩展组件加载失败":"Extension failed to load"})}),children:r.jsx(f.Suspense,{fallback:e??r.jsx(Kt,{}),children:g?De.createElement(Yt(u),{route:u.route||s,lessonId:h,classId:m,dispatcher:jt(l,u.pluginId,i?.dispatcher),...u.slotProps,...i}):r.jsx(Ho,{ext:u,route:u.route||s,slotProps:{lessonId:h,classId:m,dispatcher:jt(l,u.pluginId,i?.dispatcher),...u.slotProps,...i},slot:t})})},`${u.pluginId}/${u.id}`)})})}const Op=({state:t,onToggleAnonymous:e,onOpenRubricModal:n,onToggleVoiceDanmaku:s,onAdvanceStage:i,onAddMinute:o,onTogglePauseTimer:a,isFullscreen:l,onToggleFullscreen:c,onClose:d})=>{const h=p=>{const u=Math.floor(Math.max(0,p)/60),g=Math.max(0,p)%60;return`${String(u).padStart(2,"0")}:${String(g).padStart(2,"0")}`},m=Math.round(t.completedReviews/Math.max(1,t.totalStudents)*100);return r.jsxs("div",{id:"peer-review-telemetry-header",className:"w-full bg-[#131b2e] border-b border-[#2d3449] px-6 py-3 flex flex-wrap items-center justify-between gap-4 select-none shrink-0",children:[r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("span",{className:"px-2 py-0.5 rounded bg-[#171f33] text-[#908fa0] text-[10px] font-mono font-semibold tracking-wider",children:"STAGE 02.4"}),r.jsxs("div",{className:"flex items-center gap-1.5 text-xs text-[#c7c4d7]",children:[r.jsx("span",{children:"随堂巩固"}),r.jsx(hn,{size:13,className:"text-[#908fa0]"}),r.jsx("span",{children:"收卷归档"}),r.jsx(hn,{size:13,className:"text-[#908fa0]"}),r.jsxs("span",{className:"text-[#4edea3] font-medium flex items-center gap-1",children:[r.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-[#4edea3] animate-ping"}),"全班大屏协同互评阶段 ",t.isLocked&&"(已锁定全班终端)"]})]})]}),r.jsx("div",{className:"h-4 w-[1px] bg-[#2d3449] hidden md:block"}),r.jsxs("div",{className:"hidden sm:flex items-center gap-1.5 px-2.5 py-1 rounded bg-[#00a572]/20 text-[#4edea3] text-xs font-medium border border-[#00a572]/30",children:[r.jsx(kl,{size:14,className:"text-[#4edea3]"}),r.jsxs("span",{children:["教室主大屏协同输出 ",t.isDualScreen?"(4K 双屏模式)":"(投影模式)"]})]})]}),r.jsxs("div",{className:"flex items-center gap-4 sm:gap-6",children:[r.jsxs("div",{className:"flex items-center gap-2 bg-[#060e20] px-3 py-1.5 rounded-xl border border-[#2d3449]/60",children:[r.jsx(nm,{size:18,className:"text-[#ffb95f] animate-pulse"}),r.jsxs("div",{className:"flex flex-col",children:[r.jsxs("div",{className:"flex items-center gap-1.5",children:[r.jsx("span",{className:"text-[10px] font-mono text-[#908fa0] leading-none",children:"COUNTDOWN"}),o&&r.jsx("button",{type:"button",onClick:o,className:"text-[10px] text-[#ffb95f] hover:text-[#ffddb8] font-mono transition-colors",title:"加时 1 分钟",children:"+1m"})]}),r.jsxs("div",{className:"flex items-center gap-1.5 mt-0.5",children:[r.jsxs("span",{className:"text-sm font-semibold font-mono text-[#dae2fd] leading-none",children:[h(t.timeRemainingSeconds),r.jsxs("span",{className:"text-[#908fa0] text-xs font-normal",children:[" / ",h(t.totalTimeSeconds)]})]}),a&&r.jsx("button",{type:"button",onClick:a,className:"text-[#c7c4d7] hover:text-white transition-colors",title:t.isPaused?"恢复倒计时":"暂停倒计时",children:t.isPaused?r.jsx(sm,{size:12,className:"text-[#4edea3]"}):r.jsx(rm,{size:12})})]})]})]}),r.jsxs("div",{className:"flex items-center gap-2.5",children:[r.jsxs("div",{className:"relative w-8 h-8 flex items-center justify-center",children:[r.jsxs("svg",{className:"w-8 h-8 -rotate-90",viewBox:"0 0 36 36",children:[r.jsx("path",{className:"text-[#2d3449]",d:"M18 2.0845 a 15.9155 15.9155 0 0 1 0 31.831 a 15.9155 15.9155 0 0 1 0 -31.831",fill:"none",stroke:"currentColor",strokeWidth:"3.5"}),r.jsx("path",{className:"text-[#4edea3] transition-all duration-500",d:"M18 2.0845 a 15.9155 15.9155 0 0 1 0 31.831 a 15.9155 15.9155 0 0 1 0 -31.831",fill:"none",stroke:"currentColor",strokeDasharray:`${m}, 100`,strokeLinecap:"round",strokeWidth:"3.5"})]}),r.jsxs("span",{className:"absolute text-[9px] font-mono text-[#dae2fd] font-semibold",children:[m,"%"]})]}),r.jsxs("div",{className:"flex flex-col",children:[r.jsx("span",{className:"text-[10px] font-mono text-[#908fa0] leading-none",children:"SUBMISSIONS"}),r.jsxs("span",{className:"text-xs font-medium text-[#dae2fd] mt-0.5",children:[t.completedReviews," / ",t.totalStudents," 人已评"]})]})]}),r.jsxs("div",{className:"hidden lg:flex items-center gap-2 bg-[#171f33] px-3 py-1.5 rounded-xl border border-[#2d3449]/60",children:[r.jsx(im,{size:16,className:"text-[#c0c1ff]"}),r.jsxs("div",{className:"flex flex-col",children:[r.jsx("span",{className:"text-[10px] font-mono text-[#908fa0] leading-none",children:"PEER REACTIONS"}),r.jsxs("span",{className:"text-xs font-mono font-medium text-[#c0c1ff] mt-0.5",children:[t.totalLikes," 次点赞 · ",t.totalNominations," 份提名"]})]})]})]}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsxs("label",{htmlFor:"toggle-anon",className:"flex items-center gap-2 cursor-pointer bg-[#171f33] px-2.5 py-1.5 rounded-xl hover:bg-[#222a3d] transition-colors border border-[#2d3449]/50",title:"开启后隐藏学生真实姓名",children:[r.jsx("input",{id:"toggle-anon",type:"checkbox",checked:t.isAnonymous,onChange:e,className:"sr-only peer"}),r.jsx("div",{className:"w-7 h-4 bg-[#2d3449] peer-checked:bg-[#4edea3] rounded-full relative transition-colors",children:r.jsx("div",{className:`w-3 h-3 bg-white rounded-full absolute top-0.5 left-0.5 transition-transform ${t.isAnonymous?"translate-x-3":""}`})}),r.jsx("span",{className:"text-xs text-[#c7c4d7] font-medium",children:"双盲匿名"})]}),r.jsxs("button",{type:"button",onClick:n,className:"flex items-center gap-1.5 px-3 py-1.5 rounded-xl bg-[#171f33] hover:bg-[#222a3d] text-[#c7c4d7] hover:text-[#dae2fd] transition-colors text-xs font-medium border border-[#2d3449]/50",children:[r.jsx(_i,{size:15,className:"text-[#ffb95f]"}),r.jsx("span",{children:"互评量规"})]}),r.jsxs("button",{type:"button",onClick:s,className:`flex items-center gap-1.5 px-3 py-1.5 rounded-xl transition-colors text-xs font-medium border ${t.showDanmaku?"bg-[#00a572]/20 border-[#00a572]/40 text-[#4edea3]":"bg-[#171f33] border-[#2d3449]/50 text-[#c7c4d7] hover:text-[#dae2fd]"}`,title:"开关大屏弹幕墙",children:[r.jsx(om,{size:15,className:"text-[#4edea3]"}),r.jsx("span",{children:"全员语音弹幕"})]}),r.jsxs("button",{type:"button",onClick:i,className:"flex items-center gap-2 px-3.5 py-1.5 rounded-xl bg-[#c0c1ff] text-[#1000a9] hover:bg-[#8083ff] hover:text-white transition-all shadow-sm text-xs font-semibold",children:[r.jsx(cs,{size:15}),r.jsx("span",{children:"揭晓勋章榜"}),r.jsx("span",{className:"font-mono text-[10px] bg-[#1000a9]/15 px-1 py-0.5 rounded leading-none",children:"Enter"})]}),r.jsx(Oe,{slot:"peer_review.action"}),c&&r.jsx("button",{type:"button",onClick:c,className:"p-1.5 rounded-xl text-[#c7c4d7] hover:text-white hover:bg-[#222a3d] transition-colors ml-1",title:l?"退出全屏":"全屏展示",children:l?r.jsx(ii,{size:16}):r.jsx(Di,{size:16})}),d&&r.jsx("button",{type:"button",onClick:d,className:"p-1.5 rounded-xl text-[#ffb4ab] hover:text-white hover:bg-[#93000a]/50 transition-colors ml-1",title:"关闭大屏互评",children:r.jsx(Ie,{size:16})})]})]})},$p=({matchingItems:t,badges:e,isAnonymous:n=!1,onSelectMatchingItem:s})=>{const i=(o,a)=>!a||o.length<=1?o:`${o[0]}**`;return r.jsxs("div",{id:"peer-review-matrix-panel",className:"flex flex-col gap-4 w-full select-none",children:[r.jsxs("div",{className:"bg-[#131b2e] p-4 rounded-xl border border-[#2d3449]/60 flex flex-col gap-2.5",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("div",{className:"w-7 h-7 rounded-lg bg-[#c0c1ff]/15 flex items-center justify-center text-[#c0c1ff]",children:r.jsx(Cl,{size:16})}),r.jsx("h2",{className:"text-sm font-semibold text-[#dae2fd]",children:"智能交叉互评"})]}),r.jsx("span",{className:"px-2 py-0.5 rounded bg-[#8083ff]/20 text-[#c0c1ff] font-mono text-[10px] font-semibold",children:"1生评2份"})]}),r.jsx("p",{className:"text-xs text-[#c7c4d7] leading-relaxed",children:"分层对调机制:将满分逻辑范本与攻坚调试作业交叉分发,激发逆向审阅与自愈思考。"})]}),r.jsxs("div",{className:"bg-[#131b2e] p-4 rounded-xl border border-[#2d3449]/60 flex flex-col gap-3",children:[r.jsxs("div",{className:"flex items-center justify-between text-xs",children:[r.jsx("span",{className:"text-[#908fa0] font-mono text-[10px] font-semibold",children:"PEER MATCHING REALTIME"}),r.jsxs("span",{className:"text-[#4edea3] font-mono text-[11px] flex items-center gap-1",children:[r.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-[#4edea3] animate-pulse"})," 实时同步中"]})]}),r.jsx("div",{className:"flex flex-col gap-2.5 max-h-[380px] overflow-y-auto pr-0.5",children:t.map(o=>{const a=i(o.reviewerName,n),l=i(o.targetStudentName,n);return r.jsxs("div",{onClick:()=>s?.(o),className:`p-3 rounded-lg border transition-all cursor-pointer ${o.status==="submitted"?"bg-[#222a3d] border-[#4edea3]/40 shadow-sm":"bg-[#171f33] border-[#2d3449]/60 hover:bg-[#222a3d] hover:border-[#464554]"}`,children:[r.jsxs("div",{className:"flex items-center justify-between mb-1.5",children:[r.jsxs("div",{className:"flex items-center gap-1.5",children:[r.jsx("span",{className:"font-mono text-[11px] text-[#ffb95f] font-semibold",children:o.code}),r.jsxs("span",{className:"text-xs text-[#dae2fd] font-semibold truncate max-w-[130px]",children:[a," ",o.reviewerGroup?`(${o.reviewerGroup})`:""]})]}),o.status==="submitted"&&r.jsx("span",{className:"text-[10px] font-mono px-1.5 py-0.5 rounded bg-[#00a572]/20 text-[#4edea3]",children:"已提交评语"}),o.status==="in_progress"&&r.jsx("span",{className:"text-[10px] font-mono px-1.5 py-0.5 rounded bg-[#ca8100]/20 text-[#ffb95f] animate-pulse",children:"正在推导 (2/3)"}),o.status==="completed"&&r.jsxs("span",{className:"text-[10px] font-mono px-1.5 py-0.5 rounded bg-[#00a572]/20 text-[#4edea3] flex items-center gap-1",children:[r.jsx(it,{size:10})," 已完成"]}),o.status==="improvement"&&r.jsx("span",{className:"text-[10px] font-mono px-1.5 py-0.5 rounded bg-[#c0c1ff]/20 text-[#c0c1ff]",children:"提出改进建议 💡"})]}),r.jsxs("div",{className:"flex items-center gap-1.5 text-xs text-[#c7c4d7] mb-1.5",children:[r.jsx(Hs,{size:12,className:"text-[#908fa0] shrink-0"}),r.jsxs("span",{className:"text-[#c0c1ff] font-medium truncate",children:[l," · ",o.targetWorkTitle]})]}),o.comment&&r.jsxs("div",{className:"bg-[#060e20] p-2 rounded text-xs text-[#c7c4d7] italic border border-[#2d3449]/40 mb-1.5 leading-relaxed",children:['"',o.comment,'"']}),o.progressPercent!==void 0&&o.status==="in_progress"&&r.jsx("div",{className:"w-full bg-[#2d3449] h-1 rounded-full mt-2 overflow-hidden",children:r.jsx("div",{className:"bg-[#ffb95f] h-full rounded-full transition-all duration-300",style:{width:`${o.progressPercent}%`}})}),o.stars!==void 0&&r.jsxs("div",{className:"flex items-center justify-between mt-1.5 pt-1.5 border-t border-[#2d3449]/50",children:[r.jsx("div",{className:"flex text-[#ffb95f]",children:Array.from({length:5}).map((c,d)=>r.jsx(qs,{size:13,className:d<o.stars?"text-[#ffb95f] fill-[#ffb95f]":"text-[#464554]"},d))}),r.jsxs("span",{className:"text-[10px] font-mono text-[#908fa0]",children:[o.score?.toFixed(1)||"5.0"," / ",o.maxScore||"5.0"]})]})]},o.id)})})]}),r.jsxs("div",{className:"bg-[#131b2e] p-4 rounded-xl border border-[#2d3449]/60 flex flex-col gap-2.5",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx("span",{className:"text-[10px] font-mono font-semibold text-[#908fa0]",children:"LIVE PEER BADGE STREAM"}),r.jsx(Mi,{size:14,className:"text-[#908fa0]"})]}),r.jsx("div",{className:"flex flex-col gap-2 overflow-hidden",children:e.map(o=>r.jsxs("div",{className:"flex items-center gap-2 p-2 rounded-lg bg-[#171f33] border border-[#2d3449]/50 text-xs text-[#dae2fd]",children:[r.jsx("span",{className:"text-sm shrink-0",children:o.emoji}),r.jsxs("div",{className:"truncate",children:[r.jsx("span",{className:"text-[#4edea3] font-medium",children:i(o.senderName,n)}),r.jsx("span",{className:"text-[#c7c4d7] mx-1",children:"为"}),r.jsx("span",{className:"text-[#c0c1ff] font-medium",children:i(o.receiverName,n)}),r.jsx("span",{className:"ml-1 px-1.5 py-0.5 bg-[#222a3d] rounded text-[10px] font-mono text-[#ffb95f]",children:o.badgeTitle})]})]},o.id))}),r.jsx(Oe,{slot:"peer_review.badge"})]})]})},Fp=({workA:t,workB:e,annotations:n,isAnonymous:s=!1,onFullscreenCanvas:i,onSyncSandboxToClass:o,onAddAnnotation:a})=>{const[l,c]=f.useState("visual"),[d,h]=f.useState(!1),[m,p]=f.useState(""),u=(x,w)=>!w||x.length<=1?x:`${x[0]}**`,g=x=>{x.preventDefault(),m.trim()&&(a?.(m.trim()),p(""),h(!1))};return r.jsxs("div",{id:"spotlight-dual-work-arena",className:"flex flex-col gap-4 w-full select-none",children:[r.jsxs("div",{className:"bg-[#131b2e] p-4 rounded-xl border border-[#2d3449]/60 flex flex-wrap items-center justify-between gap-3 shadow-md",children:[r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx("div",{className:"w-9 h-9 rounded-xl bg-[#8083ff]/20 flex items-center justify-center text-[#c0c1ff] border border-[#8083ff]/30",children:r.jsx(Nl,{size:20})}),r.jsxs("div",{className:"flex flex-col",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("h1",{className:"text-base font-bold text-[#dae2fd]",children:"大屏焦点作品对比赏析"}),r.jsxs("span",{className:"px-2 py-0.5 rounded bg-[#ca8100]/20 text-[#ffb95f] font-mono text-[10px] font-semibold flex items-center gap-1 border border-[#ca8100]/30",children:[r.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-[#ffb95f] animate-ping"}),"教师激光笔协同标记中"]})]}),r.jsxs("span",{className:"text-xs text-[#c7c4d7] mt-0.5",children:["标杆创新解法 (",u(t.studentName,s),") ⟷ 经典逆风翻盘解法 (",u(e.studentName,s),")"]})]})]}),r.jsxs("div",{className:"flex items-center gap-2",children:[o&&r.jsxs("button",{type:"button",onClick:o,className:"flex items-center gap-1.5 px-3 py-1.5 rounded-lg bg-[#171f33] hover:bg-[#222a3d] text-[#c7c4d7] hover:text-white border border-[#2d3449]/60 transition-colors text-xs font-medium",title:"将对比沙箱推送到全班学生机",children:[r.jsx(am,{size:14,className:"text-[#4edea3]"}),r.jsx("span",{children:"同步沙箱至全班"})]}),i&&r.jsx("button",{type:"button",onClick:i,className:"p-2 rounded-lg bg-[#171f33] hover:bg-[#222a3d] text-[#c7c4d7] hover:text-white border border-[#2d3449]/60 transition-colors",title:"全屏沉浸投影",children:r.jsx(Di,{size:16})})]})]}),r.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[r.jsxs("div",{className:"bg-[#131b2e] rounded-xl p-4 flex flex-col gap-3 border border-[#2d3449]/60 shadow-md relative",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{className:"flex items-center gap-2.5",children:[r.jsx("div",{className:"w-8 h-8 rounded-full bg-[#8083ff] text-white flex items-center justify-center font-bold text-xs shadow-sm",children:s?"A":t.studentInitial}),r.jsxs("div",{className:"flex flex-col",children:[r.jsxs("span",{className:"text-sm font-semibold text-[#dae2fd]",children:[u(t.studentName,s)," (作品 A)"]}),r.jsx("span",{className:"text-[11px] font-mono text-[#908fa0]",children:t.workSubtitle})]})]}),r.jsxs("div",{className:"flex items-center gap-1 px-2 py-0.5 rounded bg-[#ca8100]/20 text-[#ffb95f] border border-[#ca8100]/30",children:[r.jsx(qs,{size:13,className:"text-[#ffb95f] fill-[#ffb95f]"}),r.jsx("span",{className:"font-mono text-xs font-semibold",children:typeof t.rating=="number"?t.rating.toFixed(1):"—"}),r.jsxs("span",{className:"text-[10px] text-[#908fa0]",children:["(",t.reviewCount??0,"评)"]})]})]}),r.jsx("div",{className:"flex flex-wrap gap-1.5",children:t.badges.map((x,w)=>r.jsx("span",{className:`px-2 py-0.5 rounded text-[10px] font-mono font-medium ${x.colorClass}`,children:x.label},w))}),r.jsxs("div",{"data-testid":`work-preview-${t.slot}`,className:"w-full h-44 rounded-lg bg-[#060e20] flex flex-col justify-center relative overflow-hidden border border-[#2d3449]/60",children:[t.codeLines&&t.codeLines.length>0?r.jsx("pre",{className:"px-4 py-3 font-mono text-[11px] leading-5 text-[#dae2fd] overflow-y-auto max-h-full whitespace-pre-wrap break-words",children:t.codeLines.map((x,w)=>r.jsx("div",{className:x.isHighlight?"text-[#4edea3]":"",style:{paddingLeft:`${(x.indent||0)*12}px`},children:x.text},w))}):r.jsxs("div",{className:"flex flex-col items-center justify-center gap-2 px-6 text-center",children:[r.jsx(zo,{size:28,className:"text-[#4a5570]"}),r.jsxs("span",{className:"text-[11px] text-[#908fa0] leading-relaxed",children:["该作品没有可展示的作答内容",r.jsx("br",{}),r.jsx("span",{className:"text-[10px] opacity-70",children:"(原始作答流水为空或为纯数值型)"})]})]}),t.workContent&&r.jsxs("span",{className:"absolute bottom-2 right-2 text-[10px] font-mono text-[#908fa0] bg-[#131b2e]/90 px-1.5 py-0.5 rounded border border-[#2d3449]/50",children:["真实作答 · ",t.workContent.eventCount," 条事件"]})]}),t.codeLines?.some(x=>x.comment)?r.jsxs("div",{className:"bg-[#060e20] rounded-lg p-3 font-mono text-[11px] leading-5 border border-[#2d3449]/60 overflow-x-auto text-[#dae2fd]",children:[r.jsxs("div",{className:"text-[#908fa0] mb-1",children:["# ",t.codeTitle??""]}),t.codeLines.filter(x=>x.comment).map((x,w)=>r.jsx("div",{className:x.isHighlight?"bg-[#8083ff]/20 px-1 rounded -mx-1":"",children:r.jsx("span",{className:"text-[#908fa0]",children:x.comment})},w))]}):null]}),r.jsxs("div",{className:"bg-[#131b2e] rounded-xl p-4 flex flex-col gap-3 border border-[#2d3449]/60 shadow-md relative",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{className:"flex items-center gap-2.5",children:[r.jsx("div",{className:"w-8 h-8 rounded-full bg-[#00a572] text-white flex items-center justify-center font-bold text-xs shadow-sm",children:s?"B":e.studentInitial}),r.jsxs("div",{className:"flex flex-col",children:[r.jsxs("span",{className:"text-sm font-semibold text-[#dae2fd]",children:[u(e.studentName,s)," (作品 B)"]}),r.jsx("span",{className:"text-[11px] font-mono text-[#908fa0]",children:e.workSubtitle})]})]}),r.jsxs("div",{className:"flex items-center gap-1 px-2 py-0.5 rounded bg-[#ca8100]/20 text-[#ffb95f] border border-[#ca8100]/30",children:[r.jsx(qs,{size:13,className:"text-[#ffb95f] fill-[#ffb95f]"}),r.jsx("span",{className:"font-mono text-xs font-semibold",children:typeof e.rating=="number"?e.rating.toFixed(1):"—"}),r.jsxs("span",{className:"text-[10px] text-[#908fa0]",children:["(",e.reviewCount??0,"评)"]})]})]}),r.jsx("div",{className:"flex flex-wrap gap-1.5",children:e.badges.map((x,w)=>r.jsx("span",{className:`px-2 py-0.5 rounded text-[10px] font-mono font-medium ${x.colorClass}`,children:x.label},w))}),r.jsxs("div",{"data-testid":`work-preview-${e.slot}`,className:"w-full h-44 rounded-lg bg-[#060e20] flex flex-col justify-center relative overflow-hidden border border-[#2d3449]/60",children:[e.codeLines&&e.codeLines.length>0?r.jsx("pre",{className:"px-4 py-3 font-mono text-[11px] leading-5 text-[#dae2fd] overflow-y-auto max-h-full whitespace-pre-wrap break-words",children:e.codeLines.map((x,w)=>r.jsx("div",{className:x.isHighlight?"text-[#4edea3]":"",style:{paddingLeft:`${(x.indent||0)*12}px`},children:x.text},w))}):r.jsxs("div",{className:"flex flex-col items-center justify-center gap-2 px-6 text-center",children:[r.jsx(zo,{size:28,className:"text-[#4a5570]"}),r.jsxs("span",{className:"text-[11px] text-[#908fa0] leading-relaxed",children:["该作品没有可展示的作答内容",r.jsx("br",{}),r.jsx("span",{className:"text-[10px] opacity-70",children:"(原始作答流水为空或为纯数值型)"})]})]}),e.workContent&&r.jsxs("span",{className:"absolute bottom-2 right-2 text-[10px] font-mono text-[#908fa0] bg-[#131b2e]/90 px-1.5 py-0.5 rounded border border-[#2d3449]/50",children:["真实作答 · ",e.workContent.eventCount," 条事件"]})]}),e.codeLines?.some(x=>x.comment)?r.jsxs("div",{className:"bg-[#060e20] rounded-lg p-3 font-mono text-[11px] leading-5 border border-[#2d3449]/60 overflow-x-auto text-[#dae2fd]",children:[r.jsxs("div",{className:"text-[#908fa0] mb-1",children:["# ",e.codeTitle??""]}),e.codeLines.filter(x=>x.comment).map((x,w)=>r.jsx("div",{className:x.isSuccess?"bg-[#00a572]/20 px-1 rounded -mx-1":"",children:r.jsx("span",{className:"text-[#4edea3] text-[10px]",children:x.comment})},w))]}):null]})]}),r.jsxs("div",{className:"bg-[#131b2e] rounded-xl p-4 flex flex-col gap-3 border border-[#2d3449]/60 shadow-md",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(lm,{size:16,className:"text-[#ffb95f]"}),r.jsx("span",{className:"text-xs font-semibold text-[#dae2fd]",children:"协同板书标注与点评审阅"})]}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsxs("span",{className:"text-[10px] font-mono text-[#908fa0]",children:[n.length," 条实时批注挂载"]}),a&&r.jsx("button",{type:"button",onClick:()=>h(!d),className:"text-[11px] text-[#c0c1ff] hover:text-white font-medium transition-colors",children:d?"取消批注":"+ 追加教师批注"})]})]}),d&&r.jsxs("form",{onSubmit:g,className:"flex gap-2",children:[r.jsx("input",{type:"text",value:m,onChange:x=>p(x.target.value),placeholder:"输入大屏协同批注要点...",className:"flex-1 px-3 py-1.5 rounded-lg bg-[#060e20] border border-[#2d3449] text-xs text-[#dae2fd] placeholder-[#908fa0] focus:outline-none focus:border-[#8083ff]"}),r.jsx("button",{type:"submit",className:"px-3 py-1.5 rounded-lg bg-[#c0c1ff] text-[#1000a9] font-semibold text-xs hover:bg-[#8083ff] hover:text-white transition-colors",children:"发送批注"})]}),r.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-3",children:n.map(x=>r.jsxs("div",{className:"bg-[#171f33] p-3 rounded-lg flex flex-col gap-1.5 relative overflow-hidden border border-[#2d3449]/50",children:[r.jsx("div",{className:"w-1 absolute left-0 top-0 bottom-0",style:{backgroundColor:x.borderColor}}),r.jsxs("div",{className:"flex items-center justify-between pl-2",children:[r.jsxs("div",{className:"flex items-center gap-1.5",children:[r.jsx("span",{className:`px-1.5 py-0.5 rounded text-[10px] font-mono font-bold ${x.authorType==="teacher"?"bg-[#8083ff] text-white":"bg-[#00a572] text-white"}`,children:x.authorRole}),r.jsx("span",{className:"text-xs font-semibold text-[#dae2fd]",children:u(x.authorName,s)})]}),r.jsx("span",{className:"text-[10px] font-mono text-[#908fa0]",children:x.timeAgo})]}),r.jsx("p",{className:"text-xs text-[#dae2fd] pl-2 leading-relaxed",children:x.content})]},x.id))})]}),r.jsx(Oe,{slot:"peer_review.showcase.widget"})]})},Bp=({dimensions:t,averagePercentage:e,reactions:n,onReactionClick:s,syncedStudentsCount:i})=>r.jsxs("div",{id:"peer-review-rubric-stats",className:"bg-[#131b2e] rounded-xl p-4 flex flex-col gap-4 border border-[#2d3449]/60 shadow-md select-none w-full",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx("span",{className:"text-xs font-semibold text-[#dae2fd]",children:"全班三维量规综合达标率"}),r.jsxs("span",{className:"text-[11px] font-mono text-[#4edea3] font-semibold",children:["AVERAGE: ",typeof e=="number"?`${e.toFixed(1)}%`:"—"]})]}),r.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-3 gap-3",children:t.map(o=>r.jsxs("div",{className:"bg-[#171f33] p-2.5 rounded-lg flex flex-col gap-1.5 border border-[#2d3449]/50",children:[r.jsxs("div",{className:"flex justify-between text-xs",children:[r.jsx("span",{className:"text-[#908fa0] truncate",children:o.label}),r.jsxs("span",{className:`font-mono font-medium ${o.colorClass}`,children:[o.percentage,"%"]})]}),r.jsx("div",{className:"w-full bg-[#2d3449] h-1.5 rounded-full overflow-hidden",children:r.jsx("div",{className:`h-full rounded-full transition-all duration-500 ${o.barColorClass}`,style:{width:`${o.percentage}%`}})})]},o.id))}),r.jsx(Oe,{slot:"peer_review.rubric.dimension"}),r.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3 pt-1 border-t border-[#2d3449]/40",children:[r.jsx("div",{className:"flex items-center gap-2",children:n.map(o=>r.jsxs("button",{type:"button",onClick:()=>s?.(o.id),className:"flex items-center gap-1.5 px-3 py-1 rounded-full bg-[#171f33] hover:bg-[#222a3d] border border-[#2d3449]/60 transition-all text-xs text-[#dae2fd] active:scale-95 group",children:[r.jsx("span",{children:o.emoji}),r.jsx("span",{className:"font-medium group-hover:text-white",children:o.label}),r.jsxs("span",{className:`font-mono font-semibold ${o.colorClass}`,children:["+",o.count]})]},o.id))}),r.jsxs("span",{className:"text-[10px] font-mono text-[#908fa0] flex items-center gap-1",children:[r.jsx(Ws,{size:13,className:"text-[#4edea3]"}),typeof i=="number"?`${i}台学生端已同步点赞动画`:"学生端同步状态未知"]})]})]}),Vp=({podiumStudents:t,isAnonymous:e=!1,onAwardPeerReviewPoints:n,onArchiveTopWorks:s,onCallStudentMic:i,onInviteScreenShare:o,onAdvanceToStage3:a})=>{const l=(c,d)=>!d||c.length<=1?c:`${c[0]}**`;return r.jsxs("div",{id:"peer-review-leaderboard-panel",className:"flex flex-col gap-4 w-full select-none",children:[r.jsxs("div",{className:"bg-[#131b2e] p-4 rounded-xl border border-[#2d3449]/60 flex flex-col gap-3 shadow-md",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(cm,{size:18,className:"text-[#ffb95f]"}),r.jsx("h2",{className:"text-sm font-semibold text-[#dae2fd]",children:"互评推荐先锋榜"})]}),r.jsx("span",{className:"text-[10px] font-mono text-[#908fa0] font-semibold",children:"TOP NOMINATED"})]}),r.jsx("div",{className:"flex flex-col gap-2.5",children:t.map(c=>r.jsxs("div",{className:`p-3 rounded-lg border transition-all ${c.rank===1?"bg-[#222a3d] border-[#ffb95f]/40 shadow-sm":"bg-[#171f33] border-[#2d3449]/50 hover:bg-[#222a3d]"} flex flex-col gap-1.5`,children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("span",{className:`w-5 h-5 rounded-full font-mono text-[11px] font-bold flex items-center justify-center ${c.rankBadgeClass}`,children:c.rank}),r.jsx("span",{className:"text-xs font-semibold text-[#dae2fd]",children:l(c.name,e)})]}),r.jsxs("span",{className:"font-mono text-xs font-semibold text-[#ffb95f]",children:[c.votes," 票推荐"]})]}),r.jsxs("div",{className:"flex items-center justify-between text-xs",children:[r.jsx("span",{className:"text-[#c7c4d7] truncate max-w-[140px]",children:c.workTitle}),r.jsx("span",{className:`px-1.5 py-0.5 rounded text-[10px] font-mono font-medium ${c.tagBadgeClass}`,children:c.honorTitle})]})]},c.rank))})]}),r.jsxs("div",{className:"bg-[#131b2e] p-4 rounded-xl border border-[#2d3449]/60 flex flex-col gap-3 shadow-md",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx("span",{className:"text-xs font-semibold text-[#dae2fd]",children:"随堂微勋章即时分发箱"}),r.jsx(cs,{size:15,className:"text-[#4edea3]"})]}),r.jsxs("div",{className:"flex flex-col gap-2",children:[r.jsxs("button",{type:"button",onClick:n,className:"w-full flex items-center justify-between px-3 py-2 rounded-lg bg-[#171f33] hover:bg-[#222a3d] border border-[#2d3449]/50 text-[#dae2fd] transition-colors text-xs text-left",children:[r.jsxs("span",{className:"flex items-center gap-2",children:[r.jsx(ot,{size:14,className:"text-[#ffb95f]"}),r.jsx("span",{children:"为全员互评认真学生 +2 积分"})]}),r.jsx("span",{className:"font-mono text-[10px] text-[#4edea3] font-semibold bg-[#00a572]/20 px-1.5 py-0.5 rounded",children:"一键发放"})]}),r.jsxs("button",{type:"button",onClick:s,className:"w-full flex items-center justify-between px-3 py-2 rounded-lg bg-[#171f33] hover:bg-[#222a3d] border border-[#2d3449]/50 text-[#dae2fd] transition-colors text-xs text-left",children:[r.jsxs("span",{className:"flex items-center gap-2",children:[r.jsx(rr,{size:14,className:"text-[#c0c1ff]"}),r.jsx("span",{children:"TOP 2 优秀代码入库数字馆"})]}),r.jsx("span",{className:"font-mono text-[10px] text-[#c0c1ff] font-semibold bg-[#8083ff]/20 px-1.5 py-0.5 rounded",children:"入库归档"})]})]})]}),r.jsxs("div",{className:"bg-[#131b2e] p-4 rounded-xl border border-[#2d3449]/60 flex flex-col gap-3 shadow-md",children:[r.jsx("span",{className:"text-[10px] font-mono text-[#908fa0] font-semibold",children:"TEACHER BROADCAST & STAGE TRANSITION"}),r.jsx("div",{className:"flex flex-col gap-2",children:(()=>{const c=t[0]?.name,d=t[1]?.name??c;return r.jsxs(r.Fragment,{children:[r.jsxs("button",{type:"button",disabled:!c,onClick:()=>c&&i(c),className:"w-full flex items-center justify-between px-3 py-2 rounded-lg bg-[#171f33] hover:bg-[#222a3d] border border-[#2d3449]/50 text-[#dae2fd] transition-colors text-xs text-left disabled:opacity-40 disabled:cursor-not-allowed",children:[r.jsxs("span",{className:"flex items-center gap-2",children:[r.jsx(oi,{size:14,className:"text-[#c0c1ff]"}),r.jsx("span",{children:c?`连麦作者 ${l(c,e)} (分享思路)`:"暂无提名,无法连麦"})]}),r.jsx("span",{className:"text-[#908fa0] text-[10px] font-mono",children:"连线"})]}),r.jsxs("button",{type:"button",disabled:!d,onClick:()=>d&&o(d),className:"w-full flex items-center justify-between px-3 py-2 rounded-lg bg-[#171f33] hover:bg-[#222a3d] border border-[#2d3449]/50 text-[#dae2fd] transition-colors text-xs text-left disabled:opacity-40 disabled:cursor-not-allowed",children:[r.jsxs("span",{className:"flex items-center gap-2",children:[r.jsx(kl,{size:14,className:"text-[#4edea3]"}),r.jsx("span",{children:d?`邀请 ${l(d,e)} 投屏分享`:"暂无提名,无法投屏"})]}),r.jsx("span",{className:"text-[#908fa0] text-[10px] font-mono",children:"邀请"})]})]})})()}),r.jsx(Oe,{slot:"peer_review.action"}),r.jsxs("div",{className:"pt-2",children:[r.jsxs("button",{type:"button",onClick:a,className:"w-full flex items-center justify-center gap-2 py-3 px-4 rounded-xl bg-[#c0c1ff] text-[#1000a9] hover:bg-[#8083ff] hover:text-white transition-all shadow-md group font-semibold text-xs text-center",children:[r.jsx("span",{children:"结束互评,公布全堂总积分榜与学情报告"}),r.jsx(Hs,{size:14,className:"group-hover:translate-x-1 transition-transform"})]}),r.jsx("div",{className:"text-center mt-2",children:r.jsx("span",{className:"text-[10px] font-mono text-[#908fa0]",children:"HOTKEY: PRESS ENTER TO ADVANCE TO STAGE 03"})})]})]})]})},Up=({isVisible:t,danmakuList:e,onSendDanmaku:n,isAnonymous:s=!1})=>{const[i,o]=f.useState(""),[a,l]=f.useState(!1);if(!t)return null;const c=h=>{h.preventDefault(),i.trim()&&(n?.(i.trim(),"text"),o(""))},d=()=>{n?.("语音弹幕 · 点赞神仙算法!","voice")};return r.jsxs("div",{id:"peer-review-danmaku-overlay",className:"absolute inset-0 pointer-events-none overflow-hidden z-20",children:[e.map(h=>r.jsx("div",{className:"absolute whitespace-nowrap animate-danmaku-slide pointer-events-auto",style:{top:`${h.topPercent}%`,right:"-100%"},children:r.jsxs("div",{className:"flex items-center gap-1.5 px-3 py-1 rounded-full bg-[#131b2e]/85 backdrop-blur-md border border-[#2d3449] shadow-lg text-xs text-[#dae2fd]",children:[h.type==="voice"?r.jsxs("span",{className:"flex items-center gap-1 text-[#4edea3] font-mono text-[11px]",children:[r.jsx(oi,{size:12,className:"animate-pulse"}),r.jsxs("span",{children:[h.voiceDuration||3,"s"]})]}):r.jsx("span",{className:"text-sm",children:"💬"}),r.jsxs("span",{className:"text-[#c0c1ff] font-medium",children:[s&&h.sender.length>1?`${h.sender[0]}**`:h.sender,":"]}),r.jsx("span",{className:h.color||"text-white",children:h.text})]})},h.id)),r.jsx("div",{className:"absolute bottom-4 right-4 pointer-events-auto flex items-center gap-2",children:a?r.jsxs("form",{onSubmit:c,className:"flex items-center gap-1.5 bg-[#131b2e]/95 backdrop-blur-md border border-[#2d3449] p-1.5 rounded-full shadow-xl",children:[r.jsx("input",{type:"text",value:i,onChange:h=>o(h.target.value),placeholder:"发送大屏实时弹幕...",className:"bg-transparent px-3 py-1 text-xs text-white placeholder-[#908fa0] focus:outline-none w-48"}),r.jsx("button",{type:"submit",className:"p-1.5 rounded-full bg-[#c0c1ff] text-[#1000a9] hover:bg-white transition-colors",title:"发送",children:r.jsx(dm,{size:13})}),r.jsx("button",{type:"button",onClick:d,className:"p-1.5 rounded-full bg-[#171f33] hover:bg-[#222a3d] text-[#4edea3] transition-colors",title:"发送语音弹幕",children:r.jsx(oi,{size:13})}),r.jsx("button",{type:"button",onClick:()=>l(!1),className:"px-2 text-xs text-[#908fa0] hover:text-white",children:"收起"})]}):r.jsxs("button",{type:"button",onClick:()=>l(!0),className:"flex items-center gap-1.5 px-3 py-1.5 rounded-full bg-[#131b2e]/90 hover:bg-[#222a3d] backdrop-blur-md border border-[#2d3449] text-xs text-[#c7c4d7] hover:text-white shadow-lg transition-colors cursor-pointer",children:[r.jsx(El,{size:13,className:"text-[#c0c1ff]"}),r.jsx("span",{children:"发弹幕"})]})})]})},Hp=({isOpen:t,onClose:e})=>t?r.jsx("div",{id:"peer-review-rubric-modal",className:"fixed inset-0 z-50 flex items-center justify-center bg-black/70 backdrop-blur-sm p-4 select-none",children:r.jsxs("div",{className:"bg-[#131b2e] border border-[#2d3449] rounded-2xl w-full max-w-2xl shadow-2xl overflow-hidden flex flex-col max-h-[85vh]",children:[r.jsxs("div",{className:"px-6 py-4 bg-[#171f33] border-b border-[#2d3449] flex items-center justify-between",children:[r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx("div",{className:"w-8 h-8 rounded-xl bg-[#ca8100]/20 text-[#ffb95f] flex items-center justify-center border border-[#ca8100]/30",children:r.jsx(_i,{size:18})}),r.jsxs("div",{children:[r.jsx("h2",{className:"text-sm font-bold text-[#dae2fd]",children:"随堂交叉互评量规细则"}),r.jsx("p",{className:"text-[11px] text-[#908fa0]",children:"三维评价基准 · 激励互助逆向思考"})]})]}),r.jsx("button",{type:"button",onClick:e,className:"p-1.5 rounded-lg text-[#908fa0] hover:text-white hover:bg-[#222a3d] transition-colors",children:r.jsx(Ie,{size:18})})]}),r.jsxs("div",{className:"p-6 flex flex-col gap-4 overflow-y-auto",children:[r.jsxs("div",{className:"bg-[#171f33] rounded-xl p-4 border border-[#2d3449]/60 flex flex-col gap-2",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("span",{className:"w-6 h-6 rounded-lg bg-[#8083ff]/20 text-[#c0c1ff] font-mono text-xs font-bold flex items-center justify-center",children:"1"}),r.jsx("span",{className:"text-sm font-semibold text-[#dae2fd]",children:"算法逻辑正确性 (40% 权重)"})]}),r.jsx("span",{className:"text-[10px] font-mono text-[#4edea3] bg-[#00a572]/20 px-2 py-0.5 rounded",children:"全班达标率 98%"})]}),r.jsxs("ul",{className:"text-xs text-[#c7c4d7] space-y-1.5 pl-8 list-disc",children:[r.jsxs("li",{children:[r.jsx("strong",{className:"text-white",children:"5.0分(优秀):"}),"算法逻辑自适应,无死循环或边界越界,自适应笔触与角度动态计算完全闭合。"]}),r.jsxs("li",{children:[r.jsx("strong",{className:"text-white",children:"4.0分(良好):"}),"核心功能正常,少数极端情况存在未自增或微小卡顿。"]}),r.jsxs("li",{children:[r.jsx("strong",{className:"text-white",children:"3.0分(需改进):"}),"存在语法报错或死循环,需在互评中指明行号与修复要点。"]})]})]}),r.jsxs("div",{className:"bg-[#171f33] rounded-xl p-4 border border-[#2d3449]/60 flex flex-col gap-2",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("span",{className:"w-6 h-6 rounded-lg bg-[#00a572]/20 text-[#4edea3] font-mono text-xs font-bold flex items-center justify-center",children:"2"}),r.jsx("span",{className:"text-sm font-semibold text-[#dae2fd]",children:"代码规范与缩进 (30% 权重)"})]}),r.jsx("span",{className:"text-[10px] font-mono text-[#4edea3] bg-[#00a572]/20 px-2 py-0.5 rounded",children:"全班达标率 96%"})]}),r.jsxs("ul",{className:"text-xs text-[#c7c4d7] space-y-1.5 pl-8 list-disc",children:[r.jsxs("li",{children:[r.jsx("strong",{className:"text-white",children:"5.0分(优秀):"}),"遵循 PEP8 规范,严格对齐 4 空格缩进,变量语义化规范清晰,关键算子附有说明注释。"]}),r.jsxs("li",{children:[r.jsx("strong",{className:"text-white",children:"4.0分(良好):"}),"缩进基本统一,可读性良好。"]}),r.jsxs("li",{children:[r.jsx("strong",{className:"text-white",children:"3.0分(需改进):"}),"Tab 与空格混用,循环体代码未有效缩进。"]})]})]}),r.jsxs("div",{className:"bg-[#171f33] rounded-xl p-4 border border-[#2d3449]/60 flex flex-col gap-2",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("span",{className:"w-6 h-6 rounded-lg bg-[#ca8100]/20 text-[#ffb95f] font-mono text-xs font-bold flex items-center justify-center",children:"3"}),r.jsx("span",{className:"text-sm font-semibold text-[#dae2fd]",children:"创意美感与拓展 (30% 权重)"})]}),r.jsx("span",{className:"text-[10px] font-mono text-[#ffb95f] bg-[#ca8100]/20 px-2 py-0.5 rounded",children:"全班达标率 92%"})]}),r.jsxs("ul",{className:"text-xs text-[#c7c4d7] space-y-1.5 pl-8 list-disc",children:[r.jsxs("li",{children:[r.jsx("strong",{className:"text-white",children:"5.0分(优秀):"}),"巧妙运用数学模运算(`i % 3`)或外角定理,呈现层次丰富的动态发散图形。"]}),r.jsxs("li",{children:[r.jsx("strong",{className:"text-white",children:"4.0分(良好):"}),"图形规则美观,配色和谐。"]}),r.jsxs("li",{children:[r.jsx("strong",{className:"text-white",children:"3.0分(需改进):"}),"单色基础图形,未探索步长或角度变化。"]})]})]}),r.jsx(Oe,{slot:"peer_review.rubric.dimension"})]}),r.jsx("div",{className:"px-6 py-3 bg-[#171f33] border-t border-[#2d3449] flex justify-end",children:r.jsx("button",{type:"button",onClick:e,className:"px-4 py-1.5 rounded-xl bg-[#c0c1ff] text-[#1000a9] font-semibold text-xs hover:bg-white transition-colors",children:"我已知晓"})})]})}):null;function qp(t){if(!Array.isArray(t)||t.length===0)return null;let e=0,n=0;for(const s of t){const i=s,o=Number(i.score??i.percentage??i.value);if(!Number.isFinite(o))continue;const a=Number(i.weight??0);!Number.isFinite(a)||a<=0||(e+=o*a,n+=a)}return n<=0?null:Math.round(e/n*10)/10}const Wp=({isOpen:t,onClose:e,onAdvanceToStage3:n,lessonTitle:s="",addToast:i,workA:o,workB:a,reviewProgress:l,countdownSeconds:c,onAutoAssign:d,autoAssigning:h=!1,matchingItems:m,badges:p,annotations:u,rubricDimensions:g,reactions:x,podiumStudents:w,danmaku:v,syncedStudentsCount:S,teacherName:b,stageLabel:C})=>{const[N,y]=f.useState({stage:C||"",isLocked:!0,isDualScreen:!0,isAnonymous:!0,timeRemainingSeconds:c??0,totalTimeSeconds:c??0,isPaused:!1,completedReviews:l?.completed??0,totalStudents:l?.total??0,totalLikes:0,totalNominations:0,showVoiceDanmaku:!0,showDanmaku:!0}),[P,L]=f.useState(!1),[_,O]=f.useState(!1),[T,A]=f.useState(m??[]),[R,D]=f.useState(p??[]),[I,$]=f.useState(o??null),[U,E]=f.useState(a??null),[F,j]=f.useState(u??[]),[B]=f.useState(g??[]),[X,k]=f.useState(x??[]),[q]=f.useState(w??[]),[J,G]=f.useState(v??[]);f.useEffect(()=>{if(!t||N.isPaused)return;const Z=setInterval(()=>{y(pe=>pe.timeRemainingSeconds<=1?{...pe,timeRemainingSeconds:0,isPaused:!0}:{...pe,timeRemainingSeconds:pe.timeRemainingSeconds-1})},1e3);return()=>clearInterval(Z)},[t,N.isPaused]);const re=f.useCallback(Z=>{t&&(Z.key==="Enter"?(Z.preventDefault(),se()):Z.key==="Escape"?(Z.preventDefault(),e()):Z.code==="Space"&&Z.target===document.body&&(Z.preventDefault(),ee()))},[t,e]);if(f.useEffect(()=>(window.addEventListener("keydown",re),()=>window.removeEventListener("keydown",re)),[re]),!t)return null;const Y=()=>{y(Z=>({...Z,isAnonymous:!Z.isAnonymous})),i?.("互评模式已切换",N.isAnonymous?"已恢复显示真实学生姓名":"已开启双盲匿名评价模式","info")},ye=()=>{y(Z=>({...Z,timeRemainingSeconds:Z.timeRemainingSeconds+60,totalTimeSeconds:Z.totalTimeSeconds+60})),i?.("互评加时","倒计时已增加 1 分钟","success")},ee=()=>{y(Z=>({...Z,isPaused:!Z.isPaused}))},z=()=>{document.fullscreenElement?document.exitFullscreen&&(document.exitFullscreen().catch(()=>{}),L(!1)):(document.documentElement.requestFullscreen().catch(()=>{}),L(!0))},W=Z=>{k(pe=>pe.map(le=>le.id===Z?{...le,count:le.count+1}:le)),y(pe=>({...pe,totalLikes:pe.totalLikes+1}))},K=Z=>{const pe={id:`ann-${Date.now()}`,authorType:"teacher",authorRole:"主讲教师",authorName:b||"教师",timeAgo:"刚刚",content:Z,borderColor:"#8083ff"};j(le=>[pe,...le]),i?.("批注已挂载","协同板书批注已同步至大屏","success")},ne=(Z,pe="text")=>{const le={id:`d-${Date.now()}`,sender:b||"教师",text:Z,type:pe,voiceDuration:void 0,topPercent:Math.floor(Math.random()*60)+15,color:"text-[#4edea3]"};G(he=>[...he,le])},te=()=>{i?.("微勋章已分发","已向全员认真参与互评的学生批量发放 +2 过程性积分!","success")},me=()=>{const Z=[I?.studentName,U?.studentName].filter(Boolean);i?.("作品已入库",Z.length>0?`${Z.join(" 与 ")}的优秀作品已收录进班级数字展览馆。`:"暂无焦点作品可入库(学生尚未提交)。","success")},je=Z=>{i?.("连麦请求已发起",`正在向 ${Z} 的学生端发起实时语音连麦...`,"info")},Q=Z=>{i?.("投屏邀请已下发",`已向 ${Z} 发送大屏投屏演示邀请。`,"info")},se=()=>{i?.("互评阶段已结束","正在推进至 Stage 03 结课巡查与全堂总积分榜...","success"),n&&n(),e()};return r.jsxs("div",{id:"peer-review-showcase-modal",className:"fixed inset-0 z-[9999] bg-[#0b1326] text-[#dae2fd] flex flex-col select-none overflow-hidden font-sans",children:[r.jsx(Op,{state:N,onToggleAnonymous:Y,onOpenRubricModal:()=>O(!0),onToggleVoiceDanmaku:()=>y(Z=>({...Z,showDanmaku:!Z.showDanmaku})),onAdvanceStage:se,onAddMinute:ye,onTogglePauseTimer:ee,isFullscreen:P,onToggleFullscreen:z,onClose:e}),r.jsxs("main",{className:"relative flex-1 overflow-y-auto w-full px-6 py-5",children:[!I&&!U&&T.length===0&&q.length===0&&r.jsxs("div",{className:"mb-4 rounded-xl border border-[#2d3449] bg-[#0b1326] px-4 py-2.5 flex items-center gap-3 text-[11px] text-[#908fa0]",children:[r.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-amber-400 shrink-0"}),r.jsx("span",{className:"flex-1",children:"本节暂无可展示的互评数据(需至少 2 份学生提交作品)。点击右侧按钮按「1 生评 2 份」自动分配。"}),d&&r.jsx("button",{type:"button",disabled:h,onClick:()=>void d(),className:"px-3 py-1 rounded-lg bg-[#8083ff] text-white text-[11px] font-bold hover:bg-[#9497ff] transition-colors disabled:opacity-50 shrink-0",children:h?"分配中…":"一键分配互评"})]}),r.jsx(Up,{isVisible:N.showDanmaku,danmakuList:J,onSendDanmaku:ne,isAnonymous:N.isAnonymous}),r.jsxs("div",{className:"grid grid-cols-12 gap-5 items-start",children:[r.jsx("div",{className:"col-span-12 lg:col-span-3",children:r.jsx($p,{matchingItems:T,badges:R,isAnonymous:N.isAnonymous,onSelectMatchingItem:Z=>{i?.(`查看互评明细 ${Z.code}`,`${Z.reviewerName} 正在审阅 ${Z.targetStudentName} 的作业`,"info")}})}),r.jsxs("div",{className:"col-span-12 lg:col-span-6 flex flex-col gap-4",children:[!I&&!U&&r.jsxs("div",{className:"rounded-xl border border-dashed border-[#2d3449] bg-[#0b1326] p-6 text-center",children:[r.jsx("p",{className:"text-xs font-bold text-[#dae2fd]",children:"暂无提交作品可供对比"}),r.jsx("p",{className:"text-[10px] text-[#908fa0] mt-1",children:"学生提交课件作业后,此处将自动展示两份真实作品的并排对比。"})]}),I||U?r.jsx(Fp,{workA:I,workB:U,annotations:F,isAnonymous:N.isAnonymous,onFullscreenCanvas:z,onSyncSandboxToClass:()=>{i?.("沙箱广播已生效",`对比范本已同步至全班 ${N.totalStudents||0} 台学生机控制台`,"success")},onAddAnnotation:K}):null,r.jsx(Bp,{dimensions:B,averagePercentage:qp(B),reactions:X,onReactionClick:W,syncedStudentsCount:S})]}),r.jsx("div",{className:"col-span-12 lg:col-span-3",children:r.jsx(Vp,{podiumStudents:q,isAnonymous:N.isAnonymous,onAwardPeerReviewPoints:te,onArchiveTopWorks:me,onCallStudentMic:je,onInviteScreenShare:Q,onAdvanceToStage3:se})})]})]}),r.jsx(Hp,{isOpen:_,onClose:()=>O(!1)})]})};let mn=null;const ui=new Set;function Wl(t){mn=t;for(const e of ui)try{e(t)}catch(n){console.error("[socket-service] socket-ready listener error:",n)}}function Hi(t){return mn?(t(mn),()=>{}):(ui.add(t),()=>{ui.delete(t)})}function Gp(){if(!mn)throw new Error("Socket instance not initialized. Call setSocketInstance() first.");return mn}function tt(){return mn}class Qp{constructor(e){this.socket=e,Wl(e)}emit(e,...n){this.socket.emit(e,...n)}on(e,n){this.socket.on(e,n)}off(e,n){this.socket.off(e,n)}disconnect(){this.socket.disconnect()}}const Ts={stage:"IN_CLASS_TEACHING",checkinCode:null,activePoll:null,activeBuzzer:null,pacing:{TOO_FAST:0,CONFUSED:0,CLEAR:0},classId:null,sessionId:null,stageStartedAt:null,attendance:{online:0,onlineInClass:0,expected:0,attended:0},feed:[],courseware:{attempts:0,participants:0,completed:0,avgCompletion:0},exitTicketSubmitted:0},Jp=["classroom:stage_changed","classroom:quick_poll_started","classroom:quick_poll_updated","classroom:quick_poll_closed","classroom:buzzer_ready","classroom:buzzer_winner","classroom:buzzer_reset","classroom:pacing_updated","classroom:countdown_updated","classroom:exit_ticket_submitted","classroom:feed_appended","classroom:pulse_check_requested"],Kp=4e3;function Zp(t,e={}){const{enabled:n=!0,reconcileMs:s=Kp}=e,[i,o]=f.useState(Ts),[a,l]=f.useState("polling"),[c,d]=f.useState(null),h=f.useRef(0),m=f.useRef(!0);f.useEffect(()=>(m.current=!0,()=>{m.current=!1}),[]);const p=f.useCallback(async()=>{if(!t)return;const u=++h.current;try{const g=await fetch(`/api/classroom/stage/${encodeURIComponent(t)}/data`);if(!g.ok)throw new Error(`stage data HTTP ${g.status}`);const x=await g.json();if(!m.current||u!==h.current)return;o({...Ts,...x,pacing:{...Ts.pacing,...x.pacing||{}}}),d(Date.now()),l(w=>w==="reconnecting"?"live":w==="error"?"polling":w)}catch(g){if(!m.current)return;l(x=>x==="live"?"reconnecting":x),console.warn("[StageDisplay] sync failed:",g)}},[t]);return f.useEffect(()=>{if(!n||!t)return;p();const u=setInterval(()=>void p(),s);return()=>clearInterval(u)},[n,t,s,p]),f.useEffect(()=>{if(!n||!t)return;let u=null;const g=()=>{u||(u=setTimeout(()=>{u=null,p()},120))};let x=null;const w=Hi(v=>{x?.(),v.emit("join-room",t),v.emit("join-room","classroom-broadcast");const S=Jp.map(y=>{const P=L=>{const _=L?.lessonId;_&&_!==t||g()};return v.on(y,P),[y,P]}),b=()=>{l("live"),p()},C=()=>l("reconnecting"),N=()=>l("reconnecting");v.on("connect",b),v.on("disconnect",C),v.on("connect_error",N),v.connected&&l("live"),x=()=>{for(const[y,P]of S)v.off(y,P);v.off("connect",b),v.off("disconnect",C),v.off("connect_error",N)}});return()=>{w(),x?.(),u&&clearTimeout(u)}},[n,t,p]),{data:i,health:a,lastSyncedAt:c,refresh:p}}const Yp={PRE_CLASS_READY:{zh:"课前就绪 · 准备上课",en:"Pre-Class Preparation"},IN_CLASS_TEACHING:{zh:"课中授课 · 互动探索",en:"Interactive Teaching"},WRAP_UP_EXIT_TICKET:{zh:"总结提升 · 结课通票",en:"Wrap-Up & Exit Ticket"},ARCHIVED_REPORT:{zh:"下课归档 · 学情简报",en:"Archived Report"}};function qi(t,e="zh"){const n=Yp[t];return n?e==="zh"?n.zh:n.en:t}let qo=0;function Ct(t){return qo+=1,`${t}-${Date.now().toString(36)}-${qo}`}function Xp(t,e,n={}){const{lang:s="zh",isFirstFrame:i=!1}=n,o=s==="zh",a=[];if(!t||i)return a;if(t.stage!==e.stage){const u=qi(e.stage,s),g=e.stage==="ARCHIVED_REPORT",x=e.stage==="WRAP_UP_EXIT_TICKET";let w;x?w=o?"请提醒学生在设备上完成 60 秒结课通票":"Remind students to complete the 60s exit ticket":g&&(w=o?"本课节已归档,大屏将展示学情简报":"Lesson archived; the stage will show the learning report");let v="info",S="🎓";x?(v="accent",S="🎫"):g&&(v="warning",S="📦"),a.push({id:Ct("stage"),tone:v,icon:S,title:o?`课堂环节已切换:${u}`:`Stage changed: ${u}`,detail:w,dedupeKey:`stage:${e.stage}`})}const l=t.activePoll?.id??null,c=e.activePoll?.id??null;if(c&&c!==l)a.push({id:Ct("poll-start"),tone:"accent",icon:"⚡",title:o?"课堂极速投票已开始":"Quick poll started",detail:e.activePoll?.title?String(e.activePoll.title):void 0,dedupeKey:`poll-start:${c}`});else if(l&&!c){const u=t.activePoll?.totalVotes??0;a.push({id:Ct("poll-end"),tone:"info",icon:"📊",title:o?"课堂投票已结束":"Quick poll closed",detail:o?`本轮共 ${u} 人作答`:`${u} responded in this round`,dedupeKey:`poll-end:${l}`})}const d=t.activeBuzzer?.id??null,h=e.activeBuzzer?.id??null,m=t.activeBuzzer?.status??null,p=e.activeBuzzer?.status??null;if(h&&h!==d)a.push({id:Ct("buzz-start"),tone:"accent",icon:"🔔",title:o?"抢答已开始":"Buzz-in started",detail:e.activeBuzzer?.title?String(e.activeBuzzer.title):void 0,dedupeKey:`buzz-start:${h}`});else if(h&&h===d&&p==="LOCKED"&&m!=="LOCKED"){const u=e.activeBuzzer?.winnerName,g=e.activeBuzzer?.responseTimeMs;a.push({id:Ct("buzz-winner"),tone:"success",icon:"🏆",title:o?"抢答已产生赢家":"Buzz-in winner decided",detail:u?o?`${u}${g?` · 响应用时 ${g} 毫秒`:""}`:`${u}${g?` · ${g} ms`:""}`:void 0,dedupeKey:`buzz-winner:${h}`})}else h&&h===d&&p==="READY"&&m==="LOCKED"&&a.push({id:Ct("buzz-reset"),tone:"info",icon:"♻️",title:o?"抢答已重置,可以开始新一轮":"Buzzer reset — ready for a new round",dedupeKey:`buzz-reset:${h}`});return a}function eg(t,e,n="zh"){const s=n==="zh";return t===e?null:t==="reconnecting"?{id:Ct("conn"),tone:"warning",icon:"📡",title:s?"实时连接已断开,正在重连":"Live connection lost, reconnecting…",detail:s?"大屏内容可能不是最新,将以低频轮询兜底":"Falling back to low-frequency polling",dedupeKey:"conn:reconnecting"}:t==="live"&&e==="reconnecting"?{id:Ct("conn"),tone:"success",icon:"✅",title:s?"实时连接已恢复":"Live connection restored",dedupeKey:"conn:live"}:null}const Wo={info:{ring:"border-sky-500/50 bg-sky-500/10 text-sky-200",icon:Pl},success:{ring:"border-emerald-500/50 bg-emerald-500/10 text-emerald-200",icon:it},warning:{ring:"border-amber-500/50 bg-amber-500/10 text-amber-200",icon:un},accent:{ring:"border-indigo-500/50 bg-indigo-500/10 text-indigo-200",icon:ot}},tg=6e3,Go=8e3;function ng({notices:t,onDismiss:e,lang:n="zh"}){const s=t.slice(-4),i=f.useRef(new Map);return f.useEffect(()=>{for(const a of s){if(i.current.has(a.id))continue;const l=setTimeout(()=>{i.current.delete(a.id),e(a.id)},tg);i.current.set(a.id,l)}const o=new Set(s.map(a=>a.id));for(const[a,l]of i.current)o.has(a)||(clearTimeout(l),i.current.delete(a))},[s,e]),f.useEffect(()=>()=>{for(const o of i.current.values())clearTimeout(o);i.current.clear()},[]),s.length===0?null:r.jsx("div",{"aria-live":"polite","data-testid":"stage-notice-stack",className:"fixed top-24 right-8 z-[10000] flex flex-col gap-2.5 w-[360px] pointer-events-none",children:s.map(o=>{const a=Wo[o.tone]??Wo.info,l=a.icon;return r.jsxs("div",{"data-testid":"stage-notice","data-dedupe-key":o.dedupeKey,className:`pointer-events-auto flex items-start gap-3 px-4 py-3 rounded-2xl border backdrop-blur-md shadow-2xl animate-slide-up ${a.ring}`,children:[r.jsx("span",{className:"text-xl leading-none shrink-0 mt-0.5","aria-hidden":"true",children:o.icon}),r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(l,{size:14,className:"shrink-0"}),r.jsx("span",{className:"text-sm font-bold truncate",children:o.title})]}),o.detail&&r.jsx("p",{className:"text-xs opacity-80 mt-1 line-clamp-2",children:o.detail})]}),r.jsx("button",{onClick:()=>e(o.id),"aria-label":n==="zh"?"关闭提示":"Dismiss",className:"shrink-0 p-1 rounded-lg opacity-60 hover:opacity-100 hover:bg-white/10 transition-colors cursor-pointer",children:r.jsx(Ie,{size:14})})]},o.id)})})}function sg(t="zh"){const[e,n]=f.useState([]),s=f.useRef(new Map),i=f.useCallback(l=>{if(l.length===0)return;const c=Date.now();n(d=>{let h=d;for(const m of l){const p=s.current.get(m.dedupeKey);if(!(p&&c-p<Go)){s.current.set(m.dedupeKey,c);for(const[u,g]of s.current)c-g>Go&&s.current.delete(u);h=[...h,m]}}return h.length>40?h.slice(h.length-40):h})},[]),o=f.useCallback(l=>{n(c=>c.filter(d=>d.id!==l))},[]),a=f.useCallback(()=>n([]),[]);return{notices:e,push:i,dismiss:o,clear:a}}function rg({health:t,lastSyncedAt:e,lang:n="zh"}){const s=n==="zh",o={live:{label:s?"实时连接":"Live",cls:"text-emerald-300 border-emerald-500/40 bg-emerald-500/10",dot:"bg-emerald-400 animate-pulse",Icon:Ws},reconnecting:{label:s?"重连中":"Reconnecting",cls:"text-amber-300 border-amber-500/40 bg-amber-500/10",dot:"bg-amber-400 animate-ping",Icon:Lo},polling:{label:s?"轮询同步":"Polling",cls:"text-sky-300 border-sky-500/40 bg-sky-500/10",dot:"bg-sky-400",Icon:Ws},error:{label:s?"连接异常":"Error",cls:"text-rose-300 border-rose-500/40 bg-rose-500/10",dot:"bg-rose-400",Icon:Lo}}[t],a=o.Icon,l=e?new Date(e).toLocaleTimeString():"--:--:--";return r.jsxs("div",{"data-testid":"stage-connection-badge","data-health":t,className:`flex items-center gap-2 px-3 py-2 rounded-xl border font-semibold text-xs ${o.cls}`,title:s?`最近同步:${l}`:`Last sync: ${l}`,children:[r.jsx("span",{className:`w-2 h-2 rounded-full ${o.dot}`}),r.jsx(a,{size:13}),r.jsx("span",{children:o.label}),r.jsx("span",{className:"font-mono opacity-70",children:l})]})}function ig(){if(typeof document>"u")return!1;const t=document.documentElement;return!!(t.requestFullscreen||t.webkitRequestFullscreen)}function ps(){return typeof document>"u"?!1:!!(document.fullscreenElement||document.webkitFullscreenElement)}function og(){const[t,e]=f.useState(!1),[n,s]=f.useState(!1),i=f.useRef(!1);f.useEffect(()=>{if(typeof document>"u")return;const c=()=>{const d=ps();s(d),d||(i.current=!1,e(!1))};return document.addEventListener("fullscreenchange",c),document.addEventListener("webkitfullscreenchange",c),()=>{document.removeEventListener("fullscreenchange",c),document.removeEventListener("webkitfullscreenchange",c)}},[]),f.useEffect(()=>{if(typeof window>"u")return;const c=d=>{d.key==="Escape"&&(ps()||i.current&&(i.current=!1,e(!1)))};return window.addEventListener("keydown",c),()=>window.removeEventListener("keydown",c)},[]);const o=f.useCallback(async()=>{if(e(!0),!ig()){i.current=!0;return}try{const c=document.documentElement;await(c.requestFullscreen?.()??c.webkitRequestFullscreen?.()),s(!0)}catch(c){i.current=!0,console.warn("[ViewportFullscreen] native fullscreen rejected, falling back to viewport fill:",c)}},[]),a=f.useCallback(async()=>{if(i.current=!1,e(!1),s(!1),ps())try{await document.exitFullscreen?.()}catch(c){console.warn("[ViewportFullscreen] exit failed:",c)}},[]),l=f.useCallback(()=>{ps()||i.current?a():o()},[o,a]);return{isFullscreen:t,nativeActive:n,toggle:l,exit:a}}function wt(t){return typeof t=="number"&&Number.isFinite(t)?String(t):"—"}function ts(t,e){return!e||e<=0?"—":`${Math.round(t/e*100)}%`}function ag({attendance:t,zh:e=!0}){const n=t?.onlineInClass??0,s=t?.expected??0,i=t?.attended??0,o=ts(n,s),a=s>0;return r.jsxs("div",{className:"bg-slate-900/90 rounded-3xl border border-slate-800 p-6 shadow-xl flex flex-col gap-4",children:[r.jsxs("div",{className:"flex items-center justify-between border-b border-slate-800/80 pb-3",children:[r.jsxs("div",{className:"flex items-center gap-2 text-white font-bold text-base",children:[r.jsx(vl,{size:18,className:"text-blue-400"}),r.jsx("span",{children:e?"课堂出勤":"Attendance"})]}),r.jsxs("span",{"data-testid":"stage-attendance-online",className:"flex items-center gap-1.5 text-xs font-semibold text-emerald-300",children:[r.jsx("span",{className:"w-2 h-2 rounded-full bg-emerald-400 animate-pulse"}),e?"实时在线":"Online"," ",wt(n)]})]}),r.jsxs("div",{className:"grid grid-cols-3 gap-3 text-center",children:[r.jsxs("div",{className:"bg-slate-800/50 rounded-2xl border border-slate-700/50 py-3",children:[r.jsx("div",{className:"text-2xl font-black font-mono text-white",children:wt(n)}),r.jsx("div",{className:"text-[11px] text-slate-400 mt-1",children:e?"本班在线":"Online"})]}),r.jsxs("div",{className:"bg-slate-800/50 rounded-2xl border border-slate-700/50 py-3",children:[r.jsx("div",{className:"text-2xl font-black font-mono text-white",children:wt(i)}),r.jsx("div",{className:"text-[11px] text-slate-400 mt-1",children:e?"已到课":"Attended"})]}),r.jsxs("div",{className:"bg-slate-800/50 rounded-2xl border border-slate-700/50 py-3",children:[r.jsx("div",{className:"text-2xl font-black font-mono text-white",children:wt(s)}),r.jsx("div",{className:"text-[11px] text-slate-400 mt-1",children:e?"应到":"Expected"})]})]}),a?r.jsxs(r.Fragment,{children:[r.jsxs("div",{className:"flex items-center justify-between text-xs text-slate-400",children:[r.jsx("span",{children:e?"实到率":"Attendance rate"}),r.jsx("span",{className:"font-mono font-bold text-white",children:ts(i,s)})]}),r.jsx("div",{className:"h-3 w-full bg-slate-800 rounded-full overflow-hidden",children:r.jsx("div",{className:"h-full bg-blue-500 rounded-full transition-all duration-500",style:{width:ts(i,s)}})}),r.jsxs("div",{className:"flex items-center justify-between text-xs text-slate-400",children:[r.jsx("span",{children:e?"当前在线率":"Live online rate"}),r.jsx("span",{className:"font-mono font-bold text-emerald-300",children:o})]})]}):r.jsx("p",{className:"text-[11px] text-slate-500 leading-relaxed",children:e?"本课节未绑定班级名单,暂无应到/实到口径(避免用 0% 误导为「无人到课」)。":"No class roster bound to this lesson; expected/attended is unavailable."})]})}function lg({stats:t,zh:e=!0}){const n=t?.attempts??0,s=t?.participants??0,i=t?.completed??0,o=t?.avgCompletion??0,a=n>0;return r.jsxs("div",{className:"bg-slate-900/90 rounded-3xl border border-slate-800 p-6 shadow-xl flex flex-col gap-4",children:[r.jsxs("div",{className:"flex items-center justify-between border-b border-slate-800/80 pb-3",children:[r.jsxs("div",{className:"flex items-center gap-2 text-white font-bold text-base",children:[r.jsx(um,{size:18,className:"text-amber-400"}),r.jsx("span",{children:e?"互动课件参与":"Courseware Activity"})]}),a&&r.jsxs("span",{className:"text-xs text-slate-400 font-mono",children:[n," ",e?"次作答":"attempts"]})]}),a?r.jsxs(r.Fragment,{children:[r.jsxs("div",{className:"grid grid-cols-3 gap-3 text-center",children:[r.jsxs("div",{className:"bg-slate-800/50 rounded-2xl border border-slate-700/50 py-3",children:[r.jsx("div",{className:"text-2xl font-black font-mono text-white",children:wt(s)}),r.jsx("div",{className:"text-[11px] text-slate-400 mt-1",children:e?"参与人数":"Students"})]}),r.jsxs("div",{className:"bg-slate-800/50 rounded-2xl border border-slate-700/50 py-3",children:[r.jsx("div",{className:"text-2xl font-black font-mono text-white",children:wt(i)}),r.jsx("div",{className:"text-[11px] text-slate-400 mt-1",children:e?"已完成":"Completed"})]}),r.jsxs("div",{className:"bg-slate-800/50 rounded-2xl border border-slate-700/50 py-3",children:[r.jsxs("div",{className:"text-2xl font-black font-mono text-white",children:[wt(o),"%"]}),r.jsx("div",{className:"text-[11px] text-slate-400 mt-1",children:e?"平均完成度":"Avg done"})]})]}),r.jsxs("div",{className:"flex items-center justify-between text-xs text-slate-400",children:[r.jsx("span",{children:e?"完成率":"Completion rate"}),r.jsx("span",{className:"font-mono font-bold text-white",children:ts(i,n)})]}),r.jsx("div",{className:"h-3 w-full bg-slate-800 rounded-full overflow-hidden",children:r.jsx("div",{className:"h-full bg-amber-500 rounded-full transition-all duration-500",style:{width:ts(i,n)}})})]}):r.jsxs("p",{className:"text-[11px] text-slate-500 leading-relaxed flex items-center gap-2",children:[r.jsx(_i,{size:14,className:"shrink-0"}),e?"本课节还没有学生打开互动课件,作答数据将在学生开始操作后实时出现。":"No courseware activity yet."]})]})}const cg={quiz_answered:"✅",checkin:"🙋",achievement:"🏅",assignment_submitted:"📄",assignment_graded:"🖊️",progress:"📈",courseware_submitted:"🖥️",answer:"💡",success:"🎉",info:"ℹ️"};function dg({feed:t,zh:e=!0}){const n=t??[];return r.jsxs("div",{className:"bg-slate-900/90 rounded-3xl border border-slate-800 p-6 shadow-xl flex flex-col gap-3",children:[r.jsxs("div",{className:"flex items-center justify-between border-b border-slate-800/80 pb-3",children:[r.jsxs("div",{className:"flex items-center gap-2 text-white font-bold text-base",children:[r.jsx(Mi,{size:18,className:"text-blue-400"}),r.jsx("span",{children:e?"课堂动态":"Live Feed"})]}),r.jsxs("span",{className:"text-xs text-slate-400 font-mono",children:[n.length," ",e?"条":"items"]})]}),n.length>0?r.jsx("ul",{className:"flex flex-col gap-1.5 max-h-64 overflow-y-auto no-scrollbar",children:n.map(s=>r.jsxs("li",{className:"flex items-start gap-2 text-xs text-slate-300 px-2 py-1.5 rounded-lg hover:bg-slate-800/50 transition-colors",children:[r.jsx("span",{"aria-hidden":"true",className:"shrink-0",children:cg[s.type]??"•"}),r.jsxs("span",{className:"flex-1 leading-relaxed break-words",children:[s.actorName?r.jsx("span",{className:"font-bold text-white",children:s.actorName}):null,r.jsx("span",{className:"ml-1",children:s.message})]}),s.at>0&&r.jsx("span",{className:"shrink-0 font-mono text-[10px] text-slate-500",children:new Date(s.at).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})})]},s.id))}):r.jsxs("p",{className:"text-[11px] text-slate-500 leading-relaxed flex items-center gap-2",children:[r.jsx(Oi,{size:14,className:"shrink-0"}),e?"课堂动态会在学生答题、签到、提交课件时实时出现在这里。":"Live events will appear here."]})]})}function ug({submitted:t,expected:e,zh:n=!0}){const s=t??0,i=e??0;return r.jsxs("div",{className:"flex items-center justify-between text-xs text-slate-400",children:[r.jsxs("span",{className:"flex items-center gap-1.5",children:[r.jsx(hm,{size:13,className:"text-indigo-400"}),n?"结课通票已提交":"Exit tickets submitted"]}),r.jsxs("span",{className:"font-mono font-bold text-white",children:[wt(s),i>0?` / ${wt(i)}`:""]})]})}function hg({lessonId:t,lessonTitle:e="互动课堂",data:n,lang:s="zh",health:i,lastSyncedAt:o,showCloseButton:a=!0,onClose:l,peerReview:c,syncedStudentsCount:d,peerReviewOpen:h,onOpenPeerReview:m,onClosePeerReview:p}){const{isFullscreen:u,toggle:g}=og(),[x,w]=f.useState(""),[v,S]=f.useState(!1),b=h??v,C=P=>{h===void 0&&S(P),P?m?.():p?.()};f.useEffect(()=>{const P=()=>{w(new Date().toLocaleTimeString([],{hour:"2-digit",minute:"2-digit",second:"2-digit"}))};P();const L=setInterval(P,1e3);return()=>clearInterval(L)},[]);const N=n.pacing??Ts.pacing,y=(N.TOO_FAST||0)+(N.CONFUSED||0)+(N.CLEAR||0);return r.jsxs("div",{id:"stage-display-modal",className:"fixed inset-0 z-[9999] bg-slate-950 text-slate-100 flex flex-col select-none overflow-hidden",children:[r.jsxs("header",{className:"h-20 px-8 bg-slate-900/80 border-b border-slate-800 flex items-center justify-between backdrop-blur-md",children:[r.jsxs("div",{className:"flex items-center gap-4",children:[r.jsxs("div",{className:"flex items-center gap-2.5 px-3 py-1.5 bg-blue-500/10 border border-blue-500/30 rounded-full text-blue-400 font-semibold text-sm",children:[r.jsx("span",{className:"w-2.5 h-2.5 rounded-full bg-blue-400 animate-ping"}),r.jsx("span",{children:s==="zh"?"大屏教学展台":"Stage Display"})]}),r.jsx("h1",{className:"text-2xl font-bold tracking-tight text-white line-clamp-1",children:e}),r.jsx("span",{className:"px-3 py-1 bg-slate-800 text-slate-300 text-xs font-mono rounded-md border border-slate-700",children:qi(n.stage,s)})]}),r.jsxs("div",{className:"flex items-center gap-6",children:[i&&r.jsx(rg,{health:i,lastSyncedAt:o??null,lang:s}),r.jsxs("div",{className:"flex items-center gap-2 px-4 py-2 bg-slate-800/60 rounded-xl border border-slate-700/60 font-mono text-xl font-bold text-slate-200",children:[r.jsx(Tl,{size:20,className:"text-blue-400"}),r.jsx("span",{children:x})]}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Oe,{slot:"stage.display.action",slotProps:{lessonId:t,lessonTitle:e,stage:n.stage,data:n,isFullscreen:u,lang:s,onToggleFullscreen:g,onOpenPeerReview:()=>C(!0)}}),r.jsxs("button",{id:"stage-peer-review-toggle",type:"button",onClick:()=>C(!0),className:"flex items-center gap-1.5 px-3 py-2 bg-teal-500/20 hover:bg-teal-500/30 text-teal-300 rounded-xl transition-colors border border-teal-500/40 text-xs font-semibold cursor-pointer",title:"进入全班大屏作业互评与协同赏析模式 (Stitch 21e2dac1)",children:[r.jsx(Nl,{size:15}),r.jsx("span",{children:"作业互评赏析"})]}),r.jsx("button",{id:"stage-fullscreen-toggle",onClick:g,className:"p-3 bg-slate-800 hover:bg-slate-700 text-slate-300 rounded-xl transition-colors border border-slate-700 cursor-pointer",title:u?"退出全屏":"全屏展示",children:u?r.jsx(fm,{size:20}):r.jsx(mm,{size:20})}),a&&r.jsx("button",{id:"stage-close-button",onClick:l,className:"p-3 bg-rose-900/40 hover:bg-rose-900/70 text-rose-300 rounded-xl transition-colors border border-rose-800/50 cursor-pointer",title:"关闭展台",children:r.jsx(Ie,{size:20})})]})]})]}),r.jsx(Oe,{slot:"classroom.stage.display.ticker",slotProps:{lessonId:t,lessonTitle:e,stage:n.stage,data:n,lang:s}}),r.jsxs("main",{className:"flex-1 p-8 grid grid-cols-12 gap-8 overflow-y-auto",children:[r.jsxs("section",{className:"col-span-8 flex flex-col gap-6",children:[n.stage==="PRE_CLASS_READY"&&r.jsxs("div",{className:"flex-1 bg-gradient-to-br from-slate-900 to-slate-850 rounded-3xl border border-slate-800 p-10 flex flex-col justify-center items-center text-center shadow-2xl",children:[r.jsx("div",{className:"p-4 bg-blue-500/10 rounded-3xl border border-blue-500/20 text-blue-400 mb-6",children:r.jsx(Oi,{size:48,className:"animate-pulse"})}),r.jsx("h2",{className:"text-3xl font-extrabold text-white mb-2",children:s==="zh"?"即将开始上课,请同学们准备":"Class Starting Soon"}),r.jsx("p",{className:"text-slate-400 text-lg mb-8 max-w-md",children:s==="zh"?"请打开平板或电脑进入课堂,输入口令加入":"Please join the interactive session using your device"}),n.checkinCode&&r.jsxs("div",{className:"px-10 py-6 bg-slate-800/90 rounded-2xl border border-blue-500/40 shadow-inner flex flex-col items-center",children:[r.jsx("span",{className:"text-xs uppercase tracking-widest text-slate-400 font-bold mb-2",children:s==="zh"?"课堂入课口令":"Class Code"}),r.jsx("span",{className:"text-6xl font-mono font-black tracking-wider text-blue-400",children:n.checkinCode})]})]}),n.activePoll&&r.jsxs("div",{className:"bg-slate-900/90 rounded-3xl border border-slate-800 p-8 shadow-xl flex flex-col gap-6",children:[r.jsxs("div",{className:"flex items-center justify-between border-b border-slate-800/80 pb-4",children:[r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx("span",{className:"p-2.5 bg-amber-500/10 text-amber-400 rounded-xl border border-amber-500/20",children:r.jsx(ot,{size:24})}),r.jsxs("div",{children:[r.jsx("span",{className:"text-xs font-bold text-amber-400 uppercase tracking-wide",children:s==="zh"?"课堂极速互动":"Quick Activity"}),r.jsx("h3",{className:"text-xl font-bold text-white",children:n.activePoll.title})]})]}),r.jsxs("div",{className:"text-right",children:[r.jsx("span",{className:"text-3xl font-black text-amber-400 font-mono",children:n.activePoll.totalVotes||0}),r.jsx("span",{className:"text-xs text-slate-400 block",children:s==="zh"?"人已作答":"Responded"})]})]}),r.jsx("div",{className:"grid grid-cols-2 gap-4 my-2",children:(Array.isArray(n.activePoll.options)&&n.activePoll.options.length>0?n.activePoll.options:[]).map(P=>{const L=n.activePoll.distribution?.[P]||0,_=Math.round(L/(n.activePoll.totalVotes||1)*100);return r.jsxs("div",{className:"p-5 bg-slate-800/50 rounded-2xl border border-slate-700/50 flex flex-col gap-3",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx("span",{className:"w-10 h-10 rounded-xl bg-blue-500 text-white font-bold text-lg flex items-center justify-center shadow-md",children:P}),r.jsxs("span",{className:"font-semibold text-slate-200 text-lg",children:["选项 ",P]})]}),r.jsxs("span",{className:"font-mono font-bold text-xl text-blue-400",children:[_,"% (",L,")"]})]}),r.jsx("div",{className:"h-4 w-full bg-slate-700/40 rounded-full overflow-hidden",children:r.jsx("div",{className:"h-full bg-gradient-to-r from-blue-500 to-indigo-500 transition-all duration-500 rounded-full",style:{width:`${_}%`}})})]},P)})})]}),n.activeBuzzer&&r.jsxs("div",{className:"bg-slate-900/90 rounded-3xl border border-slate-800 p-8 shadow-xl flex flex-col items-center text-center justify-center",children:[r.jsx("div",{className:"p-4 bg-rose-500/10 rounded-2xl border border-rose-500/20 text-rose-400 mb-4",children:r.jsx($i,{size:36,className:"animate-bounce"})}),r.jsx("h3",{className:"text-2xl font-bold text-white mb-2",children:n.activeBuzzer.title}),n.activeBuzzer.status==="READY"?r.jsxs("div",{className:"my-6 py-6 px-12 bg-rose-950/30 border border-rose-500/30 rounded-2xl",children:[r.jsx("span",{className:"text-4xl font-extrabold text-rose-400 animate-pulse block",children:s==="zh"?"⚡ 全班抢答中...":"⚡ Buzzing in progress..."}),r.jsx("span",{className:"text-sm text-slate-400 mt-2 block",children:s==="zh"?"请按手中的抢答按钮!":"Press your buzzer now!"})]}):r.jsxs("div",{className:"my-6 py-6 px-12 bg-emerald-950/30 border border-emerald-500/40 rounded-2xl flex flex-col items-center",children:[r.jsx(cs,{size:48,className:"text-amber-400 mb-2"}),r.jsx("span",{className:"text-sm text-emerald-400 font-bold tracking-wide uppercase",children:s==="zh"?"🎉 抢答成功!":"🎉 First to Buzz!"}),r.jsx("span",{className:"text-5xl font-black text-white my-2 font-mono",children:n.activeBuzzer.winnerName||"同学"}),n.activeBuzzer.responseTimeMs&&r.jsx("span",{className:"text-sm font-mono text-emerald-300",children:s==="zh"?`响应用时:${n.activeBuzzer.responseTimeMs} 毫秒`:`Reaction time: ${n.activeBuzzer.responseTimeMs} ms`})]})]}),n.stage==="WRAP_UP_EXIT_TICKET"&&r.jsxs("div",{className:"bg-gradient-to-br from-indigo-950/40 to-slate-900 rounded-3xl border border-indigo-800/40 p-8 shadow-xl flex flex-col items-center text-center",children:[r.jsx(pm,{size:48,className:"text-indigo-400 mb-4"}),r.jsx("h3",{className:"text-3xl font-extrabold text-white mb-2",children:s==="zh"?"60 秒结课通票 (Exit Ticket)":"60s Exit Ticket"}),r.jsx("p",{className:"text-slate-300 text-lg max-w-lg mb-6",children:s==="zh"?"请同学们打开设备完成本次课堂评估:选星级、写下今天最困惑的一个知识点。":"Please complete your 60-second summary ticket on your device."})]}),!n.activePoll&&!n.activeBuzzer&&n.stage!=="PRE_CLASS_READY"&&n.stage!=="WRAP_UP_EXIT_TICKET"&&r.jsxs("div",{className:"flex-1 min-h-[220px] bg-gradient-to-br from-slate-900 to-slate-850 rounded-3xl border border-slate-800 p-10 flex flex-col justify-center items-center text-center",children:[r.jsx("div",{className:"p-4 bg-slate-800/60 rounded-3xl border border-slate-700/50 text-slate-400 mb-5",children:r.jsx(Il,{size:40})}),r.jsx("h3",{className:"text-2xl font-extrabold text-white mb-2",children:s==="zh"?"等待课堂互动":"Waiting for classroom activity"}),r.jsx("p",{className:"text-slate-400 text-base max-w-lg",children:s==="zh"?"当前没有进行中的投票或抢答。教师发起互动后,这里会立刻展示实时结果;右侧的出勤、课件参与与课堂动态为实时数据。":"No poll or buzz-in is running. Real-time results will appear here; attendance and activity metrics are live on the right."})]}),r.jsx(Oe,{slot:"stage.display.card",slotProps:{lessonId:t,stage:n.stage}})]}),r.jsxs("aside",{className:"col-span-4 flex flex-col gap-6",children:[r.jsx(ag,{attendance:n.attendance,zh:s==="zh"}),r.jsx(lg,{stats:n.courseware,zh:s==="zh"}),n.stage==="WRAP_UP_EXIT_TICKET"&&r.jsx("div",{className:"bg-slate-900/90 rounded-3xl border border-slate-800 p-5 shadow-xl",children:r.jsx(ug,{submitted:n.exitTicketSubmitted,expected:n.attendance?.expected,zh:s==="zh"})}),r.jsx(dg,{feed:n.feed,zh:s==="zh"}),r.jsxs("div",{className:"bg-slate-900/90 rounded-3xl border border-slate-800 p-6 shadow-xl flex flex-col gap-4",children:[r.jsxs("div",{className:"flex items-center justify-between border-b border-slate-800/80 pb-3",children:[r.jsxs("div",{className:"flex items-center gap-2 text-white font-bold text-base",children:[r.jsx(gm,{size:18,className:"text-blue-400"}),r.jsx("span",{children:s==="zh"?"学习节奏晴雨表":"Pacing Barometer"})]}),r.jsxs("span",{className:"text-xs text-slate-400 font-mono",children:[y," ",s==="zh"?"次反馈":"signals"]})]}),r.jsxs("div",{className:"flex flex-col gap-3 my-1",children:[r.jsxs("div",{className:"flex items-center justify-between text-sm",children:[r.jsxs("span",{className:"flex items-center gap-2 text-emerald-300 font-medium",children:[r.jsx("span",{className:"w-2.5 h-2.5 rounded-full bg-emerald-400"}),s==="zh"?"听懂了 / 节奏合适":"Clear & Smooth"]}),r.jsx("span",{className:"font-mono font-bold text-white",children:N.CLEAR||0})]}),r.jsx("div",{className:"h-3 w-full bg-slate-800 rounded-full overflow-hidden",children:r.jsx("div",{className:"h-full bg-emerald-500 rounded-full transition-all duration-500",style:{width:`${y>0?(N.CLEAR||0)/y*100:0}%`}})}),r.jsxs("div",{className:"flex items-center justify-between text-sm pt-2",children:[r.jsxs("span",{className:"flex items-center gap-2 text-amber-300 font-medium",children:[r.jsx("span",{className:"w-2.5 h-2.5 rounded-full bg-amber-400"}),s==="zh"?"有些困惑 / 需点拨":"Confused"]}),r.jsx("span",{className:"font-mono font-bold text-white",children:N.CONFUSED||0})]}),r.jsx("div",{className:"h-3 w-full bg-slate-800 rounded-full overflow-hidden",children:r.jsx("div",{className:"h-full bg-amber-500 rounded-full transition-all duration-500",style:{width:`${y>0?(N.CONFUSED||0)/y*100:0}%`}})}),r.jsxs("div",{className:"flex items-center justify-between text-sm pt-2",children:[r.jsxs("span",{className:"flex items-center gap-2 text-rose-300 font-medium",children:[r.jsx("span",{className:"w-2.5 h-2.5 rounded-full bg-rose-400"}),s==="zh"?"讲太快了 / 跟不上":"Too Fast"]}),r.jsx("span",{className:"font-mono font-bold text-white",children:N.TOO_FAST||0})]}),r.jsx("div",{className:"h-3 w-full bg-slate-800 rounded-full overflow-hidden",children:r.jsx("div",{className:"h-full bg-rose-500 rounded-full transition-all duration-500",style:{width:`${y>0?(N.TOO_FAST||0)/y*100:0}%`}})})]}),r.jsx("p",{className:"text-xs text-slate-500 text-center mt-2",children:s==="zh"?"提示:此数据来自学生端匿名点击,自动脱敏保护学生自尊。":"Aggregated anonymized signals from student devices."})]})]})]}),b&&r.jsx(Wp,{isOpen:b,onClose:()=>C(!1),lessonTitle:e,syncedStudentsCount:d,...c??{}}),r.jsx("div",{className:"absolute inset-0 pointer-events-none z-30 overflow-hidden",children:r.jsx(Oe,{slot:"stage.display.overlay",slotProps:{lessonId:t,lessonTitle:e,stage:n.stage,data:n,isFullscreen:u,lang:s}})})]})}const fg=/\b(function|const|let|var|class|def|import|return|if|for|while|print|console)\b|[{};]\s*$/;function mg(t){const e=Array.isArray(t)?t.filter(Boolean):[];if(e.length===0)return{kind:"empty",lines:[],eventCount:0};const n=e.filter(h=>{const m=String(h?.eventType??h?.event_type??"").toLowerCase();return m.includes("submit")||m.includes("finish")||m.includes("complete")}),s=n.length>0?n:e,i=s[s.length-1],o=i?.payload??i?.payloadJson??i?.data??{},a=gg(o,["code","source","src","program","html","content","answer"]);if(a&&(fg.test(a)||a.includes(`
|
|
3
|
+
`)||a.length>120))return{kind:"code",lines:a.split(`
|
|
4
|
+
`).slice(0,14).map(h=>({text:h.slice(0,160),indent:Math.floor((h.match(/^\s*/)?.[0].length??0)/2),isHighlight:/correct|answer|正确|对|错|✓|✗/i.test(h)})),eventCount:e.length};const l=Object.entries(o).filter(([,h])=>typeof h!="object"||h===null),c=l.filter(([h])=>!pg.has(h.toLowerCase()));if(c.length>=3)return{kind:"structured",lines:c.slice(0,10).map(([h,m])=>({text:`${h}: ${xg(m)}`,indent:0})),eventCount:e.length};if(a)return{kind:"text",lines:a.split(`
|
|
5
|
+
`).slice(0,12).map(h=>({text:h.slice(0,200),indent:0})),eventCount:e.length};const d=l.filter(([,h])=>typeof h=="number");return d.length>0?{kind:"numeric",lines:d.slice(0,6).map(([h,m])=>({text:`${h}: ${m}`,indent:0})),eventCount:e.length}:{kind:"empty",lines:[],eventCount:e.length}}const pg=new Set(["type","score","comment","completion","timestamp","t","watch","attemptsd","eventtype","payload"]);function gg(t,e){for(const n of e){const s=t?.[n];if(typeof s=="string"&&s.trim())return s}return null}function xg(t){return t==null?"—":Array.isArray(t)?t.map(e=>String(e)).join("、"):typeof t=="object"?JSON.stringify(t):String(t)}const bg={code:"代码",text:"文本作答",structured:"结构化答案",numeric:"数值结果",empty:"无内容"},Qo={workA:null,workB:null,matchingItems:[],badges:[],podiumStudents:[],danmaku:[],reactions:[],rubricDimensions:[],reviewProgress:{completed:0,total:0},fromServer:!1};function yg({lessonId:t,enabled:e,attempts:n,studentCount:s,addToast:i,lang:o="zh"}){const[a,l]=f.useState([]),[c,d]=f.useState(null),[h,m]=f.useState(!1);f.useEffect(()=>{if(!t){l([]);return}let S=!0;const b=async()=>{try{const N=await fetch(`/api/classroom/sessions/${t}/top-performers?limit=50`);if(!N.ok||!S)return;const y=await N.json(),P=Array.isArray(y?.topPerformers)?y.topPerformers:[];if(!S)return;l(P.map(L=>({studentId:String(L.studentId??""),studentName:String(L.studentName??""),cumulativeScore:Number(L.cumulativeScore)||0,accuracy:Number(L.accuracy)||0})))}catch{}};b();const C=setInterval(()=>void b(),2e4);return()=>{S=!1,clearInterval(C)}},[t]);const[p,u]=f.useState({}),g=f.useCallback(async S=>{if(S)try{const b=await fetch(`/api/courseware/attempts/${encodeURIComponent(S)}/raw`);if(!b.ok)return;const C=await b.json(),N=Array.isArray(C?.events)?C.events:Array.isArray(C)?C:[];if(N.length===0)return;u(y=>({...y,[S]:mg(N)}))}catch{}},[]);f.useEffect(()=>{const S=[...n].filter(b=>b?.studentId&&b.studentId!=="teacher"&&b.studentId!=="guest").sort((b,C)=>(Number(C.score)||0)-(Number(b.score)||0)).slice(0,2);for(const b of S)b.attemptId&&!p[b.attemptId]&&g(String(b.attemptId))},[n,p,g]);const x=f.useCallback(async()=>{if(!t){d(null);return}try{const S=await fetch(`/api/classroom/sessions/${t}/peer-review`);S.ok&&d(await S.json())}catch{}},[t]);f.useEffect(()=>{if(!e)return;x();const S=setInterval(()=>void x(),5e3);return()=>clearInterval(S)},[e,x]);const w=f.useCallback(async()=>{if(t){m(!0);try{const S=await fetch(`/api/classroom/sessions/${t}/peer-review/auto-assign`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({perStudent:2})}),b=await S.json().catch(()=>null);if(!S.ok){i?.(o==="zh"?"分配失败":"Assign failed",b?.error??`HTTP ${S.status}`,"error");return}i?.(o==="zh"?"✅ 互评已分配":"✅ Peer reviews assigned",o==="zh"?`${b.works} 份作品 · 生成 ${b.tasks} 条任务(口径:${b.scope==="lesson"?"本课节课件":"本班全部"})`:`${b.tasks} tasks created`,"success"),await x()}finally{m(!1)}}},[t,i,o,x]);return{data:f.useMemo(()=>{if(c?.matchingItems?.length||c?.podiumStudents?.length)return{...Qo,matchingItems:c.matchingItems??[],badges:c.badges??[],podiumStudents:c.podiumStudents??[],danmaku:c.danmaku??[],reactions:c.reactions??[],rubricDimensions:c.dimensions??[],reviewProgress:c.progress??{completed:0,total:0},fromServer:!0};const S=n.filter(y=>y?.studentId&&y.studentId!=="teacher"&&y.studentId!=="guest"),b=[...S].sort((y,P)=>(Number(P.score)||0)-(Number(y.score)||0)),C=(y,P)=>{if(!y)return null;const L=String(y.studentName||y.studentId),_=typeof y.score=="number"?y.score:null,O=String(y.attemptId??`work-${P}`),T=p[O];return{id:O,slot:P,studentName:L,studentInitial:L.slice(0,1),workTitle:`${L} · ${y.coursewareName??"课件作品"}`,workSubtitle:_===null?y.status==="completed"?"已完成提交":"作答中":`得分 ${_}${typeof y.completion=="number"?` · 完成度 ${Math.round(y.completion*100)}%`:""}`,badges:[],workContent:T??null,codeTitle:T?`真实作答内容(${bg[T.kind]})`:void 0,codeLines:T?.lines.length?T.lines:void 0}},N=a.slice(0,3).map((y,P)=>({rank:P+1,name:y.studentName,votes:y.cumulativeScore,workTitle:`${y.accuracy}% 正确率`,honorTitle:P===0?"本节最高分":"优秀表现",rankBadgeClass:P===0?"bg-[#ffb95f] text-[#2a1700]":"bg-[#171f33] text-[#908fa0]",tagBadgeClass:"bg-[#ca8100]/20 text-[#ffb95f]"}));return{...Qo,workA:C(b[0],"A"),workB:C(b[1],"B"),podiumStudents:N,reviewProgress:{completed:S.filter(y=>y.status==="completed").length,total:s}}},[c,n,a,s,p]),topPerformers:a,autoAssigning:h,autoAssign:w,refresh:x}}function wg({lessonId:t,lessonTitle:e="互动课堂",lang:n="zh"}){const{data:s,health:i,lastSyncedAt:o}=Zp(t),{notices:a,push:l,dismiss:c}=sg(n),[d,h]=f.useState(!1),[m,p]=f.useState([]),[u,g]=f.useState("");f.useEffect(()=>{if(!d||!t)return;let C=!1;return(async()=>{try{const N=await fetch("/api/courseware/attempts?pageSize=all");N.ok&&!C&&p(ln(await N.json()))}catch{}})(),()=>{C=!0}},[d,t]),f.useEffect(()=>{let C=!1;return(async()=>{try{const N=await fetch("/api/auth/session");if(N.ok&&!C){const y=await N.json();g(String(y?.session?.name??y?.session?.username??""))}}catch{}})(),()=>{C=!0}},[]);const x=yg({lessonId:t,enabled:d,attempts:m,studentCount:s.attendance?.expected??0,lang:n}),w=f.useMemo(()=>({workA:x.data.workA,workB:x.data.workB,matchingItems:x.data.matchingItems,badges:x.data.badges,podiumStudents:x.data.podiumStudents,danmaku:x.data.danmaku,reactions:x.data.reactions,rubricDimensions:x.data.rubricDimensions,reviewProgress:x.data.reviewProgress,onAutoAssign:x.autoAssign,autoAssigning:x.autoAssigning,syncedStudentsCount:s.attendance?.onlineInClass,teacherName:u,stageLabel:qi(s.stage,n)}),[x,s.attendance,u,s.stage,n]),v=f.useRef(null),S=f.useRef(!0),b=f.useRef(i);return f.useEffect(()=>{if(S.current){S.current=!1,v.current=s;return}const C=v.current;v.current=s,C&&l(Xp(C,s,{lang:n,isFirstFrame:!1}))},[s,n,l]),f.useEffect(()=>{const C=eg(i,b.current,n);b.current=i,C&&l([C])},[i,n,l]),t?r.jsxs(r.Fragment,{children:[r.jsx(hg,{lessonId:t,lessonTitle:e,data:s,lang:n,health:i,lastSyncedAt:o,peerReviewOpen:d,onOpenPeerReview:()=>h(!0),onClosePeerReview:()=>h(!1),peerReview:w,showCloseButton:!1}),r.jsx(ng,{notices:a,onDismiss:c,lang:n})]}):r.jsxs("div",{className:"fixed inset-0 z-[9999] bg-slate-950 text-slate-100 flex flex-col items-center justify-center gap-3",children:[r.jsx("div",{className:"text-5xl",children:"📺"}),r.jsx("h1",{className:"text-2xl font-extrabold",children:n==="zh"?"大屏展台 · 等待课节":"Stage Display · Waiting for lesson"}),r.jsx("p",{className:"text-slate-400 text-sm max-w-md text-center px-6",children:n==="zh"?"请在教师端「在线课堂」中选择要授课的课节,这里会自动接入对应课堂的实时数据。":"Select a lesson in the teacher console; the stage will connect to it automatically."})]})}function vg(t){const e=Ft(),n=t.session!==void 0?t.session:e?.session,s=t.activeRole??e?.activeRole??"teacher",i=t.setActiveRole??e?.setActiveRole??(()=>{}),o=t.isStudentLiveMode??e?.isStudentLiveMode??!1,a=t.isStudentPreviewMode??e?.isStudentPreviewMode??!1,l=t.lang??e?.lang??"zh",c=t.students??e?.students??[],d=t.activeStudentId!==void 0?t.activeStudentId:e?.activeStudentId??null;return n?.role==="teacher"&&s==="student"&&!o?r.jsxs("div",{className:"bg-gradient-to-r from-amber-500 via-amber-600 to-orange-500 text-white px-6 py-1.5 flex items-center justify-between text-xs font-medium shadow-sm z-30 shrink-0 border-b border-amber-600/30",children:[r.jsxs("div",{className:"flex items-center gap-2.5",children:[r.jsxs("span",{className:"bg-black/20 text-amber-100 px-2 py-0.5 rounded font-bold uppercase tracking-wider text-xs flex items-center gap-1",children:[r.jsx(ir,{size:12}),l==="zh"?a?"学生视角预览":"学生模拟模式":a?"Student Preview":"Student View Mode"]}),r.jsx("span",{children:l==="zh"?`您当前正在以学生身份(${c.find(h=>h.id===d)?.name||"未选择"})预览系统界面与交互。`:`You are currently previewing the platform as student (${c.find(h=>h.id===d)?.name||"None"}).`})]}),r.jsxs("button",{type:"button",onClick:()=>{if(a){window.close();return}i("teacher")},className:"bg-white text-amber-800 hover:bg-amber-50 active:bg-amber-100 font-bold px-3 py-1 rounded-md shadow-xs transition-all flex items-center gap-1.5 cursor-pointer text-xs",children:[a?r.jsx(Ie,{size:13}):r.jsx(sr,{size:13}),l==="zh"?a?"关闭此预览标签页":"退出模拟并返回教师端":a?"Close Preview Tab":"Exit Student View"]})]}):null}function Sg({session:t,lang:e,onLogout:n,onProfile:s}){const[i,o]=f.useState(!1),a=f.useRef(null);f.useEffect(()=>{if(!i)return;const c=d=>{a.current&&!a.current.contains(d.target)&&o(!1)};return document.addEventListener("mousedown",c),()=>document.removeEventListener("mousedown",c)},[i]);const l=(c,d)=>e==="zh"?c:d;return r.jsxs("div",{className:"relative",ref:a,children:[r.jsxs("button",{type:"button",onClick:()=>o(c=>!c),"aria-haspopup":"menu","aria-expanded":i,title:t.name,className:"flex items-center gap-1 rounded-full p-1 hover:bg-gray-100 transition-colors cursor-pointer",children:[r.jsx("span",{className:"w-9 h-9 rounded-full bg-indigo-100 text-indigo-600 flex items-center justify-center shrink-0 overflow-hidden",children:t.avatar?r.jsx("img",{src:t.avatar,alt:t.name,className:"w-full h-full object-cover"}):r.jsx(as,{size:20})}),r.jsx(fn,{size:14,className:`text-gray-400 transition-transform duration-200 ${i?"rotate-180":""}`})]}),i&&r.jsxs("div",{role:"menu",className:"absolute right-0 mt-2 w-52 bg-white border border-gray-200 shadow-lg rounded-xl z-50 overflow-hidden py-1",children:[r.jsxs("div",{className:"px-4 py-2 border-b border-gray-100",children:[r.jsx("p",{className:"text-sm font-semibold text-gray-800 truncate",title:t.name,children:t.name}),r.jsx("p",{className:"text-xs text-gray-400 truncate",children:t.username})]}),r.jsxs("button",{type:"button",role:"menuitem",onClick:()=>{o(!1),s()},className:"w-full flex items-center gap-2 px-4 py-2 text-sm text-gray-700 hover:bg-gray-50 transition-colors cursor-pointer",children:[r.jsx(as,{size:16,className:"text-gray-400"}),l("个人资料","Profile")]}),r.jsx(Oe,{slot:"nav.user_menu",slotProps:{session:t,lang:e,closeMenu:()=>o(!1)}}),r.jsxs("button",{type:"button",role:"menuitem",onClick:()=>{o(!1),n()},className:"w-full flex items-center gap-2 px-4 py-2 text-sm text-rose-600 hover:bg-rose-50 transition-colors cursor-pointer",children:[r.jsx(sr,{size:16}),l("注销登录","Sign Out")]})]})]})}function yr(t){return t==="*"?{kind:"global",key:"*"}:t.length>2&&t.endsWith(".*")&&!t.slice(0,-2).includes("*")?{kind:"prefix",key:t.slice(0,-1)}:{kind:"exact",key:t}}class jg{constructor(){this.handlers=new Map,this.prefixHandlers=new Map,this.globalHandlers=new Set,this.wildcardCount=0}subscribe(e,n){const{kind:s,key:i}=yr(e);let o;if(s==="global")o=this.globalHandlers,this.wildcardCount++;else if(s==="prefix"){let l=this.prefixHandlers.get(i);l||(l=new Set,this.prefixHandlers.set(i,l)),o=l,this.wildcardCount++}else{let l=this.handlers.get(i);l||(l=new Set,this.handlers.set(i,l)),o=l}o.add(n);let a=!1;return()=>{a||(a=!0,o.delete(n),!(o.size>0)&&(s==="global"?this.wildcardCount--:s==="prefix"?(this.wildcardCount--,this.prefixHandlers.delete(i)):this.handlers.delete(i)))}}subscribePayload(e,n){const s=i=>n(i.payload,i);return this.subscribe(e,s)}once(e,n){const s=this.subscribe(e,i=>{s(),n(i)});return s}resolveHandlers(e){const n=this.handlers.get(e);if(this.wildcardCount===0)return n&&n.size>0?Array.from(n):[];let s=null;for(const[i,o]of this.prefixHandlers)if(e.startsWith(i)){if(!s&&(s=new Set,n))for(const a of n)s.add(a);for(const a of o)s.add(a)}if(this.globalHandlers.size>0){if(!s&&(s=new Set,n))for(const i of n)s.add(i);for(const i of this.globalHandlers)s.add(i)}return s?Array.from(s):n&&n.size>0?Array.from(n):[]}async publish(e){const n=this.resolveHandlers(e.type);if(n.length!==0)for(const s of n)try{const i=s(e);i instanceof Promise&&i.catch(o=>{console.error(`[FrontendEventBus] Async handler error on '${e.type}':`,o)})}catch(i){console.error(`[FrontendEventBus] Handler error on '${e.type}':`,i)}}async emit(e,n,s="frontend"){const i={id:typeof crypto<"u"&&crypto.randomUUID?crypto.randomUUID():`fe-${Date.now()}-${Math.random().toString(36).slice(2,8)}`,type:e,source:s,payload:n,timestamp:Date.now()};return this.publish(i)}listenerCount(e){if(e){const{kind:s,key:i}=yr(e);return s==="global"?this.globalHandlers.size:s==="prefix"?this.prefixHandlers.get(i)?.size??0:this.handlers.get(i)?.size||0}let n=this.wildcardCount;for(const s of this.handlers.values())n+=s.size;return n}clear(e){if(e){const{kind:n,key:s}=yr(e);if(n==="global")this.wildcardCount-=this.globalHandlers.size,this.globalHandlers.clear();else if(n==="prefix"){const i=this.prefixHandlers.get(s);i&&(this.wildcardCount-=i.size),this.prefixHandlers.delete(s)}else this.handlers.delete(s)}else this.handlers.clear(),this.prefixHandlers.clear(),this.globalHandlers.clear(),this.wildcardCount=0}}const Ot=new jg,kg=[{id:"light",label:"浅色日间",description:"明亮通透,适合自然采光良好的日间课堂",previewBg:"#f8fafc",previewPrimary:"#4f46e5",category:"builtin"},{id:"dark",label:"暗夜极客",description:"深邃内敛,适合计算机房与夜间专注备课",previewBg:"#0b0f19",previewPrimary:"#6366f1",category:"builtin"},{id:"eyecare",label:"教学护眼",description:"柔和舒缓,防教室大屏眩光,减轻视觉疲劳",previewBg:"#f2f7f4",previewPrimary:"#2d6a4f",category:"builtin"},{id:"chalkboard",label:"经典黑板",description:"经典墨绿板书质感,沉浸式板书演练",previewBg:"#0e1713",previewPrimary:"#4caf50",category:"builtin"}],Is={light:{"--bg-app":"#f8fafc","--bg-surface":"#ffffff","--bg-surface-secondary":"#f1f5f9","--bg-surface-elevated":"#ffffff","--border-theme":"#e2e8f0","--border-theme-subtle":"#f1f5f9","--text-main":"#0f172a","--text-muted":"#64748b","--color-primary":"#4f46e5","--color-primary-hover":"#4338ca"},dark:{"--bg-app":"#0b0f19","--bg-surface":"#111827","--bg-surface-secondary":"#1f2937","--bg-surface-elevated":"#1f2937","--border-theme":"#374151","--border-theme-subtle":"#1f2937","--text-main":"#f9fafb","--text-muted":"#9ca3af","--color-primary":"#6366f1","--color-primary-hover":"#4f46e5"},eyecare:{"--bg-app":"#f2f7f4","--bg-surface":"#ffffff","--bg-surface-secondary":"#e4eee8","--bg-surface-elevated":"#ffffff","--border-theme":"#cbe0d5","--border-theme-subtle":"#dbeef2","--text-main":"#143526","--text-muted":"#3d6350","--color-primary":"#2d6a4f","--color-primary-hover":"#1b4332"},chalkboard:{"--bg-app":"#0e1713","--bg-surface":"#15241e","--bg-surface-secondary":"#1b2f27","--bg-surface-elevated":"#1f382e","--border-theme":"#28473a","--border-theme-subtle":"#1b2f27","--text-main":"#e8f5e9","--text-muted":"#81c784","--color-primary":"#4caf50","--color-primary-hover":"#388e3c"}},wr="openlearn_theme",Qn="openlearn_custom_themes",Ks={};function Wi(t){return Ks[t]?Ks[t]:t in Is?Is[t]:Is.light}function vr(t){typeof document>"u"||document.documentElement.setAttribute("data-theme",t)}function Cg(t,e){if(typeof document>"u")return;Ks[t]=e;const n=`openlearn-custom-theme-${t}`;let s=document.getElementById(n);s||(s=document.createElement("style"),s.id=n,document.head.appendChild(s));const i=Object.entries(e).map(([o,a])=>` ${o}: ${a};`).join(`
|
|
6
|
+
`);s.textContent=`[data-theme="${t}"] {
|
|
7
|
+
${i}
|
|
8
|
+
}`}function Ng(t){if(typeof document>"u")return;delete Ks[t];const e=document.getElementById(`openlearn-custom-theme-${t}`);e&&e.parentNode&&e.parentNode.removeChild(e)}function Sr(t){if(!(typeof window>"u"))try{Ot.publish({id:ar(),type:"theme.changed",source:"theme-store",payload:{theme:t,tokens:Wi(t)},timestamp:Date.now()})}catch{}}const lr=Fi((t,e)=>({theme:"light",availableThemes:[...kg],initTheme:()=>{if(typeof window>"u")return;try{const i=localStorage.getItem(Qn);if(i){const o=JSON.parse(i);Array.isArray(o)&&o.forEach(a=>{a&&a.spec&&a.spec.id&&e().registerTheme(a.spec,a.cssVariables)})}}catch{}const s=localStorage.getItem(wr)||"light";vr(s),t({theme:s}),Sr(s)},setTheme:n=>{vr(n),typeof window<"u"&&localStorage.setItem(wr,n),t({theme:n}),Sr(n)},registerTheme:(n,s)=>{s&&Cg(n.id,s),t(i=>({availableThemes:[...i.availableThemes.filter(a=>a.id!==n.id),n]}))},unregisterTheme:n=>{Ng(n),t(s=>{const i=s.availableThemes.filter(a=>a.id!==n),o=s.theme===n?"light":s.theme;return s.theme===n&&(vr("light"),typeof window<"u"&&localStorage.setItem(wr,"light"),Sr("light")),{availableThemes:i,theme:o}})},saveCustomTheme:(n,s)=>{if(e().registerTheme(n,s),typeof window<"u")try{const i=localStorage.getItem(Qn);let o=i?JSON.parse(i):[];Array.isArray(o)||(o=[]),o=o.filter(a=>a.spec.id!==n.id),o.push({spec:n,cssVariables:s}),localStorage.setItem(Qn,JSON.stringify(o))}catch{}e().setTheme(n.id)},deleteCustomTheme:n=>{if(typeof window<"u")try{const s=localStorage.getItem(Qn);if(s){let i=JSON.parse(s);Array.isArray(i)&&(i=i.filter(o=>o.spec.id!==n),localStorage.setItem(Qn,JSON.stringify(i)))}}catch{}e().unregisterTheme(n)}})),Eg=[{id:"sapphire-classic",label:"高雅墨蓝",description:"深海午夜蓝灰与经典宝石蓝,适合沉浸式研究与高对比度投影",tokens:{"--bg-app":"#0d131f","--bg-surface":"#161f30","--bg-surface-secondary":"#1f2c42","--bg-surface-elevated":"#24334d","--border-theme":"#2e3f5b","--border-theme-subtle":"#1f2c42","--text-main":"#f1f5f9","--text-muted":"#94a3b8","--color-primary":"#3b82f6","--color-primary-hover":"#2563eb"}},{id:"sakura-dusk",label:"暮樱柔粉",description:"柔和日系樱花与温暖象牙白,适合美育、艺术与温馨研讨课堂",tokens:{"--bg-app":"#fff9fa","--bg-surface":"#ffffff","--bg-surface-secondary":"#fceef1","--bg-surface-elevated":"#ffffff","--border-theme":"#f5d5db","--border-theme-subtle":"#fae8eb","--text-main":"#3f2d33","--text-muted":"#8a6d76","--color-primary":"#f43f5e","--color-primary-hover":"#e11d48"}},{id:"autumn-amber",label:"复古秋叶",description:"温暖金秋落叶色调与复古羊皮纸质感,适合文科通识与阅读研讨",tokens:{"--bg-app":"#fdfaf6","--bg-surface":"#ffffff","--bg-surface-secondary":"#f5eee6","--bg-surface-elevated":"#ffffff","--border-theme":"#e6d7c3","--border-theme-subtle":"#ede3d5","--text-main":"#2d241e","--text-muted":"#7c6a59","--color-primary":"#d97706","--color-primary-hover":"#b45309"}},{id:"deep-sea-cyber",label:"深海极客",description:"赛博暗黑青绿冷光,极高现代感与未来科技探索质感",tokens:{"--bg-app":"#091014","--bg-surface":"#0f1a20","--bg-surface-secondary":"#16262e","--bg-surface-elevated":"#1d333e","--border-theme":"#25414e","--border-theme-subtle":"#16262e","--text-main":"#e0f2fe","--text-muted":"#7dd3fc","--color-primary":"#06b6d4","--color-primary-hover":"#0891b2"}}],Jo={...Is.light};function Pg({isOpen:t,onClose:e,lang:n="zh"}){const{availableThemes:s,saveCustomTheme:i,deleteCustomTheme:o}=lr(),a=f.useId(),[l,c]=f.useState("custom-mytheme"),[d,h]=f.useState("我的专属主题"),[m,p]=f.useState("自定义教学调色板配置"),[u,g]=f.useState({...Jo}),[x,w]=f.useState("none"),[v,S]=f.useState(""),[b,C]=f.useState(!1),[N,y]=f.useState(null);if(!t)return null;const P=s.filter(E=>E.category==="custom"),L=E=>{y(E),setTimeout(()=>y(null),3e3)},_=E=>{c(E.id),h(E.label),p(E.description),g({...E.tokens}),L(`已载入预设: ${E.label}`)},O=E=>{c(E.id),h(E.label),p(E.description);const F=Wi(E.id);F&&Object.keys(F).length>0&&g({...F}),L(`已载入自定义主题: ${E.label}`)},T=(E,F)=>{g(j=>({...j,[E]:F}))},A=()=>{const E=l.trim().toLowerCase().replace(/[^a-z0-9_-]/g,"-");if(!E){alert("请输入有效的主题标识 (ID)");return}const F={id:E,label:d.trim()||"未命名主题",description:m.trim()||"自定义主题",previewBg:u["--bg-app"]||"#ffffff",previewPrimary:u["--color-primary"]||"#4f46e5",category:"custom"};i(F,u),L(`主题「${F.label}」已保存并成功激活!`)},R=()=>{S(JSON.stringify({version:"1.0",id:l,label:d,description:m,tokens:u},null,2)),w("export")},D=()=>{S(""),w("import")},I=()=>{try{const E=JSON.parse(v);if(!E.tokens||typeof E.tokens!="object")throw new Error("缺少合法的 tokens 字段");E.id&&c(E.id),E.label&&h(E.label),E.description&&p(E.description),g(F=>({...F,...E.tokens})),w("none"),L("主题配置导入成功!")}catch(E){alert(`导入失败: ${E.message||"JSON 格式解析错误"}`)}},$=()=>{navigator.clipboard.writeText(v),C(!0),setTimeout(()=>C(!1),2e3)},U=[{key:"--color-primary",labelZh:"核心主色",labelEn:"Primary Brand Color",desc:"按钮高亮、焦点描边与重点图标"},{key:"--color-primary-hover",labelZh:"主色悬浮",labelEn:"Primary Hover",desc:"按钮悬停交互色"},{key:"--bg-app",labelZh:"全局底色",labelEn:"App Background",desc:"页面整体底衬颜色"},{key:"--bg-surface",labelZh:"卡片底色",labelEn:"Surface Background",desc:"白板卡片、浮层与侧边栏底色"},{key:"--bg-surface-secondary",labelZh:"次级底色",labelEn:"Secondary Surface",desc:"表格斑马纹、标签与次级面板"},{key:"--bg-surface-elevated",labelZh:"浮层底色",labelEn:"Elevated Surface",desc:"弹窗与下拉菜单浮动卡片"},{key:"--border-theme",labelZh:"主边框色",labelEn:"Border Color",desc:"卡片外边框、网格分割线"},{key:"--border-theme-subtle",labelZh:"弱化边框",labelEn:"Subtle Border",desc:"细微内部分割线"},{key:"--text-main",labelZh:"主文本色",labelEn:"Main Text",desc:"正文文字、标题"},{key:"--text-muted",labelZh:"弱化文本",labelEn:"Muted Text",desc:"副标题、辅助信息与提示说明"}];return r.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center p-4 sm:p-6 bg-black/60 backdrop-blur-xs animate-in fade-in duration-150",children:r.jsxs("div",{className:"bg-surface text-main border border-theme rounded-2xl shadow-2xl w-full max-w-6xl h-[92vh] max-h-[900px] flex flex-col overflow-hidden relative",children:[r.jsxs("div",{className:"flex items-center justify-between px-6 py-4 border-b border-theme shrink-0 bg-surface",children:[r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx("div",{className:"p-2 bg-primary-theme/10 rounded-xl text-primary-theme",children:r.jsx(ai,{size:22})}),r.jsxs("div",{children:[r.jsxs("h2",{className:"text-lg font-bold flex items-center gap-2 text-main",children:[n==="zh"?"主题可视化设计器":"Theme Visual Designer",r.jsx("span",{className:"text-xs px-2 py-0.5 rounded-full bg-primary-theme/10 text-primary-theme font-medium",children:"v0.3.0"})]}),r.jsx("p",{className:"text-xs text-muted mt-0.5",children:n==="zh"?"自定义课堂交互色盘,支持一键载入创意预设、实时拟真沙箱预览与微前端自动同步":"Customize learning palettes with live previews, creative presets, and micro-frontend sync"})]})]}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsxs("button",{onClick:D,className:"px-3 py-1.5 rounded-lg border border-theme text-xs font-medium hover:bg-surface-secondary text-main transition-colors flex items-center gap-1.5 cursor-pointer",title:"导入 JSON",children:[r.jsx(Ro,{size:14}),n==="zh"?"导入配置":"Import"]}),r.jsxs("button",{onClick:R,className:"px-3 py-1.5 rounded-lg border border-theme text-xs font-medium hover:bg-surface-secondary text-main transition-colors flex items-center gap-1.5 cursor-pointer",title:"导出 JSON",children:[r.jsx(li,{size:14}),n==="zh"?"导出配置":"Export"]}),r.jsx("button",{onClick:e,className:"p-2 rounded-lg text-muted hover:text-main hover:bg-surface-secondary transition-colors cursor-pointer ml-1","aria-label":"Close",children:r.jsx(Ie,{size:18})})]})]}),N&&r.jsxs("div",{className:"absolute top-18 left-1/2 -translate-x-1/2 z-50 bg-primary-theme text-white px-4 py-2 rounded-xl shadow-lg text-xs font-medium flex items-center gap-2 animate-in fade-in slide-in-from-top-2",children:[r.jsx(rt,{size:14}),N]}),r.jsxs("div",{className:"flex-1 flex flex-col md:flex-row overflow-hidden",children:[r.jsxs("div",{className:"w-full md:w-1/2 border-r border-theme overflow-y-auto p-6 space-y-6",children:[r.jsxs("section",{className:"space-y-3",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("label",{className:"text-xs font-bold uppercase tracking-wider text-muted flex items-center gap-1.5",children:[r.jsx(ot,{size:14,className:"text-amber-500"}),n==="zh"?"创意预设配色":"Creative Presets"]}),r.jsx("span",{className:"text-xs text-muted",children:"一键填入调色板"})]}),r.jsx("div",{className:"grid grid-cols-2 gap-2.5",children:Eg.map(E=>r.jsxs("button",{onClick:()=>_(E),className:"flex flex-col p-3 rounded-xl border border-theme hover:border-primary-theme/50 hover:bg-surface-secondary text-left transition-all cursor-pointer group relative overflow-hidden",children:[r.jsxs("div",{className:"flex items-center justify-between w-full",children:[r.jsxs("div",{className:"font-semibold text-xs text-main flex items-center gap-2",children:[r.jsx("span",{className:"w-3 h-3 rounded-full border border-black/10 shrink-0",style:{backgroundColor:E.tokens["--color-primary"]}}),E.label]}),r.jsxs("div",{className:"flex items-center gap-1",children:[r.jsx("span",{className:"w-2.5 h-2.5 rounded-xs",style:{backgroundColor:E.tokens["--bg-app"]}}),r.jsx("span",{className:"w-2.5 h-2.5 rounded-xs",style:{backgroundColor:E.tokens["--bg-surface"]}})]})]}),r.jsx("p",{className:"text-xs text-muted mt-1.5 line-clamp-2 leading-relaxed opacity-85",children:E.description})]},E.id))})]}),r.jsxs("section",{className:"space-y-3 pt-2 border-t border-theme-subtle",children:[r.jsxs("label",{className:"text-xs font-bold uppercase tracking-wider text-muted flex items-center gap-1.5",children:[r.jsx(xm,{size:14,className:"text-primary-theme"}),n==="zh"?"主题基础信息":"Theme Metadata"]}),r.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[r.jsxs("div",{children:[r.jsx("label",{htmlFor:`${a}-themeId`,className:"block text-xs font-medium text-muted mb-1",children:"主题标识 (ID)"}),r.jsx("input",{id:`${a}-themeId`,type:"text",value:l,onChange:E=>c(E.target.value),placeholder:"custom-mytheme",className:"w-full px-3 py-1.5 text-xs rounded-lg border border-theme bg-surface-secondary text-main focus:outline-none focus:ring-1 focus:ring-primary-theme"})]}),r.jsxs("div",{children:[r.jsx("label",{htmlFor:`${a}-label`,className:"block text-xs font-medium text-muted mb-1",children:"主题名称"}),r.jsx("input",{id:`${a}-label`,type:"text",value:d,onChange:E=>h(E.target.value),placeholder:"我的专属主题",className:"w-full px-3 py-1.5 text-xs rounded-lg border border-theme bg-surface-secondary text-main focus:outline-none focus:ring-1 focus:ring-primary-theme"})]})]}),r.jsxs("div",{children:[r.jsx("label",{htmlFor:`${a}-description`,className:"block text-xs font-medium text-muted mb-1",children:"主题描述"}),r.jsx("input",{id:`${a}-description`,type:"text",value:m,onChange:E=>p(E.target.value),placeholder:"针对特定课堂采光与演示场景优化",className:"w-full px-3 py-1.5 text-xs rounded-lg border border-theme bg-surface-secondary text-main focus:outline-none focus:ring-1 focus:ring-primary-theme"})]})]}),r.jsxs("section",{className:"space-y-3 pt-2 border-t border-theme-subtle",children:[r.jsxs("label",{className:"text-xs font-bold uppercase tracking-wider text-muted flex items-center gap-1.5",children:[r.jsx(ai,{size:14,className:"text-primary-theme"}),n==="zh"?"色彩变量调节 (Design Tokens)":"CSS Variables Token Tuning"]}),r.jsx("div",{className:"space-y-2.5",children:U.map(E=>{const F=u[E.key]||"#000000";return r.jsxs("div",{className:"flex items-center justify-between p-2.5 rounded-xl border border-theme hover:bg-surface-secondary/40 transition-colors",children:[r.jsxs("div",{className:"flex-1 min-w-0 pr-3",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("span",{className:"text-xs font-medium text-main",children:E.labelZh}),r.jsx("span",{className:"text-xs font-mono text-muted bg-surface-secondary px-1.5 py-0.5 rounded",children:E.key})]}),r.jsx("p",{className:"text-xs text-muted mt-0.5",children:E.desc})]}),r.jsxs("div",{className:"flex items-center gap-2 shrink-0",children:[r.jsx("div",{className:"relative flex items-center",children:r.jsx("input",{type:"color",value:F.startsWith("#")&&F.length===7?F:"#4f46e5",onChange:j=>T(E.key,j.target.value),className:"w-8 h-8 rounded-lg cursor-pointer border border-theme p-0.5 bg-surface",title:"打开系统拾色器"})}),r.jsx("input",{type:"text",value:F,onChange:j=>T(E.key,j.target.value),className:"w-20 px-2 py-1 text-xs font-mono rounded-lg border border-theme bg-surface text-main text-center focus:outline-none focus:ring-1 focus:ring-primary-theme"})]})]},E.key)})})]}),P.length>0&&r.jsxs("section",{className:"space-y-3 pt-2 border-t border-theme-subtle",children:[r.jsxs("label",{className:"text-xs font-bold uppercase tracking-wider text-muted flex items-center gap-1.5",children:[r.jsx(Al,{size:14,className:"text-primary-theme"}),n==="zh"?"已创建的自定义主题":"Saved Custom Themes"]}),r.jsx("div",{className:"space-y-2",children:P.map(E=>r.jsxs("div",{className:"flex items-center justify-between p-2.5 rounded-xl border border-theme bg-surface-secondary/30",children:[r.jsxs("div",{className:"flex items-center gap-2.5 min-w-0",children:[r.jsx("span",{className:"w-3.5 h-3.5 rounded-full border border-black/10 shrink-0",style:{backgroundColor:E.previewPrimary}}),r.jsxs("div",{className:"truncate",children:[r.jsx("div",{className:"text-xs font-semibold text-main truncate",children:E.label}),r.jsx("div",{className:"text-xs text-muted truncate",children:E.description})]})]}),r.jsxs("div",{className:"flex items-center gap-1.5 shrink-0 ml-2",children:[r.jsx("button",{onClick:()=>O(E),className:"px-2 py-1 text-xs rounded-md bg-surface border border-theme hover:bg-surface-secondary text-main transition-colors cursor-pointer",children:"编辑"}),r.jsx("button",{onClick:()=>{confirm(`确定删除自定义主题「${E.label}」吗?`)&&(o(E.id),L(`已删除主题「${E.label}」`))},className:"p-1 text-muted hover:text-red-500 rounded-md transition-colors cursor-pointer",title:"删除",children:r.jsx(zl,{size:13})})]})]},E.id))})]})]}),r.jsxs("div",{className:"w-full md:w-1/2 flex flex-col p-6 bg-surface-secondary/30 overflow-y-auto",children:[r.jsxs("div",{className:"flex items-center justify-between mb-3 shrink-0",children:[r.jsxs("div",{className:"flex items-center gap-1.5 text-xs font-bold uppercase tracking-wider text-muted",children:[r.jsx(ir,{size:14,className:"text-primary-theme"}),n==="zh"?"拟真沙盒视口 (Live Sandbox)":"Live Sandbox Preview"]}),r.jsxs("span",{className:"text-xs text-muted font-mono",children:["当前预览: ",d," (",l,")"]})]}),r.jsxs("div",{className:"flex-1 rounded-2xl border shadow-inner overflow-hidden flex flex-col transition-colors duration-200",style:{backgroundColor:u["--bg-app"]||"#f8fafc",borderColor:u["--border-theme"]||"#e2e8f0",color:u["--text-main"]||"#0f172a"},children:[r.jsxs("div",{className:"h-12 border-b px-4 flex items-center justify-between shrink-0",style:{backgroundColor:u["--bg-surface"]||"#ffffff",borderColor:u["--border-theme"]||"#e2e8f0"},children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("div",{className:"w-6 h-6 rounded-lg flex items-center justify-center font-bold text-white text-xs",style:{backgroundColor:u["--color-primary"]||"#4f46e5"},children:"OL"}),r.jsx("span",{className:"font-bold text-xs",style:{color:u["--text-main"]},children:"OpenLearn V2"})]}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("div",{className:"text-xs px-2 py-0.5 rounded-md font-mono",style:{backgroundColor:u["--bg-surface-secondary"]||"#f1f5f9",color:u["--text-muted"]||"#64748b"},children:"10:30:00"}),r.jsx("div",{className:"w-6 h-6 rounded-full flex items-center justify-center text-xs font-bold text-white",style:{backgroundColor:u["--color-primary"]||"#4f46e5"},children:"T"})]})]}),r.jsxs("div",{className:"p-4 space-y-4 flex-1 overflow-y-auto",children:[r.jsxs("div",{className:"p-4 rounded-xl border shadow-xs space-y-3",style:{backgroundColor:u["--bg-surface"]||"#ffffff",borderColor:u["--border-theme"]||"#e2e8f0"},children:[r.jsxs("div",{className:"flex items-start justify-between",children:[r.jsxs("div",{children:[r.jsx("h4",{className:"font-bold text-sm",style:{color:u["--text-main"]},children:"高中物理实验探究:机械能守恒定律"}),r.jsx("p",{className:"text-xs mt-1",style:{color:u["--text-muted"]},children:"DIS 光电门传感器毫秒级数据回传与曲线拟合分析"})]}),r.jsx("span",{className:"text-xs px-2 py-0.5 rounded-full font-medium",style:{backgroundColor:u["--bg-surface-secondary"],color:u["--color-primary"],border:`1px solid ${u["--border-theme"]}`},children:"进行中"})]}),r.jsxs("div",{className:"grid grid-cols-3 gap-2 pt-1",children:[r.jsxs("div",{className:"p-2 rounded-lg",style:{backgroundColor:u["--bg-surface-secondary"]},children:[r.jsx("div",{className:"text-xs",style:{color:u["--text-muted"]},children:"光电门测速 (v)"}),r.jsx("div",{className:"text-sm font-bold font-mono mt-0.5",style:{color:u["--text-main"]},children:"2.43 m/s"})]}),r.jsxs("div",{className:"p-2 rounded-lg",style:{backgroundColor:u["--bg-surface-secondary"]},children:[r.jsx("div",{className:"text-xs",style:{color:u["--text-muted"]},children:"动能增量 (ΔEk)"}),r.jsx("div",{className:"text-sm font-bold font-mono mt-0.5",style:{color:u["--color-primary"]},children:"0.589 J"})]}),r.jsxs("div",{className:"p-2 rounded-lg",style:{backgroundColor:u["--bg-surface-secondary"]},children:[r.jsx("div",{className:"text-xs",style:{color:u["--text-muted"]},children:"误差率 (Err)"}),r.jsx("div",{className:"text-sm font-bold font-mono mt-0.5",style:{color:u["--text-main"]},children:"0.84 %"})]})]}),r.jsxs("div",{className:"flex items-center gap-2 pt-2",children:[r.jsx("button",{className:"px-3 py-1.5 rounded-lg text-xs font-medium text-white shadow-xs transition-opacity hover:opacity-90 cursor-pointer",style:{backgroundColor:u["--color-primary"]||"#4f46e5"},children:"开始数据采集"}),r.jsx("button",{className:"px-3 py-1.5 rounded-lg text-xs font-medium border transition-colors cursor-pointer",style:{backgroundColor:u["--bg-surface-elevated"]||"#ffffff",borderColor:u["--border-theme"]||"#e2e8f0",color:u["--text-main"]||"#0f172a"},children:"重置实验"}),r.jsx("button",{className:"px-2 py-1.5 rounded-lg text-xs transition-colors cursor-pointer",style:{color:u["--text-muted"]},children:"查看教案"})]})]}),r.jsxs("div",{className:"p-3 rounded-xl border space-y-2",style:{backgroundColor:u["--bg-surface-elevated"]||"#ffffff",borderColor:u["--border-theme-subtle"]||"#f1f5f9"},children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx("span",{className:"text-xs font-semibold",style:{color:u["--text-main"]},children:"互动白板区域 (Whiteboard Canvas)"}),r.jsx("span",{className:"text-xs font-mono",style:{color:u["--text-muted"]},children:"60 FPS"})]}),r.jsxs("div",{className:"h-28 rounded-lg border border-dashed flex items-center justify-center p-3 relative overflow-hidden",style:{backgroundColor:u["--bg-app"],borderColor:u["--border-theme"]},children:[r.jsx("div",{className:"w-12 h-12 rounded-xl flex items-center justify-center text-white font-bold shadow-md transform -rotate-6",style:{backgroundColor:u["--color-primary"]},children:r.jsx(rr,{size:20})}),r.jsx("div",{className:"absolute bottom-2 right-2 text-xs font-mono px-1.5 py-0.5 rounded border",style:{backgroundColor:u["--bg-surface"],borderColor:u["--border-theme"],color:u["--text-muted"]},children:"iframe Bridge Sync Ready"})]})]})]})]})]})]}),r.jsxs("div",{className:"flex items-center justify-between px-6 py-4 border-t border-theme shrink-0 bg-surface",children:[r.jsx("div",{className:"flex items-center gap-2",children:r.jsxs("button",{onClick:()=>{g({...Jo}),L("已重置为系统默认调色板")},className:"px-3 py-1.5 rounded-lg border border-theme text-xs font-medium hover:bg-surface-secondary text-main transition-colors flex items-center gap-1.5 cursor-pointer",children:[r.jsx(Ll,{size:14}),n==="zh"?"重置默认":"Reset Defaults"]})}),r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx("button",{onClick:e,className:"px-4 py-2 rounded-xl border border-theme text-xs font-medium hover:bg-surface-secondary text-main transition-colors cursor-pointer",children:n==="zh"?"关闭":"Close"}),r.jsxs("button",{onClick:A,className:"px-5 py-2 rounded-xl bg-primary-theme text-white text-xs font-semibold shadow-sm hover:opacity-95 transition-opacity flex items-center gap-1.5 cursor-pointer",children:[r.jsx(bm,{size:15}),n==="zh"?"保存并激活主题":"Save & Activate Theme"]})]})]}),x!=="none"&&r.jsx("div",{className:"absolute inset-0 bg-black/60 backdrop-blur-xs flex items-center justify-center p-6 z-50 animate-in fade-in duration-100",children:r.jsxs("div",{className:"bg-surface border border-theme rounded-2xl p-5 w-full max-w-lg shadow-2xl space-y-4",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx("h3",{className:"font-bold text-sm text-main flex items-center gap-2",children:x==="export"?r.jsxs(r.Fragment,{children:[r.jsx(li,{size:16,className:"text-primary-theme"}),n==="zh"?"导出主题配置 JSON":"Export Theme JSON"]}):r.jsxs(r.Fragment,{children:[r.jsx(Ro,{size:16,className:"text-primary-theme"}),n==="zh"?"导入主题配置 JSON":"Import Theme JSON"]})}),r.jsx("button",{onClick:()=>w("none"),className:"p-1 rounded-md text-muted hover:text-main cursor-pointer",children:r.jsx(Ie,{size:16})})]}),r.jsx("div",{children:r.jsx("textarea",{value:v,readOnly:x==="export",onChange:E=>S(E.target.value),placeholder:x==="import"?"请在此粘贴主题导出的 JSON 字符串...":"",rows:10,className:"w-full p-3 font-mono text-xs rounded-xl border border-theme bg-surface-secondary text-main focus:outline-none focus:ring-1 focus:ring-primary-theme resize-none"})}),r.jsx("div",{className:"flex items-center justify-end gap-2",children:x==="export"?r.jsx(r.Fragment,{children:r.jsxs("button",{onClick:$,className:"px-4 py-1.5 rounded-lg bg-primary-theme text-white text-xs font-medium flex items-center gap-1.5 cursor-pointer",children:[b?r.jsx(rt,{size:14}):r.jsx(an,{size:14}),b?n==="zh"?"已复制":"Copied":n==="zh"?"复制到剪贴板":"Copy"]})}):r.jsxs(r.Fragment,{children:[r.jsx("button",{onClick:()=>w("none"),className:"px-3 py-1.5 rounded-lg border border-theme text-xs font-medium hover:bg-surface-secondary text-main cursor-pointer",children:n==="zh"?"取消":"Cancel"}),r.jsx("button",{onClick:I,className:"px-4 py-1.5 rounded-lg bg-primary-theme text-white text-xs font-medium cursor-pointer",children:n==="zh"?"解析并导入":"Parse & Import"})]})})]})})]})})}function Tg({lang:t="zh"}){const[e,n]=f.useState(!1),[s,i]=f.useState(!1),o=f.useRef(null),{theme:a,availableThemes:l,setTheme:c}=lr();f.useEffect(()=>{function h(m){o.current&&!o.current.contains(m.target)&&n(!1)}return e&&document.addEventListener("mousedown",h),()=>{document.removeEventListener("mousedown",h)}},[e]);const d=h=>{switch(h){case"dark":return r.jsx(wm,{size:16,className:"text-indigo-400"});case"eyecare":return r.jsx(ir,{size:16,className:"text-emerald-500"});case"chalkboard":return r.jsx(ai,{size:16,className:"text-green-400"});case"light":default:return r.jsx(ym,{size:16,className:"text-amber-500"})}};return r.jsxs(r.Fragment,{children:[r.jsxs("div",{className:"relative",ref:o,children:[r.jsx("button",{onClick:()=>n(!e),title:t==="zh"?"切换教学界面主题":"Switch Theme",className:"p-2 hover:bg-surface-secondary text-main transition-colors bg-surface rounded-lg border border-theme shadow-3xs flex items-center justify-center shrink-0 cursor-pointer","aria-label":"Theme selector",children:d(a)}),e&&r.jsxs("div",{className:"absolute right-0 mt-2 w-64 rounded-xl border border-theme bg-surface shadow-xl z-50 p-2 overflow-hidden animate-in fade-in zoom-in-95 duration-100",children:[r.jsxs("div",{className:"px-3 py-2 border-b border-theme-subtle mb-1",children:[r.jsx("div",{className:"text-xs font-semibold text-main uppercase tracking-wider",children:t==="zh"?"界面主题模式":"Interface Theme"}),r.jsx("div",{className:"text-xs text-muted mt-0.5",children:t==="zh"?"针对不同教学采光与场景优化":"Optimized for diverse lighting"})]}),r.jsx("div",{className:"space-y-1",children:l.map(h=>{const m=a===h.id;return r.jsxs("button",{onClick:()=>{c(h.id),n(!1)},className:`w-full flex items-center justify-between px-3 py-2 rounded-lg text-left text-xs transition-all cursor-pointer ${m?"bg-surface-secondary text-main font-semibold shadow-xs":"text-muted hover:bg-surface-secondary hover:text-main"}`,children:[r.jsxs("div",{className:"flex items-center gap-2.5",children:[r.jsx("span",{className:"w-3.5 h-3.5 rounded-full border border-black/10 dark:border-white/20 shrink-0 shadow-inner",style:{backgroundColor:h.previewPrimary}}),r.jsxs("div",{children:[r.jsx("div",{className:"font-medium text-main leading-none",children:h.label}),r.jsx("div",{className:"text-xs text-muted mt-1 leading-tight opacity-80",children:h.description})]})]}),m&&r.jsx(rt,{size:14,className:"text-primary-theme shrink-0"})]},h.id)})}),r.jsx("div",{className:"pt-2 mt-1 border-t border-theme-subtle",children:r.jsxs("button",{onClick:()=>{n(!1),i(!0)},className:"w-full flex items-center gap-2 px-3 py-2 rounded-lg text-xs font-medium text-primary-theme hover:bg-primary-theme/10 transition-colors cursor-pointer",children:[r.jsx(ot,{size:14}),r.jsx("span",{children:t==="zh"?"🎨 自定义主题设计器...":"🎨 Theme Designer..."})]})})]})]}),r.jsx(Pg,{isOpen:s,onClose:()=>i(!1),lang:t})]})}const jr="openlearn_font_scale",tn=85,nn=140,kr=5,As=100,Ko=[{scale:90,labelZh:"紧凑 (90%)",labelEn:"Compact (90%)"},{scale:100,labelZh:"标准 (100%)",labelEn:"Standard (100%)"},{scale:110,labelZh:"中大 (110%)",labelEn:"Medium (110%)"},{scale:120,labelZh:"大号 (120%)",labelEn:"Large (120%)"},{scale:130,labelZh:"特大 (130%)",labelEn:"Extra Large (130%)"}];function Cr(t){if(typeof document>"u")return;const e=Math.min(nn,Math.max(tn,Math.round(t)));document.documentElement.style.fontSize=`${e}%`,document.documentElement.style.setProperty("--app-font-scale",(e/100).toFixed(2)),document.documentElement.setAttribute("data-font-scale",String(e))}function Nr(t){if(!(typeof window>"u"))try{Ot.publish({id:ar(),type:"font-scale.changed",source:"font-size-store",payload:{scale:t},timestamp:Date.now()})}catch{}}const on=Fi((t,e)=>({scale:As,minScale:tn,maxScale:nn,step:kr,initFontSize:()=>{if(typeof window>"u")return;let n=As;try{const s=localStorage.getItem(jr);if(s){const i=Number(s);!isNaN(i)&&i>=tn&&i<=nn&&(n=i)}}catch{}Cr(n),t({scale:n}),Nr(n);try{window.addEventListener("storage",s=>{if(s.key===jr&&s.newValue){const i=Number(s.newValue);!isNaN(i)&&i>=tn&&i<=nn&&(Cr(i),t({scale:i}),Nr(i))}})}catch{}},setScale:n=>{const s=Math.min(nn,Math.max(tn,Math.round(n)));if(Cr(s),typeof window<"u")try{localStorage.setItem(jr,String(s))}catch{}t({scale:s}),Nr(s)},increaseScale:()=>{const n=e().scale,s=Math.min(nn,n+kr);e().setScale(s)},decreaseScale:()=>{const n=e().scale,s=Math.max(tn,n-kr);e().setScale(s)},resetScale:()=>{e().setScale(As)}}));function Gl({lang:t="zh"}){const[e,n]=f.useState(!1),s=f.useRef(null),{scale:i,minScale:o,maxScale:a,setScale:l,increaseScale:c,decreaseScale:d,resetScale:h}=on();f.useEffect(()=>{function u(g){s.current&&!s.current.contains(g.target)&&n(!1)}return e&&document.addEventListener("mousedown",u),()=>{document.removeEventListener("mousedown",u)}},[e]);const m=Ko.find(u=>u.scale===i),p=i===As;return r.jsxs("div",{className:"relative",ref:s,children:[r.jsxs("button",{type:"button",onClick:()=>n(!e),title:t==="zh"?`界面字体缩放: ${i}%(点击调节)`:`Interface Font Scaling: ${i}% (Click to adjust)`,className:`p-2 hover:bg-surface-secondary transition-colors rounded-lg border shadow-3xs flex items-center justify-center shrink-0 cursor-pointer relative ${p?"bg-surface border-theme text-main":"bg-primary-theme-light border-primary-theme text-primary-theme font-bold"}`,"aria-label":"Font size selector","aria-expanded":e,children:[r.jsx(vm,{size:16}),!p&&r.jsxs("span",{className:"absolute -bottom-1 -right-1 text-xs px-1 py-0.2 rounded-full bg-primary-theme text-white font-extrabold leading-none shadow-xs",children:[i,"%"]})]}),e&&r.jsxs("div",{className:"absolute right-0 mt-2 w-72 rounded-xl border border-theme bg-surface shadow-xl z-50 p-3 overflow-hidden animate-in fade-in zoom-in-95 duration-100 select-none",children:[r.jsxs("div",{className:"px-1 pb-2 border-b border-theme-subtle mb-2.5 flex items-center justify-between",children:[r.jsxs("div",{children:[r.jsx("div",{className:"text-xs font-semibold text-main",children:t==="zh"?"界面字号大小":"Interface Font Size"}),r.jsx("div",{className:"text-xs text-muted mt-0.5",children:t==="zh"?"全局等比缩放排版与文字":"Proportionally scale typography"})]}),!p&&r.jsxs("button",{type:"button",onClick:h,className:"flex items-center gap-1 text-xs text-muted hover:text-primary-theme transition-colors cursor-pointer px-1.5 py-0.5 rounded hover:bg-surface-secondary",title:t==="zh"?"恢复默认 100%":"Reset to 100%",children:[r.jsx(Ll,{size:11}),r.jsx("span",{children:t==="zh"?"重置":"Reset"})]})]}),r.jsxs("div",{className:"bg-surface-secondary/70 rounded-lg p-2 flex items-center justify-between mb-3 border border-theme-subtle",children:[r.jsx("button",{type:"button",onClick:d,disabled:i<=o,className:"w-8 h-8 rounded-md bg-surface border border-theme flex items-center justify-center text-main hover:bg-surface-elevated disabled:opacity-40 disabled:cursor-not-allowed transition-colors cursor-pointer shadow-3xs",title:t==="zh"?"减小字体 (A-)":"Decrease (A-)",children:r.jsx(Sm,{size:14})}),r.jsxs("div",{className:"text-center",children:[r.jsxs("div",{className:"text-sm font-black text-main leading-tight",children:[i,"%"]}),r.jsx("div",{className:"text-xs text-muted",children:m?t==="zh"?m.labelZh.split(" ")[0]:m.labelEn.split(" ")[0]:t==="zh"?"自定义比例":"Custom"})]}),r.jsx("button",{type:"button",onClick:c,disabled:i>=a,className:"w-8 h-8 rounded-md bg-surface border border-theme flex items-center justify-center text-main hover:bg-surface-elevated disabled:opacity-40 disabled:cursor-not-allowed transition-colors cursor-pointer shadow-3xs",title:t==="zh"?"增大字体 (A+)":"Increase (A+)",children:r.jsx(jm,{size:14})})]}),r.jsxs("div",{className:"space-y-1 mb-3",children:[r.jsx("div",{className:"text-xs font-bold text-muted uppercase tracking-wider px-1",children:t==="zh"?"常用档位":"Presets"}),r.jsx("div",{className:"grid grid-cols-1 gap-1",children:Ko.map(u=>{const g=i===u.scale;return r.jsxs("button",{type:"button",onClick:()=>l(u.scale),className:`w-full flex items-center justify-between px-2.5 py-1.5 rounded-lg text-left text-xs transition-all cursor-pointer ${g?"bg-primary-theme-light text-primary-theme font-bold border border-primary-theme/30":"text-main hover:bg-surface-secondary border border-transparent"}`,children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-current opacity-60"}),r.jsx("span",{children:t==="zh"?u.labelZh:u.labelEn})]}),g&&r.jsx(rt,{size:13,className:"text-primary-theme shrink-0"})]},u.scale)})})]}),r.jsxs("div",{className:"p-2.5 rounded-lg border border-theme-subtle bg-surface-secondary/40 mb-2",children:[r.jsxs("div",{className:"text-xs text-muted mb-1 flex items-center justify-between",children:[r.jsx("span",{children:t==="zh"?"实时效果预览":"Live Preview"}),r.jsxs("span",{children:[i,"%"]})]}),r.jsx("p",{className:"text-xs text-main font-medium leading-relaxed",children:t==="zh"?"让每一个文字都清晰舒适,智能赋能教学。":"Clear and comfortable typography empowers modern teaching."})]}),r.jsx("div",{className:"text-xs text-muted/80 text-center px-1",children:t==="zh"?"快捷键:Ctrl + Alt + 加号/减号":"Shortcut: Ctrl + Alt + +/-"})]})]})}function Ig(t){const e=Ft(),n=t.lang??e?.lang??"zh",s=t.activeStudentId!==void 0?t.activeStudentId:e?.activeStudentId??null,i=t.students??e?.students??[],o=t.selectedLesson!==void 0?t.selectedLesson:e?.selectedLesson??null,a=t.lessons??e?.lessons??[],l=t.isStudentLocked??e?.isStudentLocked??!1,c=t.isFollowingTeacher??e?.isFollowingTeacher??!1,d=t.setIsFollowingTeacher??e?.setIsFollowingTeacher??(()=>{}),h=t.notifyLockedNavigation??e?.notifyLockedNavigation??(()=>{});return r.jsxs("header",{className:"h-13 bg-surface/95 backdrop-blur-md border-b border-theme px-4 flex items-center justify-between z-20 shrink-0 select-none shadow-xs",children:[r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx("div",{className:"w-8 h-8 rounded-lg bg-gradient-to-tr from-pink-500 to-rose-600 flex items-center justify-center text-white font-black shadow-sm text-sm",children:"🎓"}),r.jsxs("div",{children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("h1",{className:"text-sm font-black text-main tracking-wide",children:n==="zh"?"互动课堂 · 学生端":"Interactive Classroom · Student Client"}),r.jsxs("span",{className:"flex items-center gap-1 text-xs font-bold text-emerald-600 dark:text-emerald-400 bg-emerald-500/10 border border-emerald-500/20 px-2 py-0.5 rounded-full",children:[r.jsx("span",{className:"h-1.5 w-1.5 rounded-full bg-emerald-500 animate-pulse"}),n==="zh"?"已与教师中控台实时联动":"Synced with Teacher"]})]}),r.jsxs("div",{className:"text-xs text-muted flex items-center gap-2",children:[r.jsx("span",{children:s?`学生: ${i.find(m=>m.id===s)?.name||s}`:"学生端"}),r.jsx("span",{children:"•"}),r.jsx("span",{children:o?`课节: ${a.find(m=>m.id===o)?.title||o}`:"等待教师推流课节..."})]})]})]}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsxs("button",{type:"button",onClick:()=>{if(l){h();return}d(!c)},disabled:l,className:`px-3 py-1.5 rounded-lg text-xs font-bold border transition-all flex items-center gap-1.5 shadow-2xs ${l?"cursor-not-allowed":"cursor-pointer"} ${c?"bg-indigo-50 dark:bg-indigo-950/40 text-indigo-600 dark:text-indigo-400 border-indigo-200 dark:border-indigo-800":"bg-surface text-muted border-theme hover:text-main"} ${l?"opacity-70":""}`,title:l?n==="zh"?"全班专注锁定中,已强制跟随教师步调":"Class focus is locked; following the teacher is enforced":n==="zh"?"开启后,教师端切换课节/环节/Tab时,学生端将自动同步跟随":"Follow teacher navigation",children:[r.jsx(Rl,{size:12,className:c?"animate-spin":""}),r.jsx("span",{children:n==="zh"?`跟随教师步调: ${c?"开":"关"}`:`Follow Teacher: ${c?"ON":"OFF"}`})]}),r.jsx(Gl,{lang:n}),r.jsx("button",{type:"button",onClick:()=>{document.fullscreenElement?document.exitFullscreen().catch(()=>{}):document.documentElement.requestFullscreen().catch(()=>{})},className:"p-1.5 text-muted hover:text-main rounded-lg border border-theme hover:bg-surface-secondary transition-colors cursor-pointer",title:n==="zh"?"切换全屏":"Toggle Fullscreen",children:r.jsx(Di,{size:14})}),r.jsx("button",{type:"button",onClick:()=>window.close(),className:"px-2.5 py-1.5 text-xs font-bold text-rose-600 hover:text-rose-700 bg-rose-50 dark:bg-rose-950/30 border border-rose-200 dark:border-rose-900 rounded-lg transition-colors cursor-pointer",title:n==="zh"?"关闭学生端Tab":"Close Tab",children:n==="zh"?"关闭Tab":"Close Tab"})]})]})}function Ag(t){const e=Ft(),n=t.activeRole??e?.activeRole??"teacher",s=t.studentPreviewTab??e?.isStudentPreviewMode??!1,i=t.lang??e?.lang??"zh",o=t.teacherTab??e?.teacherTab??"live_class",a=t.studentViewStatus??e?.studentViewStatus??"dashboard",l=t.session!==void 0?t.session:e?.session,c=t.activeStudentId!==void 0?t.activeStudentId:e?.activeStudentId??null,d=t.students??e?.students??[],h=t.studentDashboardData??e?.studentDashboardData??null,m=t.isNotificationsOpen??e?.isNotificationsOpen??!1,p=t.studentNotifications??e?.studentNotifications??[],u=t.unreadNotifications??e?.unreadNotifications??[],g=t.readNotifications??e?.readNotifications??new Set;t.selectedNotificationForModal!==void 0?t.selectedNotificationForModal:e?.selectedNotificationForModal;const x=t.dbConnected??e?.dbConnected??!1,w=t.dbStatus??e?.dbStatus??"normal",v=t.siteInfo??e?.siteInfo,S=t.setActiveStudentId??e?.setActiveStudentId??(()=>{}),b=t.setReadNotifications??e?.setReadNotifications??(()=>{}),C=t.setIsSystemResourceLibraryOpen??e?.setIsSystemResourceLibraryOpen??(()=>{}),N=t.setProfileOpen??e?.setProfileOpen??(()=>{}),y=t.setTeacherTab??e?.setTeacherTab??(()=>{}),P=t.setStudentViewStatus??e?.setStudentViewStatus??(()=>{}),L=t.setIsNotificationsOpen??e?.setIsNotificationsOpen??(()=>{}),_=t.setSelectedNotificationForModal??e?.setSelectedNotificationForModal??(()=>{}),O=t.handleLogout??e?.handleLogout??e?.onLogout??(()=>{}),T=t.toggleLanguage??e?.toggleLanguage??(()=>{}),A=t.setActiveRole??e?.setActiveRole??(()=>{}),R=t.isStudentLocked??e?.isStudentLocked??!1,D=t.onBlockedNavigate??e?.notifyLockedNavigation;if(e?.isStudentLiveMode)return r.jsx(Ig,{});const I=n==="student"&&R,$=()=>{if(I){D?.();return}n==="teacher"?y("live_class"):n==="student"&&P("dashboard")},U=()=>{if(I){D?.();return}n==="teacher"?y("dashboard"):n==="student"&&P("dashboard")};return r.jsxs("header",{className:"h-16 border-b border-theme bg-surface text-main flex items-center px-6 justify-between shrink-0 shadow-sm relative z-20 transition-colors duration-200",children:[r.jsxs("div",{className:"flex items-center gap-4 sm:gap-6",children:[r.jsxs("button",{onClick:$,className:"flex items-center gap-2.5 shrink-0 hover:opacity-80 transition-opacity cursor-pointer",title:I?i==="zh"?"全班专注锁定中,无法返回首页":"Class focus locked — cannot return to home":i==="zh"?"返回首页":"Back to Home",children:[v.logoUrl?r.jsx("img",{src:v.logoUrl,alt:"site logo",className:"h-8 w-8 object-contain rounded-lg shrink-0"}):r.jsx("div",{className:"h-8 w-8 rounded-lg bg-gradient-to-tr from-indigo-600 to-indigo-700 flex items-center justify-center text-white font-black text-sm shadow-xs shrink-0",children:"OL"}),r.jsxs("div",{className:"flex items-baseline gap-2",children:[r.jsx("span",{className:"text-base font-black text-slate-900 tracking-tight",children:v.siteName||"OpenLearn Next"}),r.jsxs("span",{className:"text-xs font-medium text-slate-400 tracking-tight",children:["v","0.6.0"]}),v.slogan&&r.jsx("span",{className:"hidden md:inline text-xs text-slate-400 font-normal truncate max-w-[200px]",children:v.slogan})]})]}),r.jsx(Oe,{slot:"header.status_pill",slotProps:{dbConnected:x,dbStatus:w,lang:i}}),r.jsxs("button",{onClick:U,className:`flex items-center gap-1.5 px-3 py-1.5 rounded-md text-sm font-medium transition-colors cursor-pointer ${n==="teacher"&&o==="dashboard"||n==="student"&&a==="dashboard"?"bg-indigo-50 text-indigo-700":"text-slate-600 hover:text-indigo-600 hover:bg-slate-100"} ${I?"opacity-50":""}`,children:[I?r.jsx(si,{size:16}):r.jsx(_l,{size:16}),i==="zh"?"系统总览":"Dashboard"]}),n==="student"&&r.jsxs(r.Fragment,{children:[r.jsx("span",{className:"text-slate-300 font-light text-lg select-none",children:"/"}),r.jsxs("h2",{className:"font-semibold text-gray-800 tracking-tight flex items-center gap-2",children:[r.jsx(km,{size:20,className:"text-gray-400"}),"Student Dashboard"]})]}),n==="student"&&l?.role==="teacher"&&r.jsxs("div",{className:"flex items-center gap-2 bg-amber-50/90 border border-amber-200/80 px-2.5 py-1 rounded-lg shadow-2xs",children:[r.jsxs("span",{className:"text-xs font-semibold text-amber-800 flex items-center gap-1",children:[r.jsx(ir,{size:13,className:"text-amber-600"}),i==="zh"?"模拟学生:":"View as:"]}),r.jsxs("select",{className:"border border-amber-300 rounded px-1.5 py-0.5 text-xs bg-white text-gray-800 font-medium focus:ring-1 focus:ring-amber-400 focus:outline-hidden",value:c||"",onChange:E=>S(E.target.value),children:[r.jsxs("option",{value:"",children:["-- ",i==="zh"?"选择学生":"Select Student"," --"]}),d.map(E=>r.jsx("option",{value:E.id,children:E.name},E.id))]}),r.jsxs("button",{type:"button",onClick:()=>{if(s){window.close();return}A?.("teacher")},className:"ml-1 px-2.5 py-1 bg-amber-600 hover:bg-amber-700 active:bg-amber-800 text-white text-xs font-bold rounded-md flex items-center gap-1 transition-all cursor-pointer shadow-2xs",title:i==="zh"?s?"关闭此学生视角预览标签页":"退出模拟学生并返回教师端工作台":s?"Close this student preview tab":"Exit student view and return to teacher workspace",children:[s?r.jsx(Ie,{size:12}):r.jsx(sr,{size:12}),i==="zh"?s?"关闭预览":"返回教师端":s?"Close Tab":"Exit Student View"]})]})]}),r.jsxs("div",{className:"flex items-center gap-4 text-sm text-gray-500",children:[n==="student"&&c&&h&&r.jsxs("div",{className:"relative",children:[r.jsxs("button",{onClick:()=>L(!m),className:"relative p-2 text-gray-500 hover:text-gray-700 hover:bg-gray-100 rounded-full transition-colors",children:[r.jsx($i,{size:20}),u.length>0&&r.jsx("span",{className:"absolute top-1 right-1 bg-red-500 text-white text-xs font-bold px-1.5 py-0.5 rounded-full flex items-center justify-center min-w-[18px]",children:u.length})]}),m&&r.jsxs("div",{className:"absolute right-0 mt-2 w-80 bg-white border border-gray-200 shadow-lg rounded-xl z-50 overflow-hidden",children:[r.jsxs("div",{className:"p-3 border-b border-gray-100 flex justify-between items-center bg-gray-50",children:[r.jsx("h3",{className:"font-semibold text-gray-800",children:"Notifications"}),u.length>0&&r.jsx("button",{onClick:async()=>{if(c){try{const E=p.filter(F=>!g.has(F.id)).map(F=>fetch(`/api/students/${c}/read_notifications`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({notificationId:F.id})}));await Promise.all(E)}catch(E){console.error(E)}b(E=>{const F=new Set(E);return p.forEach(j=>F.add(j.id)),F})}},className:"text-xs text-indigo-600 hover:text-indigo-800 font-medium",children:"Mark all as read"})]}),r.jsx("div",{className:"max-h-96 overflow-y-auto",children:p.length===0?r.jsx("div",{className:"p-4 text-center text-sm text-gray-500 italic",children:"No notifications."}):r.jsx("div",{className:"divide-y divide-gray-100",children:p.map(E=>{const F=!g.has(E.id);return r.jsx("div",{className:`p-3 hover:bg-gray-50 cursor-pointer ${F?"bg-indigo-50/30":""}`,onClick:()=>{F&&(c&&fetch(`/api/students/${c}/read_notifications`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({notificationId:E.id})}).catch(console.error),b(B=>new Set(B).add(E.id)));const j=h?.assignments?.find(B=>B.id===E.relatedId);_({...E,assignment:j}),L(!1)},children:r.jsxs("div",{className:"flex gap-3",children:[r.jsx("div",{className:"mt-0.5",children:E.type==="new_assignment"?r.jsx(Dl,{size:16,className:"text-indigo-500"}):r.jsx(it,{size:16,className:"text-green-500"})}),r.jsxs("div",{className:"flex-1",children:[r.jsx("div",{className:`text-sm ${F?"font-semibold text-gray-900":"font-medium text-gray-700"}`,children:E.title}),r.jsx("div",{className:`text-xs mt-0.5 ${F?"text-gray-600":"text-gray-500"}`,children:E.message})]}),F&&r.jsx("div",{className:"w-2 h-2 rounded-full bg-indigo-500 mt-1"})]})},E.id)})})})]})]}),r.jsx("div",{id:"app-header-plugin-actions",className:"flex items-center gap-2 empty:hidden",children:r.jsx(Oe,{slot:"header.action",lang:i,fallback:r.jsx(r.Fragment,{}),slotProps:{session:l,currentRole:n,lang:i}})}),r.jsxs("button",{onClick:()=>C(!0),className:"flex items-center gap-1.5 hover:text-primary-theme transition-colors bg-surface text-main px-3 py-1.5 rounded-md border border-theme shadow-sm font-medium cursor-pointer",children:[r.jsx(ci,{size:14,className:"text-emerald-500 animate-pulse"}),i==="zh"?"系统资源库":"System Resource Library"]}),r.jsx("button",{onClick:T,title:i==="zh"?"Switch to English":"切换为中文",className:"p-2 hover:bg-surface-secondary text-main transition-colors bg-surface rounded-lg border border-theme shadow-3xs flex items-center justify-center shrink-0 cursor-pointer",children:r.jsx(ci,{size:16})}),r.jsx(Gl,{lang:i}),r.jsx(Tg,{lang:i}),(()=>{const E=w==="error"||!x?{bg:"bg-rose-50 border-rose-200 text-rose-600 hover:bg-rose-100 animate-pulse",dot:"bg-rose-500",ping:"bg-rose-400",label:i==="zh"?"SQLite 数据库连接出错或已断开":"SQLite DB Error / Disconnected"}:w==="warning"?{bg:"bg-amber-50 border-amber-200 text-amber-600 hover:bg-amber-100",dot:"bg-amber-500",ping:"bg-amber-400",label:i==="zh"?"SQLite 数据库存在状态警告":"SQLite DB Warning"}:{bg:"bg-emerald-50 border-emerald-200 text-emerald-600 hover:bg-emerald-100",dot:"bg-emerald-500",ping:"bg-emerald-400",label:i==="zh"?"SQLite 数据库连接正常":"SQLite DB Connected & Normal"};return r.jsxs("div",{id:"db-connection-status-badge",className:`w-8 h-8 rounded-lg border flex items-center justify-center relative select-none shrink-0 cursor-pointer transition-colors shadow-3xs ${E.bg}`,title:E.label,children:[r.jsx(Cm,{size:15}),r.jsxs("span",{className:"absolute -top-0.5 -right-0.5 flex h-2.5 w-2.5",children:[r.jsx("span",{className:`animate-ping absolute inline-flex h-full w-full rounded-full opacity-75 ${E.ping}`}),r.jsx("span",{className:`relative inline-flex rounded-full h-2.5 w-2.5 ${E.dot}`})]})]})})(),r.jsx(Sg,{session:l,lang:i,onLogout:O,onProfile:()=>N(!0)})]})]})}function zg(){const[t,e]=f.useState(()=>typeof navigator>"u"?!0:navigator.onLine);return f.useEffect(()=>{const n=()=>e(!0),s=()=>e(!1);return window.addEventListener("online",n),window.addEventListener("offline",s),()=>{window.removeEventListener("online",n),window.removeEventListener("offline",s)}},[]),t}function Lg(){const t=Ft(),e=zg(),n=t?.lang??"zh",s=t?.activeRole??"teacher",i=t?.session;return r.jsx("footer",{id:"app-statusbar",role:"status",className:"h-7 shrink-0 border-t border-theme bg-surface text-muted text-xs flex items-center justify-end gap-3 px-4 empty:hidden",children:r.jsx(Oe,{slot:"statusbar.item",lang:n,fallback:r.jsx(r.Fragment,{}),slotProps:{session:i,currentRole:s,lang:n,isOnline:e}})})}function Rg({open:t,session:e,lang:n,onClose:s,onSaved:i,onAvatar:o}){const[a,l]=f.useState(e.name),[c,d]=f.useState(!1),[h,m]=f.useState(null),p=f.useRef(null),[u,g]=f.useState(!1),[x,w]=f.useState(null),[v,S]=f.useState(!1),[b,C]=f.useState(""),[N,y]=f.useState(""),[P,L]=f.useState(""),[_,O]=f.useState(!1),[T,A]=f.useState(null),[R,D]=f.useState(!1);if(!t)return null;const I=(q,J)=>n==="zh"?q:J,$=e.role==="teacher"?e.subRole==="administrator"?I("管理员","Administrator"):I("教师","Teacher"):I("学生","Student"),U=a.trim(),E=U.length>0&&U!==e.name,F=async()=>{if(!(!E||c)){d(!0),m(null);try{const q=await fetch("/api/auth/profile",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:U})}),J=await q.json();if(!q.ok){m(J.error||(n==="zh"?"保存失败":"Save failed"));return}i(J.name??U)}catch{m(n==="zh"?"网络错误,请重试":"Network error, please retry")}finally{d(!1)}}},j=b.length>0&&N.length>=8&&/[a-zA-Z]/.test(N)&&/[0-9]/.test(N)&&N===P,B=async()=>{if(!(!j||_)){O(!0),A(null);try{const q=await fetch("/api/auth/change-password",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({oldPassword:b,newPassword:N})}),J=await q.json();if(!q.ok){A(J.error||(n==="zh"?"修改失败":"Change failed"));return}D(!0),C(""),y(""),L(""),S(!1)}catch{A(n==="zh"?"网络错误,请重试":"Network error, please retry")}finally{O(!1)}}},X=async q=>{const J=q.target.files?.[0];if(q.target.value="",!!J){g(!0),w(null);try{const G=await new Promise((ye,ee)=>{const z=new FileReader;z.onload=()=>ye(z.result),z.onerror=()=>ee(z.error),z.readAsDataURL(J)}),re=await fetch("/api/auth/avatar",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({filename:J.name,base64Data:G})}),Y=await re.json();if(!re.ok){w(Y.error||(n==="zh"?"上传失败":"Upload failed"));return}o?.(Y.avatar)}catch{w(n==="zh"?"网络错误,请重试":"Network error, please retry")}finally{g(!1)}}},k=async()=>{g(!0),w(null);try{const q=await fetch("/api/auth/avatar",{method:"DELETE"}),J=await q.json().catch(()=>({}));if(!q.ok){w(J.error||(n==="zh"?"移除失败":"Remove failed"));return}o?.(null)}catch{w(n==="zh"?"网络错误,请重试":"Network error, please retry")}finally{g(!1)}};return r.jsx("div",{className:"fixed inset-0 bg-black/40 backdrop-blur-xs flex items-center justify-center z-50 p-4",onClick:s,children:r.jsxs("div",{className:"bg-white rounded-2xl shadow-xl w-full max-w-md overflow-hidden",onClick:q=>q.stopPropagation(),children:[r.jsxs("div",{className:"flex items-center justify-between px-5 py-4 border-b border-gray-100",children:[r.jsx("h3",{className:"font-semibold text-gray-800",children:I("个人资料","Profile")}),r.jsx("button",{onClick:s,className:"text-gray-400 hover:text-gray-600 cursor-pointer",children:r.jsx(Ie,{size:18})})]}),r.jsxs("div",{className:"p-5 space-y-5",children:[r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx("span",{className:"w-14 h-14 rounded-full bg-indigo-100 text-indigo-600 flex items-center justify-center shrink-0 overflow-hidden",children:e.avatar?r.jsx("img",{src:e.avatar,alt:e.name,className:"w-full h-full object-cover"}):r.jsx(as,{size:28})}),r.jsxs("div",{className:"min-w-0",children:[r.jsx("p",{className:"text-base font-semibold text-gray-800 truncate",children:e.name}),r.jsx("p",{className:"text-xs text-gray-400",children:$}),r.jsxs("div",{className:"mt-1.5 flex items-center gap-3",children:[r.jsx("button",{type:"button",onClick:()=>p.current?.click(),disabled:u,className:"text-xs text-indigo-600 hover:text-indigo-800 disabled:opacity-50 cursor-pointer",children:u?I("上传中…","Uploading…"):e.avatar?I("更换头像","Change avatar"):I("上传头像","Upload avatar")}),e.avatar&&r.jsx("button",{type:"button",onClick:k,disabled:u,className:"text-xs text-rose-500 hover:text-rose-700 disabled:opacity-50 cursor-pointer",children:I("移除","Remove")})]}),r.jsx("input",{ref:p,type:"file",accept:"image/png,image/jpeg,image/gif,image/webp",className:"hidden",onChange:X})]})]}),x&&r.jsx("p",{className:"text-xs text-rose-500",children:x}),r.jsxs("div",{children:[r.jsx("label",{className:"block text-sm text-gray-500 mb-1",children:I("显示名称","Display Name")}),r.jsxs("div",{className:"flex gap-2",children:[r.jsx("input",{value:a,onChange:q=>l(q.target.value),maxLength:50,className:"flex-1 border border-gray-300 rounded-lg px-3 py-2 text-sm text-gray-800 focus:outline-none focus:ring-2 focus:ring-indigo-200"}),r.jsx("button",{onClick:F,disabled:!E||c,className:"px-4 py-2 rounded-lg bg-indigo-600 text-white text-sm font-medium disabled:opacity-40 enabled:hover:bg-indigo-700 transition-colors cursor-pointer shrink-0",children:c?I("保存中…","Saving…"):I("保存","Save")})]}),h&&r.jsx("p",{className:"text-xs text-rose-500 mt-1",children:h})]}),r.jsxs("div",{className:"border-t border-gray-100 pt-4",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("span",{className:"text-sm font-medium text-gray-700 flex items-center gap-2",children:[r.jsx(Sl,{size:16,className:"text-gray-400"}),I("修改密码","Change Password")]}),!v&&!R&&r.jsx("button",{onClick:()=>{S(!0),A(null)},className:"text-sm text-indigo-600 hover:text-indigo-800 cursor-pointer",children:I("修改","Edit")})]}),R&&r.jsxs("p",{className:"mt-2 flex items-center gap-1.5 text-sm text-emerald-600",children:[r.jsx(it,{size:16}),I("密码已修改,其他设备的登录已失效","Password changed. Other devices were logged out.")]}),v&&r.jsxs("div",{className:"mt-3 space-y-3",children:[r.jsx("input",{type:"password",value:b,onChange:q=>C(q.target.value),placeholder:I("当前密码","Current password"),className:"w-full border border-gray-300 rounded-lg px-3 py-2 text-sm text-gray-800 focus:outline-none focus:ring-2 focus:ring-indigo-200"}),r.jsx("input",{type:"password",value:N,onChange:q=>y(q.target.value),placeholder:I("新密码(≥8 位,含字母和数字)","New password (≥8 chars, letters + numbers)"),className:"w-full border border-gray-300 rounded-lg px-3 py-2 text-sm text-gray-800 focus:outline-none focus:ring-2 focus:ring-indigo-200"}),r.jsx("input",{type:"password",value:P,onChange:q=>L(q.target.value),placeholder:I("确认新密码","Confirm new password"),className:"w-full border border-gray-300 rounded-lg px-3 py-2 text-sm text-gray-800 focus:outline-none focus:ring-2 focus:ring-indigo-200"}),T&&r.jsx("p",{className:"text-xs text-rose-500",children:T}),r.jsxs("div",{className:"flex gap-2 justify-end",children:[r.jsx("button",{onClick:()=>{S(!1),C(""),y(""),L(""),A(null)},className:"px-4 py-2 rounded-lg border border-gray-300 text-sm text-gray-600 hover:bg-gray-50 cursor-pointer",children:I("取消","Cancel")}),r.jsx("button",{onClick:B,disabled:!j||_,className:"px-4 py-2 rounded-lg bg-indigo-600 text-white text-sm font-medium disabled:opacity-40 enabled:hover:bg-indigo-700 transition-colors cursor-pointer",children:_?I("提交中…","Submitting…"):I("提交","Submit")})]})]})]}),r.jsxs("div",{className:"border-t border-gray-100 pt-4 space-y-2",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx("span",{className:"text-sm text-gray-400",children:I("用户名(登录账号)","Username (login)")}),r.jsx("span",{className:"text-sm font-medium text-gray-700 truncate max-w-[60%]",title:e.username,children:e.username||"-"})]}),r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx("span",{className:"text-sm text-gray-400",children:I("角色","Role")}),r.jsx("span",{className:"text-sm font-medium text-gray-700",children:$})]})]})]})]})})}const _g=f.lazy(()=>$e(()=>import("./StudentView-Bxrut8tS.js"),__vite__mapDeps([0,1,2,3,4])).then(t=>({default:t.StudentView}))),Dg=f.lazy(()=>$e(()=>import("./TeacherView-DXg0boJH.js"),__vite__mapDeps([5,1,2,3,4])).then(t=>({default:t.TeacherView})));function Mg(t){const{activeRole:e}=t;return r.jsx(f.Suspense,{fallback:r.jsxs("div",{className:"flex-1 flex flex-col items-center justify-center min-h-[50vh] text-slate-400 gap-3",children:[r.jsx(Pt,{className:"w-8 h-8 animate-spin text-indigo-500"}),r.jsx("span",{className:"text-sm font-medium tracking-wide",children:"正在加载工作台..."})]}),children:e==="student"?r.jsx(_g,{}):r.jsx(Dg,{})})}function Og(t={}){const e=Ft(),n=t.showRightSidebar??e?.showRightSidebar??!1,s=t.setShowRightSidebar??e?.setShowRightSidebar??(()=>{}),i=t.rightSidebarTab??e?.rightSidebarTab??"agent",o=t.setRightSidebarTab??e?.setRightSidebarTab??(()=>{}),a=t.effectiveAgentProviderId??e?.effectiveAgentProviderId??"";t.agentProviderId??e?.agentProviderId;const l=t.setAgentProviderId??e?.setAgentProviderId??(()=>{}),c=t.personaId??e?.personaId??"",d=t.setPersonaId??e?.setPersonaId??(()=>{}),h=t.aiProviders??e?.aiProviders??[],m=t.selectedAgentProvider!==void 0?t.selectedAgentProvider:e?.selectedAgentProvider??null,p=t.chatLog??e?.chatLog??[],u=t.loading??e?.loading??!1,g=t.input??e?.input??"",x=t.setInput??e?.setInput??(()=>{}),w=t.handleSend??e?.handleSend??(async()=>{}),v=t.chatAttachments??e?.chatAttachments??[],S=t.setChatAttachments??e?.setChatAttachments??(()=>{}),b=t.handleChatFileChange??e?.handleChatFileChange??(()=>{}),C=t.handleChatDrop??e?.handleChatDrop??(()=>{}),N=t.onClearAgentMemory??e?.handleClearAgentMemory??(()=>{}),y=t.events??e?.events??[],P=t.lang??e?.lang??"zh",L=t.t??e?.t??{},_=f.useRef(null);f.useEffect(()=>{_.current?.scrollIntoView({behavior:"smooth"})},[p]);const[O,T]=f.useState([]);return f.useEffect(()=>{!n||O.length>0||fetch("/api/agent/personas").then(A=>A.ok?A.json():null).then(A=>{A?.success&&Array.isArray(A.personas)&&T(A.personas)}).catch(()=>{})},[n]),r.jsx("div",{className:`transition-all duration-300 bg-white border-l border-gray-200 flex flex-col shadow-xl relative z-30 shrink-0 ${n?"w-96":"w-12 items-center cursor-pointer hover:bg-gray-50"}`,children:n?r.jsxs(r.Fragment,{children:[r.jsxs("div",{className:"flex bg-gray-100 p-1 m-4 rounded-lg shrink-0",children:[r.jsxs("button",{onClick:()=>o("agent"),className:`flex-1 py-1.5 text-xs font-medium rounded-md transition-colors flex items-center justify-center gap-1 ${i==="agent"?"bg-white shadow text-indigo-600":"text-gray-500 hover:text-gray-700"}`,children:[r.jsx(gr,{size:14})," Agent"]}),r.jsxs("button",{onClick:()=>o("shell"),className:`flex-1 py-1.5 text-xs font-medium rounded-md transition-colors flex items-center justify-center gap-1 ${i==="shell"?"bg-white shadow text-indigo-600":"text-gray-500 hover:text-gray-700"}`,children:[r.jsx(Es,{size:14})," Shell"]}),r.jsx(Oe,{slot:"ai_sidebar.tab",slotProps:{renderType:"button",activeTab:i,setActiveTab:o,lang:P}}),r.jsx("button",{onClick:()=>s(!1),className:"ml-1 p-1.5 text-gray-400 hover:text-gray-600 rounded-md",children:r.jsx(Nm,{size:14})})]}),i==="agent"?r.jsxs("div",{className:"flex-1 flex flex-col min-h-0",children:[r.jsx("div",{className:"p-4 border-b border-gray-100 shrink-0",children:r.jsxs("div",{className:"flex items-start justify-between gap-3",children:[r.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[r.jsx("div",{className:"p-1.5 bg-indigo-50 text-indigo-600 rounded-lg",children:r.jsx(gr,{size:16})}),r.jsxs("div",{className:"min-w-0",children:[r.jsx("h2",{className:"font-semibold text-gray-900 text-sm",children:L.agentTitle}),r.jsx("p",{className:"text-xs text-gray-500",children:L.agentSubtitle}),r.jsxs("button",{onClick:N,title:P==="zh"?"清除内核助手的对话记忆":"Clear the kernel assistant's conversation memory",className:"mt-1 inline-flex items-center gap-1 text-xs text-gray-400 hover:text-red-500 transition-colors",children:["🧹 ",P==="zh"?"清除记忆":"Clear memory"]})]})]}),r.jsxs("div",{className:"flex flex-col items-end gap-1.5 min-w-[150px] max-w-[50%]",children:[r.jsx("span",{className:"text-xs font-semibold uppercase tracking-[0.18em] text-gray-400",children:P==="zh"?"AI 提供商":"AI Provider"}),r.jsxs("div",{className:"relative w-full",children:[h.length===0?r.jsx("select",{disabled:!0,value:"",className:"w-full appearance-none rounded-xl border border-amber-200 bg-amber-50/50 px-3 py-2 pr-9 text-xs font-medium text-amber-700 shadow-xs outline-none cursor-not-allowed",children:r.jsx("option",{value:"",children:P==="zh"?"未配置 AI 提供商":"No AI Provider"})}):r.jsx("select",{value:a,onChange:A=>l(A.target.value),className:"w-full appearance-none rounded-xl border border-gray-200 bg-gradient-to-b from-white to-gray-50 px-3 py-2 pr-9 text-xs font-medium text-gray-700 shadow-xs outline-none transition-colors focus:border-indigo-400 focus:ring-2 focus:ring-indigo-100",children:h.map(A=>r.jsx("option",{value:A.id,children:A.name},A.id))}),r.jsx(fn,{size:12,className:"pointer-events-none absolute right-3 top-1/2 -translate-y-1/2 text-gray-400"})]}),r.jsx("div",{className:"text-xs text-gray-400 truncate w-full text-right",title:m?.model_name||"",children:m?`${m.model_name}`:P==="zh"?"未配置提供商":"No Provider"})]})]})}),d&&O.length>0&&r.jsx("div",{className:"mx-4 mb-3",children:r.jsxs("select",{value:c||"",onChange:A=>d(A.target.value),className:"w-full appearance-none rounded-xl border border-gray-200 bg-gradient-to-b from-white to-gray-50 px-3 py-2 text-xs font-medium text-gray-700 shadow-xs outline-none transition-colors focus:border-indigo-400 focus:ring-2 focus:ring-indigo-100",children:[r.jsx("option",{value:"",children:P==="zh"?"🤖 助教角色:默认":"🤖 Persona: Default"}),O.filter(A=>A.id!=="plain_assistant").map(A=>r.jsxs("option",{value:A.id,children:[A.icon||"🎯"," ",P==="zh"?A.nameZh:A.nameEn]},A.id))]})}),h.length===0&&r.jsxs("div",{className:"mx-4 mt-3 p-3 bg-amber-50 border border-amber-200/80 rounded-xl text-xs text-amber-900 flex items-start gap-2 shadow-xs shrink-0",children:[r.jsx(un,{size:15,className:"shrink-0 text-amber-600 mt-0.5"}),r.jsxs("div",{className:"flex-1 leading-relaxed",children:[r.jsx("span",{className:"font-semibold",children:P==="zh"?"未配置 AI 提供商":"No AI Provider Configured"}),r.jsx("p",{className:"mt-0.5 text-amber-700",children:P==="zh"?"请前往「系统管理 -> AI 提供商管理」添加大模型服务(如 DeepSeek、Qwen、OpenAI 等)。":'Please configure an AI provider in "System Management -> AI Provider Management" to use the AI assistant.'})]})]}),r.jsxs("div",{className:"flex-1 overflow-y-auto p-4 space-y-4",children:[p.map((A,R)=>r.jsx("div",{className:`flex flex-col ${A.role==="user"?"items-end":"items-start"}`,children:r.jsx("div",{className:`px-4 py-2.5 rounded-2xl max-w-[85%] text-xs whitespace-pre-wrap ${A.role==="user"?"bg-indigo-600 text-white rounded-br-none":"bg-gray-100 text-gray-800 rounded-bl-none"}`,children:A.content})},R)),u&&r.jsx("div",{className:"flex items-start",children:r.jsxs("div",{className:"px-4 py-2.5 rounded-2xl max-w-[85%] text-xs bg-gray-100 text-gray-500 rounded-bl-none flex items-center gap-1",children:[r.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-gray-400 animate-bounce"}),r.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-gray-400 animate-bounce",style:{animationDelay:"0.1s"}}),r.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-gray-400 animate-bounce",style:{animationDelay:"0.2s"}})]})}),r.jsx("div",{ref:_})]}),r.jsxs("form",{onSubmit:w,className:"p-3 border-t border-gray-100 bg-white shrink-0 font-sans",onDragOver:A=>A.preventDefault(),onDrop:C,children:[v.length>0&&r.jsx("div",{className:"flex flex-wrap gap-1 mb-2 px-1",children:v.map((A,R)=>r.jsxs("div",{className:"flex items-center gap-1 bg-indigo-50 border border-indigo-100 text-indigo-700 px-2 py-0.5 rounded-full text-xs",children:[r.jsx(Em,{size:10,className:"shrink-0"}),r.jsx("span",{className:"truncate max-w-[100px]",title:A.name,children:A.name}),r.jsx("button",{type:"button",onClick:()=>S(D=>D.filter((I,$)=>$!==R)),className:"hover:bg-indigo-200 rounded-full p-0.5 cursor-pointer ml-0.5 transition-colors text-indigo-400 hover:text-indigo-600",children:r.jsx(Ie,{size:10})})]},R))}),r.jsxs("div",{className:"flex items-center gap-1.5",children:[r.jsxs("label",{className:"p-1 px-1.5 text-gray-500 hover:text-indigo-600 rounded-full hover:bg-gray-100 cursor-pointer transition-colors shrink-0",children:[r.jsx(Pm,{size:14}),r.jsx("input",{type:"file",multiple:!0,className:"hidden",onChange:b,accept:".csv,.txt,.json,.md"})]}),r.jsxs("div",{className:"relative flex-1",children:[r.jsx("input",{type:"text",value:g,disabled:h.length===0,onChange:A=>x(A.target.value),placeholder:h.length===0?P==="zh"?"请先配置 AI 提供商":"Please configure AI provider first":L.placeholder,className:"w-full bg-gray-50 border border-gray-200 rounded-full pl-4 pr-10 py-1.5 text-xs focus:outline-none focus:ring-2 focus:ring-indigo-500 focus:border-transparent transition-all disabled:opacity-60 disabled:cursor-not-allowed"}),r.jsx("button",{type:"submit",disabled:u||!g.trim()||h.length===0,className:"absolute right-1 top-1/2 -translate-y-1/2 p-1 bg-indigo-600 text-white rounded-full hover:bg-indigo-700 disabled:opacity-50 transition-colors cursor-pointer disabled:cursor-not-allowed",children:r.jsx(El,{size:10})})]})]})]})]}):i==="shell"?r.jsxs("div",{className:"flex-1 flex flex-col bg-black text-green-400 font-mono text-xs min-h-0 mx-4 mb-4 rounded-xl shadow-inner border border-gray-800 overflow-hidden",children:[r.jsx("div",{className:"p-3 border-b border-gray-800 flex items-center justify-between shrink-0 bg-gray-900",children:r.jsxs("div",{className:"flex items-center gap-2 text-gray-300 font-sans tracking-wide",children:[r.jsx(Es,{size:14}),r.jsx("span",{className:"text-xs",children:L.eventStream})]})}),r.jsx("div",{className:"p-3 overflow-y-auto flex-1 flex flex-col gap-1 select-text",children:y.length===0?r.jsx("div",{className:"text-gray-600 italic",children:"Waiting for events..."}):y.map((A,R)=>r.jsxs("div",{className:"flex flex-col gap-1 hover:bg-gray-800/50 p-2 rounded mb-1",children:[r.jsxs("div",{className:"flex items-center gap-2 justify-between",children:[r.jsxs("span",{className:"text-gray-500 shrink-0 text-xs",children:["[",new Date(A.timestamp).toLocaleTimeString(),"]"]}),r.jsx("span",{className:"text-blue-400 shrink-0 truncate text-xs",title:A.source,children:A.source})]}),r.jsx("div",{className:"text-green-300 font-bold",children:A.type}),r.jsx("div",{className:"text-gray-400 break-words mt-1 leading-tight",children:A.payload})]},R))})]}):r.jsx("div",{className:"flex-1 flex flex-col min-h-0 overflow-y-auto p-4",children:r.jsx(Oe,{slot:"ai_sidebar.tab",slotProps:{renderType:"panel",activeTab:i,lang:P}})})]}):r.jsxs("div",{className:"flex flex-col items-center py-6 h-full text-gray-400 w-full",onClick:()=>s(!0),children:[r.jsx(gr,{size:18,className:"mb-6 hover:text-indigo-500"}),r.jsx(Es,{size:18,className:"hover:text-indigo-500"}),r.jsx("div",{className:"mt-8 flex-1 flex flex-col justify-end pb-8",children:r.jsx("div",{className:"uppercase tracking-widest text-xs rotate-180",style:{writingMode:"vertical-rl"},children:"OS Core Options"})})]})})}const $g=f.lazy(()=>$e(()=>import("./ImportModal-ChY_Y5DZ.js"),__vite__mapDeps([6,1,2,3])).then(t=>({default:t.ImportModal}))),Fg=f.lazy(()=>$e(()=>import("./CourseWizardModal-D2m3PG7k.js"),__vite__mapDeps([7,1,2,3,4])).then(t=>({default:t.CourseWizardModal}))),Bg=f.lazy(()=>$e(()=>import("./ImportLessonsModal-DUGpcZV3.js"),__vite__mapDeps([8,1,2,3,4])).then(t=>({default:t.ImportLessonsModal}))),Vg=f.lazy(()=>$e(()=>import("./QuizGeneratorModal-CbRirQId.js"),__vite__mapDeps([9,1,2,3,4])).then(t=>({default:t.QuizGeneratorModal}))),Ug=f.lazy(()=>$e(()=>import("./ProcessLogsModal-DfKPVIYe.js"),__vite__mapDeps([10,1,2,3])).then(t=>({default:t.ProcessLogsModal}))),Hg=f.lazy(()=>$e(()=>import("./CloudDriveModal-CLe4I18S.js"),__vite__mapDeps([11,1,2,12,3,4])).then(t=>({default:t.CloudDriveModal}))),qg=f.lazy(()=>$e(()=>import("./SystemResourceLibraryModal-CXdrWHDL.js"),__vite__mapDeps([13,1,2,11,12,3,4])).then(t=>({default:t.SystemResourceLibraryModal}))),Wg=f.lazy(()=>$e(()=>import("./BatchPickerModal-CES2DlPx.js"),__vite__mapDeps([14,1,2,3,4])).then(t=>({default:t.BatchPickerModal}))),Gg=f.lazy(()=>$e(()=>import("./ExportWeightModal-C3gIzDaP.js"),__vite__mapDeps([15,1,2,3,4])).then(t=>({default:t.ExportWeightModal}))),Qg=f.lazy(()=>$e(()=>import("./NotificationDetailModal-BBATA8Lh.js"),__vite__mapDeps([16,1,2,3,4])).then(t=>({default:t.NotificationDetailModal}))),Jg=f.lazy(()=>$e(()=>import("./HelpTour-B-RKDb1-.js"),__vite__mapDeps([17,1,2,3])).then(t=>({default:t.HelpTour}))),Kg=f.lazy(()=>$e(()=>import("./CoursewareHubPanel-gqjte-Pv.js"),__vite__mapDeps([18,1,2,3])).then(t=>({default:t.CoursewareHubPanel})));function Zg(t={}){const e=Ft(),{lang:n=e?.lang??"zh",t:s=e?.t??{},showImportModal:i=e?.showImportModal??!1,setShowImportModal:o=e?.setShowImportModal??(()=>{}),handleImportFile:a=e?.handleImportFile??(()=>{}),importError:l=e?.importError??null,importSuccess:c=e?.importSuccess??null,isImporting:d=e?.isImporting??!1,downloadCSVTemplate:h=e?.downloadCSVTemplate??(()=>{}),addToast:m=e?.addToast??(()=>{}),generateTemplateContent:p=e?.generateTemplateContent??(()=>""),isImportLessonsOpen:u=e?.isImportLessonsOpen??!1,setIsImportLessonsOpen:g=e?.setIsImportLessonsOpen??(()=>{}),importStatus:x=e?.importStatus??"idle",setIsDraggingImport:w=e?.setIsDraggingImport??(()=>{}),handleCSVFileChange:v=e?.handleCSVFileChange??(()=>{}),downloadCsvTemplate:S=e?.downloadCsvTemplate??(()=>{}),isDraggingImport:b=e?.isDraggingImport??!1,previewImportData:C=e?.previewImportData??[],setPreviewImportData:N=e?.setPreviewImportData??(()=>{}),setImportStatus:y=e?.setImportStatus??(()=>{}),importProgress:P=e?.importProgress??0,importProgressTotal:L=e?.importProgressTotal??0,importErrorMsg:_=e?.importErrorMsg??"",setImportErrorMsg:O=e?.setImportErrorMsg??(()=>{}),handleCSVImportSubmit:T=e?.handleCSVImportSubmit??(()=>{}),lessons:A=e?.lessons??[],fetchClassDashboard:R=e?.fetchClassDashboard??(()=>{}),currentVfsParent:D=e?.currentVfsParent??null,setCurrentVfsParent:I=e?.setCurrentVfsParent??(()=>{}),vfsNodes:$=e?.vfsNodes??[],showProcessLogs:U=e?.showProcessLogs??null,setShowProcessLogs:E=e?.setShowProcessLogs??(()=>{}),processLogsContent:F=e?.processLogsContent??"",isCloudDriveOpen:j=e?.isCloudDriveOpen??!1,setIsCloudDriveOpen:B=e?.setIsCloudDriveOpen??(()=>{}),cloudDrivePreviewNode:X=e?.cloudDrivePreviewNode??null,setCloudDrivePreviewNode:k=e?.setCloudDrivePreviewNode??(()=>{}),isSystemResourceLibraryOpen:q=e?.isSystemResourceLibraryOpen??!1,setIsSystemResourceLibraryOpen:J=e?.setIsSystemResourceLibraryOpen??(()=>{}),systemResourceTab:G=e?.systemResourceTab??"system",setSystemResourceTab:re=e?.setSystemResourceTab??(()=>{}),selectedLibraryResourceId:Y=e?.selectedLibraryResourceId??null,setSelectedLibraryResourceId:ye=e?.setSelectedLibraryResourceId??(()=>{}),loadingLibraryResources:ee=e?.loadingLibraryResources??!1,libraryResources:z=e?.libraryResources??[],fetchLibraryResources:W=e?.fetchLibraryResources??(()=>{}),classes:K=e?.classes??[],expandedClassId:ne=e?.expandedClassId??null,isExportWeightModalOpen:te=e?.isExportWeightModalOpen??!1,setIsExportWeightModalOpen:me=e?.setIsExportWeightModalOpen??(()=>{}),quizzesWeight:je=e?.quizzesWeight??40,setQuizzesWeight:Q=e?.setQuizzesWeight??(()=>{}),assignmentsWeight:se=e?.assignmentsWeight??60,setAssignmentsWeight:Z=e?.setAssignmentsWeight??(()=>{}),handleQuizzesWeightChange:pe=e?.handleQuizzesWeightChange??(()=>{}),handleAssignmentsWeightChange:le=e?.handleAssignmentsWeightChange??(()=>{}),customCategoryOverrides:he=e?.customCategoryOverrides??{},setCustomCategoryOverrides:Ce=e?.setCustomCategoryOverrides??(()=>{}),classDashboardMap:Ee=e?.classDashboardMap??{},exportClassId:M=e?.exportClassId??"",exportClassName:V=e?.exportClassName??"",csvPreviewData:ie=e?.csvPreviewData??null,handleExportGrades:oe=e?.handleExportGrades??(()=>{}),setSelectedAssignment:fe=e?.setSelectedAssignment??(()=>{}),setStudentViewStatus:Ae=e?.setStudentViewStatus??(()=>{}),setQuizStudentAnswers:Ve=e?.setQuizStudentAnswers??(()=>{}),setSubAssignmentTab:Ue=e?.setSubAssignmentTab??(()=>{}),isTourOpen:at=e?.isTourOpen??!1,setIsTourOpen:lt=e?.setIsTourOpen??(()=>{}),handleSeedSuccess:Pe=e?.handleSeedSuccess??(()=>{}),setTeacherTab:Qe=e?.setTeacherTab??(()=>{}),showCoursewareHub:Fe=e?.showCoursewareHub??!1,setShowCoursewareHub:yn=e?.setShowCoursewareHub??(()=>{})}=t,Re=t.courseWizard??e,wn=Re?.isCourseWizardOpen??t.isCourseWizardOpen??!1,vn=Re?.setIsCourseWizardOpen??t.setIsCourseWizardOpen??(()=>{}),Sn=Re?.wizardStep??t.wizardStep??1,At=Re?.setWizardStep??t.setWizardStep??(()=>{}),Vt=Re?.wizardIsSubmitting??t.wizardIsSubmitting??!1,Ut=Re?.wizardCourseTitle??t.wizardCourseTitle??"",jn=Re?.setWizardCourseTitle??t.setWizardCourseTitle??(()=>{}),kn=Re?.wizardCourseDescription??t.wizardCourseDescription??"",Cn=Re?.setWizardCourseDescription??t.setWizardCourseDescription??(()=>{}),Ht=Re?.wizardCourseCategory??t.wizardCourseCategory??"",Nn=Re?.setWizardCourseCategory??t.setWizardCourseCategory??(()=>{}),En=Re?.wizardCourseTimeline??t.wizardCourseTimeline??[],Pn=Re?.setWizardCourseTimeline??t.setWizardCourseTimeline??(()=>{}),qt=Re?.wizardCourseContent??t.wizardCourseContent??"",Tn=Re?.setWizardCourseContent??t.setWizardCourseContent??(()=>{}),Wt=Re?.handleDeployWizardCourse??t.handleDeployWizardCourse??(()=>{}),ke=t.quizGenerator??e,xt=ke?.isQuizGeneratorOpen??t.isQuizGeneratorOpen??!1,In=ke?.setIsQuizGeneratorOpen??t.setIsQuizGeneratorOpen??(()=>{}),An=ke?.quizGenMode??t.quizGenMode??"scan_lesson",zn=ke?.setQuizGenMode??t.setQuizGenMode??(()=>{}),Ln=ke?.quizGenSelectedLessonId??t.quizGenSelectedLessonId??"",bt=ke?.setQuizGenSelectedLessonId??t.setQuizGenSelectedLessonId??(()=>{}),Gt=ke?.quizGenTopic??t.quizGenTopic??"",Rn=ke?.setQuizGenTopic??t.setQuizGenTopic??(()=>{}),_n=ke?.isGeneratingSuggestions??t.isGeneratingSuggestions??!1,Dn=ke?.setIsGeneratingSuggestions??t.setIsGeneratingSuggestions??(()=>{}),Mn=ke?.suggestedObjectives??t.suggestedObjectives??[],On=ke?.setSuggestedObjectives??t.setSuggestedObjectives??(()=>{}),$n=ke?.suggestedQuestions??t.suggestedQuestions??[],Fn=ke?.setSuggestedQuestions??t.setSuggestedQuestions??(()=>{}),Bn=ke?.quizGenTimeLimit??t.quizGenTimeLimit??0,Vn=ke?.setQuizGenTimeLimit??t.setQuizGenTimeLimit??(()=>{}),Un=ke?.savingQuiz??t.savingQuiz??!1,Hn=ke?.setSavingQuiz??t.setSavingQuiz??(()=>{}),qn=ke?.quizGeneratorClassId??t.quizGeneratorClassId??null,Je=t.classBatch??e,Wn=Je?.batchPicker??t.batchPicker??null,Qt=Je?.setBatchPicker??t.setBatchPicker??(()=>{}),be=Je?.batchPickerLesson??t.batchPickerLesson??"",et=Je?.setBatchPickerLesson??t.setBatchPickerLesson??(()=>{}),Jt=Je?.batchPickerDate??t.batchPickerDate??"",ge=Je?.setBatchPickerDate??t.setBatchPickerDate??(()=>{}),He=Je?.batchPickerTargetClass??t.batchPickerTargetClass??"",ct=Je?.setBatchPickerTargetClass??t.setBatchPickerTargetClass??(()=>{}),fs=Je?.confirmBatchPicker??t.confirmBatchPicker??(()=>{}),zt=t.studentNotificationsHook??e,Ke=zt?.selectedNotificationForModal??t.selectedNotificationForModal??null,Lt=zt?.setSelectedNotificationForModal??t.setSelectedNotificationForModal??(()=>{});return r.jsxs(f.Suspense,{fallback:null,children:[r.jsx($g,{show:i,onClose:()=>o(!1),lang:n,handleImportFile:a,importError:l,importSuccess:c,isImporting:d,downloadCSVTemplate:h}),r.jsx(Fg,{isCourseWizardOpen:wn,setIsCourseWizardOpen:vn,lang:n,wizardStep:Sn,setWizardStep:At,wizardIsSubmitting:Vt,wizardCourseTitle:Ut,setWizardCourseTitle:jn,wizardCourseDescription:kn,setWizardCourseDescription:Cn,wizardCourseCategory:Ht,setWizardCourseCategory:Nn,wizardCourseTimeline:En,setWizardCourseTimeline:Pn,wizardCourseContent:qt,setWizardCourseContent:Tn,addToast:m,generateTemplateContent:p,handleDeployWizardCourse:Wt}),r.jsx(Bg,{isImportLessonsOpen:u,setIsImportLessonsOpen:g,lang:n,importStatus:x,setIsDraggingImport:w,handleCSVFileChange:v,downloadCsvTemplate:S,isDraggingImport:b,previewImportData:C,setPreviewImportData:N,setImportStatus:y,importProgress:P,importProgressTotal:L,importErrorMsg:_,setImportErrorMsg:O,handleCSVImportSubmit:T}),r.jsx(Vg,{isQuizGeneratorOpen:xt,setIsQuizGeneratorOpen:In,lessons:A,quizGenMode:An,setQuizGenMode:zn,quizGenSelectedLessonId:Ln,setQuizGenSelectedLessonId:bt,quizGenTopic:Gt,setQuizGenTopic:Rn,isGeneratingSuggestions:_n,setIsGeneratingSuggestions:Dn,suggestedObjectives:Mn,setSuggestedObjectives:On,suggestedQuestions:$n,setSuggestedQuestions:Fn,quizGenTimeLimit:Bn,setQuizGenTimeLimit:Vn,savingQuiz:Un,setSavingQuiz:Hn,quizGeneratorClassId:qn,fetchClassDashboard:R}),r.jsx(Ug,{showProcessLogs:U,setShowProcessLogs:E,processLogsContent:F,t:s}),r.jsx(Hg,{isOpen:j,onClose:()=>B(!1),vfsNodes:$,currentVfsParent:D,setCurrentVfsParent:I,cloudDrivePreviewNode:X,setCloudDrivePreviewNode:k}),r.jsx(qg,{isSystemResourceLibraryOpen:q,setIsSystemResourceLibraryOpen:J,lang:n,systemResourceTab:G,setSystemResourceTab:re,selectedLibraryResourceId:Y,setSelectedLibraryResourceId:ye,vfsNodes:$,currentVfsParent:D,setCurrentVfsParent:I,cloudDrivePreviewNode:X,setCloudDrivePreviewNode:k,loadingLibraryResources:ee,libraryResources:z,fetchLibraryResources:W}),r.jsx(Wg,{batchPicker:Wn,setBatchPicker:Qt,batchPickerLesson:be,setBatchPickerLesson:ze=>et(typeof ze=="function"?ze(be):ze),batchPickerDate:Jt,setBatchPickerDate:ze=>ge(typeof ze=="function"?ze(Jt):ze),batchPickerTargetClass:He,setBatchPickerTargetClass:ze=>ct(typeof ze=="function"?ze(He):ze),lessons:A,classes:K,expandedClassId:ne,confirmBatchPicker:fs,lang:n}),r.jsx(Gg,{isExportWeightModalOpen:te,setIsExportWeightModalOpen:me,lang:n,quizzesWeight:je,setQuizzesWeight:Q,assignmentsWeight:se,setAssignmentsWeight:Z,handleQuizzesWeightChange:pe,handleAssignmentsWeightChange:le,customCategoryOverrides:he,setCustomCategoryOverrides:Ce,classDashboardMap:Ee,exportClassId:M,exportClassName:V,csvPreviewData:ie,handleExportGrades:oe}),r.jsx(Qg,{notification:Ke,onClose:()=>Lt(null),lang:n,onOpenWorkspace:ze=>{fe(ze),Ae("assignment"),Ve({}),Ue("quiz")}}),r.jsx(Jg,{isOpen:at,onClose:()=>lt(!1),lang:n,onSeedSuccess:Pe,onJumpTab:ze=>Qe(ze)}),Fe&&r.jsx(Kg,{onClose:()=>yn(!1),lang:n})]})}const Yg="openlearn_live_classroom_sync";class Ql{constructor(e=Yg,n,s){this.channel=null,this.isDestroyed=!1,this.messageListeners=[],this.lessonId=null,this.classId=null,this.socketBoundTo=null,this.offSocketReady=null,this.handleRemoteSync=i=>{this.isDestroyed||!i?.message||this.lessonId&&i.lessonId&&i.lessonId!==this.lessonId||this.emitToListeners(i.message)},this.lessonId=n||null,this.classId=s||null,typeof window<"u"&&typeof window.BroadcastChannel<"u"&&(this.channel=new BroadcastChannel(e),this.channel.onmessage=i=>{this.isDestroyed||!i.data||this.emitToListeners(i.data)}),this.offSocketReady=Hi(()=>this.ensureSocketBound())}ensureSocketBound(){if(this.isDestroyed)return;const e=tt();!e||e===this.socketBoundTo||(this.unbindSocket(),e.on("classroom:sync_message",this.handleRemoteSync),this.socketBoundTo=e)}unbindSocket(){this.socketBoundTo&&(this.socketBoundTo.off("classroom:sync_message",this.handleRemoteSync),this.socketBoundTo=null)}setLessonContext(e,n){this.lessonId=e,n!==void 0&&(this.classId=n)}emitToListeners(e){this.messageListeners.forEach(n=>{try{n(e)}catch(s){console.error("[ClassroomSyncChannel] Listener error:",s)}})}onMessage(e){return this.ensureSocketBound(),this.messageListeners.push(e),()=>{this.messageListeners=this.messageListeners.filter(n=>n!==e)}}postMessage(e){if(this.isDestroyed)return;if(this.ensureSocketBound(),this.channel)try{this.channel.postMessage(e)}catch(s){console.warn("[ClassroomSyncChannel] Failed to post message to BroadcastChannel:",s)}const n=tt();if(n&&this.lessonId)try{n.emit("teacher-sync-message",{lessonId:this.lessonId,message:e})}catch(s){console.warn("[ClassroomSyncChannel] Failed to emit socket sync message:",s)}}broadcastInitState(e){this.postMessage({type:"TEACHER_INIT_STATE",payload:e})}broadcastChangeLesson(e){this.lessonId=e,this.postMessage({type:"TEACHER_CHANGE_LESSON",payload:{lessonId:e,classId:this.classId}});const n=tt();n&&e&&n.emit("teacher-broadcast-lesson",{lessonId:e,classId:this.classId})}broadcastChangeSegment(e){this.postMessage({type:"TEACHER_CHANGE_SEGMENT",payload:{segmentId:e,lessonId:this.lessonId}});const n=tt();n&&this.lessonId&&e&&n.emit("teacher-broadcast-segment",{lessonId:this.lessonId,activeSegmentId:e})}broadcastChangeTab(e){this.postMessage({type:"TEACHER_CHANGE_TAB",payload:{tab:e,lessonId:this.lessonId}});const n=tt();n&&this.lessonId&&n.emit("teacher-broadcast-tab",{lessonId:this.lessonId,tab:e})}broadcastLockClass(e){this.postMessage({type:"TEACHER_LOCK_CLASS",payload:{locked:e,lessonId:this.lessonId,classId:this.classId}});const n=tt();n&&this.lessonId&&n.emit("teacher-broadcast-lock",{lessonId:this.lessonId,locked:e,classId:this.classId})}broadcastPickStudent(e,n){this.postMessage({type:"TEACHER_PICK_STUDENT",payload:{studentId:e,studentName:n}});const s=tt();s&&s.emit("teacher-pick-student",{studentId:e,studentName:n,lessonId:this.lessonId,classId:this.classId})}broadcastSyncTimer(e,n){this.postMessage({type:"TEACHER_SYNC_TIMER",payload:{timeRemaining:e,isRunning:n,lessonId:this.lessonId}})}broadcastCountdown(e){this.postMessage({type:"TEACHER_BROADCAST_COUNTDOWN",payload:e}),this.broadcastSyncTimer(e.timeRemaining,e.isRunning)}broadcastPingStudent(e,n){this.postMessage({type:"TEACHER_PING_STUDENT",payload:{studentId:e,message:n}});const s=tt();s&&this.lessonId&&s.emit("teacher-ping-student",{studentId:e,lessonId:this.lessonId,message:n})}broadcastFullscreen(e,n){const s=n||this.lessonId||void 0;this.postMessage({type:"TEACHER_BROADCAST_FULLSCREEN",payload:{elementId:e,lessonId:s}});const i=tt();i&&s&&i.emit("teacher-broadcast-fullscreen",{elementId:e,lessonId:s,classId:this.classId})}requestHandshake(){this.postMessage({type:"STUDENT_HANDSHAKE_REQUEST"})}acknowledgePick(e){this.postMessage({type:"STUDENT_ACKNOWLEDGE_PICK",payload:{studentId:e}});const n=tt();n&&n.emit("student-acknowledge-pick",{studentId:e,lessonId:this.lessonId})}sendHeartbeat(e){this.postMessage({type:"STUDENT_HEARTBEAT",payload:{studentId:e,timestamp:Date.now()}})}destroy(){this.isDestroyed=!0,this.messageListeners=[],this.offSocketReady?.(),this.offSocketReady=null,this.unbindSocket(),this.channel&&(this.channel.close(),this.channel=null)}}async function Xg(t){const e=await fetch(`/api/students/${t}/read_notifications`);return e.ok?{ok:!0,data:await e.json()}:{ok:!1}}async function ex(t,e){await fetch(`/api/students/${t}/read_notifications`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({notificationId:e})})}async function tx(t,e){await fetch(`/api/students/${t}/progress`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}async function nx(t,e){const n=await fetch(`/api/classes/${t}/lessons/${e}/progress`);return n.ok?{ok:!0,data:await n.json()}:{ok:!1}}async function sx(t){const e=await fetch(`/api/students/${t}/progress`);return e.ok?{ok:!0,data:await e.json()}:{ok:!1}}function rx(t,e,n=typeof window<"u"?window:null){const s=f.useRef(e);s.current=e,f.useEffect(()=>{if(!n)return;const i=o=>{const a=o;s.current?.(a.detail,a)};return n.addEventListener(t,i),()=>{n.removeEventListener(t,i)}},[t,n])}function ix(){try{const t=window.AudioContext||window.webkitAudioContext;if(!t)return;const e=new t,n=e.currentTime,s=e.createOscillator(),i=e.createGain();s.type="sine",s.frequency.setValueAtTime(587.33,n),s.frequency.exponentialRampToValueAtTime(880,n+.3),i.gain.setValueAtTime(.25,n),i.gain.exponentialRampToValueAtTime(.001,n+.8),s.connect(i),i.connect(e.destination),s.start(n),s.stop(n+.8)}catch{}}function ox({lessonId:t,lang:e="zh",syncChannel:n}){const[s,i]=f.useState(null),[o,a]=f.useState(!1),[l,c]=f.useState(!0),[d,h]=f.useState(!1),m=f.useRef(s);m.current=s,f.useEffect(()=>{if(!t)return;let S=null,b;try{S=n||new Ql,b=S.onMessage(P=>{P.type==="TEACHER_BROADCAST_COUNTDOWN"?i(P.payload):P.type==="TEACHER_SYNC_TIMER"&&i(L=>L?{...L,timeRemaining:P.payload.timeRemaining,isRunning:P.payload.isRunning,endsAt:P.payload.isRunning?Date.now()+P.payload.timeRemaining*1e3:null}:{lessonId:t,totalDuration:Math.max(300,P.payload.timeRemaining),timeRemaining:P.payload.timeRemaining,isRunning:P.payload.isRunning,isPaused:!1,label:e==="zh"?"⏱️ 课堂限时任务":"⏱️ Timed Task",endsAt:P.payload.isRunning?Date.now()+P.payload.timeRemaining*1e3:null,updatedAt:Date.now()})})}catch{}(async()=>{try{const P=await fetch(`/api/classroom/sessions/${t}/countdown`);if(P.ok){const L=await P.json();L.success&&L.countdown&&i(L.countdown)}}catch{}})();let N=null;const y=Hi(P=>{const L=_=>{!_||_.lessonId&&_.lessonId!==t||i(_)};N?.(),P.on("classroom:countdown_updated",L),N=()=>P.off("classroom:countdown_updated",L)});return()=>{b?.(),y(),N?.(),!n&&typeof S?.destroy=="function"&&S.destroy()}},[t,e]),rx("openlearn:countdown:updated",S=>{S&&i(S)});const p=f.useRef(null);if(f.useEffect(()=>{!s?.isRunning||!s.endsAt||p.current!==s.endsAt&&(p.current=s.endsAt,h(!1))},[s?.isRunning,s?.endsAt]),f.useEffect(()=>{if(!s||!s.isRunning||!s.endsAt)return;const S=setInterval(()=>{const b=m.current;if(!b||!b.isRunning||!b.endsAt)return;const C=Date.now(),N=Math.max(0,Math.round((b.endsAt-C)/1e3));if(N!==b.timeRemaining){const y={...b,timeRemaining:N,updatedAt:C};N<=0&&(y.isRunning=!1,y.isPaused=!1,y.endsAt=null,l&&!d&&(ix(),h(!0))),i(y);try{window.dispatchEvent(new CustomEvent("openlearn:student:countdown_tick",{detail:{timeRemaining:N,totalDuration:b.totalDuration,label:b.label}}))}catch{}}},500);return()=>clearInterval(S)},[s?.isRunning,s?.endsAt,l,d]),!s||s.timeRemaining===0&&!s.isRunning&&!d)return null;const u=S=>{const b=Math.floor(S/60),C=S%60,N=y=>y.toString().padStart(2,"0");return`${N(b)}:${N(C)}`},g=s.totalDuration>0?Math.min(100,Math.max(0,s.timeRemaining/s.totalDuration*100)):0,x=s.timeRemaining>0&&s.timeRemaining<=60,w=s.timeRemaining>60&&s.timeRemaining<=180,v=s.timeRemaining===0;return r.jsx("aside",{id:"student-classroom-countdown-banner","aria-label":e==="zh"?"课堂倒计时通知":"Classroom Countdown Alert",className:`fixed top-4 right-6 z-50 transition-all duration-300 select-none ${o?"w-auto":"w-72 sm:w-80"}`,children:r.jsxs("div",{className:`bg-surface/95 backdrop-blur-md border rounded-2xl shadow-2xl p-3 flex flex-col gap-2 transition-all ${x?"border-rose-500/80 shadow-rose-500/20":w?"border-amber-500/80 shadow-amber-500/20":v?"border-emerald-500/80 shadow-emerald-500/20":"border-theme shadow-primary-theme/10"}`,children:[r.jsxs("div",{className:"flex items-center justify-between gap-1",children:[r.jsxs("div",{className:"flex items-center gap-1.5 min-w-0",children:[r.jsx("span",{className:`p-1 rounded-lg text-white shrink-0 ${x?"bg-rose-500 animate-pulse":w?"bg-amber-500":v?"bg-emerald-500":"bg-primary-theme"}`,children:r.jsx(Tl,{size:12,className:s.isRunning?"animate-spin":"",style:{animationDuration:"6s"}})}),r.jsx("span",{className:"text-xs font-bold text-main truncate",children:s.label||(e==="zh"?"课堂任务":"Task")})]}),r.jsxs("div",{className:"flex items-center gap-1 shrink-0",children:[r.jsx("button",{type:"button",onClick:()=>c(!l),className:"p-1 rounded-md text-muted hover:text-main text-xs transition-colors cursor-pointer",title:l?"提示音已开启":"提示音已静音",children:l?r.jsx(Tm,{size:12}):r.jsx(Im,{size:12})}),r.jsx("button",{type:"button",onClick:()=>a(!o),className:"p-1 rounded-md text-muted hover:text-main text-xs transition-colors cursor-pointer",title:o?"展开":"收起",children:o?r.jsx(fn,{size:12}):r.jsx(Am,{size:12})})]})]}),!o&&r.jsxs(r.Fragment,{children:[r.jsxs("div",{className:"flex items-baseline justify-between px-1",children:[r.jsx("span",{id:"student-countdown-digits",className:`text-2xl font-black font-mono tracking-widest ${x?"text-rose-500 animate-pulse":w?"text-amber-500":v?"text-emerald-500":"text-primary-theme"}`,children:u(s.timeRemaining)}),r.jsx("span",{className:"text-[11px] font-semibold text-muted",children:v?e==="zh"?"🎉 时间已截止!":"Time is up!":s.isPaused?e==="zh"?"⏸️ 老师已暂停计时":"Paused":e==="zh"?"与全班同步中":"Synced"})]}),r.jsx("div",{className:"w-full h-1.5 bg-surface-secondary rounded-full overflow-hidden",children:r.jsx("div",{className:`h-full transition-all duration-500 ${x?"bg-rose-500":w?"bg-amber-500":v?"bg-emerald-500":"bg-primary-theme"}`,style:{width:`${g}%`}})}),r.jsx(Oe,{slot:"student.classroom.countdown",slotProps:{countdown:s,lang:e}})]})]})})}const ax={id:"core-q-1",question:"关于变力沿曲线轨道做功过程,下列说法严格正确的是:",options:[{key:"A",text:"可以直接利用恒力做功公式 W = F·s·cosθ 统一计算"},{key:"B",text:"可将位移划分为无限小微元 Δs,在每个微元内以恒代变累加求和"},{key:"C",text:"只要动能有变化,机械能一定严格守恒"},{key:"D",text:"变力做功的数值与运动路径完全无关"}],correctOption:"B",explanation:"变力方向或大小随位置改变,不能直接套用恒力公式;微元法(微分与积分思想)是求解变力功的根本物理方法。",scaffoldHint:"⚠️ 巩固支架提示:请回顾牛顿第二定律与微积分思想,变力无法一次求和,必须采用 F-s 面积或微元累加!"},lx={id:"challenge-q-1",title:"高阶思维跃迁:变力与非弹性碰撞复合临界",prompt:"若物块在变阻力 f = -kv 作用下滑动并与弹性挡板碰撞,下列守恒与极限关系成立的是:",options:[{key:"A",text:"全程动量守恒且机械能保持守恒"},{key:"B",text:"当速度衰减为 0 前,系统动量损耗率与瞬时阻力成正比"},{key:"C",text:"滑动阻力做功仅取决于物块最终停止位置与重力势能无关"},{key:"D",text:"以上均不正确"}],correctOption:"B",rewardBadge:"🏅 物理探究思维跃迁徽章"},cx=({isOpen:t,onClose:e,lessonId:n,studentName:s="我",lang:i="zh",coreQuestion:o=ax,challengeQuestion:a=lx,onSubmitSuccess:l})=>{const[c,d]=f.useState(null),[h,m]=f.useState(!1),[p,u]=f.useState(null),[g,x]=f.useState(null),[w,v]=f.useState(5),[S,b]=f.useState(""),[C,N]=f.useState(""),[y,P]=f.useState(!1),[L,_]=f.useState(!1),O=()=>{if(!c)return;const R=c===o.correctOption;u(R),m(!0)},T=async()=>{if(y)return;P(!0);const R=p?g?"challenge_done":"passed":"remediation";try{n&&await fetch(`/api/classroom/sessions/${n}/exit-ticket`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({rating:w,puzzledConcept:S.trim(),feedback:C.trim(),coreAnswer:c,isCorrect:p,tierLevel:R,challengeAnswer:g})}),_(!0),l?.()}catch{_(!0),l?.()}finally{P(!1)}},A=()=>{l?.(),e()};return t?r.jsx("div",{"data-testid":"adaptive-exit-ticket-modal",className:"fixed inset-0 z-50 bg-black/60 backdrop-blur-xs flex items-center justify-center p-4 animate-fade-in select-none",children:r.jsxs("div",{className:"bg-surface rounded-3xl border border-indigo-500/40 p-6 w-full max-w-lg shadow-2xl flex flex-col gap-4 max-h-[92vh] overflow-y-auto",children:[r.jsxs("div",{className:"flex items-center justify-between border-b border-border/80 pb-3 shrink-0",children:[r.jsxs("div",{className:"flex items-center gap-2 text-indigo-500 font-extrabold text-base",children:[r.jsx(it,{size:20}),r.jsx("span",{children:i==="zh"?"60 秒自适应结课通票 (Adaptive Exit Ticket)":"60s Adaptive Exit Ticket"})]}),r.jsx("button",{onClick:A,className:"text-muted hover:text-main rounded-lg p-1 cursor-pointer","aria-label":"Close",children:r.jsx(Ie,{size:18})})]}),L?r.jsxs("div",{className:"py-8 flex flex-col items-center justify-center text-center gap-3",children:[r.jsx("div",{className:"w-14 h-14 rounded-full bg-emerald-500/20 text-emerald-600 dark:text-emerald-400 flex items-center justify-center",children:r.jsx(it,{size:32})}),r.jsx("h3",{className:"text-base font-black text-main",children:i==="zh"?"结课通票提交成功!":"Exit Ticket Submitted!"}),r.jsx("p",{className:"text-xs text-muted max-w-xs",children:i==="zh"?"你的学情反馈与梯级作答已实时同步至教师大屏与个人课后学情卡。":"Feedback synced to classroom dashboard."}),r.jsx("button",{onClick:A,className:"mt-2 px-6 py-2 rounded-xl bg-indigo-600 hover:bg-indigo-700 text-white font-bold text-xs transition-colors cursor-pointer",children:i==="zh"?"完成":"Done"})]}):r.jsxs("div",{className:"flex flex-col gap-4 text-xs",children:[r.jsxs("div",{className:"bg-surface-secondary/70 p-4 rounded-2xl border border-border/60 flex flex-col gap-2.5",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("span",{className:"font-extrabold text-main flex items-center gap-1.5 text-xs",children:[r.jsx("span",{className:"px-2 py-0.5 rounded bg-indigo-500 text-white font-mono text-[10px]",children:"必做诊断"}),r.jsx("span",{children:"1. 核心概念过关题"})]}),h&&r.jsx("span",{className:`text-2xs font-bold px-2 py-0.5 rounded-full ${p?"bg-emerald-100 text-emerald-700 dark:bg-emerald-950 dark:text-emerald-300":"bg-rose-100 text-rose-700 dark:bg-rose-950 dark:text-rose-300"}`,children:p?"✓ 概念通关":"需巩固"})]}),r.jsx("p",{className:"text-main font-semibold leading-relaxed",children:o.question}),r.jsx("div",{className:"space-y-1.5",children:o.options.map(R=>r.jsxs("button",{type:"button",disabled:h,onClick:()=>d(R.key),className:`w-full p-2.5 rounded-xl border text-left flex items-start gap-2.5 transition-all cursor-pointer ${c===R.key?"border-indigo-500 bg-indigo-50/50 dark:bg-indigo-950/40 font-bold text-indigo-700 dark:text-indigo-300":"border-border/60 hover:bg-surface text-main"} ${h?"cursor-default opacity-90":""}`,children:[r.jsx("span",{className:"w-5 h-5 rounded-full bg-surface-secondary border border-border flex items-center justify-center text-[10px] font-mono shrink-0",children:R.key}),r.jsx("span",{className:"text-2xs leading-relaxed",children:R.text})]},R.key))}),!h&&r.jsxs("button",{type:"button",disabled:!c,onClick:O,className:`mt-1 py-1.5 px-3 rounded-xl font-bold text-2xs transition-colors flex items-center justify-center gap-1 ${c?"bg-indigo-600 hover:bg-indigo-700 text-white cursor-pointer shadow-xs":"bg-surface-secondary text-muted cursor-not-allowed"}`,children:[r.jsx("span",{children:"确认本题答案"}),r.jsx(hn,{size:12})]}),h&&p&&r.jsxs("div",{"data-testid":"challenge-branch",className:"mt-2 p-3 rounded-xl bg-emerald-500/10 border border-emerald-500/30 text-emerald-800 dark:text-emerald-200 space-y-2 animate-fade-in",children:[r.jsxs("div",{className:"flex items-center gap-1.5 font-bold text-2xs",children:[r.jsx(ot,{size:14,className:"text-emerald-600 dark:text-emerald-400"}),r.jsx("span",{children:"太棒了!已解锁【Lv.2 进阶探究挑战题】(冲刺思维勋章)"})]}),r.jsx("p",{className:"text-2xs font-semibold text-main",children:a.prompt}),r.jsx("div",{className:"grid grid-cols-1 gap-1",children:a.options.map(R=>r.jsxs("button",{type:"button",onClick:()=>x(R.key),className:`p-2 rounded-lg border text-left text-2xs transition-colors ${g===R.key?"border-emerald-500 bg-emerald-100/60 dark:bg-emerald-950 font-bold text-emerald-800 dark:text-emerald-200":"border-emerald-500/20 bg-surface text-main hover:bg-surface-secondary"}`,children:[r.jsxs("span",{className:"font-mono font-bold mr-1.5",children:[R.key,"."]}),r.jsx("span",{children:R.text})]},R.key))})]}),h&&!p&&r.jsxs("div",{"data-testid":"scaffold-branch",className:"mt-2 p-3 rounded-xl bg-amber-500/10 border border-amber-500/30 text-amber-800 dark:text-amber-200 space-y-1.5 animate-fade-in",children:[r.jsxs("div",{className:"flex items-center gap-1.5 font-bold text-2xs text-amber-600 dark:text-amber-400",children:[r.jsx(rr,{size:14}),r.jsx("span",{children:"核心概念支架提示卡"})]}),r.jsx("p",{className:"text-2xs leading-relaxed",children:o.scaffoldHint}),r.jsxs("p",{className:"text-3xs text-muted",children:["解析:",o.explanation]})]})]}),r.jsxs("div",{className:"flex flex-col gap-1.5",children:[r.jsx("label",{className:"text-2xs font-bold text-main",children:i==="zh"?"2. 今日课堂综合掌握感评估":"Rate Today Lesson"}),r.jsxs("div",{className:"flex items-center gap-2",children:[[1,2,3,4,5].map(R=>r.jsx("button",{type:"button",onClick:()=>v(R),className:"p-0.5 text-xl transition-transform hover:scale-125 cursor-pointer",children:r.jsx(qs,{size:20,className:R<=w?"text-amber-400 fill-amber-400":"text-slate-300"})},R)),r.jsxs("span",{className:"text-2xs font-bold text-amber-500 font-mono ml-1",children:[w,".0 星"]})]})]}),r.jsxs("div",{className:"flex flex-col gap-1",children:[r.jsx("label",{className:"text-2xs font-bold text-main",children:i==="zh"?"3. 今天最困惑或没完全搞懂的知识点/卡点是什么?":"Most Confused Concept"}),r.jsx("input",{type:"text",value:S,onChange:R=>b(R.target.value),placeholder:i==="zh"?"例如:变力做功 F-s 面积法、临界滑动摩擦...":"e.g. friction boundary...",className:"w-full px-3 py-2 bg-surface-secondary border border-border rounded-xl text-xs text-main focus:outline-hidden focus:ring-2 focus:ring-indigo-500"})]}),r.jsxs("div",{className:"flex flex-col gap-1",children:[r.jsx("label",{className:"text-2xs font-bold text-main",children:i==="zh"?"4. 给老师的一句小建议 (选填)":"Feedback (Optional)"}),r.jsx("input",{type:"text",value:C,onChange:R=>N(R.target.value),placeholder:i==="zh"?"例如:希望能补充一道微元积分经典例题...":"Feedback...",className:"w-full px-3 py-1.5 bg-surface-secondary border border-border rounded-xl text-xs text-main focus:outline-hidden focus:ring-2 focus:ring-indigo-500"})]}),r.jsx("button",{type:"button",disabled:y,onClick:T,className:"w-full py-2.5 bg-indigo-600 hover:bg-indigo-700 text-white font-extrabold rounded-xl transition-colors cursor-pointer shadow-md text-xs flex items-center justify-center gap-1.5",children:r.jsx("span",{children:y?i==="zh"?"正在提交...":"Submitting...":i==="zh"?"提交自适应结课通票":"Submit Exit Ticket"})})]})]})}):null};function dx({lessonId:t,studentId:e="student_demo",studentName:n="我",lang:s="zh"}){const[i,o]=f.useState(null),[a,l]=f.useState(null),[c,d]=f.useState("IN_CLASS_TEACHING"),[h,m]=f.useState(null),[p,u]=f.useState({}),[g,x]=f.useState(null),[w,v]=f.useState(null),[S,b]=f.useState(!1),[C,N]=f.useState("IDLE"),[y,P]=f.useState(null),[L,_]=f.useState(null),[O,T]=f.useState(!1),[A,R]=f.useState(!1),[D,I]=f.useState(5),[$,U]=f.useState(""),[E,F]=f.useState(""),j=f.useRef(Date.now()),B=f.useRef(null),X=f.useRef(0),k=f.useRef(0),q=f.useRef(null),J=f.useRef(null),G=f.useRef(!1);if(f.useEffect(()=>{if(!t)return;let ee=!0;const z=async()=>{const K=++X.current;try{const ne=await fetch(`/api/classroom/sessions/${t}`);if(ne.ok&&ee){const te=await ne.json();if(te.hasActiveSession){d(te.stage),te.session?.current_segment_id&&m(te.session.current_segment_id),te.stage==="WRAP_UP_EXIT_TICKET"&&!G.current&&T(!0),te.activePoll&&(!q.current||q.current.id!==te.activePoll.id)?(q.current=te.activePoll,o(te.activePoll),v(null),b(!1)):!te.activePoll&&q.current&&(q.current=null,o(null));const me=J.current;if(te.activeBuzzer)if(!me||me.id!==te.activeBuzzer.id)J.current=te.activeBuzzer,l(te.activeBuzzer),N("IDLE"),P(null),B.current=null,j.current=Date.now();else if(te.activeBuzzer.status==="LOCKED"){const Q=B.current,se=Q&&Q.buzzerId===te.activeBuzzer.id?Q.status:te.activeBuzzer.winner_student_id===e?"WINNER":"MISSED";B.current={buzzerId:te.activeBuzzer.id,status:se},J.current=te.activeBuzzer,N(se),l(te.activeBuzzer)}else te.activeBuzzer.status==="READY"&&!(K<=k.current)&&B.current?.buzzerId===te.activeBuzzer.id&&(B.current=null,J.current=te.activeBuzzer,N("IDLE"),l(te.activeBuzzer),P(null),j.current=Date.now());else me&&(J.current=null,l(null),N("IDLE"),B.current=null)}}}catch{}};z();const W=setInterval(z,2500);return()=>{ee=!1,clearInterval(W)}},[t,e]),f.useEffect(()=>{const ee=tt();if(!ee||!t)return;const z=W=>{W?.lessonId===t&&W?.activeSegmentId&&m(W.activeSegmentId)};return ee.on("student-active-segment-changed",z),()=>{typeof ee.off=="function"&&ee.off("student-active-segment-changed",z)}},[t]),f.useEffect(()=>{t&&fetch(`/api/lessons/${t}`).then(ee=>ee.ok?ee.json():null).then(ee=>{if(ee?.timeline)try{const z=typeof ee.timeline=="string"?JSON.parse(ee.timeline):ee.timeline;if(Array.isArray(z)){const W={};z.forEach(K=>{K?.id&&K?.title&&(W[K.id]=K.title)}),u(W)}}catch{}}).catch(()=>{})},[t]),f.useEffect(()=>{if(!t)return;fetch(`/api/classroom/sessions/${t}/pacing-summary?segmentId=${encodeURIComponent(h||"default")}`).then(z=>z.ok?z.json():null).then(z=>{z?.success&&x(z.mySignal||null)}).catch(()=>{})},[t,h]),!t)return null;const re=async ee=>{try{const z=g===ee,W=await fetch(`/api/classroom/sessions/${t}/pacing`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({signal:z?null:ee,action:z?"cancel":void 0,toggle:!0,segmentId:h||"default"})});if(W.ok){const K=await W.json();x(K.currentSignal??null),K.currentSignal?_(ee==="TOO_FAST"?s==="zh"?"已反馈: 🐇 讲太快":"Pacing: Too Fast":ee==="SLOW"?s==="zh"?"已反馈: 🐢 讲太慢":"Pacing: Too Slow":ee==="CONFUSED"?s==="zh"?"已反馈: ❓ 有疑问":"Pacing: Confused":s==="zh"?"已反馈: 💡 听懂了":"Pacing: Clear"):_(s==="zh"?"已取消反馈":"Feedback cleared"),setTimeout(()=>_(null),2500)}}catch{}},Y=async ee=>{if(!(!i||S))try{v(ee),b(!0),await fetch(`/api/classroom/sessions/${t}/quick-poll/${i.id}/vote`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({option:ee})})}catch{}},ye=async()=>{if(!a||a.status!=="READY"||C!=="IDLE")return;const ee=Date.now()-j.current;k.current=X.current,N("BUZZED");try{const z=await fetch(`/api/classroom/sessions/${t}/buzzer/${a.id}/buzz`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({studentName:n,responseTimeMs:ee})});if(z.ok){const W=await z.json(),K=W.won??W.winner===!0,ne=K?"WINNER":"MISSED";if(B.current={buzzerId:a.id,status:ne},N(ne),!K&&W.winner){const te={...a,status:"LOCKED",winner_student_id:W.winner.studentId??null,winner_student_name:W.winner.studentName??null,winner_response_time_ms:W.winner.responseTimeMs??null};J.current=te,l(te)}}else N("IDLE")}catch{N("IDLE")}};return r.jsxs(r.Fragment,{children:[r.jsx(ox,{lessonId:t,lang:s}),r.jsx(Oe,{slot:"student.classroom.overlay",slotProps:{studentId:e,lessonId:t}}),r.jsx(Oe,{slot:"student.fullscreen",slotProps:{studentId:e,lessonId:t}}),r.jsxs("aside",{"aria-label":s==="zh"?"课堂互动工具栏":"Classroom interaction toolbar",className:"fixed bottom-6 right-6 z-40 flex items-center gap-2.5 bg-surface/95 backdrop-blur-md border border-theme p-2 rounded-2xl shadow-2xl transition-all",children:[r.jsxs("div",{className:"flex items-center gap-1.5 px-2 py-1 bg-surface-secondary/70 rounded-xl border border-theme text-2xs font-bold text-muted",children:[r.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-primary-theme animate-pulse"}),r.jsx("span",{className:"truncate max-w-[120px]",children:h&&p[h]?p[h]:s==="zh"?"当前环节":"Current Segment"})]}),L&&r.jsx("span",{className:"text-2xs font-bold text-primary-theme px-1.5 py-0.5 animate-fade-in whitespace-nowrap",children:L}),r.jsxs("div",{className:"flex items-center gap-1",children:[r.jsxs("button",{type:"button",onClick:()=>re("CLEAR"),className:`px-2.5 py-1.5 rounded-xl font-bold text-xs transition-all flex items-center gap-1 cursor-pointer ${g==="CLEAR"?"bg-emerald-500/20 text-emerald-600 dark:text-emerald-300 ring-2 ring-emerald-500/60 shadow-xs":"hover:bg-emerald-500/10 text-emerald-600 dark:text-emerald-400"}`,title:s==="zh"?"听懂了,节奏适宜(再次点击取消)":"Clear & Optimal (Click again to cancel)",children:[r.jsx("span",{children:"💡"}),r.jsx("span",{className:"hidden sm:inline",children:s==="zh"?"听懂了":"Clear"}),g==="CLEAR"&&r.jsx("span",{className:"text-3xs ml-0.5 font-bold",children:"✓"})]}),r.jsxs("button",{type:"button",onClick:()=>re("CONFUSED"),className:`px-2.5 py-1.5 rounded-xl font-bold text-xs transition-all flex items-center gap-1 cursor-pointer ${g==="CONFUSED"?"bg-amber-500/20 text-amber-600 dark:text-amber-300 ring-2 ring-amber-500/60 shadow-xs":"hover:bg-amber-500/10 text-amber-600 dark:text-amber-400"}`,title:s==="zh"?"有点困惑,希望老师点拨(再次点击取消)":"Confused (Click again to cancel)",children:[r.jsx("span",{children:"❓"}),r.jsx("span",{className:"hidden sm:inline",children:s==="zh"?"有疑问":"Confused"}),g==="CONFUSED"&&r.jsx("span",{className:"text-3xs ml-0.5 font-bold",children:"✓"})]}),r.jsxs("button",{type:"button",onClick:()=>re("TOO_FAST"),className:`px-2.5 py-1.5 rounded-xl font-bold text-xs transition-all flex items-center gap-1 cursor-pointer ${g==="TOO_FAST"?"bg-rose-500/20 text-rose-600 dark:text-rose-300 ring-2 ring-rose-500/60 shadow-xs":"hover:bg-rose-500/10 text-rose-600 dark:text-rose-400"}`,title:s==="zh"?"讲得太快了,希望能慢一点(再次点击取消)":"Too fast (Click again to cancel)",children:[r.jsx("span",{children:"🐇"}),r.jsx("span",{className:"hidden sm:inline",children:s==="zh"?"讲太快":"Too Fast"}),g==="TOO_FAST"&&r.jsx("span",{className:"text-3xs ml-0.5 font-bold",children:"✓"})]}),r.jsxs("button",{type:"button",onClick:()=>re("SLOW"),className:`px-2.5 py-1.5 rounded-xl font-bold text-xs transition-all flex items-center gap-1 cursor-pointer ${g==="SLOW"?"bg-indigo-500/20 text-indigo-600 dark:text-indigo-300 ring-2 ring-indigo-500/60 shadow-xs":"hover:bg-indigo-500/10 text-indigo-600 dark:text-indigo-400"}`,title:s==="zh"?"讲太慢了,希望快一点(再次点击取消)":"Too slow (Click again to cancel)",children:[r.jsx("span",{children:"🐢"}),r.jsx("span",{className:"hidden sm:inline",children:s==="zh"?"讲太慢":"Too Slow"}),g==="SLOW"&&r.jsx("span",{className:"text-3xs ml-0.5 font-bold",children:"✓"})]})]})]}),i&&i.status==="ACTIVE"&&r.jsxs("div",{className:"fixed bottom-20 right-6 z-50 bg-surface rounded-2xl border border-amber-500/40 p-5 shadow-2xl w-80 flex flex-col gap-3 animate-slide-up",children:[r.jsxs("div",{className:"flex items-center justify-between border-b border-border/60 pb-2",children:[r.jsxs("span",{className:"text-xs font-extrabold text-amber-500 flex items-center gap-1.5",children:[r.jsx(ot,{size:14}),s==="zh"?"极速答题进行中":"Quick Poll Active"]}),S&&r.jsxs("span",{className:"text-[11px] text-emerald-500 font-bold flex items-center gap-1",children:[r.jsx(it,{size:12}),s==="zh"?"已提交":"Submitted"]})]}),r.jsx("p",{className:"font-bold text-sm text-foreground",children:i.title}),r.jsx("div",{className:"grid grid-cols-2 gap-2 mt-1",children:(i.options||["A","B","C","D"]).map(ee=>{const z=w===ee;return r.jsx("button",{disabled:S,onClick:()=>Y(ee),className:`p-3 rounded-xl font-bold text-center text-sm transition-all cursor-pointer ${z?"bg-primary-theme text-white ring-2 ring-primary-theme shadow-md scale-95":S?"bg-surface-secondary text-muted opacity-60 cursor-not-allowed":"bg-surface-secondary hover:bg-primary-theme/10 hover:border-primary-theme border border-border text-foreground"}`,children:ee},ee)})})]}),a&&y!==a.id&&r.jsx("div",{className:"fixed inset-0 z-50 bg-black/60 backdrop-blur-xs flex items-center justify-center p-4",onClick:()=>P(a.id),children:r.jsxs("div",{className:"relative bg-surface rounded-3xl border border-rose-500/50 p-8 w-full max-w-sm shadow-2xl flex flex-col items-center text-center gap-4 animate-scale-up",onClick:ee=>ee.stopPropagation(),children:[r.jsx("button",{onClick:()=>P(a.id),"aria-label":s==="zh"?"关闭抢答":"Close buzzer",className:"absolute top-3 right-3 p-1.5 rounded-full text-muted hover:text-foreground hover:bg-surface-secondary transition-colors cursor-pointer",children:r.jsx(Ie,{size:18})}),r.jsxs("h3",{className:"text-xl font-black text-foreground flex items-center gap-2",children:[r.jsx($i,{size:22,className:"text-rose-500 animate-bounce"}),r.jsx("span",{children:a.title||"全班极速抢答"})]}),C==="BUZZED"&&r.jsxs("div",{className:"my-4 p-6 bg-amber-500/10 border border-amber-500/30 rounded-2xl flex flex-col items-center text-center",children:[r.jsx("span",{className:"text-4xl mb-2 animate-pulse",children:"⚡"}),r.jsx("span",{className:"text-base font-bold text-foreground",children:"正在提交抢答…"}),r.jsx("span",{className:"text-xs text-muted mt-1",children:"请稍候,马上公布结果"})]}),C==="IDLE"&&a.status==="READY"&&r.jsxs("div",{className:"my-4 flex flex-col items-center gap-3",children:[r.jsxs("button",{onClick:ye,className:"w-36 h-36 rounded-full bg-gradient-to-tr from-rose-600 to-rose-400 text-white font-black text-2xl shadow-xl hover:scale-105 active:scale-95 transition-all flex flex-col items-center justify-center border-4 border-white dark:border-slate-800 cursor-pointer animate-pulse",children:[r.jsx(zm,{size:32,className:"mb-1"}),r.jsx("span",{children:"抢!"})]}),r.jsx("span",{className:"text-xs text-muted",children:"点击红色大按钮抢得首答权"})]}),C==="WINNER"&&r.jsxs("div",{className:"my-4 p-6 bg-emerald-500/10 border border-emerald-500/30 rounded-2xl flex flex-col items-center text-center",children:[r.jsx("span",{className:"text-4xl mb-2",children:"🎉"}),r.jsx("span",{className:"text-lg font-black text-emerald-500",children:"恭喜你率先抢答!"}),r.jsx("span",{className:"text-xs text-muted mt-1",children:"请起立或开麦回答老师的问题"}),r.jsx("button",{onClick:()=>P(a.id),className:"mt-3 px-4 py-1.5 rounded-xl text-xs font-bold text-muted hover:text-foreground hover:bg-surface-secondary transition-colors cursor-pointer",children:s==="zh"?"知道了,返回课堂":"Got it, back to class"})]}),C==="MISSED"&&r.jsxs("div",{className:"my-4 p-6 bg-slate-800/20 border border-border rounded-2xl flex flex-col items-center text-center",children:[r.jsx("span",{className:"text-4xl mb-2",children:"⚡"}),r.jsxs("span",{className:"text-base font-bold text-foreground",children:["已被 ",a.winner_student_name||"其他同学"," 抢先一步!"]}),r.jsx("span",{className:"text-xs text-muted mt-1",children:"下次手速要更快哦"}),r.jsx("button",{onClick:()=>P(a.id),className:"mt-3 px-4 py-1.5 rounded-xl text-xs font-bold text-muted hover:text-foreground hover:bg-surface-secondary transition-colors cursor-pointer",children:s==="zh"?"知道了,返回课堂":"Got it, back to class"})]})]})}),r.jsx(cx,{isOpen:O&&!A,onClose:()=>T(!1),lessonId:t,studentName:n,lang:s,onSubmitSuccess:()=>{G.current=!0,R(!0)}})]})}function ux(t){const e=Ft(),n=t.pickedAnnouncement!==void 0?t.pickedAnnouncement:e?.pickedAnnouncement,s=t.setPickedAnnouncement??e?.setPickedAnnouncement,i=t.pickedAlertData!==void 0?t.pickedAlertData:e?.pickedAlertData,o=t.setPickedAlertData??e?.setPickedAlertData,a=t.lang??e?.lang??"zh",l=t.selectedLesson!==void 0?t.selectedLesson:e?.selectedLesson??null,c=t.liveClassSelectedClassId!==void 0?t.liveClassSelectedClassId:e?.liveClassSelectedClassId??null,d=t.activeStudentId!==void 0?t.activeStudentId:e?.activeStudentId??null,h=t.students??e?.students??[],m=t.activeRole??e?.activeRole??"teacher",p=t.isStudentLiveMode??e?.isStudentLiveMode??!1,u=t.liveStudentParam!==void 0?t.liveStudentParam:e?.liveStudentParam??null,g=t.addToast??e?.addToast??(()=>{}),x=t.setReadNotifications??e?.setReadNotifications??(()=>{});return r.jsxs(r.Fragment,{children:[n&&!i&&r.jsx("div",{className:"fixed top-4 left-1/2 -translate-x-1/2 z-[9990] animate-in slide-in-from-top-4 duration-300 pointer-events-auto max-w-lg w-auto",children:r.jsxs("div",{className:"flex items-center gap-3 px-5 py-2.5 bg-gradient-to-r from-amber-500 to-orange-500 text-white rounded-full shadow-xl shadow-amber-500/25 backdrop-blur-xs text-sm font-bold border border-amber-300/40",children:[r.jsxs("span",{className:"relative flex h-2.5 w-2.5",children:[r.jsx("span",{className:"animate-ping absolute inline-flex h-full w-full rounded-full bg-white opacity-75"}),r.jsx("span",{className:"relative inline-flex rounded-full h-2.5 w-2.5 bg-white"})]}),r.jsx(ot,{size:16,className:"text-amber-200 shrink-0"}),r.jsx("span",{className:"truncate",children:a==="zh"?`🎯 课堂抽问:老师随机抽中了【${n.studentName}】同学回答问题!`:`🎯 Classroom Pick: Teacher randomly selected [${n.studentName}] to answer!`}),s&&r.jsx("button",{type:"button",onClick:()=>s(null),className:"ml-2 hover:bg-white/20 rounded-full p-1 transition-colors cursor-pointer text-white/80 hover:text-white shrink-0","aria-label":"Close announcement",children:r.jsx(Ie,{size:14})})]})}),i&&r.jsx("div",{className:"fixed inset-0 z-[9999] bg-black/70 backdrop-blur-xs flex items-center justify-center p-4 animate-in fade-in duration-200",children:r.jsxs("div",{className:"bg-surface border-4 border-amber-500 rounded-3xl shadow-2xl shadow-amber-500/40 ring-8 ring-amber-500/20 p-7 max-w-md w-full text-center space-y-5 animate-in zoom-in-95 duration-300",children:[r.jsxs("div",{className:"relative w-20 h-20 mx-auto",children:[r.jsx("div",{className:"absolute inset-0 bg-amber-500/30 rounded-full animate-ping"}),r.jsx("div",{className:"relative w-20 h-20 bg-gradient-to-tr from-amber-500 to-orange-500 text-white rounded-full flex items-center justify-center shadow-lg shadow-amber-500/40",children:r.jsx(ot,{size:40,className:"animate-pulse"})})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx("h3",{className:"text-2xl font-black text-main tracking-tight",children:a==="zh"?"⚡️ 闪电抽问:老师抽中了你!":"⚡️ Classroom Pick: Teacher Selected You!"}),r.jsxs("div",{className:"inline-flex items-center gap-2 px-4 py-1.5 rounded-full bg-amber-500/10 border border-amber-500/30 text-amber-600 dark:text-amber-400 font-black text-lg",children:[r.jsx("span",{children:"🎯"}),r.jsx("span",{children:i.studentName})]}),r.jsx("p",{className:"text-sm text-muted leading-relaxed",children:a==="zh"?r.jsx(r.Fragment,{children:"老师在课堂随机抽问中抽中了你,请立即集中注意力参与互动回答!"}):r.jsx(r.Fragment,{children:"The teacher selected you in the classroom random pick. Please respond and participate now!"})})]}),r.jsx("div",{className:"pt-2",children:r.jsxs("button",{type:"button",onClick:()=>{const w=new Ql(void 0,l,c);if(w.acknowledgePick(i.studentId),w.destroy(),i.rollcallId){const v=i.rollcallId;d&&ex(d,v).catch(console.error),x(S=>new Set(S).add(v))}o?.(null),g(a==="zh"?"🙋♂️ 已确认答到":"🙋♂️ Acknowledged",a==="zh"?"已向老师中控台发送举手答到信号!":"Sent acknowledge signal to teacher!","success")},className:"w-full py-3.5 bg-gradient-to-r from-amber-500 to-orange-600 hover:from-amber-600 hover:to-orange-700 text-white font-black text-base rounded-2xl shadow-xl shadow-amber-500/35 transition-all active:scale-95 cursor-pointer flex items-center justify-center gap-2",children:[r.jsx(it,{size:20}),r.jsx("span",{children:a==="zh"?"🙋♂️ 我已准备好 / 确认答到 (反馈给老师)":"🙋♂️ Ready / Acknowledge to Teacher"})]})})]})}),(m==="student"||p)&&r.jsx(dx,{lessonId:l,studentId:d||u||void 0,studentName:h.find(w=>w.id===(d||u))?.name||void 0,lang:a})]})}const Gi=f.createContext({});function Qi(t){const e=f.useRef(null);return e.current===null&&(e.current=t()),e.current}const hx=typeof window<"u",Jl=hx?f.useLayoutEffect:f.useEffect,cr=f.createContext(null),Ji=f.createContext({transformPagePoint:t=>t,isStatic:!1,reducedMotion:"never"});function Zo(t,e){if(typeof t=="function")return t(e);t!=null&&(t.current=e)}function fx(...t){return e=>{let n=!1;const s=t.map(i=>{const o=Zo(i,e);return!n&&typeof o=="function"&&(n=!0),o});if(n)return()=>{for(let i=0;i<s.length;i++){const o=s[i];typeof o=="function"?o():Zo(t[i],null)}}}}function mx(...t){return f.useCallback(fx(...t),t)}class px extends f.Component{getSnapshotBeforeUpdate(e){const n=this.props.childRef.current;if(xr(n)&&e.isPresent&&!this.props.isPresent&&this.props.pop!==!1){const s=n.offsetParent,i=xr(s)&&s.offsetWidth||0,o=xr(s)&&s.offsetHeight||0,a=getComputedStyle(n),l=this.props.sizeRef.current;l.height=parseFloat(a.height),l.width=parseFloat(a.width),l.top=n.offsetTop,l.left=n.offsetLeft,l.right=i-l.width-l.left,l.bottom=o-l.height-l.top,l.direction=a.direction}return null}componentDidUpdate(){}render(){return this.props.children}}function gx({children:t,isPresent:e,anchorX:n,anchorY:s,root:i,pop:o}){const a=f.useId(),l=f.useRef(null),c=f.useRef({width:0,height:0,top:0,left:0,right:0,bottom:0,direction:"ltr"}),{nonce:d}=f.useContext(Ji),h=t.props?.ref??t?.ref,m=mx(l,h);return f.useInsertionEffect(()=>{const{width:p,height:u,top:g,left:x,right:w,bottom:v,direction:S}=c.current;if(e||o===!1||!l.current||!p||!u)return;const b=S==="rtl",C=n==="left"?b?`right: ${w}`:`left: ${x}`:b?`left: ${x}`:`right: ${w}`,N=s==="bottom"?`bottom: ${v}`:`top: ${g}`;l.current.dataset.motionPopId=a;const y=document.createElement("style");d&&(y.nonce=d);const P=i??document.head;return P.appendChild(y),y.sheet&&y.sheet.insertRule(`
|
|
9
|
+
[data-motion-pop-id="${a}"] {
|
|
10
|
+
position: absolute !important;
|
|
11
|
+
width: ${p}px !important;
|
|
12
|
+
height: ${u}px !important;
|
|
13
|
+
${C}px !important;
|
|
14
|
+
${N}px !important;
|
|
15
|
+
}
|
|
16
|
+
`),()=>{l.current?.removeAttribute("data-motion-pop-id"),P.contains(y)&&P.removeChild(y)}},[e]),r.jsx(px,{isPresent:e,childRef:l,sizeRef:c,pop:o,children:o===!1?t:f.cloneElement(t,{ref:m})})}const xx=({children:t,initial:e,isPresent:n,onExitComplete:s,custom:i,presenceAffectsLayout:o,mode:a,anchorX:l,anchorY:c,root:d})=>{const h=Qi(bx),m=f.useId();let p=!0,u=f.useMemo(()=>(p=!1,{id:m,initial:e,isPresent:n,custom:i,onExitComplete:g=>{h.set(g,!0);for(const x of h.values())if(!x)return;s&&s()},register:g=>(h.set(g,!1),()=>h.delete(g))}),[n,h,s]);return o&&p&&(u={...u}),f.useMemo(()=>{h.forEach((g,x)=>h.set(x,!1))},[n]),f.useEffect(()=>{!n&&!h.size&&s&&s()},[n]),t=r.jsx(gx,{pop:a==="popLayout",isPresent:n,anchorX:l,anchorY:c,root:d,children:t}),r.jsx(cr.Provider,{value:u,children:t})};function bx(){return new Map}function Kl(t=!0){const e=f.useContext(cr);if(e===null)return[!0,null];const{isPresent:n,onExitComplete:s,register:i}=e,o=f.useId();f.useEffect(()=>{if(t)return i(o)},[t]);const a=f.useCallback(()=>t&&s&&s(o),[o,s,t]);return!n&&s?[!1,a]:[!0]}const gs=t=>t.key||"";function Yo(t){const e=[];return f.Children.forEach(t,n=>{f.isValidElement(n)&&e.push(n)}),e}const Zl=({children:t,custom:e,initial:n=!0,onExitComplete:s,presenceAffectsLayout:i=!0,mode:o="sync",propagate:a=!1,anchorX:l="left",anchorY:c="top",root:d})=>{const[h,m]=Kl(a),p=f.useMemo(()=>Yo(t),[t]),u=a&&!h?[]:p.map(gs),g=f.useRef(!0),x=f.useRef(p),w=Qi(()=>new Map),v=f.useRef(new Set),[S,b]=f.useState(p),[C,N]=f.useState(p);Jl(()=>{g.current=!1,x.current=p;for(let L=0;L<C.length;L++){const _=gs(C[L]);u.includes(_)?(w.delete(_),v.current.delete(_)):w.get(_)!==!0&&w.set(_,!1)}},[C,u.length,u.join("-")]);const y=[];if(p!==S){let L=[...p];for(let _=0;_<C.length;_++){const O=C[_],T=gs(O);u.includes(T)||(L.splice(_,0,O),y.push(O))}return o==="wait"&&y.length&&(L=y),N(Yo(L)),b(p),null}const{forceRender:P}=f.useContext(Gi);return r.jsx(r.Fragment,{children:C.map(L=>{const _=gs(L),O=a&&!h?!1:p===C||u.includes(_),T=()=>{if(v.current.has(_))return;if(w.has(_))v.current.add(_),w.set(_,!0);else return;let A=!0;w.forEach(R=>{R||(A=!1)}),A&&(P?.(),N(x.current),a&&m?.(),s&&s())};return r.jsx(xx,{isPresent:O,initial:!g.current||n?void 0:!1,custom:e,presenceAffectsLayout:i,mode:o,root:d,onExitComplete:O?void 0:T,anchorX:l,anchorY:c,children:L},_)})})},Yl=f.createContext({strict:!1}),Xo={animation:["animate","variants","whileHover","whileTap","exit","whileInView","whileFocus","whileDrag"],exit:["exit"],drag:["drag","dragControls"],focus:["whileFocus"],hover:["whileHover","onHoverStart","onHoverEnd"],tap:["whileTap","onTap","onTapStart","onTapCancel"],pan:["onPan","onPanStart","onPanSessionStart","onPanEnd"],inView:["whileInView","onViewportEnter","onViewportLeave"],layout:["layout","layoutId"]};let ea=!1;function yx(){if(ea)return;const t={};for(const e in Xo)t[e]={isEnabled:n=>Xo[e].some(s=>!!n[s])};Ml(t),ea=!0}function Xl(){return yx(),$m()}function wx(t){const e=Xl();for(const n in t)e[n]={...e[n],...t[n]};Ml(e)}const vx=new Set(["animate","exit","variants","initial","style","values","variants","transition","transformTemplate","custom","inherit","onBeforeLayoutMeasure","onAnimationStart","onAnimationComplete","onUpdate","onDragStart","onDrag","onDragEnd","onMeasureDragConstraints","onDirectionLock","onDragTransitionEnd","_dragX","_dragY","onHoverStart","onHoverEnd","onViewportEnter","onViewportLeave","globalTapTarget","propagate","ignoreStrict","viewport"]);function Zs(t){return t.startsWith("while")||t.startsWith("drag")&&t!=="draggable"||t.startsWith("layout")||t.startsWith("onTap")||t.startsWith("onPan")||t.startsWith("onLayout")||vx.has(t)}let ec=t=>!Zs(t);function Sx(t){typeof t=="function"&&(ec=e=>e.startsWith("on")?!Zs(e):t(e))}try{Sx(require("@emotion/is-prop-valid").default)}catch{}function jx(t,e,n){const s={};for(const i in t)i==="values"&&typeof t.values=="object"||Bi(t[i])||(ec(i)||n===!0&&Zs(i)||!e&&!Zs(i)||t.draggable&&i.startsWith("onDrag"))&&(s[i]=t[i]);return s}const dr=f.createContext({});function kx(t,e){if(Ol(t)){const{initial:n,animate:s}=t;return{initial:n===!1||_o(n)?n:void 0,animate:_o(s)?s:void 0}}return t.inherit!==!1?e:{}}function Cx(t){const{initial:e,animate:n}=kx(t,f.useContext(dr));return f.useMemo(()=>({initial:e,animate:n}),[ta(e),ta(n)])}function ta(t){return Array.isArray(t)?t.join(" "):t}const Ki=()=>({style:{},transform:{},transformOrigin:{},vars:{}});function tc(t,e,n){for(const s in e)!Bi(e[s])&&!Fm(s,n)&&(t[s]=e[s])}function Nx({transformTemplate:t},e){return f.useMemo(()=>{const n=Ki();return Bm(n,e,t),Object.assign({},n.vars,n.style)},[e])}function Ex(t,e){const n=t.style||{},s={};return tc(s,n,t),Object.assign(s,Nx(t,e)),s}function Px(t,e){const n={},s=Ex(t,e);return t.drag&&t.dragListener!==!1&&(n.draggable=!1,s.userSelect=s.WebkitUserSelect=s.WebkitTouchCallout="none",s.touchAction=t.drag===!0?"none":`pan-${t.drag==="x"?"y":"x"}`),t.tabIndex===void 0&&(t.onTap||t.onTapStart||t.whileTap)&&(n.tabIndex=0),n.style=s,n}const nc=()=>({...Ki(),attrs:{}});function Tx(t,e,n,s){const i=f.useMemo(()=>{const o=nc();return Vm(o,e,Um(s),t.transformTemplate,t.style),{...o.attrs,style:{...o.style}}},[e]);if(t.style){const o={};tc(o,t.style,t),i.style={...o,...i.style}}return i}const Ix=["animate","circle","defs","desc","ellipse","g","image","line","filter","marker","mask","metadata","path","pattern","polygon","polyline","rect","stop","switch","symbol","svg","text","tspan","use","view"];function Zi(t){return typeof t!="string"||t.includes("-")?!1:!!(Ix.indexOf(t)>-1||/[A-Z]/u.test(t))}function Ax(t,e,n,{latestValues:s},i,o=!1,a){const c=(a??Zi(t)?Tx:Px)(e,s,i,t),d=jx(e,typeof t=="string",o),h=t!==f.Fragment?{...d,...c,ref:n}:{},{children:m}=e,p=f.useMemo(()=>Bi(m)?m.get():m,[m]);return f.createElement(t,{...h,children:p})}function zx({scrapeMotionValuesFromProps:t,createRenderState:e},n,s,i){return{latestValues:Lx(n,s,i,t),renderState:e()}}function Lx(t,e,n,s){const i={},o=s(t,{});for(const p in o)i[p]=Hm(o[p]);let{initial:a,animate:l}=t;const c=Ol(t),d=qm(t);e&&d&&!c&&t.inherit!==!1&&(a===void 0&&(a=e.initial),l===void 0&&(l=e.animate));let h=n?n.initial===!1:!1;h=h||a===!1;const m=h?l:a;if(m&&typeof m!="boolean"&&!$l(m)){const p=Array.isArray(m)?m:[m];for(let u=0;u<p.length;u++){const g=Wm(t,p[u]);if(g){const{transitionEnd:x,transition:w,...v}=g;for(const S in v){let b=v[S];if(Array.isArray(b)){const C=h?b.length-1:0;b=b[C]}b!==null&&(i[S]=b)}for(const S in x)i[S]=x[S]}}}return i}const sc=t=>(e,n)=>{const s=f.useContext(dr),i=f.useContext(cr),o=()=>zx(t,e,s,i);return n?o():Qi(o)},Rx=sc({scrapeMotionValuesFromProps:Gm,createRenderState:Ki}),_x=sc({scrapeMotionValuesFromProps:Qm,createRenderState:nc}),Dx=Symbol.for("motionComponentSymbol");function Mx(t,e,n){const s=f.useRef(n);f.useInsertionEffect(()=>{s.current=n});const i=f.useRef(null);return f.useCallback(o=>{o&&t.onMount?.(o),e&&(o?e.mount(o):e.unmount());const a=s.current;if(typeof a=="function")if(o){const l=a(o);typeof l=="function"&&(i.current=l)}else i.current?(i.current(),i.current=null):a(o);else a&&(a.current=o)},[e])}const rc=f.createContext({});function sn(t){return t&&typeof t=="object"&&Object.prototype.hasOwnProperty.call(t,"current")}function Ox(t,e,n,s,i,o){const{visualElement:a}=f.useContext(dr),l=f.useContext(Yl),c=f.useContext(cr),d=f.useContext(Ji),h=d.reducedMotion,m=d.skipAnimations,p=f.useRef(null),u=f.useRef(!1);s=s||l.renderer,!p.current&&s&&(p.current=s(t,{visualState:e,parent:a,props:n,presenceContext:c,blockInitialAnimation:c?c.initial===!1:!1,reducedMotionConfig:h,skipAnimations:m,isSVG:o}),u.current&&p.current&&(p.current.manuallyAnimateOnMount=!0));const g=p.current,x=f.useContext(rc);g&&!g.projection&&i&&(g.type==="html"||g.type==="svg")&&$x(p.current,n,i,x);const w=f.useRef(!1);f.useInsertionEffect(()=>{g&&w.current&&g.update(n,c)});const v=n[Jm],S=f.useRef(!!v&&typeof window<"u"&&!window.MotionHandoffIsComplete?.(v)&&window.MotionHasOptimisedAnimation?.(v));return Jl(()=>{u.current=!0,g&&(w.current=!0,window.MotionIsMounted=!0,g.updateFeatures(),g.scheduleRenderMicrotask(),S.current&&g.animationState&&g.animationState.animateChanges())}),f.useEffect(()=>{g&&(!S.current&&g.animationState&&g.animationState.animateChanges(),S.current&&(queueMicrotask(()=>{window.MotionHandoffMarkAsComplete?.(v)}),S.current=!1),g.enteringChildren=void 0)}),g}function $x(t,e,n,s){const{layoutId:i,layout:o,drag:a,dragConstraints:l,layoutScroll:c,layoutRoot:d,layoutAnchor:h,layoutCrossfade:m}=e;t.projection=new n(t.latestValues,e["data-framer-portal-id"]?void 0:ic(t.parent)),t.projection.setOptions({layoutId:i,layout:o,alwaysMeasureLayout:!!a||l&&sn(l),visualElement:t,animationType:typeof o=="string"?o:"both",initialPromotionConfig:s,crossfade:m,layoutScroll:c,layoutRoot:d,layoutAnchor:h})}function ic(t){if(t)return t.options.allowProjection!==!1?t.projection:ic(t.parent)}function Er(t,{forwardMotionProps:e=!1,type:n}={},s,i){s&&wx(s);const o=n?n==="svg":Zi(t),a=o?_x:Rx;function l(d,h){let m;const p={...f.useContext(Ji),...d,layoutId:Fx(d)},{isStatic:u}=p,g=Cx(d),x=a(d,u);if(!u&&typeof window<"u"){Bx();const w=Vx(p);m=w.MeasureLayout,g.visualElement=Ox(t,x,p,i,w.ProjectionNode,o)}return r.jsxs(dr.Provider,{value:g,children:[m&&g.visualElement?r.jsx(m,{visualElement:g.visualElement,...p}):null,Ax(t,d,Mx(x,g.visualElement,h),x,u,e,o)]})}l.displayName=`motion.${typeof t=="string"?t:`create(${t.displayName??t.name??""})`}`;const c=f.forwardRef(l);return c[Dx]=t,c}function Fx({layoutId:t}){const e=f.useContext(Gi).id;return e&&t!==void 0?e+"-"+t:t}function Bx(t,e){f.useContext(Yl).strict}function Vx(t){const e=Xl(),{drag:n,layout:s}=e;if(!n&&!s)return{};const i={...n,...s};return{MeasureLayout:n?.isEnabled(t)||s?.isEnabled(t)?i.MeasureLayout:void 0,ProjectionNode:i.ProjectionNode}}function Ux(t,e){if(typeof Proxy>"u")return Er;const n=new Map,s=(o,a)=>Er(o,a,t,e),i=(o,a)=>s(o,a);return new Proxy(i,{get:(o,a)=>a==="create"?s:(n.has(a)||n.set(a,Er(a,void 0,t,e)),n.get(a))})}const Hx=(t,e)=>e.isSVG??Zi(t)?new Km(e):new Zm(e,{allowProjection:t!==f.Fragment});class qx extends Tt{constructor(e){super(e),e.animationState||(e.animationState=Ym(e))}updateAnimationControlsSubscription(){const{animate:e}=this.node.getProps();$l(e)&&(this.unmountControls=e.subscribe(this.node))}mount(){this.updateAnimationControlsSubscription()}update(){const{animate:e}=this.node.getProps(),{animate:n}=this.node.prevProps||{};e!==n&&this.updateAnimationControlsSubscription()}unmount(){this.node.animationState.reset(),this.unmountControls?.()}}let Wx=0;class Gx extends Tt{constructor(){super(...arguments),this.id=Wx++,this.isExitComplete=!1}update(){if(!this.node.presenceContext)return;const{isPresent:e,onExitComplete:n}=this.node.presenceContext,{isPresent:s}=this.node.prevPresenceContext||{};if(!this.node.animationState||e===s)return;if(e&&s===!1){if(this.isExitComplete){const{initial:o,custom:a}=this.node.getProps();if(typeof o=="string"||typeof o=="object"&&o!==null&&!Array.isArray(o)){const l=Xm(this.node,o,a);if(l){const{transition:c,transitionEnd:d,...h}=l;for(const m in h)this.node.getValue(m)?.jump(h[m])}}this.node.animationState.reset(),this.node.animationState.animateChanges()}else this.node.animationState.setActive("exit",!1);this.isExitComplete=!1;return}const i=this.node.animationState.setActive("exit",!e);n&&!e&&i.then(()=>{this.isExitComplete=!0,n(this.id)})}mount(){const{register:e,onExitComplete:n}=this.node.presenceContext||{};n&&n(this.id),e&&(this.unmount=e(this.id))}unmount(){}}const Qx={animation:{Feature:qx},exit:{Feature:Gx}};function ds(t){return{point:{x:t.pageX,y:t.pageY}}}const Jx=t=>e=>Fl(e)&&t(e,ds(e));function ns(t,e,n,s){return Gs(t,e,Jx(n),s)}const oc=({current:t})=>t?t.ownerDocument.defaultView:null,na=(t,e)=>Math.abs(t-e);function Kx(t,e){const n=na(t.x,e.x),s=na(t.y,e.y);return Math.sqrt(n**2+s**2)}const sa=new Set(["auto","scroll"]);class ac{constructor(e,n,{transformPagePoint:s,contextWindow:i=window,dragSnapToOrigin:o=!1,distanceThreshold:a=3,element:l}={}){if(this.startEvent=null,this.lastMoveEvent=null,this.lastMoveEventInfo=null,this.lastRawMoveEventInfo=null,this.handlers={},this.contextWindow=window,this.scrollPositions=new Map,this.removeScrollListeners=null,this.onElementScroll=u=>{this.handleScroll(u.target)},this.onWindowScroll=()=>{this.handleScroll(window)},this.updatePoint=()=>{if(!(this.lastMoveEvent&&this.lastMoveEventInfo))return;this.lastRawMoveEventInfo&&(this.lastMoveEventInfo=xs(this.lastRawMoveEventInfo,this.transformPagePoint));const u=Pr(this.lastMoveEventInfo,this.history),g=this.startEvent!==null,x=Kx(u.offset,{x:0,y:0})>=this.distanceThreshold;if(!g&&!x)return;const{point:w}=u,{timestamp:v}=Do;this.history.push({...w,timestamp:v});const{onStart:S,onMove:b}=this.handlers;g||(S&&S(this.lastMoveEvent,u),this.startEvent=this.lastMoveEvent),b&&b(this.lastMoveEvent,u)},this.handlePointerMove=(u,g)=>{this.lastMoveEvent=u,this.lastRawMoveEventInfo=g,this.lastMoveEventInfo=xs(g,this.transformPagePoint),ut.update(this.updatePoint,!0)},this.handlePointerUp=(u,g)=>{this.end();const{onEnd:x,onSessionEnd:w,resumeAnimation:v}=this.handlers;if((this.dragSnapToOrigin||!this.startEvent)&&v&&v(),!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const S=Pr(u.type==="pointercancel"?this.lastMoveEventInfo:xs(g,this.transformPagePoint),this.history);this.startEvent&&x&&x(u,S),w&&w(u,S)},!Fl(e))return;this.dragSnapToOrigin=o,this.handlers=n,this.transformPagePoint=s,this.distanceThreshold=a,this.contextWindow=i||window;const c=ds(e),d=xs(c,this.transformPagePoint),{point:h}=d,{timestamp:m}=Do;this.history=[{...h,timestamp:m}];const{onSessionStart:p}=n;p&&p(e,Pr(d,this.history)),this.removeListeners=Bl(ns(this.contextWindow,"pointermove",this.handlePointerMove),ns(this.contextWindow,"pointerup",this.handlePointerUp),ns(this.contextWindow,"pointercancel",this.handlePointerUp)),l&&this.startScrollTracking(l)}startScrollTracking(e){let n=e.parentElement;for(;n;){const s=getComputedStyle(n);(sa.has(s.overflowX)||sa.has(s.overflowY))&&this.scrollPositions.set(n,{x:n.scrollLeft,y:n.scrollTop}),n=n.parentElement}this.scrollPositions.set(window,{x:window.scrollX,y:window.scrollY}),window.addEventListener("scroll",this.onElementScroll,{capture:!0}),window.addEventListener("scroll",this.onWindowScroll),this.removeScrollListeners=()=>{window.removeEventListener("scroll",this.onElementScroll,{capture:!0}),window.removeEventListener("scroll",this.onWindowScroll)}}handleScroll(e){const n=this.scrollPositions.get(e);if(!n)return;const s=e===window,i=s?{x:window.scrollX,y:window.scrollY}:{x:e.scrollLeft,y:e.scrollTop},o={x:i.x-n.x,y:i.y-n.y};o.x===0&&o.y===0||(s?this.lastMoveEventInfo&&(this.lastMoveEventInfo.point.x+=o.x,this.lastMoveEventInfo.point.y+=o.y):this.history.length>0&&(this.history[0].x-=o.x,this.history[0].y-=o.y),this.scrollPositions.set(e,i),ut.update(this.updatePoint,!0))}updateHandlers(e){this.handlers=e}end(){this.removeListeners&&this.removeListeners(),this.removeScrollListeners&&this.removeScrollListeners(),this.scrollPositions.clear(),ep(this.updatePoint)}}function xs(t,e){return e?{point:e(t.point)}:t}function ra(t,e){return{x:t.x-e.x,y:t.y-e.y}}function Pr({point:t},e){return{point:t,delta:ra(t,lc(e)),offset:ra(t,Zx(e)),velocity:Yx(e,.1)}}function Zx(t){return t[0]}function lc(t){return t[t.length-1]}function Yx(t,e){if(t.length<2)return{x:0,y:0};let n=t.length-1,s=null;const i=lc(t);for(;n>=0&&(s=t[n],!(i.timestamp-s.timestamp>Mo(e)));)n--;if(!s)return{x:0,y:0};s===t[0]&&t.length>2&&i.timestamp-s.timestamp>Mo(e)*2&&(s=t[1]);const o=tp(i.timestamp-s.timestamp);if(o===0)return{x:0,y:0};const a={x:(i.x-s.x)/o,y:(i.y-s.y)/o};return a.x===1/0&&(a.x=0),a.y===1/0&&(a.y=0),a}function Xx(t,{min:e,max:n},s){return e!==void 0&&t<e?t=s?Qs(e,t,s.min):Math.max(t,e):n!==void 0&&t>n&&(t=s?Qs(n,t,s.max):Math.min(t,n)),t}function ia(t,e,n){return{min:e!==void 0?t.min+e:void 0,max:n!==void 0?t.max+n-(t.max-t.min):void 0}}function eb(t,{top:e,left:n,bottom:s,right:i}){return{x:ia(t.x,n,i),y:ia(t.y,e,s)}}function oa(t,e){let n=e.min-t.min,s=e.max-t.max;return e.max-e.min<t.max-t.min&&([n,s]=[s,n]),{min:n,max:s}}function tb(t,e){return{x:oa(t.x,e.x),y:oa(t.y,e.y)}}function nb(t,e){let n=.5;const s=di(t),i=di(e);return i>s?n=Oo(e.min,e.max-s,t.min):s>i&&(n=Oo(t.min,t.max-i,e.min)),np(0,1,n)}function sb(t,e){const n={};return e.min!==void 0&&(n.min=e.min-t.min),e.max!==void 0&&(n.max=e.max-t.min),n}const hi=.35;function rb(t=hi){return t===!1?t=0:t===!0&&(t=hi),{x:aa(t,"left","right"),y:aa(t,"top","bottom")}}function aa(t,e,n){return{min:la(t,e),max:la(t,n)}}function la(t,e){return typeof t=="number"?t:t[e]||0}const ib=new WeakMap;class ob{constructor(e){this.openDragLock=null,this.isDragging=!1,this.currentDirection=null,this.originPoint={x:0,y:0},this.constraints=!1,this.hasMutatedConstraints=!1,this.elastic=sp(),this.latestPointerEvent=null,this.latestPanInfo=null,this.visualElement=e}start(e,{snapToCursor:n=!1,distanceThreshold:s}={}){const{presenceContext:i}=this.visualElement;if(i&&i.isPresent===!1)return;const o=m=>{n&&this.snapToCursor(ds(m).point),this.stopAnimation()},a=(m,p)=>{const{drag:u,dragPropagation:g,onDragStart:x}=this.getProps();if(u&&!g&&(this.openDragLock&&this.openDragLock(),this.openDragLock=lp(u),!this.openDragLock))return;this.latestPointerEvent=m,this.latestPanInfo=p,this.isDragging=!0,this.currentDirection=null,this.resolveConstraints(),this.visualElement.projection&&(this.visualElement.projection.isAnimationBlocked=!0,this.visualElement.projection.target=void 0),St(v=>{let S=this.getAxisMotionValue(v).get()||0;if(cp.test(S)){const{projection:b}=this.visualElement;if(b&&b.layout){const C=b.layout.layoutBox[v];C&&(S=di(C)*(parseFloat(S)/100))}}this.originPoint[v]=S}),x&&ut.update(()=>x(m,p),!1,!0),$o(this.visualElement,"transform");const{animationState:w}=this.visualElement;w&&w.setActive("whileDrag",!0)},l=(m,p)=>{this.latestPointerEvent=m,this.latestPanInfo=p;const{dragPropagation:u,dragDirectionLock:g,onDirectionLock:x,onDrag:w}=this.getProps();if(!u&&!this.openDragLock)return;const{offset:v}=p;if(g&&this.currentDirection===null){this.currentDirection=lb(v),this.currentDirection!==null&&x&&x(this.currentDirection);return}this.updateAxis("x",p.point,v),this.updateAxis("y",p.point,v),this.visualElement.render(),w&&ut.update(()=>w(m,p),!1,!0)},c=(m,p)=>{this.latestPointerEvent=m,this.latestPanInfo=p,this.stop(m,p),this.latestPointerEvent=null,this.latestPanInfo=null},d=()=>{const{dragSnapToOrigin:m}=this.getProps();(m||this.constraints)&&this.startAnimation({x:0,y:0})},{dragSnapToOrigin:h}=this.getProps();this.panSession=new ac(e,{onSessionStart:o,onStart:a,onMove:l,onSessionEnd:c,resumeAnimation:d},{transformPagePoint:this.visualElement.getTransformPagePoint(),dragSnapToOrigin:h,distanceThreshold:s,contextWindow:oc(this.visualElement),element:this.visualElement.current})}stop(e,n){const s=e||this.latestPointerEvent,i=n||this.latestPanInfo,o=this.isDragging;if(this.cancel(),!o||!i||!s)return;const{velocity:a}=i;this.startAnimation(a);const{onDragEnd:l}=this.getProps();l&&ut.postRender(()=>l(s,i))}cancel(){this.isDragging=!1;const{projection:e,animationState:n}=this.visualElement;e&&(e.isAnimationBlocked=!1),this.endPanSession();const{dragPropagation:s}=this.getProps();!s&&this.openDragLock&&(this.openDragLock(),this.openDragLock=null),n&&n.setActive("whileDrag",!1)}endPanSession(){this.panSession&&this.panSession.end(),this.panSession=void 0}updateAxis(e,n,s){const{drag:i}=this.getProps();if(!s||!bs(e,i,this.currentDirection))return;const o=this.getAxisMotionValue(e);let a=this.originPoint[e]+s[e];this.constraints&&this.constraints[e]&&(a=Xx(a,this.constraints[e],this.elastic[e])),o.set(a)}resolveConstraints(){const{dragConstraints:e,dragElastic:n}=this.getProps(),s=this.visualElement.projection&&!this.visualElement.projection.layout?this.visualElement.projection.measure(!1):this.visualElement.projection?.layout,i=this.constraints;e&&sn(e)?this.constraints||(this.constraints=this.resolveRefConstraints()):e&&s?this.constraints=eb(s.layoutBox,e):this.constraints=!1,this.elastic=rb(n),i!==this.constraints&&!sn(e)&&s&&this.constraints&&!this.hasMutatedConstraints&&St(o=>{this.constraints!==!1&&this.getAxisMotionValue(o)&&(this.constraints[o]=sb(s.layoutBox[o],this.constraints[o]))})}resolveRefConstraints(){const{dragConstraints:e,onMeasureDragConstraints:n}=this.getProps();if(!e||!sn(e))return!1;const s=e.current,{projection:i}=this.visualElement;if(!i||!i.layout)return!1;i.root&&(i.root.scroll=void 0,i.root.updateScroll());const o=rp(s,i.root,this.visualElement.getTransformPagePoint());let a=tb(i.layout.layoutBox,o);if(n){const l=n(ip(a));this.hasMutatedConstraints=!!l,l&&(a=op(l))}return a}startAnimation(e){const{drag:n,dragMomentum:s,dragElastic:i,dragTransition:o,dragSnapToOrigin:a,onDragTransitionEnd:l}=this.getProps(),c=this.constraints||{},d=St(h=>{if(!bs(h,n,this.currentDirection))return;let m=c&&c[h]||{};(a===!0||a===h)&&(m={min:0,max:0});const p=i?200:1e6,u=i?40:1e7,g={type:"inertia",velocity:s?e[h]:0,bounceStiffness:p,bounceDamping:u,timeConstant:750,restDelta:1,restSpeed:10,...o,...m};return this.startAxisValueAnimation(h,g)});return Promise.all(d).then(l)}startAxisValueAnimation(e,n){const s=this.getAxisMotionValue(e);return $o(this.visualElement,e),s.start(ap(e,s,0,n,this.visualElement,!1))}stopAnimation(){St(e=>this.getAxisMotionValue(e).stop())}getAxisMotionValue(e){const n=`_drag${e.toUpperCase()}`,i=this.visualElement.getProps()[n];return i||this.visualElement.getValue(e,this.visualElement.latestValues[e]??0)}snapToCursor(e){St(n=>{const{drag:s}=this.getProps();if(!bs(n,s,this.currentDirection))return;const{projection:i}=this.visualElement,o=this.getAxisMotionValue(n);if(i&&i.layout){const{min:a,max:l}=i.layout.layoutBox[n],c=o.get()||0;o.set(e[n]-Qs(a,l,.5)+c)}})}scalePositionWithinConstraints(){if(!this.visualElement.current)return;const{drag:e,dragConstraints:n}=this.getProps(),{projection:s}=this.visualElement;if(!sn(n)||!s||!this.constraints)return;this.stopAnimation();const i={x:0,y:0};St(a=>{const l=this.getAxisMotionValue(a);if(l&&this.constraints!==!1){const c=l.get();i[a]=nb({min:c,max:c},this.constraints[a])}});const{transformTemplate:o}=this.visualElement.getProps();this.visualElement.current.style.transform=o?o({},""):"none",s.root&&s.root.updateScroll(),s.updateLayout(),this.constraints=!1,this.resolveConstraints(),St(a=>{if(!bs(a,e,null))return;const l=this.getAxisMotionValue(a),{min:c,max:d}=this.constraints[a];l.set(Qs(c,d,i[a]))}),this.visualElement.render()}addListeners(){if(!this.visualElement.current)return;ib.set(this.visualElement,this);const e=this.visualElement.current,n=ns(e,"pointerdown",d=>{const{drag:h,dragListener:m=!0}=this.getProps(),p=d.target,u=p!==e&&dp(p);h&&m&&!u&&this.start(d)});let s;const i=()=>{const{dragConstraints:d}=this.getProps();sn(d)&&d.current&&(this.constraints=this.resolveRefConstraints(),s||(s=ab(e,d.current,()=>this.scalePositionWithinConstraints())))},{projection:o}=this.visualElement,a=o.addEventListener("measure",i);o&&!o.layout&&(o.root&&o.root.updateScroll(),o.updateLayout()),ut.read(i);const l=Gs(window,"resize",()=>this.scalePositionWithinConstraints()),c=o.addEventListener("didUpdate",(({delta:d,hasLayoutChanged:h})=>{this.isDragging&&h&&(St(m=>{const p=this.getAxisMotionValue(m);p&&(this.originPoint[m]+=d[m].translate,p.set(p.get()+d[m].translate))}),this.visualElement.render())}));return()=>{l(),n(),a(),c&&c(),s&&s()}}getProps(){const e=this.visualElement.getProps(),{drag:n=!1,dragDirectionLock:s=!1,dragPropagation:i=!1,dragConstraints:o=!1,dragElastic:a=hi,dragMomentum:l=!0}=e;return{...e,drag:n,dragDirectionLock:s,dragPropagation:i,dragConstraints:o,dragElastic:a,dragMomentum:l}}}function ca(t){let e=!0;return()=>{if(e){e=!1;return}t()}}function ab(t,e,n){const s=Fo(t,ca(n)),i=Fo(e,ca(n));return()=>{s(),i()}}function bs(t,e,n){return(e===!0||e===t)&&(n===null||n===t)}function lb(t,e=10){let n=null;return Math.abs(t.y)>e?n="y":Math.abs(t.x)>e&&(n="x"),n}class cb extends Tt{constructor(e){super(e),this.removeGroupControls=Ps,this.removeListeners=Ps,this.controls=new ob(e)}mount(){const{dragControls:e}=this.node.getProps();e&&(this.removeGroupControls=e.subscribe(this.controls)),this.removeListeners=this.controls.addListeners()||Ps}update(){const{dragControls:e}=this.node.getProps(),{dragControls:n}=this.node.prevProps||{};e!==n&&(this.removeGroupControls(),e&&(this.removeGroupControls=e.subscribe(this.controls)))}unmount(){this.removeGroupControls(),this.removeListeners(),this.controls.isDragging||this.controls.endPanSession()}}const Tr=t=>(e,n)=>{t&&ut.update(()=>t(e,n),!1,!0)};class db extends Tt{constructor(){super(...arguments),this.removePointerDownListener=Ps}onPointerDown(e){this.session=new ac(e,this.createPanHandlers(),{transformPagePoint:this.node.getTransformPagePoint(),contextWindow:oc(this.node)})}createPanHandlers(){const{onPanSessionStart:e,onPanStart:n,onPan:s,onPanEnd:i}=this.node.getProps();return{onSessionStart:Tr(e),onStart:Tr(n),onMove:Tr(s),onEnd:(o,a)=>{delete this.session,i&&ut.postRender(()=>i(o,a))}}}mount(){this.removePointerDownListener=ns(this.node.current,"pointerdown",e=>this.onPointerDown(e))}update(){this.session&&this.session.updateHandlers(this.createPanHandlers())}unmount(){this.removePointerDownListener(),this.session&&this.session.end()}}let Ir=!1;class ub extends f.Component{componentDidMount(){const{visualElement:e,layoutGroup:n,switchLayoutGroup:s,layoutId:i}=this.props,{projection:o}=e;o&&(n.group&&n.group.add(o),s&&s.register&&i&&s.register(o),Ir&&o.root.didUpdate(),o.addEventListener("animationComplete",()=>{this.safeToRemove()}),o.setOptions({...o.options,layoutDependency:this.props.layoutDependency,onExitComplete:()=>this.safeToRemove()})),hp.hasEverUpdated=!0}getSnapshotBeforeUpdate(e){const{layoutDependency:n,visualElement:s,drag:i,isPresent:o}=this.props,{projection:a}=s;return a&&(a.isPresent=o,e.layoutDependency!==n&&a.setOptions({...a.options,layoutDependency:n}),Ir=!0,i||e.layoutDependency!==n||n===void 0||e.isPresent!==o?a.willUpdate():this.safeToRemove(),e.isPresent!==o&&(o?a.promote():a.relegate()||ut.postRender(()=>{const l=a.getStack();(!l||!l.members.length)&&this.safeToRemove()}))),null}componentDidUpdate(){const{visualElement:e,layoutAnchor:n}=this.props,{projection:s}=e;s&&(s.options.layoutAnchor=n,s.root.didUpdate(),up.postRender(()=>{!s.currentAnimation&&s.isLead()&&this.safeToRemove()}))}componentWillUnmount(){const{visualElement:e,layoutGroup:n,switchLayoutGroup:s}=this.props,{projection:i}=e;Ir=!0,i&&(i.scheduleCheckAfterUnmount(),n&&n.group&&n.group.remove(i),s&&s.deregister&&s.deregister(i))}safeToRemove(){const{safeToRemove:e}=this.props;e&&e()}render(){return null}}function cc(t){const[e,n]=Kl(),s=f.useContext(Gi);return r.jsx(ub,{...t,layoutGroup:s,switchLayoutGroup:f.useContext(rc),isPresent:e,safeToRemove:n})}const hb={pan:{Feature:db},drag:{Feature:cb,ProjectionNode:Vl,MeasureLayout:cc}};function da(t,e,n){const{props:s}=t;t.animationState&&s.whileHover&&t.animationState.setActive("whileHover",n==="Start");const i="onHover"+n,o=s[i];o&&ut.postRender(()=>o(e,ds(e)))}class fb extends Tt{mount(){const{current:e}=this.node;e&&(this.unmount=fp(e,(n,s)=>(da(this.node,s,"Start"),i=>da(this.node,i,"End"))))}unmount(){}}class mb extends Tt{constructor(){super(...arguments),this.isActive=!1}onFocus(){let e=!1;try{e=this.node.current.matches(":focus-visible")}catch{e=!0}!e||!this.node.animationState||(this.node.animationState.setActive("whileFocus",!0),this.isActive=!0)}onBlur(){!this.isActive||!this.node.animationState||(this.node.animationState.setActive("whileFocus",!1),this.isActive=!1)}mount(){this.unmount=Bl(Gs(this.node.current,"focus",()=>this.onFocus()),Gs(this.node.current,"blur",()=>this.onBlur()))}unmount(){}}function ua(t,e,n){const{props:s}=t;if(t.current instanceof HTMLButtonElement&&t.current.disabled)return;t.animationState&&s.whileTap&&t.animationState.setActive("whileTap",n==="Start");const i="onTap"+(n==="End"?"":n),o=s[i];o&&ut.postRender(()=>o(e,ds(e)))}class pb extends Tt{mount(){const{current:e}=this.node;if(!e)return;const{globalTapTarget:n,propagate:s}=this.node.props;this.unmount=mp(e,(i,o)=>(ua(this.node,o,"Start"),(a,{success:l})=>ua(this.node,a,l?"End":"Cancel")),{useGlobalTarget:n,stopPropagation:s?.tap===!1})}unmount(){}}const fi=new WeakMap,Ar=new WeakMap,gb=t=>{const e=fi.get(t.target);e&&e(t)},xb=t=>{t.forEach(gb)};function bb({root:t,...e}){const n=t||document;Ar.has(n)||Ar.set(n,{});const s=Ar.get(n),i=JSON.stringify(e);return s[i]||(s[i]=new IntersectionObserver(xb,{root:t,...e})),s[i]}function yb(t,e,n){const s=bb(e);return fi.set(t,n),s.observe(t),()=>{fi.delete(t),s.unobserve(t)}}const wb={some:0,all:1};class vb extends Tt{constructor(){super(...arguments),this.hasEnteredView=!1,this.isInView=!1}startObserver(){this.stopObserver?.();const{viewport:e={}}=this.node.getProps(),{root:n,margin:s,amount:i="some",once:o}=e,a={root:n?n.current:void 0,rootMargin:s,threshold:typeof i=="number"?i:wb[i]},l=c=>{const{isIntersecting:d}=c;if(this.isInView===d||(this.isInView=d,o&&!d&&this.hasEnteredView))return;d&&(this.hasEnteredView=!0),this.node.animationState&&this.node.animationState.setActive("whileInView",d);const{onViewportEnter:h,onViewportLeave:m}=this.node.getProps(),p=d?h:m;p&&p(c)};this.stopObserver=yb(this.node.current,a,l)}mount(){this.startObserver()}update(){if(typeof IntersectionObserver>"u")return;const{props:e,prevProps:n}=this.node;["amount","margin","root"].some(Sb(e,n))&&this.startObserver()}unmount(){this.stopObserver?.(),this.hasEnteredView=!1,this.isInView=!1}}function Sb({viewport:t={}},{viewport:e={}}={}){return n=>t[n]!==e[n]}const jb={inView:{Feature:vb},tap:{Feature:pb},focus:{Feature:mb},hover:{Feature:fb}},kb={layout:{ProjectionNode:Vl,MeasureLayout:cc}},Cb={...Qx,...jb,...hb,...kb},zs=Ux(Cb,Hx);async function Ys(t){if(typeof window>"u")return!1;try{if(navigator.clipboard&&window.isSecureContext)return await navigator.clipboard.writeText(t),!0}catch{}try{const e=document.createElement("textarea");e.value=t,e.style.position="fixed",e.style.left="-999999px",e.style.top="-999999px",e.setAttribute("readonly",""),document.body.appendChild(e),e.focus(),e.select();const n=document.execCommand("copy");return document.body.removeChild(e),n}catch(e){return console.error("[OpenLearn Clipboard] Failed to copy text to clipboard:",e),!1}}function Nb(){const t=Cp(o=>o.toasts),[e,n]=f.useState(null),s=async(o,a)=>{o.stopPropagation();const l=`[${a.title}] ${a.message}`;await Ys(l)&&(n(a.id),setTimeout(()=>n(null),2e3))},i=o=>{switch(o){case"error":return{border:"border-l-4 border-rose-500",iconBg:"bg-rose-50 text-rose-600 dark:bg-rose-950/60 dark:text-rose-400",icon:r.jsx(Us,{size:16})};case"warning":return{border:"border-l-4 border-amber-500",iconBg:"bg-amber-50 text-amber-600 dark:bg-amber-950/60 dark:text-amber-400",icon:r.jsx(un,{size:16})};case"info":return{border:"border-l-4 border-blue-500",iconBg:"bg-blue-50 text-blue-600 dark:bg-blue-950/60 dark:text-blue-400",icon:r.jsx(Pl,{size:16})};case"success":default:return{border:"border-l-4 border-emerald-500",iconBg:"bg-emerald-50 text-emerald-600 dark:bg-emerald-950/60 dark:text-emerald-400",icon:r.jsx(it,{size:16})}}};return r.jsx("div",{className:"fixed bottom-6 right-6 z-50 flex flex-col gap-3 min-w-[320px] max-w-sm pointer-events-none",children:r.jsx(Zl,{children:t.map(o=>{const a=i(o.type),l=e===o.id;return r.jsxs(zs.div,{initial:{opacity:0,y:50,x:50,scale:.9},animate:{opacity:1,y:0,x:0,scale:1},exit:{opacity:0,scale:.85,transition:{duration:.2}},transition:{type:"spring",stiffness:300,damping:24},className:`pointer-events-auto w-full bg-white dark:bg-slate-900 ring-1 ring-black/5 shadow-2xl rounded-xl p-4 flex gap-3 ${a.border} overflow-hidden text-gray-900 dark:text-gray-100`,id:`toast-${o.id}`,children:[r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsxs("div",{className:"flex items-center justify-between gap-2",children:[r.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[r.jsx("span",{className:`p-1 rounded-full shrink-0 ${a.iconBg}`,children:a.icon}),r.jsx("p",{className:"font-semibold text-sm font-sans truncate",children:o.title})]}),(o.type==="error"||o.type==="warning")&&r.jsxs("button",{type:"button",onClick:c=>s(c,o),className:`text-xs font-bold px-1.5 py-0.5 rounded transition-all flex items-center gap-1 cursor-pointer shrink-0 ${l?"bg-emerald-600 text-white":"bg-gray-100 hover:bg-gray-200 dark:bg-slate-800 dark:hover:bg-slate-700 text-gray-600 dark:text-gray-300"}`,title:"复制错误内容",children:[l?r.jsx(rt,{size:11}):r.jsx(an,{size:11}),r.jsx("span",{children:l?"已复制":"复制"})]})]}),r.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400 mt-2 leading-relaxed font-sans break-words",children:o.message})]}),r.jsx("button",{type:"button",onClick:()=>Ye.getState().removeToast(o.id),className:"text-gray-400 hover:text-gray-600 dark:hover:text-gray-200 hover:bg-gray-50 dark:hover:bg-slate-800 rounded p-1 h-fit transition-colors shrink-0 cursor-pointer",children:r.jsx(Ie,{size:14})})]},o.id)})})})}const mi=new Set;function Eb(t){return mi.add(t),()=>{mi.delete(t)}}const ha=30,fa=(t,e)=>Math.min(t,e.length);function Yi(t){const e=new Date(t.timestamp).toLocaleString(),n=[`### [${t.type.toUpperCase()}] ${t.title}`,`- **发生时间**: ${e}`,`- **页面路径**: ${t.url||"N/A"}`,`- **错误摘要**: ${t.message}`];return t.endpoint&&n.push(`- **请求接口**: \`${t.endpoint}\` (HTTP ${t.status||"Unknown"})`),t.componentStack&&n.push("- **组件堆栈**:","```",t.componentStack.trim(),"```"),t.stack&&n.push("- **调用栈 (Stack Trace)**:","```",t.stack.trim(),"```"),n.join(`
|
|
17
|
+
`)}function dc(t){const e=new Date(t.timestamp).toLocaleString(),n=[`### [学生端异常] ${t.studentName||t.studentId} - ${t.title}`,`- **学生信息**: ${t.studentName||"未知"} (\`${t.studentId}\`)`,`- **关联课节**: ${t.lessonId||"未指定"}`,`- **关联班级**: ${t.classId||"未指定"}`,`- **发生时间**: ${e}`,`- **页面路径**: ${t.url||"N/A"}`,`- **错误摘要**: ${t.message}`];return t.endpoint&&n.push(`- **请求接口**: \`${t.endpoint}\` (HTTP ${t.status||"Unknown"})`),t.componentStack&&n.push("- **组件堆栈**:","```",t.componentStack.trim(),"```"),t.stack&&n.push("- **调用栈 (Stack Trace)**:","```",t.stack.trim(),"```"),n.join(`
|
|
18
|
+
`)}function Pb(t,e=[]){const n=new Date().toLocaleString(),s=typeof window<"u"?window.location.href:"Unknown",i=typeof navigator<"u"?navigator.userAgent:"Unknown";if(t.length===0&&e.length===0)return`# 🛠️ OpenLearn 系统诊断报告
|
|
19
|
+
- 生成时间: ${n}
|
|
20
|
+
- 暂无记录的系统异常。`;const o=t.length+e.length,a=["# 🛠️ OpenLearn 系统异常诊断报告",`- **生成时间**: ${n}`,`- **当前页面**: ${s}`,`- **异常总数**: ${o} 项`,`- **本机异常数**: ${t.length} 项`,`- **学生端异常数**: ${e.length} 项`,`- **运行环境**: ${i}`,"","---",""].join(`
|
|
21
|
+
`),l=t.length>0?`## 💻 本机异常记录 (${t.length})
|
|
22
|
+
|
|
23
|
+
`+t.map((d,h)=>`#### 错误 #${h+1} (${d.type.toUpperCase()})
|
|
24
|
+
`+Yi(d)).join(`
|
|
25
|
+
|
|
26
|
+
---
|
|
27
|
+
|
|
28
|
+
`):"",c=e.length>0?`## 🎒 学生端异常记录 (${e.length})
|
|
29
|
+
|
|
30
|
+
`+e.map((d,h)=>`#### 学生异常 #${h+1}
|
|
31
|
+
`+dc(d)).join(`
|
|
32
|
+
|
|
33
|
+
---
|
|
34
|
+
|
|
35
|
+
`):"";return[a,l,c].filter(Boolean).join(`
|
|
36
|
+
|
|
37
|
+
---
|
|
38
|
+
|
|
39
|
+
`)}const Dt=$t((t,e)=>({errors:[],studentErrors:[],activeTab:"local",isErrorCenterOpen:!1,unreadCount:0,addError:n=>{const s=Date.now(),i=n.url||(typeof window<"u"?window.location.href:""),o=n.userAgent||(typeof navigator<"u"?navigator.userAgent:""),a=e().errors.findIndex(c=>c.type===n.type&&c.message===n.message&&s-c.timestamp<2e3);if(a>=0)return e().errors[a];const l={id:`err_${s}_${Math.random().toString(36).slice(2,7)}`,timestamp:n.timestamp||s,url:i,userAgent:o,type:n.type,title:n.title,message:n.message,stack:n.stack,componentStack:n.componentStack,endpoint:n.endpoint,status:n.status};return t(c=>{const d=[l,...c.errors].slice(0,ha);return{errors:d,unreadCount:fa(c.unreadCount+1,d)}}),mi.forEach(c=>{try{c(l)}catch(d){console.error("[ErrorStore] Error in errorListener:",d)}}),l},removeError:n=>t(s=>{const i=s.errors.filter(o=>o.id!==n);return{errors:i,unreadCount:fa(s.unreadCount,i)}}),clearErrors:()=>t({errors:[],unreadCount:0}),addStudentError:n=>{const s=Date.now(),i=n.timestamp||s;t(o=>o.studentErrors.some(d=>d.studentId===n.studentId&&d.type===n.type&&d.message===n.message&&Math.abs(i-d.timestamp)<2e3)?o:{studentErrors:[{...n,id:n.id||`st_err_${s}_${Math.random().toString(36).slice(2,7)}`,timestamp:i},...o.studentErrors].slice(0,ha)})},removeStudentError:n=>t(s=>({studentErrors:s.studentErrors.filter(i=>i.id!==n)})),clearStudentErrors:()=>t({studentErrors:[]}),setIsErrorCenterOpen:n=>t({isErrorCenterOpen:n,unreadCount:n?0:e().unreadCount}),setActiveTab:n=>t({activeTab:n}),markAllRead:()=>t({unreadCount:0})}));function ht(t){return pn(Dt,t||(e=>e))}function Tb(){const t=ue(T=>T.session),e=typeof window<"u"&&(new URLSearchParams(window.location.search).get("mode")==="student_live"||window.location.hash.includes("student_live")),n=t?.role==="student"||e,s=ht(T=>T.errors),i=ht(T=>T.studentErrors),o=ht(T=>T.activeTab),a=ht(T=>T.setActiveTab),l=ht(T=>T.isErrorCenterOpen),c=ht(T=>T.setIsErrorCenterOpen),d=ht(T=>T.clearErrors),h=ht(T=>T.clearStudentErrors),m=ht(T=>T.removeError),p=ht(T=>T.removeStudentError),[u,g]=f.useState(!1),[x,w]=f.useState(null),[v,S]=f.useState(new Set),[b,C]=f.useState(!1),N=s.length+(n?0:i.length),y=s.length>0||!n&&i.length>0,P=T=>{S(A=>{const R=new Set(A);return R.has(T)?R.delete(T):R.add(T),R})},L=async()=>{const T=Pb(s,n?[]:i);await Ys(T)&&(g(!0),setTimeout(()=>g(!1),2500))},_=async(T,A,R=!1)=>{T.stopPropagation();const D=R?dc(A):Yi(A);await Ys(D)&&(w(A.id),setTimeout(()=>w(null),2500))},O=T=>{switch(T){case"react":return r.jsx("span",{className:"px-2 py-0.5 rounded-full text-xs font-bold bg-rose-100 text-rose-700 dark:bg-rose-950/60 dark:text-rose-400 border border-rose-200 dark:border-rose-800",children:"React"});case"api":return r.jsx("span",{className:"px-2 py-0.5 rounded-full text-xs font-bold bg-purple-100 text-purple-700 dark:bg-purple-950/60 dark:text-purple-400 border border-purple-200 dark:border-purple-800",children:"API 5xx"});case"promise":return r.jsx("span",{className:"px-2 py-0.5 rounded-full text-xs font-bold bg-amber-100 text-amber-700 dark:bg-amber-950/60 dark:text-amber-400 border border-amber-200 dark:border-amber-800",children:"Promise"});default:return r.jsx("span",{className:"px-2 py-0.5 rounded-full text-xs font-bold bg-blue-100 text-blue-700 dark:bg-blue-950/60 dark:text-blue-400 border border-blue-200 dark:border-blue-800",children:"Runtime"})}};return r.jsxs(r.Fragment,{children:[y&&!l&&!b&&(n?r.jsxs(zs.button,{type:"button",initial:{opacity:0,scale:.8},animate:{opacity:1,scale:1},exit:{opacity:0,scale:.8},className:"fixed bottom-5 left-5 z-40 w-8 h-8 rounded-full bg-slate-900/80 hover:bg-slate-900 text-rose-400 border border-rose-500/40 shadow-lg flex items-center justify-center cursor-pointer transition-all hover:scale-105 select-none",onClick:()=>c(!0),id:"system-error-pill",title:`系统状态提示: ${s.length} 处异常`,children:[r.jsx(un,{size:15}),r.jsx("span",{className:"absolute -top-1 -right-1 min-w-[16px] h-4 px-1 rounded-full bg-rose-500 text-white text-[10px] font-bold flex items-center justify-center leading-none shadow-xs border border-slate-900",children:s.length})]}):r.jsxs(zs.div,{initial:{opacity:0,y:20,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,scale:.9},className:"fixed bottom-5 left-5 z-40 flex items-center gap-2 bg-slate-900/90 hover:bg-slate-900 backdrop-blur-md text-white px-3.5 py-2 rounded-2xl shadow-xl border border-rose-500/40 cursor-pointer select-none transition-all group",onClick:()=>{s.length===0&&i.length>0&&a("student"),c(!0)},id:"system-error-pill",children:[r.jsxs("div",{className:"relative flex items-center justify-center",children:[r.jsx("span",{className:"animate-ping absolute inline-flex h-3 w-3 rounded-full bg-rose-400 opacity-75"}),r.jsx("span",{className:"relative inline-flex rounded-full h-2 w-2 bg-rose-500"})]}),r.jsx(un,{size:15,className:"text-rose-400 group-hover:scale-110 transition-transform"}),r.jsxs("div",{className:"text-xs font-semibold flex items-center gap-1.5",children:[r.jsx("span",{children:"捕获到"}),r.jsx("span",{className:"bg-rose-500/80 text-white font-mono px-1.5 py-0.2 rounded-md text-xs font-bold",children:N}),r.jsx("span",{children:"处系统异常"}),i.length>0&&r.jsxs("span",{className:"text-[10px] text-rose-300 font-normal",children:["(含学生端 ",i.length,")"]})]}),r.jsx("button",{type:"button",className:"text-xs font-bold text-rose-300 hover:text-white bg-white/10 hover:bg-white/20 px-2 py-0.5 rounded-lg transition-colors ml-1",children:"查看与复制"}),r.jsx("button",{type:"button",onClick:T=>{T.stopPropagation(),C(!0)},className:"text-gray-400 hover:text-gray-200 p-0.5 hover:bg-white/10 rounded transition-colors ml-0.5",title:"暂时隐藏胶囊",children:r.jsx(Ie,{size:13})})]})),r.jsx(Zl,{children:l&&r.jsx("div",{className:"fixed inset-0 bg-gray-900/60 backdrop-blur-xs flex items-center justify-center p-4 z-50 overflow-hidden select-text",children:r.jsxs(zs.div,{initial:{opacity:0,scale:.95,y:10},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:10},className:"bg-white dark:bg-slate-900 border border-gray-200 dark:border-gray-800 rounded-2xl shadow-2xl w-full max-w-3xl max-h-[85vh] flex flex-col overflow-hidden text-gray-900 dark:text-gray-100",children:[r.jsxs("div",{className:"px-5 py-4 border-b border-gray-200 dark:border-gray-800 flex items-center justify-between bg-gray-50/80 dark:bg-slate-850/80 shrink-0",children:[r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx("div",{className:"p-2 bg-rose-500/10 text-rose-600 dark:text-rose-400 border border-rose-500/20 rounded-xl",children:r.jsx(Lm,{size:18})}),r.jsxs("div",{children:[r.jsx("div",{className:"flex items-center gap-2",children:r.jsxs("h2",{className:"text-sm font-bold flex items-center gap-2",children:[r.jsx("span",{children:"系统异常诊断中心 (System Diagnostics)"}),r.jsxs("span",{className:"text-xs font-normal text-gray-500 dark:text-gray-400",children:["(",N," 项记录)"]})]})}),r.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400 mt-0.5",children:"自动捕获运行时、Promise 及接口 5xx 异常,支持一键导出 Markdown 格式排查报告。"})]})]}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsxs("button",{type:"button",onClick:L,disabled:N===0,className:`px-3 py-1.5 rounded-lg text-xs font-bold transition-all flex items-center gap-1.5 shadow-xs cursor-pointer ${u?"bg-emerald-600 text-white":"bg-indigo-600 hover:bg-indigo-700 text-white disabled:opacity-40 disabled:cursor-not-allowed"}`,title:"复制所有异常报告为 Markdown 文本",children:[u?r.jsx(rt,{size:13}):r.jsx(an,{size:13}),r.jsx("span",{children:u?"已复制全部!":"一键复制全部诊断日志"})]}),r.jsx("button",{type:"button",onClick:()=>{!n&&o==="student"?h():d()},disabled:o==="student"?i.length===0:s.length===0,className:"p-1.5 text-gray-500 hover:text-rose-600 dark:text-gray-400 dark:hover:text-rose-400 hover:bg-gray-100 dark:hover:bg-slate-800 rounded-lg transition-colors disabled:opacity-40 disabled:cursor-not-allowed cursor-pointer",title:o==="student"?"清空学生端异常记录":"清空记录",children:r.jsx(zl,{size:16})}),r.jsx("button",{type:"button",onClick:()=>c(!1),className:"p-1.5 text-gray-500 hover:text-gray-800 dark:text-gray-400 dark:hover:text-gray-200 hover:bg-gray-100 dark:hover:bg-slate-800 rounded-lg transition-colors cursor-pointer",children:r.jsx(Ie,{size:16})})]})]}),!n&&r.jsxs("div",{className:"px-5 py-2 border-b border-gray-200 dark:border-gray-800 bg-gray-50/50 dark:bg-slate-900/50 flex items-center gap-2",children:[r.jsxs("button",{type:"button",onClick:()=>a("local"),className:`px-3 py-1.5 rounded-lg text-xs font-bold transition-all flex items-center gap-1.5 cursor-pointer ${o==="local"?"bg-white dark:bg-slate-800 text-indigo-600 dark:text-indigo-400 shadow-xs border border-gray-200 dark:border-gray-700":"text-gray-500 hover:text-gray-800 dark:text-gray-400"}`,children:[r.jsx(Rm,{size:13}),r.jsxs("span",{children:["本机异常 (",s.length,")"]})]}),r.jsxs("button",{type:"button",onClick:()=>a("student"),className:`px-3 py-1.5 rounded-lg text-xs font-bold transition-all flex items-center gap-1.5 cursor-pointer ${o==="student"?"bg-white dark:bg-slate-800 text-rose-600 dark:text-rose-400 shadow-xs border border-gray-200 dark:border-gray-700":"text-gray-500 hover:text-gray-800 dark:text-gray-400"}`,children:[r.jsx(Vs,{size:14}),r.jsxs("span",{children:["学生端异常 (",i.length,")"]}),i.length>0&&r.jsx("span",{className:"inline-block w-2 h-2 rounded-full bg-rose-500 animate-pulse"})]})]}),r.jsx("div",{className:"flex-1 overflow-y-auto p-4 space-y-3 min-h-0 bg-slate-50/50 dark:bg-slate-950/30",children:!n&&o==="student"?i.length===0?r.jsxs("div",{className:"py-16 text-center text-gray-400 dark:text-gray-500 space-y-2",children:[r.jsx(rt,{size:32,className:"mx-auto text-emerald-500 opacity-80"}),r.jsx("p",{className:"text-sm font-semibold",children:"暂无学生端上报的系统异常"}),r.jsx("p",{className:"text-xs opacity-75",children:"全班学生端运行良好,未发生未捕获的前端崩溃或接口 5xx 故障。"})]}):i.map((T,A)=>{const R=v.has(T.id),D=x===T.id;return r.jsxs("div",{className:"bg-white dark:bg-slate-900 border border-gray-200 dark:border-gray-800 rounded-xl overflow-hidden shadow-2xs hover:border-gray-300 dark:hover:border-gray-700 transition-colors",children:[r.jsxs("div",{onClick:()=>P(T.id),className:"px-4 py-3 flex items-start justify-between gap-3 cursor-pointer select-none hover:bg-gray-50/50 dark:hover:bg-slate-850/50 transition-colors",children:[r.jsxs("div",{className:"flex items-start gap-2.5 min-w-0 flex-1",children:[r.jsx("span",{className:"text-gray-400 mt-0.5 shrink-0",children:R?r.jsx(fn,{size:15}):r.jsx(hn,{size:15})}),r.jsxs("div",{className:"space-y-1 min-w-0 flex-1",children:[r.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[r.jsxs("span",{className:"px-2 py-0.5 rounded-full text-xs font-bold bg-rose-100 text-rose-700 dark:bg-rose-950/60 dark:text-rose-400 border border-rose-200 dark:border-rose-800 flex items-center gap-1",children:[r.jsx(Vs,{size:11}),r.jsx("span",{children:T.studentName||T.studentId})]}),O(T.type),r.jsxs("span",{className:"font-bold text-xs text-gray-900 dark:text-gray-100 truncate",children:["#",i.length-A," ",T.title]}),r.jsx("span",{className:"text-xs text-gray-400 font-mono",children:new Date(T.timestamp).toLocaleTimeString()})]}),r.jsx("p",{className:"text-xs text-rose-600 dark:text-rose-400 font-mono break-all line-clamp-2",children:T.message}),r.jsxs("div",{className:"flex items-center gap-3 text-xs text-gray-500 font-mono truncate",children:[r.jsxs("span",{children:["学生学号/ID: ",T.studentId]}),T.lessonId&&r.jsxs("span",{children:["课节: ",T.lessonId]}),T.classId&&r.jsxs("span",{children:["班级: ",T.classId]}),T.endpoint&&r.jsxs("span",{children:["接口: ",T.endpoint]})]})]})]}),r.jsxs("div",{className:"flex items-center gap-1.5 shrink-0",children:[r.jsxs("button",{type:"button",onClick:I=>_(I,T,!0),className:`px-2.5 py-1 rounded-lg text-xs font-bold transition-all flex items-center gap-1 cursor-pointer ${D?"bg-emerald-600 text-white":"bg-gray-100 hover:bg-gray-200 text-gray-700 dark:bg-slate-800 dark:hover:bg-slate-700 dark:text-gray-200"}`,title:"一键复制此条学生错误报告",children:[D?r.jsx(rt,{size:11}):r.jsx(an,{size:11}),r.jsx("span",{children:D?"已复制":"复制"})]}),r.jsx("button",{type:"button",onClick:I=>{I.stopPropagation(),p(T.id)},className:"p-1 text-gray-400 hover:text-rose-600 rounded transition-colors cursor-pointer",title:"移除此项",children:r.jsx(Ie,{size:13})})]})]}),R&&r.jsxs("div",{className:"px-4 py-3 bg-slate-900 text-slate-200 border-t border-gray-100 dark:border-gray-800 text-xs font-mono space-y-2.5",children:[r.jsxs("div",{className:"flex items-center justify-between text-xs text-slate-400 border-b border-slate-800 pb-1.5",children:[r.jsxs("span",{children:["学生: ",T.studentName||"未知"," (",T.studentId,")"]}),r.jsxs("span",{children:["页面地址: ",T.url||"未知"]}),r.jsxs("span",{children:["时间: ",new Date(T.timestamp).toLocaleString()]})]}),T.stack&&r.jsxs("div",{children:[r.jsx("span",{className:"text-rose-400 font-bold block mb-1",children:"Stack Trace:"}),r.jsx("pre",{className:"whitespace-pre-wrap text-xs leading-relaxed max-h-48 overflow-y-auto opacity-90",children:T.stack})]}),T.componentStack&&r.jsxs("div",{className:"pt-2 border-t border-slate-800",children:[r.jsx("span",{className:"text-amber-400 font-bold block mb-1",children:"Component Stack:"}),r.jsx("pre",{className:"whitespace-pre-wrap text-xs leading-relaxed max-h-36 overflow-y-auto opacity-80",children:T.componentStack})]})]})]},T.id)}):s.length===0?r.jsxs("div",{className:"py-16 text-center text-gray-400 dark:text-gray-500 space-y-2",children:[r.jsx(rt,{size:32,className:"mx-auto text-emerald-500 opacity-80"}),r.jsx("p",{className:"text-sm font-semibold",children:"暂无捕获到的系统异常"}),r.jsx("p",{className:"text-xs opacity-75",children:"系统运行顺畅,所有模块均在正常状态下运作。"})]}):s.map((T,A)=>{const R=v.has(T.id),D=x===T.id;return r.jsxs("div",{className:"bg-white dark:bg-slate-900 border border-gray-200 dark:border-gray-800 rounded-xl overflow-hidden shadow-2xs hover:border-gray-300 dark:hover:border-gray-700 transition-colors",children:[r.jsxs("div",{onClick:()=>P(T.id),className:"px-4 py-3 flex items-start justify-between gap-3 cursor-pointer select-none hover:bg-gray-50/50 dark:hover:bg-slate-850/50 transition-colors",children:[r.jsxs("div",{className:"flex items-start gap-2.5 min-w-0 flex-1",children:[r.jsx("span",{className:"text-gray-400 mt-0.5 shrink-0",children:R?r.jsx(fn,{size:15}):r.jsx(hn,{size:15})}),r.jsxs("div",{className:"space-y-1 min-w-0 flex-1",children:[r.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[O(T.type),r.jsxs("span",{className:"font-bold text-xs text-gray-900 dark:text-gray-100 truncate",children:["#",s.length-A," ",T.title]}),r.jsx("span",{className:"text-xs text-gray-400 font-mono",children:new Date(T.timestamp).toLocaleTimeString()})]}),r.jsx("p",{className:"text-xs text-rose-600 dark:text-rose-400 font-mono break-all line-clamp-2",children:T.message}),T.endpoint&&r.jsxs("p",{className:"text-xs text-gray-500 font-mono truncate",children:["接口: ",T.endpoint]})]})]}),r.jsxs("div",{className:"flex items-center gap-1.5 shrink-0",children:[r.jsxs("button",{type:"button",onClick:I=>_(I,T,!1),className:`px-2.5 py-1 rounded-lg text-xs font-bold transition-all flex items-center gap-1 cursor-pointer ${D?"bg-emerald-600 text-white":"bg-gray-100 hover:bg-gray-200 text-gray-700 dark:bg-slate-800 dark:hover:bg-slate-700 dark:text-gray-200"}`,title:"一键复制此条错误报告",children:[D?r.jsx(rt,{size:11}):r.jsx(an,{size:11}),r.jsx("span",{children:D?"已复制":"复制"})]}),r.jsx("button",{type:"button",onClick:I=>{I.stopPropagation(),m(T.id)},className:"p-1 text-gray-400 hover:text-rose-600 rounded transition-colors cursor-pointer",title:"移除此项",children:r.jsx(Ie,{size:13})})]})]}),R&&r.jsxs("div",{className:"px-4 py-3 bg-slate-900 text-slate-200 border-t border-gray-100 dark:border-gray-800 text-xs font-mono space-y-2.5",children:[r.jsxs("div",{className:"flex items-center justify-between text-xs text-slate-400 border-b border-slate-800 pb-1.5",children:[r.jsxs("span",{children:["页面地址: ",T.url||"未知"]}),r.jsxs("span",{children:["时间: ",new Date(T.timestamp).toLocaleString()]})]}),T.stack&&r.jsxs("div",{children:[r.jsx("span",{className:"text-rose-400 font-bold block mb-1",children:"Stack Trace:"}),r.jsx("pre",{className:"whitespace-pre-wrap text-xs leading-relaxed max-h-48 overflow-y-auto opacity-90",children:T.stack})]}),T.componentStack&&r.jsxs("div",{className:"pt-2 border-t border-slate-800",children:[r.jsx("span",{className:"text-amber-400 font-bold block mb-1",children:"Component Stack:"}),r.jsx("pre",{className:"whitespace-pre-wrap text-xs leading-relaxed max-h-36 overflow-y-auto opacity-80",children:T.componentStack})]})]})]},T.id)})})]})})})]})}let ma=!1;function Ib(){if(ma)return;ma=!0;const t=()=>$e(()=>import("./ActivityWorkspaceWidget-_6XMBAcc.js"),__vite__mapDeps([19,1,2,3,4])).then(e=>({default:()=>r.jsx(e.ActivityWorkspaceWidget,{role:"teacher",mode:"status"})}));t.__isLazyFactory=!0,Le.getState().registerExtensionPoint("teacher.dashboard.widget",{id:"official_activity_center",label:"Activity Center",icon:"Puzzle",pluginId:"openlearn-official",component:t})}function Ab(t,e){const n={};return(t[t.length-1]===""?[...t,""]:t).join((n.padRight?" ":"")+","+(n.padLeft===!1?"":" ")).trim()}const zb=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,Lb=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,Rb={};function pa(t,e){return(Rb.jsx?Lb:zb).test(t)}const _b=/[ \t\n\f\r]/g;function Db(t){return typeof t=="object"?t.type==="text"?ga(t.value):!1:ga(t)}function ga(t){return t.replace(_b,"")===""}class us{constructor(e,n,s){this.normal=n,this.property=e,s&&(this.space=s)}}us.prototype.normal={};us.prototype.property={};us.prototype.space=void 0;function uc(t,e){const n={},s={};for(const i of t)Object.assign(n,i.property),Object.assign(s,i.normal);return new us(n,s,e)}function pi(t){return t.toLowerCase()}class Ge{constructor(e,n){this.attribute=n,this.property=e}}Ge.prototype.attribute="";Ge.prototype.booleanish=!1;Ge.prototype.boolean=!1;Ge.prototype.commaOrSpaceSeparated=!1;Ge.prototype.commaSeparated=!1;Ge.prototype.defined=!1;Ge.prototype.mustUseProperty=!1;Ge.prototype.number=!1;Ge.prototype.overloadedBoolean=!1;Ge.prototype.property="";Ge.prototype.spaceSeparated=!1;Ge.prototype.space=void 0;let Mb=0;const de=Bt(),_e=Bt(),gi=Bt(),H=Bt(),ve=Bt(),Mt=Bt(),Ze=Bt();function Bt(){return 2**++Mb}const xi=Object.freeze(Object.defineProperty({__proto__:null,boolean:de,booleanish:_e,commaOrSpaceSeparated:Ze,commaSeparated:Mt,number:H,overloadedBoolean:gi,spaceSeparated:ve},Symbol.toStringTag,{value:"Module"})),zr=Object.keys(xi);class Xi extends Ge{constructor(e,n,s,i){let o=-1;if(super(e,n),xa(this,"space",i),typeof s=="number")for(;++o<zr.length;){const a=zr[o];xa(this,zr[o],(s&xi[a])===xi[a])}}}Xi.prototype.defined=!0;function xa(t,e,n){n&&(t[e]=n)}function gn(t){const e={},n={};for(const[s,i]of Object.entries(t.properties)){const o=new Xi(s,t.transform(t.attributes||{},s),i,t.space);t.mustUseProperty&&t.mustUseProperty.includes(s)&&(o.mustUseProperty=!0),e[s]=o,n[pi(s)]=s,n[pi(o.attribute)]=s}return new us(e,n,t.space)}const hc=gn({properties:{ariaActiveDescendant:null,ariaAtomic:_e,ariaAutoComplete:null,ariaBusy:_e,ariaChecked:_e,ariaColCount:H,ariaColIndex:H,ariaColSpan:H,ariaControls:ve,ariaCurrent:null,ariaDescribedBy:ve,ariaDetails:null,ariaDisabled:_e,ariaDropEffect:ve,ariaErrorMessage:null,ariaExpanded:_e,ariaFlowTo:ve,ariaGrabbed:_e,ariaHasPopup:null,ariaHidden:_e,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:ve,ariaLevel:H,ariaLive:null,ariaModal:_e,ariaMultiLine:_e,ariaMultiSelectable:_e,ariaOrientation:null,ariaOwns:ve,ariaPlaceholder:null,ariaPosInSet:H,ariaPressed:_e,ariaReadOnly:_e,ariaRelevant:null,ariaRequired:_e,ariaRoleDescription:ve,ariaRowCount:H,ariaRowIndex:H,ariaRowSpan:H,ariaSelected:_e,ariaSetSize:H,ariaSort:null,ariaValueMax:H,ariaValueMin:H,ariaValueNow:H,ariaValueText:null,role:null},transform(t,e){return e==="role"?e:"aria-"+e.slice(4).toLowerCase()}});function fc(t,e){return e in t?t[e]:e}function mc(t,e){return fc(t,e.toLowerCase())}const Ob=gn({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:Mt,acceptCharset:ve,accessKey:ve,action:null,allow:null,allowFullScreen:de,allowPaymentRequest:de,allowUserMedia:de,alpha:de,alt:null,as:null,async:de,autoCapitalize:null,autoComplete:ve,autoFocus:de,autoPlay:de,blocking:ve,capture:null,charSet:null,checked:de,cite:null,className:ve,closedBy:null,colorSpace:null,cols:H,colSpan:H,command:null,commandFor:null,content:null,contentEditable:_e,controls:de,controlsList:ve,coords:H|Mt,crossOrigin:null,data:null,dateTime:null,decoding:null,default:de,defer:de,dir:null,dirName:null,disabled:de,download:gi,draggable:_e,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:de,formTarget:null,headers:ve,height:H,hidden:gi,high:H,href:null,hrefLang:null,htmlFor:ve,httpEquiv:ve,id:null,imageSizes:null,imageSrcSet:null,inert:de,inputMode:null,integrity:null,is:null,isMap:de,itemId:null,itemProp:ve,itemRef:ve,itemScope:de,itemType:ve,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:de,low:H,manifest:null,max:null,maxLength:H,media:null,method:null,min:null,minLength:H,multiple:de,muted:de,name:null,nonce:null,noModule:de,noValidate:de,onAbort:null,onAfterPrint:null,onAuxClick:null,onBeforeMatch:null,onBeforePrint:null,onBeforeToggle:null,onBeforeUnload:null,onBlur:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onContextLost:null,onContextMenu:null,onContextRestored:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnded:null,onError:null,onFocus:null,onFormData:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLanguageChange:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadEnd:null,onLoadStart:null,onMessage:null,onMessageError:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRejectionHandled:null,onReset:null,onResize:null,onScroll:null,onScrollEnd:null,onSecurityPolicyViolation:null,onSeeked:null,onSeeking:null,onSelect:null,onSlotChange:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnhandledRejection:null,onUnload:null,onVolumeChange:null,onWaiting:null,onWheel:null,open:de,optimum:H,pattern:null,ping:ve,placeholder:null,playsInline:de,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:de,referrerPolicy:null,rel:ve,required:de,reversed:de,rows:H,rowSpan:H,sandbox:ve,scope:null,scoped:de,seamless:de,selected:de,shadowRootClonable:de,shadowRootCustomElementRegistry:de,shadowRootDelegatesFocus:de,shadowRootMode:null,shadowRootSerializable:de,shape:null,size:H,sizes:null,slot:null,span:H,spellCheck:_e,src:null,srcDoc:null,srcLang:null,srcSet:null,start:H,step:null,style:null,tabIndex:H,target:null,title:null,translate:null,type:null,typeMustMatch:de,useMap:null,value:_e,width:H,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:ve,axis:null,background:null,bgColor:null,border:H,borderColor:null,bottomMargin:H,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:de,declare:de,event:null,face:null,frame:null,frameBorder:null,hSpace:H,leftMargin:H,link:null,longDesc:null,lowSrc:null,marginHeight:H,marginWidth:H,noResize:de,noHref:de,noShade:de,noWrap:de,object:null,profile:null,prompt:null,rev:null,rightMargin:H,rules:null,scheme:null,scrolling:_e,standby:null,summary:null,text:null,topMargin:H,valueType:null,version:null,vAlign:null,vLink:null,vSpace:H,allowTransparency:null,autoCorrect:null,autoSave:null,credentialless:de,disablePictureInPicture:de,disableRemotePlayback:de,exportParts:Mt,part:ve,prefix:null,property:null,results:H,security:null,unselectable:null},space:"html",transform:mc}),$b=gn({attributes:{accentHeight:"accent-height",alignmentBaseline:"alignment-baseline",arabicForm:"arabic-form",baselineShift:"baseline-shift",capHeight:"cap-height",className:"class",clipPath:"clip-path",clipRule:"clip-rule",colorInterpolation:"color-interpolation",colorInterpolationFilters:"color-interpolation-filters",colorProfile:"color-profile",colorRendering:"color-rendering",crossOrigin:"crossorigin",dataType:"datatype",dominantBaseline:"dominant-baseline",enableBackground:"enable-background",fillOpacity:"fill-opacity",fillRule:"fill-rule",floodColor:"flood-color",floodOpacity:"flood-opacity",fontFamily:"font-family",fontSize:"font-size",fontSizeAdjust:"font-size-adjust",fontStretch:"font-stretch",fontStyle:"font-style",fontVariant:"font-variant",fontWeight:"font-weight",glyphName:"glyph-name",glyphOrientationHorizontal:"glyph-orientation-horizontal",glyphOrientationVertical:"glyph-orientation-vertical",hrefLang:"hreflang",horizAdvX:"horiz-adv-x",horizOriginX:"horiz-origin-x",horizOriginY:"horiz-origin-y",imageRendering:"image-rendering",letterSpacing:"letter-spacing",lightingColor:"lighting-color",markerEnd:"marker-end",markerMid:"marker-mid",markerStart:"marker-start",maskType:"mask-type",navDown:"nav-down",navDownLeft:"nav-down-left",navDownRight:"nav-down-right",navLeft:"nav-left",navNext:"nav-next",navPrev:"nav-prev",navRight:"nav-right",navUp:"nav-up",navUpLeft:"nav-up-left",navUpRight:"nav-up-right",onAbort:"onabort",onActivate:"onactivate",onAfterPrint:"onafterprint",onBeforePrint:"onbeforeprint",onBegin:"onbegin",onCancel:"oncancel",onCanPlay:"oncanplay",onCanPlayThrough:"oncanplaythrough",onChange:"onchange",onClick:"onclick",onClose:"onclose",onCopy:"oncopy",onCueChange:"oncuechange",onCut:"oncut",onDblClick:"ondblclick",onDrag:"ondrag",onDragEnd:"ondragend",onDragEnter:"ondragenter",onDragExit:"ondragexit",onDragLeave:"ondragleave",onDragOver:"ondragover",onDragStart:"ondragstart",onDrop:"ondrop",onDurationChange:"ondurationchange",onEmptied:"onemptied",onEnd:"onend",onEnded:"onended",onError:"onerror",onFocus:"onfocus",onFocusIn:"onfocusin",onFocusOut:"onfocusout",onHashChange:"onhashchange",onInput:"oninput",onInvalid:"oninvalid",onKeyDown:"onkeydown",onKeyPress:"onkeypress",onKeyUp:"onkeyup",onLoad:"onload",onLoadedData:"onloadeddata",onLoadedMetadata:"onloadedmetadata",onLoadStart:"onloadstart",onMessage:"onmessage",onMouseDown:"onmousedown",onMouseEnter:"onmouseenter",onMouseLeave:"onmouseleave",onMouseMove:"onmousemove",onMouseOut:"onmouseout",onMouseOver:"onmouseover",onMouseUp:"onmouseup",onMouseWheel:"onmousewheel",onOffline:"onoffline",onOnline:"ononline",onPageHide:"onpagehide",onPageShow:"onpageshow",onPaste:"onpaste",onPause:"onpause",onPlay:"onplay",onPlaying:"onplaying",onPopState:"onpopstate",onProgress:"onprogress",onRateChange:"onratechange",onRepeat:"onrepeat",onReset:"onreset",onResize:"onresize",onScroll:"onscroll",onSeeked:"onseeked",onSeeking:"onseeking",onSelect:"onselect",onShow:"onshow",onStalled:"onstalled",onStorage:"onstorage",onSubmit:"onsubmit",onSuspend:"onsuspend",onTimeUpdate:"ontimeupdate",onToggle:"ontoggle",onUnload:"onunload",onVolumeChange:"onvolumechange",onWaiting:"onwaiting",onZoom:"onzoom",overlinePosition:"overline-position",overlineThickness:"overline-thickness",paintOrder:"paint-order",panose1:"panose-1",pointerEvents:"pointer-events",referrerPolicy:"referrerpolicy",renderingIntent:"rendering-intent",shapeRendering:"shape-rendering",stopColor:"stop-color",stopOpacity:"stop-opacity",strikethroughPosition:"strikethrough-position",strikethroughThickness:"strikethrough-thickness",strokeDashArray:"stroke-dasharray",strokeDashOffset:"stroke-dashoffset",strokeLineCap:"stroke-linecap",strokeLineJoin:"stroke-linejoin",strokeMiterLimit:"stroke-miterlimit",strokeOpacity:"stroke-opacity",strokeWidth:"stroke-width",tabIndex:"tabindex",textAnchor:"text-anchor",textDecoration:"text-decoration",textRendering:"text-rendering",transformOrigin:"transform-origin",typeOf:"typeof",underlinePosition:"underline-position",underlineThickness:"underline-thickness",unicodeBidi:"unicode-bidi",unicodeRange:"unicode-range",unitsPerEm:"units-per-em",vAlphabetic:"v-alphabetic",vHanging:"v-hanging",vIdeographic:"v-ideographic",vMathematical:"v-mathematical",vectorEffect:"vector-effect",vertAdvY:"vert-adv-y",vertOriginX:"vert-origin-x",vertOriginY:"vert-origin-y",wordSpacing:"word-spacing",writingMode:"writing-mode",xHeight:"x-height",playbackOrder:"playbackorder",timelineBegin:"timelinebegin"},properties:{about:Ze,accentHeight:H,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:H,amplitude:H,arabicForm:null,ascent:H,attributeName:null,attributeType:null,azimuth:H,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:H,by:null,calcMode:null,capHeight:H,className:ve,clip:null,clipPath:null,clipPathUnits:null,clipRule:null,color:null,colorInterpolation:null,colorInterpolationFilters:null,colorProfile:null,colorRendering:null,content:null,contentScriptType:null,contentStyleType:null,crossOrigin:null,cursor:null,cx:null,cy:null,d:null,dataType:null,defaultAction:null,descent:H,diffuseConstant:H,direction:null,display:null,dur:null,divisor:H,dominantBaseline:null,download:de,dx:null,dy:null,edgeMode:null,editable:null,elevation:H,enableBackground:null,end:null,event:null,exponent:H,externalResourcesRequired:null,fill:null,fillOpacity:H,fillRule:null,filter:null,filterRes:null,filterUnits:null,floodColor:null,floodOpacity:null,focusable:null,focusHighlight:null,fontFamily:null,fontSize:null,fontSizeAdjust:null,fontStretch:null,fontStyle:null,fontVariant:null,fontWeight:null,format:null,fr:null,from:null,fx:null,fy:null,g1:Mt,g2:Mt,glyphName:Mt,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:H,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:H,horizOriginX:H,horizOriginY:H,id:null,ideographic:H,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:H,k:H,k1:H,k2:H,k3:H,k4:H,kernelMatrix:Ze,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:H,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskType:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:H,mediaTime:null,method:null,min:null,mode:null,name:null,navDown:null,navDownLeft:null,navDownRight:null,navLeft:null,navNext:null,navPrev:null,navRight:null,navUp:null,navUpLeft:null,navUpRight:null,numOctaves:null,observer:null,offset:null,onAbort:null,onActivate:null,onAfterPrint:null,onBeforePrint:null,onBegin:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnd:null,onEnded:null,onError:null,onFocus:null,onFocusIn:null,onFocusOut:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadStart:null,onMessage:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onMouseWheel:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRepeat:null,onReset:null,onResize:null,onScroll:null,onSeeked:null,onSeeking:null,onSelect:null,onShow:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnload:null,onVolumeChange:null,onWaiting:null,onZoom:null,opacity:null,operator:null,order:null,orient:null,orientation:null,origin:null,overflow:null,overlay:null,overlinePosition:H,overlineThickness:H,paintOrder:null,panose1:null,path:null,pathLength:H,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:ve,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:H,pointsAtY:H,pointsAtZ:H,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:Ze,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:Ze,rev:Ze,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:Ze,requiredFeatures:Ze,requiredFonts:Ze,requiredFormats:Ze,resource:null,restart:null,result:null,rotate:null,rx:null,ry:null,scale:null,seed:null,shapeRendering:null,side:null,slope:null,snapshotTime:null,specularConstant:H,specularExponent:H,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:H,strikethroughThickness:H,string:null,stroke:null,strokeDashArray:Ze,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:H,strokeOpacity:H,strokeWidth:null,style:null,surfaceScale:H,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:Ze,tabIndex:H,tableValues:null,target:null,targetX:H,targetY:H,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:Ze,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:H,underlineThickness:H,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:H,values:null,vAlphabetic:H,vMathematical:H,vectorEffect:null,vHanging:H,vIdeographic:H,version:null,vertAdvY:H,vertOriginX:H,vertOriginY:H,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:H,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:fc}),pc=gn({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:"xlink",transform(t,e){return"xlink:"+e.slice(5).toLowerCase()}}),gc=gn({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:mc}),xc=gn({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(t,e){return"xml:"+e.slice(3).toLowerCase()}}),Fb={classId:"classID",dataType:"datatype",itemId:"itemID",strokeDashArray:"strokeDasharray",strokeDashOffset:"strokeDashoffset",strokeLineCap:"strokeLinecap",strokeLineJoin:"strokeLinejoin",strokeMiterLimit:"strokeMiterlimit",typeOf:"typeof",xLinkActuate:"xlinkActuate",xLinkArcRole:"xlinkArcrole",xLinkHref:"xlinkHref",xLinkRole:"xlinkRole",xLinkShow:"xlinkShow",xLinkTitle:"xlinkTitle",xLinkType:"xlinkType",xmlnsXLink:"xmlnsXlink"},Bb=/[A-Z]/g,ba=/-[a-z]/g,Vb=/^data[-\w.:]+$/i;function Ub(t,e){const n=pi(e);let s=e,i=Ge;if(n in t.normal)return t.property[t.normal[n]];if(n.length>4&&n.slice(0,4)==="data"&&Vb.test(e)){if(e.charAt(4)==="-"){const o=e.slice(5).replace(ba,qb);s="data"+o.charAt(0).toUpperCase()+o.slice(1)}else{const o=e.slice(4);if(!ba.test(o)){let a=o.replace(Bb,Hb);a.charAt(0)!=="-"&&(a="-"+a),e="data"+a}}i=Xi}return new i(s,e)}function Hb(t){return"-"+t.toLowerCase()}function qb(t){return t.charAt(1).toUpperCase()}const Wb=uc([hc,Ob,pc,gc,xc],"html"),eo=uc([hc,$b,pc,gc,xc],"svg");function Gb(t){return t.join(" ").trim()}var Xt={},Lr,ya;function Qb(){if(ya)return Lr;ya=1;var t=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,e=/\n/g,n=/^\s*/,s=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,i=/^:\s*/,o=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,a=/^[;\s]*/,l=/^\s+|\s+$/g,c=`
|
|
40
|
+
`,d="/",h="*",m="",p="comment",u="declaration";function g(w,v){if(typeof w!="string")throw new TypeError("First argument must be a string");if(!w)return[];v=v||{};var S=1,b=1;function C(D){var I=D.match(e);I&&(S+=I.length);var $=D.lastIndexOf(c);b=~$?D.length-$:b+D.length}function N(){var D={line:S,column:b};return function(I){return I.position=new y(D),_(),I}}function y(D){this.start=D,this.end={line:S,column:b},this.source=v.source}y.prototype.content=w;function P(D){var I=new Error(v.source+":"+S+":"+b+": "+D);if(I.reason=D,I.filename=v.source,I.line=S,I.column=b,I.source=w,!v.silent)throw I}function L(D){var I=D.exec(w);if(I){var $=I[0];return C($),w=w.slice($.length),I}}function _(){L(n)}function O(D){var I;for(D=D||[];I=T();)I!==!1&&D.push(I);return D}function T(){var D=N();if(!(d!=w.charAt(0)||h!=w.charAt(1))){for(var I=2;m!=w.charAt(I)&&(h!=w.charAt(I)||d!=w.charAt(I+1));)++I;if(I+=2,m===w.charAt(I-1))return P("End of comment missing");var $=w.slice(2,I-2);return b+=2,C($),w=w.slice(I),b+=2,D({type:p,comment:$})}}function A(){var D=N(),I=L(s);if(I){if(T(),!L(i))return P("property missing ':'");var $=L(o),U=D({type:u,property:x(I[0].replace(t,m)),value:$?x($[0].replace(t,m)):m});return L(a),U}}function R(){var D=[];O(D);for(var I;I=A();)I!==!1&&(D.push(I),O(D));return D}return _(),R()}function x(w){return w?w.replace(l,m):m}return Lr=g,Lr}var wa;function Jb(){if(wa)return Xt;wa=1;var t=Xt&&Xt.__importDefault||function(s){return s&&s.__esModule?s:{default:s}};Object.defineProperty(Xt,"__esModule",{value:!0}),Xt.default=n;const e=t(Qb());function n(s,i){let o=null;if(!s||typeof s!="string")return o;const a=(0,e.default)(s),l=typeof i=="function";return a.forEach(c=>{if(c.type!=="declaration")return;const{property:d,value:h}=c;l?i(d,h,c):h&&(o=o||{},o[d]=h)}),o}return Xt}var Jn={},va;function Kb(){if(va)return Jn;va=1,Object.defineProperty(Jn,"__esModule",{value:!0}),Jn.camelCase=void 0;var t=/^--[a-zA-Z0-9_-]+$/,e=/-([a-z])/g,n=/^[^-]+$/,s=/^-(webkit|moz|ms|o|khtml)-/,i=/^-(ms)-/,o=function(d){return!d||n.test(d)||t.test(d)},a=function(d,h){return h.toUpperCase()},l=function(d,h){return"".concat(h,"-")},c=function(d,h){return h===void 0&&(h={}),o(d)?d:(d=d.toLowerCase(),h.reactCompat?d=d.replace(i,l):d=d.replace(s,l),d.replace(e,a))};return Jn.camelCase=c,Jn}var Kn,Sa;function Zb(){if(Sa)return Kn;Sa=1;var t=Kn&&Kn.__importDefault||function(i){return i&&i.__esModule?i:{default:i}},e=t(Jb()),n=Kb();function s(i,o){var a={};return!i||typeof i!="string"||(0,e.default)(i,function(l,c){l&&c&&(a[(0,n.camelCase)(l,o)]=c)}),a}return s.default=s,Kn=s,Kn}var Yb=Zb();const Xb=wl(Yb),bc=yc("end"),to=yc("start");function yc(t){return e;function e(n){const s=n&&n.position&&n.position[t]||{};if(typeof s.line=="number"&&s.line>0&&typeof s.column=="number"&&s.column>0)return{line:s.line,column:s.column,offset:typeof s.offset=="number"&&s.offset>-1?s.offset:void 0}}}function e0(t){const e=to(t),n=bc(t);if(e&&n)return{start:e,end:n}}function ss(t){return!t||typeof t!="object"?"":"position"in t||"type"in t?ja(t.position):"start"in t||"end"in t?ja(t):"line"in t||"column"in t?bi(t):""}function bi(t){return ka(t&&t.line)+":"+ka(t&&t.column)}function ja(t){return bi(t&&t.start)+"-"+bi(t&&t.end)}function ka(t){return t&&typeof t=="number"?t:1}class Be extends Error{constructor(e,n,s){super(),typeof n=="string"&&(s=n,n=void 0);let i="",o={},a=!1;if(n&&("line"in n&&"column"in n?o={place:n}:"start"in n&&"end"in n?o={place:n}:"type"in n?o={ancestors:[n],place:n.position}:o={...n}),typeof e=="string"?i=e:!o.cause&&e&&(a=!0,i=e.message,o.cause=e),!o.ruleId&&!o.source&&typeof s=="string"){const c=s.indexOf(":");c===-1?o.ruleId=s:(o.source=s.slice(0,c),o.ruleId=s.slice(c+1))}if(!o.place&&o.ancestors&&o.ancestors){const c=o.ancestors[o.ancestors.length-1];c&&(o.place=c.position)}const l=o.place&&"start"in o.place?o.place.start:o.place;this.ancestors=o.ancestors||void 0,this.cause=o.cause||void 0,this.column=l?l.column:void 0,this.fatal=void 0,this.file="",this.message=i,this.line=l?l.line:void 0,this.name=ss(o.place)||"1:1",this.place=o.place||void 0,this.reason=this.message,this.ruleId=o.ruleId||void 0,this.source=o.source||void 0,this.stack=a&&o.cause&&typeof o.cause.stack=="string"?o.cause.stack:"",this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}}Be.prototype.file="";Be.prototype.name="";Be.prototype.reason="";Be.prototype.message="";Be.prototype.stack="";Be.prototype.column=void 0;Be.prototype.line=void 0;Be.prototype.ancestors=void 0;Be.prototype.cause=void 0;Be.prototype.fatal=void 0;Be.prototype.place=void 0;Be.prototype.ruleId=void 0;Be.prototype.source=void 0;const no={}.hasOwnProperty,t0=new Map,n0=/[A-Z]/g,s0=new Set(["table","tbody","thead","tfoot","tr"]),r0=new Set(["td","th"]),wc="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function i0(t,e){if(!e||e.Fragment===void 0)throw new TypeError("Expected `Fragment` in options");const n=e.filePath||void 0;let s;if(e.development){if(typeof e.jsxDEV!="function")throw new TypeError("Expected `jsxDEV` in options when `development: true`");s=f0(n,e.jsxDEV)}else{if(typeof e.jsx!="function")throw new TypeError("Expected `jsx` in production options");if(typeof e.jsxs!="function")throw new TypeError("Expected `jsxs` in production options");s=h0(n,e.jsx,e.jsxs)}const i={Fragment:e.Fragment,ancestors:[],components:e.components||{},create:s,elementAttributeNameCase:e.elementAttributeNameCase||"react",evaluater:e.createEvaluater?e.createEvaluater():void 0,filePath:n,ignoreInvalidStyle:e.ignoreInvalidStyle||!1,passKeys:e.passKeys!==!1,passNode:e.passNode||!1,schema:e.space==="svg"?eo:Wb,stylePropertyNameCase:e.stylePropertyNameCase||"dom",tableCellAlignToStyle:e.tableCellAlignToStyle!==!1},o=vc(i,t,void 0);return o&&typeof o!="string"?o:i.create(t,i.Fragment,{children:o||void 0},void 0)}function vc(t,e,n){if(e.type==="element")return o0(t,e,n);if(e.type==="mdxFlowExpression"||e.type==="mdxTextExpression")return a0(t,e);if(e.type==="mdxJsxFlowElement"||e.type==="mdxJsxTextElement")return c0(t,e,n);if(e.type==="mdxjsEsm")return l0(t,e);if(e.type==="root")return d0(t,e,n);if(e.type==="text")return u0(t,e)}function o0(t,e,n){const s=t.schema;let i=s;e.tagName.toLowerCase()==="svg"&&s.space==="html"&&(i=eo,t.schema=i),t.ancestors.push(e);const o=jc(t,e.tagName,!1),a=m0(t,e);let l=ro(t,e);return s0.has(e.tagName)&&(l=l.filter(function(c){return typeof c=="string"?!Db(c):!0})),Sc(t,a,o,e),so(a,l),t.ancestors.pop(),t.schema=s,t.create(e,o,a,n)}function a0(t,e){if(e.data&&e.data.estree&&t.evaluater){const s=e.data.estree.body[0];return s.type,t.evaluater.evaluateExpression(s.expression)}ls(t,e.position)}function l0(t,e){if(e.data&&e.data.estree&&t.evaluater)return t.evaluater.evaluateProgram(e.data.estree);ls(t,e.position)}function c0(t,e,n){const s=t.schema;let i=s;e.name==="svg"&&s.space==="html"&&(i=eo,t.schema=i),t.ancestors.push(e);const o=e.name===null?t.Fragment:jc(t,e.name,!0),a=p0(t,e),l=ro(t,e);return Sc(t,a,o,e),so(a,l),t.ancestors.pop(),t.schema=s,t.create(e,o,a,n)}function d0(t,e,n){const s={};return so(s,ro(t,e)),t.create(e,t.Fragment,s,n)}function u0(t,e){return e.value}function Sc(t,e,n,s){typeof n!="string"&&n!==t.Fragment&&t.passNode&&(e.node=s)}function so(t,e){if(e.length>0){const n=e.length>1?e:e[0];n&&(t.children=n)}}function h0(t,e,n){return s;function s(i,o,a,l){const d=Array.isArray(a.children)?n:e;return l?d(o,a,l):d(o,a)}}function f0(t,e){return n;function n(s,i,o,a){const l=Array.isArray(o.children),c=to(s);return e(i,o,a,l,{columnNumber:c?c.column-1:void 0,fileName:t,lineNumber:c?c.line:void 0},void 0)}}function m0(t,e){const n={};let s,i;for(i in e.properties)if(i!=="children"&&no.call(e.properties,i)){const o=g0(t,i,e.properties[i]);if(o){const[a,l]=o;t.tableCellAlignToStyle&&a==="align"&&typeof l=="string"&&r0.has(e.tagName)?s=l:n[a]=l}}if(s){const o=n.style||(n.style={});o[t.stylePropertyNameCase==="css"?"text-align":"textAlign"]=s}return n}function p0(t,e){const n={};for(const s of e.attributes)if(s.type==="mdxJsxExpressionAttribute")if(s.data&&s.data.estree&&t.evaluater){const o=s.data.estree.body[0];o.type;const a=o.expression;a.type;const l=a.properties[0];l.type,Object.assign(n,t.evaluater.evaluateExpression(l.argument))}else ls(t,e.position);else{const i=s.name;let o;if(s.value&&typeof s.value=="object")if(s.value.data&&s.value.data.estree&&t.evaluater){const l=s.value.data.estree.body[0];l.type,o=t.evaluater.evaluateExpression(l.expression)}else ls(t,e.position);else o=s.value===null?!0:s.value;n[i]=o}return n}function ro(t,e){const n=[];let s=-1;const i=t.passKeys?new Map:t0;for(;++s<e.children.length;){const o=e.children[s];let a;if(t.passKeys){const c=o.type==="element"?o.tagName:o.type==="mdxJsxFlowElement"||o.type==="mdxJsxTextElement"?o.name:void 0;if(c){const d=i.get(c)||0;a=c+"-"+d,i.set(c,d+1)}}const l=vc(t,o,a);l!==void 0&&n.push(l)}return n}function g0(t,e,n){const s=Ub(t.schema,e);if(!(n==null||typeof n=="number"&&Number.isNaN(n))){if(Array.isArray(n)&&(n=s.commaSeparated?Ab(n):Gb(n)),s.property==="style"){let i=typeof n=="object"?n:x0(t,String(n));return t.stylePropertyNameCase==="css"&&(i=b0(i)),["style",i]}return[t.elementAttributeNameCase==="react"&&s.space?Fb[s.property]||s.property:s.attribute,n]}}function x0(t,e){try{return Xb(e,{reactCompat:!0})}catch(n){if(t.ignoreInvalidStyle)return{};const s=n,i=new Be("Cannot parse `style` attribute",{ancestors:t.ancestors,cause:s,ruleId:"style",source:"hast-util-to-jsx-runtime"});throw i.file=t.filePath||void 0,i.url=wc+"#cannot-parse-style-attribute",i}}function jc(t,e,n){let s;if(!n)s={type:"Literal",value:e};else if(e.includes(".")){const i=e.split(".");let o=-1,a;for(;++o<i.length;){const l=pa(i[o])?{type:"Identifier",name:i[o]}:{type:"Literal",value:i[o]};a=a?{type:"MemberExpression",object:a,property:l,computed:!!(o&&l.type==="Literal"),optional:!1}:l}s=a}else s=pa(e)&&!/^[a-z]/.test(e)?{type:"Identifier",name:e}:{type:"Literal",value:e};if(s.type==="Literal"){const i=s.value;return no.call(t.components,i)?t.components[i]:i}if(t.evaluater)return t.evaluater.evaluateExpression(s);ls(t)}function ls(t,e){const n=new Be("Cannot handle MDX estrees without `createEvaluater`",{ancestors:t.ancestors,place:e,ruleId:"mdx-estree",source:"hast-util-to-jsx-runtime"});throw n.file=t.filePath||void 0,n.url=wc+"#cannot-handle-mdx-estrees-without-createevaluater",n}function b0(t){const e={};let n;for(n in t)no.call(t,n)&&(e[y0(n)]=t[n]);return e}function y0(t){let e=t.replace(n0,w0);return e.slice(0,3)==="ms-"&&(e="-"+e),e}function w0(t){return"-"+t.toLowerCase()}const Rr={action:["form"],cite:["blockquote","del","ins","q"],data:["object"],formAction:["button","input"],href:["a","area","base","link"],icon:["menuitem"],itemId:null,manifest:["html"],ping:["a","area"],poster:["video"],src:["audio","embed","iframe","img","input","script","source","track","video"]},v0={};function S0(t,e){const n=v0,s=typeof n.includeImageAlt=="boolean"?n.includeImageAlt:!0,i=typeof n.includeHtml=="boolean"?n.includeHtml:!0;return kc(t,s,i)}function kc(t,e,n){if(j0(t)){if("value"in t)return t.type==="html"&&!n?"":t.value;if(e&&"alt"in t&&t.alt)return t.alt;if("children"in t)return Ca(t.children,e,n)}return Array.isArray(t)?Ca(t,e,n):""}function Ca(t,e,n){const s=[];let i=-1;for(;++i<t.length;)s[i]=kc(t[i],e,n);return s.join("")}function j0(t){return!!(t&&typeof t=="object")}const Na=document.createElement("i");function io(t){const e="&"+t+";";Na.innerHTML=e;const n=Na.textContent;return n.charCodeAt(n.length-1)===59&&t!=="semi"||n===e?!1:n}function pt(t,e,n,s){const i=t.length;let o=0,a;if(e<0?e=-e>i?0:i+e:e=e>i?i:e,n=n>0?n:0,s.length<1e4)a=Array.from(s),a.unshift(e,n),t.splice(...a);else for(n&&t.splice(e,n);o<s.length;)a=s.slice(o,o+1e4),a.unshift(e,0),t.splice(...a),o+=1e4,e+=1e4}function nt(t,e){return t.length>0?(pt(t,t.length,0,e),t):e}const Ea={}.hasOwnProperty;function k0(t){const e={};let n=-1;for(;++n<t.length;)C0(e,t[n]);return e}function C0(t,e){let n;for(n in e){const i=(Ea.call(t,n)?t[n]:void 0)||(t[n]={}),o=e[n];let a;if(o)for(a in o){Ea.call(i,a)||(i[a]=[]);const l=o[a];N0(i[a],Array.isArray(l)?l:l?[l]:[])}}}function N0(t,e){let n=-1;const s=[];for(;++n<e.length;)(e[n].add==="after"?t:s).push(e[n]);pt(t,0,0,s)}function Cc(t,e){const n=Number.parseInt(t,e);return n<9||n===11||n>13&&n<32||n>126&&n<160||n>55295&&n<57344||n>64975&&n<65008||(n&65535)===65535||(n&65535)===65534||n>1114111?"�":String.fromCodePoint(n)}function cn(t){return t.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const mt=It(/[A-Za-z]/),Xe=It(/[\dA-Za-z]/),E0=It(/[#-'*+\--9=?A-Z^-~]/);function yi(t){return t!==null&&(t<32||t===127)}const wi=It(/\d/),P0=It(/[\dA-Fa-f]/),T0=It(/[!-/:-@[-`{-~]/);function ae(t){return t!==null&&t<-2}function We(t){return t!==null&&(t<0||t===32)}function we(t){return t===-2||t===-1||t===32}const I0=It(/\p{P}|\p{S}/u),A0=It(/\s/);function It(t){return e;function e(n){return n!==null&&n>-1&&t.test(String.fromCharCode(n))}}function xn(t){const e=[];let n=-1,s=0,i=0;for(;++n<t.length;){const o=t.charCodeAt(n);let a="";if(o===37&&Xe(t.charCodeAt(n+1))&&Xe(t.charCodeAt(n+2)))i=2;else if(o<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(o))||(a=String.fromCharCode(o));else if(o>55295&&o<57344){const l=t.charCodeAt(n+1);o<56320&&l>56319&&l<57344?(a=String.fromCharCode(o,l),i=1):a="�"}else a=String.fromCharCode(o);a&&(e.push(t.slice(s,n),encodeURIComponent(a)),s=n+i+1,a=""),i&&(n+=i,i=0)}return e.join("")+t.slice(s)}function Se(t,e,n,s){const i=s?s-1:Number.POSITIVE_INFINITY;let o=0;return a;function a(c){return we(c)?(t.enter(n),l(c)):e(c)}function l(c){return we(c)&&o++<i?(t.consume(c),l):(t.exit(n),e(c))}}const z0={tokenize:L0};function L0(t){const e=t.attempt(this.parser.constructs.contentInitial,s,i);let n;return e;function s(l){if(l===null){t.consume(l);return}return t.enter("lineEnding"),t.consume(l),t.exit("lineEnding"),Se(t,e,"linePrefix")}function i(l){return t.enter("paragraph"),o(l)}function o(l){const c=t.enter("chunkText",{contentType:"text",previous:n});return n&&(n.next=c),n=c,a(l)}function a(l){if(l===null){t.exit("chunkText"),t.exit("paragraph"),t.consume(l);return}return ae(l)?(t.consume(l),t.exit("chunkText"),o):(t.consume(l),a)}}const R0={tokenize:_0},Pa={tokenize:D0};function _0(t){const e=this,n=[];let s=0,i,o,a;return l;function l(b){if(s<n.length){const C=n[s];return e.containerState=C[1],t.attempt(C[0].continuation,c,d)(b)}return d(b)}function c(b){if(s++,e.containerState._closeFlow){e.containerState._closeFlow=void 0,i&&S();const C=e.events.length;let N=C,y;for(;N--;)if(e.events[N][0]==="exit"&&e.events[N][1].type==="chunkFlow"){y=e.events[N][1].end;break}v(s);let P=C;for(;P<e.events.length;)e.events[P][1].end={...y},P++;return pt(e.events,N+1,0,e.events.slice(C)),e.events.length=P,d(b)}return l(b)}function d(b){if(s===n.length){if(!i)return p(b);if(i.currentConstruct&&i.currentConstruct.concrete)return g(b);e.interrupt=!!(i.currentConstruct&&!i._gfmTableDynamicInterruptHack)}return e.containerState={},t.check(Pa,h,m)(b)}function h(b){return i&&S(),v(s),p(b)}function m(b){return e.parser.lazy[e.now().line]=s!==n.length,a=e.now().offset,g(b)}function p(b){return e.containerState={},t.attempt(Pa,u,g)(b)}function u(b){return s++,n.push([e.currentConstruct,e.containerState]),p(b)}function g(b){if(b===null){i&&S(),v(0),t.consume(b);return}return i=i||e.parser.flow(e.now()),t.enter("chunkFlow",{_tokenizer:i,contentType:"flow",previous:o}),x(b)}function x(b){if(b===null){w(t.exit("chunkFlow"),!0),v(0),t.consume(b);return}return ae(b)?(t.consume(b),w(t.exit("chunkFlow")),s=0,e.interrupt=void 0,l):(t.consume(b),x)}function w(b,C){const N=e.sliceStream(b);if(C&&N.push(null),b.previous=o,o&&(o.next=b),o=b,i.defineSkip(b.start),i.write(N),e.parser.lazy[b.start.line]){let y=i.events.length;for(;y--;)if(i.events[y][1].start.offset<a&&(!i.events[y][1].end||i.events[y][1].end.offset>a))return;const P=e.events.length;let L=P,_,O;for(;L--;)if(e.events[L][0]==="exit"&&e.events[L][1].type==="chunkFlow"){if(_){O=e.events[L][1].end;break}_=!0}for(v(s),y=P;y<e.events.length;)e.events[y][1].end={...O},y++;pt(e.events,L+1,0,e.events.slice(P)),e.events.length=y}}function v(b){let C=n.length;for(;C-- >b;){const N=n[C];e.containerState=N[1],N[0].exit.call(e,t)}n.length=b}function S(){i.write([null]),o=void 0,i=void 0,e.containerState._closeFlow=void 0}}function D0(t,e,n){return Se(t,t.attempt(this.parser.constructs.document,e,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function Ta(t){if(t===null||We(t)||A0(t))return 1;if(I0(t))return 2}function oo(t,e,n){const s=[];let i=-1;for(;++i<t.length;){const o=t[i].resolveAll;o&&!s.includes(o)&&(e=o(e,n),s.push(o))}return e}const vi={name:"attention",resolveAll:M0,tokenize:O0};function M0(t,e){let n=-1,s,i,o,a,l,c,d,h;for(;++n<t.length;)if(t[n][0]==="enter"&&t[n][1].type==="attentionSequence"&&t[n][1]._close){for(s=n;s--;)if(t[s][0]==="exit"&&t[s][1].type==="attentionSequence"&&t[s][1]._open&&e.sliceSerialize(t[s][1]).charCodeAt(0)===e.sliceSerialize(t[n][1]).charCodeAt(0)){if((t[s][1]._close||t[n][1]._open)&&(t[n][1].end.offset-t[n][1].start.offset)%3&&!((t[s][1].end.offset-t[s][1].start.offset+t[n][1].end.offset-t[n][1].start.offset)%3))continue;c=t[s][1].end.offset-t[s][1].start.offset>1&&t[n][1].end.offset-t[n][1].start.offset>1?2:1;const m={...t[s][1].end},p={...t[n][1].start};Ia(m,-c),Ia(p,c),a={type:c>1?"strongSequence":"emphasisSequence",start:m,end:{...t[s][1].end}},l={type:c>1?"strongSequence":"emphasisSequence",start:{...t[n][1].start},end:p},o={type:c>1?"strongText":"emphasisText",start:{...t[s][1].end},end:{...t[n][1].start}},i={type:c>1?"strong":"emphasis",start:{...a.start},end:{...l.end}},t[s][1].end={...a.start},t[n][1].start={...l.end},d=[],t[s][1].end.offset-t[s][1].start.offset&&(d=nt(d,[["enter",t[s][1],e],["exit",t[s][1],e]])),d=nt(d,[["enter",i,e],["enter",a,e],["exit",a,e],["enter",o,e]]),d=nt(d,oo(e.parser.constructs.insideSpan.null,t.slice(s+1,n),e)),d=nt(d,[["exit",o,e],["enter",l,e],["exit",l,e],["exit",i,e]]),t[n][1].end.offset-t[n][1].start.offset?(h=2,d=nt(d,[["enter",t[n][1],e],["exit",t[n][1],e]])):h=0,pt(t,s-1,n-s+3,d),n=s+d.length-h-2;break}}for(n=-1;++n<t.length;)t[n][1].type==="attentionSequence"&&(t[n][1].type="data");return t}function O0(t,e){const n=this.parser.constructs.attentionMarkers.null,s=this.previous,i=Ta(s);let o;return a;function a(c){return o=c,t.enter("attentionSequence"),l(c)}function l(c){if(c===o)return t.consume(c),l;const d=t.exit("attentionSequence"),h=Ta(c),m=!h||h===2&&i||n.includes(c),p=!i||i===2&&h||n.includes(s);return d._open=!!(o===42?m:m&&(i||!p)),d._close=!!(o===42?p:p&&(h||!m)),e(c)}}function Ia(t,e){t.column+=e,t.offset+=e,t._bufferIndex+=e}const $0={name:"autolink",tokenize:F0};function F0(t,e,n){let s=0;return i;function i(u){return t.enter("autolink"),t.enter("autolinkMarker"),t.consume(u),t.exit("autolinkMarker"),t.enter("autolinkProtocol"),o}function o(u){return mt(u)?(t.consume(u),a):u===64?n(u):d(u)}function a(u){return u===43||u===45||u===46||Xe(u)?(s=1,l(u)):d(u)}function l(u){return u===58?(t.consume(u),s=0,c):(u===43||u===45||u===46||Xe(u))&&s++<32?(t.consume(u),l):(s=0,d(u))}function c(u){return u===62?(t.exit("autolinkProtocol"),t.enter("autolinkMarker"),t.consume(u),t.exit("autolinkMarker"),t.exit("autolink"),e):u===null||u===32||u===60||yi(u)?n(u):(t.consume(u),c)}function d(u){return u===64?(t.consume(u),h):E0(u)?(t.consume(u),d):n(u)}function h(u){return Xe(u)?m(u):n(u)}function m(u){return u===46?(t.consume(u),s=0,h):u===62?(t.exit("autolinkProtocol").type="autolinkEmail",t.enter("autolinkMarker"),t.consume(u),t.exit("autolinkMarker"),t.exit("autolink"),e):p(u)}function p(u){if((u===45||Xe(u))&&s++<63){const g=u===45?p:m;return t.consume(u),g}return n(u)}}const ur={partial:!0,tokenize:B0};function B0(t,e,n){return s;function s(o){return we(o)?Se(t,i,"linePrefix")(o):i(o)}function i(o){return o===null||ae(o)?e(o):n(o)}}const Nc={continuation:{tokenize:U0},exit:H0,name:"blockQuote",tokenize:V0};function V0(t,e,n){const s=this;return i;function i(a){if(a===62){const l=s.containerState;return l.open||(t.enter("blockQuote",{_container:!0}),l.open=!0),t.enter("blockQuotePrefix"),t.enter("blockQuoteMarker"),t.consume(a),t.exit("blockQuoteMarker"),o}return n(a)}function o(a){return we(a)?(t.enter("blockQuotePrefixWhitespace"),t.consume(a),t.exit("blockQuotePrefixWhitespace"),t.exit("blockQuotePrefix"),e):(t.exit("blockQuotePrefix"),e(a))}}function U0(t,e,n){const s=this;return i;function i(a){return we(a)?Se(t,o,"linePrefix",s.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(a):o(a)}function o(a){return t.attempt(Nc,e,n)(a)}}function H0(t){t.exit("blockQuote")}const Ec={name:"characterEscape",tokenize:q0};function q0(t,e,n){return s;function s(o){return t.enter("characterEscape"),t.enter("escapeMarker"),t.consume(o),t.exit("escapeMarker"),i}function i(o){return T0(o)?(t.enter("characterEscapeValue"),t.consume(o),t.exit("characterEscapeValue"),t.exit("characterEscape"),e):n(o)}}const Pc={name:"characterReference",tokenize:W0};function W0(t,e,n){const s=this;let i=0,o,a;return l;function l(m){return t.enter("characterReference"),t.enter("characterReferenceMarker"),t.consume(m),t.exit("characterReferenceMarker"),c}function c(m){return m===35?(t.enter("characterReferenceMarkerNumeric"),t.consume(m),t.exit("characterReferenceMarkerNumeric"),d):(t.enter("characterReferenceValue"),o=31,a=Xe,h(m))}function d(m){return m===88||m===120?(t.enter("characterReferenceMarkerHexadecimal"),t.consume(m),t.exit("characterReferenceMarkerHexadecimal"),t.enter("characterReferenceValue"),o=6,a=P0,h):(t.enter("characterReferenceValue"),o=7,a=wi,h(m))}function h(m){if(m===59&&i){const p=t.exit("characterReferenceValue");return a===Xe&&!io(s.sliceSerialize(p))?n(m):(t.enter("characterReferenceMarker"),t.consume(m),t.exit("characterReferenceMarker"),t.exit("characterReference"),e)}return a(m)&&i++<o?(t.consume(m),h):n(m)}}const Aa={partial:!0,tokenize:Q0},za={concrete:!0,name:"codeFenced",tokenize:G0};function G0(t,e,n){const s=this,i={partial:!0,tokenize:N};let o=0,a=0,l;return c;function c(y){return d(y)}function d(y){const P=s.events[s.events.length-1];return o=P&&P[1].type==="linePrefix"?P[2].sliceSerialize(P[1],!0).length:0,l=y,t.enter("codeFenced"),t.enter("codeFencedFence"),t.enter("codeFencedFenceSequence"),h(y)}function h(y){return y===l?(a++,t.consume(y),h):a<3?n(y):(t.exit("codeFencedFenceSequence"),we(y)?Se(t,m,"whitespace")(y):m(y))}function m(y){return y===null||ae(y)?(t.exit("codeFencedFence"),s.interrupt?e(y):t.check(Aa,x,C)(y)):(t.enter("codeFencedFenceInfo"),t.enter("chunkString",{contentType:"string"}),p(y))}function p(y){return y===null||ae(y)?(t.exit("chunkString"),t.exit("codeFencedFenceInfo"),m(y)):we(y)?(t.exit("chunkString"),t.exit("codeFencedFenceInfo"),Se(t,u,"whitespace")(y)):y===96&&y===l?n(y):(t.consume(y),p)}function u(y){return y===null||ae(y)?m(y):(t.enter("codeFencedFenceMeta"),t.enter("chunkString",{contentType:"string"}),g(y))}function g(y){return y===null||ae(y)?(t.exit("chunkString"),t.exit("codeFencedFenceMeta"),m(y)):y===96&&y===l?n(y):(t.consume(y),g)}function x(y){return t.attempt(i,C,w)(y)}function w(y){return t.enter("lineEnding"),t.consume(y),t.exit("lineEnding"),v}function v(y){return o>0&&we(y)?Se(t,S,"linePrefix",o+1)(y):S(y)}function S(y){return y===null||ae(y)?t.check(Aa,x,C)(y):(t.enter("codeFlowValue"),b(y))}function b(y){return y===null||ae(y)?(t.exit("codeFlowValue"),S(y)):(t.consume(y),b)}function C(y){return t.exit("codeFenced"),e(y)}function N(y,P,L){let _=0;return O;function O(I){return y.enter("lineEnding"),y.consume(I),y.exit("lineEnding"),T}function T(I){return y.enter("codeFencedFence"),we(I)?Se(y,A,"linePrefix",s.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(I):A(I)}function A(I){return I===l?(y.enter("codeFencedFenceSequence"),R(I)):L(I)}function R(I){return I===l?(_++,y.consume(I),R):_>=a?(y.exit("codeFencedFenceSequence"),we(I)?Se(y,D,"whitespace")(I):D(I)):L(I)}function D(I){return I===null||ae(I)?(y.exit("codeFencedFence"),P(I)):L(I)}}}function Q0(t,e,n){const s=this;return i;function i(a){return a===null?n(a):(t.enter("lineEnding"),t.consume(a),t.exit("lineEnding"),o)}function o(a){return s.parser.lazy[s.now().line]?n(a):e(a)}}const _r={name:"codeIndented",tokenize:K0},J0={partial:!0,tokenize:Z0};function K0(t,e,n){const s=this;return i;function i(d){return t.enter("codeIndented"),Se(t,o,"linePrefix",5)(d)}function o(d){const h=s.events[s.events.length-1];return h&&h[1].type==="linePrefix"&&h[2].sliceSerialize(h[1],!0).length>=4?a(d):n(d)}function a(d){return d===null?c(d):ae(d)?t.attempt(J0,a,c)(d):(t.enter("codeFlowValue"),l(d))}function l(d){return d===null||ae(d)?(t.exit("codeFlowValue"),a(d)):(t.consume(d),l)}function c(d){return t.exit("codeIndented"),e(d)}}function Z0(t,e,n){const s=this;return i;function i(a){return s.parser.lazy[s.now().line]?n(a):ae(a)?(t.enter("lineEnding"),t.consume(a),t.exit("lineEnding"),i):Se(t,o,"linePrefix",5)(a)}function o(a){const l=s.events[s.events.length-1];return l&&l[1].type==="linePrefix"&&l[2].sliceSerialize(l[1],!0).length>=4?e(a):ae(a)?i(a):n(a)}}const Y0={name:"codeText",previous:ey,resolve:X0,tokenize:ty};function X0(t){let e=t.length-4,n=3,s,i;if((t[n][1].type==="lineEnding"||t[n][1].type==="space")&&(t[e][1].type==="lineEnding"||t[e][1].type==="space")){for(s=n;++s<e;)if(t[s][1].type==="codeTextData"){t[n][1].type="codeTextPadding",t[e][1].type="codeTextPadding",n+=2,e-=2;break}}for(s=n-1,e++;++s<=e;)i===void 0?s!==e&&t[s][1].type!=="lineEnding"&&(i=s):(s===e||t[s][1].type==="lineEnding")&&(t[i][1].type="codeTextData",s!==i+2&&(t[i][1].end=t[s-1][1].end,t.splice(i+2,s-i-2),e-=s-i-2,s=i+2),i=void 0);return t}function ey(t){return t!==96||this.events[this.events.length-1][1].type==="characterEscape"}function ty(t,e,n){let s=0,i,o;return a;function a(m){return t.enter("codeText"),t.enter("codeTextSequence"),l(m)}function l(m){return m===96?(t.consume(m),s++,l):(t.exit("codeTextSequence"),c(m))}function c(m){return m===null?n(m):m===32?(t.enter("space"),t.consume(m),t.exit("space"),c):m===96?(o=t.enter("codeTextSequence"),i=0,h(m)):ae(m)?(t.enter("lineEnding"),t.consume(m),t.exit("lineEnding"),c):(t.enter("codeTextData"),d(m))}function d(m){return m===null||m===32||m===96||ae(m)?(t.exit("codeTextData"),c(m)):(t.consume(m),d)}function h(m){return m===96?(t.consume(m),i++,h):i===s?(t.exit("codeTextSequence"),t.exit("codeText"),e(m)):(o.type="codeTextData",d(m))}}class ny{constructor(e){this.left=e?[...e]:[],this.right=[]}get(e){if(e<0||e>=this.left.length+this.right.length)throw new RangeError("Cannot access index `"+e+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return e<this.left.length?this.left[e]:this.right[this.right.length-e+this.left.length-1]}get length(){return this.left.length+this.right.length}shift(){return this.setCursor(0),this.right.pop()}slice(e,n){const s=n??Number.POSITIVE_INFINITY;return s<this.left.length?this.left.slice(e,s):e>this.left.length?this.right.slice(this.right.length-s+this.left.length,this.right.length-e+this.left.length).reverse():this.left.slice(e).concat(this.right.slice(this.right.length-s+this.left.length).reverse())}splice(e,n,s){const i=n||0;this.setCursor(Math.trunc(e));const o=this.right.splice(this.right.length-i,Number.POSITIVE_INFINITY);return s&&Zn(this.left,s),o.reverse()}pop(){return this.setCursor(Number.POSITIVE_INFINITY),this.left.pop()}push(e){this.setCursor(Number.POSITIVE_INFINITY),this.left.push(e)}pushMany(e){this.setCursor(Number.POSITIVE_INFINITY),Zn(this.left,e)}unshift(e){this.setCursor(0),this.right.push(e)}unshiftMany(e){this.setCursor(0),Zn(this.right,e.reverse())}setCursor(e){if(!(e===this.left.length||e>this.left.length&&this.right.length===0||e<0&&this.left.length===0))if(e<this.left.length){const n=this.left.splice(e,Number.POSITIVE_INFINITY);Zn(this.right,n.reverse())}else{const n=this.right.splice(this.left.length+this.right.length-e,Number.POSITIVE_INFINITY);Zn(this.left,n.reverse())}}}function Zn(t,e){let n=0;if(e.length<1e4)t.push(...e);else for(;n<e.length;)t.push(...e.slice(n,n+1e4)),n+=1e4}function Tc(t){const e={};let n=-1,s,i,o,a,l,c,d;const h=new ny(t);for(;++n<h.length;){for(;n in e;)n=e[n];if(s=h.get(n),n&&s[1].type==="chunkFlow"&&h.get(n-1)[1].type==="listItemPrefix"&&(c=s[1]._tokenizer.events,o=0,o<c.length&&c[o][1].type==="lineEndingBlank"&&(o+=2),o<c.length&&c[o][1].type==="content"))for(;++o<c.length&&c[o][1].type!=="content";)c[o][1].type==="chunkText"&&(c[o][1]._isInFirstContentOfListItem=!0,o++);if(s[0]==="enter")s[1].contentType&&(Object.assign(e,sy(h,n)),n=e[n],d=!0);else if(s[1]._container){for(o=n,i=void 0;o--;)if(a=h.get(o),a[1].type==="lineEnding"||a[1].type==="lineEndingBlank")a[0]==="enter"&&(i&&(h.get(i)[1].type="lineEndingBlank"),a[1].type="lineEnding",i=o);else if(!(a[1].type==="linePrefix"||a[1].type==="listItemIndent"))break;i&&(s[1].end={...h.get(i)[1].start},l=h.slice(i,n),l.unshift(s),h.splice(i,n-i+1,l))}}return pt(t,0,Number.POSITIVE_INFINITY,h.slice(0)),!d}function sy(t,e){const n=t.get(e)[1],s=t.get(e)[2];let i=e-1;const o=[];let a=n._tokenizer;a||(a=s.parser[n.contentType](n.start),n._contentTypeTextTrailing&&(a._contentTypeTextTrailing=!0));const l=a.events,c=[],d={};let h,m,p=-1,u=n,g=0,x=0;const w=[x];for(;u;){for(;t.get(++i)[1]!==u;);o.push(i),u._tokenizer||(h=s.sliceStream(u),u.next||h.push(null),m&&a.defineSkip(u.start),u._isInFirstContentOfListItem&&(a._gfmTasklistFirstContentOfListItem=!0),a.write(h),u._isInFirstContentOfListItem&&(a._gfmTasklistFirstContentOfListItem=void 0)),m=u,u=u.next}for(u=n;++p<l.length;)l[p][0]==="exit"&&l[p-1][0]==="enter"&&l[p][1].type===l[p-1][1].type&&l[p][1].start.line!==l[p][1].end.line&&(x=p+1,w.push(x),u._tokenizer=void 0,u.previous=void 0,u=u.next);for(a.events=[],u?(u._tokenizer=void 0,u.previous=void 0):w.pop(),p=w.length;p--;){const v=l.slice(w[p],w[p+1]),S=o.pop();c.push([S,S+v.length-1]),t.splice(S,2,v)}for(c.reverse(),p=-1;++p<c.length;)d[g+c[p][0]]=g+c[p][1],g+=c[p][1]-c[p][0]-1;return d}const ry={resolve:oy,tokenize:ay},iy={partial:!0,tokenize:ly};function oy(t){return Tc(t),t}function ay(t,e){let n;return s;function s(l){return t.enter("content"),n=t.enter("chunkContent",{contentType:"content"}),i(l)}function i(l){return l===null?o(l):ae(l)?t.check(iy,a,o)(l):(t.consume(l),i)}function o(l){return t.exit("chunkContent"),t.exit("content"),e(l)}function a(l){return t.consume(l),t.exit("chunkContent"),n.next=t.enter("chunkContent",{contentType:"content",previous:n}),n=n.next,i}}function ly(t,e,n){const s=this;return i;function i(a){return t.exit("chunkContent"),t.enter("lineEnding"),t.consume(a),t.exit("lineEnding"),Se(t,o,"linePrefix")}function o(a){if(a===null||ae(a))return n(a);const l=s.events[s.events.length-1];return!s.parser.constructs.disable.null.includes("codeIndented")&&l&&l[1].type==="linePrefix"&&l[2].sliceSerialize(l[1],!0).length>=4?e(a):t.interrupt(s.parser.constructs.flow,n,e)(a)}}function Ic(t,e,n,s,i,o,a,l,c){const d=c||Number.POSITIVE_INFINITY;let h=0;return m;function m(v){return v===60?(t.enter(s),t.enter(i),t.enter(o),t.consume(v),t.exit(o),p):v===null||v===32||v===41||yi(v)?n(v):(t.enter(s),t.enter(a),t.enter(l),t.enter("chunkString",{contentType:"string"}),x(v))}function p(v){return v===62?(t.enter(o),t.consume(v),t.exit(o),t.exit(i),t.exit(s),e):(t.enter(l),t.enter("chunkString",{contentType:"string"}),u(v))}function u(v){return v===62?(t.exit("chunkString"),t.exit(l),p(v)):v===null||v===60||ae(v)?n(v):(t.consume(v),v===92?g:u)}function g(v){return v===60||v===62||v===92?(t.consume(v),u):u(v)}function x(v){return!h&&(v===null||v===41||We(v))?(t.exit("chunkString"),t.exit(l),t.exit(a),t.exit(s),e(v)):h<d&&v===40?(t.consume(v),h++,x):v===41?(t.consume(v),h--,x):v===null||v===32||v===40||yi(v)?n(v):(t.consume(v),v===92?w:x)}function w(v){return v===40||v===41||v===92?(t.consume(v),x):x(v)}}function Ac(t,e,n,s,i,o){const a=this;let l=0,c;return d;function d(u){return t.enter(s),t.enter(i),t.consume(u),t.exit(i),t.enter(o),h}function h(u){return l>999||u===null||u===91||u===93&&!c||u===94&&!l&&"_hiddenFootnoteSupport"in a.parser.constructs?n(u):u===93?(t.exit(o),t.enter(i),t.consume(u),t.exit(i),t.exit(s),e):ae(u)?(t.enter("lineEnding"),t.consume(u),t.exit("lineEnding"),h):(t.enter("chunkString",{contentType:"string"}),m(u))}function m(u){return u===null||u===91||u===93||ae(u)||l++>999?(t.exit("chunkString"),h(u)):(t.consume(u),c||(c=!we(u)),u===92?p:m)}function p(u){return u===91||u===92||u===93?(t.consume(u),l++,m):m(u)}}function zc(t,e,n,s,i,o){let a;return l;function l(p){return p===34||p===39||p===40?(t.enter(s),t.enter(i),t.consume(p),t.exit(i),a=p===40?41:p,c):n(p)}function c(p){return p===a?(t.enter(i),t.consume(p),t.exit(i),t.exit(s),e):(t.enter(o),d(p))}function d(p){return p===a?(t.exit(o),c(a)):p===null?n(p):ae(p)?(t.enter("lineEnding"),t.consume(p),t.exit("lineEnding"),Se(t,d,"linePrefix")):(t.enter("chunkString",{contentType:"string"}),h(p))}function h(p){return p===a||p===null||ae(p)?(t.exit("chunkString"),d(p)):(t.consume(p),p===92?m:h)}function m(p){return p===a||p===92?(t.consume(p),h):h(p)}}function rs(t,e){let n;return s;function s(i){return ae(i)?(t.enter("lineEnding"),t.consume(i),t.exit("lineEnding"),n=!0,s):we(i)?Se(t,s,n?"linePrefix":"lineSuffix")(i):e(i)}}const cy={name:"definition",tokenize:uy},dy={partial:!0,tokenize:hy};function uy(t,e,n){const s=this;let i;return o;function o(u){return t.enter("definition"),a(u)}function a(u){return Ac.call(s,t,l,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(u)}function l(u){return i=cn(s.sliceSerialize(s.events[s.events.length-1][1]).slice(1,-1)),u===58?(t.enter("definitionMarker"),t.consume(u),t.exit("definitionMarker"),c):n(u)}function c(u){return We(u)?rs(t,d)(u):d(u)}function d(u){return Ic(t,h,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(u)}function h(u){return t.attempt(dy,m,m)(u)}function m(u){return we(u)?Se(t,p,"whitespace")(u):p(u)}function p(u){return u===null||ae(u)?(t.exit("definition"),s.parser.defined.push(i),e(u)):n(u)}}function hy(t,e,n){return s;function s(l){return We(l)?rs(t,i)(l):n(l)}function i(l){return zc(t,o,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(l)}function o(l){return we(l)?Se(t,a,"whitespace")(l):a(l)}function a(l){return l===null||ae(l)?e(l):n(l)}}const fy={name:"hardBreakEscape",tokenize:my};function my(t,e,n){return s;function s(o){return t.enter("hardBreakEscape"),t.consume(o),i}function i(o){return ae(o)?(t.exit("hardBreakEscape"),e(o)):n(o)}}const py={name:"headingAtx",resolve:gy,tokenize:xy};function gy(t,e){let n=t.length-2,s=3,i,o;return t[s][1].type==="whitespace"&&(s+=2),n-2>s&&t[n][1].type==="whitespace"&&(n-=2),t[n][1].type==="atxHeadingSequence"&&(s===n-1||n-4>s&&t[n-2][1].type==="whitespace")&&(n-=s+1===n?2:4),n>s&&(i={type:"atxHeadingText",start:t[s][1].start,end:t[n][1].end},o={type:"chunkText",start:t[s][1].start,end:t[n][1].end,contentType:"text"},pt(t,s,n-s+1,[["enter",i,e],["enter",o,e],["exit",o,e],["exit",i,e]])),t}function xy(t,e,n){let s=0;return i;function i(h){return t.enter("atxHeading"),o(h)}function o(h){return t.enter("atxHeadingSequence"),a(h)}function a(h){return h===35&&s++<6?(t.consume(h),a):h===null||We(h)?(t.exit("atxHeadingSequence"),l(h)):n(h)}function l(h){return h===35?(t.enter("atxHeadingSequence"),c(h)):h===null||ae(h)?(t.exit("atxHeading"),e(h)):we(h)?Se(t,l,"whitespace")(h):(t.enter("atxHeadingText"),d(h))}function c(h){return h===35?(t.consume(h),c):(t.exit("atxHeadingSequence"),l(h))}function d(h){return h===null||h===35||We(h)?(t.exit("atxHeadingText"),l(h)):(t.consume(h),d)}}const by=["address","article","aside","base","basefont","blockquote","body","caption","center","col","colgroup","dd","details","dialog","dir","div","dl","dt","fieldset","figcaption","figure","footer","form","frame","frameset","h1","h2","h3","h4","h5","h6","head","header","hr","html","iframe","legend","li","link","main","menu","menuitem","nav","noframes","ol","optgroup","option","p","param","search","section","summary","table","tbody","td","tfoot","th","thead","title","tr","track","ul"],La=["pre","script","style","textarea"],yy={concrete:!0,name:"htmlFlow",resolveTo:Sy,tokenize:jy},wy={partial:!0,tokenize:Cy},vy={partial:!0,tokenize:ky};function Sy(t){let e=t.length;for(;e--&&!(t[e][0]==="enter"&&t[e][1].type==="htmlFlow"););return e>1&&t[e-2][1].type==="linePrefix"&&(t[e][1].start=t[e-2][1].start,t[e+1][1].start=t[e-2][1].start,t.splice(e-2,2)),t}function jy(t,e,n){const s=this;let i,o,a,l,c;return d;function d(k){return h(k)}function h(k){return t.enter("htmlFlow"),t.enter("htmlFlowData"),t.consume(k),m}function m(k){return k===33?(t.consume(k),p):k===47?(t.consume(k),o=!0,x):k===63?(t.consume(k),i=3,s.interrupt?e:j):mt(k)?(t.consume(k),a=String.fromCharCode(k),w):n(k)}function p(k){return k===45?(t.consume(k),i=2,u):k===91?(t.consume(k),i=5,l=0,g):mt(k)?(t.consume(k),i=4,s.interrupt?e:j):n(k)}function u(k){return k===45?(t.consume(k),s.interrupt?e:j):n(k)}function g(k){const q="CDATA[";return k===q.charCodeAt(l++)?(t.consume(k),l===q.length?s.interrupt?e:A:g):n(k)}function x(k){return mt(k)?(t.consume(k),a=String.fromCharCode(k),w):n(k)}function w(k){if(k===null||k===47||k===62||We(k)){const q=k===47,J=a.toLowerCase();return!q&&!o&&La.includes(J)?(i=1,s.interrupt?e(k):A(k)):by.includes(a.toLowerCase())?(i=6,q?(t.consume(k),v):s.interrupt?e(k):A(k)):(i=7,s.interrupt&&!s.parser.lazy[s.now().line]?n(k):o?S(k):b(k))}return k===45||Xe(k)?(t.consume(k),a+=String.fromCharCode(k),w):n(k)}function v(k){return k===62?(t.consume(k),s.interrupt?e:A):n(k)}function S(k){return we(k)?(t.consume(k),S):O(k)}function b(k){return k===47?(t.consume(k),O):k===58||k===95||mt(k)?(t.consume(k),C):we(k)?(t.consume(k),b):O(k)}function C(k){return k===45||k===46||k===58||k===95||Xe(k)?(t.consume(k),C):N(k)}function N(k){return k===61?(t.consume(k),y):we(k)?(t.consume(k),N):b(k)}function y(k){return k===null||k===60||k===61||k===62||k===96?n(k):k===34||k===39?(t.consume(k),c=k,P):we(k)?(t.consume(k),y):L(k)}function P(k){return k===c?(t.consume(k),c=null,_):k===null||ae(k)?n(k):(t.consume(k),P)}function L(k){return k===null||k===34||k===39||k===47||k===60||k===61||k===62||k===96||We(k)?N(k):(t.consume(k),L)}function _(k){return k===47||k===62||we(k)?b(k):n(k)}function O(k){return k===62?(t.consume(k),T):n(k)}function T(k){return k===null||ae(k)?A(k):we(k)?(t.consume(k),T):n(k)}function A(k){return k===45&&i===2?(t.consume(k),$):k===60&&i===1?(t.consume(k),U):k===62&&i===4?(t.consume(k),B):k===63&&i===3?(t.consume(k),j):k===93&&i===5?(t.consume(k),F):ae(k)&&(i===6||i===7)?(t.exit("htmlFlowData"),t.check(wy,X,R)(k)):k===null||ae(k)?(t.exit("htmlFlowData"),R(k)):(t.consume(k),A)}function R(k){return t.check(vy,D,X)(k)}function D(k){return t.enter("lineEnding"),t.consume(k),t.exit("lineEnding"),I}function I(k){return k===null||ae(k)?R(k):(t.enter("htmlFlowData"),A(k))}function $(k){return k===45?(t.consume(k),j):A(k)}function U(k){return k===47?(t.consume(k),a="",E):A(k)}function E(k){if(k===62){const q=a.toLowerCase();return La.includes(q)?(t.consume(k),B):A(k)}return mt(k)&&a.length<8?(t.consume(k),a+=String.fromCharCode(k),E):A(k)}function F(k){return k===93?(t.consume(k),j):A(k)}function j(k){return k===62?(t.consume(k),B):k===45&&i===2?(t.consume(k),j):A(k)}function B(k){return k===null||ae(k)?(t.exit("htmlFlowData"),X(k)):(t.consume(k),B)}function X(k){return t.exit("htmlFlow"),e(k)}}function ky(t,e,n){const s=this;return i;function i(a){return ae(a)?(t.enter("lineEnding"),t.consume(a),t.exit("lineEnding"),o):n(a)}function o(a){return s.parser.lazy[s.now().line]?n(a):e(a)}}function Cy(t,e,n){return s;function s(i){return t.enter("lineEnding"),t.consume(i),t.exit("lineEnding"),t.attempt(ur,e,n)}}const Ny={name:"htmlText",tokenize:Ey};function Ey(t,e,n){const s=this;let i,o,a;return l;function l(j){return t.enter("htmlText"),t.enter("htmlTextData"),t.consume(j),c}function c(j){return j===33?(t.consume(j),d):j===47?(t.consume(j),N):j===63?(t.consume(j),b):mt(j)?(t.consume(j),L):n(j)}function d(j){return j===45?(t.consume(j),h):j===91?(t.consume(j),o=0,g):mt(j)?(t.consume(j),S):n(j)}function h(j){return j===45?(t.consume(j),u):n(j)}function m(j){return j===null?n(j):j===45?(t.consume(j),p):ae(j)?(a=m,U(j)):(t.consume(j),m)}function p(j){return j===45?(t.consume(j),u):m(j)}function u(j){return j===62?$(j):j===45?p(j):m(j)}function g(j){const B="CDATA[";return j===B.charCodeAt(o++)?(t.consume(j),o===B.length?x:g):n(j)}function x(j){return j===null?n(j):j===93?(t.consume(j),w):ae(j)?(a=x,U(j)):(t.consume(j),x)}function w(j){return j===93?(t.consume(j),v):x(j)}function v(j){return j===62?$(j):j===93?(t.consume(j),v):x(j)}function S(j){return j===null||j===62?$(j):ae(j)?(a=S,U(j)):(t.consume(j),S)}function b(j){return j===null?n(j):j===63?(t.consume(j),C):ae(j)?(a=b,U(j)):(t.consume(j),b)}function C(j){return j===62?$(j):b(j)}function N(j){return mt(j)?(t.consume(j),y):n(j)}function y(j){return j===45||Xe(j)?(t.consume(j),y):P(j)}function P(j){return ae(j)?(a=P,U(j)):we(j)?(t.consume(j),P):$(j)}function L(j){return j===45||Xe(j)?(t.consume(j),L):j===47||j===62||We(j)?_(j):n(j)}function _(j){return j===47?(t.consume(j),$):j===58||j===95||mt(j)?(t.consume(j),O):ae(j)?(a=_,U(j)):we(j)?(t.consume(j),_):$(j)}function O(j){return j===45||j===46||j===58||j===95||Xe(j)?(t.consume(j),O):T(j)}function T(j){return j===61?(t.consume(j),A):ae(j)?(a=T,U(j)):we(j)?(t.consume(j),T):_(j)}function A(j){return j===null||j===60||j===61||j===62||j===96?n(j):j===34||j===39?(t.consume(j),i=j,R):ae(j)?(a=A,U(j)):we(j)?(t.consume(j),A):(t.consume(j),D)}function R(j){return j===i?(t.consume(j),i=void 0,I):j===null?n(j):ae(j)?(a=R,U(j)):(t.consume(j),R)}function D(j){return j===null||j===34||j===39||j===60||j===61||j===96?n(j):j===47||j===62||We(j)?_(j):(t.consume(j),D)}function I(j){return j===47||j===62||We(j)?_(j):n(j)}function $(j){return j===62?(t.consume(j),t.exit("htmlTextData"),t.exit("htmlText"),e):n(j)}function U(j){return t.exit("htmlTextData"),t.enter("lineEnding"),t.consume(j),t.exit("lineEnding"),E}function E(j){return we(j)?Se(t,F,"linePrefix",s.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(j):F(j)}function F(j){return t.enter("htmlTextData"),a(j)}}const ao={name:"labelEnd",resolveAll:Ay,resolveTo:zy,tokenize:Ly},Py={tokenize:Ry},Ty={tokenize:_y},Iy={tokenize:Dy};function Ay(t){let e=-1;const n=[];for(;++e<t.length;){const s=t[e][1];if(n.push(t[e]),s.type==="labelImage"||s.type==="labelLink"||s.type==="labelEnd"){const i=s.type==="labelImage"?4:2;s.type="data",e+=i}}return t.length!==n.length&&pt(t,0,t.length,n),t}function zy(t,e){let n=t.length,s=0,i,o,a,l;for(;n--;)if(i=t[n][1],o){if(i.type==="link"||i.type==="labelLink"&&i._inactive)break;t[n][0]==="enter"&&i.type==="labelLink"&&(i._inactive=!0)}else if(a){if(t[n][0]==="enter"&&(i.type==="labelImage"||i.type==="labelLink")&&!i._balanced&&(o=n,i.type!=="labelLink")){s=2;break}}else i.type==="labelEnd"&&(a=n);const c={type:t[o][1].type==="labelLink"?"link":"image",start:{...t[o][1].start},end:{...t[t.length-1][1].end}},d={type:"label",start:{...t[o][1].start},end:{...t[a][1].end}},h={type:"labelText",start:{...t[o+s+2][1].end},end:{...t[a-2][1].start}};return l=[["enter",c,e],["enter",d,e]],l=nt(l,t.slice(o+1,o+s+3)),l=nt(l,[["enter",h,e]]),l=nt(l,oo(e.parser.constructs.insideSpan.null,t.slice(o+s+4,a-3),e)),l=nt(l,[["exit",h,e],t[a-2],t[a-1],["exit",d,e]]),l=nt(l,t.slice(a+1)),l=nt(l,[["exit",c,e]]),pt(t,o,t.length,l),t}function Ly(t,e,n){const s=this;let i=s.events.length,o,a;for(;i--;)if((s.events[i][1].type==="labelImage"||s.events[i][1].type==="labelLink")&&!s.events[i][1]._balanced){o=s.events[i][1];break}return l;function l(p){return o?o._inactive?m(p):(a=s.parser.defined.includes(cn(s.sliceSerialize({start:o.end,end:s.now()}))),t.enter("labelEnd"),t.enter("labelMarker"),t.consume(p),t.exit("labelMarker"),t.exit("labelEnd"),c):n(p)}function c(p){return p===40?t.attempt(Py,h,a?h:m)(p):p===91?t.attempt(Ty,h,a?d:m)(p):a?h(p):m(p)}function d(p){return t.attempt(Iy,h,m)(p)}function h(p){return e(p)}function m(p){return o._balanced=!0,n(p)}}function Ry(t,e,n){return s;function s(m){return t.enter("resource"),t.enter("resourceMarker"),t.consume(m),t.exit("resourceMarker"),i}function i(m){return We(m)?rs(t,o)(m):o(m)}function o(m){return m===41?h(m):Ic(t,a,l,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(m)}function a(m){return We(m)?rs(t,c)(m):h(m)}function l(m){return n(m)}function c(m){return m===34||m===39||m===40?zc(t,d,n,"resourceTitle","resourceTitleMarker","resourceTitleString")(m):h(m)}function d(m){return We(m)?rs(t,h)(m):h(m)}function h(m){return m===41?(t.enter("resourceMarker"),t.consume(m),t.exit("resourceMarker"),t.exit("resource"),e):n(m)}}function _y(t,e,n){const s=this;return i;function i(l){return Ac.call(s,t,o,a,"reference","referenceMarker","referenceString")(l)}function o(l){return s.parser.defined.includes(cn(s.sliceSerialize(s.events[s.events.length-1][1]).slice(1,-1)))?e(l):n(l)}function a(l){return n(l)}}function Dy(t,e,n){return s;function s(o){return t.enter("reference"),t.enter("referenceMarker"),t.consume(o),t.exit("referenceMarker"),i}function i(o){return o===93?(t.enter("referenceMarker"),t.consume(o),t.exit("referenceMarker"),t.exit("reference"),e):n(o)}}const My={name:"labelStartImage",resolveAll:ao.resolveAll,tokenize:Oy};function Oy(t,e,n){const s=this;return i;function i(l){return t.enter("labelImage"),t.enter("labelImageMarker"),t.consume(l),t.exit("labelImageMarker"),o}function o(l){return l===91?(t.enter("labelMarker"),t.consume(l),t.exit("labelMarker"),t.exit("labelImage"),a):n(l)}function a(l){return l===94&&"_hiddenFootnoteSupport"in s.parser.constructs?n(l):e(l)}}const $y={name:"labelStartLink",resolveAll:ao.resolveAll,tokenize:Fy};function Fy(t,e,n){const s=this;return i;function i(a){return t.enter("labelLink"),t.enter("labelMarker"),t.consume(a),t.exit("labelMarker"),t.exit("labelLink"),o}function o(a){return a===94&&"_hiddenFootnoteSupport"in s.parser.constructs?n(a):e(a)}}const Dr={name:"lineEnding",tokenize:By};function By(t,e){return n;function n(s){return t.enter("lineEnding"),t.consume(s),t.exit("lineEnding"),Se(t,e,"linePrefix")}}const Ls={name:"thematicBreak",tokenize:Vy};function Vy(t,e,n){let s=0,i;return o;function o(d){return t.enter("thematicBreak"),a(d)}function a(d){return i=d,l(d)}function l(d){return d===i?(t.enter("thematicBreakSequence"),c(d)):s>=3&&(d===null||ae(d))?(t.exit("thematicBreak"),e(d)):n(d)}function c(d){return d===i?(t.consume(d),s++,c):(t.exit("thematicBreakSequence"),we(d)?Se(t,l,"whitespace")(d):l(d))}}const qe={continuation:{tokenize:Wy},exit:Qy,name:"list",tokenize:qy},Uy={partial:!0,tokenize:Jy},Hy={partial:!0,tokenize:Gy};function qy(t,e,n){const s=this,i=s.events[s.events.length-1];let o=i&&i[1].type==="linePrefix"?i[2].sliceSerialize(i[1],!0).length:0,a=0;return l;function l(u){const g=s.containerState.type||(u===42||u===43||u===45?"listUnordered":"listOrdered");if(g==="listUnordered"?!s.containerState.marker||u===s.containerState.marker:wi(u)){if(s.containerState.type||(s.containerState.type=g,t.enter(g,{_container:!0})),g==="listUnordered")return t.enter("listItemPrefix"),u===42||u===45?t.check(Ls,n,d)(u):d(u);if(!s.interrupt||u===49)return t.enter("listItemPrefix"),t.enter("listItemValue"),c(u)}return n(u)}function c(u){return wi(u)&&++a<10?(t.consume(u),c):(!s.interrupt||a<2)&&(s.containerState.marker?u===s.containerState.marker:u===41||u===46)?(t.exit("listItemValue"),d(u)):n(u)}function d(u){return t.enter("listItemMarker"),t.consume(u),t.exit("listItemMarker"),s.containerState.marker=s.containerState.marker||u,t.check(ur,s.interrupt?n:h,t.attempt(Uy,p,m))}function h(u){return s.containerState.initialBlankLine=!0,o++,p(u)}function m(u){return we(u)?(t.enter("listItemPrefixWhitespace"),t.consume(u),t.exit("listItemPrefixWhitespace"),p):n(u)}function p(u){return s.containerState.size=o+s.sliceSerialize(t.exit("listItemPrefix"),!0).length,e(u)}}function Wy(t,e,n){const s=this;return s.containerState._closeFlow=void 0,t.check(ur,i,o);function i(l){return s.containerState.furtherBlankLines=s.containerState.furtherBlankLines||s.containerState.initialBlankLine,Se(t,e,"listItemIndent",s.containerState.size+1)(l)}function o(l){return s.containerState.furtherBlankLines||!we(l)?(s.containerState.furtherBlankLines=void 0,s.containerState.initialBlankLine=void 0,a(l)):(s.containerState.furtherBlankLines=void 0,s.containerState.initialBlankLine=void 0,t.attempt(Hy,e,a)(l))}function a(l){return s.containerState._closeFlow=!0,s.interrupt=void 0,Se(t,t.attempt(qe,e,n),"linePrefix",s.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(l)}}function Gy(t,e,n){const s=this;return Se(t,i,"listItemIndent",s.containerState.size+1);function i(o){const a=s.events[s.events.length-1];return a&&a[1].type==="listItemIndent"&&a[2].sliceSerialize(a[1],!0).length===s.containerState.size?e(o):n(o)}}function Qy(t){t.exit(this.containerState.type)}function Jy(t,e,n){const s=this;return Se(t,i,"listItemPrefixWhitespace",s.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function i(o){const a=s.events[s.events.length-1];return!we(o)&&a&&a[1].type==="listItemPrefixWhitespace"?e(o):n(o)}}const Ra={name:"setextUnderline",resolveTo:Ky,tokenize:Zy};function Ky(t,e){let n=t.length,s,i,o;for(;n--;)if(t[n][0]==="enter"){if(t[n][1].type==="content"){s=n;break}t[n][1].type==="paragraph"&&(i=n)}else t[n][1].type==="content"&&t.splice(n,1),!o&&t[n][1].type==="definition"&&(o=n);const a={type:"setextHeading",start:{...t[s][1].start},end:{...t[t.length-1][1].end}};return t[i][1].type="setextHeadingText",o?(t.splice(i,0,["enter",a,e]),t.splice(o+1,0,["exit",t[s][1],e]),t[s][1].end={...t[o][1].end}):t[s][1]=a,t.push(["exit",a,e]),t}function Zy(t,e,n){const s=this;let i;return o;function o(d){let h=s.events.length,m;for(;h--;)if(s.events[h][1].type!=="lineEnding"&&s.events[h][1].type!=="linePrefix"&&s.events[h][1].type!=="content"){m=s.events[h][1].type==="paragraph";break}return!s.parser.lazy[s.now().line]&&(s.interrupt||m)?(t.enter("setextHeadingLine"),i=d,a(d)):n(d)}function a(d){return t.enter("setextHeadingLineSequence"),l(d)}function l(d){return d===i?(t.consume(d),l):(t.exit("setextHeadingLineSequence"),we(d)?Se(t,c,"lineSuffix")(d):c(d))}function c(d){return d===null||ae(d)?(t.exit("setextHeadingLine"),e(d)):n(d)}}const Yy={tokenize:Xy};function Xy(t){const e=this,n=t.attempt(ur,s,t.attempt(this.parser.constructs.flowInitial,i,Se(t,t.attempt(this.parser.constructs.flow,i,t.attempt(ry,i)),"linePrefix")));return n;function s(o){if(o===null){t.consume(o);return}return t.enter("lineEndingBlank"),t.consume(o),t.exit("lineEndingBlank"),e.currentConstruct=void 0,n}function i(o){if(o===null){t.consume(o);return}return t.enter("lineEnding"),t.consume(o),t.exit("lineEnding"),e.currentConstruct=void 0,n}}const ew={resolveAll:Rc()},tw=Lc("string"),nw=Lc("text");function Lc(t){return{resolveAll:Rc(t==="text"?sw:void 0),tokenize:e};function e(n){const s=this,i=this.parser.constructs[t],o=n.attempt(i,a,l);return a;function a(h){return d(h)?o(h):l(h)}function l(h){if(h===null){n.consume(h);return}return n.enter("data"),n.consume(h),c}function c(h){return d(h)?(n.exit("data"),o(h)):(n.consume(h),c)}function d(h){if(h===null)return!0;const m=i[h];let p=-1;if(m)for(;++p<m.length;){const u=m[p];if(!u.previous||u.previous.call(s,s.previous))return!0}return!1}}}function Rc(t){return e;function e(n,s){let i=-1,o;for(;++i<=n.length;)o===void 0?n[i]&&n[i][1].type==="data"&&(o=i,i++):(!n[i]||n[i][1].type!=="data")&&(i!==o+2&&(n[o][1].end=n[i-1][1].end,n.splice(o+2,i-o-2),i=o+2),o=void 0);return t?t(n,s):n}}function sw(t,e){let n=0;for(;++n<=t.length;)if((n===t.length||t[n][1].type==="lineEnding")&&t[n-1][1].type==="data"){const s=t[n-1][1],i=e.sliceStream(s);let o=i.length,a=-1,l=0,c;for(;o--;){const d=i[o];if(typeof d=="string"){for(a=d.length;d.charCodeAt(a-1)===32;)l++,a--;if(a)break;a=-1}else if(d===-2)c=!0,l++;else if(d!==-1){o++;break}}if(e._contentTypeTextTrailing&&n===t.length&&(l=0),l){const d={type:n===t.length||c||l<2?"lineSuffix":"hardBreakTrailing",start:{_bufferIndex:o?a:s.start._bufferIndex+a,_index:s.start._index+o,line:s.end.line,column:s.end.column-l,offset:s.end.offset-l},end:{...s.end}};s.end={...d.start},s.start.offset===s.end.offset?Object.assign(s,d):(t.splice(n,0,["enter",d,e],["exit",d,e]),n+=2)}n++}return t}const rw={42:qe,43:qe,45:qe,48:qe,49:qe,50:qe,51:qe,52:qe,53:qe,54:qe,55:qe,56:qe,57:qe,62:Nc},iw={91:cy},ow={[-2]:_r,[-1]:_r,32:_r},aw={35:py,42:Ls,45:[Ra,Ls],60:yy,61:Ra,95:Ls,96:za,126:za},lw={38:Pc,92:Ec},cw={[-5]:Dr,[-4]:Dr,[-3]:Dr,33:My,38:Pc,42:vi,60:[$0,Ny],91:$y,92:[fy,Ec],93:ao,95:vi,96:Y0},dw={null:[vi,ew]},uw={null:[42,95]},hw={null:[]},fw=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:uw,contentInitial:iw,disable:hw,document:rw,flow:aw,flowInitial:ow,insideSpan:dw,string:lw,text:cw},Symbol.toStringTag,{value:"Module"}));function mw(t,e,n){let s={_bufferIndex:-1,_index:0,line:n&&n.line||1,column:n&&n.column||1,offset:n&&n.offset||0};const i={},o=[];let a=[],l=[];const c={attempt:P(N),check:P(y),consume:S,enter:b,exit:C,interrupt:P(y,{interrupt:!0})},d={code:null,containerState:{},defineSkip:x,events:[],now:g,parser:t,previous:null,sliceSerialize:p,sliceStream:u,write:m};let h=e.tokenize.call(d,c);return e.resolveAll&&o.push(e),d;function m(T){return a=nt(a,T),w(),a[a.length-1]!==null?[]:(L(e,0),d.events=oo(o,d.events,d),d.events)}function p(T,A){return gw(u(T),A)}function u(T){return pw(a,T)}function g(){const{_bufferIndex:T,_index:A,line:R,column:D,offset:I}=s;return{_bufferIndex:T,_index:A,line:R,column:D,offset:I}}function x(T){i[T.line]=T.column,O()}function w(){let T;for(;s._index<a.length;){const A=a[s._index];if(typeof A=="string")for(T=s._index,s._bufferIndex<0&&(s._bufferIndex=0);s._index===T&&s._bufferIndex<A.length;)v(A.charCodeAt(s._bufferIndex));else v(A)}}function v(T){h=h(T)}function S(T){ae(T)?(s.line++,s.column=1,s.offset+=T===-3?2:1,O()):T!==-1&&(s.column++,s.offset++),s._bufferIndex<0?s._index++:(s._bufferIndex++,s._bufferIndex===a[s._index].length&&(s._bufferIndex=-1,s._index++)),d.previous=T}function b(T,A){const R=A||{};return R.type=T,R.start=g(),d.events.push(["enter",R,d]),l.push(R),R}function C(T){const A=l.pop();return A.end=g(),d.events.push(["exit",A,d]),A}function N(T,A){L(T,A.from)}function y(T,A){A.restore()}function P(T,A){return R;function R(D,I,$){let U,E,F,j;return Array.isArray(D)?X(D):"tokenize"in D?X([D]):B(D);function B(G){return re;function re(Y){const ye=Y!==null&&G[Y],ee=Y!==null&&G.null,z=[...Array.isArray(ye)?ye:ye?[ye]:[],...Array.isArray(ee)?ee:ee?[ee]:[]];return X(z)(Y)}}function X(G){return U=G,E=0,G.length===0?$:k(G[E])}function k(G){return re;function re(Y){return j=_(),F=G,G.partial||(d.currentConstruct=G),G.name&&d.parser.constructs.disable.null.includes(G.name)?J():G.tokenize.call(A?Object.assign(Object.create(d),A):d,c,q,J)(Y)}}function q(G){return T(F,j),I}function J(G){return j.restore(),++E<U.length?k(U[E]):$}}}function L(T,A){T.resolveAll&&!o.includes(T)&&o.push(T),T.resolve&&pt(d.events,A,d.events.length-A,T.resolve(d.events.slice(A),d)),T.resolveTo&&(d.events=T.resolveTo(d.events,d))}function _(){const T=g(),A=d.previous,R=d.currentConstruct,D=d.events.length,I=Array.from(l);return{from:D,restore:$};function $(){s=T,d.previous=A,d.currentConstruct=R,d.events.length=D,l=I,O()}}function O(){s.line in i&&s.column<2&&(s.column=i[s.line],s.offset+=i[s.line]-1)}}function pw(t,e){const n=e.start._index,s=e.start._bufferIndex,i=e.end._index,o=e.end._bufferIndex;let a;if(n===i)a=[t[n].slice(s,o)];else{if(a=t.slice(n,i),s>-1){const l=a[0];typeof l=="string"?a[0]=l.slice(s):a.shift()}o>0&&a.push(t[i].slice(0,o))}return a}function gw(t,e){let n=-1;const s=[];let i;for(;++n<t.length;){const o=t[n];let a;if(typeof o=="string")a=o;else switch(o){case-5:{a="\r";break}case-4:{a=`
|
|
41
|
+
`;break}case-3:{a=`\r
|
|
42
|
+
`;break}case-2:{a=e?" ":" ";break}case-1:{if(!e&&i)continue;a=" ";break}default:a=String.fromCharCode(o)}i=o===-2,s.push(a)}return s.join("")}function xw(t){const s={constructs:k0([fw,...(t||{}).extensions||[]]),content:i(z0),defined:[],document:i(R0),flow:i(Yy),lazy:{},string:i(tw),text:i(nw)};return s;function i(o){return a;function a(l){return mw(s,o,l)}}}function bw(t){for(;!Tc(t););return t}const _a=/[\0\t\n\r]/g;function yw(){let t=1,e="",n=!0,s;return i;function i(o,a,l){const c=[];let d,h,m,p,u;for(o=e+(typeof o=="string"?o.toString():new TextDecoder(a||void 0).decode(o)),m=0,e="",n&&(o.charCodeAt(0)===65279&&m++,n=void 0);m<o.length;){if(_a.lastIndex=m,d=_a.exec(o),p=d&&d.index!==void 0?d.index:o.length,u=o.charCodeAt(p),!d){e=o.slice(m);break}if(u===10&&m===p&&s)c.push(-3),s=void 0;else switch(s&&(c.push(-5),s=void 0),m<p&&(c.push(o.slice(m,p)),t+=p-m),u){case 0:{c.push(65533),t++;break}case 9:{for(h=Math.ceil(t/4)*4,c.push(-2);t++<h;)c.push(-1);break}case 10:{c.push(-4),t=1;break}default:s=!0,t=1}m=p+1}return l&&(s&&c.push(-5),e&&c.push(e),c.push(null)),c}}const ww=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function vw(t){return t.replace(ww,Sw)}function Sw(t,e,n){if(e)return e;if(n.charCodeAt(0)===35){const i=n.charCodeAt(1),o=i===120||i===88;return Cc(n.slice(o?2:1),o?16:10)}return io(n)||t}const _c={}.hasOwnProperty;function jw(t,e,n){return e&&typeof e=="object"&&(n=e,e=void 0),kw(n)(bw(xw(n).document().write(yw()(t,e,!0))))}function kw(t){const e={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:o(se),autolinkProtocol:_,autolinkEmail:_,atxHeading:o(te),blockQuote:o(ee),characterEscape:_,characterReference:_,codeFenced:o(z),codeFencedFenceInfo:a,codeFencedFenceMeta:a,codeIndented:o(z,a),codeText:o(W,a),codeTextData:_,data:_,codeFlowValue:_,definition:o(K),definitionDestinationString:a,definitionLabelString:a,definitionTitleString:a,emphasis:o(ne),hardBreakEscape:o(me),hardBreakTrailing:o(me),htmlFlow:o(je,a),htmlFlowData:_,htmlText:o(je,a),htmlTextData:_,image:o(Q),label:a,link:o(se),listItem:o(pe),listItemValue:p,listOrdered:o(Z,m),listUnordered:o(Z),paragraph:o(le),reference:k,referenceString:a,resourceDestinationString:a,resourceTitleString:a,setextHeading:o(te),strong:o(he),thematicBreak:o(Ee)},exit:{atxHeading:c(),atxHeadingSequence:N,autolink:c(),autolinkEmail:ye,autolinkProtocol:Y,blockQuote:c(),characterEscapeValue:O,characterReferenceMarkerHexadecimal:J,characterReferenceMarkerNumeric:J,characterReferenceValue:G,characterReference:re,codeFenced:c(w),codeFencedFence:x,codeFencedFenceInfo:u,codeFencedFenceMeta:g,codeFlowValue:O,codeIndented:c(v),codeText:c(I),codeTextData:O,data:O,definition:c(),definitionDestinationString:C,definitionLabelString:S,definitionTitleString:b,emphasis:c(),hardBreakEscape:c(A),hardBreakTrailing:c(A),htmlFlow:c(R),htmlFlowData:O,htmlText:c(D),htmlTextData:O,image:c(U),label:F,labelText:E,lineEnding:T,link:c($),listItem:c(),listOrdered:c(),listUnordered:c(),paragraph:c(),referenceString:q,resourceDestinationString:j,resourceTitleString:B,resource:X,setextHeading:c(L),setextHeadingLineSequence:P,setextHeadingText:y,strong:c(),thematicBreak:c()}};Dc(e,(t||{}).mdastExtensions||[]);const n={};return s;function s(M){let V={type:"root",children:[]};const ie={stack:[V],tokenStack:[],config:e,enter:l,exit:d,buffer:a,resume:h,data:n},oe=[];let fe=-1;for(;++fe<M.length;)if(M[fe][1].type==="listOrdered"||M[fe][1].type==="listUnordered")if(M[fe][0]==="enter")oe.push(fe);else{const Ae=oe.pop();fe=i(M,Ae,fe)}for(fe=-1;++fe<M.length;){const Ae=e[M[fe][0]];_c.call(Ae,M[fe][1].type)&&Ae[M[fe][1].type].call(Object.assign({sliceSerialize:M[fe][2].sliceSerialize},ie),M[fe][1])}if(ie.tokenStack.length>0){const Ae=ie.tokenStack[ie.tokenStack.length-1];(Ae[1]||Da).call(ie,void 0,Ae[0])}for(V.position={start:kt(M.length>0?M[0][1].start:{line:1,column:1,offset:0}),end:kt(M.length>0?M[M.length-2][1].end:{line:1,column:1,offset:0})},fe=-1;++fe<e.transforms.length;)V=e.transforms[fe](V)||V;return V}function i(M,V,ie){let oe=V-1,fe=-1,Ae=!1,Ve,Ue,at,lt;for(;++oe<=ie;){const Pe=M[oe];switch(Pe[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{Pe[0]==="enter"?fe++:fe--,lt=void 0;break}case"lineEndingBlank":{Pe[0]==="enter"&&(Ve&&!lt&&!fe&&!at&&(at=oe),lt=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:lt=void 0}if(!fe&&Pe[0]==="enter"&&Pe[1].type==="listItemPrefix"||fe===-1&&Pe[0]==="exit"&&(Pe[1].type==="listUnordered"||Pe[1].type==="listOrdered")){if(Ve){let Qe=oe;for(Ue=void 0;Qe--;){const Fe=M[Qe];if(Fe[1].type==="lineEnding"||Fe[1].type==="lineEndingBlank"){if(Fe[0]==="exit")continue;Ue&&(M[Ue][1].type="lineEndingBlank",Ae=!0),Fe[1].type="lineEnding",Ue=Qe}else if(!(Fe[1].type==="linePrefix"||Fe[1].type==="blockQuotePrefix"||Fe[1].type==="blockQuotePrefixWhitespace"||Fe[1].type==="blockQuoteMarker"||Fe[1].type==="listItemIndent"))break}at&&(!Ue||at<Ue)&&(Ve._spread=!0),Ve.end=Object.assign({},Ue?M[Ue][1].start:Pe[1].end),M.splice(Ue||oe,0,["exit",Ve,Pe[2]]),oe++,ie++}if(Pe[1].type==="listItemPrefix"){const Qe={type:"listItem",_spread:!1,start:Object.assign({},Pe[1].start),end:void 0};Ve=Qe,M.splice(oe,0,["enter",Qe,Pe[2]]),oe++,ie++,at=void 0,lt=!0}}}return M[V][1]._spread=Ae,ie}function o(M,V){return ie;function ie(oe){l.call(this,M(oe),oe),V&&V.call(this,oe)}}function a(){this.stack.push({type:"fragment",children:[]})}function l(M,V,ie){this.stack[this.stack.length-1].children.push(M),this.stack.push(M),this.tokenStack.push([V,ie||void 0]),M.position={start:kt(V.start),end:void 0}}function c(M){return V;function V(ie){M&&M.call(this,ie),d.call(this,ie)}}function d(M,V){const ie=this.stack.pop(),oe=this.tokenStack.pop();if(oe)oe[0].type!==M.type&&(V?V.call(this,M,oe[0]):(oe[1]||Da).call(this,M,oe[0]));else throw new Error("Cannot close `"+M.type+"` ("+ss({start:M.start,end:M.end})+"): it’s not open");ie.position.end=kt(M.end)}function h(){return S0(this.stack.pop())}function m(){this.data.expectingFirstListItemValue=!0}function p(M){if(this.data.expectingFirstListItemValue){const V=this.stack[this.stack.length-2];V.start=Number.parseInt(this.sliceSerialize(M),10),this.data.expectingFirstListItemValue=void 0}}function u(){const M=this.resume(),V=this.stack[this.stack.length-1];V.lang=M}function g(){const M=this.resume(),V=this.stack[this.stack.length-1];V.meta=M}function x(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function w(){const M=this.resume(),V=this.stack[this.stack.length-1];V.value=M.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function v(){const M=this.resume(),V=this.stack[this.stack.length-1];V.value=M.replace(/(\r?\n|\r)$/g,"")}function S(M){const V=this.resume(),ie=this.stack[this.stack.length-1];ie.label=V,ie.identifier=cn(this.sliceSerialize(M)).toLowerCase()}function b(){const M=this.resume(),V=this.stack[this.stack.length-1];V.title=M}function C(){const M=this.resume(),V=this.stack[this.stack.length-1];V.url=M}function N(M){const V=this.stack[this.stack.length-1];if(!V.depth){const ie=this.sliceSerialize(M).length;V.depth=ie}}function y(){this.data.setextHeadingSlurpLineEnding=!0}function P(M){const V=this.stack[this.stack.length-1];V.depth=this.sliceSerialize(M).codePointAt(0)===61?1:2}function L(){this.data.setextHeadingSlurpLineEnding=void 0}function _(M){const ie=this.stack[this.stack.length-1].children;let oe=ie[ie.length-1];(!oe||oe.type!=="text")&&(oe=Ce(),oe.position={start:kt(M.start),end:void 0},ie.push(oe)),this.stack.push(oe)}function O(M){const V=this.stack.pop();V.value+=this.sliceSerialize(M),V.position.end=kt(M.end)}function T(M){const V=this.stack[this.stack.length-1];if(this.data.atHardBreak){const ie=V.children[V.children.length-1];ie.position.end=kt(M.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&e.canContainEols.includes(V.type)&&(_.call(this,M),O.call(this,M))}function A(){this.data.atHardBreak=!0}function R(){const M=this.resume(),V=this.stack[this.stack.length-1];V.value=M}function D(){const M=this.resume(),V=this.stack[this.stack.length-1];V.value=M}function I(){const M=this.resume(),V=this.stack[this.stack.length-1];V.value=M}function $(){const M=this.stack[this.stack.length-1];if(this.data.inReference){const V=this.data.referenceType||"shortcut";M.type+="Reference",M.referenceType=V,delete M.url,delete M.title}else delete M.identifier,delete M.label;this.data.referenceType=void 0}function U(){const M=this.stack[this.stack.length-1];if(this.data.inReference){const V=this.data.referenceType||"shortcut";M.type+="Reference",M.referenceType=V,delete M.url,delete M.title}else delete M.identifier,delete M.label;this.data.referenceType=void 0}function E(M){const V=this.sliceSerialize(M),ie=this.stack[this.stack.length-2];ie.label=vw(V),ie.identifier=cn(V).toLowerCase()}function F(){const M=this.stack[this.stack.length-1],V=this.resume(),ie=this.stack[this.stack.length-1];if(this.data.inReference=!0,ie.type==="link"){const oe=M.children;ie.children=oe}else ie.alt=V}function j(){const M=this.resume(),V=this.stack[this.stack.length-1];V.url=M}function B(){const M=this.resume(),V=this.stack[this.stack.length-1];V.title=M}function X(){this.data.inReference=void 0}function k(){this.data.referenceType="collapsed"}function q(M){const V=this.resume(),ie=this.stack[this.stack.length-1];ie.label=V,ie.identifier=cn(this.sliceSerialize(M)).toLowerCase(),this.data.referenceType="full"}function J(M){this.data.characterReferenceType=M.type}function G(M){const V=this.sliceSerialize(M),ie=this.data.characterReferenceType;let oe;ie?(oe=Cc(V,ie==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):oe=io(V);const fe=this.stack[this.stack.length-1];fe.value+=oe}function re(M){const V=this.stack.pop();V.position.end=kt(M.end)}function Y(M){O.call(this,M);const V=this.stack[this.stack.length-1];V.url=this.sliceSerialize(M)}function ye(M){O.call(this,M);const V=this.stack[this.stack.length-1];V.url="mailto:"+this.sliceSerialize(M)}function ee(){return{type:"blockquote",children:[]}}function z(){return{type:"code",lang:null,meta:null,value:""}}function W(){return{type:"inlineCode",value:""}}function K(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function ne(){return{type:"emphasis",children:[]}}function te(){return{type:"heading",depth:0,children:[]}}function me(){return{type:"break"}}function je(){return{type:"html",value:""}}function Q(){return{type:"image",title:null,url:"",alt:null}}function se(){return{type:"link",title:null,url:"",children:[]}}function Z(M){return{type:"list",ordered:M.type==="listOrdered",start:null,spread:M._spread,children:[]}}function pe(M){return{type:"listItem",spread:M._spread,checked:null,children:[]}}function le(){return{type:"paragraph",children:[]}}function he(){return{type:"strong",children:[]}}function Ce(){return{type:"text",value:""}}function Ee(){return{type:"thematicBreak"}}}function kt(t){return{line:t.line,column:t.column,offset:t.offset}}function Dc(t,e){let n=-1;for(;++n<e.length;){const s=e[n];Array.isArray(s)?Dc(t,s):Cw(t,s)}}function Cw(t,e){let n;for(n in e)if(_c.call(e,n))switch(n){case"canContainEols":{const s=e[n];s&&t[n].push(...s);break}case"transforms":{const s=e[n];s&&t[n].push(...s);break}case"enter":case"exit":{const s=e[n];s&&Object.assign(t[n],s);break}}}function Da(t,e){throw t?new Error("Cannot close `"+t.type+"` ("+ss({start:t.start,end:t.end})+"): a different token (`"+e.type+"`, "+ss({start:e.start,end:e.end})+") is open"):new Error("Cannot close document, a token (`"+e.type+"`, "+ss({start:e.start,end:e.end})+") is still open")}function Nw(t){const e=this;e.parser=n;function n(s){return jw(s,{...e.data("settings"),...t,extensions:e.data("micromarkExtensions")||[],mdastExtensions:e.data("fromMarkdownExtensions")||[]})}}function Ew(t,e){const n={type:"element",tagName:"blockquote",properties:{},children:t.wrap(t.all(e),!0)};return t.patch(e,n),t.applyData(e,n)}function Pw(t,e){const n={type:"element",tagName:"br",properties:{},children:[]};return t.patch(e,n),[t.applyData(e,n),{type:"text",value:`
|
|
43
|
+
`}]}function Tw(t,e){const n=e.value?e.value+`
|
|
44
|
+
`:"",s={},i=e.lang?e.lang.split(/\s+/):[];i.length>0&&(s.className=["language-"+i[0]]);let o={type:"element",tagName:"code",properties:s,children:[{type:"text",value:n}]};return e.meta&&(o.data={meta:e.meta}),t.patch(e,o),o=t.applyData(e,o),o={type:"element",tagName:"pre",properties:{},children:[o]},t.patch(e,o),o}function Iw(t,e){const n={type:"element",tagName:"del",properties:{},children:t.all(e)};return t.patch(e,n),t.applyData(e,n)}function Aw(t,e){const n={type:"element",tagName:"em",properties:{},children:t.all(e)};return t.patch(e,n),t.applyData(e,n)}function zw(t,e){const n=typeof t.options.clobberPrefix=="string"?t.options.clobberPrefix:"user-content-",s=String(e.identifier).toUpperCase(),i=xn(s.toLowerCase()),o=t.footnoteOrder.indexOf(s);let a,l=t.footnoteCounts.get(s);l===void 0?(l=0,t.footnoteOrder.push(s),a=t.footnoteOrder.length):a=o+1,l+=1,t.footnoteCounts.set(s,l);const c={type:"element",tagName:"a",properties:{href:"#"+n+"fn-"+i,id:n+"fnref-"+i+(l>1?"-"+l:""),dataFootnoteRef:!0,ariaDescribedBy:["footnote-label"]},children:[{type:"text",value:String(a)}]};t.patch(e,c);const d={type:"element",tagName:"sup",properties:{},children:[c]};return t.patch(e,d),t.applyData(e,d)}function Lw(t,e){const n={type:"element",tagName:"h"+e.depth,properties:{},children:t.all(e)};return t.patch(e,n),t.applyData(e,n)}function Rw(t,e){if(t.options.allowDangerousHtml){const n={type:"raw",value:e.value};return t.patch(e,n),t.applyData(e,n)}}function Mc(t,e){const n=e.referenceType;let s="]";if(n==="collapsed"?s+="[]":n==="full"&&(s+="["+(e.label||e.identifier)+"]"),e.type==="imageReference")return[{type:"text",value:"!["+e.alt+s}];const i=t.all(e),o=i[0];o&&o.type==="text"?o.value="["+o.value:i.unshift({type:"text",value:"["});const a=i[i.length-1];return a&&a.type==="text"?a.value+=s:i.push({type:"text",value:s}),i}function _w(t,e){const n=String(e.identifier).toUpperCase(),s=t.definitionById.get(n);if(!s)return Mc(t,e);const i={src:xn(s.url||""),alt:e.alt};s.title!==null&&s.title!==void 0&&(i.title=s.title);const o={type:"element",tagName:"img",properties:i,children:[]};return t.patch(e,o),t.applyData(e,o)}function Dw(t,e){const n={src:xn(e.url)};e.alt!==null&&e.alt!==void 0&&(n.alt=e.alt),e.title!==null&&e.title!==void 0&&(n.title=e.title);const s={type:"element",tagName:"img",properties:n,children:[]};return t.patch(e,s),t.applyData(e,s)}function Mw(t,e){const n={type:"text",value:e.value.replace(/\r?\n|\r/g," ")};t.patch(e,n);const s={type:"element",tagName:"code",properties:{},children:[n]};return t.patch(e,s),t.applyData(e,s)}function Ow(t,e){const n=String(e.identifier).toUpperCase(),s=t.definitionById.get(n);if(!s)return Mc(t,e);const i={href:xn(s.url||"")};s.title!==null&&s.title!==void 0&&(i.title=s.title);const o={type:"element",tagName:"a",properties:i,children:t.all(e)};return t.patch(e,o),t.applyData(e,o)}function $w(t,e){const n={href:xn(e.url)};e.title!==null&&e.title!==void 0&&(n.title=e.title);const s={type:"element",tagName:"a",properties:n,children:t.all(e)};return t.patch(e,s),t.applyData(e,s)}function Fw(t,e,n){const s=t.all(e),i=n?Bw(n):Oc(e),o={},a=[];if(typeof e.checked=="boolean"){const h=s[0];let m;h&&h.type==="element"&&h.tagName==="p"?m=h:(m={type:"element",tagName:"p",properties:{},children:[]},s.unshift(m)),m.children.length>0&&m.children.unshift({type:"text",value:" "}),m.children.unshift({type:"element",tagName:"input",properties:{type:"checkbox",checked:e.checked,disabled:!0},children:[]}),o.className=["task-list-item"]}let l=-1;for(;++l<s.length;){const h=s[l];(i||l!==0||h.type!=="element"||h.tagName!=="p")&&a.push({type:"text",value:`
|
|
45
|
+
`}),h.type==="element"&&h.tagName==="p"&&!i?a.push(...h.children):a.push(h)}const c=s[s.length-1];c&&(i||c.type!=="element"||c.tagName!=="p")&&a.push({type:"text",value:`
|
|
46
|
+
`});const d={type:"element",tagName:"li",properties:o,children:a};return t.patch(e,d),t.applyData(e,d)}function Bw(t){let e=!1;if(t.type==="list"){e=t.spread||!1;const n=t.children;let s=-1;for(;!e&&++s<n.length;)e=Oc(n[s])}return e}function Oc(t){const e=t.spread;return e??t.children.length>1}function Vw(t,e){const n={},s=t.all(e);let i=-1;for(typeof e.start=="number"&&e.start!==1&&(n.start=e.start);++i<s.length;){const a=s[i];if(a.type==="element"&&a.tagName==="li"&&a.properties&&Array.isArray(a.properties.className)&&a.properties.className.includes("task-list-item")){n.className=["contains-task-list"];break}}const o={type:"element",tagName:e.ordered?"ol":"ul",properties:n,children:t.wrap(s,!0)};return t.patch(e,o),t.applyData(e,o)}function Uw(t,e){const n={type:"element",tagName:"p",properties:{},children:t.all(e)};return t.patch(e,n),t.applyData(e,n)}function Hw(t,e){const n={type:"root",children:t.wrap(t.all(e))};return t.patch(e,n),t.applyData(e,n)}function qw(t,e){const n={type:"element",tagName:"strong",properties:{},children:t.all(e)};return t.patch(e,n),t.applyData(e,n)}function Ww(t,e){const n=t.all(e),s=n.shift(),i=[];if(s){const a={type:"element",tagName:"thead",properties:{},children:t.wrap([s],!0)};t.patch(e.children[0],a),i.push(a)}if(n.length>0){const a={type:"element",tagName:"tbody",properties:{},children:t.wrap(n,!0)},l=to(e.children[1]),c=bc(e.children[e.children.length-1]);l&&c&&(a.position={start:l,end:c}),i.push(a)}const o={type:"element",tagName:"table",properties:{},children:t.wrap(i,!0)};return t.patch(e,o),t.applyData(e,o)}function Gw(t,e,n){const s=n?n.children:void 0,o=(s?s.indexOf(e):1)===0?"th":"td",a=n&&n.type==="table"?n.align:void 0,l=a?a.length:e.children.length;let c=-1;const d=[];for(;++c<l;){const m=e.children[c],p={},u=a?a[c]:void 0;u&&(p.align=u);let g={type:"element",tagName:o,properties:p,children:[]};m&&(g.children=t.all(m),t.patch(m,g),g=t.applyData(m,g)),d.push(g)}const h={type:"element",tagName:"tr",properties:{},children:t.wrap(d,!0)};return t.patch(e,h),t.applyData(e,h)}function Qw(t,e){const n={type:"element",tagName:"td",properties:{},children:t.all(e)};return t.patch(e,n),t.applyData(e,n)}const Ma=9,Oa=32;function Jw(t){const e=String(t),n=/\r?\n|\r/g;let s=n.exec(e),i=0;const o=[];for(;s;)o.push($a(e.slice(i,s.index),i>0,!0),s[0]),i=s.index+s[0].length,s=n.exec(e);return o.push($a(e.slice(i),i>0,!1)),o.join("")}function $a(t,e,n){let s=0,i=t.length;if(e){let o=t.codePointAt(s);for(;o===Ma||o===Oa;)s++,o=t.codePointAt(s)}if(n){let o=t.codePointAt(i-1);for(;o===Ma||o===Oa;)i--,o=t.codePointAt(i-1)}return i>s?t.slice(s,i):""}function Kw(t,e){const n={type:"text",value:Jw(String(e.value))};return t.patch(e,n),t.applyData(e,n)}function Zw(t,e){const n={type:"element",tagName:"hr",properties:{},children:[]};return t.patch(e,n),t.applyData(e,n)}const Yw={blockquote:Ew,break:Pw,code:Tw,delete:Iw,emphasis:Aw,footnoteReference:zw,heading:Lw,html:Rw,imageReference:_w,image:Dw,inlineCode:Mw,linkReference:Ow,link:$w,listItem:Fw,list:Vw,paragraph:Uw,root:Hw,strong:qw,table:Ww,tableCell:Qw,tableRow:Gw,text:Kw,thematicBreak:Zw,toml:ys,yaml:ys,definition:ys,footnoteDefinition:ys};function ys(){}const $c=-1,hr=0,is=1,Xs=2,lo=3,co=4,uo=5,ho=6,Fc=7,Bc=8,Xw=typeof self=="object"?self:globalThis,Fa=(t,e)=>{switch(t){case"Function":case"SharedWorker":case"Worker":case"eval":case"setInterval":case"setTimeout":throw new TypeError("unable to deserialize "+t)}return new Xw[t](e)},ev=(t,e)=>{const n=(i,o)=>(t.set(o,i),i),s=i=>{if(t.has(i))return t.get(i);const[o,a]=e[i];switch(o){case hr:case $c:return n(a,i);case is:{const l=n([],i);for(const c of a)l.push(s(c));return l}case Xs:{const l=n({},i);for(const[c,d]of a)l[s(c)]=s(d);return l}case lo:return n(new Date(a),i);case co:{const{source:l,flags:c}=a;return n(new RegExp(l,c),i)}case uo:{const l=n(new Map,i);for(const[c,d]of a)l.set(s(c),s(d));return l}case ho:{const l=n(new Set,i);for(const c of a)l.add(s(c));return l}case Fc:{const{name:l,message:c}=a;return n(Fa(l,c),i)}case Bc:return n(BigInt(a),i);case"BigInt":return n(Object(BigInt(a)),i);case"ArrayBuffer":return n(new Uint8Array(a).buffer,a);case"DataView":{const{buffer:l}=new Uint8Array(a);return n(new DataView(l),a)}}return n(Fa(o,a),i)};return s},Ba=t=>ev(new Map,t)(0),en="",{toString:tv}={},{keys:nv}=Object,Yn=t=>{const e=typeof t;if(e!=="object"||!t)return[hr,e];const n=tv.call(t).slice(8,-1);switch(n){case"Array":return[is,en];case"Object":return[Xs,en];case"Date":return[lo,en];case"RegExp":return[co,en];case"Map":return[uo,en];case"Set":return[ho,en];case"DataView":return[is,n]}return n.includes("Array")?[is,n]:n.includes("Error")?[Fc,n]:[Xs,n]},ws=([t,e])=>t===hr&&(e==="function"||e==="symbol"),sv=(t,e,n,s)=>{const i=(a,l)=>{const c=s.push(a)-1;return n.set(l,c),c},o=a=>{if(n.has(a))return n.get(a);let[l,c]=Yn(a);switch(l){case hr:{let h=a;switch(c){case"bigint":l=Bc,h=a.toString();break;case"function":case"symbol":if(t)throw new TypeError("unable to serialize "+c);h=null;break;case"undefined":return i([$c],a)}return i([l,h],a)}case is:{if(c){let p=a;return c==="DataView"?p=new Uint8Array(a.buffer):c==="ArrayBuffer"&&(p=new Uint8Array(a)),i([c,[...p]],a)}const h=[],m=i([l,h],a);for(const p of a)h.push(o(p));return m}case Xs:{if(c)switch(c){case"BigInt":return i([c,a.toString()],a);case"Boolean":case"Number":case"String":return i([c,a.valueOf()],a)}if(e&&"toJSON"in a)return o(a.toJSON());const h=[],m=i([l,h],a);for(const p of nv(a))(t||!ws(Yn(a[p])))&&h.push([o(p),o(a[p])]);return m}case lo:return i([l,a.toISOString()],a);case co:{const{source:h,flags:m}=a;return i([l,{source:h,flags:m}],a)}case uo:{const h=[],m=i([l,h],a);for(const[p,u]of a)(t||!(ws(Yn(p))||ws(Yn(u))))&&h.push([o(p),o(u)]);return m}case ho:{const h=[],m=i([l,h],a);for(const p of a)(t||!ws(Yn(p)))&&h.push(o(p));return m}}const{message:d}=a;return i([l,{name:c,message:d}],a)};return o},Va=(t,{json:e,lossy:n}={})=>{const s=[];return sv(!(e||n),!!e,new Map,s)(t),s},er=typeof structuredClone=="function"?(t,e)=>e&&("json"in e||"lossy"in e)?Ba(Va(t,e)):structuredClone(t):(t,e)=>Ba(Va(t,e));function rv(t,e){const n=[{type:"text",value:"↩"}];return e>1&&n.push({type:"element",tagName:"sup",properties:{},children:[{type:"text",value:String(e)}]}),n}function iv(t,e){return"Back to reference "+(t+1)+(e>1?"-"+e:"")}function ov(t){const e=typeof t.options.clobberPrefix=="string"?t.options.clobberPrefix:"user-content-",n=t.options.footnoteBackContent||rv,s=t.options.footnoteBackLabel||iv,i=t.options.footnoteLabel||"Footnotes",o=t.options.footnoteLabelTagName||"h2",a=t.options.footnoteLabelProperties||{className:["sr-only"]},l=[];let c=-1;for(;++c<t.footnoteOrder.length;){const d=t.footnoteById.get(t.footnoteOrder[c]);if(!d)continue;const h=t.all(d),m=String(d.identifier).toUpperCase(),p=xn(m.toLowerCase());let u=0;const g=[],x=t.footnoteCounts.get(m);for(;x!==void 0&&++u<=x;){g.length>0&&g.push({type:"text",value:" "});let S=typeof n=="string"?n:n(c,u);typeof S=="string"&&(S={type:"text",value:S}),g.push({type:"element",tagName:"a",properties:{href:"#"+e+"fnref-"+p+(u>1?"-"+u:""),dataFootnoteBackref:"",ariaLabel:typeof s=="string"?s:s(c,u),className:["data-footnote-backref"]},children:Array.isArray(S)?S:[S]})}const w=h[h.length-1];if(w&&w.type==="element"&&w.tagName==="p"){const S=w.children[w.children.length-1];S&&S.type==="text"?S.value+=" ":w.children.push({type:"text",value:" "}),w.children.push(...g)}else h.push(...g);const v={type:"element",tagName:"li",properties:{id:e+"fn-"+p},children:t.wrap(h,!0)};t.patch(d,v),l.push(v)}if(l.length!==0)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:o,properties:{...er(a),id:"footnote-label"},children:[{type:"text",value:i}]},{type:"text",value:`
|
|
47
|
+
`},{type:"element",tagName:"ol",properties:{},children:t.wrap(l,!0)},{type:"text",value:`
|
|
48
|
+
`}]}}const Vc=(function(t){if(t==null)return dv;if(typeof t=="function")return fr(t);if(typeof t=="object")return Array.isArray(t)?av(t):lv(t);if(typeof t=="string")return cv(t);throw new Error("Expected function, string, or object as test")});function av(t){const e=[];let n=-1;for(;++n<t.length;)e[n]=Vc(t[n]);return fr(s);function s(...i){let o=-1;for(;++o<e.length;)if(e[o].apply(this,i))return!0;return!1}}function lv(t){const e=t;return fr(n);function n(s){const i=s;let o;for(o in t)if(i[o]!==e[o])return!1;return!0}}function cv(t){return fr(e);function e(n){return n&&n.type===t}}function fr(t){return e;function e(n,s,i){return!!(uv(n)&&t.call(this,n,typeof s=="number"?s:void 0,i||void 0))}}function dv(){return!0}function uv(t){return t!==null&&typeof t=="object"&&"type"in t}const Uc=[],hv=!0,Ua=!1,fv="skip";function mv(t,e,n,s){let i;typeof e=="function"&&typeof n!="function"?(s=n,n=e):i=e;const o=Vc(i),a=s?-1:1;l(t,void 0,[])();function l(c,d,h){const m=c&&typeof c=="object"?c:{};if(typeof m.type=="string"){const u=typeof m.tagName=="string"?m.tagName:typeof m.name=="string"?m.name:void 0;Object.defineProperty(p,"name",{value:"node ("+(c.type+(u?"<"+u+">":""))+")"})}return p;function p(){let u=Uc,g,x,w;if((!e||o(c,d,h[h.length-1]||void 0))&&(u=pv(n(c,h)),u[0]===Ua))return u;if("children"in c&&c.children){const v=c;if(v.children&&u[0]!==fv)for(x=(s?v.children.length:-1)+a,w=h.concat(v);x>-1&&x<v.children.length;){const S=v.children[x];if(g=l(S,x,w)(),g[0]===Ua)return g;x=typeof g[1]=="number"?g[1]:x+a}}return u}}}function pv(t){return Array.isArray(t)?t:typeof t=="number"?[hv,t]:t==null?Uc:[t]}function Hc(t,e,n,s){let i,o,a;typeof e=="function"&&typeof n!="function"?(o=void 0,a=e,i=n):(o=e,a=n,i=s),mv(t,o,l,i);function l(c,d){const h=d[d.length-1],m=h?h.children.indexOf(c):void 0;return a(c,m,h)}}const Si={}.hasOwnProperty,gv={};function xv(t,e){const n=e||gv,s=new Map,i=new Map,o=new Map,a={...Yw,...n.handlers},l={all:d,applyData:yv,definitionById:s,footnoteById:i,footnoteCounts:o,footnoteOrder:[],handlers:a,one:c,options:n,patch:bv,wrap:vv};return Hc(t,function(h){if(h.type==="definition"||h.type==="footnoteDefinition"){const m=h.type==="definition"?s:i,p=String(h.identifier).toUpperCase();m.has(p)||m.set(p,h)}}),l;function c(h,m){const p=h.type,u=l.handlers[p];if(Si.call(l.handlers,p)&&u)return u(l,h,m);if(l.options.passThrough&&l.options.passThrough.includes(p)){if("children"in h){const{children:x,...w}=h,v=er(w);return v.children=l.all(h),v}return er(h)}return(l.options.unknownHandler||wv)(l,h,m)}function d(h){const m=[];if("children"in h){const p=h.children;let u=-1;for(;++u<p.length;){const g=l.one(p[u],h);if(g){if(u&&p[u-1].type==="break"&&(!Array.isArray(g)&&g.type==="text"&&(g.value=Ha(g.value)),!Array.isArray(g)&&g.type==="element")){const x=g.children[0];x&&x.type==="text"&&(x.value=Ha(x.value))}Array.isArray(g)?m.push(...g):m.push(g)}}}return m}}function bv(t,e){t.position&&(e.position=e0(t))}function yv(t,e){let n=e;if(t&&t.data){const s=t.data.hName,i=t.data.hChildren,o=t.data.hProperties;if(typeof s=="string")if(n.type==="element")n.tagName=s;else{const a="children"in n?n.children:[n];n={type:"element",tagName:s,properties:{},children:a}}n.type==="element"&&o&&Object.assign(n.properties,er(o)),"children"in n&&n.children&&i!==null&&i!==void 0&&(n.children=i)}return n}function wv(t,e){const n=e.data||{},s="value"in e&&!(Si.call(n,"hProperties")||Si.call(n,"hChildren"))?{type:"text",value:e.value}:{type:"element",tagName:"div",properties:{},children:t.all(e)};return t.patch(e,s),t.applyData(e,s)}function vv(t,e){const n=[];let s=-1;for(e&&n.push({type:"text",value:`
|
|
49
|
+
`});++s<t.length;)s&&n.push({type:"text",value:`
|
|
50
|
+
`}),n.push(t[s]);return e&&t.length>0&&n.push({type:"text",value:`
|
|
51
|
+
`}),n}function Ha(t){let e=0,n=t.charCodeAt(e);for(;n===9||n===32;)e++,n=t.charCodeAt(e);return t.slice(e)}function qa(t,e){const n=xv(t,e),s=n.one(t,void 0),i=ov(n),o=Array.isArray(s)?{type:"root",children:s}:s||{type:"root",children:[]};return i&&o.children.push({type:"text",value:`
|
|
52
|
+
`},i),o}function Sv(t,e){return t&&"run"in t?async function(n,s){const i=qa(n,{file:s,...e});await t.run(i,s)}:function(n,s){return qa(n,{file:s,...t||e})}}function Wa(t){if(t)throw t}var Mr,Ga;function jv(){if(Ga)return Mr;Ga=1;var t=Object.prototype.hasOwnProperty,e=Object.prototype.toString,n=Object.defineProperty,s=Object.getOwnPropertyDescriptor,i=function(d){return typeof Array.isArray=="function"?Array.isArray(d):e.call(d)==="[object Array]"},o=function(d){if(!d||e.call(d)!=="[object Object]")return!1;var h=t.call(d,"constructor"),m=d.constructor&&d.constructor.prototype&&t.call(d.constructor.prototype,"isPrototypeOf");if(d.constructor&&!h&&!m)return!1;var p;for(p in d);return typeof p>"u"||t.call(d,p)},a=function(d,h){n&&h.name==="__proto__"?n(d,h.name,{enumerable:!0,configurable:!0,value:h.newValue,writable:!0}):d[h.name]=h.newValue},l=function(d,h){if(h==="__proto__")if(t.call(d,h)){if(s)return s(d,h).value}else return;return d[h]};return Mr=function c(){var d,h,m,p,u,g,x=arguments[0],w=1,v=arguments.length,S=!1;for(typeof x=="boolean"&&(S=x,x=arguments[1]||{},w=2),(x==null||typeof x!="object"&&typeof x!="function")&&(x={});w<v;++w)if(d=arguments[w],d!=null)for(h in d)m=l(x,h),p=l(d,h),x!==p&&(S&&p&&(o(p)||(u=i(p)))?(u?(u=!1,g=m&&i(m)?m:[]):g=m&&o(m)?m:{},a(x,{name:h,newValue:c(S,g,p)})):typeof p<"u"&&a(x,{name:h,newValue:p}));return x},Mr}var kv=jv();const Or=wl(kv);function ji(t){if(typeof t!="object"||t===null)return!1;const e=Object.getPrototypeOf(t);return(e===null||e===Object.prototype||Object.getPrototypeOf(e)===null)&&!(Symbol.toStringTag in t)&&!(Symbol.iterator in t)}function Cv(){const t=[],e={run:n,use:s};return e;function n(...i){let o=-1;const a=i.pop();if(typeof a!="function")throw new TypeError("Expected function as last argument, not "+a);l(null,...i);function l(c,...d){const h=t[++o];let m=-1;if(c){a(c);return}for(;++m<i.length;)(d[m]===null||d[m]===void 0)&&(d[m]=i[m]);i=d,h?Nv(h,l)(...d):a(null,...d)}}function s(i){if(typeof i!="function")throw new TypeError("Expected `middelware` to be a function, not "+i);return t.push(i),e}}function Nv(t,e){let n;return s;function s(...a){const l=t.length>a.length;let c;l&&a.push(i);try{c=t.apply(this,a)}catch(d){const h=d;if(l&&n)throw h;return i(h)}l||(c&&c.then&&typeof c.then=="function"?c.then(o,i):c instanceof Error?i(c):o(c))}function i(a,...l){n||(n=!0,e(a,...l))}function o(a){i(null,a)}}const ft={basename:Ev,dirname:Pv,extname:Tv,join:Iv,sep:"/"};function Ev(t,e){if(e!==void 0&&typeof e!="string")throw new TypeError('"ext" argument must be a string');hs(t);let n=0,s=-1,i=t.length,o;if(e===void 0||e.length===0||e.length>t.length){for(;i--;)if(t.codePointAt(i)===47){if(o){n=i+1;break}}else s<0&&(o=!0,s=i+1);return s<0?"":t.slice(n,s)}if(e===t)return"";let a=-1,l=e.length-1;for(;i--;)if(t.codePointAt(i)===47){if(o){n=i+1;break}}else a<0&&(o=!0,a=i+1),l>-1&&(t.codePointAt(i)===e.codePointAt(l--)?l<0&&(s=i):(l=-1,s=a));return n===s?s=a:s<0&&(s=t.length),t.slice(n,s)}function Pv(t){if(hs(t),t.length===0)return".";let e=-1,n=t.length,s;for(;--n;)if(t.codePointAt(n)===47){if(s){e=n;break}}else s||(s=!0);return e<0?t.codePointAt(0)===47?"/":".":e===1&&t.codePointAt(0)===47?"//":t.slice(0,e)}function Tv(t){hs(t);let e=t.length,n=-1,s=0,i=-1,o=0,a;for(;e--;){const l=t.codePointAt(e);if(l===47){if(a){s=e+1;break}continue}n<0&&(a=!0,n=e+1),l===46?i<0?i=e:o!==1&&(o=1):i>-1&&(o=-1)}return i<0||n<0||o===0||o===1&&i===n-1&&i===s+1?"":t.slice(i,n)}function Iv(...t){let e=-1,n;for(;++e<t.length;)hs(t[e]),t[e]&&(n=n===void 0?t[e]:n+"/"+t[e]);return n===void 0?".":Av(n)}function Av(t){hs(t);const e=t.codePointAt(0)===47;let n=zv(t,!e);return n.length===0&&!e&&(n="."),n.length>0&&t.codePointAt(t.length-1)===47&&(n+="/"),e?"/"+n:n}function zv(t,e){let n="",s=0,i=-1,o=0,a=-1,l,c;for(;++a<=t.length;){if(a<t.length)l=t.codePointAt(a);else{if(l===47)break;l=47}if(l===47){if(!(i===a-1||o===1))if(i!==a-1&&o===2){if(n.length<2||s!==2||n.codePointAt(n.length-1)!==46||n.codePointAt(n.length-2)!==46){if(n.length>2){if(c=n.lastIndexOf("/"),c!==n.length-1){c<0?(n="",s=0):(n=n.slice(0,c),s=n.length-1-n.lastIndexOf("/")),i=a,o=0;continue}}else if(n.length>0){n="",s=0,i=a,o=0;continue}}e&&(n=n.length>0?n+"/..":"..",s=2)}else n.length>0?n+="/"+t.slice(i+1,a):n=t.slice(i+1,a),s=a-i-1;i=a,o=0}else l===46&&o>-1?o++:o=-1}return n}function hs(t){if(typeof t!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(t))}const Lv={cwd:Rv};function Rv(){return"/"}function ki(t){return!!(t!==null&&typeof t=="object"&&"href"in t&&t.href&&"protocol"in t&&t.protocol&&t.auth===void 0)}function _v(t){if(typeof t=="string")t=new URL(t);else if(!ki(t)){const e=new TypeError('The "path" argument must be of type string or an instance of URL. Received `'+t+"`");throw e.code="ERR_INVALID_ARG_TYPE",e}if(t.protocol!=="file:"){const e=new TypeError("The URL must be of scheme file");throw e.code="ERR_INVALID_URL_SCHEME",e}return Dv(t)}function Dv(t){if(t.hostname!==""){const s=new TypeError('File URL host must be "localhost" or empty on darwin');throw s.code="ERR_INVALID_FILE_URL_HOST",s}const e=t.pathname;let n=-1;for(;++n<e.length;)if(e.codePointAt(n)===37&&e.codePointAt(n+1)===50){const s=e.codePointAt(n+2);if(s===70||s===102){const i=new TypeError("File URL path must not include encoded / characters");throw i.code="ERR_INVALID_FILE_URL_PATH",i}}return decodeURIComponent(e)}const $r=["history","path","basename","stem","extname","dirname"];class qc{constructor(e){let n;e?ki(e)?n={path:e}:typeof e=="string"||Mv(e)?n={value:e}:n=e:n={},this.cwd="cwd"in n?"":Lv.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let s=-1;for(;++s<$r.length;){const o=$r[s];o in n&&n[o]!==void 0&&n[o]!==null&&(this[o]=o==="history"?[...n[o]]:n[o])}let i;for(i in n)$r.includes(i)||(this[i]=n[i])}get basename(){return typeof this.path=="string"?ft.basename(this.path):void 0}set basename(e){Br(e,"basename"),Fr(e,"basename"),this.path=ft.join(this.dirname||"",e)}get dirname(){return typeof this.path=="string"?ft.dirname(this.path):void 0}set dirname(e){Qa(this.basename,"dirname"),this.path=ft.join(e||"",this.basename)}get extname(){return typeof this.path=="string"?ft.extname(this.path):void 0}set extname(e){if(Fr(e,"extname"),Qa(this.dirname,"extname"),e){if(e.codePointAt(0)!==46)throw new Error("`extname` must start with `.`");if(e.includes(".",1))throw new Error("`extname` cannot contain multiple dots")}this.path=ft.join(this.dirname,this.stem+(e||""))}get path(){return this.history[this.history.length-1]}set path(e){ki(e)&&(e=_v(e)),Br(e,"path"),this.path!==e&&this.history.push(e)}get stem(){return typeof this.path=="string"?ft.basename(this.path,this.extname):void 0}set stem(e){Br(e,"stem"),Fr(e,"stem"),this.path=ft.join(this.dirname||"",e+(this.extname||""))}fail(e,n,s){const i=this.message(e,n,s);throw i.fatal=!0,i}info(e,n,s){const i=this.message(e,n,s);return i.fatal=void 0,i}message(e,n,s){const i=new Be(e,n,s);return this.path&&(i.name=this.path+":"+i.name,i.file=this.path),i.fatal=!1,this.messages.push(i),i}toString(e){return this.value===void 0?"":typeof this.value=="string"?this.value:new TextDecoder(e||void 0).decode(this.value)}}function Fr(t,e){if(t&&t.includes(ft.sep))throw new Error("`"+e+"` cannot be a path: did not expect `"+ft.sep+"`")}function Br(t,e){if(!t)throw new Error("`"+e+"` cannot be empty")}function Qa(t,e){if(!t)throw new Error("Setting `"+e+"` requires `path` to be set too")}function Mv(t){return!!(t&&typeof t=="object"&&"byteLength"in t&&"byteOffset"in t)}const Ov=(function(t){const s=this.constructor.prototype,i=s[t],o=function(){return i.apply(o,arguments)};return Object.setPrototypeOf(o,s),o}),$v={}.hasOwnProperty;class fo extends Ov{constructor(){super("copy"),this.Compiler=void 0,this.Parser=void 0,this.attachers=[],this.compiler=void 0,this.freezeIndex=-1,this.frozen=void 0,this.namespace={},this.parser=void 0,this.transformers=Cv()}copy(){const e=new fo;let n=-1;for(;++n<this.attachers.length;){const s=this.attachers[n];e.use(...s)}return e.data(Or(!0,{},this.namespace)),e}data(e,n){return typeof e=="string"?arguments.length===2?(Hr("data",this.frozen),this.namespace[e]=n,this):$v.call(this.namespace,e)&&this.namespace[e]||void 0:e?(Hr("data",this.frozen),this.namespace=e,this):this.namespace}freeze(){if(this.frozen)return this;const e=this;for(;++this.freezeIndex<this.attachers.length;){const[n,...s]=this.attachers[this.freezeIndex];if(s[0]===!1)continue;s[0]===!0&&(s[0]=void 0);const i=n.call(e,...s);typeof i=="function"&&this.transformers.use(i)}return this.frozen=!0,this.freezeIndex=Number.POSITIVE_INFINITY,this}parse(e){this.freeze();const n=vs(e),s=this.parser||this.Parser;return Vr("parse",s),s(String(n),n)}process(e,n){const s=this;return this.freeze(),Vr("process",this.parser||this.Parser),Ur("process",this.compiler||this.Compiler),n?i(void 0,n):new Promise(i);function i(o,a){const l=vs(e),c=s.parse(l);s.run(c,l,function(h,m,p){if(h||!m||!p)return d(h);const u=m,g=s.stringify(u,p);Vv(g)?p.value=g:p.result=g,d(h,p)});function d(h,m){h||!m?a(h):o?o(m):n(void 0,m)}}}processSync(e){let n=!1,s;return this.freeze(),Vr("processSync",this.parser||this.Parser),Ur("processSync",this.compiler||this.Compiler),this.process(e,i),Ka("processSync","process",n),s;function i(o,a){n=!0,Wa(o),s=a}}run(e,n,s){Ja(e),this.freeze();const i=this.transformers;return!s&&typeof n=="function"&&(s=n,n=void 0),s?o(void 0,s):new Promise(o);function o(a,l){const c=vs(n);i.run(e,c,d);function d(h,m,p){const u=m||e;h?l(h):a?a(u):s(void 0,u,p)}}}runSync(e,n){let s=!1,i;return this.run(e,n,o),Ka("runSync","run",s),i;function o(a,l){Wa(a),i=l,s=!0}}stringify(e,n){this.freeze();const s=vs(n),i=this.compiler||this.Compiler;return Ur("stringify",i),Ja(e),i(e,s)}use(e,...n){const s=this.attachers,i=this.namespace;if(Hr("use",this.frozen),e!=null)if(typeof e=="function")c(e,n);else if(typeof e=="object")Array.isArray(e)?l(e):a(e);else throw new TypeError("Expected usable value, not `"+e+"`");return this;function o(d){if(typeof d=="function")c(d,[]);else if(typeof d=="object")if(Array.isArray(d)){const[h,...m]=d;c(h,m)}else a(d);else throw new TypeError("Expected usable value, not `"+d+"`")}function a(d){if(!("plugins"in d)&&!("settings"in d))throw new Error("Expected usable value but received an empty preset, which is probably a mistake: presets typically come with `plugins` and sometimes with `settings`, but this has neither");l(d.plugins),d.settings&&(i.settings=Or(!0,i.settings,d.settings))}function l(d){let h=-1;if(d!=null)if(Array.isArray(d))for(;++h<d.length;){const m=d[h];o(m)}else throw new TypeError("Expected a list of plugins, not `"+d+"`")}function c(d,h){let m=-1,p=-1;for(;++m<s.length;)if(s[m][0]===d){p=m;break}if(p===-1)s.push([d,...h]);else if(h.length>0){let[u,...g]=h;const x=s[p][1];ji(x)&&ji(u)&&(u=Or(!0,x,u)),s[p]=[d,u,...g]}}}}const Fv=new fo().freeze();function Vr(t,e){if(typeof e!="function")throw new TypeError("Cannot `"+t+"` without `parser`")}function Ur(t,e){if(typeof e!="function")throw new TypeError("Cannot `"+t+"` without `compiler`")}function Hr(t,e){if(e)throw new Error("Cannot call `"+t+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function Ja(t){if(!ji(t)||typeof t.type!="string")throw new TypeError("Expected node, got `"+t+"`")}function Ka(t,e,n){if(!n)throw new Error("`"+t+"` finished async. Use `"+e+"` instead")}function vs(t){return Bv(t)?t:new qc(t)}function Bv(t){return!!(t&&typeof t=="object"&&"message"in t&&"messages"in t)}function Vv(t){return typeof t=="string"||Uv(t)}function Uv(t){return!!(t&&typeof t=="object"&&"byteLength"in t&&"byteOffset"in t)}const Hv="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",Za=[],Ya={allowDangerousHtml:!0},qv=/^(https?|ircs?|mailto|xmpp)$/i,Wv=[{from:"astPlugins",id:"remove-buggy-html-in-markdown-parser"},{from:"allowDangerousHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"allowNode",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowElement"},{from:"allowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowedElements"},{from:"className",id:"remove-classname"},{from:"disallowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"disallowedElements"},{from:"escapeHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"includeElementIndex",id:"#remove-includeelementindex"},{from:"includeNodeIndex",id:"change-includenodeindex-to-includeelementindex"},{from:"linkTarget",id:"remove-linktarget"},{from:"plugins",id:"change-plugins-to-remarkplugins",to:"remarkPlugins"},{from:"rawSourcePos",id:"#remove-rawsourcepos"},{from:"renderers",id:"change-renderers-to-components",to:"components"},{from:"source",id:"change-source-to-children",to:"children"},{from:"sourcePos",id:"#remove-sourcepos"},{from:"transformImageUri",id:"#add-urltransform",to:"urlTransform"},{from:"transformLinkUri",id:"#add-urltransform",to:"urlTransform"}];function Gv(t){const e=Qv(t),n=Jv(t);return Kv(e.runSync(e.parse(n),n),t)}function Qv(t){const e=t.rehypePlugins||Za,n=t.remarkPlugins||Za,s=t.remarkRehypeOptions?{...t.remarkRehypeOptions,...Ya}:Ya;return Fv().use(Nw).use(n).use(Sv,s).use(e)}function Jv(t){const e=t.children||"",n=new qc;return typeof e=="string"&&(n.value=e),n}function Kv(t,e){const n=e.allowedElements,s=e.allowElement,i=e.components,o=e.disallowedElements,a=e.skipHtml,l=e.unwrapDisallowed,c=e.urlTransform||Zv;for(const h of Wv)Object.hasOwn(e,h.from)&&(""+h.from+(h.to?"use `"+h.to+"` instead":"remove it")+Hv+h.id,void 0);return Hc(t,d),i0(t,{Fragment:r.Fragment,components:i,ignoreInvalidStyle:!0,jsx:r.jsx,jsxs:r.jsxs,passKeys:!0,passNode:!0});function d(h,m,p){if(h.type==="raw"&&p&&typeof m=="number")return a?p.children.splice(m,1):p.children[m]={type:"text",value:h.value},m;if(h.type==="element"){let u;for(u in Rr)if(Object.hasOwn(Rr,u)&&Object.hasOwn(h.properties,u)){const g=h.properties[u],x=Rr[u];(x===null||x.includes(h.tagName))&&(h.properties[u]=c(String(g||""),u,h))}}if(h.type==="element"){let u=n?!n.includes(h.tagName):o?o.includes(h.tagName):!1;if(!u&&s&&typeof m=="number"&&(u=!s(h,m,p)),u&&p&&typeof m=="number")return l&&h.children?p.children.splice(m,1,...h.children):p.children.splice(m,1),m}}}function Zv(t){const e=t.indexOf(":"),n=t.indexOf("?"),s=t.indexOf("#"),i=t.indexOf("/");return e===-1||i!==-1&&e>i||n!==-1&&e>n||s!==-1&&e>s||qv.test(t.slice(0,e))?t:""}const Yv=(t,e)=>{const n=t?t.trim():"New Course";switch(e){case"Mathematics":return`# ${n}
|
|
53
|
+
|
|
54
|
+
## 101 Course Core Foundations
|
|
55
|
+
Welcome to our mathematics laboratory. This course is designed to break down abstract calculations into visual whiteboard proofs and real-world application models.
|
|
56
|
+
|
|
57
|
+
### 📐 Key Theorems & Proof Matrix
|
|
58
|
+
- **Formula A**: $E = mc^2$ or equivalent derivative parameters
|
|
59
|
+
- **Core Axiom**: For every linear projection, a finite dimension defines its trace.
|
|
60
|
+
|
|
61
|
+
### 实践演练随堂真题 Practice Problems
|
|
62
|
+
1. Calculate the local optima for the function on the interactive workspace.
|
|
63
|
+
2. Prove the uniqueness of the residual limit under Gaussian conditions.
|
|
64
|
+
|
|
65
|
+
### 📥 Homework Assignment Task
|
|
66
|
+
Identify three real-world physical structures implementing these spatial principles and coordinate maps.`;case"ComputerScience":return`# ${n}
|
|
67
|
+
|
|
68
|
+
## 💻 Technical Exploration & Engineering Lab
|
|
69
|
+
This session acts as an immersive sandbox exploring core algorithmic structures, optimization mechanics, and data abstractions.
|
|
70
|
+
|
|
71
|
+
### ⚙️ Core Lecture Blueprint & Pseudocode
|
|
72
|
+
\`\`\`python
|
|
73
|
+
def optimize_weights(data, factor=0.01):
|
|
74
|
+
# Initialize local metrics
|
|
75
|
+
scores = [x * factor for x in data]
|
|
76
|
+
return sum(scores) / len(scores)
|
|
77
|
+
\`\`\`
|
|
78
|
+
|
|
79
|
+
### ⚡ Laboratory Workspace Drill
|
|
80
|
+
- **Objective**: Develop a linear hash-map with zero-collision distribution.
|
|
81
|
+
- **Action**: Use the interactive canvas to sketch data pipelines.
|
|
82
|
+
|
|
83
|
+
### 📝 Post-Class Evaluation
|
|
84
|
+
Write a 200-word critique analyzing memory-locality vs execution-speed trade-offs in low-level registers.`;case"Literature":return`# ${n}
|
|
85
|
+
|
|
86
|
+
## ✍️ Literary Critical Analysis Seminar
|
|
87
|
+
This curriculum evaluates textual aesthetics, semantic patterns, subtextual symbols, and historical contexts across classic paradigms.
|
|
88
|
+
|
|
89
|
+
### 🏛️ Classic Textual Excerpts
|
|
90
|
+
> "Reality represents a state of constant translation between what is experienced and what is chronicled."
|
|
91
|
+
|
|
92
|
+
### 💭 Critique Evaluation Metrics
|
|
93
|
+
- **Theme Assessment**: Analyze structural ironies within contemporary essays.
|
|
94
|
+
- **Author Intention**: Focus on pacing triggers and character foils.
|
|
95
|
+
|
|
96
|
+
### 💬 Classroom Collaborative Debate Topics
|
|
97
|
+
Does digital notation diminish the biological connection to textual journaling? Discuss under 15 minutes framework.`;case"Physics":return`# ${n}
|
|
98
|
+
|
|
99
|
+
## ⚡ Experimental Physics & Natural Science Sandbox
|
|
100
|
+
In this session, theoretical models undergo practical validation through interactive virtual whiteboard modeling and numerical measurements.
|
|
101
|
+
|
|
102
|
+
### 🔬 Key Mechanical Principles & Constraints
|
|
103
|
+
- **Axiom 1**: Momentum is conserved in closed coordinate vectors.
|
|
104
|
+
- **Axiom 2**: Resistance is directly proportional to temperature factors.
|
|
105
|
+
|
|
106
|
+
### 🛠️ Lab Step-by-Step Procedure
|
|
107
|
+
1. Plot the force vectors acting on the balance coordinate vertices.
|
|
108
|
+
2. Measure the velocity coefficients across three alternate trial loops.
|
|
109
|
+
|
|
110
|
+
### 📝 Homework Assignment Evaluation
|
|
111
|
+
Calculate energy loss ratios using standard mathematical integrals in your journal.`;case"History":return`# ${n}
|
|
112
|
+
|
|
113
|
+
## 🏛️ Geopolitical Context Mapping & Historical Context
|
|
114
|
+
This course explores historical trends, decision frameworks, resource patterns, and socio-economic influences that shaped modern civilization.
|
|
115
|
+
|
|
116
|
+
### 🗺️ Context Timeline Focus
|
|
117
|
+
- **Phase A**: Resource migration patterns along major trade waterways.
|
|
118
|
+
- **Phase B**: Strategic institutional reforms and cultural integration cycles.
|
|
119
|
+
|
|
120
|
+
### 🔍 Primary Source Critique Work
|
|
121
|
+
Analyze the 18th-century legislative documents for bias, context gaps, and underlying socio-economic drivers.
|
|
122
|
+
|
|
123
|
+
### 💬 Group Discussion Prompts
|
|
124
|
+
How did geography influence the longevity of ancient administrative models?`;case"Art":return`# ${n}
|
|
125
|
+
|
|
126
|
+
## 🎨 Visual Composition & Creative Sketching Studio
|
|
127
|
+
A workshop focusing on aesthetic principles, negative space ratios, visual balance, and dynamic typography models.
|
|
128
|
+
|
|
129
|
+
### 🖌️ Design Principles
|
|
130
|
+
- **Golden Spiral**: Align critical focal points with recursive visual arcs.
|
|
131
|
+
- **Chiaroscuro**: Leverage deep high-contrast shading to establish three-dimensional form.
|
|
132
|
+
|
|
133
|
+
### 🛠️ Whiteboard Practical Sandbox Project
|
|
134
|
+
Collaborate on the dynamic canvas to draft a raw responsive layout using minimal monochromatic blocks.
|
|
135
|
+
|
|
136
|
+
### 🎨 Portfolio Task
|
|
137
|
+
Submit three divergent conceptual drafts representing active space constraints.`;default:return`# ${n}
|
|
138
|
+
|
|
139
|
+
## 🔮 Multidisciplinary Advanced Exploration & Research
|
|
140
|
+
This course integrates cross-subject paradigms, cognitive practices, and critical reasoning methods.
|
|
141
|
+
|
|
142
|
+
### 📚 Course Syllabus Modules
|
|
143
|
+
- **Module 1**: Core theoretical grounding and conceptual models.
|
|
144
|
+
- **Module 2**: Practical exercises combining research and action.
|
|
145
|
+
|
|
146
|
+
### 📝 Interactive Classroom Tasks
|
|
147
|
+
1. Formulate 2 key research queries aligning with this lecture.
|
|
148
|
+
2. Sketch the systemic flow diagram depicting interaction factors.
|
|
149
|
+
|
|
150
|
+
### 📥 Assignment Brief
|
|
151
|
+
Draft a 300-word integration proposal based on today's whiteboard exercises.`}},Xa={zh:{migratableBadge:"可迁移",migrateToFormat:"迁移到新格式",migrationPromptHeading:"发现可迁移的旧格式插件",migrationPromptBody:"该插件使用旧格式运行。上传新格式 ZIP 包以完成迁移,迁移后旧版本可安全卸载。",zipParseError:"ZIP 文件解析失败,请确认文件包含有效的 manifest.json",workerActivationError:"插件在 Worker 环境中激活失败,请检查插件代码与浏览器兼容性",extensionLoadError:"扩展组件加载失败",retry:"重新加载",noExtensionPoints:"暂无已注册的扩展组件",dropZipHere:"拖拽 ZIP 文件到此处",zipFileHint:"仅支持 .zip 格式的插件包",analyzing:"分析中...",dragActive:"释放以上传",legacyTooltip:"该插件使用旧执行格式运行。新格式版本可能可用。",ready:"就绪",uploadZipPlugin:"上传并安装 ZIP 插件",agentTitle:"内核助手",agentSubtitle:"自主 Shell 控制器",agentIntro:"你好!我是你的教育系统 OS 内核助手。你可以让我“创建一节物理课并在白板上画一个圆”,我将通过底层总线为你构建。",placeholder:"例如:创建一节历史课并画一张地图...",dashboard:"系统总览",kernelRunning:"系统正常运行",lessons:"课程",noLessons:"暂无课程。请让助手创建一节课!",noContent:"无内容...",whiteboardCanvas:"白板画布",emptyWhiteboard:"白板为空",simulationError:"系统错误:执行 OS 命令失败。",executedCommands:"执行的命令:",switchLang:"Switch to English",plugins:"插件中心",uploadPlugin:"上传并安装插件",pluginSource:"扩展插件源码 (JS)",installPlugin:"验证并安装",installing:"安装中...",installedPlugins:"已运行插件",noPlugins:"未发现第三方插件",lessonContent:"课程教案与笔记",eventStream:"内核审计事件流",selectLesson:"请先在左侧选择一节课程",systemLogs:"系统日志",hideLogs:"隐藏日志",showLogs:"显示日志",approvals:"待审批高危操作",approve:"批准",reject:"拒绝",noApprovals:"暂无待审批命令",fileSystem:"虚拟文件系统",noFiles:"当前目录为空",processes:"进程管理",noProcesses:"没有正在运行的进程",processLogs:"查看日志",classes:"班级管理",students:"学生管理",noClasses:"暂无班级",noStudents:"暂无学生"},en:{migratableBadge:"Migratable",migrateToFormat:"Migrate to New Format",migrationPromptHeading:"Legacy Plugin Detected",migrationPromptBody:"This plugin runs in legacy mode. Upload a new-format ZIP package to migrate. The old version can be safely uninstalled afterwards.",zipParseError:"Failed to parse ZIP file. Ensure the package contains a valid manifest.json.",workerActivationError:"Plugin activation in Worker environment failed. Check plugin code and browser compatibility.",extensionLoadError:"Extension failed to load",retry:"Retry Load",noExtensionPoints:"No extension points registered",dropZipHere:"Drop ZIP file here",zipFileHint:".zip plugin packages only",analyzing:"Analyzing...",dragActive:"Release to upload",legacyTooltip:"This plugin uses the old execution format. A new-format version may be available.",ready:"Ready",uploadZipPlugin:"Upload & Install ZIP Plugin",agentTitle:"Kernel Agent",agentSubtitle:"Autonomous Shell Controller",agentIntro:'Hello! I am your Educational OS Kernel Agent. You can ask me to "create a physics lesson and draw a circle on its whiteboard" and I will use the Command Bus to build it.',placeholder:"e.g. Create a history lesson and draw a map...",dashboard:"OS Dashboard",kernelRunning:"Kernel Running",lessons:"Lessons",noLessons:"No lessons yet. Ask the Agent to create one!",noContent:"No content...",whiteboardCanvas:"Whiteboard Canvas",emptyWhiteboard:"Empty Whiteboard",simulationError:"Simulation Error: Failed to execute OS command.",executedCommands:"Executed Commands: ",switchLang:"切换到中文",plugins:"Plugin Center",uploadPlugin:"Upload & Install Plugin",pluginSource:"Extension Source Code (JS)",installPlugin:"Validate & Install",installing:"Installing...",installedPlugins:"Running Plugins",noPlugins:"No 3rd-party plugins found",lessonContent:"Lesson Content & Notes",eventStream:"Kernel Audit Event Stream",selectLesson:"Please select a lesson from the left",systemLogs:"System Logs",hideLogs:"Hide Logs",showLogs:"Show Logs",approvals:"Pending Approvals",approve:"Approve",reject:"Reject",noApprovals:"No pending commands",fileSystem:"Virtual File System",noFiles:"Directory is empty",processes:"Process Manager",noProcesses:"No active processes",processLogs:"View Logs",classes:"Classes",students:"Students",noClasses:"No classes found",noStudents:"No students found"}};function Xv(){return{addToast:f.useCallback((e,n,s="info")=>{const i=Math.random().toString(36).substring(2,9);Ne.getState().addToast({id:i,title:e,message:n,type:s}),setTimeout(()=>{Ne.getState().removeToast(i)},6e3)},[])}}function eS(){f.useEffect(()=>{if(typeof window>"u")return;const t=o=>{const a=o.reason,l=a instanceof Error?a.message:typeof a=="string"?a:JSON.stringify(a)||"Unhandled promise rejection",c=a instanceof Error?a.stack:void 0;Dt.getState().addError({type:"promise",title:"未捕获的异步异常 (Unhandled Promise)",message:l,stack:c}),console.warn("[GlobalErrorCapture] Caught unhandled rejection:",a)},e=o=>{if(!o.message&&!o.error)return;const a=o.message||(o.error?.message??"Unknown script error"),l=o.error?.stack;Dt.getState().addError({type:"runtime",title:"JavaScript 运行时错误 (Runtime Error)",message:a,stack:l}),console.warn("[GlobalErrorCapture] Caught window error:",o.error||o.message)},n=window.fetch,s=async(...o)=>{try{const a=await n(...o);if(!a.ok&&a.status>=500)try{const c=await a.clone().text();let d="";try{const p=JSON.parse(c);d=p.error||p.message||p.details||c}catch{d=c.slice(0,300)}const h=o[0],m=typeof h=="string"?h:h instanceof Request?h.url:String(h);Dt.getState().addError({type:"api",title:`服务端接口错误 (HTTP ${a.status})`,message:d||`Request failed with status ${a.status}`,endpoint:m,status:a.status})}catch{}return a}catch(a){const l=o[0],c=typeof l=="string"?l:l instanceof Request?l.url:String(l);throw c&&(c.startsWith("/api")||c.includes("/api/"))&&Dt.getState().addError({type:"api",title:"网络请求失败 (Network Disconnected / Error)",message:a?.message||"Failed to fetch API endpoint",endpoint:c,stack:a?.stack}),a}},i=Eb(o=>{try{const a=Ne.getState(),l=typeof window<"u"&&(new URLSearchParams(window.location.search).get("mode")==="student_live"||window.location.hash.includes("student_live"));if(!(a.session?.role==="student"||l))return;const d=typeof window<"u"?new URLSearchParams(window.location.search):null,h=a.session?.userId||d?.get("studentId")||"anonymous_student",m=a.session?.name||a.session?.username||d?.get("studentName")||h,p=a.selectedLesson||d?.get("lessonId")||null,u=a.liveClassSelectedClassId||d?.get("classId")||null,g={studentId:h,studentName:m,lessonId:p,classId:u,error:o},x=tt();if(x&&x.connected)x.emit("student-client-error",g);else{const w="/api/diagnostics/report",v=JSON.stringify(g);typeof navigator<"u"&&navigator.sendBeacon?navigator.sendBeacon(w,new Blob([v],{type:"application/json"})):fetch(w,{method:"POST",headers:{"Content-Type":"application/json"},body:v}).catch(()=>{})}}catch(a){console.warn("[GlobalErrorCapture] Failed to report student error:",a)}});return window.fetch=s,window.addEventListener("unhandledrejection",t),window.addEventListener("error",e),()=>{window.fetch=n,window.removeEventListener("unhandledrejection",t),window.removeEventListener("error",e),i()}},[])}async function tS(){const t=await fetch("/api/resources");return t.ok?{ok:!0,data:await t.json()}:{ok:!1}}async function nS(){const t=await fetch("/api/db-status");let e;try{e=await t.json()}catch{e={}}return{ok:t.ok,status:t.status,data:e}}async function sS(){const t=await fetch("/api/auth/session");return t.ok?{ok:!0,data:await t.json()}:{ok:!1}}async function rS(){const t=await fetch("/api/site-settings");return t.ok?{ok:!0,data:await t.json()}:{ok:!1}}async function iS(){await fetch("/api/auth/logout",{method:"POST"})}function oS(t){const{fetchStudents:e}=t,n=ue(b=>b.session),s=ue(b=>b.setSession),i=ue(b=>b.lang),o=ue(b=>b.setLang),[a,l]=f.useState("teacher"),[c,d]=f.useState(!0),[h,m]=f.useState("normal"),[p,u]=f.useState(null),[g,x]=f.useState(!1);return f.useEffect(()=>{if(!n)return;const b=async()=>{try{const{ok:N,status:y,data:P}=await nS();N?(P.status==="warning"||P.warning?m("warning"):m("normal"),d(!0)):y===429||y===503?(m("warning"),d(!0)):(m("error"),d(!1))}catch{m("error"),d(!1)}};b();const C=setInterval(b,5e3);return()=>clearInterval(C)},[n]),f.useEffect(()=>{(async()=>{try{const{ok:C,data:N}=await rS();C&&Ne.getState().setSiteInfo({siteName:N.siteName||"",slogan:N.slogan||"",logoUrl:N.logoUrl||null})}catch(C){console.warn("Failed to fetch site settings:",C)}})()},[]),{session:n,setSession:s,lang:i,setLang:o,activeRole:a,setActiveRole:l,setActiveStudentId:u,activeStudentId:p,dbConnected:c,dbStatus:h,profileOpen:g,setProfileOpen:x,handleLoginSuccess:b=>{s(b),b.role==="teacher"?(l("teacher"),Ne.getState().setTeacherTab("live_class")):(l("student"),u(b.studentId),e())},handleLogout:async()=>{try{await iS()}catch(b){console.error("Logout failed",b)}s(null)},toggleLanguage:()=>{o(i==="zh"?"en":"zh")}}}function aS(t){const{activeStudentId:e,activeRole:n,students:s,liveClassFocusLocked:i,setIsFollowingTeacher:o,lang:a,addToast:l}=t,[c,d]=f.useState("dashboard"),h=n==="student"&&(!!e&&!!s.find(P=>P.id===e)?.locked_lesson_id||i),m=f.useRef(h),p=f.useRef(c);f.useEffect(()=>{m.current=h,p.current=c},[h,c]),f.useEffect(()=>{h&&(o(!0),d("lesson"))},[h]);const u=P=>{const L=typeof P=="function"?P(p.current):P;if(m.current&&L!=="lesson"){g();return}d(L)},g=()=>{l(a==="zh"?"🔒 全班专注锁定":"🔒 Class Focus Locked",a==="zh"?"老师已开启全班专注锁定,暂时无法切换页面,请跟随教师当前授课内容。":"The teacher locked the class focus. Navigation is disabled — please follow the current lesson.","warning")},[x,w]=f.useState("whiteboard"),[v,S]=f.useState(null),[b,C]=f.useState("none"),[N,y]=f.useState(!0);return f.useEffect(()=>{c!=="lesson"&&y(!0)},[c]),{studentViewStatus:c,setStudentViewStatus:u,isStudentLocked:h,studentLessonTab:x,setStudentLessonTab:w,studentSelectedCourseware:v,setStudentSelectedCourseware:S,studentFullscreenPanel:b,setStudentFullscreenPanel:C,isStudentLessonContentCollapsed:N,setIsStudentLessonContentCollapsed:y,notifyLockedNavigation:g}}function lS(t){return"#/"+t}function el(t){const e=t.replace(/^#/,"");return!e||e==="/"?null:e.replace(/^\//,"")}function cS({lang:t,addToast:e,fetchStudents:n}){const[s,i]=f.useState(!1),o=typeof window<"u"&&(new URLSearchParams(window.location.search).get("mode")==="student_live"||window.location.hash.includes("student_live")),a=typeof window<"u"?new URLSearchParams(window.location.search).get("studentId"):null,l=typeof window<"u"?new URLSearchParams(window.location.search).get("lessonId"):null,c=typeof window<"u"?new URLSearchParams(window.location.search).get("classId"):null,d=typeof window<"u"&&(new URLSearchParams(window.location.search).get("mode")==="stage_display"||window.location.hash.includes("stage_display")),h=typeof window<"u"?new URLSearchParams(window.location.search).get("lessonId"):null,m=typeof window<"u"?new URLSearchParams(window.location.search).get("title"):null,p=typeof window<"u"?new URLSearchParams(window.location.search).get("lang"):null,u=typeof window<"u"&&(new URLSearchParams(window.location.search).get("mode")==="student_preview"||window.location.hash.includes("student_preview")),g=o||u,[x,w]=f.useState(!0),[v,S]=f.useState(!1);f.useEffect(()=>{lr.getState().initTheme(),on.getState().initFontSize();const le=he=>{(he.ctrlKey||he.metaKey)&&he.altKey&&(he.key==="+"||he.key==="="?(he.preventDefault(),on.getState().increaseScale()):he.key==="-"||he.key==="_"?(he.preventDefault(),on.getState().decreaseScale()):he.key==="0"&&(he.preventDefault(),on.getState().resetScale()))};return window.addEventListener("keydown",le),()=>window.removeEventListener("keydown",le)},[]);const b=ue(le=>le.session),C=ue(le=>le.setSession),[N,y]=f.useState(!0),P=oS({fetchStudents:n}),{activeRole:L,setActiveRole:_,activeStudentId:O,setActiveStudentId:T,dbConnected:A,dbStatus:R,profileOpen:D,setProfileOpen:I,handleLoginSuccess:$,handleLogout:U,toggleLanguage:E}=P,F=ue(le=>le.students),j=ue(le=>le.setSelectedLesson),B=aS({activeStudentId:O,activeRole:L,students:F,liveClassFocusLocked:v,setIsFollowingTeacher:w,lang:t,addToast:e}),{studentViewStatus:X,setStudentViewStatus:k,isStudentLocked:q,studentLessonTab:J,setStudentLessonTab:G,studentSelectedCourseware:re,setStudentSelectedCourseware:Y,studentFullscreenPanel:ye,setStudentFullscreenPanel:ee,isStudentLessonContentCollapsed:z,setIsStudentLessonContentCollapsed:W,notifyLockedNavigation:K}=B;f.useEffect(()=>{(async()=>{try{const{ok:he,data:Ce}=await sS();if(he&&Ce&&Ce.session)if(C(Ce.session),g){_("student"),k("lesson");const Ee=a||Ce.session.studentId;Ee&&T(Ee),l&&j(l),n()}else _(Ce.session.role),Ce.session.role==="student"&&Ce.session.studentId&&(T(Ce.session.studentId),n())}catch(he){console.warn("Session check failed",he)}finally{y(!1)}})()},[]);const ne=ue(le=>le.teacherTab),te=ue(le=>le.setTeacherTab);f.useEffect(()=>{if(g||d)return;const le=()=>{const Ce=el(window.location.hash);Ce&&Ce!==Ne.getState().teacherTab&&te(Ce)};window.addEventListener("hashchange",le);const he=el(window.location.hash);return he&&te(he),()=>window.removeEventListener("hashchange",le)},[te,g,d]),f.useEffect(()=>{if(g||d)return;const le=lS(ne);window.location.hash!==le&&(window.location.hash=le)},[ne,te,g,d]);const[me,je]=f.useState(!1),[Q,se]=f.useState(!1),[Z,pe]=f.useState(!1);return f.useEffect(()=>{b?.subRole==="administrator"&&localStorage.getItem("edu_os_tour_completed")!=="true"&&je(!0)},[b]),f.useEffect(()=>{ne==="live_class"&&i(!0)},[ne]),{mainNavCollapsed:s,setMainNavCollapsed:i,isStudentLiveMode:o,liveStudentParam:a,liveLessonParam:l,liveClassParam:c,isStageDisplayMode:d,stageLessonParam:h,stageTitleParam:m,stageLangParam:p,isStudentPreviewMode:u,isStudentTabMode:g,isFollowingTeacher:x,setIsFollowingTeacher:w,liveClassFocusLocked:v,setLiveClassFocusLocked:S,session:b,setSession:C,sessionLoading:N,fetchStudents:n,sessionBootstrapData:P,activeRole:L,setActiveRole:_,activeStudentId:O,setActiveStudentId:T,dbConnected:A,dbStatus:R,profileOpen:D,setProfileOpen:I,handleLoginSuccess:$,handleLogout:U,toggleLanguage:E,students:F,setSelectedLesson:j,studentViewStateData:B,studentViewStatus:X,setStudentViewStatus:k,isStudentLocked:q,studentLessonTab:J,setStudentLessonTab:G,studentSelectedCourseware:re,setStudentSelectedCourseware:Y,studentFullscreenPanel:ye,setStudentFullscreenPanel:ee,isStudentLessonContentCollapsed:z,setIsStudentLessonContentCollapsed:W,notifyLockedNavigation:K,teacherTab:ne,setTeacherTab:te,isTourOpen:me,setIsTourOpen:je,isApprovalsCollapsed:Q,setIsApprovalsCollapsed:se,isProcessesCollapsed:Z,setIsProcessesCollapsed:pe}}function dS(t){const[e,n]=f.useState(""),[s,i]=f.useState("recent"),[o,a]=f.useState(!1),[l,c]=f.useState(!1),[d,h]=f.useState(!1),[m,p]=f.useState(null),u=f.useMemo(()=>{let g=[...t];if(e.trim()){const x=e.toLowerCase();g=g.filter(w=>w.title.toLowerCase().includes(x)||w.content.toLowerCase().includes(x))}if(o&&(g=g.filter(x=>(x.enrollment_count||0)>0)),l&&(g=g.filter(x=>x.content&&x.content.trim().length>0)),d){const x=new Date(new Date().getFullYear(),new Date().getMonth(),1).getTime();g=g.filter(w=>(w.created_at||0)>=x)}return s==="recent"?g.sort((x,w)=>(w.created_at||0)-(x.created_at||0)):s==="alphabetical"?g.sort((x,w)=>x.title.localeCompare(w.title)):s==="enrollment"&&g.sort((x,w)=>(w.enrollment_count||0)-(x.enrollment_count||0)),g},[t,e,s,o,l,d]);return{lessonsSearchQuery:e,setLessonsSearchQuery:n,lessonsSortOrder:s,setLessonsSortOrder:i,filterEnrollment:o,setFilterEnrollment:a,filterHasContent:l,setFilterHasContent:c,filterThisMonth:d,setFilterThisMonth:h,copyingLessonId:m,setCopyingLessonId:p,filteredAndSortedLessons:u}}function uS(){const[t,e]=f.useState([]),[n,s]=f.useState(!1),[i,o]=f.useState({lab_id:null,seats:[]}),[a,l]=f.useState(!1),[c,d]=f.useState([]),[h,m]=f.useState({}),[p,u]=f.useState({}),[g,x]=f.useState(null),[w,v]=f.useState(""),[S,b]=f.useState(""),C=f.useCallback(async()=>{try{s(!0);const _=await fetch("/api/labs");_.ok&&e(await _.json())}catch(_){console.error(_)}finally{s(!1)}},[]),N=f.useCallback(async _=>{try{const O=await fetch(`/api/classes/${_}/seats`);if(O.ok){const T=await O.json();o(T)}}catch(O){console.error(O)}},[]),y=f.useCallback(async()=>{try{const _=new Date().toISOString().split("T")[0],O=await fetch(`/api/schedules/today?date=${_}`);if(O.ok){const T=await O.json();T.success&&T.schedules&&d(T.schedules)}}catch(_){console.warn("Failed to fetch today schedules",_)}},[]),P=f.useCallback(async _=>{try{const O=await fetch(`/api/classes/${_}/schedules`);if(O.ok){const T=await O.json();m(A=>({...A,[_]:T}))}}catch{}},[]),L=f.useCallback(async _=>{try{const O=await fetch(`/api/schedules/${_}/attendance`);if(O.ok){const T=await O.json();u(A=>({...A,[_]:T}))}}catch{}},[]);return{computerLabs:t,setComputerLabs:e,loadingLabs:n,setLoadingLabs:s,fetchLabs:C,classSeats:i,setClassSeats:o,savingSeats:a,setSavingSeats:l,fetchClassSeats:N,todaySchedules:c,setTodaySchedules:d,fetchTodaySchedules:y,classSchedulesMap:h,setClassSchedulesMap:m,fetchClassSchedules:P,scheduleAttendanceMap:p,setScheduleAttendanceMap:u,fetchScheduleAttendance:L,expandedScheduleId:g,setExpandedScheduleId:x,newScheduleDate:w,setNewScheduleDate:v,newScheduleLessonId:S,setNewScheduleLessonId:b}}function hS(t){const{lang:e,addToast:n,setCopyingLessonId:s}=t,i=ue(u=>u.selectedLesson),o=ue(u=>u.setSelectedLesson),a=ue(u=>u.setElements),l=f.useRef(""),c=async()=>{await Ne.getState().loadLessons()};return{fetchLessons:c,handleQuickCreateLesson:async(u,g)=>{try{const{ok:x,data:w}=await bp({title:u,content:g});if(x)return await c(),w.id||"lesson-created"}catch(x){console.error("Quick create lesson failed",x)}return""},handleDeleteCourse:async u=>{const{ok:g,data:x}=await yp(u);if(!g)throw new Error(x.error||"Failed to delete course");await c(),i===u&&o(null),n(e==="zh"?"课程已删除":"Course Deleted",e==="zh"?"课程及其所有关联数据已被删除。":"The course and all associated data have been deleted.","success")},handleCopyCourse:async u=>{s(u);try{const{ok:g,data:x}=await wp(u);if(!g)throw new Error(x.error||"Failed to copy course");await c(),n(e==="zh"?"复制成功":"Course Copied",e==="zh"?"课程已成功复制。":"Course has been copied successfully.","success")}catch(g){n(e==="zh"?"复制失败":"Copy Failed",g.message||(e==="zh"?"复制课程时发生错误。":"An error occurred while copying the course."),"error")}finally{s(null)}},fetchElements:async u=>{try{const{ok:g,data:x}=await vp(u);if(!g)return;const w=JSON.stringify(x);w!==l.current&&(l.current=w,a(x))}catch{}},lastElementsJsonRef:l}}async function fS(){const t=await fetch("/api/commands/registered");return t.ok?{ok:!0,data:await t.json(),contentType:t.headers.get("content-type")}:{ok:!1,contentType:t.headers.get("content-type")}}async function mS(t){const e=await fetch(`/api/vfs${t?`?parentId=${t}`:""}`);return e.ok?{ok:!0,data:await e.json()}:{ok:!1}}async function pS(){const t=await fetch("/api/processes");return t.ok?{ok:!0,data:await t.json()}:{ok:!1}}async function gS(t){const e=await fetch(`/api/processes/${t}/logs`);return e.ok?{ok:!0,data:await e.json()}:{ok:!1}}async function xS(t,e){return{ok:(await fetch(`/api/classes/${t}/schedules`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})).ok}}async function bS(t,e){return{ok:(await fetch(`/api/assignments/${t}/submissions`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})).ok}}async function yS(t,e){const n=await fetch(`/api/classes/${t}/assignments/generate`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({topic:e})});return n.ok?{ok:!0,data:await n.json().catch(()=>({}))}:{ok:!1}}async function wS(t){const e=await fetch(`/api/classes/${t}/progress`);return e.ok?{ok:!0,data:await e.json()}:{ok:!1}}async function vS(t){const e=await fetch(`/api/classes/${t}/dashboard`);return e.ok?{ok:!0,data:await e.json()}:{ok:!1}}async function SS(t){const e=await fetch(`/api/students/${t}/dashboard`);return e.ok?{ok:!0,data:await e.json()}:{ok:!1}}function jS(t){const{fetchClassSchedules:e}=t,[n,s]=f.useState({}),[i,o]=f.useState({}),[a,l]=f.useState({}),[c,d]=f.useState({}),[h,m]=f.useState({}),[p,u]=f.useState([]),g=async C=>{try{const{ok:N,data:y}=await kp(C);N&&s(P=>({...P,[C]:y}))}catch{}},x=async C=>{try{const{ok:N,data:y}=await wS(C);N&&o(P=>({...P,[C]:y}))}catch{}},w=async C=>{try{const{ok:N,data:y}=await vS(C);N&&l(P=>({...P,[C]:y}))}catch{}};return{classStudentsMap:n,setClassStudentsMap:s,classProgressMap:i,setClassProgressMap:o,classDashboardMap:a,setClassDashboardMap:l,classAssignmentsMap:c,setClassAssignmentsMap:d,assignmentSubmissionsMap:h,setAssignmentSubmissionsMap:m,liveClassStudentProgress:p,setLiveClassStudentProgress:u,fetchClassStudents:g,fetchClassProgress:x,fetchClassDashboard:w,fetchLiveClassStudentProgress:async(C,N)=>{try{const{ok:y,data:P}=await nx(C,N);y&&u(P)}catch{}},handleQuickScheduleClass:async(C,N,y)=>{try{const{ok:P}=await xS(C,{lessonId:N,scheduledDate:y});if(P)return await e(C),!0}catch(P){console.error("Quick schedule class failed",P)}return!1},handleQuickGenerateAssignment:async(C,N,y)=>{const P=N||y||"Assignment";try{const{ok:L,data:_}=await yS(C,P);if(L)return await w(C),_.id||"assignment-created"}catch(L){console.error("Quick generate assignment failed",L)}return null}}}function kS(t){const[e,n]=f.useState([]),[s,i]=f.useState([]),[o,a]=f.useState([]),[l,c]=f.useState(null),[d,h]=f.useState(""),[m,p]=f.useState(!1),[u,g]=f.useState(null);return{registeredCommands:e,setRegisteredCommands:n,vfsNodes:s,setVfsNodes:i,processes:o,setProcesses:a,showProcessLogs:l,setShowProcessLogs:c,processLogsContent:d,setProcessLogsContent:h,showLogs:m,setShowLogs:p,currentVfsParent:u,setCurrentVfsParent:g,fetchRegisteredCommands:async()=>{try{const{ok:b,data:C,contentType:N}=await fS();b&&N&&N.includes("application/json")&&Array.isArray(C)&&n(C)}catch(b){console.warn("Failed to fetch registered commands",b)}},fetchVfs:async b=>{if(t)try{const{ok:C,data:N}=await mS(b);C&&i(N)}catch(C){console.warn("Failed to fetch VFS nodes",C)}},fetchProcesses:async()=>{try{const{ok:b,data:C}=await pS();b&&a(C)}catch{}},fetchProcessLogs:async b=>{try{const{ok:C,data:N}=await gS(b);C&&(h(N.logs||""),c(b))}catch{}}}}function tl(t,e){let n="",s="",i="";t==="class"?(n=e==="zh"?"班级及学生批量导入模板.csv":"class_import_template.csv",s="Class Name,Class Desc,Student Name,Student Email",i=e==="zh"?`高一A班,基础英语课程,李明,liming@example.com
|
|
152
|
+
高一A班,基础英语课程,王华,wanghua@example.com`:`Class 101,Introduction to English,John Doe,john@example.com
|
|
153
|
+
Class 101,Introduction to English,Jane Smith,jane@example.com`):(n=e==="zh"?"学生批量导入模板.csv":"student_import_template.csv",s="Student Name,Student Email",i=e==="zh"?`张三,zhangsan@example.com
|
|
154
|
+
李四,lisi@example.com`:`Alice Cooper,alice@example.com
|
|
155
|
+
Bob Dylan,bob@example.com`);const o=new Blob(["\uFEFF"+s+`
|
|
156
|
+
`+i],{type:"text/csv;charset=utf-8;"}),a=URL.createObjectURL(o),l=document.createElement("a");l.href=a,l.setAttribute("download",n),document.body.appendChild(l),l.click(),document.body.removeChild(l)}async function CS(t,e){const{lang:n,fetchClasses:s,fetchStudents:i}=e;return new Promise((o,a)=>{const l=new FileReader;l.onload=async c=>{try{const d=c.target?.result;if(!d)throw new Error("File content is empty");let h=[],m=[],p=!0;if(t.name.endsWith(".json")){const u=JSON.parse(d);if(!Array.isArray(u))throw new Error("JSON structure must be an array");u.some(x=>x.className||x.name&&(x.students||x.classDescription))?(p=!0,h=u.map(x=>{const w=x.name||x.className||x.class_name,v=x.description||x.classDescription||"",S=x.students||x.studentList||[],b=(Array.isArray(S)?S:[]).map(C=>({name:C.name||C.studentName||"",email:C.email||C.studentEmail||""})).filter(C=>C.name);return{name:w,description:v,students:b}}).filter(x=>x.name)):(p=!1,m=u.map(x=>({name:x.name||x.studentName||x.student_name||"",email:x.email||x.studentEmail||x.student_email||""})).filter(x=>x.name))}else{const u=d.split(/\r?\n/);if(u.length<2)throw new Error("CSV has empty or insufficient data");const g=u[0].split(",").map(b=>b.trim().toLowerCase()),x=g.findIndex(b=>b.includes("class name")||b.includes("班级名称")||b.includes("班级")||b.includes("classname")||b.includes("class_name")),w=g.findIndex(b=>b.includes("class desc")||b.includes("班级描述")||b.includes("描述")||b.includes("class_desc")),v=g.findIndex(b=>b.includes("student name")||b.includes("学生姓名")||b.includes("姓名")||b.includes("学生")||b.includes("studentname")||b.includes("student_name")),S=g.findIndex(b=>b.includes("student email")||b.includes("学生邮箱")||b.includes("邮箱")||b.includes("email")||b.includes("studentemail")||b.includes("student_email"));if(v===-1)throw new Error('CSV is missing column: "Student Name" (学生姓名/姓名/学生)');if(x!==-1){p=!0;const b={};for(let C=1;C<u.length;C++){const N=u[C].trim();if(!N)continue;const P=(N.match(/(".*?"|[^",]+)(?=\s*,|\s*$)/g)||N.split(",")).map(A=>A.replace(/^"|"$/g,"").trim()),L=P[x];if(!L)continue;const _=w!==-1&&P[w]||"",O=v!==-1&&P[v]||"",T=S!==-1&&P[S]||"";b[L]||(b[L]={name:L,description:_,students:[]}),O&&b[L].students.push({name:O,email:T})}h=Object.values(b)}else{p=!1;for(let b=1;b<u.length;b++){const C=u[b].trim();if(!C)continue;const y=(C.match(/(".*?"|[^",]+)(?=\s*,|\s*$)/g)||C.split(",")).map(_=>_.replace(/^"|"$/g,"").trim()),P=v!==-1&&y[v]||"",L=S!==-1&&y[S]||"";P&&m.push({name:P,email:L})}}}if(p){if(h.length===0)throw new Error("No valid class elements found inside file.");const u=await fetch("/api/classes/import",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({classes:h})});if(!u.ok){const x=await u.json();throw new Error(x.error||"Server importation failed")}const g=await u.json();await s(),await i(),o({success:!0,message:n==="zh"?`成功导入 ${g.imported.length} 个班级数据!`:`Successfully imported ${g.imported.length} classes data!`})}else{if(m.length===0)throw new Error("No valid student elements found inside file.");const u=await fetch("/api/students/import",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({students:m})});if(!u.ok){const x=await u.json();throw new Error(x.error||"Server student importation failed")}const g=await u.json();await i(),o({success:!0,message:n==="zh"?`成功导入 ${g.imported.filter(x=>x.new).length} 名新学者,匹配并更新了其中的 ${g.imported.filter(x=>!x.new).length} 名同学!`:`Successfully imported ${g.imported.filter(x=>x.new).length} new students and updated ${g.imported.filter(x=>!x.new).length} existing ones!`})}}catch(d){a(d)}},l.onerror=()=>{a(new Error("Failed to read file from disk."))},l.readAsText(t)})}function NS(t,e){return new Promise((n,s)=>{const i=new FileReader;i.onload=o=>{try{const a=o.target?.result;if(!a)throw new Error("Empty CSV file");const l=a.split(/\r?\n/);if(l.length<2)throw new Error(e==="zh"?"CSV 文件行数不足,请包含标题和至少一行数据。":"CSV is missing content or headers.");const c=l[0].split(",").map(p=>p.trim().toLowerCase()),d=c.findIndex(p=>p.includes("title")||p.includes("标题")||p.includes("课程")),h=c.findIndex(p=>p.includes("content")||p.includes("内容")||p.includes("正文"));if(d===-1||h===-1)throw new Error(e==="zh"?'CSV 缺少必要表头列:必须包含 "Title"(课程标题)和 "Content"(课程内容)。':'CSV must contain "Title" and "Content" headers.');const m=[];for(let p=1;p<l.length;p++){const u=l[p].trim();if(!u)continue;const x=(u.match(/(".*?"|[^",]+)(?=\s*,|\s*$)/g)||u.split(",")).map(S=>S.replace(/^"|"$/g,"").trim()),w=x[d],v=x[h];w&&v&&m.push({title:w,content:v})}if(m.length===0)throw new Error(e==="zh"?"未能从 CSV 解析出有效课程数据。":"No valid courses found in CSV.");n(m)}catch(a){s(a)}},i.onerror=()=>{s(new Error(e==="zh"?"无法读取选取的 CSV 文件!":"Failure to read the CSV!"))},i.readAsText(t)})}async function ES(t,e){const{lang:n,setImportProgress:s,fetchLessons:i}=e;let o=0;for(let a=0;a<t.length;a++){const l=t[a];try{const c=await fetch("/api/lessons",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({title:l.title,content:l.content})});if(c.ok)o++;else{const d=await c.json();console.warn(`Failed to import item ${a+1}:`,d)}}catch(c){console.warn(`Error importing item ${a+1}:`,c)}s(a+1)}return o>0?(await i(),{success:!0}):{success:!1,errorMsg:n==="zh"?"所有课程项导入均失败。请检查控制台或格式。":"Failed to import any of the courses. Please check your console or schema."}}function PS(t){const{lang:e,fetchClasses:n,fetchStudents:s,fetchLessons:i}=t,[o,a]=f.useState(!1),[l,c]=f.useState(null),[d,h]=f.useState(!1),[m,p]=f.useState("system"),[u,g]=f.useState(null),[x,w]=f.useState([]),[v,S]=f.useState(!1),[b,C]=f.useState(!1),N=async()=>{try{S(!0);const{ok:K,data:ne}=await tS();K&&w(ne)}catch(K){console.warn("Error fetching library resources:",K)}finally{S(!1)}};f.useEffect(()=>{d&&N()},[d]);const[y,P]=f.useState(!1),[L,_]=f.useState("idle"),[O,T]=f.useState(0),[A,R]=f.useState(0),[D,I]=f.useState(""),[$,U]=f.useState([]),[E,F]=f.useState(!1),j=()=>{tl("class",e)},B=async K=>{if(K){if(!K.name.toLowerCase().endsWith(".csv")){_("error"),I(e==="zh"?"只支持包含 .csv 后缀名的文件!":"Only files ending in .csv are supported!");return}_("parsing"),I("");try{const ne=await NS(K,e);U(ne),_("idle")}catch(ne){_("error"),I(ne.message||String(ne))}}},X=async()=>{if($.length===0)return;_("importing"),T(0),R($.length);const K=await ES($,{lang:e,setImportProgress:T,fetchLessons:i});K.success?_("success"):(_("error"),I(K.errorMsg||""))},[k,q]=f.useState(!1),[J,G]=f.useState(!1),[re,Y]=f.useState(null),[ye,ee]=f.useState(null);return{isCloudDriveOpen:o,setIsCloudDriveOpen:a,cloudDrivePreviewNode:l,setCloudDrivePreviewNode:c,isSystemResourceLibraryOpen:d,setIsSystemResourceLibraryOpen:h,systemResourceTab:m,setSystemResourceTab:p,selectedLibraryResourceId:u,setSelectedLibraryResourceId:g,libraryResources:x,setLibraryResources:w,loadingLibraryResources:v,setLoadingLibraryResources:S,showCoursewareHub:b,setShowCoursewareHub:C,fetchLibraryResources:N,isImportLessonsOpen:y,setIsImportLessonsOpen:P,importStatus:L,setImportStatus:_,importProgress:O,setImportProgress:T,importProgressTotal:A,setImportProgressTotal:R,importErrorMsg:D,setImportErrorMsg:I,previewImportData:$,setPreviewImportData:U,isDraggingImport:E,setIsDraggingImport:F,downloadCsvTemplate:j,handleCSVFileChange:B,handleCSVImportSubmit:X,showImportModal:k,setShowImportModal:q,isImporting:J,setIsImporting:G,importError:re,setImportError:Y,importSuccess:ye,setImportSuccess:ee,downloadCSVTemplate:K=>{tl(K,e)},handleImportFile:async K=>{G(!0),Y(null),ee(null);try{const ne=await CS(K,{lang:e,fetchClasses:n,fetchStudents:s});ee(ne.message)}catch(ne){Y(ne.message||String(ne))}finally{G(!1)}}}}function TS(t){const{lang:e,addToast:n,fetchLessons:s,setSelectedLesson:i,setTeacherTab:o}=t,[a,l]=f.useState(!1),[c,d]=f.useState(1),[h,m]=f.useState(""),[p,u]=f.useState("Mathematics"),[g,x]=f.useState(""),[w,v]=f.useState(""),[S,b]=f.useState([{id:"seg-w1",title:"Course Orientation / 课堂导入",type:"intro",duration:"5m",color:"bg-blue-50 text-blue-700 border-blue-200 hover:bg-blue-100",notes:"Introduce basic goals"},{id:"seg-w2",title:"Subject Core Lecture / 核心精讲",type:"lecture",duration:"20m",color:"bg-indigo-50 text-indigo-700 border-indigo-200 hover:bg-indigo-100",notes:"Present major content frameworks"},{id:"seg-w3",title:"Interactive Lab Work / 实践演练",type:"practice",duration:"15m",color:"bg-green-50 text-green-700 border-green-200 hover:bg-green-100",notes:"Provide collaborative assignments on terminal or board"},{id:"seg-w4",title:"Wrap up / 随堂总结与答疑",type:"summary",duration:"5m",color:"bg-purple-50 text-purple-700 border-purple-200 hover:bg-purple-100",notes:"Reflect and assign task"}]),[C,N]=f.useState(!1);return{isCourseWizardOpen:a,setIsCourseWizardOpen:l,wizardStep:c,setWizardStep:d,wizardCourseTitle:h,setWizardCourseTitle:m,wizardCourseCategory:p,setWizardCourseCategory:u,wizardCourseDescription:g,setWizardCourseDescription:x,wizardCourseContent:w,setWizardCourseContent:v,wizardCourseTimeline:S,setWizardCourseTimeline:b,wizardIsSubmitting:C,setWizardIsSubmitting:N,handleDeployWizardCourse:async()=>{if(!h.trim()){alert(e==="zh"?"请输入课程标题!":"Please provide a course title!");return}N(!0);try{const P=w.trim()||`Course outline for ${h} (${p})`,L=await fetch("/api/lessons",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({title:h,content:P})});if(L.ok){const O=(await L.json()).result?.lessonId;O&&await fetch(`/api/lessons/${O}/timeline`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({timeline:S})}),await s(),O&&(i(O),o("lesson_editor")),n(e==="zh"?"⭐ 课程发布成功":"⭐ Course Deployed Successfully",e==="zh"?`课程《${h}》已成功保存到核心SQLite并已自动激活!`:`Course "${h}" is now live in SQLite and auto-activated.`,"success"),l(!1),m(""),u("Mathematics"),x(""),v(""),d(1)}else n("Error","SQLite save failed","warning")}catch(P){console.error(P),n("Error","Launch Exception","warning")}finally{N(!1)}}}}const IS=`exports.default = {
|
|
157
|
+
manifest: {
|
|
158
|
+
id: "@my-scope/hello-world",
|
|
159
|
+
name: "Hello World Plugin",
|
|
160
|
+
version: "1.0.0",
|
|
161
|
+
capabilitiesProposed: ["lesson:read"]
|
|
162
|
+
},
|
|
163
|
+
activate: async (ctx) => {
|
|
164
|
+
ctx.log.info('Hello World plugin activated');
|
|
165
|
+
}
|
|
166
|
+
};`;function AS(t){const{session:e,host:n,lang:s,addToast:i,setChatLog:o,setTeacherTab:a,fetchLessons:l}=t,[c,d]=f.useState([]),[h,m]=f.useState([]),[p,u]=f.useState(!1),[g,x]=f.useState(null),[w,v]=f.useState(""),[S,b]=f.useState(""),[C,N]=f.useState(""),[y,P]=f.useState(""),[L,_]=f.useState(null),[O,T]=f.useState(!1),[A,R]=f.useState("store"),[D,I]=f.useState(IS),[$,U]=f.useState(!1),[E,F]=f.useState([]),[j,B]=f.useState([]),[X,k]=f.useState({}),q=f.useRef(new Set),J=f.useCallback(async()=>{try{const Q=await fetch("/api/plugins");if(Q.ok){const se=await Q.json();d(se)}}catch(Q){console.warn("Failed to fetch plugins",Q)}},[]),G=f.useCallback(async()=>{try{const Q=await fetch("/api/ai-providers");if(Q.ok){const se=await Q.json();m(se)}}catch(Q){console.warn("Failed to fetch AI Providers",Q)}},[]);f.useEffect(()=>{J(),e&&e.role!=="student"&&G()},[J,G,e?.role]);const re=f.useCallback(async()=>{try{const Q=await fetch("/api/events");Q.ok&&F(await Q.json())}catch{}},[]),Y=f.useCallback(async()=>{try{const Q=await fetch("/api/approvals");Q.ok&&B(await Q.json())}catch{}},[]);return{plugins:c,setPlugins:d,fetchPlugins:J,aiProviders:h,setAiProviders:m,fetchAIProviders:G,isAIProviderModalOpen:p,setIsAIProviderModalOpen:u,editingAIProvider:g,setEditingAIProvider:x,providerName:w,setProviderName:v,providerApiUrl:S,setProviderApiUrl:b,providerApiKey:C,setProviderApiKey:N,providerModelName:y,setProviderModelName:P,testingProviderId:L,setTestingProviderId:_,showPluginModal:O,setShowPluginModal:T,storeTab:A,setStoreTab:R,pluginCode:D,setPluginCode:I,installingPlugin:$,setInstallingPlugin:U,events:E,setEvents:F,fetchEvents:re,approvals:j,setApprovals:B,fetchApprovals:Y,scoreOverrides:X,setScoreOverrides:k,handleSaveAIProvider:async()=>{if(!w.trim()||!S.trim()||!y.trim()){i(s==="zh"?"表单不完整":"Incomplete Form",s==="zh"?"请填写提供商名称、API 基础地址与模型标识。":"Please fill in Name, API URL, and Model Name.","warning");return}try{let Q;if(g?Q=await fetch(`/api/ai-providers/${g.id}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:w,api_url:S,api_key:C,model_name:y})}):Q=await fetch("/api/ai-providers",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:w,api_url:S,api_key:C,model_name:y})}),Q.ok)i(s==="zh"?"保存成功":"Saved Successfully",s==="zh"?`AI 提供商 [${w}] 已保存。`:`AI Provider [${w}] has been updated.`,"success"),u(!1),x(null),v(""),b(""),N(""),P(""),G();else{const se=await Q.json().catch(()=>({}));i(s==="zh"?"保存失败":"Failed to Save",se.error||(s==="zh"?"无法写入数据库":"Failed to write to database"),"warning")}}catch(Q){console.error(Q),i(s==="zh"?"保存异常":"Execution Error",Q.message||"Error occurred","warning")}},handleDeleteAIProvider:async(Q,se)=>{if(confirm(s==="zh"?`确定要删除 AI 提供商 [${se}] 吗?此操作无法撤销。`:`Are you sure you want to delete AI Provider [${se}]?`))try{(await fetch(`/api/ai-providers/${Q}`,{method:"DELETE"})).ok?(i(s==="zh"?"删除成功":"Deleted Successfully",s==="zh"?`AI 提供商 [${se}] 已经被清除。`:`AI Provider [${se}] has been removed.`,"success"),G()):i(s==="zh"?"删除失败":"Failed to Delete","Database error","warning")}catch(Z){console.error(Z),i(s==="zh"?"操作异常":"Execution Error",Z.message||"Error occurred","warning")}},handleTestAIProvider:async Q=>{_(Q.id);try{const se=await fetch("/api/ai-providers/test",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({api_url:Q.api_url,api_key:Q.api_key,model_name:Q.model_name})}),Z=await se.json();se.ok&&Z.success?i(s==="zh"?"测试通过":"Test Succeeded",s==="zh"?`成功连接至 [${Q.name}]。${Z.message}`:`Successfully connected to [${Q.name}]. ${Z.message}`,"success"):i(s==="zh"?"测试失败":"Test Failed",Z.error||"Connection error","warning")}catch(se){console.error(se),i(s==="zh"?"连接异常":"Connection Exception",se.message||"Error occurred","warning")}finally{_(null)}},handleInstallPlugin:async()=>{if(D.trim()){U(!0);try{const se=await(await fetch("/api/plugins",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({sourceCode:D})})).json();se.success?(await J(),T(!1),o(Z=>[...Z,{role:"agent",content:`[System] Plugin "${se.manifest.name}" installed successfully. You can now prompt me to use it.`}])):alert("Plugin installation failed: "+se.error)}catch(Q){alert("Error: "+Q.message)}finally{U(!1)}}},handleZipPluginUpload:async(Q,se,Z)=>{U(!0);const pe=Z?.mode==="update";try{const le={"Content-Type":"application/octet-stream","X-Filename":encodeURIComponent(Q.name),"X-Execution-Mode":se,"X-Install-Mode":pe?"update":"install","X-Allow-Downgrade":Z?.allowDowngrade?"true":"false"};Z?.targetPluginId&&(le["X-Target-Plugin-Id"]=encodeURIComponent(Z.targetPluginId));const he=pe&&Z?.targetPluginId?`/api/plugins/${encodeURIComponent(Z.targetPluginId)}/update-zip-raw`:"/api/plugins/upload-zip-raw",Ce=await fetch(he,{method:"POST",headers:le,body:Q}),Ee=await Ce.json().catch(()=>({}));if(!Ce.ok||!Ee.success){const oe=Ee.error||"Unknown error";throw i(s==="zh"?pe?"更新失败":"安装失败":pe?"Update Failed":"Installation Failed",oe,"error"),new Error(oe)}const M=Ee.pluginId||Ee.manifest?.pluginId||Ee.manifest?.id,V=!!(Ee.updated||pe);if(!V&&M)await fetch(`/api/plugins/${encodeURIComponent(M)}/toggle`,{method:"POST"}).catch(()=>{});else if(V&&Ee.wasActive&&M)try{await n.deactivatePlugin(M)}catch{}a("plugins"),R("store"),await J(),setTimeout(()=>{J()},1e3);const ie=Ee.manifest?.name||M||Q.name;if(V){const oe=Ee.oldVersion||"?",fe=Ee.newVersion||Ee.manifest?.version||"?";i(s==="zh"?"插件更新成功":"Plugin Updated",s==="zh"?`"${ie}" 已从 v${oe} 更新到 v${fe}(配置与数据已保留)`:`"${ie}" updated v${oe} → v${fe} (config & data preserved)`,"success"),o(Ae=>[...Ae,{role:"agent",content:`[System] Plugin "${ie}" updated ${oe} → ${fe}.`}])}else i(s==="zh"?"插件安装成功":"Plugin Installed",s==="zh"?`三方插件 "${ie}" 已成功上传并以 [${se==="worker"?"Worker 隔离":"VM 嵌入"}] 模式激活运行!`:`Plugin "${ie}" installed and activated in [${se}] mode!`,"success"),o(oe=>[...oe,{role:"agent",content:`[System] Plugin "${ie}" installed successfully from ZIP file.`}])}catch(le){const he=le?.message?String(le.message):"";throw he&&he!=="Failed to fetch"&&he!=="Network error"||i(s==="zh"?"网络错误":"Network Error",he||"Network error","error"),le}finally{U(!1)}},handleTogglePlugin:async Q=>{if(!q.current.has(Q)){q.current.add(Q);try{const se=await fetch(`/api/plugins/${encodeURIComponent(Q)}/toggle`,{method:"POST"}),Z=await se.json().catch(()=>({}));if(se.ok)await J();else{const pe=Z.error||"Unknown error";pe.includes("requires human approval")||pe.includes("queued")?(alert(s==="zh"?'该操作已加入"待审批高危操作"列表,请在右侧侧边栏中通过审批以生效。':"This action has been queued. Please approve it in the Pending Approvals list on the right side."),await Y()):alert((s==="zh"?"切换插件状态失败: ":"Failed to toggle plugin: ")+pe)}}catch(se){console.error("Failed to toggle plugin:",se),alert(s==="zh"?"网络错误,切换插件失败":"Network error, failed to toggle plugin")}finally{q.current.delete(Q)}}},handleDeletePlugin:async Q=>{if(window.confirm(s==="zh"?"确定要彻底删除该插件吗?删除后此插件相关的功能将无法使用。":"Are you sure you want to completely delete this plugin? This cannot be undone."))try{const se=await fetch(`/api/plugins/${encodeURIComponent(Q)}`,{method:"DELETE"});if(se.ok)a("plugins"),R("store"),await J(),o(Z=>[...Z,{role:"agent",content:"[System] Plugin uninstalled and deleted."}]);else{const Z=await se.json().catch(()=>({}));alert(Z.error||(s==="zh"?"删除插件失败":"Failed to delete plugin"))}}catch(se){console.error("Failed to delete plugin:",se),alert(s==="zh"?"删除插件失败":"Failed to delete plugin")}},handleApprove:async(Q,se)=>{try{const pe=await(await fetch(`/api/approvals/${Q}/approve`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({payloadOverride:se})})).json();pe.success?(await Y(),await l(),await J()):alert("Action failed: "+pe.error)}catch(Z){console.error(Z)}},handleReject:async Q=>{try{await fetch(`/api/approvals/${Q}/reject`,{method:"POST"}),await Y(),await J()}catch(se){console.error(se)}}}}function zS(){const[t,e]=f.useState(!1),[n,s]=f.useState(null),[i,o]=f.useState("scan_lesson"),[a,l]=f.useState(""),[c,d]=f.useState(""),[h,m]=f.useState(!1),[p,u]=f.useState([]),[g,x]=f.useState([]),[w,v]=f.useState(!1),[S,b]=f.useState({}),[C,N]=f.useState(10),[y,P]=f.useState("quiz"),L=f.useRef(S);return f.useEffect(()=>{L.current=S},[S]),{isQuizGeneratorOpen:t,setIsQuizGeneratorOpen:e,quizGeneratorClassId:n,setQuizGeneratorClassId:s,quizGenMode:i,setQuizGenMode:o,quizGenSelectedLessonId:a,setQuizGenSelectedLessonId:l,quizGenTopic:c,setQuizGenTopic:d,isGeneratingSuggestions:h,setIsGeneratingSuggestions:m,suggestedObjectives:p,setSuggestedObjectives:u,suggestedQuestions:g,setSuggestedQuestions:x,savingQuiz:w,setSavingQuiz:v,quizStudentAnswers:S,setQuizStudentAnswers:b,quizGenTimeLimit:C,setQuizGenTimeLimit:N,quizStudentAnswersRef:L,subAssignmentTab:y,setSubAssignmentTab:P}}function LS(t){const{lang:e,classes:n,expandedClassId:s,fetchClasses:i,fetchClassStudents:o,handleExportAllClassesCombined:a}=t,[l,c]=f.useState(!1),[d,h]=f.useState(new Set),[m,p]=f.useState(new Set),[u,g]=f.useState(null),[x,w]=f.useState(""),[v,S]=f.useState(""),[b,C]=f.useState("");return{batchMode:l,setBatchMode:c,selectedClassIds:d,setSelectedClassIds:h,selectedStudentIds:m,setSelectedStudentIds:p,batchPicker:u,setBatchPicker:g,batchPickerLesson:x,setBatchPickerLesson:w,batchPickerDate:v,setBatchPickerDate:S,batchPickerTargetClass:b,setBatchPickerTargetClass:C,toggleClassSelection:E=>{h(F=>{const j=new Set(F);return j.has(E)?j.delete(E):j.add(E),j})},toggleSelectAllClasses:()=>{h(E=>E.size===n.length&&n.length>0?new Set:new Set(n.map(F=>F.id)))},toggleStudentSelection:E=>{p(F=>{const j=new Set(F);return j.has(E)?j.delete(E):j.add(E),j})},toggleSelectAllStudents:E=>{p(F=>F.size===E.length&&E.length>0?new Set:new Set(E.map(j=>j.id)))},handleBatchDeleteClasses:async()=>{if(d.size!==0&&confirm(e==="zh"?`确认彻底删除选中的 ${d.size} 个班级吗?该操作不可恢复。`:`Delete ${d.size} selected classes permanently?`)){for(const E of d)await fetch(`/api/classes/${E}`,{method:"DELETE"});h(new Set),await i()}},handleBatchExportClasses:async()=>{d.size!==0&&await a(n.filter(E=>d.has(E.id)))},handleBatchSetPasscode:async()=>{if(d.size===0)return;const E=window.prompt(e==="zh"?"请输入临时班级密码(留空则清除):":"Enter temporary passcode (leave empty to clear):");if(E!==null){for(const F of d)await fetch(`/api/classes/${F}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({class_passcode:E===""?null:E})});h(new Set),await i()}},handleBatchScheduleClasses:()=>{d.size!==0&&(w(""),S(new Date().toISOString().split("T")[0]),g("schedule"))},handleBatchDeleteStudents:async()=>{if(!(m.size===0||!s)&&confirm(e==="zh"?`确认彻底删除选中的 ${m.size} 名学生账号吗?将删除其全部关联数据,不可恢复。`:`Permanently delete ${m.size} selected student accounts?`)){for(const E of m)await fetch(`/api/students/${E}`,{method:"DELETE"});p(new Set),await o(s)}},handleBatchResetPassword:async()=>{if(m.size===0||!s)return;const E=window.prompt(e==="zh"?"请输入要为选中学生设置的新密码:":"Enter new password for selected students:");if(!(E===null||E.trim()==="")){for(const F of m)await fetch(`/api/students/${F}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({password:E})});p(new Set),await o(s)}},handleBatchTransferStudents:()=>{m.size===0||!s||(C(""),g("transfer"))},handleBatchSetLockedLesson:()=>{m.size===0||!s||(w(""),g("lockedLesson"))},confirmBatchPicker:async()=>{if(s){if(u==="schedule"){if(!x){alert(e==="zh"?"请选择课程":"Please select a lesson");return}for(const E of d)await fetch(`/api/classes/${E}/schedules`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({lessonId:x,scheduledDate:v+" 09:00:00",status:"scheduled"})});h(new Set)}else if(u==="lockedLesson"){if(!x){alert(e==="zh"?"请选择课程":"Please select a lesson");return}for(const E of m)await fetch(`/api/students/${E}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({locked_lesson_id:x})});p(new Set)}else if(u==="transfer"){if(!b||b===s){alert(e==="zh"?"请选择不同的目标班级":"Please select a different target class");return}for(const E of m)await fetch(`/api/classes/${s}/students/${E}`,{method:"DELETE"}),await fetch(`/api/classes/${b}/students`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({studentId:E})});p(new Set)}g(null),s&&await o(s)}}}}function RS(t){const{selectedLesson:e,lessons:n,setLessons:s}=t,[i,o]=f.useState([]),[a,l]=f.useState("seg-1"),[c,d]=f.useState(null),[h,m]=f.useState(null),[p,u]=f.useState("none"),[g,x]=f.useState(null),[w,v]=f.useState(!1),S=f.useRef(null),b=async(C,N)=>{u("saving");try{(await fetch(`/api/lessons/${C}/timeline`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({timeline:N})})).ok?(s(P=>P.map(L=>L.id===C?{...L,timeline:JSON.stringify(N)}:L)),o(N),u("saved"),x(new Date)):u("error")}catch(y){console.error("Failed to save timeline:",y),u("error")}};return f.useEffect(()=>{if(e){const C=n.find(N=>N.id===e);if(C){let N=[];if(C.timeline)try{N=typeof C.timeline=="string"?JSON.parse(C.timeline):C.timeline}catch{N=[{id:"seg-1",title:"开场准备",type:"intro",duration:"5m",color:"bg-blue-50 text-blue-700 border-blue-200 hover:bg-blue-100"},{id:"seg-2",title:"讲授新课",type:"lecture",duration:"20m",color:"bg-indigo-50 text-indigo-700 border-indigo-200 hover:bg-indigo-100"},{id:"seg-3",title:"互动练习",type:"practice",duration:"15m",color:"bg-green-50 text-green-700 border-green-200 hover:bg-green-100"},{id:"seg-4",title:"课堂总结",type:"summary",duration:"5m",color:"bg-purple-50 text-purple-700 border-purple-200 hover:bg-purple-100"}]}else N=[{id:"seg-1",title:"开场准备",type:"intro",duration:"5m",color:"bg-blue-50 text-blue-700 border-blue-200 hover:bg-blue-100"},{id:"seg-2",title:"讲授新课",type:"lecture",duration:"20m",color:"bg-indigo-50 text-indigo-700 border-indigo-200 hover:bg-indigo-100"},{id:"seg-3",title:"互动练习",type:"practice",duration:"15m",color:"bg-green-50 text-green-700 border-green-200 hover:bg-green-100"},{id:"seg-4",title:"课堂总结",type:"summary",duration:"5m",color:"bg-purple-50 text-purple-700 border-purple-200 hover:bg-purple-100"}];o(N);const y=S.current!==e;S.current=e,N.length>0?(y||!N.some(P=>P.id===a))&&l(N[0].id):l(null)}}},[e,n]),{timelineSegments:i,setTimelineSegments:o,activeSegmentId:a,setActiveSegmentId:l,segmentToEdit:c,setSegmentToEdit:d,draggedSegmentIdx:h,setDraggedSegmentIdx:m,editorSaveStatus:p,setEditorSaveStatus:u,editorLastSavedTime:g,setEditorLastSavedTime:x,editorPanelsExpanded:w,setEditorPanelsExpanded:v,saveTimeline:b}}function Wc(t){if(t==null)return"";const e=String(t);return e.includes(",")||e.includes('"')||e.includes(`
|
|
167
|
+
`)?`"${e.replace(/"/g,'""')}"`:e}async function _S(t){const{classId:e,className:n,students:s,dashData:i,lang:o,addToast:a,setIsGeneratingPDFReport:l}=t;l(c=>({...c,[e]:!0}));try{if(!i){a(o==="zh"?"暂无班级评分数据":"No Class Performance Data",o==="zh"?"请确保在此班级加载了作业与测验。":"Please check if assignments or quizzes are present for this class.","warning");return}const c=i.performance||[],d=i.assignments||[],h={};s.forEach(E=>{h[E.id]={id:E.id,name:E.name,totalGradesSum:0,gradedCount:0,submittedCount:0,totalCount:0}}),c.forEach(E=>{const F=E.student_id;h[F]&&(h[F].totalCount++,(E.submission_status==="submitted"||E.submission_status==="graded")&&h[F].submittedCount++,E.score!==null&&E.score!==void 0&&(h[F].totalGradesSum+=E.score,h[F].gradedCount++))});const m=Object.values(h).map(E=>{const F=E.gradedCount>0?E.totalGradesSum/E.gradedCount:0,j=E.totalCount>0?E.submittedCount/E.totalCount*100:0;return{...E,avgScore:F,submissionRate:j}});m.sort((E,F)=>F.avgScore-E.avgScore);let p=0,u=0,g=0,x=0;c.forEach(E=>{x++,(E.submission_status==="submitted"||E.submission_status==="graded")&&g++,E.score!==null&&E.score!==void 0&&(p+=E.score,u++)});const w=u>0?p/u:0,v=x>0?g/x*100:0,S={};d.forEach(E=>{S[E.id]={id:E.id,title:E.title,scores:[],submittedCount:0,totalCount:0}}),c.forEach(E=>{const F=E.assignment_id;S[F]&&(S[F].totalCount++,(E.submission_status==="submitted"||E.submission_status==="graded")&&S[F].submittedCount++,E.score!==null&&E.score!==void 0&&S[F].scores.push(E.score))});const b=Object.values(S).map(E=>{const F=E.scores.length,j=E.scores.reduce((J,G)=>J+G,0),B=F>0?j/F:0,X=F>0?Math.max(...E.scores):0,k=F>0?Math.min(...E.scores):0,q=E.totalCount>0?E.submittedCount/E.totalCount*100:0;return{...E,avg:B,max:X,min:k,subRate:q}}),{jsPDF:C}=await $e(async()=>{const{jsPDF:E}=await import("./vendor-pdf-D0UGJOgo.js").then(F=>F.j);return{jsPDF:E}},[]),{applyPlugin:N}=await $e(async()=>{const{applyPlugin:E}=await import("./vendor-pdf-D0UGJOgo.js").then(F=>F.b);return{applyPlugin:E}},[]);N(C);const y=new C({orientation:"p",unit:"mm",format:"a4"}),P=[15,23,42],L=[79,70,229],_=[51,65,85],O=[226,232,240],T=E=>{y.setDrawColor(O[0],O[1],O[2]),y.setLineWidth(.3),y.line(14,E,196,E)};y.setFillColor(P[0],P[1],P[2]),y.rect(0,0,210,42,"F"),y.setTextColor(255,255,255),y.setFont("helvetica","bold"),y.setFontSize(20),y.text("CLASS PERFORMANCE REPORT",14,18),y.setFont("helvetica","normal"),y.setFontSize(10),y.setTextColor(194,205,225),y.text("Academic Insights • Generative Report Summary",14,25),y.text(`Classroom: ${n} | Date: ${new Date().toLocaleDateString()} ${new Date().toLocaleTimeString()}`,14,32),y.setFillColor(L[0],L[1],L[2]),y.rect(172,10,24,24,"F"),y.setFont("helvetica","bold"),y.setFontSize(14),y.setTextColor(255,255,255),y.text("OS",180,26);let A=52;y.setTextColor(P[0],P[1],P[2]),y.setFont("helvetica","bold"),y.setFontSize(12),y.text("I. EXECUTIVE OVERVIEW",14,A),A+=6;const R=[["Classroom/Subject Name",n],["Total Enrolled Students",`${s.length} student(s)`],["Curriculum Items (Assignments/Quizzes)",`${d.length} items`],["Global Assignment Submission Rate",`${v.toFixed(1)}%`],["Class Average Performance Score",`${w.toFixed(1)}%`]];y.autoTable({startY:A,head:[["Metric Indicator","Class-wide Metric Value"]],body:R,theme:"striped",headStyles:{fillColor:P,textColor:[255,255,255],fontStyle:"bold",fontSize:9},bodyStyles:{textColor:_,fontSize:9.5},margin:{left:14,right:14}}),A=y.lastAutoTable.finalY+12,y.setTextColor(P[0],P[1],P[2]),y.setFont("helvetica","bold"),y.setFontSize(12),y.text("II. STUDENT RANKING DISTRIBUTION",14,A),A+=6;const D=m.map((E,F)=>{let j="Excellent";return E.avgScore>=90?j="Excellent (A)":E.avgScore>=75?j="Good (B)":E.avgScore>=60?j="Satisfactory (C)":j="Needs Improvement (D)",[`${F+1}`,E.name,`${E.submittedCount}/${E.totalCount} (${E.submissionRate.toFixed(0)}%)`,`${E.avgScore.toFixed(1)}%`,j]});y.autoTable({startY:A,head:[["Rank","Student Name","Completion Rate","Average Score","Academic Standing Tier"]],body:D,theme:"grid",headStyles:{fillColor:L,textColor:[255,255,255],fontStyle:"bold",fontSize:9.5},bodyStyles:{textColor:_,fontSize:9.5},alternateRowStyles:{fillColor:[248,250,252]},columnStyles:{0:{cellWidth:15,halign:"center",fontStyle:"bold"},1:{fontStyle:"bold"},2:{halign:"center"},3:{halign:"center",fontStyle:"bold"}},margin:{left:14,right:14}}),A=y.lastAutoTable.finalY+12,A>210&&(y.addPage(),A=20),y.setTextColor(P[0],P[1],P[2]),y.setFont("helvetica","bold"),y.setFontSize(12),y.text("III. ASSIGNMENT PERFORMANCE METRICS",14,A),A+=6;const I=b.map(E=>[E.title,`${E.subRate.toFixed(0)}%`,`${E.avg.toFixed(1)}%`,`${E.min.toFixed(0)}% - ${E.max.toFixed(0)}%`]);y.autoTable({startY:A,head:[["Assignment/Quiz Title","Submission Rate","Average Grade","Range (Min - Max)"]],body:I.length>0?I:[["No assignment performance records found.","-","-","-"]],theme:"striped",headStyles:{fillColor:[100,116,139],textColor:[255,255,255],fontStyle:"bold",fontSize:9.5},bodyStyles:{textColor:_,fontSize:9.5},columnStyles:{1:{halign:"center"},2:{halign:"center",fontStyle:"bold"},3:{halign:"center"}},margin:{left:14,right:14}}),A=y.lastAutoTable.finalY+15,T(275),y.setFontSize(8),y.setTextColor(148,163,184),y.text("Generated by OpenLearn Next • Educational Operating System",14,282),y.text("Page 1 of 1 • Internal Educational Audit",196,282,{align:"right"});const $=n.replace(/[^a-z0-9]/gi,"_").toLowerCase(),U=new Date().toISOString().split("T")[0];y.save(`Class_Report_${$}_${U}.pdf`),a(o==="zh"?"📄 PDF 报告导出完成":"📄 PDF Report Generated",o==="zh"?`班级【${n}】的综合学情 PDF 报告已生成并下载。`:`Class performance report for ${n} saved to your device.`,"success")}catch(c){console.error("PDF Generation Failed:",c),a(o==="zh"?"❌ PDF 报告生成失败":"❌ PDF Report Failed",c.message||"Error occurred during PDF generation","warning")}finally{l(c=>({...c,[e]:!1}))}}function DS(t){const{className:e,students:n,dashData:s,qWeight:i=40,aWeight:o=60,overrides:a={}}=t;if(!s||!s.assignments){alert("No performance data available to export. Please open the dashboard to load class data first.");return}if(n.length===0){alert("No students in this class to export grades for.");return}const l=s.assignments||[],c=s.performance||[],d=l.map(b=>{let C="assignment";if(a[b.id])C=a[b.id];else{const N=b.content&&b.content.startsWith('{"quizType":"mcq_learning_objectives"'),y=b.title&&(b.title.toLowerCase().includes("quiz")||b.title.toLowerCase().includes("test")||b.title.includes("测验")||b.title.includes("测试"));C=N||y?"quiz":"assignment"}return{...b,category:C}}),h=["Student Name","Student Email"];d.forEach(b=>{const C=b.category==="quiz"?"Quiz":"Assignment";h.push(`${C}: ${b.title}`)}),h.push("Quizzes Average","Assignments Average",`Weighted Average (${i}% Quizzes, ${o}% Assignments)`,"Simple Average Score","Submitted Count","Total Items");const m=[h];n.forEach(b=>{const C=[b.name,b.email];let N=0,y=0,P=0,L=0,_=0,O=0,T=0;d.forEach(E=>{const F=c.find(j=>j.assignment_id===E.id&&j.student_id===b.id);if(F&&F.score!==null&&F.score!==void 0){C.push(`${F.score}%`);const j=Number(F.score);E.category==="quiz"?(N+=j,y++):(P+=j,L++),_+=j,O++,T++}else F&&F.submission_status==="submitted"?(C.push("Pending Grade"),T++):C.push("Not Submitted")});const A=y>0?Math.round(N/y):null,R=L>0?Math.round(P/L):null;let D="N/A";if(A!==null&&R!==null){const E=A*(i/100)+R*(o/100);D=`${Math.round(E)}%`}else A!==null?D=`${A}%`:R!==null&&(D=`${R}%`);const I=A!==null?`${A}%`:"N/A",$=R!==null?`${R}%`:"N/A",U=O>0?`${Math.round(_/O)}%`:"N/A";C.push(I,$,D,U,`${T}`,`${l.length}`),m.push(C.map(Wc))});const p=m.map(b=>b.join(",")).join(`
|
|
168
|
+
`),u=new Blob(["\uFEFF"+p],{type:"text/csv;charset=utf-8;"}),g=URL.createObjectURL(u),x=document.createElement("a"),w=e.replace(/[^a-z0-9]/gi,"_").toLowerCase(),v=new Date().toISOString().split("T")[0],S=`${w}_grades_report_${v}.csv`;x.setAttribute("href",g),x.setAttribute("download",S),x.style.visibility="hidden",document.body.appendChild(x),x.click(),document.body.removeChild(x),URL.revokeObjectURL(g)}function MS(t){const{exportClassId:e,classStudentsMap:n,classDashboardMap:s,quizzesWeight:i,assignmentsWeight:o,customCategoryOverrides:a,lang:l}=t;if(!e)return null;const c=n[e]||[],d=s[e];if(!d||!d.assignments||c.length===0)return null;const h=d.assignments||[],m=d.performance||[],p=h.map(w=>{let v="assignment";if(a[w.id])v=a[w.id];else{const S=w.content&&w.content.startsWith('{"quizType":"mcq_learning_objectives"'),b=w.title&&(w.title.toLowerCase().includes("quiz")||w.title.toLowerCase().includes("test")||w.title.includes("测验")||w.title.includes("测试"));v=S||b?"quiz":"assignment"}return{...w,category:v}}),u=["Student Name","Student Email"];p.forEach(w=>{const v=w.category==="quiz"?"Quiz":"Assignment";u.push(`${v}: ${w.title}`)}),u.push("Quizzes Average","Assignments Average",`Weighted Average (${i}% Quizzes, ${o}% Assignments)`,"Simple Average Score","Submitted Count","Total Items");const g=[];return c.slice(0,5).forEach(w=>{const v=[w.name,w.email];let S=0,b=0,C=0,N=0,y=0,P=0,L=0;p.forEach(I=>{const $=m.find(U=>U.assignment_id===I.id&&U.student_id===w.id);if($&&$.score!==null&&$.score!==void 0){v.push(`${$.score}%`);const U=Number($.score);I.category==="quiz"?(S+=U,b++):(C+=U,N++),y+=U,P++,L++}else $&&$.submission_status==="submitted"?(v.push(l==="zh"?"待评分":"Pending Grade"),L++):v.push(l==="zh"?"未提交":"Not Submitted")});const _=b>0?Math.round(S/b):null,O=N>0?Math.round(C/N):null;let T="N/A";if(_!==null&&O!==null){const I=_*(i/100)+O*(o/100);T=`${Math.round(I)}%`}else _!==null?T=`${_}%`:O!==null&&(T=`${O}%`);const A=_!==null?`${_}%`:"N/A",R=O!==null?`${O}%`:"N/A",D=P>0?`${Math.round(y/P)}%`:"N/A";v.push(A,R,T,D,`${L}`,`${h.length}`),g.push(v)}),{headers:u,rows:g,totalStudents:c.length}}function OS(t){const{classes:e,classStudentsMap:n,classDashboardMap:s,lang:i}=t,a=[["Class Name","Student Name","Student Email","Quizzes Average","Assignments Average","Calculated Weighted Score (40% Quiz / 60% Assignment)","Simple Average Score","Submitted Count","Total Items"]];if(e.forEach(h=>{const m=n[h.id]||[],p=s[h.id];if(!p||!p.assignments||m.length===0)return;const u=p.assignments||[],g=u.map(x=>{const w=x.content&&x.content.startsWith('{"quizType":"mcq_learning_objectives"'),v=x.title&&(x.title.toLowerCase().includes("quiz")||x.title.toLowerCase().includes("test")||x.title.includes("测验")||x.title.includes("测试"));return{...x,category:w||v?"quiz":"assignment"}});m.forEach(x=>{let w=0,v=0,S=0,b=0,C=0,N=0;g.forEach(T=>{const A=p.performance?.find(R=>R.student_id===x.id&&R.assignment_id===T.id&&R.submission_status==="graded"&&R.score!==null);if(A){const R=Number(A.score);C+=R,N++,T.category==="quiz"?(w+=R,v++):(S+=R,b++)}});const y=v>0?Math.round(w/v):null,P=b>0?Math.round(S/b):null;let L=0;y!==null&&P!==null?L=Math.round(y*.4+P*.6):y!==null?L=Math.round(y):P!==null&&(L=Math.round(P));const _=N>0?Math.round(C/N):0,O=[h.name,x.name,x.email,y!==null?`${y}%`:"N/A",P!==null?`${P}%`:"N/A",`${L}%`,`${_}%`,`${N}`,`${u.length}`];a.push(O)})}),a.length<=1){alert(i==="zh"?"暂无可导出的成绩数据。请确保班级中有已评分的作业。":"No graded performance data available to export.");return}const l="data:text/csv;charset=utf-8,\uFEFF"+a.map(h=>h.map(Wc).join(",")).join(`
|
|
169
|
+
`),c=encodeURI(l),d=document.createElement("a");d.setAttribute("href",c),d.setAttribute("download",`All_Classes_Combined_Grades_${new Date().toISOString().slice(0,10)}.csv`),document.body.appendChild(d),d.click(),document.body.removeChild(d)}function $S(t){const{lang:e,classes:n,classStudentsMap:s,classDashboardMap:i,fetchClassStudents:o,fetchClassDashboard:a,fetchClassProgress:l,addToast:c=()=>{}}=t,[d,h]=f.useState(!1),[m,p]=f.useState(""),[u,g]=f.useState(""),[x,w]=f.useState(40),[v,S]=f.useState(60),[b,C]=f.useState({}),[N,y]=f.useState(!1),[P,L]=f.useState(!1),[_,O]=f.useState(null),[T,A]=f.useState(!1),[R,D]=f.useState({}),I=f.useCallback(k=>{const q=Math.min(100,Math.max(0,k));w(q),S(100-q)},[]),$=f.useCallback(k=>{const q=Math.min(100,Math.max(0,k));S(q),w(100-q)},[]),U=f.useMemo(()=>MS({exportClassId:m,classStudentsMap:s,classDashboardMap:i,quizzesWeight:x,assignmentsWeight:v,customCategoryOverrides:b,lang:e}),[m,x,v,b,s,i,e]),E=f.useCallback(async(k,q)=>{O(k);try{await o(k),await a(k),await l(k),p(k),g(q),w(40),S(60),C({}),h(!0)}catch(J){console.error(J)}finally{O(null),y(!1)}},[o,a,l]),F=f.useCallback((k,q,J=40,G=60,re={})=>{DS({className:q,students:s[k]||[],dashData:i[k],qWeight:J,aWeight:G,overrides:re})},[s,i]),j=f.useCallback(async(k,q)=>{await o(k),await a(k),await l(k),await _S({classId:k,className:q,students:s[k]||[],dashData:i[k],lang:e,addToast:c,setIsGeneratingPDFReport:D})},[s,i,e,c,o,a,l]),B=f.useCallback(async()=>{A(!0);try{await OS({classes:n,classStudentsMap:s,classDashboardMap:i,lang:e})}catch(k){console.error("Export all classes error:",k)}finally{A(!1),y(!1)}},[n,s,i,e]),X=f.useCallback((k,q)=>{const J=i[q];if(!J||!J.performance)return null;const G=Date.now()-2592e6,Y=J.performance.filter(z=>z.student_id===k).filter(z=>z.submitted_at&&z.submitted_at>=G&&z.score!==null&&z.score!==void 0);if(Y.length===0)return null;const ee=Y.reduce((z,W)=>z+Number(W.score),0)/Y.length;return ee<60?Math.round(ee):null},[i]);return{isExportWeightModalOpen:d,setIsExportWeightModalOpen:h,exportClassId:m,setExportClassId:p,exportClassName:u,setExportClassName:g,quizzesWeight:x,setQuizzesWeight:w,assignmentsWeight:v,setAssignmentsWeight:S,customCategoryOverrides:b,setCustomCategoryOverrides:C,exportDropdownOpen:N,setExportDropdownOpen:y,exportTooltipOpen:P,setExportTooltipOpen:L,loadingExportClassId:_,setLoadingExportClassId:O,isExportingAllCombined:T,setIsExportingAllCombined:A,isGeneratingPDFReport:R,setIsGeneratingPDFReport:D,handleQuizzesWeightChange:I,handleAssignmentsWeightChange:$,csvPreviewData:U,triggerExportForClass:E,handleExportGrades:F,handleGeneratePDFReport:j,handleExportAllClassesCombined:B,get30DayAverageWarning:X}}class FS{constructor(){this.store=$t(()=>({items:new Map}))}register(e,n){const s=n||e.pluginId;this.store.setState(i=>{const o=new Map(i.items);return o.set(e.type,{config:{...e,pluginId:s},pluginId:s}),{items:o}})}unregister(e,n){this.store.setState(s=>{const i=s.items.get(e);if(!i||n&&i.pluginId!==n)return s;const o=new Map(s.items);return o.delete(e),{items:o}})}unregisterPlugin(e){this.store.setState(n=>{let s=!1;const i=new Map(n.items);for(const[o,a]of n.items)a.pluginId===e&&(i.delete(o),s=!0);return s?{items:i}:n})}get(e){return this.store.getState().items.get(e)?.config}getAll(){return Array.from(this.store.getState().items.values()).map(e=>e.config)}has(e){return this.store.getState().items.has(e)}getStore(){return this.store}}const os=new FS;function eC(){return pn(os.getStore(),Kf(t=>Array.from(t.items.values()).map(e=>e.config)))}const tC={slate:{iconBg:"bg-slate-100",iconText:"text-slate-600",cardHoverBorder:"hover:border-slate-400",cardHoverRing:"group-hover:ring-slate-300",cardHoverShadow:"group-hover:shadow-slate-200/70",groupAccent:"bg-slate-400",groupText:"text-slate-500"},blue:{iconBg:"bg-blue-100",iconText:"text-blue-600",cardHoverBorder:"hover:border-blue-400",cardHoverRing:"group-hover:ring-blue-300",cardHoverShadow:"group-hover:shadow-blue-200/70",groupAccent:"bg-blue-400",groupText:"text-blue-500"},violet:{iconBg:"bg-violet-100",iconText:"text-violet-600",cardHoverBorder:"hover:border-violet-400",cardHoverRing:"group-hover:ring-violet-300",cardHoverShadow:"group-hover:shadow-violet-200/70",groupAccent:"bg-violet-400",groupText:"text-violet-500"},amber:{iconBg:"bg-amber-100",iconText:"text-amber-600",cardHoverBorder:"hover:border-amber-400",cardHoverRing:"group-hover:ring-amber-300",cardHoverShadow:"group-hover:shadow-amber-200/70",groupAccent:"bg-amber-400",groupText:"text-amber-500"},rose:{iconBg:"bg-rose-100",iconText:"text-rose-600",cardHoverBorder:"hover:border-rose-400",cardHoverRing:"group-hover:ring-rose-300",cardHoverShadow:"group-hover:shadow-rose-200/70",groupAccent:"bg-rose-400",groupText:"text-rose-500"},emerald:{iconBg:"bg-emerald-100",iconText:"text-emerald-600",cardHoverBorder:"hover:border-emerald-400",cardHoverRing:"group-hover:ring-emerald-300",cardHoverShadow:"group-hover:shadow-emerald-200/70",groupAccent:"bg-emerald-400",groupText:"text-emerald-500"},cyan:{iconBg:"bg-cyan-100",iconText:"text-cyan-600",cardHoverBorder:"hover:border-cyan-400",cardHoverRing:"group-hover:ring-cyan-300",cardHoverShadow:"group-hover:shadow-cyan-200/70",groupAccent:"bg-cyan-400",groupText:"text-cyan-500"},pink:{iconBg:"bg-pink-100",iconText:"text-pink-600",cardHoverBorder:"hover:border-pink-400",cardHoverRing:"group-hover:ring-pink-300",cardHoverShadow:"group-hover:shadow-pink-200/70",groupAccent:"bg-pink-400",groupText:"text-pink-500"},indigo:{iconBg:"bg-indigo-100",iconText:"text-indigo-600",cardHoverBorder:"hover:border-indigo-400",cardHoverRing:"group-hover:ring-indigo-300",cardHoverShadow:"group-hover:shadow-indigo-200/70",groupAccent:"bg-indigo-400",groupText:"text-indigo-500"}},nC=[{id:"present",labelZh:"内容呈现",labelEn:"Content"},{id:"assess",labelZh:"评估互动",labelEn:"Assessment"},{id:"manage",labelZh:"课堂管理",labelEn:"Classroom"},{id:"extension",labelZh:"插件扩展",labelEn:"Extensions"}],BS=[{type:"presentation",labelZh:"课件演示",labelEn:"Slides Deck",descriptionZh:"Markdown 幻灯片",descriptionEn:"Markdown slides",icon:Il,color:"violet",group:"present",defaultData:{markdown:`# Title Slide
|
|
170
|
+
---
|
|
171
|
+
## Slide 2`},editFields:[{key:"markdown",labelZh:"幻灯片内容 (Markdown)",labelEn:"Slides Content (Markdown)",kind:"textarea",placeholderZh:`# 标题
|
|
172
|
+
---
|
|
173
|
+
## 第二页`}]},{type:"code-sandbox",labelZh:"代码沙箱",labelEn:"Code Editor",descriptionZh:"可运行代码",descriptionEn:"Runnable code",icon:Es,color:"slate",group:"present",defaultData:{code:"console.log('Hello Sandbox!');"},editFields:[{key:"code",labelZh:"代码",labelEn:"Code",kind:"textarea",placeholderZh:"console.log('Hello');"}]},{type:"math-graph",labelZh:"数学函数",labelEn:"Math Grapher",descriptionZh:"函数图像",descriptionEn:"Function graph",icon:Mi,color:"blue",group:"present",defaultData:{equation:"Math.sin(x)"},editFields:[{key:"equation",labelZh:"函数表达式",labelEn:"Equation",kind:"input",placeholderZh:"如 Math.sin(x)"}]},{type:"html-applet",labelZh:"交互网页课件",labelEn:"Interactive Courseware",descriptionZh:"可交互 HTML/ZIP 网页",descriptionEn:"Interactive web/ZIP applet",icon:ci,color:"emerald",group:"present",defaultData:{title:"Interactive Web Courseware",code:`<!-- Interactive Web Courseware -->
|
|
174
|
+
<div style='padding:20px; text-align:center;'>
|
|
175
|
+
<h2>Interactive Web Courseware</h2>
|
|
176
|
+
<p>在属性栏中配置本地 ZIP/HTML 部署包。</p>
|
|
177
|
+
</div>`},editFields:[{key:"title",labelZh:"标题",labelEn:"Title",kind:"input",placeholderZh:"课件标题",placeholderEn:"Courseware title"},{key:"coursewareUuid",labelZh:"互动课件 (Courseware)",labelEn:"Courseware",kind:"select",loadOptions:async()=>{try{return(await(await fetch("/api/courseware")).json()).map(n=>({value:n.uuid,label:n.name}))}catch{return[]}}},{key:"code",labelZh:"HTML 代码",labelEn:"HTML Code",kind:"textarea",placeholderZh:"<div>…</div>"}]},{type:"quiz",labelZh:"随堂测试",labelEn:"Interactive Quiz",descriptionZh:"选择题互动",descriptionEn:"Multiple choice",icon:jl,color:"amber",group:"assess",defaultData:{question:"New Quiz",options:["A","B","C","D"]},editFields:[{key:"question",labelZh:"题目",labelEn:"Question",kind:"input",placeholderZh:"请输入题目"},{key:"options",labelZh:"选项 (A/B/C/D)",labelEn:"Options (A/B/C/D)",kind:"options"}]},{type:"assignment",labelZh:"作业提交",labelEn:"Assignment",descriptionZh:"布置与提交",descriptionEn:"Submit work",icon:Dl,color:"rose",group:"assess",defaultData:{title:"New Assignment",description:"Upload your work here"},editFields:[{key:"title",labelZh:"作业标题",labelEn:"Title",kind:"input",placeholderZh:"如:第一章练习"},{key:"description",labelZh:"说明",labelEn:"Description",kind:"textarea",placeholderZh:"作业要求说明…"}]},{type:"rollcall",labelZh:"随机点名",labelEn:"Random Picker",descriptionZh:"课堂点名",descriptionEn:"Pick a student",icon:Cl,color:"cyan",group:"manage",defaultData:{allStudents:[]},editFields:[]},{type:"hello-world",labelZh:"问候插件",labelEn:"Hello World",descriptionZh:"欢迎问候",descriptionEn:"Welcome greeting",icon:ot,color:"pink",group:"manage",defaultData:{},editFields:[]}],VS=BS.reduce((t,e)=>(t[e.type]=e,t),{});function US(t){return VS[t]||os.get(t)}const nl="openlearnv2.agentProviderId";function HS({lang:t,addToast:e,host:n,session:s,fetchStudents:i,fetchClasses:o,chatLogRef:a}){const l=ue(ce=>ce.lessons),c=ue(ce=>ce.setLessons),d=dS(l),{lessonsSearchQuery:h,setLessonsSearchQuery:m,lessonsSortOrder:p,setLessonsSortOrder:u,filterEnrollment:g,setFilterEnrollment:x,filterHasContent:w,setFilterHasContent:v,filterThisMonth:S,setFilterThisMonth:b,copyingLessonId:C,setCopyingLessonId:N,filteredAndSortedLessons:y}=d,P=ue(ce=>ce.selectedLesson),L=ue(ce=>ce.setSelectedLesson),_=ue(ce=>ce.elements),O=ue(ce=>ce.setElements),[T,A]=f.useState(!1),[R,D]=f.useState("agent"),I=ue(ce=>ce.classes),$=ue(ce=>ce.setClasses),U=ue(ce=>ce.students),E=ue(ce=>ce.setStudents),F=uS(),{computerLabs:j,setComputerLabs:B,loadingLabs:X,setLoadingLabs:k,fetchLabs:q,classSeats:J,setClassSeats:G,savingSeats:re,setSavingSeats:Y,fetchClassSeats:ye,todaySchedules:ee,setTodaySchedules:z,fetchTodaySchedules:W,classSchedulesMap:K,setClassSchedulesMap:ne,fetchClassSchedules:te,scheduleAttendanceMap:me,setScheduleAttendanceMap:je,fetchScheduleAttendance:Q,expandedScheduleId:se,setExpandedScheduleId:Z,newScheduleDate:pe,setNewScheduleDate:le,newScheduleLessonId:he,setNewScheduleLessonId:Ce}=F,Ee=hS({lang:t,addToast:e,setCopyingLessonId:N}),{fetchLessons:M,handleQuickCreateLesson:V,handleDeleteCourse:ie,handleCopyCourse:oe,fetchElements:fe}=Ee,Ae=jS({fetchClassSchedules:te}),{classStudentsMap:Ve,setClassStudentsMap:Ue,classProgressMap:at,setClassProgressMap:lt,classDashboardMap:Pe,setClassDashboardMap:Qe,classAssignmentsMap:Fe,setClassAssignmentsMap:yn,assignmentSubmissionsMap:Re,setAssignmentSubmissionsMap:wn,liveClassStudentProgress:vn,setLiveClassStudentProgress:Sn,fetchClassStudents:At,fetchClassProgress:Vt,fetchClassDashboard:Ut,fetchLiveClassStudentProgress:jn,handleQuickScheduleClass:kn,handleQuickGenerateAssignment:Cn}=Ae,[Ht,Nn]=f.useState(null),En=ce=>{Nn(ce)},[Pn,qt]=f.useState(null),Tn=ce=>{qt(ce)},Wt=f.useRef(null),[ke,xt]=f.useState(null),In=ce=>{const To=US(ce);To&&xt({type:ce,data:{...To.defaultData}})},An=async ce=>{ke&&await Wt.current?.addElementAtCenter(ke.type,ce),xt(null)},zn=ue(ce=>ce.siteInfo),Ln=ue(ce=>ce.setSiteInfo),bt=RS({selectedLesson:P,lessons:l,setLessons:c}),{timelineSegments:Gt,setTimelineSegments:Rn,activeSegmentId:_n,setActiveSegmentId:Dn,segmentToEdit:Mn,setSegmentToEdit:On,draggedSegmentIdx:$n,setDraggedSegmentIdx:Fn,editorSaveStatus:Bn,setEditorSaveStatus:Vn,editorLastSavedTime:Un,setEditorLastSavedTime:Hn,editorPanelsExpanded:qn,setEditorPanelsExpanded:Je,saveTimeline:Wn}=bt,Qt=kS(s),{registeredCommands:be,setRegisteredCommands:et,vfsNodes:Jt,setVfsNodes:ge,processes:He,setProcesses:ct,showProcessLogs:fs,setShowProcessLogs:zt,processLogsContent:Ke,setProcessLogsContent:Lt,showLogs:ze,setShowLogs:hd,currentVfsParent:fd,setCurrentVfsParent:md,fetchRegisteredCommands:pd,fetchVfs:gd,fetchProcesses:xd,fetchProcessLogs:bd}=Qt,yo=PS({lang:t,fetchClasses:o,fetchStudents:i,fetchLessons:M}),{isCloudDriveOpen:yd,setIsCloudDriveOpen:wd,cloudDrivePreviewNode:vd,setCloudDrivePreviewNode:Sd,isSystemResourceLibraryOpen:jd,setIsSystemResourceLibraryOpen:kd,systemResourceTab:Cd,setSystemResourceTab:Nd,selectedLibraryResourceId:Ed,setSelectedLibraryResourceId:Pd,libraryResources:Td,setLibraryResources:Id,loadingLibraryResources:Ad,setLoadingLibraryResources:zd,showCoursewareHub:Ld,setShowCoursewareHub:Rd,fetchLibraryResources:_d,isImportLessonsOpen:Dd,setIsImportLessonsOpen:Md,importStatus:Od,setImportStatus:$d,importProgress:Fd,setImportProgress:Bd,importProgressTotal:Vd,setImportProgressTotal:Ud,importErrorMsg:Hd,setImportErrorMsg:qd,previewImportData:Wd,setPreviewImportData:Gd,isDraggingImport:Qd,setIsDraggingImport:Jd,downloadCsvTemplate:Kd,handleCSVFileChange:Zd,handleCSVImportSubmit:Yd,showImportModal:Xd,setShowImportModal:eu,isImporting:tu,setIsImporting:nu,importError:su,setImportError:ru,importSuccess:iu,setImportSuccess:ou,downloadCSVTemplate:au,handleImportFile:lu}=yo,wo=ue(ce=>ce.setTeacherTab),vo=TS({lang:t,addToast:e,fetchLessons:M,setSelectedLesson:L,setTeacherTab:wo}),{isCourseWizardOpen:cu,setIsCourseWizardOpen:du,wizardStep:uu,setWizardStep:hu,wizardCourseTitle:fu,setWizardCourseTitle:mu,wizardCourseCategory:pu,setWizardCourseCategory:gu,wizardCourseDescription:xu,setWizardCourseDescription:bu,wizardCourseContent:yu,setWizardCourseContent:wu,wizardCourseTimeline:vu,setWizardCourseTimeline:Su,wizardIsSubmitting:ju,handleDeployWizardCourse:ku}=vo,So=AS({session:s,host:n,lang:t,addToast:e,setChatLog:ce=>a.current(ce),setTeacherTab:wo,fetchLessons:M}),{plugins:Cu,setPlugins:Nu,fetchPlugins:Eu,aiProviders:vt,setAiProviders:Pu,fetchAIProviders:Tu,isAIProviderModalOpen:Iu,setIsAIProviderModalOpen:Au,editingAIProvider:zu,setEditingAIProvider:Lu,providerName:Ru,setProviderName:_u,providerApiUrl:Du,setProviderApiUrl:Mu,providerApiKey:Ou,setProviderApiKey:$u,providerModelName:Fu,setProviderModelName:Bu,testingProviderId:Vu,setTestingProviderId:Uu,showPluginModal:Hu,setShowPluginModal:qu,storeTab:Wu,setStoreTab:Gu,pluginCode:Qu,setPluginCode:Ju,installingPlugin:Ku,setInstallingPlugin:Zu,events:Yu,setEvents:Xu,fetchEvents:eh,approvals:th,setApprovals:nh,fetchApprovals:sh,scoreOverrides:rh,setScoreOverrides:ih,handleSaveAIProvider:oh,handleDeleteAIProvider:ah,handleTestAIProvider:lh,handleInstallPlugin:ch,handleZipPluginUpload:dh,handleTogglePlugin:uh,handleDeletePlugin:hh,handleApprove:fh,handleReject:mh}=So,[Rt,jo]=f.useState(()=>typeof window>"u"?"":window.localStorage.getItem(nl)||""),ko=vt.some(ce=>ce.id===Rt)?Rt:vt[0]?.id||"",ph=vt.find(ce=>ce.id===ko)||null;f.useEffect(()=>{typeof window<"u"&&window.localStorage.setItem(nl,Rt)},[Rt]),f.useEffect(()=>{vt.length>0&&!vt.some(ce=>ce.id===Rt)&&jo(vt[0].id)},[vt,Rt]);const Co=zS(),{isQuizGeneratorOpen:gh,setIsQuizGeneratorOpen:xh,quizGeneratorClassId:bh,setQuizGeneratorClassId:yh,quizGenMode:wh,setQuizGenMode:vh,quizGenSelectedLessonId:Sh,setQuizGenSelectedLessonId:jh,quizGenTopic:kh,setQuizGenTopic:Ch,isGeneratingSuggestions:Nh,setIsGeneratingSuggestions:Eh,suggestedObjectives:Ph,setSuggestedObjectives:Th,suggestedQuestions:Ih,setSuggestedQuestions:Ah,savingQuiz:zh,setSavingQuiz:Lh,quizStudentAnswers:Rh,setQuizStudentAnswers:_h,quizGenTimeLimit:Dh,setQuizGenTimeLimit:Mh,quizStudentAnswersRef:Oh,subAssignmentTab:$h,setSubAssignmentTab:Fh}=Co,[Bh,Vh]=f.useState(null),[Uh,Hh]=f.useState("dueDate"),[qh,Wh]=f.useState({}),No=$S({lang:t,classes:I,classStudentsMap:Ve,classDashboardMap:Pe,fetchClassStudents:At,fetchClassDashboard:Ut,fetchClassProgress:Vt}),{isExportWeightModalOpen:Gh,setIsExportWeightModalOpen:Qh,exportClassId:Jh,setExportClassId:Kh,exportClassName:Zh,setExportClassName:Yh,quizzesWeight:Xh,setQuizzesWeight:ef,assignmentsWeight:tf,setAssignmentsWeight:nf,customCategoryOverrides:sf,setCustomCategoryOverrides:rf,exportDropdownOpen:of,setExportDropdownOpen:af,exportTooltipOpen:lf,setExportTooltipOpen:cf,loadingExportClassId:df,setLoadingExportClassId:uf,isExportingAllCombined:hf,setIsExportingAllCombined:ff,isGeneratingPDFReport:mf,setIsGeneratingPDFReport:pf,handleQuizzesWeightChange:gf,handleAssignmentsWeightChange:xf,csvPreviewData:bf,triggerExportForClass:yf,handleExportGrades:wf,handleGeneratePDFReport:vf,handleExportAllClassesCombined:Eo,get30DayAverageWarning:Sf}=No,Po=LS({lang:t,classes:I,expandedClassId:Ht,fetchClasses:o,fetchClassStudents:At,handleExportAllClassesCombined:Eo}),{batchMode:jf,setBatchMode:kf,selectedClassIds:Cf,setSelectedClassIds:Nf,selectedStudentIds:Ef,setSelectedStudentIds:Pf,batchPicker:Tf,setBatchPicker:If,batchPickerLesson:Af,setBatchPickerLesson:zf,batchPickerDate:Lf,setBatchPickerDate:Rf,batchPickerTargetClass:_f,setBatchPickerTargetClass:Df,toggleClassSelection:Mf,toggleSelectAllClasses:Of,toggleStudentSelection:$f,toggleSelectAllStudents:Ff,handleBatchDeleteClasses:Bf,handleBatchExportClasses:Vf,handleBatchSetPasscode:Uf,handleBatchScheduleClasses:Hf,handleBatchDeleteStudents:qf,handleBatchResetPassword:Wf,handleBatchTransferStudents:Gf,handleBatchSetLockedLesson:Qf,confirmBatchPicker:Jf}=Po;return{lessons:l,setLessons:c,lessonFilteringData:d,lessonsSearchQuery:h,setLessonsSearchQuery:m,lessonsSortOrder:p,setLessonsSortOrder:u,filterEnrollment:g,setFilterEnrollment:x,filterHasContent:w,setFilterHasContent:v,filterThisMonth:S,setFilterThisMonth:b,copyingLessonId:C,setCopyingLessonId:N,filteredAndSortedLessons:y,selectedLesson:P,setSelectedLesson:L,elements:_,setElements:O,showRightSidebar:T,setShowRightSidebar:A,rightSidebarTab:R,setRightSidebarTab:D,classes:I,setClasses:$,students:U,setStudents:E,labAndScheduleData:F,computerLabs:j,setComputerLabs:B,loadingLabs:X,setLoadingLabs:k,fetchLabs:q,classSeats:J,setClassSeats:G,savingSeats:re,setSavingSeats:Y,fetchClassSeats:ye,todaySchedules:ee,setTodaySchedules:z,fetchTodaySchedules:W,classSchedulesMap:K,setClassSchedulesMap:ne,fetchClassSchedules:te,scheduleAttendanceMap:me,setScheduleAttendanceMap:je,fetchScheduleAttendance:Q,expandedScheduleId:se,setExpandedScheduleId:Z,newScheduleDate:pe,setNewScheduleDate:le,newScheduleLessonId:he,setNewScheduleLessonId:Ce,lessonCrudData:Ee,fetchLessons:M,handleQuickCreateLesson:V,handleDeleteCourse:ie,handleCopyCourse:oe,fetchElements:fe,classOpsData:Ae,classStudentsMap:Ve,setClassStudentsMap:Ue,classProgressMap:at,setClassProgressMap:lt,classDashboardMap:Pe,setClassDashboardMap:Qe,classAssignmentsMap:Fe,setClassAssignmentsMap:yn,assignmentSubmissionsMap:Re,setAssignmentSubmissionsMap:wn,liveClassStudentProgress:vn,setLiveClassStudentProgress:Sn,fetchClassStudents:At,fetchClassProgress:Vt,fetchClassDashboard:Ut,fetchLiveClassStudentProgress:jn,handleQuickScheduleClass:kn,handleQuickGenerateAssignment:Cn,expandedClassId:Ht,setExpandedClassId:En,expandedStudentId:Pn,setExpandedStudentId:Tn,whiteboardRef:Wt,paletteEdit:ke,setPaletteEdit:xt,handlePaletteActivate:In,handlePaletteConfirm:An,siteInfo:zn,setSiteInfo:Ln,lessonTimelineData:bt,timelineSegments:Gt,setTimelineSegments:Rn,activeSegmentId:_n,setActiveSegmentId:Dn,segmentToEdit:Mn,setSegmentToEdit:On,draggedSegmentIdx:$n,setDraggedSegmentIdx:Fn,editorSaveStatus:Bn,setEditorSaveStatus:Vn,editorLastSavedTime:Un,setEditorLastSavedTime:Hn,editorPanelsExpanded:qn,setEditorPanelsExpanded:Je,saveTimeline:Wn,systemData:Qt,registeredCommands:be,setRegisteredCommands:et,vfsNodes:Jt,setVfsNodes:ge,processes:He,setProcesses:ct,showProcessLogs:fs,setShowProcessLogs:zt,processLogsContent:Ke,setProcessLogsContent:Lt,showLogs:ze,setShowLogs:hd,currentVfsParent:fd,setCurrentVfsParent:md,fetchRegisteredCommands:pd,fetchVfs:gd,fetchProcesses:xd,fetchProcessLogs:bd,resourceLibraryData:yo,isCloudDriveOpen:yd,setIsCloudDriveOpen:wd,cloudDrivePreviewNode:vd,setCloudDrivePreviewNode:Sd,isSystemResourceLibraryOpen:jd,setIsSystemResourceLibraryOpen:kd,systemResourceTab:Cd,setSystemResourceTab:Nd,selectedLibraryResourceId:Ed,setSelectedLibraryResourceId:Pd,libraryResources:Td,setLibraryResources:Id,loadingLibraryResources:Ad,setLoadingLibraryResources:zd,showCoursewareHub:Ld,setShowCoursewareHub:Rd,fetchLibraryResources:_d,isImportLessonsOpen:Dd,setIsImportLessonsOpen:Md,importStatus:Od,setImportStatus:$d,importProgress:Fd,setImportProgress:Bd,importProgressTotal:Vd,setImportProgressTotal:Ud,importErrorMsg:Hd,setImportErrorMsg:qd,previewImportData:Wd,setPreviewImportData:Gd,isDraggingImport:Qd,setIsDraggingImport:Jd,downloadCsvTemplate:Kd,handleCSVFileChange:Zd,handleCSVImportSubmit:Yd,showImportModal:Xd,setShowImportModal:eu,isImporting:tu,setIsImporting:nu,importError:su,setImportError:ru,importSuccess:iu,setImportSuccess:ou,downloadCSVTemplate:au,handleImportFile:lu,courseWizard:vo,isCourseWizardOpen:cu,setIsCourseWizardOpen:du,wizardStep:uu,setWizardStep:hu,wizardCourseTitle:fu,setWizardCourseTitle:mu,wizardCourseCategory:pu,setWizardCourseCategory:gu,wizardCourseDescription:xu,setWizardCourseDescription:bu,wizardCourseContent:yu,setWizardCourseContent:wu,wizardCourseTimeline:vu,setWizardCourseTimeline:Su,wizardIsSubmitting:ju,handleDeployWizardCourse:ku,pluginManagementData:So,plugins:Cu,setPlugins:Nu,fetchPlugins:Eu,aiProviders:vt,setAiProviders:Pu,fetchAIProviders:Tu,isAIProviderModalOpen:Iu,setIsAIProviderModalOpen:Au,editingAIProvider:zu,setEditingAIProvider:Lu,providerName:Ru,setProviderName:_u,providerApiUrl:Du,setProviderApiUrl:Mu,providerApiKey:Ou,setProviderApiKey:$u,providerModelName:Fu,setProviderModelName:Bu,testingProviderId:Vu,setTestingProviderId:Uu,showPluginModal:Hu,setShowPluginModal:qu,storeTab:Wu,setStoreTab:Gu,pluginCode:Qu,setPluginCode:Ju,installingPlugin:Ku,setInstallingPlugin:Zu,events:Yu,setEvents:Xu,fetchEvents:eh,approvals:th,setApprovals:nh,fetchApprovals:sh,scoreOverrides:rh,setScoreOverrides:ih,handleSaveAIProvider:oh,handleDeleteAIProvider:ah,handleTestAIProvider:lh,handleInstallPlugin:ch,handleZipPluginUpload:dh,handleTogglePlugin:uh,handleDeletePlugin:hh,handleApprove:fh,handleReject:mh,agentProviderId:Rt,setAgentProviderId:jo,effectiveAgentProviderId:ko,selectedAgentProvider:ph,quizGenerator:Co,isQuizGeneratorOpen:gh,setIsQuizGeneratorOpen:xh,quizGeneratorClassId:bh,setQuizGeneratorClassId:yh,quizGenMode:wh,setQuizGenMode:vh,quizGenSelectedLessonId:Sh,setQuizGenSelectedLessonId:jh,quizGenTopic:kh,setQuizGenTopic:Ch,isGeneratingSuggestions:Nh,setIsGeneratingSuggestions:Eh,suggestedObjectives:Ph,setSuggestedObjectives:Th,suggestedQuestions:Ih,setSuggestedQuestions:Ah,savingQuiz:zh,setSavingQuiz:Lh,quizStudentAnswers:Rh,setQuizStudentAnswers:_h,quizGenTimeLimit:Dh,setQuizGenTimeLimit:Mh,quizStudentAnswersRef:Oh,subAssignmentTab:$h,setSubAssignmentTab:Fh,isGeneratingAssignment:Bh,setIsGeneratingAssignment:Vh,assignmentSortOrder:Uh,setAssignmentSortOrder:Hh,isGrading:qh,setIsGrading:Wh,gradeExport:No,isExportWeightModalOpen:Gh,setIsExportWeightModalOpen:Qh,exportClassId:Jh,setExportClassId:Kh,exportClassName:Zh,setExportClassName:Yh,quizzesWeight:Xh,setQuizzesWeight:ef,assignmentsWeight:tf,setAssignmentsWeight:nf,customCategoryOverrides:sf,setCustomCategoryOverrides:rf,exportDropdownOpen:of,setExportDropdownOpen:af,exportTooltipOpen:lf,setExportTooltipOpen:cf,loadingExportClassId:df,setLoadingExportClassId:uf,isExportingAllCombined:hf,setIsExportingAllCombined:ff,isGeneratingPDFReport:mf,setIsGeneratingPDFReport:pf,handleQuizzesWeightChange:gf,handleAssignmentsWeightChange:xf,csvPreviewData:bf,triggerExportForClass:yf,handleExportGrades:wf,handleGeneratePDFReport:vf,handleExportAllClassesCombined:Eo,get30DayAverageWarning:Sf,classBatch:Po,batchMode:jf,setBatchMode:kf,selectedClassIds:Cf,setSelectedClassIds:Nf,selectedStudentIds:Ef,setSelectedStudentIds:Pf,batchPicker:Tf,setBatchPicker:If,batchPickerLesson:Af,setBatchPickerLesson:zf,batchPickerDate:Lf,setBatchPickerDate:Rf,batchPickerTargetClass:_f,setBatchPickerTargetClass:Df,toggleClassSelection:Mf,toggleSelectAllClasses:Of,toggleStudentSelection:$f,toggleSelectAllStudents:Ff,handleBatchDeleteClasses:Bf,handleBatchExportClasses:Vf,handleBatchSetPasscode:Uf,handleBatchScheduleClasses:Hf,handleBatchDeleteStudents:qf,handleBatchResetPassword:Wf,handleBatchTransferStudents:Gf,handleBatchSetLockedLesson:Qf,confirmBatchPicker:Jf,handleSeedSuccess:async ce=>{await o(),await M(),await W().catch(()=>{}),Ne.getState().setLiveClassSelectedClassId(ce.classId),L(ce.lessonId),Ne.getState().setLiveClassIsActive(!0),e(t==="zh"?"示范课堂准备就绪":"Demo Classroom Ready",t==="zh"?"示范班级与课件已加载,已自动开启授课状态!":"Demo class & courseware loaded. Live class session is now active!","success")}}}function qS(){const[t,e]=f.useState(null),[n,s]=f.useState(null);f.useEffect(()=>{if(n){const g=setTimeout(()=>{s(null)},8e3);return()=>clearTimeout(g)}},[n]),f.useEffect(()=>{if(t)try{const g=window.AudioContext||window.webkitAudioContext;if(g){const x=new g,w=x.currentTime,v=x.createOscillator(),S=x.createGain();v.type="sine",v.frequency.setValueAtTime(587.33,w),v.frequency.exponentialRampToValueAtTime(880,w+.25),S.gain.setValueAtTime(.25,w),S.gain.exponentialRampToValueAtTime(.001,w+.8),v.connect(S),S.connect(x.destination),v.start(w),v.stop(w+.8)}}catch{}},[t]);const[i,o]=f.useState(0),[a,l]=f.useState([]),[c,d]=f.useState(new Map),[h,m]=f.useState([]),[p,u]=f.useState({});return{pickedAlertData:t,setPickedAlertData:e,pickedAnnouncement:n,setPickedAnnouncement:s,liveClassTimeRemaining:i,setLiveClassTimeRemaining:o,liveClassFeed:a,setLiveClassFeed:l,liveClassAcknowledgedMap:c,setLiveClassAcknowledgedMap:d,onlineStudentIds:h,setOnlineStudentIds:m,activeStudentLessons:p,setActiveStudentLessons:u}}function WS(t){const{activeStudentId:e,activeRole:n,selectedLesson:s,students:i,quizStudentAnswersRef:o,setStudentViewStatus:a}=t,l=ue(b=>b.session),c=ue(b=>b.setSelectedLesson),[d,h]=f.useState(null),[m,p]=f.useState({}),[u,g]=f.useState(null),x=async b=>{try{const{ok:C,data:N}=await SS(b);C&&(h(N),N.profile&&N.profile.locked_lesson_id&&(c(N.profile.locked_lesson_id),a("lesson")))}catch{}},w=async(b=!1)=>{if(!u||!e)return;const N=u?.content&&u.content.startsWith('{"quizType":"mcq_learning_objectives"')?JSON.stringify(o.current):"Submitted via Whiteboard";try{const{ok:y}=await bS(u.id,{studentId:e,content:N});y&&(b&&alert("Time is up! Your assessment was successfully submitted automatically."),await x(e),a("dashboard"),g(null))}catch(y){console.error(y)}};return f.useEffect(()=>{if(l&&n==="student"&&e){x(e);const b=i.find(C=>C.id===e);b&&b.locked_lesson_id&&(c(b.locked_lesson_id),a("lesson"))}},[l,n,e,i]),{studentDashboardData:d,setStudentDashboardData:h,studentProgressMap:m,setStudentProgressMap:p,selectedAssignment:u,setSelectedAssignment:g,fetchStudentDashboard:x,fetchStudentProgress:async b=>{try{const{ok:C,data:N}=await sx(b);C&&p(y=>({...y,[b]:N}))}catch{}},updateStudentProgress:async b=>{if(n==="student"&&e&&s)try{await tx(e,{lessonId:s,completed:b===100,progressPercent:b})}catch(C){console.error("Failed to update student progress:",C)}},submitQuizAssignment:w}}function GS(t,e,n){const[s,i]=f.useState(new Set),[o,a]=f.useState(null),[l,c]=f.useState(!1),d=f.useMemo(()=>{if(t!=="student"||!e)return[];const m=[],p=e.assignments||[];for(const u of p)if(!u.submission_status)m.push({id:`new-${u.id}`,type:"new_assignment",title:n==="zh"?"新发布作业":"New Assignment",message:n==="zh"?`您有一项新作业:"${u.title}"`:`You have a new assignment: ${u.title}`,date:u.created_at,relatedId:u.id});else if(u.submission_status==="graded"){const g=!!u.feedback;m.push({id:`graded-${u.id}`,type:"graded",title:g?n==="zh"?"收到新成绩与反馈":"Grade & Feedback Posted":n==="zh"?"新成绩发布":"Assignment Graded",message:g?n==="zh"?`您的作业"${u.title}"已评分,得分:${u.score}%。反馈:"${u.feedback}"`:`Your assignment "${u.title}" was graded. Score: ${u.score}%. Teacher feedback: "${u.feedback}"`:n==="zh"?`您的作业"${u.title}"已评分,得分:${u.score}%`:`Your assignment "${u.title}" was graded. Score: ${u.score}%`,date:u.submitted_at||u.created_at,relatedId:u.id})}return m.sort((u,g)=>g.date-u.date)},[t,e,n]),h=f.useMemo(()=>d.filter(m=>!s.has(m.id)),[d,s]);return{studentNotifications:d,unreadNotifications:h,readNotifications:s,setReadNotifications:i,selectedNotificationForModal:o,setSelectedNotificationForModal:a,isNotificationsOpen:l,setIsNotificationsOpen:c}}function QS(t){const{lang:e,t:n,selectedLesson:s,effectiveAgentProviderId:i,expandedClassId:o,fetchLessons:a,fetchClasses:l,fetchStudents:c,fetchClassStudents:d,fetchClassProgress:h,fetchClassDashboard:m,fetchElements:p}=t,[u,g]=f.useState([{role:"agent",content:n.agentIntro||""}]),[x,w]=f.useState(""),[v,S]=f.useState(!1),[b,C]=f.useState([]),[N,y]=f.useState("");f.useEffect(()=>{u.length===1&&u[0].role==="agent"&&g([{role:"agent",content:n.agentIntro}])},[e,n.agentIntro]);const P=f.useCallback(async A=>{try{const R=await fetch(`/api/agent/conversations?lessonId=${encodeURIComponent(A||"")}`);if(!R.ok)return;const D=await R.json(),I=Array.isArray(D.messages)?D.messages:[];I.length>0?g(I.map($=>({role:$.role==="assistant"?"agent":"user",content:$.content}))):g([{role:"agent",content:n.agentIntro}])}catch{}},[n.agentIntro]),L=f.useCallback(async()=>{try{await fetch(`/api/agent/conversations?lessonId=${encodeURIComponent(s||"")}`,{method:"DELETE"})}catch{}g([{role:"agent",content:n.agentIntro}])},[s,n.agentIntro]);return f.useEffect(()=>{P(s)},[s,P]),{personaId:N,setPersonaId:y,chatLog:u,setChatLog:g,input:x,setInput:w,loading:v,setLoading:S,chatAttachments:b,setChatAttachments:C,handleChatFileChange:A=>{A.target.files&&Array.from(A.target.files).forEach(R=>{const D=new FileReader;D.onload=I=>{I.target?.result&&C($=>[...$,{name:R.name,content:I.target.result}])},R.name.endsWith(".zip")?D.readAsDataURL(R):D.readAsText(R)})},handleChatDrop:A=>{A.preventDefault(),A.dataTransfer.files&&Array.from(A.dataTransfer.files).forEach(R=>{const D=new FileReader;D.onload=I=>{I.target?.result&&C($=>[...$,{name:R.name,content:I.target.result}])},R.name.endsWith(".zip")?D.readAsDataURL(R):D.readAsText(R)})},handleSend:async A=>{if(A.preventDefault(),!x.trim()||v)return;const R=[...b];let D=x;R.length>0&&(D+=`
|
|
178
|
+
(📁 ${e==="zh"?"附件":"Attachments"}: ${R.map(I=>I.name).join(", ")})`),g(I=>[...I,{role:"user",content:D}]),w(""),C([]),S(!0);try{const I=await fetch("/api/agent/chat",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({message:x,lang:e,currentLessonId:s,attachments:R,providerId:i||null,personaId:N||null})}),$=await I.json();let U="";!I.ok||$.success===!1?U=`⚠️ ${$.message||$.error||(e==="zh"?"未知系统错误":"Unknown System Error")}`:(U=$.agentText||"",$.toolResults&&$.toolResults.length>0&&(U+=`
|
|
179
|
+
|
|
180
|
+
${n.executedCommands}`+$.toolResults.map(E=>E.callName).join(", "))),g(E=>[...E,{role:"agent",content:U}]),await a(),await l(),await c(),o&&(await d(o),await h(o),await m(o)),s&&await p(s)}catch{g(I=>[...I,{role:"agent",content:n.simulationError}])}finally{S(!1)}},handleClearAgentMemory:L,restoreAgentMemory:P}}function JS(t){const{session:e,showProcessLogs:n,activeStudentId:s,currentVfsParent:i,selectedLesson:o,selectedAssignment:a,expandedClassId:l,fetchLessons:c,fetchPlugins:d,fetchRegisteredCommands:h,fetchEvents:m,fetchApprovals:p,fetchProcesses:u,fetchClasses:g,fetchTodaySchedules:x,fetchStudents:w,fetchLabs:v,fetchVfs:S,fetchProcessLogs:b,fetchClassStudents:C,fetchElements:N}=t,y=f.useRef(i),P=f.useRef(o),L=f.useRef(a),_=f.useRef(l);f.useEffect(()=>{y.current=i},[i]),f.useEffect(()=>{P.current=o},[o]),f.useEffect(()=>{L.current=a},[a]),f.useEffect(()=>{_.current=l},[l]),f.useEffect(()=>{if(!e)return;const O=e.role==="student",T=e.role==="teacher",A=T&&(e.subRole==="administrator"||e.username==="admin"||e.userId==="usr_admin");c(),d(),h(),x().catch(()=>{}),A&&(m(),p(),u()),T?(g(),w(),v(),S(y.current)):O&&y.current&&S(y.current);let R=!1;const D=setInterval(async()=>{if(!R){R=!0;try{if(A&&(await m(),await p(),await u(),n&&await b(n)),await c(),await h(),await x().catch(()=>{}),T&&(await g(),await w(),await v(),await S(y.current),_.current&&await C(_.current)),P.current&&await N(P.current),L.current){const I=s||L.current.student_id;await N(`assignment-${L.current.id}-student-${I}`)}}finally{R=!1}}},2e3);return()=>clearInterval(D)},[e,n,s]),f.useEffect(()=>{e&&(e.role==="teacher"||i)&&S(i)},[i,e]),f.useEffect(()=>{o&&N(o)},[o])}const gt=Object.create(null);gt.open="0";gt.close="1";gt.ping="2";gt.pong="3";gt.message="4";gt.upgrade="5";gt.noop="6";const Rs=Object.create(null);Object.keys(gt).forEach(t=>{Rs[gt[t]]=t});const Ci={type:"error",data:"parser error"},Gc=typeof Blob=="function"||typeof Blob<"u"&&Object.prototype.toString.call(Blob)==="[object BlobConstructor]",Qc=typeof ArrayBuffer=="function",Jc=t=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(t):t&&t.buffer instanceof ArrayBuffer,mo=({type:t,data:e},n,s)=>Gc&&e instanceof Blob?n?s(e):sl(e,s):Qc&&(e instanceof ArrayBuffer||Jc(e))?n?s(e):sl(new Blob([e]),s):s(gt[t]+(e||"")),sl=(t,e)=>{const n=new FileReader;return n.onload=function(){const s=n.result.split(",")[1];e("b"+(s||""))},n.readAsDataURL(t)};function rl(t){return t instanceof Uint8Array?t:t instanceof ArrayBuffer?new Uint8Array(t):new Uint8Array(t.buffer,t.byteOffset,t.byteLength)}let qr;function KS(t,e){if(Gc&&t.data instanceof Blob)return t.data.arrayBuffer().then(rl).then(e);if(Qc&&(t.data instanceof ArrayBuffer||Jc(t.data)))return e(rl(t.data));mo(t,!1,n=>{qr||(qr=new TextEncoder),e(qr.encode(n))})}const il="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",es=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(let t=0;t<il.length;t++)es[il.charCodeAt(t)]=t;const ZS=t=>{let e=t.length*.75,n=t.length,s,i=0,o,a,l,c;t[t.length-1]==="="&&(e--,t[t.length-2]==="="&&e--);const d=new ArrayBuffer(e),h=new Uint8Array(d);for(s=0;s<n;s+=4)o=es[t.charCodeAt(s)],a=es[t.charCodeAt(s+1)],l=es[t.charCodeAt(s+2)],c=es[t.charCodeAt(s+3)],h[i++]=o<<2|a>>4,h[i++]=(a&15)<<4|l>>2,h[i++]=(l&3)<<6|c&63;return d},YS=typeof ArrayBuffer=="function",po=(t,e)=>{if(typeof t!="string")return{type:"message",data:Kc(t,e)};const n=t.charAt(0);return n==="b"?{type:"message",data:XS(t.substring(1),e)}:Rs[n]?t.length>1?{type:Rs[n],data:t.substring(1)}:{type:Rs[n]}:Ci},XS=(t,e)=>{if(YS){const n=ZS(t);return Kc(n,e)}else return{base64:!0,data:t}},Kc=(t,e)=>{switch(e){case"blob":return t instanceof Blob?t:new Blob([t]);case"arraybuffer":default:return t instanceof ArrayBuffer?t:t.buffer}},Zc="",ej=(t,e)=>{const n=t.length,s=new Array(n);let i=0;t.forEach((o,a)=>{mo(o,!1,l=>{s[a]=l,++i===n&&e(s.join(Zc))})})},tj=(t,e)=>{const n=t.split(Zc),s=[];for(let i=0;i<n.length;i++){const o=po(n[i],e);if(s.push(o),o.type==="error")break}return s};function nj(){return new TransformStream({transform(t,e){KS(t,n=>{const s=n.length;let i;if(s<126)i=new Uint8Array(1),new DataView(i.buffer).setUint8(0,s);else if(s<65536){i=new Uint8Array(3);const o=new DataView(i.buffer);o.setUint8(0,126),o.setUint16(1,s)}else{i=new Uint8Array(9);const o=new DataView(i.buffer);o.setUint8(0,127),o.setBigUint64(1,BigInt(s))}t.data&&typeof t.data!="string"&&(i[0]|=128),e.enqueue(i),e.enqueue(n)})}})}let Wr;function Ss(t){return t.reduce((e,n)=>e+n.length,0)}function js(t,e){if(t[0].length===e)return t.shift();const n=new Uint8Array(e);let s=0;for(let i=0;i<e;i++)n[i]=t[0][s++],s===t[0].length&&(t.shift(),s=0);return t.length&&s<t[0].length&&(t[0]=t[0].slice(s)),n}function sj(t,e){Wr||(Wr=new TextDecoder);const n=[];let s=0,i=-1,o=!1;return new TransformStream({transform(a,l){for(n.push(a);;){if(s===0){if(Ss(n)<1)break;const c=js(n,1);o=(c[0]&128)===128,i=c[0]&127,i<126?s=3:i===126?s=1:s=2}else if(s===1){if(Ss(n)<2)break;const c=js(n,2);i=new DataView(c.buffer,c.byteOffset,c.length).getUint16(0),s=3}else if(s===2){if(Ss(n)<8)break;const c=js(n,8),d=new DataView(c.buffer,c.byteOffset,c.length),h=d.getUint32(0);if(h>Math.pow(2,21)-1){l.enqueue(Ci);break}i=h*Math.pow(2,32)+d.getUint32(4),s=3}else{if(Ss(n)<i)break;const c=js(n,i);l.enqueue(po(o?c:Wr.decode(c),e)),s=0}if(i===0||i>t){l.enqueue(Ci);break}}}})}const Yc=4;function Me(t){if(t)return rj(t)}function rj(t){for(var e in Me.prototype)t[e]=Me.prototype[e];return t}Me.prototype.on=Me.prototype.addEventListener=function(t,e){return this._callbacks=this._callbacks||{},(this._callbacks["$"+t]=this._callbacks["$"+t]||[]).push(e),this};Me.prototype.once=function(t,e){function n(){this.off(t,n),e.apply(this,arguments)}return n.fn=e,this.on(t,n),this};Me.prototype.off=Me.prototype.removeListener=Me.prototype.removeAllListeners=Me.prototype.removeEventListener=function(t,e){if(this._callbacks=this._callbacks||{},arguments.length==0)return this._callbacks={},this;var n=this._callbacks["$"+t];if(!n)return this;if(arguments.length==1)return delete this._callbacks["$"+t],this;for(var s,i=0;i<n.length;i++)if(s=n[i],s===e||s.fn===e){n.splice(i,1);break}return n.length===0&&delete this._callbacks["$"+t],this};Me.prototype.emit=function(t){this._callbacks=this._callbacks||{};for(var e=new Array(arguments.length-1),n=this._callbacks["$"+t],s=1;s<arguments.length;s++)e[s-1]=arguments[s];if(n){n=n.slice(0);for(var s=0,i=n.length;s<i;++s)n[s].apply(this,e)}return this};Me.prototype.emitReserved=Me.prototype.emit;Me.prototype.listeners=function(t){return this._callbacks=this._callbacks||{},this._callbacks["$"+t]||[]};Me.prototype.hasListeners=function(t){return!!this.listeners(t).length};const mr=typeof Promise=="function"&&typeof Promise.resolve=="function"?e=>Promise.resolve().then(e):(e,n)=>n(e,0),st=typeof self<"u"?self:typeof window<"u"?window:Function("return this")(),ij="arraybuffer";function Xc(t,...e){return e.reduce((n,s)=>(t.hasOwnProperty(s)&&(n[s]=t[s]),n),{})}const oj=st.setTimeout,aj=st.clearTimeout;function pr(t,e){e.useNativeTimers?(t.setTimeoutFn=oj.bind(st),t.clearTimeoutFn=aj.bind(st)):(t.setTimeoutFn=st.setTimeout.bind(st),t.clearTimeoutFn=st.clearTimeout.bind(st))}const lj=1.33;function cj(t){return typeof t=="string"?dj(t):Math.ceil((t.byteLength||t.size)*lj)}function dj(t){let e=0,n=0;for(let s=0,i=t.length;s<i;s++)e=t.charCodeAt(s),e<128?n+=1:e<2048?n+=2:e<55296||e>=57344?n+=3:(s++,n+=4);return n}function ed(){return Date.now().toString(36).substring(3)+Math.random().toString(36).substring(2,5)}function uj(t){let e="";for(let n in t)t.hasOwnProperty(n)&&(e.length&&(e+="&"),e+=encodeURIComponent(n)+"="+encodeURIComponent(t[n]));return e}function hj(t){let e={},n=t.split("&");for(let s=0,i=n.length;s<i;s++){let o=n[s].split("=");e[decodeURIComponent(o[0])]=decodeURIComponent(o[1])}return e}class fj extends Error{constructor(e,n,s){super(e),this.description=n,this.context=s,this.type="TransportError"}}class go extends Me{constructor(e){super(),this.writable=!1,pr(this,e),this.opts=e,this.query=e.query,this.socket=e.socket,this.supportsBinary=!e.forceBase64}onError(e,n,s){return super.emitReserved("error",new fj(e,n,s)),this}open(){return this.readyState="opening",this.doOpen(),this}close(){return(this.readyState==="opening"||this.readyState==="open")&&(this.doClose(),this.onClose()),this}send(e){this.readyState==="open"&&this.write(e)}onOpen(){this.readyState="open",this.writable=!0,super.emitReserved("open")}onData(e){const n=po(e,this.socket.binaryType);this.onPacket(n)}onPacket(e){super.emitReserved("packet",e)}onClose(e){this.readyState="closed",super.emitReserved("close",e)}pause(e){}createUri(e,n={}){return e+"://"+this._hostname()+this._port()+this.opts.path+this._query(n)}_hostname(){const e=this.opts.hostname;return e.indexOf(":")===-1?e:"["+e+"]"}_port(){return this.opts.port&&(this.opts.secure&&Number(this.opts.port)!==443||!this.opts.secure&&Number(this.opts.port)!==80)?":"+this.opts.port:""}_query(e){const n=uj(e);return n.length?"?"+n:""}}class mj extends go{constructor(){super(...arguments),this._polling=!1}get name(){return"polling"}doOpen(){this._poll()}pause(e){this.readyState="pausing";const n=()=>{this.readyState="paused",e()};if(this._polling||!this.writable){let s=0;this._polling&&(s++,this.once("pollComplete",function(){--s||n()})),this.writable||(s++,this.once("drain",function(){--s||n()}))}else n()}_poll(){this._polling=!0,this.doPoll(),this.emitReserved("poll")}onData(e){const n=s=>{if(this.readyState==="opening"&&s.type==="open"&&this.onOpen(),s.type==="close")return this.onClose({description:"transport closed by the server"}),!1;this.onPacket(s)};tj(e,this.socket.binaryType).forEach(n),this.readyState!=="closed"&&(this._polling=!1,this.emitReserved("pollComplete"),this.readyState==="open"&&this._poll())}doClose(){const e=()=>{this.write([{type:"close"}])};this.readyState==="open"?e():this.once("open",e)}write(e){this.writable=!1,ej(e,n=>{this.doWrite(n,()=>{this.writable=!0,this.emitReserved("drain")})})}uri(){const e=this.opts.secure?"https":"http",n=this.query||{};return this.opts.timestampRequests!==!1&&(n[this.opts.timestampParam]=ed()),!this.supportsBinary&&!n.sid&&(n.b64=1),this.createUri(e,n)}}let td=!1;try{td=typeof XMLHttpRequest<"u"&&"withCredentials"in new XMLHttpRequest}catch{}const pj=td;function gj(){}class xj extends mj{constructor(e){if(super(e),typeof location<"u"){const n=location.protocol==="https:";let s=location.port;s||(s=n?"443":"80"),this.xd=typeof location<"u"&&e.hostname!==location.hostname||s!==e.port}}doWrite(e,n){const s=this.request({method:"POST",data:e});s.on("success",n),s.on("error",(i,o)=>{this.onError("xhr post error",i,o)})}doPoll(){const e=this.request();e.on("data",this.onData.bind(this)),e.on("error",(n,s)=>{this.onError("xhr poll error",n,s)}),this.pollXhr=e}}let dn=class _s extends Me{constructor(e,n,s){super(),this.createRequest=e,pr(this,s),this._opts=s,this._method=s.method||"GET",this._uri=n,this._data=s.data!==void 0?s.data:null,this._create()}_create(){var e;const n=Xc(this._opts,"agent","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","autoUnref");n.xdomain=!!this._opts.xd;const s=this._xhr=this.createRequest(n);try{s.open(this._method,this._uri,!0);try{if(this._opts.extraHeaders){s.setDisableHeaderCheck&&s.setDisableHeaderCheck(!0);for(let i in this._opts.extraHeaders)this._opts.extraHeaders.hasOwnProperty(i)&&s.setRequestHeader(i,this._opts.extraHeaders[i])}}catch{}if(this._method==="POST")try{s.setRequestHeader("Content-type","text/plain;charset=UTF-8")}catch{}try{s.setRequestHeader("Accept","*/*")}catch{}(e=this._opts.cookieJar)===null||e===void 0||e.addCookies(s),"withCredentials"in s&&(s.withCredentials=this._opts.withCredentials),this._opts.requestTimeout&&(s.timeout=this._opts.requestTimeout),s.onreadystatechange=()=>{var i;s.readyState===3&&((i=this._opts.cookieJar)===null||i===void 0||i.parseCookies(s.getResponseHeader("set-cookie"))),s.readyState===4&&(s.status===200||s.status===1223?this._onLoad():this.setTimeoutFn(()=>{this._onError(typeof s.status=="number"?s.status:0)},0))},s.send(this._data)}catch(i){this.setTimeoutFn(()=>{this._onError(i)},0);return}typeof document<"u"&&(this._index=_s.requestsCount++,_s.requests[this._index]=this)}_onError(e){this.emitReserved("error",e,this._xhr),this._cleanup(!0)}_cleanup(e){if(!(typeof this._xhr>"u"||this._xhr===null)){if(this._xhr.onreadystatechange=gj,e)try{this._xhr.abort()}catch{}typeof document<"u"&&delete _s.requests[this._index],this._xhr=null}}_onLoad(){const e=this._xhr.responseText;e!==null&&(this.emitReserved("data",e),this.emitReserved("success"),this._cleanup())}abort(){this._cleanup()}};dn.requestsCount=0;dn.requests={};if(typeof document<"u"){if(typeof attachEvent=="function")attachEvent("onunload",ol);else if(typeof addEventListener=="function"){const t="onpagehide"in st?"pagehide":"unload";addEventListener(t,ol,!1)}}function ol(){for(let t in dn.requests)dn.requests.hasOwnProperty(t)&&dn.requests[t].abort()}const bj=(function(){const t=nd({xdomain:!1});return t&&t.responseType!==null})();class yj extends xj{constructor(e){super(e);const n=e&&e.forceBase64;this.supportsBinary=bj&&!n}request(e={}){return Object.assign(e,{xd:this.xd},this.opts),new dn(nd,this.uri(),e)}}function nd(t){const e=t.xdomain;try{if(typeof XMLHttpRequest<"u"&&(!e||pj))return new XMLHttpRequest}catch{}if(!e)try{return new st[["Active"].concat("Object").join("X")]("Microsoft.XMLHTTP")}catch{}}const sd=typeof navigator<"u"&&typeof navigator.product=="string"&&navigator.product.toLowerCase()==="reactnative";class wj extends go{get name(){return"websocket"}doOpen(){const e=this.uri(),n=this.opts.protocols,s=sd?{}:Xc(this.opts,"agent","perMessageDeflate","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","localAddress","protocolVersion","origin","maxPayload","family","checkServerIdentity");this.opts.extraHeaders&&(s.headers=this.opts.extraHeaders);try{this.ws=this.createSocket(e,n,s)}catch(i){return this.emitReserved("error",i)}this.ws.binaryType=this.socket.binaryType,this.addEventListeners()}addEventListeners(){this.ws.onopen=()=>{this.opts.autoUnref&&this.ws._socket.unref(),this.onOpen()},this.ws.onclose=e=>this.onClose({description:"websocket connection closed",context:e}),this.ws.onmessage=e=>this.onData(e.data),this.ws.onerror=e=>this.onError("websocket error",e)}write(e){this.writable=!1;for(let n=0;n<e.length;n++){const s=e[n],i=n===e.length-1;mo(s,this.supportsBinary,o=>{try{this.doWrite(s,o)}catch{}i&&mr(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){typeof this.ws<"u"&&(this.ws.onerror=()=>{},this.ws.close(),this.ws=null)}uri(){const e=this.opts.secure?"wss":"ws",n=this.query||{};return this.opts.timestampRequests&&(n[this.opts.timestampParam]=ed()),this.supportsBinary||(n.b64=1),this.createUri(e,n)}}const Gr=st.WebSocket||st.MozWebSocket;class vj extends wj{createSocket(e,n,s){return sd?new Gr(e,n,s):n?new Gr(e,n):new Gr(e)}doWrite(e,n){this.ws.send(n)}}class Sj extends go{get name(){return"webtransport"}doOpen(){try{this._transport=new WebTransport(this.createUri("https"),this.opts.transportOptions[this.name])}catch(e){return this.emitReserved("error",e)}this._transport.closed.then(()=>{this.onClose()}).catch(e=>{this.onError("webtransport error",e)}),this._transport.ready.then(()=>{this._transport.createBidirectionalStream().then(e=>{const n=sj(Number.MAX_SAFE_INTEGER,this.socket.binaryType),s=e.readable.pipeThrough(n).getReader(),i=nj();i.readable.pipeTo(e.writable),this._writer=i.writable.getWriter();const o=()=>{s.read().then(({done:l,value:c})=>{l||(this.onPacket(c),o())}).catch(l=>{})};o();const a={type:"open"};this.query.sid&&(a.data=`{"sid":"${this.query.sid}"}`),this._writer.write(a).then(()=>this.onOpen())})})}write(e){this.writable=!1;for(let n=0;n<e.length;n++){const s=e[n],i=n===e.length-1;this._writer.write(s).then(()=>{i&&mr(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){var e;(e=this._transport)===null||e===void 0||e.close()}}const jj={websocket:vj,webtransport:Sj,polling:yj},kj=/^(?:(?![^:@\/?#]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@\/?#]*)(?::([^:@\/?#]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,Cj=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"];function Ni(t){if(t.length>8e3)throw"URI too long";const e=t,n=t.indexOf("["),s=t.indexOf("]");n!=-1&&s!=-1&&(t=t.substring(0,n)+t.substring(n,s).replace(/:/g,";")+t.substring(s,t.length));let i=kj.exec(t||""),o={},a=14;for(;a--;)o[Cj[a]]=i[a]||"";return n!=-1&&s!=-1&&(o.source=e,o.host=o.host.substring(1,o.host.length-1).replace(/;/g,":"),o.authority=o.authority.replace("[","").replace("]","").replace(/;/g,":"),o.ipv6uri=!0),o.pathNames=Nj(o,o.path),o.queryKey=Ej(o,o.query),o}function Nj(t,e){const n=/\/{2,9}/g,s=e.replace(n,"/").split("/");return(e.slice(0,1)=="/"||e.length===0)&&s.splice(0,1),e.slice(-1)=="/"&&s.splice(s.length-1,1),s}function Ej(t,e){const n={};return e.replace(/(?:^|&)([^&=]*)=?([^&]*)/g,function(s,i,o){i&&(n[i]=o)}),n}const Ei=typeof addEventListener=="function"&&typeof removeEventListener=="function",Ds=[];Ei&&addEventListener("offline",()=>{Ds.forEach(t=>t())},!1);class Et extends Me{constructor(e,n){if(super(),this.binaryType=ij,this.writeBuffer=[],this._prevBufferLen=0,this._pingInterval=-1,this._pingTimeout=-1,this._maxPayload=-1,this._pingTimeoutTime=1/0,e&&typeof e=="object"&&(n=e,e=null),e){const s=Ni(e);n.hostname=s.host,n.secure=s.protocol==="https"||s.protocol==="wss",n.port=s.port,s.query&&(n.query=s.query)}else n.host&&(n.hostname=Ni(n.host).host);pr(this,n),this.secure=n.secure!=null?n.secure:typeof location<"u"&&location.protocol==="https:",n.hostname&&!n.port&&(n.port=this.secure?"443":"80"),this.hostname=n.hostname||(typeof location<"u"?location.hostname:"localhost"),this.port=n.port||(typeof location<"u"&&location.port?location.port:this.secure?"443":"80"),this.transports=[],this._transportsByName={},n.transports.forEach(s=>{const i=s.prototype.name;this.transports.push(i),this._transportsByName[i]=s}),this.opts=Object.assign({path:"/engine.io",agent:!1,withCredentials:!1,upgrade:!0,timestampParam:"t",rememberUpgrade:!1,addTrailingSlash:!0,rejectUnauthorized:!0,perMessageDeflate:{threshold:1024},transportOptions:{},closeOnBeforeunload:!1},n),this.opts.path=this.opts.path.replace(/\/$/,"")+(this.opts.addTrailingSlash?"/":""),typeof this.opts.query=="string"&&(this.opts.query=hj(this.opts.query)),Ei&&(this.opts.closeOnBeforeunload&&(this._beforeunloadEventListener=()=>{this.transport&&(this.transport.removeAllListeners(),this.transport.close())},addEventListener("beforeunload",this._beforeunloadEventListener,!1)),this.hostname!=="localhost"&&(this._offlineEventListener=()=>{this._onClose("transport close",{description:"network connection lost"})},Ds.push(this._offlineEventListener))),this.opts.withCredentials&&(this._cookieJar=void 0),this._open()}createTransport(e){const n=Object.assign({},this.opts.query);n.EIO=Yc,n.transport=e,this.id&&(n.sid=this.id);const s=Object.assign({},this.opts,{query:n,socket:this,hostname:this.hostname,secure:this.secure,port:this.port},this.opts.transportOptions[e]);return new this._transportsByName[e](s)}_open(){if(this.transports.length===0){this.setTimeoutFn(()=>{this.emitReserved("error","No transports available")},0);return}const e=this.opts.rememberUpgrade&&Et.priorWebsocketSuccess&&this.transports.indexOf("websocket")!==-1?"websocket":this.transports[0];this.readyState="opening";const n=this.createTransport(e);n.open(),this.setTransport(n)}setTransport(e){this.transport&&this.transport.removeAllListeners(),this.transport=e,e.on("drain",this._onDrain.bind(this)).on("packet",this._onPacket.bind(this)).on("error",this._onError.bind(this)).on("close",n=>this._onClose("transport close",n))}onOpen(){this.readyState="open",Et.priorWebsocketSuccess=this.transport.name==="websocket",this.emitReserved("open"),this.flush()}_onPacket(e){if(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing")switch(this.emitReserved("packet",e),this.emitReserved("heartbeat"),e.type){case"open":this.onHandshake(JSON.parse(e.data));break;case"ping":this._sendPacket("pong"),this.emitReserved("ping"),this.emitReserved("pong"),this._resetPingTimeout();break;case"error":const n=new Error("server error");n.code=e.data,this._onError(n);break;case"message":this.emitReserved("data",e.data),this.emitReserved("message",e.data);break}}onHandshake(e){this.emitReserved("handshake",e),this.id=e.sid,this.transport.query.sid=e.sid,this._pingInterval=e.pingInterval,this._pingTimeout=e.pingTimeout,this._maxPayload=e.maxPayload,this.onOpen(),this.readyState!=="closed"&&this._resetPingTimeout()}_resetPingTimeout(){this.clearTimeoutFn(this._pingTimeoutTimer);const e=this._pingInterval+this._pingTimeout;this._pingTimeoutTime=Date.now()+e,this._pingTimeoutTimer=this.setTimeoutFn(()=>{this._onClose("ping timeout")},e),this.opts.autoUnref&&this._pingTimeoutTimer.unref()}_onDrain(){this.writeBuffer.splice(0,this._prevBufferLen),this._prevBufferLen=0,this.writeBuffer.length===0?this.emitReserved("drain"):this.flush()}flush(){if(this.readyState!=="closed"&&this.transport.writable&&!this.upgrading&&this.writeBuffer.length){const e=this._getWritablePackets();this.transport.send(e),this._prevBufferLen=e.length,this.emitReserved("flush")}}_getWritablePackets(){if(!(this._maxPayload&&this.transport.name==="polling"&&this.writeBuffer.length>1))return this.writeBuffer;let n=1;for(let s=0;s<this.writeBuffer.length;s++){const i=this.writeBuffer[s].data;if(i&&(n+=cj(i)),s>0&&n>this._maxPayload)return this.writeBuffer.slice(0,s);n+=2}return this.writeBuffer}_hasPingExpired(){if(!this._pingTimeoutTime)return!0;const e=Date.now()>this._pingTimeoutTime;return e&&(this._pingTimeoutTime=0,mr(()=>{this._onClose("ping timeout")},this.setTimeoutFn)),e}write(e,n,s){return this._sendPacket("message",e,n,s),this}send(e,n,s){return this._sendPacket("message",e,n,s),this}_sendPacket(e,n,s,i){if(typeof n=="function"&&(i=n,n=void 0),typeof s=="function"&&(i=s,s=null),this.readyState==="closing"||this.readyState==="closed")return;s=s||{},s.compress=s.compress!==!1;const o={type:e,data:n,options:s};this.emitReserved("packetCreate",o),this.writeBuffer.push(o),i&&this.once("flush",i),this.flush()}close(){const e=()=>{this._onClose("forced close"),this.transport.close()},n=()=>{this.off("upgrade",n),this.off("upgradeError",n),e()},s=()=>{this.once("upgrade",n),this.once("upgradeError",n)};return(this.readyState==="opening"||this.readyState==="open")&&(this.readyState="closing",this.writeBuffer.length?this.once("drain",()=>{this.upgrading?s():e()}):this.upgrading?s():e()),this}_onError(e){if(Et.priorWebsocketSuccess=!1,this.opts.tryAllTransports&&this.transports.length>1&&this.readyState==="opening")return this.transports.shift(),this._open();this.emitReserved("error",e),this._onClose("transport error",e)}_onClose(e,n){if(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing"){if(this.clearTimeoutFn(this._pingTimeoutTimer),this.transport.removeAllListeners("close"),this.transport.close(),this.transport.removeAllListeners(),Ei&&(this._beforeunloadEventListener&&removeEventListener("beforeunload",this._beforeunloadEventListener,!1),this._offlineEventListener)){const s=Ds.indexOf(this._offlineEventListener);s!==-1&&Ds.splice(s,1)}this.readyState="closed",this.id=null,this.emitReserved("close",e,n),this.writeBuffer=[],this._prevBufferLen=0}}}Et.protocol=Yc;class Pj extends Et{constructor(){super(...arguments),this._upgrades=[]}onOpen(){if(super.onOpen(),this.readyState==="open"&&this.opts.upgrade)for(let e=0;e<this._upgrades.length;e++)this._probe(this._upgrades[e])}_probe(e){let n=this.createTransport(e),s=!1;Et.priorWebsocketSuccess=!1;const i=()=>{s||(n.send([{type:"ping",data:"probe"}]),n.once("packet",m=>{if(!s)if(m.type==="pong"&&m.data==="probe"){if(this.upgrading=!0,this.emitReserved("upgrading",n),!n)return;Et.priorWebsocketSuccess=n.name==="websocket",this.transport.pause(()=>{s||this.readyState!=="closed"&&(h(),this.setTransport(n),n.send([{type:"upgrade"}]),this.emitReserved("upgrade",n),n=null,this.upgrading=!1,this.flush())})}else{const p=new Error("probe error");p.transport=n.name,this.emitReserved("upgradeError",p)}}))};function o(){s||(s=!0,h(),n.close(),n=null)}const a=m=>{const p=new Error("probe error: "+m);p.transport=n.name,o(),this.emitReserved("upgradeError",p)};function l(){a("transport closed")}function c(){a("socket closed")}function d(m){n&&m.name!==n.name&&o()}const h=()=>{n.removeListener("open",i),n.removeListener("error",a),n.removeListener("close",l),this.off("close",c),this.off("upgrading",d)};n.once("open",i),n.once("error",a),n.once("close",l),this.once("close",c),this.once("upgrading",d),this._upgrades.indexOf("webtransport")!==-1&&e!=="webtransport"?this.setTimeoutFn(()=>{s||n.open()},200):n.open()}onHandshake(e){this._upgrades=this._filterUpgrades(e.upgrades),super.onHandshake(e)}_filterUpgrades(e){const n=[];for(let s=0;s<e.length;s++)~this.transports.indexOf(e[s])&&n.push(e[s]);return n}}let Tj=class extends Pj{constructor(e,n={}){const s=typeof e=="object"?e:n;(!s.transports||s.transports&&typeof s.transports[0]=="string")&&(s.transports=(s.transports||["polling","websocket","webtransport"]).map(i=>jj[i]).filter(i=>!!i)),super(e,s)}};function Ij(t,e="",n){let s=t;n=n||typeof location<"u"&&location,t==null&&(t=n.protocol+"//"+n.host),typeof t=="string"&&(t.charAt(0)==="/"&&(t.charAt(1)==="/"?t=n.protocol+t:t=n.host+t),/^(https?|wss?):\/\//.test(t)||(typeof n<"u"?t=n.protocol+"//"+t:t="https://"+t),s=Ni(t)),s.port||(/^(http|ws)$/.test(s.protocol)?s.port="80":/^(http|ws)s$/.test(s.protocol)&&(s.port="443")),s.path=s.path||"/";const o=s.host.indexOf(":")!==-1?"["+s.host+"]":s.host;return s.id=s.protocol+"://"+o+":"+s.port+e,s.href=s.protocol+"://"+o+(n&&n.port===s.port?"":":"+s.port),s}const Aj=typeof ArrayBuffer=="function",zj=t=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(t):t.buffer instanceof ArrayBuffer,rd=Object.prototype.toString,Lj=typeof Blob=="function"||typeof Blob<"u"&&rd.call(Blob)==="[object BlobConstructor]",Rj=typeof File=="function"||typeof File<"u"&&rd.call(File)==="[object FileConstructor]";function xo(t){return Aj&&(t instanceof ArrayBuffer||zj(t))||Lj&&t instanceof Blob||Rj&&t instanceof File}function Ms(t,e){if(!t||typeof t!="object")return!1;if(Array.isArray(t)){for(let n=0,s=t.length;n<s;n++)if(Ms(t[n]))return!0;return!1}if(xo(t))return!0;if(t.toJSON&&typeof t.toJSON=="function"&&arguments.length===1)return Ms(t.toJSON(),!0);for(const n in t)if(Object.prototype.hasOwnProperty.call(t,n)&&Ms(t[n]))return!0;return!1}function _j(t){const e=[],n=t.data,s=t;return s.data=Os(n,e),s.attachments=e.length,{packet:s,buffers:e}}function Os(t,e,n){if(!t)return t;if(xo(t)){const s={_placeholder:!0,num:e.length};return e.push(t),s}else if(Array.isArray(t)){const s=new Array(t.length);for(let i=0;i<t.length;i++)s[i]=Os(t[i],e);return s}else if(typeof t=="object"&&!(t instanceof Date)){if(t.toJSON&&typeof t.toJSON=="function"&&!n)return Os(t.toJSON(),e,!0);const s={};for(const i in t)Object.prototype.hasOwnProperty.call(t,i)&&(s[i]=Os(t[i],e));return s}return t}function Dj(t,e){return t.data=Pi(t.data,e),delete t.attachments,t}function Pi(t,e){if(!t)return t;if(t&&t._placeholder===!0){if(typeof t.num=="number"&&t.num>=0&&t.num<e.length)return e[t.num];throw new Error("illegal attachments")}else if(Array.isArray(t))for(let n=0;n<t.length;n++)t[n]=Pi(t[n],e);else if(typeof t=="object")for(const n in t)Object.prototype.hasOwnProperty.call(t,n)&&(t[n]=Pi(t[n],e));return t}const Mj=["connect","connect_error","disconnect","disconnecting","newListener","removeListener"];var xe;(function(t){t[t.CONNECT=0]="CONNECT",t[t.DISCONNECT=1]="DISCONNECT",t[t.EVENT=2]="EVENT",t[t.ACK=3]="ACK",t[t.CONNECT_ERROR=4]="CONNECT_ERROR",t[t.BINARY_EVENT=5]="BINARY_EVENT",t[t.BINARY_ACK=6]="BINARY_ACK"})(xe||(xe={}));class Oj{constructor(e){this.replacer=e}encode(e){return(e.type===xe.EVENT||e.type===xe.ACK)&&Ms(e)?this.encodeAsBinary({type:e.type===xe.EVENT?xe.BINARY_EVENT:xe.BINARY_ACK,nsp:e.nsp,data:e.data,id:e.id}):[this.encodeAsString(e)]}encodeAsString(e){let n=""+e.type;return(e.type===xe.BINARY_EVENT||e.type===xe.BINARY_ACK)&&(n+=e.attachments+"-"),e.nsp&&e.nsp!=="/"&&(n+=e.nsp+","),e.id!=null&&(n+=e.id),e.data!=null&&(n+=JSON.stringify(e.data,this.replacer)),n}encodeAsBinary(e){const n=_j(e),s=this.encodeAsString(n.packet),i=n.buffers;return i.unshift(s),i}}class bo extends Me{constructor(e){super(),this.opts=Object.assign({reviver:void 0,maxAttachments:10},typeof e=="function"?{reviver:e}:e)}add(e){let n;if(typeof e=="string"){if(this.reconstructor)throw new Error("got plaintext data when reconstructing a packet");n=this.decodeString(e);const s=n.type===xe.BINARY_EVENT;s||n.type===xe.BINARY_ACK?(n.type=s?xe.EVENT:xe.ACK,this.reconstructor=new $j(n)):super.emitReserved("decoded",n)}else if(xo(e)||e.base64)if(this.reconstructor)n=this.reconstructor.takeBinaryData(e),n&&(this.reconstructor=null,super.emitReserved("decoded",n));else throw new Error("got binary data when not reconstructing a packet");else throw new Error("Unknown type: "+e)}decodeString(e){let n=0;const s={type:Number(e.charAt(0))};if(xe[s.type]===void 0)throw new Error("unknown packet type "+s.type);if(s.type===xe.BINARY_EVENT||s.type===xe.BINARY_ACK){const o=n+1;for(;e.charAt(++n)!=="-"&&n!=e.length;);const a=e.substring(o,n);if(a!=Number(a)||e.charAt(n)!=="-")throw new Error("Illegal attachments");const l=Number(a);if(!Fj(l)||l<1)throw new Error("Illegal attachments");if(l>this.opts.maxAttachments)throw new Error("too many attachments");s.attachments=l}if(e.charAt(n+1)==="/"){const o=n+1;for(;++n&&!(e.charAt(n)===","||n===e.length););s.nsp=e.substring(o,n)}else s.nsp="/";const i=e.charAt(n+1);if(i!==""&&Number(i)==i){const o=n+1;for(;++n;){const a=e.charAt(n);if(a==null||Number(a)!=a){--n;break}if(n===e.length)break}s.id=Number(e.substring(o,n+1))}if(e.charAt(++n)){const o=this.tryParse(e.substr(n));if(bo.isPayloadValid(s.type,o))s.data=o;else throw new Error("invalid payload")}return s}tryParse(e){try{return JSON.parse(e,this.opts.reviver)}catch{return!1}}static isPayloadValid(e,n){switch(e){case xe.CONNECT:return al(n);case xe.DISCONNECT:return n===void 0;case xe.CONNECT_ERROR:return typeof n=="string"||al(n);case xe.EVENT:case xe.BINARY_EVENT:return Array.isArray(n)&&(typeof n[0]=="number"||typeof n[0]=="string"&&Mj.indexOf(n[0])===-1);case xe.ACK:case xe.BINARY_ACK:return Array.isArray(n)}}destroy(){this.reconstructor&&(this.reconstructor.finishedReconstruction(),this.reconstructor=null)}}class $j{constructor(e){this.packet=e,this.buffers=[],this.reconPack=e}takeBinaryData(e){if(this.buffers.push(e),this.buffers.length===this.reconPack.attachments){const n=Dj(this.reconPack,this.buffers);return this.finishedReconstruction(),n}return null}finishedReconstruction(){this.reconPack=null,this.buffers=[]}}const Fj=Number.isInteger||function(t){return typeof t=="number"&&isFinite(t)&&Math.floor(t)===t};function al(t){return Object.prototype.toString.call(t)==="[object Object]"}const Bj=Object.freeze(Object.defineProperty({__proto__:null,Decoder:bo,Encoder:Oj,get PacketType(){return xe}},Symbol.toStringTag,{value:"Module"}));function dt(t,e,n){return t.on(e,n),function(){t.off(e,n)}}const Vj=Object.freeze({connect:1,connect_error:1,disconnect:1,disconnecting:1,newListener:1,removeListener:1});class id extends Me{constructor(e,n,s){super(),this.connected=!1,this.recovered=!1,this.receiveBuffer=[],this.sendBuffer=[],this._queue=[],this._queueSeq=0,this.ids=0,this.acks={},this.flags={},this.io=e,this.nsp=n,s&&s.auth&&(this.auth=s.auth),this._opts=Object.assign({},s),this.io._autoConnect&&this.open()}get disconnected(){return!this.connected}subEvents(){if(this.subs)return;const e=this.io;this.subs=[dt(e,"open",this.onopen.bind(this)),dt(e,"packet",this.onpacket.bind(this)),dt(e,"error",this.onerror.bind(this)),dt(e,"close",this.onclose.bind(this))]}get active(){return!!this.subs}connect(){return this.connected?this:(this.subEvents(),this.io._reconnecting||this.io.open(),this.io._readyState==="open"&&this.onopen(),this)}open(){return this.connect()}send(...e){return e.unshift("message"),this.emit.apply(this,e),this}emit(e,...n){var s,i,o;if(Vj.hasOwnProperty(e))throw new Error('"'+e.toString()+'" is a reserved event name');if(n.unshift(e),this._opts.retries&&!this.flags.fromQueue&&!this.flags.volatile)return this._addToQueue(n),this;const a={type:xe.EVENT,data:n};if(a.options={},a.options.compress=this.flags.compress!==!1,typeof n[n.length-1]=="function"){const h=this.ids++,m=n.pop();this._registerAckCallback(h,m),a.id=h}const l=(i=(s=this.io.engine)===null||s===void 0?void 0:s.transport)===null||i===void 0?void 0:i.writable,c=this.connected&&!(!((o=this.io.engine)===null||o===void 0)&&o._hasPingExpired());return this.flags.volatile&&!l||(c?(this.notifyOutgoingListeners(a),this.packet(a)):this.sendBuffer.push(a)),this.flags={},this}_registerAckCallback(e,n){var s;const i=(s=this.flags.timeout)!==null&&s!==void 0?s:this._opts.ackTimeout;if(i===void 0){this.acks[e]=n;return}const o=this.io.setTimeoutFn(()=>{delete this.acks[e];for(let l=0;l<this.sendBuffer.length;l++)this.sendBuffer[l].id===e&&this.sendBuffer.splice(l,1);n.call(this,new Error("operation has timed out"))},i),a=(...l)=>{this.io.clearTimeoutFn(o),n.apply(this,l)};a.withError=!0,this.acks[e]=a}emitWithAck(e,...n){return new Promise((s,i)=>{const o=(a,l)=>a?i(a):s(l);o.withError=!0,n.push(o),this.emit(e,...n)})}_addToQueue(e){let n;typeof e[e.length-1]=="function"&&(n=e.pop());const s={id:this._queueSeq++,tryCount:0,pending:!1,args:e,flags:Object.assign({fromQueue:!0},this.flags)};e.push((i,...o)=>(this._queue[0],i!==null?s.tryCount>this._opts.retries&&(this._queue.shift(),n&&n(i)):(this._queue.shift(),n&&n(null,...o)),s.pending=!1,this._drainQueue())),this._queue.push(s),this._drainQueue()}_drainQueue(e=!1){if(!this.connected||this._queue.length===0)return;const n=this._queue[0];n.pending&&!e||(n.pending=!0,n.tryCount++,this.flags=n.flags,this.emit.apply(this,n.args))}packet(e){e.nsp=this.nsp,this.io._packet(e)}onopen(){typeof this.auth=="function"?this.auth(e=>{this._sendConnectPacket(e)}):this._sendConnectPacket(this.auth)}_sendConnectPacket(e){this.packet({type:xe.CONNECT,data:this._pid?Object.assign({pid:this._pid,offset:this._lastOffset},e):e})}onerror(e){this.connected||this.emitReserved("connect_error",e)}onclose(e,n){this.connected=!1,delete this.id,this.emitReserved("disconnect",e,n),this._clearAcks()}_clearAcks(){Object.keys(this.acks).forEach(e=>{if(!this.sendBuffer.some(s=>String(s.id)===e)){const s=this.acks[e];delete this.acks[e],s.withError&&s.call(this,new Error("socket has been disconnected"))}})}onpacket(e){if(e.nsp===this.nsp)switch(e.type){case xe.CONNECT:e.data&&e.data.sid?this.onconnect(e.data.sid,e.data.pid):this.emitReserved("connect_error",new Error("It seems you are trying to reach a Socket.IO server in v2.x with a v3.x client, but they are not compatible (more information here: https://socket.io/docs/v3/migrating-from-2-x-to-3-0/)"));break;case xe.EVENT:case xe.BINARY_EVENT:this.onevent(e);break;case xe.ACK:case xe.BINARY_ACK:this.onack(e);break;case xe.DISCONNECT:this.ondisconnect();break;case xe.CONNECT_ERROR:this.destroy();const s=new Error(e.data.message);s.data=e.data.data,this.emitReserved("connect_error",s);break}}onevent(e){const n=e.data||[];e.id!=null&&n.push(this.ack(e.id)),this.connected?this.emitEvent(n):this.receiveBuffer.push(Object.freeze(n))}emitEvent(e){if(this._anyListeners&&this._anyListeners.length){const n=this._anyListeners.slice();for(const s of n)s.apply(this,e)}super.emit.apply(this,e),this._pid&&e.length&&typeof e[e.length-1]=="string"&&(this._lastOffset=e[e.length-1])}ack(e){const n=this;let s=!1;return function(...i){s||(s=!0,n.packet({type:xe.ACK,id:e,data:i}))}}onack(e){const n=this.acks[e.id];typeof n=="function"&&(delete this.acks[e.id],n.withError&&e.data.unshift(null),n.apply(this,e.data))}onconnect(e,n){this.id=e,this.recovered=n&&this._pid===n,this._pid=n,this.connected=!0,this.emitBuffered(),this._drainQueue(!0),this.emitReserved("connect")}emitBuffered(){this.receiveBuffer.forEach(e=>this.emitEvent(e)),this.receiveBuffer=[],this.sendBuffer.forEach(e=>{this.notifyOutgoingListeners(e),this.packet(e)}),this.sendBuffer=[]}ondisconnect(){this.destroy(),this.onclose("io server disconnect")}destroy(){this.subs&&(this.subs.forEach(e=>e()),this.subs=void 0),this.io._destroy(this)}disconnect(){return this.connected&&this.packet({type:xe.DISCONNECT}),this.destroy(),this.connected&&this.onclose("io client disconnect"),this}close(){return this.disconnect()}compress(e){return this.flags.compress=e,this}get volatile(){return this.flags.volatile=!0,this}timeout(e){return this.flags.timeout=e,this}onAny(e){return this._anyListeners=this._anyListeners||[],this._anyListeners.push(e),this}prependAny(e){return this._anyListeners=this._anyListeners||[],this._anyListeners.unshift(e),this}offAny(e){if(!this._anyListeners)return this;if(e){const n=this._anyListeners;for(let s=0;s<n.length;s++)if(e===n[s])return n.splice(s,1),this}else this._anyListeners=[];return this}listenersAny(){return this._anyListeners||[]}onAnyOutgoing(e){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.push(e),this}prependAnyOutgoing(e){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.unshift(e),this}offAnyOutgoing(e){if(!this._anyOutgoingListeners)return this;if(e){const n=this._anyOutgoingListeners;for(let s=0;s<n.length;s++)if(e===n[s])return n.splice(s,1),this}else this._anyOutgoingListeners=[];return this}listenersAnyOutgoing(){return this._anyOutgoingListeners||[]}notifyOutgoingListeners(e){if(this._anyOutgoingListeners&&this._anyOutgoingListeners.length){const n=this._anyOutgoingListeners.slice();for(const s of n)s.apply(this,e.data)}}}function bn(t){t=t||{},this.ms=t.min||100,this.max=t.max||1e4,this.factor=t.factor||2,this.jitter=t.jitter>0&&t.jitter<=1?t.jitter:0,this.attempts=0}bn.prototype.duration=function(){var t=this.ms*Math.pow(this.factor,this.attempts++);if(this.jitter){var e=Math.random(),n=Math.floor(e*this.jitter*t);t=(Math.floor(e*10)&1)==0?t-n:t+n}return Math.min(t,this.max)|0};bn.prototype.reset=function(){this.attempts=0};bn.prototype.setMin=function(t){this.ms=t};bn.prototype.setMax=function(t){this.max=t};bn.prototype.setJitter=function(t){this.jitter=t};class Ti extends Me{constructor(e,n){var s;super(),this.nsps={},this.subs=[],e&&typeof e=="object"&&(n=e,e=void 0),n=n||{},n.path=n.path||"/socket.io",this.opts=n,pr(this,n),this.reconnection(n.reconnection!==!1),this.reconnectionAttempts(n.reconnectionAttempts||1/0),this.reconnectionDelay(n.reconnectionDelay||1e3),this.reconnectionDelayMax(n.reconnectionDelayMax||5e3),this.randomizationFactor((s=n.randomizationFactor)!==null&&s!==void 0?s:.5),this.backoff=new bn({min:this.reconnectionDelay(),max:this.reconnectionDelayMax(),jitter:this.randomizationFactor()}),this.timeout(n.timeout==null?2e4:n.timeout),this._readyState="closed",this.uri=e;const i=n.parser||Bj;this.encoder=new i.Encoder,this.decoder=new i.Decoder,this._autoConnect=n.autoConnect!==!1,this._autoConnect&&this.open()}reconnection(e){return arguments.length?(this._reconnection=!!e,e||(this.skipReconnect=!0),this):this._reconnection}reconnectionAttempts(e){return e===void 0?this._reconnectionAttempts:(this._reconnectionAttempts=e,this)}reconnectionDelay(e){var n;return e===void 0?this._reconnectionDelay:(this._reconnectionDelay=e,(n=this.backoff)===null||n===void 0||n.setMin(e),this)}randomizationFactor(e){var n;return e===void 0?this._randomizationFactor:(this._randomizationFactor=e,(n=this.backoff)===null||n===void 0||n.setJitter(e),this)}reconnectionDelayMax(e){var n;return e===void 0?this._reconnectionDelayMax:(this._reconnectionDelayMax=e,(n=this.backoff)===null||n===void 0||n.setMax(e),this)}timeout(e){return arguments.length?(this._timeout=e,this):this._timeout}maybeReconnectOnOpen(){!this._reconnecting&&this._reconnection&&this.backoff.attempts===0&&this.reconnect()}open(e){if(~this._readyState.indexOf("open"))return this;this.engine=new Tj(this.uri,this.opts);const n=this.engine,s=this;this._readyState="opening",this.skipReconnect=!1;const i=dt(n,"open",function(){s.onopen(),e&&e()}),o=l=>{this.cleanup(),this._readyState="closed",this.emitReserved("error",l),e?e(l):this.maybeReconnectOnOpen()},a=dt(n,"error",o);if(this._timeout!==!1){const l=this._timeout,c=this.setTimeoutFn(()=>{i(),o(new Error("timeout")),n.close()},l);this.opts.autoUnref&&c.unref(),this.subs.push(()=>{this.clearTimeoutFn(c)})}return this.subs.push(i),this.subs.push(a),this}connect(e){return this.open(e)}onopen(){this.cleanup(),this._readyState="open",this.emitReserved("open");const e=this.engine;this.subs.push(dt(e,"ping",this.onping.bind(this)),dt(e,"data",this.ondata.bind(this)),dt(e,"error",this.onerror.bind(this)),dt(e,"close",this.onclose.bind(this)),dt(this.decoder,"decoded",this.ondecoded.bind(this)))}onping(){this.emitReserved("ping")}ondata(e){try{this.decoder.add(e)}catch(n){this.onclose("parse error",n)}}ondecoded(e){mr(()=>{this.emitReserved("packet",e)},this.setTimeoutFn)}onerror(e){this.emitReserved("error",e)}socket(e,n){let s=this.nsps[e];return s?this._autoConnect&&!s.active&&s.connect():(s=new id(this,e,n),this.nsps[e]=s),s}_destroy(e){const n=Object.keys(this.nsps);for(const s of n)if(this.nsps[s].active)return;this._close()}_packet(e){const n=this.encoder.encode(e);for(let s=0;s<n.length;s++)this.engine.write(n[s],e.options)}cleanup(){this.subs.forEach(e=>e()),this.subs.length=0,this.decoder.destroy()}_close(){this.skipReconnect=!0,this._reconnecting=!1,this.onclose("forced close")}disconnect(){return this._close()}onclose(e,n){var s;this.cleanup(),(s=this.engine)===null||s===void 0||s.close(),this.backoff.reset(),this._readyState="closed",this.emitReserved("close",e,n),this._reconnection&&!this.skipReconnect&&this.reconnect()}reconnect(){if(this._reconnecting||this.skipReconnect)return this;const e=this;if(this.backoff.attempts>=this._reconnectionAttempts)this.backoff.reset(),this.emitReserved("reconnect_failed"),this._reconnecting=!1;else{const n=this.backoff.duration();this._reconnecting=!0;const s=this.setTimeoutFn(()=>{e.skipReconnect||(this.emitReserved("reconnect_attempt",e.backoff.attempts),!e.skipReconnect&&e.open(i=>{i?(e._reconnecting=!1,e.reconnect(),this.emitReserved("reconnect_error",i)):e.onreconnect()}))},n);this.opts.autoUnref&&s.unref(),this.subs.push(()=>{this.clearTimeoutFn(s)})}}onreconnect(){const e=this.backoff.attempts;this._reconnecting=!1,this.backoff.reset(),this.emitReserved("reconnect",e)}}const Xn={};function $s(t,e){typeof t=="object"&&(e=t,t=void 0),e=e||{};const n=Ij(t,e.path||"/socket.io"),s=n.source,i=n.id,o=n.path,a=Xn[i]&&o in Xn[i].nsps,l=e.forceNew||e["force new connection"]||e.multiplex===!1||a;let c;return l?c=new Ti(s,e):(Xn[i]||(Xn[i]=new Ti(s,e)),c=Xn[i]),n.query&&!e.query&&(e.query=n.queryKey),c.socket(n.path,e)}Object.assign($s,{Manager:Ti,Socket:id,io:$s,connect:$s});class Uj{constructor(e=""){this.baseUrl=e}async get(e){return this.request("GET",e)}async post(e,n){return this.request("POST",e,n)}async del(e){return this.request("DELETE",e)}async request(e,n,s){try{const i=`${this.baseUrl}${n}`,o={method:e,credentials:"same-origin",headers:{"Content-Type":"application/json"}};return s!==void 0&&e!=="GET"&&e!=="DELETE"&&(o.body=JSON.stringify(s)),await(await fetch(i,o)).json()}catch(i){return{success:!1,error:i.message??"Network error"}}}}class Hj{constructor(e){this.modalState=null,this.addToastFn=e??null}showToast(e,n,s="info"){this.addToastFn?this.addToastFn(e,n,s):console.warn("[UIService] No addToast callback registered — toast not shown:",e,n)}showModal(e,n){this.modalState={visible:!0,title:e,content:n}}closeModal(){this.modalState=null}getModalState(){return this.modalState}downloadFile(e,n,s="application/octet-stream"){const i=typeof e=="string"?new Blob([e],{type:s}):e,o=URL.createObjectURL(i),a=document.createElement("a");a.href=o,a.download=n,document.body.appendChild(a),a.click(),document.body.removeChild(a),URL.revokeObjectURL(o)}}class qj{constructor(e){this.prefix=`edu_os_plugin:${e}:`}get(e){return localStorage.getItem(this.prefix+e)}set(e,n){localStorage.setItem(this.prefix+e,n)}delete(e){localStorage.removeItem(this.prefix+e)}clear(){this.prefix.length;const e=[];for(let n=0;n<localStorage.length;n++){const s=localStorage.key(n);s&&s.startsWith(this.prefix)&&e.push(s)}for(const n of e)localStorage.removeItem(n)}}const Ii=$t(t=>({remoteFullscreenElementId:null,setRemoteFullscreenElementId:e=>t({remoteFullscreenElementId:e}),clearRemoteFullscreen:()=>t({remoteFullscreenElementId:null}),remoteBrowserFullscreenElementId:null,setRemoteBrowserFullscreenElementId:e=>t({remoteBrowserFullscreenElementId:e})})),rC=t=>pn(Ii,t),Qr=new Set,od=$t((t,e)=>({lastEvent:null,version:0,subscribe:n=>(Qr.add(n),()=>{Qr.delete(n)}),record:n=>{t({lastEvent:n,version:e().version+1});for(const s of Qr)try{s(n)}catch(i){console.error("[pointsLedgerStore] listener error:",i)}},reset:()=>{t({lastEvent:null,version:0})}})),iC=t=>pn(od,t),ad=200;function Wj(t){return{id:t.id,type:t.type,source:`whiteboard.slot.${t.source}`,payload:{lessonId:t.lessonId,elementId:t.elementId,coursewareUuid:t.coursewareUuid,attemptId:t.attemptId,studentId:t.studentId,studentName:t.studentName,...t.payload,__raw:t.raw},timestamp:t.timestamp,correlationId:t.lessonId}}class Gj{constructor(e={}){this.buffer=[],this.subscriptions=[],this.byType=new Map,this.capacity=e.capacity??ad,this.persist=e.persist??!1}ingest(e,n){const s={id:ar(),timestamp:Date.now(),...e};if(this.buffer.push(s),this.buffer.length>this.capacity&&this.buffer.shift(),this.dispatch(s),!n?.skipBusSync)try{const i=Wj(s);Ot.publish(i)}catch(i){typeof console<"u"&&console.warn("[WhiteboardEventSlot] frontendEventBus publish failed:",i)}return this.persist&&typeof indexedDB<"u"&&this.persistEvent(s),s}emit(e,n,s={}){return this.ingest({...s,type:e,source:s.source??"manual",payload:n})}subscribe(e,n,s={}){const i={filter:e,handler:n};if(this.subscriptions.push(i),e.types)for(const o of e.types)this.byType.has(o)||this.byType.set(o,new Set),this.byType.get(o).add(i);if(s.replay&&s.replay>0){const o=this.query(e,{limit:s.replay});queueMicrotask(()=>{for(const a of o)try{n(a)}catch(l){console.error("[WhiteboardEventSlot] replay handler error:",l)}})}return()=>{const o=this.subscriptions.indexOf(i);if(o>=0&&this.subscriptions.splice(o,1),e.types)for(const a of e.types)this.byType.get(a)?.delete(i)}}query(e={},n={}){const s=n.limit??this.capacity,i=n.since??0,o=[];for(let a=this.buffer.length-1;a>=0;a--){const l=this.buffer[a];if(l.timestamp<i||ll(l,e)&&(o.push(l),o.length>=s))break}return o}stats(){const e={},n={};for(const s of this.buffer)e[s.type]=(e[s.type]??0)+1,n[s.source]=(n[s.source]??0)+1;return{total:this.buffer.length,byType:e,bySource:n}}clear(){this.buffer=[]}size(){return this.buffer.length}dispatch(e){const n=e.type?this.byType.get(e.type):void 0,s=n?Array.from(n):this.subscriptions;for(const i of s)if(ll(e,i.filter))try{i.handler(e)}catch(o){console.error("[WhiteboardEventSlot] handler error:",o)}}async persistEvent(e){if(!(typeof indexedDB>"u"))try{const n=await Qj(),s=n.transaction("events","readwrite");s.objectStore("events").put(e),await new Promise((o,a)=>{s.oncomplete=()=>o(),s.onerror=()=>a(s.error)}),n.close()}catch{}}}function ll(t,e){return!(e.types&&e.types.length>0&&!e.types.includes(t.type)||e.sources&&e.sources.length>0&&!e.sources.includes(t.source)||e.lessonId&&t.lessonId!==e.lessonId||e.elementId&&t.elementId!==e.elementId||e.coursewareUuid&&t.coursewareUuid!==e.coursewareUuid||e.studentId&&t.studentId!==e.studentId||e.predicate&&!e.predicate(t))}let ks=null;function Qj(){return ks||(ks=new Promise((t,e)=>{const n=indexedDB.open("whiteboard-event-slot",1);n.onupgradeneeded=()=>{const s=n.result;s.objectStoreNames.contains("events")||s.createObjectStore("events",{keyPath:"id"})},n.onsuccess=()=>t(n.result),n.onerror=()=>e(n.error)}),ks)}const Nt=new Gj({capacity:ad,persist:!1});typeof window<"u"&&Ot.subscribe("courseware.*",t=>{if(t.source==="whiteboard"||t.source?.startsWith("whiteboard."))return;const e=t.payload??{},n=e.data??e,s=typeof n=="object"&&n!==null?n:{},i=e.attemptId||(typeof s.attemptId=="string"?s.attemptId:void 0);Nt.ingest({source:"iframe.bridge",type:t.type,attemptId:i,coursewareUuid:typeof s.courseware_uuid=="string"?s.courseware_uuid:void 0,payload:{...s,attemptId:i},raw:n},{skipBusSync:!0})});const Jj={excellent:{rating:"excellent",label:"卓越表现",labelEn:"Excellent",score:3,rewardCoins:10,badge:"🌟",colorClass:"from-amber-400 to-yellow-500 text-yellow-950"},good:{rating:"good",label:"良好完成",labelEn:"Good",score:2,rewardCoins:5,badge:"👍",colorClass:"from-emerald-400 to-teal-500 text-emerald-950"},encourage:{rating:"encourage",label:"值得鼓励",labelEn:"Encourage",score:1,rewardCoins:2,badge:"💪",colorClass:"from-orange-400 to-amber-500 text-orange-950"}};function cl(t){const e=Math.max(0,t.lesson_picked_count||0),n=Math.max(0,t.term_picked_count||0);return 1/(1+3*e+n)}function oC(t,e){if(!t||t.length===0)return{filtered:[],fallback:!1};const n=t.filter(s=>s.tier===e);return n.length>0?{filtered:n,fallback:!1}:{filtered:t,fallback:!0}}function aC(t,e=Math.random){if(!t||t.length===0)return null;if(t.length===1)return{student:t[0],weight:cl(t[0])};const n=t.map(a=>cl(a)),s=n.reduce((a,l)=>a+l,0);if(s<=0){const a=Math.floor(e()*t.length);return{student:t[a],weight:1}}const i=e()*s;let o=0;for(let a=0;a<t.length;a++)if(o+=n[a],i<=o||a===t.length-1)return{student:t[a],weight:n[a]};return{student:t[0],weight:n[0]}}function Kj(t){const{session:e,host:n,activeRole:s,activeStudentId:i,selectedLesson:o,activeSegmentId:a,studentViewStatus:l,lang:c,students:d,addToast:h,setOnlineStudentIds:m,setActiveStudentLessons:p,setLessons:u,setActiveSegmentId:g,setLiveClassStudentProgress:x,setLiveClassAcknowledgedMap:w,setLiveClassFeed:v,setSelectedLesson:S,setStudentViewStatus:b,studentLessonTab:C,setStudentLessonTab:N,selectedAssignment:y,setSelectedAssignment:P,setLocalProgressPercent:L,fetchStudentDashboard:_,fetchStudents:O,fetchElements:T,setPickedAlertData:A,setPickedAnnouncement:R}=t,D=f.useRef(null),I=f.useRef(s),$=f.useRef(i),U=f.useRef(c),E=f.useRef(d),F=f.useRef(h),j=f.useRef(o),B=f.useRef(null),X=f.useRef(l),k=f.useRef(new Map),q=f.useRef(C),J=f.useRef(A),G=f.useRef(R),re=f.useRef(null);return f.useEffect(()=>{I.current=s},[s]),f.useEffect(()=>{$.current=i},[i]),f.useEffect(()=>{U.current=c},[c]),f.useEffect(()=>{E.current=d},[d]),f.useEffect(()=>{F.current=h},[h]),f.useEffect(()=>{j.current=o},[o]),f.useEffect(()=>{X.current=l},[l]),f.useEffect(()=>{q.current=C},[C]),f.useEffect(()=>{B.current=y},[y]),f.useEffect(()=>{J.current=A},[A]),f.useEffect(()=>{G.current=R},[R]),f.useEffect(()=>{if(!e)return;const Y=$s();D.current=Y,Wl(Y),n.isInitialized()||n.initialize(new Uj,new Qp(Y),new Hj(F.current),new qj("__app__"));const ye=()=>{Y.emit("join-room","whiteboard-broadcast"),Y.emit("join-room","classroom-broadcast");const z=Ne.getState().liveClassSelectedClassId;I.current==="teacher"&&z&&Y.emit("join-room",`class-${z}`),I.current==="student"&&$.current?(Y.emit("register-student",{studentId:$.current,name:E.current.find(W=>W.id===$.current)?.name||$.current}),X.current==="lesson"&&j.current&&Y.emit("enter-lesson",{studentId:$.current,lessonId:j.current})):Y.emit("request-presence")};ye(),Y.on("presence-update",z=>{m(z.onlineStudentIds),p(z.activeStudentLessons)}),Y.on("lesson-progress-mode-changed",z=>{const{lessonId:W,progressMode:K,progressConditions:ne}=z;u(te=>te.map(me=>me.id===W?{...me,progress_mode:K,progress_conditions:ne}:me))}),Y.on("student-active-segment-changed",z=>{const{activeSegmentId:W}=z;g(W)}),Y.on("student-pinged",z=>{const W=z.message||(U.current==="zh"?"⚠️ 学习进度预警:老师注意到您的进度有些落后,请抓紧时间跟上!":"⚠️ Progress Alert: The teacher noticed you are falling behind. Please keep up!");h(U.current==="zh"?"⚠️ 学习进度预警":"⚠️ Progress Warning",W,"warning")}),Y.on("student-progress-updated",z=>{const{studentId:W,progressPercent:K,completed:ne}=z;x(te=>{const me=te.findIndex(je=>je.student_id===W);if(me!==-1){const je=[...te];return je[me]={...je[me],progress_percent:K,completed:ne?1:0},je}else return[...te,{student_id:W,progress_percent:K,completed:ne?1:0}]})}),Y.on("student-error-alert",z=>{if(!(!z||!z.error)&&(I.current==="teacher"||e?.role==="administrator")){Dt.getState().addStudentError({...z.error,studentId:z.studentId,studentName:z.studentName||z.studentId,lessonId:z.lessonId,classId:z.classId});const W=z.studentName?`${z.studentName} (${z.studentId})`:z.studentId;h(U.current==="zh"?"学生端异常提醒":"Student Exception Alert",`${W}: ${z.error.title||z.error.message}`,"warning")}}),Y.on("assignment-graded-toast",z=>{if(I.current==="student"&&$.current&&z.studentId===$.current){const W=z.assignmentTitle||z.assignmentId,K=U.current==="zh"?`您的作业"${W}"已完成评分!得分:${z.score}%。建议反馈已收到,快去查看。`:`Your assignment "${W}" was graded. Score: ${z.score}%. Tutoring feedback has been posted.`;h(U.current==="zh"?"🎓 作业已评分":"🎓 Assignment Graded",K,"success"),_($.current)}}),Y.on("student-picked",z=>{const W=`${z.studentId}:${z.pickedTime??""}`,K=Date.now(),ne=k.current.get(W),te=ne!==void 0&&K-ne<1e4;if(!te){k.current.set(W,K);for(const[Q,se]of k.current)K-se>=1e4&&k.current.delete(Q)}const me=$.current,je=I.current==="student"&&me&&z.studentId===me;if(je&&me&&!te){J.current?.({studentId:z.studentId,studentName:z.studentName,rollcallId:z.rollcallId});const Q=U.current==="zh"?"闪电警报!您已被老师在课程随机抽问中抽中!请立即集中注意力参与课堂回答。":"Attention alert! You have been randomly picked by the teacher! Please pay immediate attention.";h(U.current==="zh"?"⚡️ 闪电抽问:老师抽中了你!":"⚡️ Classroom Pick Alert",Q,"warning"),_(me)}else if(I.current==="student"&&!je&&!te){const Q=z.studentName||"同学";G.current?.({studentName:Q,studentId:z.studentId});const se=U.current==="zh"?`老师在课堂中随机抽中了【${Q}】同学回答问题!`:`Teacher randomly selected [${Q}] to answer!`;h(U.current==="zh"?"🎯 课堂随机抽问":"🎯 Classroom Random Pick",se,"info")}v(Q=>[{id:`feed-pick-${z.studentId}-${z.pickedTime||Date.now()}`,time:new Date(z.pickedTime||Date.now()).toLocaleTimeString(),type:"picked",message:U.current==="zh"?`点名互动:随机抽中学生【${z.studentName}】。`:`Classroom Pick: Randomly selected student "${z.studentName}".`},...Q])}),Y.on("rollcall:evaluated",z=>{if(I.current!=="student"||z?.lessonId&&j.current&&z.lessonId!==j.current)return;const W=!!$.current&&z?.studentId===$.current,K=U.current==="zh",ne=Jj[z?.rating];ne&&(W?(h(K?`${ne.badge} ${ne.label} +${z.rewardCoins} 金币`:`${ne.badge} ${ne.labelEn} +${z.rewardCoins} coins`,K?`老师在随机抽问中给了你「${ne.label}」的评价,成长金币 +${z.rewardCoins} 已到账!`:`The teacher rated you "${ne.labelEn}" in the random pick. +${z.rewardCoins} growth coins credited!`,"success"),$.current&&_($.current)):h(K?`${ne.badge} 课堂表现评定`:`${ne.badge} Classroom Evaluation`,K?`老师给【${z.studentName||"某位同学"}】评了「${ne.label}」。`:`The teacher rated "${z.studentName||"a student"}" as "${ne.labelEn}".`,"info"),v(te=>[{id:`feed-eval-${z.rollcallId||z.studentId}-${z.timestamp||Date.now()}`,time:new Date(z.timestamp||Date.now()).toLocaleTimeString(),type:"picked",message:K?`点名评价:${z.studentName||"学生"} 获评「${ne.label}」+${z.rewardCoins}金币。`:`Roll-call evaluation: "${z.studentName||"a student"}" rated ${ne.labelEn} +${z.rewardCoins} coins.`},...te]))}),Y.on("classroom:points_awarded",z=>{if(!z?.studentId)return;const W=U.current==="zh",K=Number(z.deltaPoints)||0;od.getState().record({studentId:z.studentId,classId:z.classId??"",deltaPoints:K,reason:z.reason??"",dimensionId:z.dimensionId,createdAt:z.createdAt}),!!$.current&&z.studentId===$.current&&(h(W?K>=0?"🎁 获得成长积分":"📉 积分调整":K>=0?"Points earned":"Points adjusted",W?`${K>=0?"+":""}${K} 积分${z.reason?`:${z.reason}`:""}`:`${K>=0?"+":""}${K} points${z.reason?`: ${z.reason}`:""}`,K>=0?"success":"warning"),$.current&&_($.current))}),Y.on("student-acknowledged",z=>{const{studentId:W}=z;w(K=>{const ne=new Map(K);return ne.set(W,!0),ne}),v(K=>[{id:`feed-ack-${W}-${Date.now()}`,time:new Date().toLocaleTimeString(),type:"checkin",message:U.current==="zh"?`学生已确认收到提问点名(学生 ID: ${W})。`:`Student acknowledged the classroom call (Student ID: ${W}).`},...K]),O()}),Y.on("class-lock-status-changed",z=>{const{lessonId:W,locked:K}=z;I.current==="student"&&$.current?(Promise.resolve(O()).then(()=>{K&&W&&(S(W),b("lesson"),h(U.current==="zh"?"🔒 课程已被锁定":"🔒 Lesson Locked",U.current==="zh"?"老师已锁定当前授课,您将无法切换到其他页面。":"The teacher has locked the active lesson. You cannot leave this page.","info"))}),_($.current)):O()}),Y.on("student-lesson-tab-changed",z=>{I.current==="student"&&z?.tab&&(!z.lessonId||z.lessonId===j.current)&&N(z.tab)}),Y.on("teacher-switched-lesson",z=>{I.current==="student"&&z?.lessonId&&(S(z.lessonId),b("lesson"))}),Y.on("whiteboard-sync",z=>{const{roomId:W,type:K}=z||{};K==="refresh"&&W&&(T(W),!j.current&&I.current==="student"&&(S(W),b("lesson")),Y.emit("join-room",W))});const ee=()=>{Ii.getState().clearRemoteFullscreen();const z=re.current;re.current=null,z&&(N(z.lessonTab),z.viewStatus==="assignment"&&(P(z.assignment??null),z.lessonId&&S(z.lessonId),b("assignment")))};return Y.on("whiteboard-fullscreen-changed",z=>{if(I.current!=="student")return;const W=z?.lessonId,K=z?.elementId??null,ne=z?.mode==="browser",te=Ii.getState();if(!K){if(ne){te.setRemoteBrowserFullscreenElementId(null),te.remoteFullscreenElementId||ee();return}ee();return}if(!W)return;const me=X.current;(me==="lesson"?j.current===W:me==="assignment")&&(!te.remoteFullscreenElementId&&!te.remoteBrowserFullscreenElementId&&(re.current={viewStatus:me,lessonTab:q.current,lessonId:j.current,assignment:me==="assignment"?B.current:null}),ne?te.setRemoteBrowserFullscreenElementId(K):te.setRemoteFullscreenElementId(K),me==="assignment"&&P(null),S(W),T(W),b("lesson"),N("whiteboard"))}),Y.on("connect",()=>{ye(),ee()}),Y.io?.on("reconnect",()=>{ye()}),Y.on("whiteboard-quiz-answered",z=>{try{if(!z)return;Nt.ingest({source:"widget.quiz",type:"quiz.answered",lessonId:z.lessonId,elementId:z.elementId,studentId:z.studentId,studentName:z.studentName,payload:{answer:z.answer,score:typeof z.score=="number"?z.score:void 0,isCorrect:!!z.isCorrect,correctAnswer:z.correctAnswer,question:z.question,time:z.time},raw:z})}catch(W){console.error("[useClassroomSocket] quiz.answered ingest failed",W)}}),Y.on("courseware-attempt-updated",z=>{try{if(!z||typeof z.attemptId!="string")return;const W=z.type==="log"?"courseware.event_logged":z.type==="submit"?"courseware.submitted":z.type==="promote"?"courseware.finished":"courseware.event_logged";Nt.ingest({source:"iframe.bridge",type:W,attemptId:z.attemptId,payload:{attemptId:z.attemptId,attemptType:z.type},raw:z})}catch(W){console.error("[useClassroomSocket] courseware-attempt-updated ingest failed",W)}}),()=>{Y.disconnect(),D.current=null}},[e,s,i]),f.useEffect(()=>{D.current&&s==="student"&&i&&(l==="lesson"&&o?(D.current.emit("enter-lesson",{studentId:i,lessonId:o}),fetch(`/api/students/${i}/progress`).then(Y=>Y.json()).then(Y=>{if(Array.isArray(Y)){const ye=Y.find(ee=>ee.lesson_id===o);L(ye?ye.progress_percent:0)}}).catch(console.error)):D.current.emit("leave-lesson",{studentId:i}))},[l,o,s,i]),f.useEffect(()=>{s==="teacher"&&o&&a&&D.current&&D.current.emit("teacher-broadcast-segment",{lessonId:o,activeSegmentId:a})},[a,o,s]),{socketRef:D}}const dl=new Map,Jr=new Map;async function Zj(t){const e=dl.get(t);if(e)return e;const n=Jr.get(t);if(n)return n;const s=(async()=>{try{const i=await fetch(`/api/courseware/attempts/${encodeURIComponent(t)}/adopt`,{method:"POST",headers:{"Content-Type":"application/json"},body:"{}"});if(!i.ok)return i.status!==401&&console.warn(`[LMS Bridge] Attempt adopt failed: HTTP ${i.status}`),t;const o=await i.json();return typeof o?.attemptId=="string"&&o.attemptId?(dl.set(t,o.attemptId),o.attemptId):t}catch(i){return console.warn("[LMS Bridge] Attempt adopt request failed:",i),t}finally{Jr.delete(t)}})();return Jr.set(t,s),s}const tr=new Set;function Yj(t){return tr.add(t),()=>{tr.delete(t)}}function ld(t){if(!t)return null;for(const e of tr)if(e.contentWindow===t)return e;if(typeof document<"u")try{return Array.from(document.querySelectorAll("iframe[data-lms-bridge]")).find(n=>n.contentWindow===t)||null}catch{return null}return null}function ul(t){return typeof document>"u"||!t?!1:ld(t)!==null}function Ai(t){const e=t.length;let n=e+2;for(let s=0;s<e;s++){const i=t.charCodeAt(s);if(i===34||i===92)n+=1;else if(i<32)n+=i===8||i===9||i===10||i===12||i===13?1:5;else if(i>=55296&&i<=57343){const o=s+1<e?t.charCodeAt(s+1):0;i<=56319&&o>=56320&&o<=57343?s++:n+=5}}return n}const zi=-1,rn=-2,Xj=4;function ek(t){if(Array.isArray(t))return!0;const e=Object.getPrototypeOf(t);return e!==Object.prototype&&e!==null?!1:typeof t.toJSON!="function"}function Li(t,e,n){if(t===null)return 4;const s=typeof t;if(s==="boolean")return t===!0?4:5;if(s==="number"){const c=t;return Number.isFinite(c)?String(c).length:4}if(s==="string")return Ai(t);if(typeof t!="object")return 0;if(e>=Xj||!ek(t))return zi;let i=2,o=!0;const a=c=>(i+=c,n.total+=c,n.total>n.limit),l=c=>(i+=c,n.total>n.limit?rn:null);if(Array.isArray(t)){for(let c=0;c<t.length;c++){if(!o&&a(1))return rn;o=!1;const d=t[c];if(d===void 0||typeof d=="function"||typeof d=="symbol"){if(a(4))return rn;continue}const h=Li(d,e+1,n);if(h<0)return h;const m=l(h);if(m!==null)return m}return i}for(const c of Object.keys(t)){let d;try{d=t[c]}catch{return zi}if(d===void 0||typeof d=="function"||typeof d=="symbol")continue;if(!o&&a(1)||(o=!1,a(Ai(c)+1)))return rn;const h=Li(d,e+1,n);if(h<0)return h;const m=l(h);if(m!==null)return m}return i}function tk(t,e=512*1024){if(!t||typeof t=="number"||typeof t=="boolean")return!1;if(typeof t=="string")return Ai(t)>e;const s=Li(t,0,{total:0,limit:e});if(s===rn)return!0;if(s===zi)try{return JSON.stringify(t).length>e}catch{return!1}return s>e}async function nk(t){const e=t.data;if(!e||typeof e!="object")return;const n=typeof e.type=="string"?e.type:"";if(!(n.startsWith("LMS_")||n==="submit"||n==="finish"||n==="completed"||n==="saveProgress"||typeof e.attempt_id=="string"))return;if(tk(e,512*1024)){console.warn("[LMS Bridge] Dropped oversized postMessage (>512KB)");return}if(typeof window<"u"&&t.source&&t.source!==window&&!ul(t.source))return;let i=e.attempt_id;const o=e.payload||e;if(!i&&t.source)try{const c=ld(t.source);if(c&&c.contentWindow){const d=c.contentWindow;d.__LMS_STUDENT__?.attempt_id&&(i=d.__LMS_STUDENT__.attempt_id)}}catch{}if(!i||typeof i!="string")return;if(i=await Zj(i),n==="LMS_CONFIG"){Cs("courseware.config_reported",i,e.config??o);return}if(n==="LMS_GET_PROGRESS"){const c=e.requestId,d=t.source;if(c&&d&&typeof d.postMessage=="function"){if(d!==window&&!ul(d)){console.warn("[LMS Bridge Security] Dropping response to untrusted window");return}let h;try{h=(await(await fetch(`/api/courseware/attempts/${encodeURIComponent(i)}/progress`)).json()).progress??null}catch{h=null}const m=t.origin&&t.origin!=="null"?t.origin:"*";d.postMessage({type:"LMS_PROGRESS_RESPONSE",requestId:c,progress:h},m)}return}const a=n==="LMS_SUBMIT"||n==="LMS_FINISH"||n==="submit"||n==="finish"||n==="completed"||o&&typeof o=="object"&&(o.score!==void 0||o.grade!==void 0||o.result!==void 0||o.points!==void 0),l=n==="LMS_SAVE_PROGRESS"||n==="saveProgress";if(a){Cs("courseware.submitted",i,o);try{const c=await fetch(`/api/courseware/attempts/${encodeURIComponent(i)}/submit`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({score:o?.score??o?.grade??o?.result??o?.points??void 0,comment:o?.comment??o?.feedback??o?.note??void 0,completion:o?.completion??1,status:"completed",extra:o})});if(!c.ok){const d=await c.text().catch(()=>"");console.error(`[LMS Bridge] Backend rejected attempt submission: HTTP ${c.status}`,d)}}catch(c){console.error("[LMS Bridge] Failed to submit attempt data to backend:",c)}}else if(l){Cs("courseware.progress_saved",i,o);try{const c=await fetch(`/api/courseware/attempts/${encodeURIComponent(i)}/submit`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({score:o?.score??o?.grade??o?.result??o?.points??void 0,comment:o?.comment??o?.feedback??void 0,completion:o?.completion??void 0,status:"inprogress",extra:o})});if(!c.ok){const d=await c.text().catch(()=>"");console.error(`[LMS Bridge] Backend rejected progress save: HTTP ${c.status}`,d)}}catch(c){console.error("[LMS Bridge] Failed to save progress to backend:",c)}}else{Cs("courseware.event_logged",i,o);try{const c=await fetch(`/api/courseware/attempts/${encodeURIComponent(i)}/log`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({eventType:n||"log",payload:o})});if(!c.ok){const d=await c.text().catch(()=>"");console.error(`[LMS Bridge] Backend rejected event log: HTTP ${c.status}`,d)}}catch(c){console.error("[LMS Bridge] Failed to log event to backend:",c)}}}function Cs(t,e,n){Ot.publish({id:ar(),type:t,source:"courseware-bridge",payload:{attemptId:e,data:n},timestamp:Date.now(),correlationId:e})}function sk(t){f.useEffect(()=>{if(!t)return;const e=n=>{nk(n)};return window.addEventListener("message",e),()=>{window.removeEventListener("message",e)}},[t])}function cd(){const t=[],e=new Set;for(const n of tr)n&&!e.has(n)&&(e.add(n),t.push(n));if(typeof document<"u")try{document.querySelectorAll("iframe[data-lms-bridge]").forEach(n=>{e.has(n)||(e.add(n),t.push(n))})}catch{}return t}function nr(t,e){try{let n;if(t.src&&typeof window<"u")try{const s=new URL(t.src,window.location.href);s.origin&&s.origin!=="null"&&!t.src.startsWith("blob:")&&!t.src.startsWith("data:")&&(n=s.origin)}catch{}t.contentWindow?.postMessage(e,n||"*")}catch{}}function dd(t,e={}){if(!(typeof document>"u"))try{cd().forEach(s=>{nr(s,{type:"LMS_HOST_COMMAND",event:"theme:changed",payload:{theme:t,tokens:e}}),nr(s,{type:"LMS_THEME_CHANGED",theme:t,tokens:e})})}catch{}}function ud(t){if(!(typeof document>"u"))try{const e=Math.min(140,Math.max(85,Math.round(t)));cd().forEach(s=>{nr(s,{type:"LMS_HOST_COMMAND",event:"font-scale:changed",payload:{scale:e,fontScale:(e/100).toFixed(2)}}),nr(s,{type:"LMS_FONT_SCALE_CHANGED",scale:e,fontScale:(e/100).toFixed(2)})})}catch{}}let Kr=null,Zr=null;typeof window<"u"&&(Ot.subscribe("theme.changed",t=>{Kr&&clearTimeout(Kr),Kr=setTimeout(()=>{const e=t.payload;e&&typeof e.theme=="string"&&dd(e.theme,e.tokens??{})},50)}),Ot.subscribe("font-scale.changed",t=>{Zr&&clearTimeout(Zr),Zr=setTimeout(()=>{const e=t.payload;e&&typeof e.scale=="number"&&ud(e.scale)},50)}));function Yr(t){return Array.isArray(t)?t.filter(e=>typeof e=="string"&&e.length>0):[]}function hl(t){if(!t||typeof t!="object")return[];const e=Yr(t.capabilitiesProposed);if(e.length>0)return e;const n=t.manifest;if(typeof n=="string"&&n.length>0)try{return Yr(JSON.parse(n)?.capabilitiesProposed)}catch{return[]}return n&&typeof n=="object"?Yr(n.capabilitiesProposed):[]}const fl="@openlearn/frontend:IFrontendAPI",ml="@openlearn/frontend:ISocketService",pl="@openlearn/frontend:IUIService",gl="@openlearn/frontend:IStorageService",rk="@openlearn/frontend:ISemesterGradeService",ik="@openlearn/frontend:IHostActionDispatcher";var Te=(t=>(t.INSTALLED="installed",t.ACTIVATING="activating",t.ACTIVE="active",t.DEACTIVATING="deactivating",t.INACTIVE="inactive",t.ERROR="error",t.UNINSTALLED="uninstalled",t))(Te||{});function ok(t){const{lang:e,t:n,addToast:s,host:i,session:o,activeStudentId:a,activeRole:l,setStudentViewStatus:c,studentViewStatus:d,studentLessonTab:h,setStudentLessonTab:m,setLiveClassFocusLocked:p,isStudentLiveMode:u,isFollowingTeacher:g,liveStudentParam:x,fetchStudents:w,fetchLessons:v,fetchElements:S,fetchClasses:b,fetchClassStudents:C,fetchClassProgress:N,fetchClassDashboard:y,fetchLiveClassStudentProgress:P,setLiveClassStudentProgress:L,fetchRegisteredCommands:_,fetchVfs:O,fetchProcesses:T,fetchProcessLogs:A,fetchTodaySchedules:R,fetchLabs:D,fetchPlugins:I,fetchEvents:$,fetchApprovals:U,showProcessLogs:E,currentVfsParent:F,expandedClassId:j,activeSegmentId:B,setActiveSegmentId:X,quizStudentAnswersRef:k,effectiveAgentProviderId:q,plugins:J}=t,[G,re]=f.useState(0),Y=qS(),{pickedAlertData:ye,setPickedAlertData:ee,pickedAnnouncement:z,setPickedAnnouncement:W,liveClassTimeRemaining:K,setLiveClassTimeRemaining:ne,liveClassFeed:te,setLiveClassFeed:me,liveClassAcknowledgedMap:je,setLiveClassAcknowledgedMap:Q,onlineStudentIds:se,setOnlineStudentIds:Z,activeStudentLessons:pe,setActiveStudentLessons:le}=Y,he=ue(be=>be.liveClassSelectedClassId),Ce=ue(be=>be.setLiveClassSelectedClassId),Ee=ue(be=>be.liveClassIsActive),M=ue(be=>be.setLiveClassIsActive),V=ue(be=>be.selectedLesson),ie=ue(be=>be.setSelectedLesson),oe=ue(be=>be.setLessons),fe=ue(be=>be.students),Ae=WS({activeStudentId:a,activeRole:l,selectedLesson:V,students:fe,quizStudentAnswersRef:k,setStudentViewStatus:c}),{studentDashboardData:Ve,setStudentDashboardData:Ue,studentProgressMap:at,setStudentProgressMap:lt,selectedAssignment:Pe,setSelectedAssignment:Qe,fetchStudentDashboard:Fe,fetchStudentProgress:yn,updateStudentProgress:Re,submitQuizAssignment:wn}=Ae,[vn,Sn]=f.useState(""),[At,Vt]=f.useState("all"),[Ut,jn]=f.useState("grid"),[kn,Cn]=f.useState({}),[Ht,Nn]=f.useState({}),[En,Pn]=f.useState({}),qt=GS(l,Ve,e),{studentNotifications:Tn,unreadNotifications:Wt,readNotifications:ke,setReadNotifications:xt,selectedNotificationForModal:In,setSelectedNotificationForModal:An,isNotificationsOpen:zn,setIsNotificationsOpen:Ln}=qt;f.useEffect(()=>{a&&Xg(a).then(({ok:be,data:et})=>{xt(be&&Array.isArray(et)?new Set(et):new Set)}).catch(be=>{console.warn("Failed to load read notifications from DB",be),xt(new Set)})},[a]);const bt=f.useRef(new Set);f.useEffect(()=>{if(!i.isInitialized()||J.length===0)return;const be=Le.getState(),et=J.filter(ge=>ge.status==="active");for(const ge of et){if(!ge.has_frontend||bt.current.has(ge.id))continue;const He=be.activePlugins.find(Ke=>Ke.id===ge.id),ct=!!(He&&ge.version&&He.version!==ge.version);if(!(!He||ct||He.state!==Te.ACTIVE&&He.state!==Te.ACTIVATING))continue;bt.current.add(ge.id);const zt=()=>{if(!be.activePlugins.find(Ke=>Ke.id===ge.id))be.addPlugin({id:ge.id,name:ge.name,version:ge.version??"",state:Te.INSTALLED,executionMode:"inline",capabilitiesProposed:hl(ge)});else if(ct)try{const Ke=hl(ge);Le.setState(Lt=>({activePlugins:Lt.activePlugins.map(ze=>ze.id===ge.id?{...ze,version:ge.version??"",name:ge.name,capabilitiesProposed:Ke}:ze)}))}catch{}try{const Ke=JSON.parse(ge.manifest);i.activateRemotePlugin(ge.id,Ke).catch(Lt=>{console.error(`[App] Failed to activate remote plugin "${ge.name}":`,Lt)}).finally(()=>{bt.current.delete(ge.id)})}catch(Ke){bt.current.delete(ge.id),console.error(`[App] Failed to parse manifest for plugin "${ge.name}":`,Ke)}};He&&He.state===Te.ACTIVE&&ct?i.deactivatePlugin(ge.id).catch(()=>{}).finally(zt):zt()}const Jt=J.filter(ge=>ge.status!=="active");for(const ge of Jt){if(!ge.has_frontend)continue;const He=be.activePlugins.find(ct=>ct.id===ge.id);He&&He.state===Te.ACTIVE&&i.deactivatePlugin(ge.id).catch(ct=>{console.error(`[App] Failed to deactivate remote plugin "${ge.name}":`,ct)})}},[J,i]),f.useEffect(()=>{if(!i.isInitialized()||J.length===0)return;const be=Le.getState();for(const et of J)et.status==="active"&&(be.dashboardVisibility.has(et.id)||be.setDashboardVisibility(et.id,!0))},[J,i]),f.useEffect(()=>{he&&V?P(he,V):L([])},[he,V]),f.useEffect(()=>{he&&C(he)},[he]),sk(o);const Gt=QS({lang:e,t:n,selectedLesson:V,effectiveAgentProviderId:q,expandedClassId:j,fetchLessons:v,fetchClasses:b,fetchStudents:w,fetchClassStudents:C,fetchClassProgress:N,fetchClassDashboard:y,fetchElements:S}),{personaId:Rn,setPersonaId:_n,chatLog:Dn,setChatLog:Mn,input:On,setInput:$n,loading:Fn,setLoading:Bn,chatAttachments:Vn,setChatAttachments:Un,handleChatFileChange:Hn,handleChatDrop:qn,handleSend:Je,handleClearAgentMemory:Wn}=Gt;JS({session:o,showProcessLogs:E,activeStudentId:a,currentVfsParent:F,selectedLesson:V,selectedAssignment:Pe,expandedClassId:j,fetchLessons:v,fetchPlugins:I,fetchRegisteredCommands:_,fetchEvents:$,fetchApprovals:U,fetchProcesses:T,fetchClasses:b,fetchTodaySchedules:R,fetchStudents:w,fetchLabs:D,fetchVfs:O,fetchProcessLogs:A,fetchClassStudents:C,fetchElements:S});const{socketRef:Qt}=Kj({session:o,host:i,activeRole:l,activeStudentId:a,selectedLesson:V,activeSegmentId:B,studentViewStatus:d,lang:e,students:fe,addToast:s,setOnlineStudentIds:Z,setActiveStudentLessons:le,setLessons:oe,setActiveSegmentId:X,setLiveClassStudentProgress:L,setLiveClassAcknowledgedMap:Q,setLiveClassFeed:me,setSelectedLesson:ie,setStudentViewStatus:c,studentLessonTab:h,setStudentLessonTab:m,selectedAssignment:Pe,setSelectedAssignment:Qe,setLocalProgressPercent:re,fetchStudentDashboard:Fe,fetchStudents:w,fetchElements:S,setPickedAlertData:ee,setPickedAnnouncement:W});return{localProgressPercent:G,setLocalProgressPercent:re,classroomLiveData:Y,pickedAlertData:ye,setPickedAlertData:ee,pickedAnnouncement:z,setPickedAnnouncement:W,liveClassTimeRemaining:K,setLiveClassTimeRemaining:ne,liveClassFeed:te,setLiveClassFeed:me,liveClassAcknowledgedMap:je,setLiveClassAcknowledgedMap:Q,onlineStudentIds:se,setOnlineStudentIds:Z,activeStudentLessons:pe,setActiveStudentLessons:le,liveClassSelectedClassId:he,setLiveClassSelectedClassId:Ce,liveClassIsActive:Ee,setLiveClassIsActive:M,studentOpsData:Ae,studentDashboardData:Ve,setStudentDashboardData:Ue,studentProgressMap:at,setStudentProgressMap:lt,selectedAssignment:Pe,setSelectedAssignment:Qe,fetchStudentDashboard:Fe,fetchStudentProgress:yn,updateStudentProgress:Re,submitQuizAssignment:wn,rosterSearchQuery:vn,setRosterSearchQuery:Sn,rosterTagFilter:At,setRosterTagFilter:Vt,rosterViewMode:Ut,setRosterViewMode:jn,classSubmissionFilters:kn,setClassSubmissionFilters:Cn,classActiveTabs:Ht,setClassActiveTabs:Nn,studentActiveTabs:En,setStudentActiveTabs:Pn,studentNotificationsHook:qt,studentNotifications:Tn,unreadNotifications:Wt,readNotifications:ke,setReadNotifications:xt,selectedNotificationForModal:In,setSelectedNotificationForModal:An,isNotificationsOpen:zn,setIsNotificationsOpen:Ln,agentChatData:Gt,personaId:Rn,setPersonaId:_n,chatLog:Dn,setChatLog:Mn,input:On,setInput:$n,loading:Fn,setLoading:Bn,chatAttachments:Vn,setChatAttachments:Un,handleChatFileChange:Hn,handleChatDrop:qn,handleSend:Je,handleClearAgentMemory:Wn,socketRef:Qt}}Ib();function ak(){eS();const t=ue(u=>u.lang),e=Xa[t]??Xa.zh,{addToast:n}=Xv(),s=Tp(),i=async()=>{await Ne.getState().loadStudents()},o=async()=>{await Ne.getState().loadClasses()},a=f.useRef(()=>{}),l=cS({lang:t,addToast:n,fetchStudents:i}),c=HS({lang:t,addToast:n,host:s,session:l.session,fetchStudents:i,fetchClasses:o,chatLogRef:a}),d=ok({lang:t,t:e,addToast:n,host:s,session:l.session,activeStudentId:l.activeStudentId,activeRole:l.activeRole,setStudentViewStatus:l.setStudentViewStatus,studentViewStatus:l.studentViewStatus,studentLessonTab:l.studentLessonTab,setStudentLessonTab:l.setStudentLessonTab,setLiveClassFocusLocked:l.setLiveClassFocusLocked,isStudentLiveMode:l.isStudentLiveMode,isFollowingTeacher:l.isFollowingTeacher,liveStudentParam:l.liveStudentParam,fetchStudents:i,fetchLessons:c.fetchLessons,fetchElements:c.fetchElements,fetchClasses:o,fetchClassStudents:c.fetchClassStudents,fetchClassProgress:c.fetchClassProgress,fetchClassDashboard:c.fetchClassDashboard,fetchLiveClassStudentProgress:c.fetchLiveClassStudentProgress,setLiveClassStudentProgress:c.setLiveClassStudentProgress,fetchRegisteredCommands:c.fetchRegisteredCommands,fetchVfs:c.fetchVfs,fetchProcesses:c.fetchProcesses,fetchProcessLogs:c.fetchProcessLogs,fetchTodaySchedules:c.fetchTodaySchedules,fetchLabs:c.fetchLabs,fetchPlugins:c.fetchPlugins,fetchEvents:c.fetchEvents,fetchApprovals:c.fetchApprovals,showProcessLogs:c.showProcessLogs,currentVfsParent:c.currentVfsParent,expandedClassId:c.expandedClassId,activeSegmentId:c.activeSegmentId,setActiveSegmentId:c.setActiveSegmentId,quizStudentAnswersRef:c.quizStudentAnswersRef,effectiveAgentProviderId:c.effectiveAgentProviderId,plugins:c.plugins});a.current=d.setChatLog;const h=ue(u=>u.setSelectedLesson),m=ue(u=>u.setTeacherTab);return{appData:{addToast:n,...c.systemData,...c.resourceLibraryData,...c.lessonCrudData,...c.classOpsData,...l.studentViewStateData,...d.studentOpsData,...l.sessionBootstrapData,...d.classroomLiveData,...c.labAndScheduleData,...c.pluginManagementData,...d.agentChatData,...c.quizGenerator,...c.courseWizard,...c.classBatch,...c.lessonTimelineData,...d.studentNotificationsHook,...c.gradeExport,...c.lessonFilteringData,mainNavCollapsed:l.mainNavCollapsed,setMainNavCollapsed:l.setMainNavCollapsed,batchMode:c.batchMode,setBatchMode:c.setBatchMode,selectedClassIds:c.selectedClassIds,setSelectedClassIds:c.setSelectedClassIds,setSelectedStudentIds:c.setSelectedStudentIds,expandedClassId:c.expandedClassId,setExpandedClassId:c.setExpandedClassId,exportTooltipOpen:c.exportTooltipOpen,setExportTooltipOpen:c.setExportTooltipOpen,exportDropdownOpen:c.exportDropdownOpen,setExportDropdownOpen:c.setExportDropdownOpen,expandedStudentId:c.expandedStudentId,setExpandedStudentId:c.setExpandedStudentId,selectedStudentIds:c.selectedStudentIds,rosterViewMode:d.rosterViewMode,setRosterViewMode:d.setRosterViewMode,rosterSearchQuery:d.rosterSearchQuery,setRosterSearchQuery:d.setRosterSearchQuery,rosterTagFilter:d.rosterTagFilter,setRosterTagFilter:d.setRosterTagFilter,classSubmissionFilters:d.classSubmissionFilters,setClassSubmissionFilters:d.setClassSubmissionFilters,classActiveTabs:d.classActiveTabs,setClassActiveTabs:d.setClassActiveTabs,assignmentSortOrder:c.assignmentSortOrder,setAssignmentSortOrder:c.setAssignmentSortOrder,isGeneratingAssignment:c.isGeneratingAssignment,isGrading:c.isGrading,setIsGrading:c.setIsGrading,setStudents:c.setStudents,setImportError:c.setImportError,setImportSuccess:c.setImportSuccess,setShowImportModal:c.setShowImportModal,studentActiveTabs:d.studentActiveTabs,setStudentActiveTabs:d.setStudentActiveTabs,fetchStudents:i,onLogout:l.handleLogout,onAIProvidersChanged:c.fetchAIProviders,onDeleteCourse:c.handleDeleteCourse,onCopyCourse:c.handleCopyCourse,socketRef:d.socketRef,liveClassSelectedClassId:d.liveClassSelectedClassId,setLiveClassSelectedClassId:d.setLiveClassSelectedClassId,liveClassIsActive:d.liveClassIsActive,setLiveClassIsActive:d.setLiveClassIsActive,setSelectedLesson:h,setTeacherTab:m,teacherTab:l.teacherTab,onViewCourse:u=>{m("lesson_editor"),h(u)},t:e,readNotifications:d.readNotifications,setReadNotifications:d.setReadNotifications,localProgressPercent:d.localProgressPercent,setLocalProgressPercent:d.setLocalProgressPercent,lessons:c.lessons,selectedLesson:c.selectedLesson,elements:c.elements,classes:c.classes,students:c.students,isApprovalsCollapsed:l.isApprovalsCollapsed,setIsApprovalsCollapsed:l.setIsApprovalsCollapsed,isProcessesCollapsed:l.isProcessesCollapsed,setIsProcessesCollapsed:l.setIsProcessesCollapsed,whiteboardRef:c.whiteboardRef,paletteEdit:c.paletteEdit,handlePaletteActivate:c.handlePaletteActivate,handlePaletteConfirm:c.handlePaletteConfirm,setPaletteEdit:c.setPaletteEdit,session:l.session,showRightSidebar:c.showRightSidebar,setShowRightSidebar:c.setShowRightSidebar,rightSidebarTab:c.rightSidebarTab,setRightSidebarTab:c.setRightSidebarTab,agentProviderId:c.agentProviderId,setAgentProviderId:c.setAgentProviderId,effectiveAgentProviderId:c.effectiveAgentProviderId,selectedAgentProvider:c.selectedAgentProvider,isTourOpen:l.isTourOpen,setIsTourOpen:l.setIsTourOpen,handleSeedSuccess:c.handleSeedSuccess,generateTemplateContent:Yv,activeRole:l.activeRole,setActiveRole:l.setActiveRole,isStudentPreviewMode:l.isStudentPreviewMode,isNotificationsOpen:d.isNotificationsOpen,setIsNotificationsOpen:d.setIsNotificationsOpen,selectedNotificationForModal:d.selectedNotificationForModal,setSelectedNotificationForModal:d.setSelectedNotificationForModal,setProfileOpen:l.setProfileOpen,notifyLockedNavigation:l.notifyLockedNavigation,handleLogout:l.handleLogout,toggleLanguage:l.toggleLanguage,setIsSystemResourceLibraryOpen:c.setIsSystemResourceLibraryOpen,siteInfo:c.siteInfo,isStudentLiveMode:l.isStudentLiveMode,liveStudentParam:l.liveStudentParam,isFollowingTeacher:l.isFollowingTeacher,setIsFollowingTeacher:l.setIsFollowingTeacher},sessionLoading:l.sessionLoading,session:l.session,setSession:l.setSession,handleLoginSuccess:l.handleLoginSuccess,handleLogout:l.handleLogout,isStageDisplayMode:l.isStageDisplayMode,stageLessonParam:l.stageLessonParam,stageTitleParam:l.stageTitleParam,stageLangParam:l.stageLangParam,activeRole:l.activeRole,selectedLesson:c.selectedLesson,lessons:c.lessons,profileOpen:l.profileOpen,setProfileOpen:l.setProfileOpen,lang:t}}function lk(){const{appData:t,sessionLoading:e,session:n,setSession:s,handleLoginSuccess:i,handleLogout:o,isStageDisplayMode:a,stageLessonParam:l,stageTitleParam:c,stageLangParam:d,activeRole:h,selectedLesson:m,lessons:p,profileOpen:u,setProfileOpen:g,lang:x}=ak();return e?r.jsx(ms,{value:t,children:r.jsxs("div",{className:"min-h-screen bg-slate-900 flex flex-col items-center justify-center p-4 relative overflow-hidden font-sans",children:[r.jsx(Pt,{size:48,className:"text-indigo-500 animate-spin"}),r.jsx("span",{className:"text-white text-sm mt-4 font-semibold tracking-wide",children:x==="zh"?"正在连接安全核心数据库...":"Connecting Secure OS Core Database..."})]})}):n?n.mustChangePassword?r.jsx(ms,{value:t,children:r.jsx(gp,{lang:x,username:n.username,onDone:()=>s({...n,mustChangePassword:!1}),onLogout:o})}):r.jsx(ms,{value:t,children:r.jsxs(r.Fragment,{children:[a&&r.jsx(wg,{lessonId:l||m,lessonTitle:c||p.find(w=>w.id===(l||m))?.title,lang:d==="en"?"en":"zh"}),!a&&r.jsxs("div",{className:"flex h-screen bg-app text-main font-sans transition-colors duration-150",children:[r.jsxs("div",{className:"flex-1 flex flex-col bg-app h-full overflow-hidden",children:[r.jsx(vg,{}),r.jsx(Ag,{}),r.jsx(Rg,{open:u,session:n,lang:x,onClose:()=>g(!1),onSaved:w=>{n&&s({...n,name:w}),g(!1)},onAvatar:w=>{n&&s({...n,avatar:w??void 0})}}),r.jsx(Mg,{activeRole:h}),r.jsx(Lg,{})]}),r.jsx(Og,{}),r.jsx(Zg,{}),r.jsx(ux,{}),r.jsx(Nb,{}),r.jsx(Tb,{})]})]})}):r.jsx(ms,{value:t,children:r.jsx(pp,{onLoginSuccess:i,lang:x})})}class ck{constructor(){this.services=new Map}async register(e,n){if(this.services.has(e))throw new Error(`Service already registered: ${e}`);this.services.set(e,n)}async resolve(e){const n=this.services.get(e);if(!n)throw new Error(`No provider registered for token: ${e}`);return n}async unregister(e){this.services.delete(e)}has(e){return this.services.has(e)}list(){return Array.from(this.services.entries()).map(([e,n])=>({name:e,instance:n}))}}const dk=/^[0-9a-f]{8}-[0-9a-f]{4}-7[0-9a-f]{3}-[0-9a-f]{4}-[0-9a-f]{12}\./i;function uk(t,e){const n=e+".";return t.startsWith(n)||dk.test(t)?t:n+t}let hk=0;function fk(t,e){const s={student_id:"teacher_preview",student_name:"Teacher (Preview)",class_id:"",attempt_id:`att_srcdoc_${e}_${Date.now()}_${++hk}`},i={uuid:e,name:"Whiteboard HTML Applet"};return`<!DOCTYPE html>
|
|
181
|
+
<html><head>
|
|
182
|
+
<script>
|
|
183
|
+
window.__LMS_STUDENT__ = ${JSON.stringify(s)};
|
|
184
|
+
window.__LMS_COURSEWARE__ = ${JSON.stringify(i)};
|
|
185
|
+
(function() {
|
|
186
|
+
try {
|
|
187
|
+
// Override window.postMessage (self-targeting, always works)
|
|
188
|
+
var origPM = window.postMessage;
|
|
189
|
+
window.postMessage = function(msg, targetOrigin, transfer) {
|
|
190
|
+
var origin = (targetOrigin === 'null' || targetOrigin === null) ? '*' : targetOrigin;
|
|
191
|
+
try { return origPM.call(this, msg, origin, transfer); }
|
|
192
|
+
catch(err) { if (err.name === 'SyntaxError') return origPM.call(this, msg, '*', transfer); throw err; }
|
|
193
|
+
};
|
|
194
|
+
// Shadow window.parent / window.top with Proxy to intercept .postMessage()
|
|
195
|
+
// Direct assignment (window.parent.postMessage = ...) silently fails on cross-origin WindowProxy
|
|
196
|
+
function proxyWin(realRef, propName) {
|
|
197
|
+
try {
|
|
198
|
+
var safePost = function(msg, targetOrigin, transfer) {
|
|
199
|
+
var origin = (targetOrigin === 'null' || targetOrigin === null) ? '*' : targetOrigin;
|
|
200
|
+
try { return realRef.postMessage.call(realRef, msg, origin, transfer); }
|
|
201
|
+
catch(err) { if (err.name === 'SyntaxError') return realRef.postMessage.call(realRef, msg, '*', transfer); throw err; }
|
|
202
|
+
};
|
|
203
|
+
var px = new Proxy(realRef, {
|
|
204
|
+
get: function(t, p) {
|
|
205
|
+
if (p === 'postMessage') return safePost;
|
|
206
|
+
try { var v = t[p]; return typeof v === 'function' ? v.bind(t) : v; } catch(e) { return undefined; }
|
|
207
|
+
}
|
|
208
|
+
});
|
|
209
|
+
Object.defineProperty(window, propName, { get: function() { return px; }, configurable: true });
|
|
210
|
+
} catch(e) {}
|
|
211
|
+
}
|
|
212
|
+
if (window.parent && window.parent !== window) proxyWin(window.parent, 'parent');
|
|
213
|
+
try { if (window.top && window.top !== window) proxyWin(window.top, 'top'); } catch(e) {}
|
|
214
|
+
} catch(e) {}
|
|
215
|
+
})();
|
|
216
|
+
<\/script>
|
|
217
|
+
<script src="/bridge.js?cw=${encodeURIComponent(e||"")}"><\/script>
|
|
218
|
+
</head><body>
|
|
219
|
+
${t||""}
|
|
220
|
+
</body></html>`}class mk{constructor(){this.loaders=new Map}register(e,n){this.loaders.set(e.id,{impl:e,pluginId:n})}unregister(e,n){const s=this.loaders.get(e);s&&(n&&s.pluginId!==n||this.loaders.delete(e))}unregisterPlugin(e){for(const[n,s]of this.loaders)s.pluginId===e&&this.loaders.delete(n)}resolve(e,n){for(const{impl:s}of this.loaders.values())try{const i=s.resolve(e,n);if(i)return i}catch{}return null}}const Fs=new mk,pk=4;let Ns=0;const Ri=new Set;function xl(){return Ns>=pk?null:(Ns+=1,()=>{Ns=Math.max(0,Ns-1);for(const t of Ri)t()})}function gk(t){return Ri.add(t),()=>{Ri.delete(t)}}function xk(t,e){const[n,s]=f.useState(!t),[i,o]=f.useState(!1),a=f.useRef(null);return f.useEffect(()=>{if(!t||n)return;const l=e.current;if(!l)return;if(typeof IntersectionObserver>"u"){s(!0);return}const c=new IntersectionObserver(d=>{d.some(h=>h.isIntersecting)&&(s(!0),c.disconnect())},{rootMargin:"200px"});return c.observe(l),()=>c.disconnect()},[t,n,e]),f.useEffect(()=>{if(!n){a.current?.(),a.current=null,o(!1);return}const l=xl();if(l)a.current=l,o(!0);else{const c=gk(()=>{const d=xl();d&&(c(),a.current=d,o(!0))});return()=>c()}},[n]),f.useEffect(()=>()=>{a.current?.()},[]),i}function _t(t){if(typeof t=="number"&&Number.isFinite(t))return t;if(typeof t=="string"){const e=Number(t);return Number.isFinite(e)?e:void 0}}const bk=new Set(["guest","teacher","teacher_preview"]);function yk(t){const e=t.filter(o=>typeof o.score=="number").slice().sort((o,a)=>a.score-o.score),n=new Map;let s=0,i=null;return e.forEach((o,a)=>{const l=o.score;(i===null||l<i)&&(s=a+1,i=l),n.set(o.attemptId,s)}),n}function wk(t,e){return t.slice().sort((n,s)=>{const i=e.get(n.attemptId)??Number.MAX_SAFE_INTEGER,o=e.get(s.attemptId)??Number.MAX_SAFE_INTEGER;return i!==o?i-o:(n.studentName||n.studentId).localeCompare(s.studentName||s.studentId,"zh-Hans-CN")})}function vk({data:t,lessonId:e,elementId:n,className:s,title:i,lazy:o=!0}){const a=De.useRef(null),l=De.useRef(null),c=xk(o,a),{theme:d}=lr(),{scale:h}=on(),m=ue(B=>B.session),[p,u]=f.useState([]),[g,x]=f.useState(!1),[w,v]=f.useState(null),[S,b]=f.useState(null),C=Fs.resolve(t,{lessonId:e}),N=!!t.code&&!t.coursewareUuid&&!t.resourceId&&!C,y=t.coursewareUuid??(N?S:null);f.useEffect(()=>{if(!N||!t.code){b(null);return}let B=!1;return fetch("/api/courseware/inline",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({code:t.code})}).then(X=>X.ok?X.json():Promise.reject(new Error(`HTTP ${X.status}`))).then(X=>{!B&&typeof X?.uuid=="string"&&X.uuid&&b(X.uuid)}).catch(()=>{}),()=>{B=!0}},[N,t.code]),f.useEffect(()=>{if(!y){v(null);return}let B=!1;return fetch(`/api/courseware/${encodeURIComponent(y)}/access-token`).then(X=>X.ok?X.json():Promise.reject(new Error(`HTTP ${X.status}`))).then(X=>{!B&&typeof X?.token=="string"&&X.token&&v(X.token)}).catch(()=>{}),()=>{B=!0}},[y]),f.useEffect(()=>{const B=t.coursewareUuid;if(!B)return;let X=!1;const k=()=>{fetch(`/api/courseware/attempts?coursewareUuid=${encodeURIComponent(B)}&pageSize=all`).then(re=>re.ok?re.json():{data:[]}).then(re=>{X||u(ln(re))}).catch(()=>{})};k();let q=null,J=null;const G=()=>k();try{q=Gp(),q.on("courseware-attempt-updated",G)}catch{J=setInterval(k,5e3)}return()=>{X=!0,q&&q.off("courseware-attempt-updated",G),J&&clearInterval(J)}},[t.coursewareUuid]);const P=()=>{dd(d,Wi(d)),ud(h)};f.useEffect(()=>{const B=n??t.title??void 0,X=t.coursewareUuid;if(!B&&!X||!c)return;const k=a.current?.querySelector("iframe");if(!k||!(k instanceof HTMLIFrameElement)||!k.contentWindow)return;const q=J=>{if(J.source!==k.contentWindow)return;const G=J.data;if(!(!G||typeof G!="object"))if(G.type==="LMS_SUBMIT"){const re=G.payload??{};Nt.ingest({source:"iframe.postMessage",type:"courseware.submitted",lessonId:e,elementId:B,coursewareUuid:X,attemptId:typeof G.attempt_id=="string"?G.attempt_id:void 0,payload:{score:_t(re.score??re.grade),total:_t(re.total??re.fullScore),completion:_t(re.completion??re.progress),comment:typeof re.comment=="string"?re.comment:void 0},raw:G})}else if(G.type==="LMS_SAVE_PROGRESS"){const re=G.payload??{};Nt.ingest({source:"iframe.postMessage",type:"courseware.progress_saved",lessonId:e,elementId:B,coursewareUuid:X,attemptId:typeof G.attempt_id=="string"?G.attempt_id:void 0,payload:{score:_t(re.score),completion:_t(re.completion??re.progress)},raw:G})}else if(G.type==="LMS_FINISH")Nt.ingest({source:"iframe.postMessage",type:"courseware.finished",lessonId:e,elementId:B,coursewareUuid:X,attemptId:typeof G.attempt_id=="string"?G.attempt_id:void 0,payload:{},raw:G});else if(G.type==="courseware:score"||G.type==="openlearn-cw-sdk:score"){const re=G.payload??G;Nt.ingest({source:"applet.score",type:"courseware.submitted",lessonId:e,elementId:B,coursewareUuid:X,payload:{score:_t(re.score),total:_t(re.total),detail:re.detail,source:typeof G.source=="string"?G.source:"openlearn-cw-sdk"},raw:G})}else typeof G.type=="string"&&G.type.startsWith("LMS_")&&Nt.ingest({source:"iframe.postMessage",type:"courseware.unknown",lessonId:e,elementId:B,coursewareUuid:X,payload:{originalType:G.type},raw:G})};return window.addEventListener("message",q),()=>window.removeEventListener("message",q)},[c,n,t.title,t.coursewareUuid,e]);const L=t.coursewareUuid?`/runtime/${t.coursewareUuid}/${w?`?ct=${encodeURIComponent(w)}`:""}`:t.resourceId?`/api/resources/${t.resourceId}/`:C??(S?`/runtime/${S}/${w?`?ct=${encodeURIComponent(w)}`:""}`:void 0);f.useEffect(()=>{if(!c)return;const B=l.current??a.current?.querySelector("iframe");if(B&&B instanceof HTMLIFrameElement)return Yj(B)},[c,L]);const _=p.filter(B=>B.finished_at!==null&&B.finished_at!==void 0),O=_.filter(B=>B.score!==null&&B.score!==void 0),T=O.length>0?O.reduce((B,X)=>B+(X.score||0),0)/O.length:null,A=60,R=m?.role==="student"&&(m.studentId||m.userId)||null,D=yk(p),I=_.filter(B=>!bk.has(B.studentId)||B.studentId===R),$=wk(I,D),U=R?I.find(B=>B.studentId===R)??null:null,E=U?D.get(U.attemptId)??null:null,F=D.size,j=!!t.coursewareUuid&&p.length>0;return r.jsxs("div",{ref:a,className:(s??"w-full h-full")+" relative",children:[c?r.jsx("iframe",{ref:l,className:"w-full h-full border-none",src:L,srcDoc:L?void 0:fk(t.code||"",e),sandbox:"allow-scripts allow-forms allow-downloads","data-lms-bridge":"true",referrerPolicy:"no-referrer",title:i??t.title??"Interactive Courseware",credentialless:"true",onLoad:P}):r.jsx("div",{className:"w-full h-full flex items-center justify-center text-xs text-gray-400 bg-slate-50 rounded-xl",children:"课件未加载"}),j&&r.jsxs(r.Fragment,{children:[r.jsx("button",{type:"button",onClick:()=>x(B=>!B),"data-testid":"courseware-scores-toggle",className:"absolute top-2 right-2 z-[60] px-3 py-1.5 bg-white/95 backdrop-blur-sm rounded-lg shadow-lg border border-gray-200 text-xs font-medium text-gray-700 hover:bg-white transition-colors",children:g?"隐藏成绩":`查看成绩 (${$.length})`}),g&&r.jsxs("div",{"data-testid":"courseware-scores-panel",className:"absolute top-12 right-2 z-[60] w-72 max-h-96 overflow-auto bg-white/95 backdrop-blur-sm rounded-xl shadow-lg border border-gray-200 p-3",children:[r.jsx("div",{className:"text-xs text-gray-400 mb-2 flex items-center justify-between",children:r.jsxs("span",{children:[$.length," 人已提交",T!==null&&` · 均分 ${T.toFixed(1)}`]})}),R&&r.jsx("div",{"data-testid":"courseware-my-score",className:"text-xs text-blue-700 bg-blue-50 border border-blue-100 rounded-lg px-2 py-1.5 mb-2",children:U?`我的成绩 ${typeof U.score=="number"?U.score:"—"}${E!==null?` · 全班第 ${E}/${F} 名`:""}`:"我还没有提交"}),$.length===0?r.jsx("div",{className:"text-xs text-gray-400 text-center py-4",children:"暂无提交"}):r.jsx("div",{className:"space-y-1.5",children:$.map(B=>{const X=typeof B.score=="number"?B.score:null,k=typeof B.completion=="number"?Math.round(B.completion*100):null,q=D.get(B.attemptId),J=!!R&&B.studentId===R;return r.jsxs("div",{className:`flex items-center justify-between gap-2 text-xs rounded-md px-1.5 py-1 ${J?"bg-blue-50 ring-1 ring-blue-200":""}`,"data-testid":`courseware-attempt-row-${B.attemptId}`,children:[r.jsx("span",{className:"w-4 shrink-0 text-right font-mono text-gray-400",children:q??"-"}),r.jsxs("span",{className:"font-medium text-gray-700 truncate flex-1",children:[B.studentName||B.studentId,J&&r.jsx("span",{className:"ml-1 font-normal text-blue-600",children:"(我)"})]}),r.jsxs("span",{className:`font-mono font-bold ${X!==null&&X>=A?"text-green-600":"text-red-500"}`,children:[X!==null?X:"-",k!==null&&r.jsxs("span",{className:"ml-1 text-gray-400 font-normal",children:[k,"%"]})]})]},B.attemptId)})})]})]})]})}class Sk{constructor(){this.renderers=new Map}register(e,n,s){this.renderers.set(e,{impl:n,pluginId:s})}registerHostBuiltin(e,n){this.renderers.set(e,{impl:n,hostBuiltin:!0})}get(e){return this.renderers.get(e)?.impl}getEffectiveRenderer(e){const n=this.renderers.get(e);if(n)return n.pluginId||n.hostBuiltin?n.impl:void 0}has(e){return this.renderers.has(e)}unregister(e,n){const s=this.renderers.get(e);s&&(n&&s.pluginId!==n||this.renderers.delete(e))}unregisterPlugin(e){for(const[n,s]of this.renderers)s.pluginId===e&&this.renderers.delete(n)}}const Bs=new Sk,lC=({type:t,title:e,data:n,containerSize:s,onClose:i,lessonId:o,elementId:a,dismissible:l=!0,readOnly:c=!1,renderContent:d})=>{De.useEffect(()=>{if(!l)return;const N=y=>{y.key==="Escape"&&i()};return window.addEventListener("keydown",N),()=>window.removeEventListener("keydown",N)},[i,l]);const h=l?i:()=>{},m=Bs.getEffectiveRenderer(t),[p,u]=f.useState({width:window.innerWidth,height:window.innerHeight});f.useEffect(()=>{const N=()=>u({width:window.innerWidth,height:window.innerHeight});return window.addEventListener("resize",N),()=>window.removeEventListener("resize",N)},[]);const g=De.useRef(null),[x,w]=f.useState({width:0,height:0}),v=De.useRef(null),S=De.useCallback(()=>{const N=g.current;if(!N)return;const y=window.getComputedStyle(N),P=N.clientWidth-(parseFloat(y.paddingLeft)||0)-(parseFloat(y.paddingRight)||0),L=N.clientHeight-(parseFloat(y.paddingTop)||0)-(parseFloat(y.paddingBottom)||0);w({width:Math.max(0,P),height:Math.max(0,L)})},[]),b=De.useCallback(N=>{g.current=N,v.current?.disconnect(),v.current=null,N&&typeof ResizeObserver<"u"&&(v.current=new ResizeObserver(S),v.current.observe(N))},[S]);f.useLayoutEffect(()=>{S()},[S]);const C=r.jsx("div",{className:"fixed inset-0 z-[99999] bg-black/60 flex items-center justify-center",style:{pointerEvents:"auto"},children:r.jsxs("div",{className:"relative bg-white rounded-xl shadow-2xl overflow-hidden flex flex-col",style:{width:Math.max(400,p.width-32),height:Math.max(300,p.height-32)},children:[r.jsxs("div",{className:"bg-indigo-50 text-indigo-700 px-4 py-2 flex justify-between items-center text-sm font-semibold border-b border-indigo-100 shrink-0",children:[r.jsx("span",{className:"truncate",children:e}),l?r.jsxs("button",{onClick:i,className:"p-1.5 hover:bg-indigo-200/50 rounded-lg text-indigo-600 hover:text-indigo-900 transition-colors cursor-pointer flex items-center gap-1 text-xs",children:[r.jsx(ii,{size:14})," 退出全屏"]}):r.jsx("span",{className:`px-2 py-1 rounded-md text-xs font-bold flex items-center gap-1 select-none ${c?"bg-amber-100 text-amber-800 border border-amber-300":"bg-indigo-100 text-indigo-600"}`,title:c?"教师已开启全班专注锁定,当前为只读演示视图":"由教师端控制,无法在本地退出",children:c?"🔒 全班专注锁定中 · 演示视图":r.jsxs(r.Fragment,{children:[r.jsx(ii,{size:12})," 教师同步视图"]})})]}),(()=>{const N=t==="quiz"||t==="assignment";return r.jsxs("div",{ref:b,"data-testid":"fullscreen-content",className:"flex-1 overflow-auto p-6 relative",style:{pointerEvents:c&&!N?"none":"auto"},children:[m?r.jsx(m,{elementType:t,data:n,onClose:h,containerSize:p,lessonId:o,elementId:a}):d?d(x):r.jsx(kk,{elementType:t,data:n,onClose:h,containerSize:p,lessonId:o}),c&&!N&&r.jsx("div",{"data-testid":"fullscreen-readonly-lock-cover",className:"absolute inset-0 z-50 cursor-not-allowed bg-transparent select-none",style:{pointerEvents:"auto"},title:"🔒 全班专注锁定中:组件为只读跟随模式",onClick:y=>{y.stopPropagation(),y.preventDefault()},onPointerDown:y=>{y.stopPropagation(),y.preventDefault()}})]})})()]})});return Zf.createPortal(C,document.body)},jk=[{field:"text",icon:"📝",label:"文本"},{field:"markdown",icon:"📄",label:"Markdown"},{field:"code",icon:"💻",label:"代码"},{field:"question",icon:"❓",label:"测验",extra:["options"]},{field:"equation",icon:"📐",label:"公式"},{field:"url",icon:"🔗",label:"链接"},{field:"src",icon:"🖼",label:"图片"},{field:"coursewareUuid",icon:"📚",label:"课件"}];function kk({data:t,lessonId:e}){const n=jk.find(l=>t[l.field]!==void 0&&t[l.field]!==null&&t[l.field]!=="");if(!n)return r.jsxs("div",{className:"flex flex-col items-center justify-center h-full gap-4 text-gray-500",children:[r.jsx(rr,{size:48,className:"opacity-30"}),r.jsx("div",{className:"text-sm font-medium",children:"自动识别渲染"}),r.jsx("pre",{className:"text-xs text-left bg-gray-50 border rounded-lg p-4 max-w-full max-h-80 overflow-auto font-mono",children:JSON.stringify(t,null,2)})]});const{field:s,icon:i,label:o,extra:a}=n;if(s==="markdown")return r.jsx("div",{className:"prose prose-sm max-w-none",children:r.jsx(Gv,{children:String(t.markdown)})});if(s==="code")return r.jsx("textarea",{value:String(t.code),readOnly:!0,className:"w-full h-full p-4 bg-gray-900 text-green-400 font-mono text-sm rounded-xl resize-none"});if(s==="text")return r.jsx("div",{className:"flex items-start h-full",children:r.jsx("div",{className:"text-lg whitespace-pre-wrap leading-relaxed",children:String(t.text)})});if(s==="question"){const l=Array.isArray(t.options)?t.options:[];return r.jsxs("div",{className:"max-w-2xl mx-auto space-y-6",children:[r.jsx("h3",{className:"text-xl font-bold text-gray-800",children:t.question}),r.jsx("div",{className:"flex flex-col gap-3",children:l.map((c,d)=>r.jsxs("div",{className:"px-5 py-4 text-left bg-gray-50 border-2 border-gray-200 rounded-xl text-base",children:[r.jsxs("span",{className:"font-bold text-indigo-600 mr-3",children:["ABCDEFGHIJKLMNOPQRSTUVWXYZ"[d],"."]}),c]},d))})]})}return s==="url"?r.jsx("div",{className:"flex items-center justify-center h-full",children:r.jsx("a",{href:String(t.url),target:"_blank",rel:"noopener noreferrer",className:"text-indigo-600 underline text-lg",children:String(t.url)})}):s==="src"?r.jsx("div",{className:"flex items-center justify-center h-full",children:r.jsx("img",{src:String(t.src),alt:"",className:"max-w-full max-h-full object-contain rounded-lg"})}):s==="coursewareUuid"?r.jsx(vk,{data:{coursewareUuid:String(t.coursewareUuid)},lessonId:e,className:"w-full h-full rounded-xl border"}):s==="equation"?r.jsx("div",{className:"flex items-center justify-center h-full",children:r.jsx("div",{className:"text-2xl font-mono text-gray-800 bg-gray-50 px-8 py-4 rounded-xl border",children:String(t.equation)})}):r.jsx("div",{className:"flex items-center justify-center h-full",children:r.jsxs("div",{className:"text-center",children:[r.jsx("div",{className:"text-4xl mb-2",children:i}),r.jsx("div",{className:"text-lg font-semibold text-gray-800",children:o}),r.jsx("pre",{className:"mt-4 text-xs text-gray-500 max-w-md overflow-auto",children:JSON.stringify(t,null,2)})]})})}class Ck{constructor(){this.editors=new Map}register(e,n,s){this.editors.set(e,{impl:n,pluginId:s})}get(e){return this.editors.get(e)?.impl}has(e){return this.editors.has(e)}unregister(e,n){const s=this.editors.get(e);s&&(n&&s.pluginId!==n||this.editors.delete(e))}unregisterPlugin(e){for(const[n,s]of this.editors)s.pluginId===e&&this.editors.delete(n)}}const Xr=new Ck;class Nk{constructor(){this.store=$t(()=>({items:new Map}))}register(e,n){if(!e?.quizType||!e.quizType.trim())throw new Error("[AssignmentQuestionRendererRegistry] quizType is required");if(typeof e.render!="function")throw new Error("[AssignmentQuestionRendererRegistry] render must be a function");const s=e.quizType.trim();this.store.setState(i=>{const o=new Map(i.items);return o.set(s,{config:{...e,quizType:s},pluginId:n||e.quizType}),{items:o}})}unregister(e,n){const s=e.trim(),i=this.store.getState().items.get(s);i&&n&&i.pluginId!==n||this.store.setState(o=>{const a=new Map(o.items);return a.delete(s),{items:a}})}match(e){if(!e||!e.startsWith("{"))return null;try{const n=String(JSON.parse(e).quizType??"").trim();if(!n||n==="mcq_learning_objectives")return null;const s=this.store.getState().items.get(n);return s?{config:s.config}:null}catch{return null}}clearOwned(e){e&&this.store.setState(n=>{const s=new Map(n.items);for(const[i,o]of s)o.pluginId===e&&s.delete(i);return{items:s}})}list(){return Array.from(this.store.getState().items.values()).map(e=>e.config)}clear(){this.store.setState(()=>({items:new Map}))}}const ei=new Nk,Ek=["@openlearn/frontend:IFrontendAPI","@openlearn/frontend:ISocketService","@openlearn/frontend:IUIService","@openlearn/frontend:IStorageService","@openlearn/frontend:ISemesterGradeService"];class Pk{constructor(e){this.registry=null,this.initialized=!1,this.sourceCodes=new Map,this.pluginModules=new Map,this.workerManager=null,this.dispatcher=Ul,this.disposers=new Map,this.moduleLoader=e?.moduleLoader??this.defaultModuleLoader}trackDisposer(e,n){const s=this.disposers.get(e)??[];return s.push(n),this.disposers.set(e,s),()=>{const i=this.disposers.get(e);if(!i)return;const o=i.indexOf(n);o>=0&&i.splice(o,1),n()}}getDispatcher(){return this.dispatcher}setDispatcher(e){this.dispatcher=e}setWorkerManager(e){this.workerManager=e}async initialize(e,n,s,i,o){o&&(this.dispatcher=o);const a=new ck;await a.register(fl,e),await a.register(ml,n),await a.register(pl,s),await a.register(gl,i),await a.register(rk,new Tk(e)),await a.register(ik,this.dispatcher),this.registry=a,this.initialized=!0,Le.getState().initialize(a)}getRegistry(){return this.registry}isInitialized(){return this.initialized}async installPlugin(e,n){this.sourceCodes.set(e.id,n),Le.getState().addPlugin({id:e.id,name:e.name,version:e.version,state:Te.INSTALLED,executionMode:"inline",icon:e.icon,capabilitiesProposed:Array.isArray(e.capabilitiesProposed)?[...e.capabilitiesProposed]:[]})}async activateRemotePlugin(e,n){const s=Le.getState(),i=s.activePlugins.find(o=>o.id===e);if(!(i&&(i.state===Te.ACTIVE||i.state===Te.ACTIVATING))){s.updatePluginState(e,Te.ACTIVATING);try{const o=`/plugins/${e}/frontend.js`,a=await fetch(o);if(!a.ok)throw new Error(`Failed to fetch frontend.js for plugin "${e}": HTTP ${a.status}`);let l=await a.text();window.HostSharedDeps&&(l=Ak(l));const c=new Blob([l],{type:"text/javascript"}),d=URL.createObjectURL(c);let h;try{h=await import(d)}finally{URL.revokeObjectURL(d)}const m=h.default??h;if(typeof m.activate!="function")throw new Error("Invalid remote frontend plugin: missing activate function");const p=await this.buildContext(e,n);await Promise.race([m.activate(p),new Promise((u,g)=>setTimeout(()=>g(new Error("Activation timeout (5000ms)")),5e3))]),this.pluginModules.set(e,{manifest:n,activate:m.activate,deactivate:typeof m.deactivate=="function"?m.deactivate:void 0}),s.updatePluginState(e,Te.ACTIVE)}catch(o){throw console.error(`[FrontendPluginHost] Failed to activate remote plugin "${e}":`,o),s.updatePluginState(e,Te.ERROR),this.unregisterPluginResources(e),o}}}async activatePlugin(e){const n=Le.getState(),s=n.activePlugins.find(i=>i.id===e);if(!s)throw new Error(`Plugin not found: ${e}`);if(s.executionMode==="worker")return this.activateWorkerPlugin(e,s);if(s.executionMode!=="inline")throw new Error(`Unsupported execution mode for activation: ${s.executionMode}`);n.updatePluginState(e,Te.ACTIVATING);try{const i=this.sourceCodes.get(e);if(!i)throw new Error(`No source code found for plugin: ${e}`);const o=await this.moduleLoader(i),a=o.default??o,l=a.manifest??o.manifest,c=a.activate??o.activate,d=a.deactivate??o.deactivate;if(!l||typeof c!="function")throw new Error("Invalid plugin: missing manifest or activate function");if(l.id!==e)throw new Error(`Manifest id mismatch: expected "${e}", got "${l.id}"`);if(l.classroomTools)for(const m of l.classroomTools)n.registerExtensionPoint("classroom.tool",{id:m.id,label:m.name,icon:m.icon,slotProps:m.commandType?{commandType:m.commandType}:void 0,component:()=>Promise.resolve({default:(()=>null)}),pluginId:e});if(l.contributes){const m=l.contributes;if(Array.isArray(m["command_palette.item"]))for(const p of m["command_palette.item"])n.registerExtensionPoint("command_palette.item",{id:p.id,label:p.title,slotProps:p,component:()=>Promise.resolve({default:(()=>null)}),pluginId:e});if(Array.isArray(m["quick_insert.item"]))for(const p of m["quick_insert.item"])n.registerExtensionPoint("quick_insert.item",{id:p.id,label:p.title,icon:p.icon,slotProps:p,component:()=>Promise.resolve({default:(()=>null)}),pluginId:e});if(Array.isArray(m["ai.prompt.template"]))for(const p of m["ai.prompt.template"])n.registerExtensionPoint("ai.prompt.template",{id:p.id,label:p.title,slotProps:p,component:()=>Promise.resolve({default:(()=>null)}),pluginId:e});if(Array.isArray(m["ai.skill.provider"]))for(const p of m["ai.skill.provider"])n.registerExtensionPoint("ai.skill.provider",{id:p.id,label:p.name,slotProps:p,component:()=>Promise.resolve({default:(()=>null)}),pluginId:e});if(Array.isArray(m["classroom.tool"])&&!l.classroomTools)for(const p of m["classroom.tool"])n.registerExtensionPoint("classroom.tool",{id:p.id,label:p.name,icon:p.icon,slotProps:p.commandType?{commandType:p.commandType,payload:p.payload}:void 0,component:()=>Promise.resolve({default:(()=>null)}),pluginId:e})}const h=await this.buildContext(e,l);await Promise.race([c(h),new Promise((m,p)=>setTimeout(()=>p(new Error("Activation timeout (5000ms)")),5e3))]),this.pluginModules.set(e,{manifest:l,activate:c,deactivate:typeof d=="function"?d:void 0}),n.updatePluginState(e,Te.ACTIVE)}catch(i){throw n.updatePluginState(e,Te.ERROR),this.unregisterPluginResources(e),i}}async activateWorkerPlugin(e,n){if(!this.workerManager)throw new Error(`Cannot activate plugin "${e}" in worker mode: BrowserWorkerManager not set. Call setWorkerManager() first.`);const s=Le.getState(),i=this.sourceCodes.get(e);if(!i)throw new Error(`No source code found for plugin: ${e}`);const o={id:e,name:n.name,version:n.version,capabilitiesProposed:Array.isArray(n.capabilitiesProposed)?[...n.capabilitiesProposed]:[]};s.updatePluginState(e,Te.ACTIVATING);try{let a;if(this.registry)try{a=await this.registry.resolve("@openlearn/frontend:ISocketService")}catch{}const{serviceHost:l}=await this.workerManager.createWorker(e,o,i,Ek,a);this.pluginModules.set(e,{manifest:o,activate:async()=>{},deactivate:async()=>{await this.workerManager.terminateWorker(e)}}),s.updatePluginState(e,Te.ACTIVE)}catch(a){throw s.updatePluginState(e,Te.ERROR),this.unregisterPluginResources(e),a}}async deactivatePlugin(e){const n=Le.getState(),s=n.activePlugins.find(i=>i.id===e);if(!(!s||s.state!==Te.ACTIVE)){n.updatePluginState(e,Te.DEACTIVATING);try{const i=this.pluginModules.get(e);i?.deactivate&&await Promise.race([i.deactivate(),new Promise((o,a)=>setTimeout(()=>a(new Error("Deactivation timeout (5000ms)")),5e3))])}catch(i){console.error(`[FrontendPluginHost] Deactivation error for "${e}":`,i)}finally{this.unregisterPluginResources(e),this.pluginModules.delete(e),n.updatePluginState(e,Te.INACTIVE)}}}async uninstallPlugin(e){const n=Le.getState();n.activePlugins.find(i=>i.id===e)?.state===Te.ACTIVE&&await this.deactivatePlugin(e);try{await fetch(`/api/plugins/${e}`,{method:"DELETE"})}catch(i){console.error(`[FrontendPluginHost] Failed to DELETE plugin "${e}" on server:`,i)}this.sourceCodes.delete(e),this.pluginModules.delete(e),this.unregisterPluginResources(e),n.removePlugin(e)}getExtensions(e){return Le.getState().getExtensions(e)}unregisterPluginResources(e){const n=this.disposers.get(e);if(n){const s=n.splice(0);for(const i of s)try{i()}catch(o){console.error(`[FrontendPluginHost] Error releasing subscription for "${e}":`,o)}this.disposers.delete(e)}Le.getState().unregisterPluginExtensionPoints(e),Bs.unregisterPlugin(e),Xr.unregisterPlugin(e),Fs.unregisterPlugin(e),os.unregisterPlugin(e),ei.clearOwned(e)}async defaultModuleLoader(e){const n=new Blob([e],{type:"text/javascript"}),s=URL.createObjectURL(n);try{return await import(s)}finally{URL.revokeObjectURL(s)}}async buildContext(e,n){if(!this.registry)throw new Error("FrontendPluginHost not initialized");const s=await this.registry.resolve(fl),i=await this.registry.resolve(ml),o=await this.registry.resolve(pl),a=await this.registry.resolve(gl),l=this.dispatcher.createScopedDispatcher?this.dispatcher.createScopedDispatcher(e):{dispatch:(c,d)=>this.dispatcher.dispatch(c,{sourcePluginId:e,...d}),registerHandler:(c,d)=>this.dispatcher.registerHandler(c,d),subscribe:(c,d)=>this.dispatcher.subscribe(c,d),use:c=>this.dispatcher.use(c)};return{services:{frontendApi:s,socketService:i,uiService:o,storageService:a},pluginId:e,manifest:n,dispatcher:l,ui:{registerExtensionPoint:(c,d)=>{Le.getState().registerExtensionPoint(c,{...d,pluginId:e})},unregisterExtensionPoint:(c,d)=>{Le.getState().unregisterExtensionPoint(c,d)},registerFullscreenRenderer:(c,d)=>{Bs.register(c,d,e)},unregisterFullscreenRenderer:c=>{Bs.unregister(c,e)},registerPropertyEditor:(c,d)=>{Xr.register(c,d,e)},unregisterPropertyEditor:c=>{Xr.unregister(c,e)},registerCoursewareSource:c=>{Fs.register(c,e)},unregisterCoursewareSource:c=>{Fs.unregister(c,e)},registerPaletteItem:c=>{os.register(c,e)},unregisterPaletteItem:c=>{os.unregister(c,e)},registerAssignmentQuestionRenderer:c=>{ei.register(c,e)},unregisterAssignmentQuestionRenderer:c=>{ei.unregister(c,e)}},navigation:{getTeacherTab:()=>Ne.getState().teacherTab,setTeacherTab:c=>Ne.getState().setTeacherTab(c),setSelectedLesson:c=>Ne.getState().setSelectedLesson(c),subscribeTeacherTab:c=>{let d=Ne.getState().teacherTab;return this.trackDisposer(e,Ne.subscribe(h=>{const m=h.teacherTab;m!==d&&(d=m,c(m))}))}},context:{get:()=>{const c=Ne.getState();return{lessonId:c.selectedLesson,classId:c.liveClassSelectedClassId}},subscribe:c=>{const d=Ne.getState();let h={lessonId:d.selectedLesson,classId:d.liveClassSelectedClassId};return this.trackDisposer(e,Ne.subscribe(m=>{const p={lessonId:m.selectedLesson,classId:m.liveClassSelectedClassId};(p.lessonId!==h.lessonId||p.classId!==h.classId)&&(h=p,c(p))}))}},invokeCommand:async(c,d)=>{if(!s)throw new Error(`Plugin "${e}" cannot invoke command: frontendApi is not available. Has FrontendPluginHost initialized?`);const h=uk(c,n.id),m=await s.post("/api/plugins/execute-command",{type:h,payload:d});if(m.success&&m.result!==void 0)return m.result;throw new Error(m.error||"Command execution failed")},registerPanel:c=>{const d=c.slot||"teacher.dashboard.widget";Le.getState().registerExtensionPoint(d,{...c,pluginId:e})},registerMenu:c=>{const d=c.slot||"teacher.panel";Le.getState().registerExtensionPoint(d,{...c,pluginId:e})},registerToolbarButton:c=>{Le.getState().registerExtensionPoint("classroom.tool",{...c,pluginId:e})}}}}class Tk{constructor(e){this.frontendApi=e}async saveSemesterGrade(e,n,s){const i=await this.frontendApi.post("/api/grade-sync",{lessonId:e,studentId:n,grade:s});if(!i.success)throw new Error(i.error||"Failed to sync semester grade")}}const bl={react:"window.HostSharedDeps.React","react-dom":"window.HostSharedDeps.ReactDOM","react-dom/client":"(window.HostSharedDeps.ReactDOMClient || window.HostSharedDeps.ReactDOM)","react/jsx-runtime":"window.HostSharedDeps.jsxRuntime",recharts:"window.HostSharedDeps.Recharts","lucide-react":"window.HostSharedDeps.LucideReact"};function yl(t){return t.split(",").map(e=>e.trim()).filter(Boolean).map(e=>e.replace(/^type\s+/,"")).map(e=>e.replace(/\s+as\s+/,": ")).join(", ")}function Ik(t,e){t=t.replace(/\/\*[\s\S]*?\*\//g,"").replace(/\/\/.*$/gm,"").trim();const n=[],s=t.match(/^([a-zA-Z_$][\w$]*)\s*,\s*\*\s*as\s+([a-zA-Z_$][\w$]*)$/);if(s)return n.push(`const ${s[1]} = ${e}?.default ?? ${e};`),n.push(`const ${s[2]} = ${e};`),n.join(" ");const i=t.match(/^([a-zA-Z_$][\w$]*)\s*,\s*\{([\s\S]*)\}$/);if(i){const c=i[1],d=yl(i[2]);return n.push(`const ${c} = ${e}?.default ?? ${e};`),d&&n.push(`const { ${d} } = ${e};`),n.join(" ")}const o=t.match(/^\*\s*as\s+([a-zA-Z_$][\w$]*)$/);if(o)return`const ${o[1]} = ${e};`;const a=t.match(/^\{([\s\S]*)\}$/);if(a)return`const { ${yl(a[1])} } = ${e};`;const l=t.match(/^([a-zA-Z_$][\w$]*)$/);return l?`const ${l[1]} = ${e}?.default ?? ${e};`:null}function Ak(t){let e=t.replace(/import\s+['"]([^'"]+)['"];?/g,(n,s)=>bl[s]?`/* [HostSharedDeps] ${n} */`:n);return e=e.replace(/import\s+([\s\S]*?)\s+from\s+['"]([^'"]+)['"];?/g,(n,s,i)=>{const o=bl[i];if(!o)return n;const a=Ik(s,o);return a||n}),e}class zk extends De.Component{constructor(e){super(e),this.state={hasError:!1,error:null,errorInfo:null,copied:!1,showDetails:!1},this.handleCopy=async()=>{const{error:n,errorInfo:s}=this.state;if(!n)return;const i=Yi({type:"react",title:"React 组件渲染致命异常",message:n.message||String(n),stack:n.stack,componentStack:s?.componentStack||void 0,timestamp:Date.now(),url:typeof window<"u"?window.location.href:""});await Ys(i)&&(this.setState({copied:!0}),setTimeout(()=>this.setState({copied:!1}),2500))},this.handleReset=()=>{this.setState({hasError:!1,error:null,errorInfo:null,copied:!1,showDetails:!1})},this.handleGoHome=()=>{typeof window<"u"&&(window.location.href="/")}}static getDerivedStateFromError(e){return{hasError:!0,error:e}}componentDidCatch(e,n){this.setState({errorInfo:n}),Dt.getState().addError({type:"react",title:"React 组件渲染异常",message:e?.message||String(e),stack:e?.stack,componentStack:n?.componentStack||void 0}),console.error("[GlobalErrorBoundary] Unhandled React render exception:",e,n)}render(){if(this.state.hasError){const{error:e,errorInfo:n,copied:s,showDetails:i}=this.state,o=this.props.fallbackTitle||"界面渲染遇到意外错误";return r.jsx("div",{className:"min-h-screen bg-slate-50 dark:bg-slate-950 flex items-center justify-center p-4 select-text",children:r.jsxs("div",{className:"max-w-2xl w-full bg-white dark:bg-slate-900 rounded-2xl shadow-xl border border-rose-200 dark:border-rose-900/60 overflow-hidden",children:[r.jsxs("div",{className:"bg-gradient-to-r from-rose-500 to-red-600 px-6 py-5 text-white flex items-center gap-3.5",children:[r.jsx("div",{className:"p-2.5 bg-white/20 rounded-xl backdrop-blur-xs shrink-0",children:r.jsx(_m,{size:24,className:"text-white"})}),r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsx("h1",{className:"text-lg font-bold leading-snug",children:o}),r.jsx("p",{className:"text-xs text-rose-100 mt-0.5",children:"OpenLearn 捕获到界面异常,已阻止整页崩溃并为您保留了诊断报告。"})]})]}),r.jsxs("div",{className:"p-6 space-y-4",children:[r.jsxs("div",{children:[r.jsx("label",{className:"text-xs font-bold text-gray-500 dark:text-gray-400 uppercase tracking-wider block mb-1.5",children:"错误摘要 (Error Summary)"}),r.jsxs("div",{className:"bg-rose-50 dark:bg-rose-950/40 border border-rose-200 dark:border-rose-900/50 rounded-xl p-3.5 text-rose-900 dark:text-rose-200 text-sm font-mono break-all",children:[e?.name,": ",e?.message||"未知异常"]})]}),r.jsxs("div",{className:"border border-gray-200 dark:border-gray-800 rounded-xl overflow-hidden",children:[r.jsxs("button",{type:"button",onClick:()=>this.setState({showDetails:!i}),className:"w-full px-4 py-2.5 bg-gray-50 dark:bg-slate-800/60 hover:bg-gray-100 dark:hover:bg-slate-800 flex items-center justify-between text-xs font-semibold text-gray-700 dark:text-gray-300 transition-colors cursor-pointer",children:[r.jsx("span",{children:"查看调用堆栈与排查信息"}),i?r.jsx(fn,{size:14}):r.jsx(hn,{size:14})]}),i&&r.jsxs("div",{className:"p-4 bg-slate-900 text-slate-200 text-xs font-mono max-h-64 overflow-y-auto space-y-3 leading-relaxed",children:[e?.stack&&r.jsxs("div",{children:[r.jsx("span",{className:"text-rose-400 font-bold block mb-1",children:"Stack Trace:"}),r.jsx("pre",{className:"whitespace-pre-wrap text-xs opacity-90",children:e.stack})]}),n?.componentStack&&r.jsxs("div",{className:"pt-2 border-t border-slate-800",children:[r.jsx("span",{className:"text-amber-400 font-bold block mb-1",children:"Component Stack:"}),r.jsx("pre",{className:"whitespace-pre-wrap text-xs opacity-80",children:n.componentStack})]})]})]}),r.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3 pt-2",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsxs("button",{type:"button",onClick:this.handleCopy,className:`px-4 py-2 rounded-xl text-xs font-bold transition-all flex items-center gap-1.5 shadow-sm cursor-pointer ${s?"bg-emerald-600 text-white shadow-emerald-600/30":"bg-indigo-600 hover:bg-indigo-700 text-white shadow-indigo-600/30"}`,children:[s?r.jsx(rt,{size:14}):r.jsx(an,{size:14}),r.jsx("span",{children:s?"✓ 诊断报告已复制!":"一键复制错误报告"})]}),r.jsxs("button",{type:"button",onClick:this.handleReset,className:"px-3.5 py-2 rounded-xl text-xs font-semibold bg-gray-100 dark:bg-slate-800 hover:bg-gray-200 dark:hover:bg-slate-700 text-gray-700 dark:text-gray-200 transition-colors flex items-center gap-1.5 cursor-pointer",children:[r.jsx(Rl,{size:14}),r.jsx("span",{children:"重新加载界面"})]})]}),r.jsxs("button",{type:"button",onClick:this.handleGoHome,className:"px-3 py-2 rounded-xl text-xs font-medium text-gray-500 hover:text-gray-800 dark:text-gray-400 dark:hover:text-gray-100 transition-colors flex items-center gap-1 cursor-pointer",children:[r.jsx(_l,{size:14}),r.jsx("span",{children:"返回系统主页"})]})]})]})]})})}return this.props.children}}function Lk({isOpen:t,onClose:e,onSuccess:n,lang:s="zh"}){const[i,o]=f.useState([]),[a,l]=f.useState(!1),[c,d]=f.useState(null),[h,m]=f.useState(""),[p,u]=f.useState("all"),[g,x]=f.useState(null);if(f.useEffect(()=>{t&&(l(!0),fetch(`/api/external/smart-edu/resources?subject=${p}&query=${encodeURIComponent(h)}`).then(S=>S.json()).then(S=>{S.success&&Array.isArray(S.resources)&&o(S.resources)}).catch(S=>console.error("Failed to load smart edu resources",S)).finally(()=>l(!1)))},[t,p,h]),!t)return null;const w=async S=>{try{d(S.id);const C=await(await fetch("/api/external/smart-edu/import",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({resourceId:S.id})})).json();C.success?(x(`已成功导入《${S.title}》!`),setTimeout(()=>{x(null),n?.(),e()},1200)):alert(C.error||"导入失败")}catch(b){alert(b.message||"网络异常,导入失败")}finally{d(null)}},v=S=>{switch(S){case"national_gold":return"国家级一等奖精品课";case"national_silver":return"国家级二等奖精品课";case"ministry_excellent":return"教育部“部优”示范课";default:return"国家认证精品课"}};return r.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center p-4 bg-slate-950/70 backdrop-blur-sm animate-in fade-in duration-150",children:r.jsxs("div",{className:"relative w-full max-w-4xl bg-slate-900 border border-amber-500/30 rounded-2xl shadow-2xl shadow-amber-950/20 overflow-hidden flex flex-col max-h-[85vh]",children:[r.jsxs("div",{className:"px-6 py-4 bg-gradient-to-r from-amber-950/50 via-slate-900 to-slate-900 border-b border-amber-500/20 flex items-center justify-between",children:[r.jsxs("div",{className:"flex items-center space-x-3",children:[r.jsx("div",{className:"w-10 h-10 rounded-xl bg-gradient-to-br from-amber-400 to-yellow-600 flex items-center justify-center shadow-md shadow-amber-600/30 text-slate-950 font-bold",children:r.jsx(ot,{className:"w-5 h-5 text-slate-950"})}),r.jsxs("div",{children:[r.jsxs("div",{className:"flex items-center space-x-2",children:[r.jsx("h3",{className:"text-base font-bold text-white tracking-wide",children:"国家智慧教育公共服务平台 · 精品课资源库"}),r.jsxs("span",{className:"px-2 py-0.5 text-[11px] font-semibold bg-amber-500/20 text-amber-300 border border-amber-500/40 rounded-full flex items-center gap-1",children:[r.jsx(or,{className:"w-3 h-3"})," smartedu.cn 官方直连"]})]}),r.jsx("p",{className:"text-xs text-slate-400 mt-0.5",children:"同步教育部审定高中新课标示范课程、微课视频切片及配套白板探究实验"})]})]}),r.jsx("button",{onClick:e,className:"p-1.5 text-slate-400 hover:text-white rounded-lg hover:bg-slate-800 transition",children:r.jsx(Ie,{className:"w-5 h-5"})})]}),r.jsxs("div",{className:"px-6 py-3 bg-slate-900/60 border-b border-slate-800 flex flex-wrap items-center justify-between gap-3",children:[r.jsx("div",{className:"flex items-center space-x-1.5 overflow-x-auto pb-1 sm:pb-0",children:[{id:"all",label:"全部学科"},{id:"information_tech",label:"信息科技"},{id:"physics",label:"高中物理"},{id:"general_tech",label:"通用技术"}].map(S=>r.jsx("button",{onClick:()=>u(S.id),className:`px-3 py-1.5 rounded-lg text-xs font-medium transition ${p===S.id?"bg-amber-500 text-slate-950 font-semibold shadow-sm":"text-slate-300 hover:bg-slate-800"}`,children:S.label},S.id))}),r.jsxs("div",{className:"relative min-w-[240px]",children:[r.jsx(Dm,{className:"w-4 h-4 absolute left-3 top-1/2 -translate-y-1/2 text-slate-400"}),r.jsx("input",{type:"text",placeholder:"搜索课名、教师、知识点...",value:h,onChange:S=>m(S.target.value),className:"w-full pl-9 pr-3 py-1.5 text-xs bg-slate-950/70 border border-slate-700 rounded-lg text-white placeholder-slate-500 focus:outline-none focus:border-amber-500/60"})]})]}),g&&r.jsxs("div",{className:"mx-6 mt-3 px-4 py-2.5 bg-emerald-950/80 border border-emerald-500/40 rounded-xl text-emerald-300 text-xs flex items-center space-x-2 animate-in fade-in",children:[r.jsx(it,{className:"w-4 h-4 text-emerald-400"}),r.jsx("span",{children:g})]}),r.jsx("div",{className:"flex-1 overflow-y-auto p-6 space-y-4",children:a?r.jsxs("div",{className:"flex flex-col items-center justify-center py-16 text-slate-400",children:[r.jsx(Pt,{className:"w-8 h-8 animate-spin text-amber-400 mb-2"}),r.jsx("p",{className:"text-xs",children:"正在连接国家智慧教育平台检索资源..."})]}):i.length===0?r.jsx("div",{className:"text-center py-16 text-slate-500 text-xs",children:"未找到匹配的国家平台示范课程资源"}):i.map(S=>r.jsxs("div",{className:"group relative p-5 bg-slate-800/40 hover:bg-slate-800/70 border border-slate-800 hover:border-amber-500/40 rounded-xl transition duration-200 flex flex-col md:flex-row md:items-center justify-between gap-4",children:[r.jsxs("div",{className:"flex-1",children:[r.jsxs("div",{className:"flex items-center space-x-2.5 mb-1.5 flex-wrap",children:[r.jsxs("span",{className:"px-2 py-0.5 text-[10px] font-bold bg-amber-500/20 text-amber-400 border border-amber-500/30 rounded flex items-center gap-1",children:[r.jsx(cs,{className:"w-3 h-3 text-amber-400"}),v(S.awardLevel)]}),r.jsxs("span",{className:"text-xs text-slate-400 font-mono",children:["证书号: ",S.code]})]}),r.jsx("h4",{className:"text-sm font-bold text-white group-hover:text-amber-300 transition",children:S.title}),r.jsx("p",{className:"text-xs text-slate-300 mt-1 line-clamp-2 leading-relaxed",children:S.summary}),r.jsxs("div",{className:"flex items-center space-x-4 text-[11px] text-slate-400 mt-3 flex-wrap gap-y-1",children:[r.jsxs("span",{className:"text-slate-300 font-medium",children:["主讲教师: ",S.teacherName]}),r.jsxs("span",{children:["学校: ",S.schoolName]}),r.jsxs("span",{className:"flex items-center gap-1 text-amber-400/90",children:[r.jsx(Al,{className:"w-3 h-3"}),"包含 ",S.timeline.length," 教学环节"]})]})]}),r.jsx("div",{className:"flex items-center space-x-2 shrink-0",children:r.jsx("button",{disabled:c===S.id,onClick:()=>w(S),className:"px-4 py-2 bg-gradient-to-r from-amber-500 to-yellow-600 hover:from-amber-400 hover:to-yellow-500 text-slate-950 font-bold text-xs rounded-xl shadow-md shadow-amber-900/30 flex items-center space-x-1.5 transition disabled:opacity-50",children:c===S.id?r.jsxs(r.Fragment,{children:[r.jsx(Pt,{className:"w-3.5 h-3.5 animate-spin"}),r.jsx("span",{children:"同步中..."})]}):r.jsxs(r.Fragment,{children:[r.jsx(li,{className:"w-3.5 h-3.5"}),r.jsx("span",{children:"一键导入本地"})]})})})]},S.id))}),r.jsxs("div",{className:"px-6 py-3 bg-slate-950/60 border-t border-slate-800 text-[11px] text-slate-400 flex items-center justify-between",children:[r.jsxs("div",{className:"flex items-center space-x-1.5",children:[r.jsx("span",{className:"w-2 h-2 rounded-full bg-emerald-400 animate-pulse"}),r.jsx("span",{children:"国家平台数据通道已加密对齐 · 课程导入自动适配本地白板交互环境"})]}),r.jsx("span",{className:"text-slate-500",children:"CELTS-3 / 教育部教育信息化技术标准"})]})]})})}function Rk({onRefresh:t,lang:e="zh"}){const[n,s]=f.useState(!1);return r.jsxs(r.Fragment,{children:[r.jsxs("button",{onClick:()=>s(!0),className:"px-3 py-1.5 bg-gradient-to-r from-amber-500/20 to-yellow-500/20 hover:from-amber-500/30 hover:to-yellow-500/30 text-amber-300 border border-amber-500/40 rounded-xl text-xs font-semibold flex items-center space-x-1.5 shadow-sm transition active:scale-98",title:"从国家智慧教育公共服务平台 (smartedu.cn) 导入国家级精品课与微课资源",children:[r.jsx(ot,{className:"w-3.5 h-3.5 text-amber-400"}),r.jsx("span",{children:"国家平台导入"})]}),r.jsx(Lk,{isOpen:n,onClose:()=>s(!1),onSuccess:t,lang:e})]})}function _k({course:t}){if(!t)return null;let e=null;try{typeof t.content=="string"&&t.content.startsWith("{")&&(e=JSON.parse(t.content).smartEduMetadata)}catch{e=null}const n=typeof t.title=="string"&&t.title.includes("国家精品课");if(!e&&!n)return null;const s=e?.awardLevel==="ministry_excellent"?"部优示范课":e?.awardLevel==="national_silver"?"国二等奖":"国家精品课";return r.jsxs("span",{className:"inline-flex items-center gap-1 px-2 py-0.5 rounded text-[10px] font-bold bg-amber-500/15 text-amber-400 border border-amber-500/30 shadow-xs tracking-tight",title:e?`国家智慧教育平台认证精品课 · 证书号: ${e.code||"SED-2026"}`:"国家智慧教育平台认证课程",children:[r.jsx(cs,{className:"w-3 h-3 text-amber-400 shrink-0"}),r.jsx("span",{children:s})]})}function Dk({course:t,onRefresh:e}){const[n,s]=f.useState(!1),[i,o]=f.useState(!1);if(!t)return null;const a=async l=>{l.stopPropagation();try{s(!0);const d=await(await fetch("/api/external/smart-edu/report",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({lessonId:t.id,reportData:{title:t.title,lastSync:Date.now()}})})).json();d.success?(o(!0),setTimeout(()=>o(!1),2500),e?.()):alert(d.error||"上报失败")}catch(c){alert(c.message||"网络连接异常")}finally{s(!1)}};return r.jsxs("button",{onClick:a,disabled:n,className:"p-1.5 text-slate-400 hover:text-amber-400 hover:bg-slate-700/50 rounded-lg text-xs transition flex items-center gap-1",title:"同步本课教案与元数据至国家智慧教育公共服务平台",children:[n?r.jsx(Pt,{className:"w-3.5 h-3.5 animate-spin text-amber-400"}):i?r.jsx(it,{className:"w-3.5 h-3.5 text-emerald-400"}):r.jsx(Mm,{className:"w-3.5 h-3.5"}),r.jsx("span",{className:"text-[11px]",children:"国家云"})]})}function Mk({segment:t,onPatch:e,readOnly:n}){const[s,i]=f.useState(!1);if(n)return null;const o=()=>{if(!t)return;const a=t.description||"",l=`
|
|
221
|
+
> 🌐 【国家智慧教育平台·资源切片】已关联教育部审定课标微课视频 (smartedu.cn/v/${t.id||"res"})`;a.includes("国家智慧教育平台")||(e?.({description:(a+l).trim()}),i(!0),setTimeout(()=>i(!1),2e3))};return r.jsxs("button",{onClick:o,className:"px-2 py-1 bg-amber-500/10 hover:bg-amber-500/20 text-amber-300 border border-amber-500/30 rounded text-[11px] font-medium transition flex items-center space-x-1",title:"从国家平台关联教育部新课标配套微课切片",children:[s?r.jsx(rt,{className:"w-3 h-3 text-emerald-400"}):r.jsx(Om,{className:"w-3 h-3 text-amber-400"}),r.jsx("span",{children:s?"已关联微课":"国家微课"})]})}function Ok({lessonId:t}){const[e,n]=f.useState(!1);return e?null:r.jsxs("div",{className:"w-full bg-gradient-to-r from-amber-950/70 via-slate-900 to-amber-950/70 border-b border-amber-500/30 px-4 py-1.5 text-xs flex items-center justify-between text-amber-200",children:[r.jsxs("div",{className:"flex items-center space-x-2",children:[r.jsx("span",{className:"w-2 h-2 rounded-full bg-emerald-400 animate-pulse"}),r.jsx("span",{className:"font-semibold text-amber-300",children:"国家智慧教育公共服务平台"}),r.jsx("span",{className:"text-slate-400",children:"|"}),r.jsx("span",{className:"text-slate-300",children:"双师课堂数据通道已连通,授课学情与探究轨迹自动遵从 CELTS-3 规范离线暂存并同步"})]}),r.jsxs("div",{className:"flex items-center space-x-3 text-[11px]",children:[r.jsxs("span",{className:"text-emerald-400 flex items-center gap-1 font-mono",children:[r.jsx(Ws,{className:"w-3 h-3"})," 延迟: 16ms"]}),r.jsx("button",{onClick:()=>n(!0),className:"text-slate-400 hover:text-white p-0.5",title:"收起通知",children:r.jsx(Ie,{className:"w-3.5 h-3.5"})})]})]})}function $k({lessonTitle:t}){return r.jsxs("div",{className:"w-full bg-slate-950/80 backdrop-blur-md border-t border-amber-500/20 px-4 py-1.5 flex items-center justify-between text-xs text-slate-300",children:[r.jsxs("div",{className:"flex items-center space-x-2",children:[r.jsxs("span",{className:"flex items-center gap-1 text-amber-400 font-bold text-[11px] bg-amber-500/10 px-2 py-0.5 rounded border border-amber-500/30",children:[r.jsx(Oi,{className:"w-3 h-3 animate-pulse text-amber-400"}),"国家教育云·大屏示范广播"]}),r.jsxs("span",{className:"text-slate-400 text-xs truncate max-w-xl",children:["正在执教:",t||"新课标教学示范课"," · 同步连接国家中小学智慧教育平台教研专区"]})]}),r.jsxs("div",{className:"flex items-center space-x-2 text-[11px] text-slate-400 font-mono",children:[r.jsx("span",{children:"smartedu.cn"}),r.jsx("span",{className:"text-emerald-400",children:"● 连通正常"})]})]})}function Fk({lessonId:t,summaryData:e}){const[n,s]=f.useState(!1),[i,o]=f.useState(!1),a=async()=>{try{s(!0);const l={meta:{standard:"CELTS-3 (教育部基础教育学情采集标准)",platform:"国家智慧教育公共服务平台 (smartedu.cn)",generatedAt:new Date().toISOString(),lessonId:t},classroomMetrics:{attendanceRate:e?.attendanceRate||"100%",interactionCount:e?.interactionCount||36,quizAverageScore:e?.quizAverageScore||88.5,peerReviewCount:e?.peerReviewCount||18,dimensions:{computationalThinking:92,engineeringPractice:88,collaboration:95}}},c=new Blob([JSON.stringify(l,null,2)],{type:"application/json;charset=utf-8"}),d=URL.createObjectURL(c),h=document.createElement("a");h.href=d,h.download=`smartedu_celts_report_${t||"summary"}.json`,h.click(),URL.revokeObjectURL(d),o(!0),setTimeout(()=>o(!1),2500)}finally{s(!1)}};return r.jsxs("button",{onClick:a,disabled:n,className:"px-3.5 py-1.5 bg-gradient-to-r from-amber-500/20 to-yellow-600/20 hover:from-amber-500/30 hover:to-yellow-600/30 text-amber-300 border border-amber-500/40 rounded-xl text-xs font-semibold flex items-center space-x-1.5 transition active:scale-98",title:"导出符合国家智慧教育公共服务平台 CELTS-3 规范的学情评价归档包",children:[n?r.jsx(Pt,{className:"w-3.5 h-3.5 animate-spin"}):i?r.jsx(it,{className:"w-3.5 h-3.5 text-emerald-400"}):r.jsx(or,{className:"w-3.5 h-3.5 text-amber-400"}),r.jsx("span",{children:i?"已导出 CELTS-3 报告":"国家平台学情包导出"})]})}function Bk({currentRole:t}){const[e,n]=f.useState(!1),[s,i]=f.useState(null);return f.useEffect(()=>{fetch("/api/external/smart-edu/status").then(o=>o.json()).then(o=>{o.success&&i(o)}).catch(()=>{})},[]),r.jsxs("div",{className:"relative inline-flex items-center",children:[r.jsxs("button",{onClick:()=>n(!e),className:"px-2.5 py-1 rounded-full text-[11px] font-medium bg-amber-500/10 hover:bg-amber-500/20 text-amber-300 border border-amber-500/30 flex items-center space-x-1.5 transition",title:"国家智慧教育公共服务平台数据网关状态",children:[r.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-emerald-400 animate-pulse"}),r.jsx("span",{className:"font-semibold",children:"国家云"}),r.jsx("span",{className:"text-amber-400/80",children:"已连通"})]}),e&&r.jsxs("div",{className:"absolute right-0 top-full mt-2 w-72 bg-slate-900 border border-amber-500/30 rounded-xl shadow-xl p-3 z-50 text-xs animate-in fade-in duration-150",children:[r.jsxs("div",{className:"flex items-center justify-between border-b border-slate-800 pb-2 mb-2",children:[r.jsxs("span",{className:"font-bold text-white flex items-center gap-1",children:[r.jsx(or,{className:"w-4 h-4 text-amber-400"}),"国家智慧教育平台网关"]}),r.jsx("button",{onClick:()=>n(!1),className:"text-slate-400 hover:text-white",children:r.jsx(Ie,{className:"w-3.5 h-3.5"})})]}),r.jsxs("div",{className:"space-y-1.5 text-slate-300 text-[11px]",children:[r.jsxs("div",{className:"flex justify-between",children:[r.jsx("span",{className:"text-slate-400",children:"数据节点:"}),r.jsx("span",{className:"font-mono text-white",children:"api.smartedu.cn"})]}),r.jsxs("div",{className:"flex justify-between",children:[r.jsx("span",{className:"text-slate-400",children:"往返延迟:"}),r.jsxs("span",{className:"text-emerald-400 font-mono font-semibold",children:[s?.rttMs??16," ms"]})]}),r.jsxs("div",{className:"flex justify-between",children:[r.jsx("span",{className:"text-slate-400",children:"已同步示范课:"}),r.jsxs("span",{className:"text-amber-300 font-semibold",children:[s?.syncedCoursesCount??1," 门"]})]}),r.jsxs("div",{className:"flex justify-between",children:[r.jsx("span",{className:"text-slate-400",children:"数据加密:"}),r.jsx("span",{className:"text-slate-300",children:"SM4 / CELTS-3 认证"})]})]})]})]})}function Vk({siteInfo:t}){return r.jsxs("div",{className:"bg-slate-900/90 border border-amber-500/30 rounded-2xl p-5 shadow-lg relative overflow-hidden",children:[r.jsx("div",{className:"absolute right-0 top-0 translate-x-4 -translate-y-4 w-32 h-32 bg-amber-500/5 rounded-full blur-2xl pointer-events-none"}),r.jsxs("div",{className:"flex items-center justify-between pb-3 border-b border-slate-800",children:[r.jsxs("div",{className:"flex items-center space-x-2.5",children:[r.jsx("div",{className:"p-2 bg-amber-500/10 text-amber-400 rounded-xl border border-amber-500/20",children:r.jsx(or,{className:"w-5 h-5"})}),r.jsxs("div",{children:[r.jsx("h4",{className:"text-sm font-bold text-white",children:"国家智慧教育公共服务平台 · 接入看板"}),r.jsx("p",{className:"text-[11px] text-slate-400",children:"教育部教育信息化行业标准数据交换通道"})]})]}),r.jsxs("span",{className:"px-2 py-0.5 text-[10px] font-bold bg-emerald-500/20 text-emerald-400 border border-emerald-500/40 rounded-full flex items-center gap-1",children:[r.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-emerald-400 animate-pulse"}),"已直连 (双向同步)"]})]}),r.jsxs("div",{className:"grid grid-cols-3 gap-3 mt-4",children:[r.jsxs("div",{className:"bg-slate-950/60 p-3 rounded-xl border border-slate-800",children:[r.jsx("div",{className:"text-[11px] text-slate-400",children:"示范课引流"}),r.jsx("div",{className:"text-lg font-bold text-amber-400 mt-1",children:"3 门"}),r.jsx("div",{className:"text-[10px] text-slate-500 mt-0.5",children:"普通高中新课标精品库"})]}),r.jsxs("div",{className:"bg-slate-950/60 p-3 rounded-xl border border-slate-800",children:[r.jsx("div",{className:"text-[11px] text-slate-400",children:"通道合规率"}),r.jsx("div",{className:"text-lg font-bold text-emerald-400 mt-1",children:"100%"}),r.jsx("div",{className:"text-[10px] text-slate-500 mt-0.5",children:"CELTS-3 数据格式校验"})]}),r.jsxs("div",{className:"bg-slate-950/60 p-3 rounded-xl border border-slate-800",children:[r.jsx("div",{className:"text-[11px] text-slate-400",children:"网络往返"}),r.jsx("div",{className:"text-lg font-bold text-cyan-400 mt-1",children:"16 ms"}),r.jsx("div",{className:"text-[10px] text-slate-500 mt-0.5",children:"骨干专网低延迟通道"})]})]})]})}const yt="ext-national-smart-edu";function Uk(){const t=Le.getState();t.registerExtensionPoint("course.list.toolbar.action",{id:"smart-edu-toolbar-import",label:"国家平台导入",icon:"Sparkles",pluginId:yt,component:()=>Promise.resolve({default:Rk})}),t.registerExtensionPoint("course.card.badge",{id:"smart-edu-card-badge",label:"国家精品课徽标",pluginId:yt,component:()=>Promise.resolve({default:_k})}),t.registerExtensionPoint("course.card.action",{id:"smart-edu-card-action",label:"上报国家云",pluginId:yt,component:()=>Promise.resolve({default:Dk})}),t.registerExtensionPoint("editor.segment.action",{id:"smart-edu-segment-action",label:"插入国家微课",pluginId:yt,component:()=>Promise.resolve({default:Mk})}),t.registerExtensionPoint("classroom.alert.banner",{id:"smart-edu-alert-banner",label:"国家平台双师通道广播",pluginId:yt,component:()=>Promise.resolve({default:Ok})}),t.registerExtensionPoint("classroom.stage.display.ticker",{id:"smart-edu-stage-ticker",label:"国家平台大屏跑马灯",pluginId:yt,component:()=>Promise.resolve({default:$k})}),t.registerExtensionPoint("classroom.post_class.exporter",{id:"smart-edu-post-class-exporter",label:"CELTS-3 学情报告导出",pluginId:yt,component:()=>Promise.resolve({default:Fk})}),t.registerExtensionPoint("header.status_pill",{id:"smart-edu-header-status-pill",label:"国家教育云状态",pluginId:yt,component:()=>Promise.resolve({default:Bk})}),t.registerExtensionPoint("admin.dashboard.card",{id:"smart-edu-admin-card",label:"国家平台直连看板",pluginId:yt,component:()=>Promise.resolve({default:Vk})})}window.React=ti;window.ReactDOM=ni;window.HostSharedDeps={React:ti,ReactDOM:ni,ReactDOMClient:Ao,Recharts:Bo,LucideReact:ri,jsxRuntime:Io,react:ti,"react-dom":ni,"react-dom/client":Ao,"react/jsx-runtime":Io,recharts:Bo,"lucide-react":ri};const Hk=new Pk;Uk();Yf.createRoot(document.getElementById("root")).render(r.jsx(f.StrictMode,{children:r.jsx(zk,{children:r.jsx(Pp,{host:Hk,children:r.jsx(lk,{})})})}));export{Zl as A,uk as B,tC as C,Ho as D,Oe as E,Yv as F,lr as G,Yj as H,dd as I,Wi as J,Nt as K,oC as L,Gv as M,Jj as N,aC as O,BS as P,os as Q,Xr as R,hg as S,lC as T,on as U,rC as V,Gp as W,vk as X,Bs as Y,Xk as a,Ft as b,Le as c,ue as d,ei as e,Ot as f,eC as g,nC as h,Ip as i,Ql as j,US as k,tt as l,zs as m,Zp as n,iC as o,Hi as p,Wc as q,ht as r,Wp as s,yg as t,rx as u,ln as v,$s as w,Yg as x,Dt as y,Ne as z};
|