openlearn-next 0.2.9 → 0.3.2
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/cli.mjs +2 -0
- package/dist/assets/AdminDirectoryView-0XV86Ues.js +1 -0
- package/dist/assets/{BatchPickerModal-9BhmNM2R.js → BatchPickerModal-VYKUF5TC.js} +1 -1
- package/dist/assets/{ClassesView-DKScQDos.js → ClassesView-dDPegGIu.js} +2 -2
- package/dist/assets/CloudDriveModal-DiEEoAK5.js +1 -0
- package/dist/assets/ComputerLabView-BId0ZarM.js +1 -0
- package/dist/assets/CourseManagement-Dys0J3Xl.js +1 -0
- package/dist/assets/CourseWizardModal-DFZzYcbL.js +3 -0
- package/dist/assets/CoursewareHubPanel-LpUgjqbH.js +1 -0
- package/dist/assets/{Dashboard-BPxkmnvI.js → Dashboard-Bnxuy2BQ.js} +2 -2
- package/dist/assets/{ExportWeightModal-DSzySeqh.js → ExportWeightModal-DPriCEO9.js} +1 -1
- package/dist/assets/HelpTour-CHPIK2ae.js +1 -0
- package/dist/assets/{HelpView-CuNDka5n.js → HelpView-CTErIWbE.js} +3 -3
- package/dist/assets/ImportLessonsModal-BleM5Z-r.js +1 -0
- package/dist/assets/ImportModal-BTfia0Ah.js +1 -0
- package/dist/assets/InteractiveCoursewareViewer-DBCbyDmo.js +1 -0
- package/dist/assets/InteractiveWhiteboard-DnnYVSpP.js +78 -0
- package/dist/assets/{LazyCourseware-g7b8EXR_.js → LazyCourseware-BtliMSwD.js} +1 -1
- package/dist/assets/{LazyWhiteboard-BIepzrv9.js → LazyWhiteboard-D_U3t5Ft.js} +2 -2
- package/dist/assets/LessonEditorView-Lejw223i.js +1 -0
- package/dist/assets/LiveClassroomView-DW7gWs1X.js +1 -0
- package/dist/assets/{NotificationDetailModal-Bk1g_prI.js → NotificationDetailModal-me41YjnW.js} +1 -1
- package/dist/assets/{PluginView-C6s7Ltcy.js → PluginView-pof_3sut.js} +3 -3
- package/dist/assets/{ProcessLogsModal-B-PY780w.js → ProcessLogsModal-01S7zsw0.js} +1 -1
- package/dist/assets/{QuizGeneratorModal-DWH1zP0X.js → QuizGeneratorModal-UEVoYkB6.js} +1 -1
- package/dist/assets/StudentAssignmentView-BTfMYbmx.js +1 -0
- package/dist/assets/StudentLessonView-Bb5HQ6Kx.js +1 -0
- package/dist/assets/StudentPreviewModal-Bx86ogm7.js +1 -0
- package/dist/assets/StudentView-5bdEpjwh.js +2 -0
- package/dist/assets/SystemResourceLibraryModal-CRsieL1o.js +1 -0
- package/dist/assets/TeacherView-DCTHvypF.js +2 -0
- package/dist/assets/{TimetableView-BMsjwi-s.js → TimetableView-DJgOlGSf.js} +3 -3
- package/dist/assets/index-B-YxO39A.css +1 -0
- package/dist/assets/index-Bve0X_Y7.js +2 -0
- package/dist/assets/index-CerSuw-h.js +193 -0
- package/dist/assets/{index.es-DZ6UeYE-.js → index.es-CfxBkm_z.js} +1 -1
- package/dist/assets/{vendor-charts-B7ViBL9w.js → vendor-charts-CRXa4AlU.js} +1 -1
- package/dist/assets/vendor-content-CYR4BTuT.js +3 -0
- package/dist/assets/{vendor-icons-_c3xpwjZ.js → vendor-icons-Dq6MhgH9.js} +1 -1
- package/dist/assets/{vendor-pdf-CVyNPGVr.js → vendor-pdf-Cp-cYteE.js} +2 -2
- package/dist/assets/vendor-utils-BEhuP0Zq.js +1 -0
- package/dist/index.html +2 -2
- package/dist/server.cjs +994 -705
- package/package.json +10 -7
- package/dist/assets/AdminDirectoryView-CD7tW4mc.js +0 -1
- package/dist/assets/CloudDriveModal-cPtTMriS.js +0 -1
- package/dist/assets/ComputerLabView-B6-twB0u.js +0 -1
- package/dist/assets/CourseManagement-AoauIULq.js +0 -1
- package/dist/assets/CourseWizardModal-BOgLpLz7.js +0 -3
- package/dist/assets/CoursewareHubPanel-Cb1mAqHS.js +0 -1
- package/dist/assets/HelpTour-DwM9UBiA.js +0 -1
- package/dist/assets/ImportLessonsModal-Bwy2r-96.js +0 -1
- package/dist/assets/ImportModal-CmUt1YeX.js +0 -1
- package/dist/assets/InteractiveCoursewareViewer-DWnzq20c.js +0 -1
- package/dist/assets/InteractiveWhiteboard-C7JMplbp.js +0 -62
- package/dist/assets/LessonEditorView-C-mvYRUd.js +0 -1
- package/dist/assets/LiveClassroomView-CqRbWNis.js +0 -1
- package/dist/assets/StudentAssignmentView-CfTjeoAp.js +0 -1
- package/dist/assets/StudentLessonView-D2XvNGnW.js +0 -1
- package/dist/assets/StudentPreviewModal-BwXG6Cis.js +0 -1
- package/dist/assets/StudentView-DT-373QP.js +0 -2
- package/dist/assets/SystemResourceLibraryModal-BTL8rB0g.js +0 -1
- package/dist/assets/TeacherView-XdD-y67J.js +0 -2
- package/dist/assets/index-C5FKWIUq.js +0 -190
- package/dist/assets/index-CATki2cp.css +0 -1
- package/dist/assets/index-wdWIWwbg.js +0 -1
- package/dist/assets/vendor-content-V6uLfjnH.js +0 -3
- package/dist/assets/vendor-utils-4FcTwKPj.js +0 -1
|
@@ -1,190 +0,0 @@
|
|
|
1
|
-
import{R as it,r as p,j as h,g as Ca,b as lh,d as ka,h as Ea,i as ch}from"./vendor-react-0Lg0vA-4.js";import{G as Yi,S as uh,U as Pa,C as Zi,a as pn,L as Ki,A as Xi,b as Ta,c as dh,H as hh,d as fh,B as ph,e as Ia,f as Aa,g as Zr,h as Ar,D as mh,X as gn,K as gh,P as yh,T as qn,i as xh,j as Kr,k as wh,l as Xr,m as bh,n as Sh,o as vh,p as Na,q as Ch,F as za,M as kh,r as Eh,V as Ph,s as Th,t as Ih,W as rr,u as Ah,v as Nh,w as zh,x as Lh,I as _h}from"./vendor-icons-_c3xpwjZ.js";import{d as qt,e as jh,f as Rh}from"./vendor-utils-4FcTwKPj.js";import{_ as Ne,E as Mh}from"./vendor-pdf-CVyNPGVr.js";import{i as ir,g as Oh,s as La,a as ei,b as _a,c as eo,d as Dh,e as Fh,f as Bh,h as $h,r as Vh,j as Uh,k as ja,l as qh,m as Wh,n as Hh,o as Gh,S as Qh,H as Jh,F as vt,p as Yh,q as Zh,t as Ra,u as Xn,v as to,w as Xe,x as Ma,y as Kh,z as no,A as Xh,B as es,C as Nr,D as so,E as ef,G as tf,I as wt,J as nf,K as sf,L as rf,M as ro,N as of,O as af,P as io,Q as lf,R as cf,T as Wn,U as uf,V as df,W as Oa,X as hf,Y as ff}from"./vendor-motion-DjY2czvL.js";import{v as pf}from"./vendor-pptx-B_NheIKl.js";import{R as mf}from"./vendor-charts-B7ViBL9w.js";const gf=e=>{const t=e.split(/\r?\n/);if(t.length<2)return[];const n=t[0],s=[",",";"," "];let r=",",i=0;s.forEach(f=>{const g=n.split(f).length;g>i&&(i=g,r=f)});const o=f=>{const g=[];let x=!1,C="";for(let b=0;b<f.length;b++){const I=f[b];I==='"'?x=!x:I===r&&!x?(g.push(C.trim()),C=""):C+=I}return g.push(C.trim()),g},a=o(n).map(f=>f.toLowerCase().replace(/["'\r]/g,"").trim()),l=a.findIndex(f=>f.includes("name")||f.includes("student")||f.includes("姓名")||f.includes("学生")),c=a.findIndex(f=>f.includes("email")||f.includes("mail")||f.includes("邮箱")),u=l>=0?l:0,d=c>=0?c:1,m=[];for(let f=1;f<t.length;f++){if(!t[f].trim())continue;const g=o(t[f]),x=g[u]?g[u].replace(/["'\r]/g,"").trim():"",C=g[d]?g[d].replace(/["'\r]/g,"").trim():"";x&&m.push({name:x,email:C})}return m},oo={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"}},yf=it.memo(function({onLoginSuccess:t,lang:n}){const[s,r]=p.useState("teacher"),[i,o]=p.useState(null),[a,l]=p.useState(""),[c,u]=p.useState(""),[d,m]=p.useState(""),[f,g]=p.useState(!1),[x,C]=p.useState([]),[b,I]=p.useState(""),[S,E]=p.useState(""),[z,k]=p.useState(""),[L,R]=p.useState(""),[O,P]=p.useState(!1);p.useEffect(()=>{(async()=>{try{const F=await fetch("/api/students");if(F.ok){const A=await F.json();C(A),A.length>0&&I(A[0].id)}}catch(F){console.warn("Failed to fetch student roster for login selection:",F)}})()},[]),p.useEffect(()=>{(async()=>{try{const F=await fetch("/api/site-settings");if(F.ok){const A=await F.json();o(A)}}catch(F){console.warn("Failed to fetch site settings for login branding:",F)}})()},[]);const N=async D=>{if(D.preventDefault(),!a.trim()||!c){m(n==="zh"?"请输入完整的用户名和密码。":"Please fill in both key fields.");return}try{m(""),g(!0);const F=await fetch("/api/auth/login",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({entrance:"teacher",username:a.trim(),password:c})});if(F.ok){const A=await F.json();t(A.session)}else{const A=await F.json();m(A.error||(n==="zh"?"用户名或密码不正确":"Invalid username or password"))}}catch{m(n==="zh"?"网络连接异常,请重试":"Network communication failure. Please try again.")}finally{g(!1)}},_=async D=>{D.preventDefault();const F=b||S.trim();if(!F){R(n==="zh"?"请选择或输入学号/学生标识。":"Please select or enter your Student ID.");return}if(!z.trim()){R(n==="zh"?"请输入个人密码或临时班级密码。":"Please enter your personal password or temporary class passcode.");return}try{R(""),P(!0);const A=await fetch("/api/auth/login",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({entrance:"student",studentId:F,password:z.trim()})});if(A.ok){const T=await A.json();t(T.session)}else{const T=await A.json();R(T.error||(n==="zh"?"找不到该学生记录":"Student record not found"))}}catch{R(n==="zh"?"网络连接异常,请重试":"Network connection failure. Please try again.")}finally{P(!1)}};return h.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:[h.jsx("div",{className:"absolute top-[-10%] left-[-10%] w-[40rem] h-[40rem] rounded-full bg-indigo-500/10 blur-3xl -z-10"}),h.jsx("div",{className:"absolute bottom-[-10%] right-[-10%] w-[35rem] h-[35rem] rounded-full bg-violet-500/10 blur-3xl -z-10"}),h.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:[h.jsxs("div",{className:"text-center mb-8",children:[i?.logoUrl?h.jsx("img",{src:i.logoUrl,alt:i.siteName||"logo",className:"inline-block h-16 w-16 object-contain mb-4 rounded-xl"}):h.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:h.jsx(Yi,{size:32})}),h.jsxs("h1",{className:"text-2xl sm:text-3xl font-black text-white tracking-tight flex items-center justify-center gap-2",children:[i?.siteName||"OpenLearn Next"," ",h.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"})]}),h.jsx("p",{className:"text-slate-400 text-xs sm:text-sm mt-2",children:i?.slogan||(n==="zh"?"下一代智能数字化学习系统":"Next-Generation Intelligent Digital Learning Platform")})]}),h.jsxs("div",{className:"flex bg-slate-900 p-1 rounded-xl border border-slate-800 gap-1 mb-6",children:[h.jsxs("button",{onClick:()=>r("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:[h.jsx(uh,{size:14}),n==="zh"?"教师与管理端":"Teacher / Staff Portal"]}),h.jsxs("button",{onClick:()=>r("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:[h.jsx(Pa,{size:14}),n==="zh"?"学生自助端":"Student Self-Service"]})]}),s==="teacher"?h.jsxs("form",{onSubmit:N,className:"space-y-4",children:[d&&h.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:[h.jsx(Zi,{size:15,className:"shrink-0"}),h.jsx("span",{children:d})]}),h.jsxs("div",{className:"space-y-1.5",children:[h.jsxs("label",{className:"text-xs font-medium text-slate-400 flex items-center gap-1.5",children:[h.jsx(pn,{size:13}),n==="zh"?"教工账户名 / username":"Staff Username"]}),h.jsx("input",{type:"text",value:a,onChange:D=>l(D.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})]}),h.jsxs("div",{className:"space-y-1.5",children:[h.jsxs("label",{className:"text-xs font-medium text-slate-400 flex items-center gap-1.5",children:[h.jsx(Ki,{size:13}),n==="zh"?"输入登录密码 / password":"Access Password"]}),h.jsx("input",{type:"password",value:c,onChange:D=>u(D.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})]}),h.jsxs("button",{type:"submit",disabled:f,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:[h.jsx("span",{children:f?n==="zh"?"鉴权登录中...":"Authorizing...":n==="zh"?"安全验证登录":"Authorized Sign In"}),h.jsx(Xi,{size:15})]})]}):h.jsxs("form",{onSubmit:_,className:"space-y-4",children:[L&&h.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:[h.jsx(Zi,{size:15,className:"shrink-0"}),h.jsx("span",{children:L})]}),x.length>0?h.jsxs("div",{className:"space-y-1.5",children:[h.jsxs("label",{className:"text-xs font-medium text-slate-400 flex items-center gap-1.5",children:[h.jsx(Yi,{size:14}),n==="zh"?"从学生花名册中快速选择":"Quick Access Student Select"]}),h.jsx("select",{value:b,onChange:D=>{I(D.target.value),E("")},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(D=>h.jsxs("option",{value:D.id,children:[D.name," (",D.student_number||D.id,")"]},D.id))}),h.jsx("p",{className:"text-[10px] text-slate-500 font-medium",children:n==="zh"?"✨ 在沙盒调试中,你可以直接下拉选择已有的学生账户一键登录为该生。":"✨ Sandbox help: Quick select existing students on file to simulate as student."})]}):null,h.jsxs("div",{className:"relative flex py-2 items-center",children:[h.jsx("div",{className:"flex-grow border-t border-slate-850"}),h.jsx("span",{className:"flex-shrink mx-3 text-[10px] font-bold text-slate-500 uppercase tracking-wider",children:n==="zh"?"或手动输入学号":"Or input key manually"}),h.jsx("div",{className:"flex-grow border-t border-slate-850"})]}),h.jsxs("div",{className:"space-y-1.5",children:[h.jsxs("label",{className:"text-xs font-medium text-slate-400 flex items-center gap-1.5",children:[h.jsx(pn,{size:13}),n==="zh"?"学号 / Student ID":"Student Access Key"]}),h.jsx("input",{type:"text",value:S,onChange:D=>{E(D.target.value),I("")},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"})]}),h.jsxs("div",{className:"space-y-1.5",children:[h.jsxs("label",{className:"text-xs font-medium text-slate-400 flex items-center gap-1.5",children:[h.jsx(Ki,{size:13}),n==="zh"?"个人密码 / 临时班级密码":"Personal Password / Class Passcode"]}),h.jsx("input",{type:"password",required:!0,value:z,onChange:D=>k(D.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"})]}),h.jsxs("button",{type:"submit",disabled:O,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:[h.jsx("span",{children:O?n==="zh"?"正在连接学生终端...":"Entering Desk...":n==="zh"?"登录学生智慧桌面":"Login Interactive Desk"}),h.jsx(Xi,{size:15})]})]})]})]})});function xf({session:e,lang:t,onLogout:n,onProfile:s}){const[r,i]=p.useState(!1),o=p.useRef(null);p.useEffect(()=>{if(!r)return;const l=c=>{o.current&&!o.current.contains(c.target)&&i(!1)};return document.addEventListener("mousedown",l),()=>document.removeEventListener("mousedown",l)},[r]);const a=(l,c)=>t==="zh"?l:c;return h.jsxs("div",{className:"relative",ref:o,children:[h.jsxs("button",{type:"button",onClick:()=>i(l=>!l),"aria-haspopup":"menu","aria-expanded":r,title:e.name,className:"flex items-center gap-1 rounded-full p-1 hover:bg-gray-100 transition-colors cursor-pointer",children:[h.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:e.avatar?h.jsx("img",{src:e.avatar,alt:e.name,className:"w-full h-full object-cover"}):h.jsx(pn,{size:20})}),h.jsx(Ta,{size:14,className:`text-gray-400 transition-transform duration-200 ${r?"rotate-180":""}`})]}),r&&h.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:[h.jsxs("div",{className:"px-4 py-2 border-b border-gray-100",children:[h.jsx("p",{className:"text-sm font-semibold text-gray-800 truncate",title:e.name,children:e.name}),h.jsx("p",{className:"text-xs text-gray-400 truncate",children:e.username})]}),h.jsxs("button",{type:"button",role:"menuitem",onClick:()=>{i(!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:[h.jsx(pn,{size:16,className:"text-gray-400"}),a("个人资料","Profile")]}),h.jsxs("button",{type:"button",role:"menuitem",onClick:()=>{i(!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:[h.jsx(dh,{size:16}),a("注销登录","Sign Out")]})]})]})}function wf(e){const{activeRole:t,lang:n,teacherTab:s,studentViewStatus:r,session:i,activeStudentId:o,students:a,studentDashboardData:l,isNotificationsOpen:c,studentNotifications:u,unreadNotifications:d,readNotifications:m,dbConnected:f,dbStatus:g,siteInfo:x,setActiveStudentId:C,setReadNotifications:b,setIsSystemResourceLibraryOpen:I,setProfileOpen:S,setTeacherTab:E,setStudentViewStatus:z,setIsNotificationsOpen:k,setSelectedNotificationForModal:L,handleLogout:R,toggleLanguage:O}=e;return h.jsxs("header",{className:"h-16 border-b border-gray-200 bg-white flex items-center px-6 justify-between shrink-0 shadow-sm relative z-20",children:[h.jsxs("div",{className:"flex items-center gap-4 sm:gap-6",children:[h.jsxs("button",{onClick:()=>{t==="teacher"?E("dashboard"):t==="student"&&z("dashboard")},className:"flex items-center gap-2.5 shrink-0 hover:opacity-80 transition-opacity cursor-pointer",title:n==="zh"?"返回系统总览":"Back to Dashboard",children:[x.logoUrl?h.jsx("img",{src:x.logoUrl,alt:"site logo",className:"h-8 w-8 object-contain rounded-lg shrink-0"}):h.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"}),h.jsxs("div",{className:"flex items-baseline gap-2",children:[h.jsx("span",{className:"text-base font-black text-slate-900 tracking-tight",children:x.siteName||"OpenLearn Next"}),h.jsxs("span",{className:"text-[10px] font-medium text-slate-400 tracking-tight",children:["v","0.2.9"]}),x.slogan&&h.jsx("span",{className:"hidden md:inline text-xs text-slate-400 font-normal truncate max-w-[200px]",children:x.slogan})]})]}),h.jsxs("button",{onClick:()=>{t==="teacher"?E("dashboard"):t==="student"&&z("dashboard")},className:`flex items-center gap-1.5 px-3 py-1.5 rounded-md text-sm font-medium transition-colors cursor-pointer ${t==="teacher"&&s==="dashboard"||t==="student"&&r==="dashboard"?"bg-indigo-50 text-indigo-700":"text-slate-600 hover:text-indigo-600 hover:bg-slate-100"}`,children:[h.jsx(hh,{size:16}),n==="zh"?"系统总览":"Dashboard"]}),t==="student"&&h.jsxs(h.Fragment,{children:[h.jsx("span",{className:"text-slate-300 font-light text-lg select-none",children:"/"}),h.jsxs("h2",{className:"font-semibold text-gray-800 tracking-tight flex items-center gap-2",children:[h.jsx(fh,{size:20,className:"text-gray-400"}),"Student Dashboard"]})]}),t==="student"&&i.role==="teacher"&&h.jsxs("div",{className:"flex items-center gap-2",children:[h.jsx("span",{className:"text-sm text-gray-500",children:"View as:"}),h.jsxs("select",{className:"border border-gray-200 rounded p-1 text-sm bg-white",value:o||"",onChange:P=>C(P.target.value),children:[h.jsx("option",{value:"",children:"-- Select Student --"}),a.map(P=>h.jsx("option",{value:P.id,children:P.name},P.id))]})]})]}),h.jsxs("div",{className:"flex items-center gap-4 text-sm text-gray-500",children:[t==="student"&&o&&l&&h.jsxs("div",{className:"relative",children:[h.jsxs("button",{onClick:()=>k(!c),className:"relative p-2 text-gray-500 hover:text-gray-700 hover:bg-gray-100 rounded-full transition-colors",children:[h.jsx(ph,{size:20}),d.length>0&&h.jsx("span",{className:"absolute top-1 right-1 bg-red-500 text-white text-[10px] font-bold px-1.5 py-0.5 rounded-full flex items-center justify-center min-w-[18px]",children:d.length})]}),c&&h.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:[h.jsxs("div",{className:"p-3 border-b border-gray-100 flex justify-between items-center bg-gray-50",children:[h.jsx("h3",{className:"font-semibold text-gray-800",children:"Notifications"}),d.length>0&&h.jsx("button",{onClick:async()=>{if(!o)return;try{const N=u.filter(_=>!m.has(_.id)).map(_=>fetch(`/api/students/${o}/read_notifications`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({notificationId:_.id})}));await Promise.all(N)}catch(N){console.error(N)}const P=new Set(m);u.forEach(N=>P.add(N.id)),b(P)},className:"text-xs text-indigo-600 hover:text-indigo-800 font-medium",children:"Mark all as read"})]}),h.jsx("div",{className:"max-h-96 overflow-y-auto",children:u.length===0?h.jsx("div",{className:"p-4 text-center text-sm text-gray-500 italic",children:"No notifications."}):h.jsx("div",{className:"divide-y divide-gray-100",children:u.map(P=>{const N=!m.has(P.id);return h.jsx("div",{className:`p-3 hover:bg-gray-50 cursor-pointer ${N?"bg-indigo-50/30":""}`,onClick:()=>{if(N){o&&fetch(`/api/students/${o}/read_notifications`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({notificationId:P.id})}).catch(console.error);const D=new Set(m);D.add(P.id),b(D)}const _=l?.assignments?.find(D=>D.id===P.relatedId);L({...P,assignment:_}),k(!1)},children:h.jsxs("div",{className:"flex gap-3",children:[h.jsx("div",{className:"mt-0.5",children:P.type==="new_assignment"?h.jsx(Ia,{size:16,className:"text-indigo-500"}):P.type==="rollcall_picked"?h.jsx(Aa,{size:16,className:"text-amber-500 animate-pulse"}):h.jsx(Zr,{size:16,className:"text-green-500"})}),h.jsxs("div",{className:"flex-1",children:[h.jsx("div",{className:`text-sm ${N?"font-semibold text-gray-900":"font-medium text-gray-700"}`,children:P.title}),h.jsx("div",{className:`text-xs mt-0.5 ${N?"text-gray-600":"text-gray-500"}`,children:P.message})]}),N&&h.jsx("div",{className:"w-2 h-2 rounded-full bg-indigo-500 mt-1"})]})},P.id)})})})]})]}),h.jsxs("button",{onClick:()=>I(!0),className:"flex items-center gap-1.5 hover:text-indigo-600 transition-colors bg-white px-3 py-1.5 rounded-md border border-gray-200 shadow-sm font-medium cursor-pointer",children:[h.jsx(Ar,{size:14,className:"text-emerald-500 animate-pulse"}),n==="zh"?"系统资源库":"System Resource Library"]}),h.jsx("button",{onClick:O,title:n==="zh"?"Switch to English":"切换为中文",className:"p-2 hover:bg-slate-100 text-slate-600 hover:text-indigo-600 transition-colors bg-white rounded-lg border border-gray-200 shadow-3xs flex items-center justify-center shrink-0 cursor-pointer",children:h.jsx(Ar,{size:16})}),(()=>{const P=g==="error"||!f?{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:n==="zh"?"SQLite 数据库连接出错或已断开":"SQLite DB Error / Disconnected"}:g==="warning"?{bg:"bg-amber-50 border-amber-200 text-amber-600 hover:bg-amber-100",dot:"bg-amber-500",ping:"bg-amber-400",label:n==="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:n==="zh"?"SQLite 数据库连接正常":"SQLite DB Connected & Normal"};return h.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 ${P.bg}`,title:P.label,children:[h.jsx(mh,{size:15}),h.jsxs("span",{className:"absolute -top-0.5 -right-0.5 flex h-2.5 w-2.5",children:[h.jsx("span",{className:`animate-ping absolute inline-flex h-full w-full rounded-full opacity-75 ${P.ping}`}),h.jsx("span",{className:`relative inline-flex rounded-full h-2.5 w-2.5 ${P.dot}`})]})]})})(),h.jsx(xf,{session:i,lang:n,onLogout:R,onProfile:()=>S(!0)})]})]})}function bf({open:e,session:t,lang:n,onClose:s,onSaved:r,onAvatar:i}){const[o,a]=p.useState(t.name),[l,c]=p.useState(!1),[u,d]=p.useState(null),m=p.useRef(null),[f,g]=p.useState(!1),[x,C]=p.useState(null),[b,I]=p.useState(!1),[S,E]=p.useState(""),[z,k]=p.useState(""),[L,R]=p.useState(""),[O,P]=p.useState(!1),[N,_]=p.useState(null),[D,F]=p.useState(!1);if(!e)return null;const A=(W,ee)=>n==="zh"?W:ee,T=t.role==="teacher"?t.subRole==="administrator"?A("管理员","Administrator"):A("教师","Teacher"):A("学生","Student"),B=o.trim(),M=B.length>0&&B!==t.name,q=async()=>{if(!(!M||l)){c(!0),d(null);try{const W=await fetch("/api/auth/profile",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:B})}),ee=await W.json();if(!W.ok){d(ee.error||(n==="zh"?"保存失败":"Save failed"));return}r(ee.name??B)}catch{d(n==="zh"?"网络错误,请重试":"Network error, please retry")}finally{c(!1)}}},y=S.length>0&&z.length>=8&&/[a-zA-Z]/.test(z)&&/[0-9]/.test(z)&&z===L,te=async()=>{if(!(!y||O)){P(!0),_(null);try{const W=await fetch("/api/auth/change-password",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({oldPassword:S,newPassword:z})}),ee=await W.json();if(!W.ok){_(ee.error||(n==="zh"?"修改失败":"Change failed"));return}F(!0),E(""),k(""),R(""),I(!1)}catch{_(n==="zh"?"网络错误,请重试":"Network error, please retry")}finally{P(!1)}}},ae=async W=>{const ee=W.target.files?.[0];if(W.target.value="",!!ee){g(!0),C(null);try{const se=await new Promise((Le,Ae)=>{const he=new FileReader;he.onload=()=>Le(he.result),he.onerror=()=>Ae(he.error),he.readAsDataURL(ee)}),fe=await fetch("/api/auth/avatar",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({filename:ee.name,base64Data:se})}),ge=await fe.json();if(!fe.ok){C(ge.error||(n==="zh"?"上传失败":"Upload failed"));return}i?.(ge.avatar)}catch{C(n==="zh"?"网络错误,请重试":"Network error, please retry")}finally{g(!1)}}},w=async()=>{g(!0),C(null);try{const W=await fetch("/api/auth/avatar",{method:"DELETE"}),ee=await W.json().catch(()=>({}));if(!W.ok){C(ee.error||(n==="zh"?"移除失败":"Remove failed"));return}i?.(null)}catch{C(n==="zh"?"网络错误,请重试":"Network error, please retry")}finally{g(!1)}};return h.jsx("div",{className:"fixed inset-0 bg-black/40 backdrop-blur-xs flex items-center justify-center z-50 p-4",onClick:s,children:h.jsxs("div",{className:"bg-white rounded-2xl shadow-xl w-full max-w-md overflow-hidden",onClick:W=>W.stopPropagation(),children:[h.jsxs("div",{className:"flex items-center justify-between px-5 py-4 border-b border-gray-100",children:[h.jsx("h3",{className:"font-semibold text-gray-800",children:A("个人资料","Profile")}),h.jsx("button",{onClick:s,className:"text-gray-400 hover:text-gray-600 cursor-pointer",children:h.jsx(gn,{size:18})})]}),h.jsxs("div",{className:"p-5 space-y-5",children:[h.jsxs("div",{className:"flex items-center gap-3",children:[h.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:t.avatar?h.jsx("img",{src:t.avatar,alt:t.name,className:"w-full h-full object-cover"}):h.jsx(pn,{size:28})}),h.jsxs("div",{className:"min-w-0",children:[h.jsx("p",{className:"text-base font-semibold text-gray-800 truncate",children:t.name}),h.jsx("p",{className:"text-xs text-gray-400",children:T}),h.jsxs("div",{className:"mt-1.5 flex items-center gap-3",children:[h.jsx("button",{type:"button",onClick:()=>m.current?.click(),disabled:f,className:"text-xs text-indigo-600 hover:text-indigo-800 disabled:opacity-50 cursor-pointer",children:f?A("上传中…","Uploading…"):t.avatar?A("更换头像","Change avatar"):A("上传头像","Upload avatar")}),t.avatar&&h.jsx("button",{type:"button",onClick:w,disabled:f,className:"text-xs text-rose-500 hover:text-rose-700 disabled:opacity-50 cursor-pointer",children:A("移除","Remove")})]}),h.jsx("input",{ref:m,type:"file",accept:"image/png,image/jpeg,image/gif,image/webp",className:"hidden",onChange:ae})]})]}),x&&h.jsx("p",{className:"text-xs text-rose-500",children:x}),h.jsxs("div",{children:[h.jsx("label",{className:"block text-sm text-gray-500 mb-1",children:A("显示名称","Display Name")}),h.jsxs("div",{className:"flex gap-2",children:[h.jsx("input",{value:o,onChange:W=>a(W.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"}),h.jsx("button",{onClick:q,disabled:!M||l,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:l?A("保存中…","Saving…"):A("保存","Save")})]}),u&&h.jsx("p",{className:"text-xs text-rose-500 mt-1",children:u})]}),h.jsxs("div",{className:"border-t border-gray-100 pt-4",children:[h.jsxs("div",{className:"flex items-center justify-between",children:[h.jsxs("span",{className:"text-sm font-medium text-gray-700 flex items-center gap-2",children:[h.jsx(gh,{size:16,className:"text-gray-400"}),A("修改密码","Change Password")]}),!b&&!D&&h.jsx("button",{onClick:()=>{I(!0),_(null)},className:"text-sm text-indigo-600 hover:text-indigo-800 cursor-pointer",children:A("修改","Edit")})]}),D&&h.jsxs("p",{className:"mt-2 flex items-center gap-1.5 text-sm text-emerald-600",children:[h.jsx(Zr,{size:16}),A("密码已修改,其他设备的登录已失效","Password changed. Other devices were logged out.")]}),b&&h.jsxs("div",{className:"mt-3 space-y-3",children:[h.jsx("input",{type:"password",value:S,onChange:W=>E(W.target.value),placeholder:A("当前密码","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"}),h.jsx("input",{type:"password",value:z,onChange:W=>k(W.target.value),placeholder:A("新密码(≥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"}),h.jsx("input",{type:"password",value:L,onChange:W=>R(W.target.value),placeholder:A("确认新密码","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"}),N&&h.jsx("p",{className:"text-xs text-rose-500",children:N}),h.jsxs("div",{className:"flex gap-2 justify-end",children:[h.jsx("button",{onClick:()=>{I(!1),E(""),k(""),R(""),_(null)},className:"px-4 py-2 rounded-lg border border-gray-300 text-sm text-gray-600 hover:bg-gray-50 cursor-pointer",children:A("取消","Cancel")}),h.jsx("button",{onClick:te,disabled:!y||O,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:O?A("提交中…","Submitting…"):A("提交","Submit")})]})]})]}),h.jsxs("div",{className:"border-t border-gray-100 pt-4 space-y-2",children:[h.jsxs("div",{className:"flex items-center justify-between",children:[h.jsx("span",{className:"text-sm text-gray-400",children:A("用户名(登录账号)","Username (login)")}),h.jsx("span",{className:"text-sm font-medium text-gray-700 truncate max-w-[60%]",title:t.username,children:t.username||"-"})]}),h.jsxs("div",{className:"flex items-center justify-between",children:[h.jsx("span",{className:"text-sm text-gray-400",children:A("角色","Role")}),h.jsx("span",{className:"text-sm font-medium text-gray-700",children:T})]})]})]})]})})}const _0={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"}},j0=[{id:"present",labelZh:"内容呈现",labelEn:"Content"},{id:"assess",labelZh:"评估互动",labelEn:"Assessment"},{id:"manage",labelZh:"课堂管理",labelEn:"Classroom"}],Sf=[{type:"presentation",labelZh:"课件演示",labelEn:"Slides Deck",descriptionZh:"Markdown 幻灯片",descriptionEn:"Markdown slides",icon:yh,color:"violet",group:"present",defaultData:{markdown:`# Title Slide
|
|
2
|
-
---
|
|
3
|
-
## Slide 2`},editFields:[{key:"markdown",labelZh:"幻灯片内容 (Markdown)",labelEn:"Slides Content (Markdown)",kind:"textarea",placeholderZh:`# 标题
|
|
4
|
-
---
|
|
5
|
-
## 第二页`}]},{type:"code-sandbox",labelZh:"代码沙箱",labelEn:"Code Editor",descriptionZh:"可运行代码",descriptionEn:"Runnable code",icon:qn,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:xh,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:Ar,color:"emerald",group:"present",defaultData:{title:"Interactive Web Courseware",code:`<!-- Interactive Web Courseware -->
|
|
6
|
-
<div style='padding:20px; text-align:center;'>
|
|
7
|
-
<h2>Interactive Web Courseware</h2>
|
|
8
|
-
<p>在属性栏中配置本地 ZIP/HTML 部署包。</p>
|
|
9
|
-
</div>`},editFields:[{key:"title",labelZh:"标题",labelEn:"Title",kind:"input",placeholderZh:"课件标题",placeholderEn:"Courseware title"},{key:"coursewareUuid",labelZh:"互动课件",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:"resourceId",labelZh:"系统资源",labelEn:"System Resource",kind:"select",loadOptions:async()=>{try{return(await(await fetch("/api/resources")).json()).map(n=>({value:n.id,label:`[${n.type}] ${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:Kr,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:Ia,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:wh,color:"cyan",group:"manage",defaultData:{allStudents:[]},editFields:[]},{type:"hello-world",labelZh:"问候插件",labelEn:"Hello World",descriptionZh:"欢迎问候",descriptionEn:"Welcome greeting",icon:Aa,color:"pink",group:"manage",defaultData:{},editFields:[]}],vf=Sf.reduce((e,t)=>(e[t.type]=t,e),{}),tt=qt(e=>({lang:"zh",activeRole:"teacher",teacherTab:"courses",profileOpen:!1,isCourseWizardOpen:!1,isImportLessonsOpen:!1,isQuizGeneratorOpen:!1,isLessonPreviewVisible:!1,isSystemResourceLibraryOpen:!1,batchPicker:null,isExportWeightModalOpen:!1,toasts:[],siteInfo:{siteName:"",slogan:"",logoUrl:null},setLang:t=>e({lang:t}),setActiveRole:t=>e({activeRole:t}),setTeacherTab:t=>e({teacherTab:t}),setProfileOpen:t=>e({profileOpen:t}),setIsCourseWizardOpen:t=>e({isCourseWizardOpen:t}),setIsImportLessonsOpen:t=>e({isImportLessonsOpen:t}),setIsQuizGeneratorOpen:t=>e({isQuizGeneratorOpen:t}),setIsLessonPreviewVisible:t=>e({isLessonPreviewVisible:t}),setIsSystemResourceLibraryOpen:t=>e({isSystemResourceLibraryOpen:t}),setBatchPicker:t=>e({batchPicker:t}),setIsExportWeightModalOpen:t=>e({isExportWeightModalOpen:t}),addToast:t=>e(n=>({toasts:[...n.toasts,t]})),removeToast:t=>e(n=>({toasts:n.toasts.filter(s=>s.id!==t)})),setSiteInfo:t=>e({siteInfo:t})})),Cf=qt(e=>({classes:[],students:[],classStudentsMap:{},classDashboardMap:{},studentProgressMap:{},classSchedulesMap:{},scheduleAttendanceMap:{},assignmentSubmissionsMap:{},classAssignmentsMap:{},classProgressMap:{},classSeats:{lab_id:null,seats:[]},setClasses:t=>e({classes:t}),setStudents:t=>e({students:t}),setClassStudents:(t,n)=>e(s=>({classStudentsMap:{...s.classStudentsMap,[t]:n}})),setClassDashboard:(t,n)=>e(s=>({classDashboardMap:{...s.classDashboardMap,[t]:n}})),setStudentProgress:(t,n)=>e(s=>({studentProgressMap:{...s.studentProgressMap,[t]:n}})),setClassSchedules:(t,n)=>e(s=>({classSchedulesMap:{...s.classSchedulesMap,[t]:n}})),setScheduleAttendance:(t,n)=>e(s=>({scheduleAttendanceMap:{...s.scheduleAttendanceMap,[t]:n}})),setAssignmentSubmissions:(t,n)=>e(s=>({assignmentSubmissionsMap:{...s.assignmentSubmissionsMap,[t]:n}})),setClassAssignments:(t,n)=>e(s=>({classAssignmentsMap:{...s.classAssignmentsMap,[t]:n}})),setClassProgress:(t,n)=>e(s=>({classProgressMap:{...s.classProgressMap,[t]:n}})),setClassSeats:t=>e({classSeats:t})})),kf=qt(e=>({lessons:[],selectedLesson:null,elements:[],vfsNodes:[],setLessons:t=>e(n=>({lessons:typeof t=="function"?t(n.lessons):t})),setSelectedLesson:t=>e({selectedLesson:t}),setElements:t=>e({elements:t}),setVfsNodes:t=>e({vfsNodes:t})})),Ef=qt(e=>({liveClassSelectedClassId:null,liveClassIsActive:!1,liveClassFeed:[],liveClassTimeRemaining:0,liveClassAcknowledgedMap:new Map,liveClassStudentProgress:[],onlineStudentIds:[],activeStudentLessons:{},setLiveClassSelectedClassId:t=>e({liveClassSelectedClassId:t}),setLiveClassIsActive:t=>e({liveClassIsActive:t}),setLiveClassFeed:t=>e({liveClassFeed:t}),appendLiveClassFeed:t=>e(n=>({liveClassFeed:[...n.liveClassFeed.slice(-49),t]})),setLiveClassTimeRemaining:t=>e({liveClassTimeRemaining:t}),setLiveClassAcknowledgedMap:t=>e({liveClassAcknowledgedMap:t}),setLiveClassStudentProgress:t=>e({liveClassStudentProgress:t}),setOnlineStudentIds:t=>e({onlineStudentIds:t}),setActiveStudentLessons:t=>e({activeStudentLessons:t})})),Pf=qt(e=>({studentDashboardData:null,notifications:[],setStudentDashboardData:t=>e({studentDashboardData:t}),setNotifications:t=>e({notifications:t})})),Pe=qt(e=>({lang:tt.getState().lang,session:null,lessons:[],selectedLesson:null,elements:[],classes:[],students:[],liveClassSelectedClassId:null,liveClassIsActive:!1,teacherTab:tt.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:tt.getState().toasts,siteInfo:tt.getState().siteInfo,setLang:t=>{tt.getState().setLang(t)},setSession:t=>e({session:t}),setLessons:t=>e(n=>({lessons:typeof t=="function"?t(n.lessons):t})),setSelectedLesson:t=>e({selectedLesson:t}),setElements:t=>e({elements:t}),setClasses:t=>e({classes:t}),setStudents:t=>e({students:t}),setLiveClassSelectedClassId:t=>e({liveClassSelectedClassId:t}),setLiveClassIsActive:t=>e({liveClassIsActive:t}),setTeacherTab:t=>{tt.getState().setTeacherTab(t)},setAiProviders:t=>e({aiProviders:t}),setPlugins:t=>e({plugins:t}),setRegisteredCommands:t=>e({registeredCommands:t}),setEvents:t=>e({events:t}),setApprovals:t=>e({approvals:t}),setProcesses:t=>e({processes:t}),setVfsNodes:t=>e({vfsNodes:t}),setTodaySchedules:t=>e({todaySchedules:t}),setComputerLabs:t=>e({computerLabs:t}),setDbConnected:t=>e({dbConnected:t}),setSessionLoading:t=>e({sessionLoading:t}),setClassStudents:(t,n)=>e(s=>({classStudentsMap:{...s.classStudentsMap,[t]:n}})),setClassDashboard:(t,n)=>e(s=>({classDashboardMap:{...s.classDashboardMap,[t]:n}})),setStudentProgress:(t,n)=>e(s=>({studentProgressMap:{...s.studentProgressMap,[t]:n}})),setClassSchedules:(t,n)=>e(s=>({classSchedulesMap:{...s.classSchedulesMap,[t]:n}})),setScheduleAttendance:(t,n)=>e(s=>({scheduleAttendanceMap:{...s.scheduleAttendanceMap,[t]:n}})),setAssignmentSubmissions:(t,n)=>e(s=>({assignmentSubmissionsMap:{...s.assignmentSubmissionsMap,[t]:n}})),setClassAssignments:(t,n)=>e(s=>({classAssignmentsMap:{...s.classAssignmentsMap,[t]:n}})),setClassProgress:(t,n)=>e(s=>({classProgressMap:{...s.classProgressMap,[t]:n}})),setClassSeats:t=>e({classSeats:t}),setOnlineStudentIds:t=>e({onlineStudentIds:t}),setActiveStudentLessons:t=>e({activeStudentLessons:t}),setLiveClassFeed:t=>e({liveClassFeed:t}),appendLiveClassFeed:t=>e(n=>({liveClassFeed:[...n.liveClassFeed.slice(-49),t]})),setLiveClassTimeRemaining:t=>e({liveClassTimeRemaining:t}),setLiveClassAcknowledgedMap:t=>e({liveClassAcknowledgedMap:t}),setLiveClassStudentProgress:t=>e({liveClassStudentProgress:t}),setStudentDashboardData:t=>e({studentDashboardData:t}),setNotifications:t=>e({notifications:t}),addToast:t=>{tt.getState().addToast(t)},removeToast:t=>{tt.getState().removeToast(t)},setSiteInfo:t=>{tt.getState().setSiteInfo(t)}}));tt.subscribe(e=>{Pe.setState({lang:e.lang,teacherTab:e.teacherTab,toasts:e.toasts,siteInfo:e.siteInfo})});Cf.subscribe(e=>{Pe.setState({classes:e.classes,students:e.students,classStudentsMap:e.classStudentsMap,classDashboardMap:e.classDashboardMap,studentProgressMap:e.studentProgressMap,classSchedulesMap:e.classSchedulesMap,scheduleAttendanceMap:e.scheduleAttendanceMap,assignmentSubmissionsMap:e.assignmentSubmissionsMap,classAssignmentsMap:e.classAssignmentsMap,classProgressMap:e.classProgressMap,classSeats:e.classSeats})});kf.subscribe(e=>{Pe.setState({lessons:e.lessons,selectedLesson:e.selectedLesson,elements:e.elements,vfsNodes:e.vfsNodes})});Ef.subscribe(e=>{Pe.setState({liveClassSelectedClassId:e.liveClassSelectedClassId,liveClassIsActive:e.liveClassIsActive,liveClassFeed:e.liveClassFeed,liveClassTimeRemaining:e.liveClassTimeRemaining,liveClassAcknowledgedMap:e.liveClassAcknowledgedMap,liveClassStudentProgress:e.liveClassStudentProgress,onlineStudentIds:e.onlineStudentIds,activeStudentLessons:e.activeStudentLessons})});Pf.subscribe(e=>{Pe.setState({studentDashboardData:e.studentDashboardData,notifications:e.notifications})});const ce=e=>jh(Pe,e);function Tf(e,t){const n={};return(e[e.length-1]===""?[...e,""]:e).join((n.padRight?" ":"")+","+(n.padLeft===!1?"":" ")).trim()}const If=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,Af=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,Nf={};function ao(e,t){return(Nf.jsx?Af:If).test(e)}const zf=/[ \t\n\f\r]/g;function Lf(e){return typeof e=="object"?e.type==="text"?lo(e.value):!1:lo(e)}function lo(e){return e.replace(zf,"")===""}class yn{constructor(t,n,s){this.normal=n,this.property=t,s&&(this.space=s)}}yn.prototype.normal={};yn.prototype.property={};yn.prototype.space=void 0;function Da(e,t){const n={},s={};for(const r of e)Object.assign(n,r.property),Object.assign(s,r.normal);return new yn(n,s,t)}function zr(e){return e.toLowerCase()}class De{constructor(t,n){this.attribute=n,this.property=t}}De.prototype.attribute="";De.prototype.booleanish=!1;De.prototype.boolean=!1;De.prototype.commaOrSpaceSeparated=!1;De.prototype.commaSeparated=!1;De.prototype.defined=!1;De.prototype.mustUseProperty=!1;De.prototype.number=!1;De.prototype.overloadedBoolean=!1;De.prototype.property="";De.prototype.spaceSeparated=!1;De.prototype.space=void 0;let _f=0;const X=zt(),xe=zt(),Lr=zt(),V=zt(),le=zt(),Nt=zt(),Ue=zt();function zt(){return 2**++_f}const _r=Object.freeze(Object.defineProperty({__proto__:null,boolean:X,booleanish:xe,commaOrSpaceSeparated:Ue,commaSeparated:Nt,number:V,overloadedBoolean:Lr,spaceSeparated:le},Symbol.toStringTag,{value:"Module"})),or=Object.keys(_r);class ti extends De{constructor(t,n,s,r){let i=-1;if(super(t,n),co(this,"space",r),typeof s=="number")for(;++i<or.length;){const o=or[i];co(this,or[i],(s&_r[o])===_r[o])}}}ti.prototype.defined=!0;function co(e,t,n){n&&(e[t]=n)}function Wt(e){const t={},n={};for(const[s,r]of Object.entries(e.properties)){const i=new ti(s,e.transform(e.attributes||{},s),r,e.space);e.mustUseProperty&&e.mustUseProperty.includes(s)&&(i.mustUseProperty=!0),t[s]=i,n[zr(s)]=s,n[zr(i.attribute)]=s}return new yn(t,n,e.space)}const Fa=Wt({properties:{ariaActiveDescendant:null,ariaAtomic:xe,ariaAutoComplete:null,ariaBusy:xe,ariaChecked:xe,ariaColCount:V,ariaColIndex:V,ariaColSpan:V,ariaControls:le,ariaCurrent:null,ariaDescribedBy:le,ariaDetails:null,ariaDisabled:xe,ariaDropEffect:le,ariaErrorMessage:null,ariaExpanded:xe,ariaFlowTo:le,ariaGrabbed:xe,ariaHasPopup:null,ariaHidden:xe,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:le,ariaLevel:V,ariaLive:null,ariaModal:xe,ariaMultiLine:xe,ariaMultiSelectable:xe,ariaOrientation:null,ariaOwns:le,ariaPlaceholder:null,ariaPosInSet:V,ariaPressed:xe,ariaReadOnly:xe,ariaRelevant:null,ariaRequired:xe,ariaRoleDescription:le,ariaRowCount:V,ariaRowIndex:V,ariaRowSpan:V,ariaSelected:xe,ariaSetSize:V,ariaSort:null,ariaValueMax:V,ariaValueMin:V,ariaValueNow:V,ariaValueText:null,role:null},transform(e,t){return t==="role"?t:"aria-"+t.slice(4).toLowerCase()}});function Ba(e,t){return t in e?e[t]:t}function $a(e,t){return Ba(e,t.toLowerCase())}const jf=Wt({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:Nt,acceptCharset:le,accessKey:le,action:null,allow:null,allowFullScreen:X,allowPaymentRequest:X,allowUserMedia:X,alpha:X,alt:null,as:null,async:X,autoCapitalize:null,autoComplete:le,autoFocus:X,autoPlay:X,blocking:le,capture:null,charSet:null,checked:X,cite:null,className:le,closedBy:null,colorSpace:null,cols:V,colSpan:V,command:null,commandFor:null,content:null,contentEditable:xe,controls:X,controlsList:le,coords:V|Nt,crossOrigin:null,data:null,dateTime:null,decoding:null,default:X,defer:X,dir:null,dirName:null,disabled:X,download:Lr,draggable:xe,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:X,formTarget:null,headers:le,height:V,hidden:Lr,high:V,href:null,hrefLang:null,htmlFor:le,httpEquiv:le,id:null,imageSizes:null,imageSrcSet:null,inert:X,inputMode:null,integrity:null,is:null,isMap:X,itemId:null,itemProp:le,itemRef:le,itemScope:X,itemType:le,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:X,low:V,manifest:null,max:null,maxLength:V,media:null,method:null,min:null,minLength:V,multiple:X,muted:X,name:null,nonce:null,noModule:X,noValidate:X,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:X,optimum:V,pattern:null,ping:le,placeholder:null,playsInline:X,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:X,referrerPolicy:null,rel:le,required:X,reversed:X,rows:V,rowSpan:V,sandbox:le,scope:null,scoped:X,seamless:X,selected:X,shadowRootClonable:X,shadowRootCustomElementRegistry:X,shadowRootDelegatesFocus:X,shadowRootMode:null,shadowRootSerializable:X,shape:null,size:V,sizes:null,slot:null,span:V,spellCheck:xe,src:null,srcDoc:null,srcLang:null,srcSet:null,start:V,step:null,style:null,tabIndex:V,target:null,title:null,translate:null,type:null,typeMustMatch:X,useMap:null,value:xe,width:V,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:le,axis:null,background:null,bgColor:null,border:V,borderColor:null,bottomMargin:V,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:X,declare:X,event:null,face:null,frame:null,frameBorder:null,hSpace:V,leftMargin:V,link:null,longDesc:null,lowSrc:null,marginHeight:V,marginWidth:V,noResize:X,noHref:X,noShade:X,noWrap:X,object:null,profile:null,prompt:null,rev:null,rightMargin:V,rules:null,scheme:null,scrolling:xe,standby:null,summary:null,text:null,topMargin:V,valueType:null,version:null,vAlign:null,vLink:null,vSpace:V,allowTransparency:null,autoCorrect:null,autoSave:null,credentialless:X,disablePictureInPicture:X,disableRemotePlayback:X,exportParts:Nt,part:le,prefix:null,property:null,results:V,security:null,unselectable:null},space:"html",transform:$a}),Rf=Wt({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:Ue,accentHeight:V,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:V,amplitude:V,arabicForm:null,ascent:V,attributeName:null,attributeType:null,azimuth:V,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:V,by:null,calcMode:null,capHeight:V,className:le,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:V,diffuseConstant:V,direction:null,display:null,dur:null,divisor:V,dominantBaseline:null,download:X,dx:null,dy:null,edgeMode:null,editable:null,elevation:V,enableBackground:null,end:null,event:null,exponent:V,externalResourcesRequired:null,fill:null,fillOpacity:V,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:Nt,g2:Nt,glyphName:Nt,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:V,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:V,horizOriginX:V,horizOriginY:V,id:null,ideographic:V,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:V,k:V,k1:V,k2:V,k3:V,k4:V,kernelMatrix:Ue,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:V,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:V,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:V,overlineThickness:V,paintOrder:null,panose1:null,path:null,pathLength:V,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:le,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:V,pointsAtY:V,pointsAtZ:V,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:Ue,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:Ue,rev:Ue,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:Ue,requiredFeatures:Ue,requiredFonts:Ue,requiredFormats:Ue,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:V,specularExponent:V,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:V,strikethroughThickness:V,string:null,stroke:null,strokeDashArray:Ue,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:V,strokeOpacity:V,strokeWidth:null,style:null,surfaceScale:V,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:Ue,tabIndex:V,tableValues:null,target:null,targetX:V,targetY:V,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:Ue,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:V,underlineThickness:V,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:V,values:null,vAlphabetic:V,vMathematical:V,vectorEffect:null,vHanging:V,vIdeographic:V,version:null,vertAdvY:V,vertOriginX:V,vertOriginY:V,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:V,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:Ba}),Va=Wt({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:"xlink",transform(e,t){return"xlink:"+t.slice(5).toLowerCase()}}),Ua=Wt({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:$a}),qa=Wt({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(e,t){return"xml:"+t.slice(3).toLowerCase()}}),Mf={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"},Of=/[A-Z]/g,uo=/-[a-z]/g,Df=/^data[-\w.:]+$/i;function Ff(e,t){const n=zr(t);let s=t,r=De;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&n.slice(0,4)==="data"&&Df.test(t)){if(t.charAt(4)==="-"){const i=t.slice(5).replace(uo,$f);s="data"+i.charAt(0).toUpperCase()+i.slice(1)}else{const i=t.slice(4);if(!uo.test(i)){let o=i.replace(Of,Bf);o.charAt(0)!=="-"&&(o="-"+o),t="data"+o}}r=ti}return new r(s,t)}function Bf(e){return"-"+e.toLowerCase()}function $f(e){return e.charAt(1).toUpperCase()}const Vf=Da([Fa,jf,Va,Ua,qa],"html"),ni=Da([Fa,Rf,Va,Ua,qa],"svg");function Uf(e){return e.join(" ").trim()}var Bt={},ar,ho;function qf(){if(ho)return ar;ho=1;var e=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,t=/\n/g,n=/^\s*/,s=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,r=/^:\s*/,i=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,o=/^[;\s]*/,a=/^\s+|\s+$/g,l=`
|
|
10
|
-
`,c="/",u="*",d="",m="comment",f="declaration";function g(C,b){if(typeof C!="string")throw new TypeError("First argument must be a string");if(!C)return[];b=b||{};var I=1,S=1;function E(F){var A=F.match(t);A&&(I+=A.length);var T=F.lastIndexOf(l);S=~T?F.length-T:S+F.length}function z(){var F={line:I,column:S};return function(A){return A.position=new k(F),O(),A}}function k(F){this.start=F,this.end={line:I,column:S},this.source=b.source}k.prototype.content=C;function L(F){var A=new Error(b.source+":"+I+":"+S+": "+F);if(A.reason=F,A.filename=b.source,A.line=I,A.column=S,A.source=C,!b.silent)throw A}function R(F){var A=F.exec(C);if(A){var T=A[0];return E(T),C=C.slice(T.length),A}}function O(){R(n)}function P(F){var A;for(F=F||[];A=N();)A!==!1&&F.push(A);return F}function N(){var F=z();if(!(c!=C.charAt(0)||u!=C.charAt(1))){for(var A=2;d!=C.charAt(A)&&(u!=C.charAt(A)||c!=C.charAt(A+1));)++A;if(A+=2,d===C.charAt(A-1))return L("End of comment missing");var T=C.slice(2,A-2);return S+=2,E(T),C=C.slice(A),S+=2,F({type:m,comment:T})}}function _(){var F=z(),A=R(s);if(A){if(N(),!R(r))return L("property missing ':'");var T=R(i),B=F({type:f,property:x(A[0].replace(e,d)),value:T?x(T[0].replace(e,d)):d});return R(o),B}}function D(){var F=[];P(F);for(var A;A=_();)A!==!1&&(F.push(A),P(F));return F}return O(),D()}function x(C){return C?C.replace(a,d):d}return ar=g,ar}var fo;function Wf(){if(fo)return Bt;fo=1;var e=Bt&&Bt.__importDefault||function(s){return s&&s.__esModule?s:{default:s}};Object.defineProperty(Bt,"__esModule",{value:!0}),Bt.default=n;const t=e(qf());function n(s,r){let i=null;if(!s||typeof s!="string")return i;const o=(0,t.default)(s),a=typeof r=="function";return o.forEach(l=>{if(l.type!=="declaration")return;const{property:c,value:u}=l;a?r(c,u,l):u&&(i=i||{},i[c]=u)}),i}return Bt}var sn={},po;function Hf(){if(po)return sn;po=1,Object.defineProperty(sn,"__esModule",{value:!0}),sn.camelCase=void 0;var e=/^--[a-zA-Z0-9_-]+$/,t=/-([a-z])/g,n=/^[^-]+$/,s=/^-(webkit|moz|ms|o|khtml)-/,r=/^-(ms)-/,i=function(c){return!c||n.test(c)||e.test(c)},o=function(c,u){return u.toUpperCase()},a=function(c,u){return"".concat(u,"-")},l=function(c,u){return u===void 0&&(u={}),i(c)?c:(c=c.toLowerCase(),u.reactCompat?c=c.replace(r,a):c=c.replace(s,a),c.replace(t,o))};return sn.camelCase=l,sn}var rn,mo;function Gf(){if(mo)return rn;mo=1;var e=rn&&rn.__importDefault||function(r){return r&&r.__esModule?r:{default:r}},t=e(Wf()),n=Hf();function s(r,i){var o={};return!r||typeof r!="string"||(0,t.default)(r,function(a,l){a&&l&&(o[(0,n.camelCase)(a,i)]=l)}),o}return s.default=s,rn=s,rn}var Qf=Gf();const Jf=Ca(Qf),Wa=Ha("end"),si=Ha("start");function Ha(e){return t;function t(n){const s=n&&n.position&&n.position[e]||{};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 Yf(e){const t=si(e),n=Wa(e);if(t&&n)return{start:t,end:n}}function un(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?go(e.position):"start"in e||"end"in e?go(e):"line"in e||"column"in e?jr(e):""}function jr(e){return yo(e&&e.line)+":"+yo(e&&e.column)}function go(e){return jr(e&&e.start)+"-"+jr(e&&e.end)}function yo(e){return e&&typeof e=="number"?e:1}class ze extends Error{constructor(t,n,s){super(),typeof n=="string"&&(s=n,n=void 0);let r="",i={},o=!1;if(n&&("line"in n&&"column"in n?i={place:n}:"start"in n&&"end"in n?i={place:n}:"type"in n?i={ancestors:[n],place:n.position}:i={...n}),typeof t=="string"?r=t:!i.cause&&t&&(o=!0,r=t.message,i.cause=t),!i.ruleId&&!i.source&&typeof s=="string"){const l=s.indexOf(":");l===-1?i.ruleId=s:(i.source=s.slice(0,l),i.ruleId=s.slice(l+1))}if(!i.place&&i.ancestors&&i.ancestors){const l=i.ancestors[i.ancestors.length-1];l&&(i.place=l.position)}const a=i.place&&"start"in i.place?i.place.start:i.place;this.ancestors=i.ancestors||void 0,this.cause=i.cause||void 0,this.column=a?a.column:void 0,this.fatal=void 0,this.file="",this.message=r,this.line=a?a.line:void 0,this.name=un(i.place)||"1:1",this.place=i.place||void 0,this.reason=this.message,this.ruleId=i.ruleId||void 0,this.source=i.source||void 0,this.stack=o&&i.cause&&typeof i.cause.stack=="string"?i.cause.stack:"",this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}}ze.prototype.file="";ze.prototype.name="";ze.prototype.reason="";ze.prototype.message="";ze.prototype.stack="";ze.prototype.column=void 0;ze.prototype.line=void 0;ze.prototype.ancestors=void 0;ze.prototype.cause=void 0;ze.prototype.fatal=void 0;ze.prototype.place=void 0;ze.prototype.ruleId=void 0;ze.prototype.source=void 0;const ri={}.hasOwnProperty,Zf=new Map,Kf=/[A-Z]/g,Xf=new Set(["table","tbody","thead","tfoot","tr"]),ep=new Set(["td","th"]),Ga="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function tp(e,t){if(!t||t.Fragment===void 0)throw new TypeError("Expected `Fragment` in options");const n=t.filePath||void 0;let s;if(t.development){if(typeof t.jsxDEV!="function")throw new TypeError("Expected `jsxDEV` in options when `development: true`");s=cp(n,t.jsxDEV)}else{if(typeof t.jsx!="function")throw new TypeError("Expected `jsx` in production options");if(typeof t.jsxs!="function")throw new TypeError("Expected `jsxs` in production options");s=lp(n,t.jsx,t.jsxs)}const r={Fragment:t.Fragment,ancestors:[],components:t.components||{},create:s,elementAttributeNameCase:t.elementAttributeNameCase||"react",evaluater:t.createEvaluater?t.createEvaluater():void 0,filePath:n,ignoreInvalidStyle:t.ignoreInvalidStyle||!1,passKeys:t.passKeys!==!1,passNode:t.passNode||!1,schema:t.space==="svg"?ni:Vf,stylePropertyNameCase:t.stylePropertyNameCase||"dom",tableCellAlignToStyle:t.tableCellAlignToStyle!==!1},i=Qa(r,e,void 0);return i&&typeof i!="string"?i:r.create(e,r.Fragment,{children:i||void 0},void 0)}function Qa(e,t,n){if(t.type==="element")return np(e,t,n);if(t.type==="mdxFlowExpression"||t.type==="mdxTextExpression")return sp(e,t);if(t.type==="mdxJsxFlowElement"||t.type==="mdxJsxTextElement")return ip(e,t,n);if(t.type==="mdxjsEsm")return rp(e,t);if(t.type==="root")return op(e,t,n);if(t.type==="text")return ap(e,t)}function np(e,t,n){const s=e.schema;let r=s;t.tagName.toLowerCase()==="svg"&&s.space==="html"&&(r=ni,e.schema=r),e.ancestors.push(t);const i=Ya(e,t.tagName,!1),o=up(e,t);let a=oi(e,t);return Xf.has(t.tagName)&&(a=a.filter(function(l){return typeof l=="string"?!Lf(l):!0})),Ja(e,o,i,t),ii(o,a),e.ancestors.pop(),e.schema=s,e.create(t,i,o,n)}function sp(e,t){if(t.data&&t.data.estree&&e.evaluater){const s=t.data.estree.body[0];return s.type,e.evaluater.evaluateExpression(s.expression)}mn(e,t.position)}function rp(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);mn(e,t.position)}function ip(e,t,n){const s=e.schema;let r=s;t.name==="svg"&&s.space==="html"&&(r=ni,e.schema=r),e.ancestors.push(t);const i=t.name===null?e.Fragment:Ya(e,t.name,!0),o=dp(e,t),a=oi(e,t);return Ja(e,o,i,t),ii(o,a),e.ancestors.pop(),e.schema=s,e.create(t,i,o,n)}function op(e,t,n){const s={};return ii(s,oi(e,t)),e.create(t,e.Fragment,s,n)}function ap(e,t){return t.value}function Ja(e,t,n,s){typeof n!="string"&&n!==e.Fragment&&e.passNode&&(t.node=s)}function ii(e,t){if(t.length>0){const n=t.length>1?t:t[0];n&&(e.children=n)}}function lp(e,t,n){return s;function s(r,i,o,a){const c=Array.isArray(o.children)?n:t;return a?c(i,o,a):c(i,o)}}function cp(e,t){return n;function n(s,r,i,o){const a=Array.isArray(i.children),l=si(s);return t(r,i,o,a,{columnNumber:l?l.column-1:void 0,fileName:e,lineNumber:l?l.line:void 0},void 0)}}function up(e,t){const n={};let s,r;for(r in t.properties)if(r!=="children"&&ri.call(t.properties,r)){const i=hp(e,r,t.properties[r]);if(i){const[o,a]=i;e.tableCellAlignToStyle&&o==="align"&&typeof a=="string"&&ep.has(t.tagName)?s=a:n[o]=a}}if(s){const i=n.style||(n.style={});i[e.stylePropertyNameCase==="css"?"text-align":"textAlign"]=s}return n}function dp(e,t){const n={};for(const s of t.attributes)if(s.type==="mdxJsxExpressionAttribute")if(s.data&&s.data.estree&&e.evaluater){const i=s.data.estree.body[0];i.type;const o=i.expression;o.type;const a=o.properties[0];a.type,Object.assign(n,e.evaluater.evaluateExpression(a.argument))}else mn(e,t.position);else{const r=s.name;let i;if(s.value&&typeof s.value=="object")if(s.value.data&&s.value.data.estree&&e.evaluater){const a=s.value.data.estree.body[0];a.type,i=e.evaluater.evaluateExpression(a.expression)}else mn(e,t.position);else i=s.value===null?!0:s.value;n[r]=i}return n}function oi(e,t){const n=[];let s=-1;const r=e.passKeys?new Map:Zf;for(;++s<t.children.length;){const i=t.children[s];let o;if(e.passKeys){const l=i.type==="element"?i.tagName:i.type==="mdxJsxFlowElement"||i.type==="mdxJsxTextElement"?i.name:void 0;if(l){const c=r.get(l)||0;o=l+"-"+c,r.set(l,c+1)}}const a=Qa(e,i,o);a!==void 0&&n.push(a)}return n}function hp(e,t,n){const s=Ff(e.schema,t);if(!(n==null||typeof n=="number"&&Number.isNaN(n))){if(Array.isArray(n)&&(n=s.commaSeparated?Tf(n):Uf(n)),s.property==="style"){let r=typeof n=="object"?n:fp(e,String(n));return e.stylePropertyNameCase==="css"&&(r=pp(r)),["style",r]}return[e.elementAttributeNameCase==="react"&&s.space?Mf[s.property]||s.property:s.attribute,n]}}function fp(e,t){try{return Jf(t,{reactCompat:!0})}catch(n){if(e.ignoreInvalidStyle)return{};const s=n,r=new ze("Cannot parse `style` attribute",{ancestors:e.ancestors,cause:s,ruleId:"style",source:"hast-util-to-jsx-runtime"});throw r.file=e.filePath||void 0,r.url=Ga+"#cannot-parse-style-attribute",r}}function Ya(e,t,n){let s;if(!n)s={type:"Literal",value:t};else if(t.includes(".")){const r=t.split(".");let i=-1,o;for(;++i<r.length;){const a=ao(r[i])?{type:"Identifier",name:r[i]}:{type:"Literal",value:r[i]};o=o?{type:"MemberExpression",object:o,property:a,computed:!!(i&&a.type==="Literal"),optional:!1}:a}s=o}else s=ao(t)&&!/^[a-z]/.test(t)?{type:"Identifier",name:t}:{type:"Literal",value:t};if(s.type==="Literal"){const r=s.value;return ri.call(e.components,r)?e.components[r]:r}if(e.evaluater)return e.evaluater.evaluateExpression(s);mn(e)}function mn(e,t){const n=new ze("Cannot handle MDX estrees without `createEvaluater`",{ancestors:e.ancestors,place:t,ruleId:"mdx-estree",source:"hast-util-to-jsx-runtime"});throw n.file=e.filePath||void 0,n.url=Ga+"#cannot-handle-mdx-estrees-without-createevaluater",n}function pp(e){const t={};let n;for(n in e)ri.call(e,n)&&(t[mp(n)]=e[n]);return t}function mp(e){let t=e.replace(Kf,gp);return t.slice(0,3)==="ms-"&&(t="-"+t),t}function gp(e){return"-"+e.toLowerCase()}const lr={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"]},yp={};function xp(e,t){const n=yp,s=typeof n.includeImageAlt=="boolean"?n.includeImageAlt:!0,r=typeof n.includeHtml=="boolean"?n.includeHtml:!0;return Za(e,s,r)}function Za(e,t,n){if(wp(e)){if("value"in e)return e.type==="html"&&!n?"":e.value;if(t&&"alt"in e&&e.alt)return e.alt;if("children"in e)return xo(e.children,t,n)}return Array.isArray(e)?xo(e,t,n):""}function xo(e,t,n){const s=[];let r=-1;for(;++r<e.length;)s[r]=Za(e[r],t,n);return s.join("")}function wp(e){return!!(e&&typeof e=="object")}const wo=document.createElement("i");function ai(e){const t="&"+e+";";wo.innerHTML=t;const n=wo.textContent;return n.charCodeAt(n.length-1)===59&&e!=="semi"||n===t?!1:n}function ot(e,t,n,s){const r=e.length;let i=0,o;if(t<0?t=-t>r?0:r+t:t=t>r?r:t,n=n>0?n:0,s.length<1e4)o=Array.from(s),o.unshift(t,n),e.splice(...o);else for(n&&e.splice(t,n);i<s.length;)o=s.slice(i,i+1e4),o.unshift(t,0),e.splice(...o),i+=1e4,t+=1e4}function Qe(e,t){return e.length>0?(ot(e,e.length,0,t),e):t}const bo={}.hasOwnProperty;function bp(e){const t={};let n=-1;for(;++n<e.length;)Sp(t,e[n]);return t}function Sp(e,t){let n;for(n in t){const r=(bo.call(e,n)?e[n]:void 0)||(e[n]={}),i=t[n];let o;if(i)for(o in i){bo.call(r,o)||(r[o]=[]);const a=i[o];vp(r[o],Array.isArray(a)?a:a?[a]:[])}}}function vp(e,t){let n=-1;const s=[];for(;++n<t.length;)(t[n].add==="after"?e:s).push(t[n]);ot(e,0,0,s)}function Ka(e,t){const n=Number.parseInt(e,t);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 Ut(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const st=Ct(/[A-Za-z]/),qe=Ct(/[\dA-Za-z]/),Cp=Ct(/[#-'*+\--9=?A-Z^-~]/);function Rr(e){return e!==null&&(e<32||e===127)}const Mr=Ct(/\d/),kp=Ct(/[\dA-Fa-f]/),Ep=Ct(/[!-/:-@[-`{-~]/);function Z(e){return e!==null&&e<-2}function Oe(e){return e!==null&&(e<0||e===32)}function oe(e){return e===-2||e===-1||e===32}const Pp=Ct(/\p{P}|\p{S}/u),Tp=Ct(/\s/);function Ct(e){return t;function t(n){return n!==null&&n>-1&&e.test(String.fromCharCode(n))}}function Ht(e){const t=[];let n=-1,s=0,r=0;for(;++n<e.length;){const i=e.charCodeAt(n);let o="";if(i===37&&qe(e.charCodeAt(n+1))&&qe(e.charCodeAt(n+2)))r=2;else if(i<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(i))||(o=String.fromCharCode(i));else if(i>55295&&i<57344){const a=e.charCodeAt(n+1);i<56320&&a>56319&&a<57344?(o=String.fromCharCode(i,a),r=1):o="�"}else o=String.fromCharCode(i);o&&(t.push(e.slice(s,n),encodeURIComponent(o)),s=n+r+1,o=""),r&&(n+=r,r=0)}return t.join("")+e.slice(s)}function ue(e,t,n,s){const r=s?s-1:Number.POSITIVE_INFINITY;let i=0;return o;function o(l){return oe(l)?(e.enter(n),a(l)):t(l)}function a(l){return oe(l)&&i++<r?(e.consume(l),a):(e.exit(n),t(l))}}const Ip={tokenize:Ap};function Ap(e){const t=e.attempt(this.parser.constructs.contentInitial,s,r);let n;return t;function s(a){if(a===null){e.consume(a);return}return e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),ue(e,t,"linePrefix")}function r(a){return e.enter("paragraph"),i(a)}function i(a){const l=e.enter("chunkText",{contentType:"text",previous:n});return n&&(n.next=l),n=l,o(a)}function o(a){if(a===null){e.exit("chunkText"),e.exit("paragraph"),e.consume(a);return}return Z(a)?(e.consume(a),e.exit("chunkText"),i):(e.consume(a),o)}}const Np={tokenize:zp},So={tokenize:Lp};function zp(e){const t=this,n=[];let s=0,r,i,o;return a;function a(S){if(s<n.length){const E=n[s];return t.containerState=E[1],e.attempt(E[0].continuation,l,c)(S)}return c(S)}function l(S){if(s++,t.containerState._closeFlow){t.containerState._closeFlow=void 0,r&&I();const E=t.events.length;let z=E,k;for(;z--;)if(t.events[z][0]==="exit"&&t.events[z][1].type==="chunkFlow"){k=t.events[z][1].end;break}b(s);let L=E;for(;L<t.events.length;)t.events[L][1].end={...k},L++;return ot(t.events,z+1,0,t.events.slice(E)),t.events.length=L,c(S)}return a(S)}function c(S){if(s===n.length){if(!r)return m(S);if(r.currentConstruct&&r.currentConstruct.concrete)return g(S);t.interrupt=!!(r.currentConstruct&&!r._gfmTableDynamicInterruptHack)}return t.containerState={},e.check(So,u,d)(S)}function u(S){return r&&I(),b(s),m(S)}function d(S){return t.parser.lazy[t.now().line]=s!==n.length,o=t.now().offset,g(S)}function m(S){return t.containerState={},e.attempt(So,f,g)(S)}function f(S){return s++,n.push([t.currentConstruct,t.containerState]),m(S)}function g(S){if(S===null){r&&I(),b(0),e.consume(S);return}return r=r||t.parser.flow(t.now()),e.enter("chunkFlow",{_tokenizer:r,contentType:"flow",previous:i}),x(S)}function x(S){if(S===null){C(e.exit("chunkFlow"),!0),b(0),e.consume(S);return}return Z(S)?(e.consume(S),C(e.exit("chunkFlow")),s=0,t.interrupt=void 0,a):(e.consume(S),x)}function C(S,E){const z=t.sliceStream(S);if(E&&z.push(null),S.previous=i,i&&(i.next=S),i=S,r.defineSkip(S.start),r.write(z),t.parser.lazy[S.start.line]){let k=r.events.length;for(;k--;)if(r.events[k][1].start.offset<o&&(!r.events[k][1].end||r.events[k][1].end.offset>o))return;const L=t.events.length;let R=L,O,P;for(;R--;)if(t.events[R][0]==="exit"&&t.events[R][1].type==="chunkFlow"){if(O){P=t.events[R][1].end;break}O=!0}for(b(s),k=L;k<t.events.length;)t.events[k][1].end={...P},k++;ot(t.events,R+1,0,t.events.slice(L)),t.events.length=k}}function b(S){let E=n.length;for(;E-- >S;){const z=n[E];t.containerState=z[1],z[0].exit.call(t,e)}n.length=S}function I(){r.write([null]),i=void 0,r=void 0,t.containerState._closeFlow=void 0}}function Lp(e,t,n){return ue(e,e.attempt(this.parser.constructs.document,t,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function vo(e){if(e===null||Oe(e)||Tp(e))return 1;if(Pp(e))return 2}function li(e,t,n){const s=[];let r=-1;for(;++r<e.length;){const i=e[r].resolveAll;i&&!s.includes(i)&&(t=i(t,n),s.push(i))}return t}const Or={name:"attention",resolveAll:_p,tokenize:jp};function _p(e,t){let n=-1,s,r,i,o,a,l,c,u;for(;++n<e.length;)if(e[n][0]==="enter"&&e[n][1].type==="attentionSequence"&&e[n][1]._close){for(s=n;s--;)if(e[s][0]==="exit"&&e[s][1].type==="attentionSequence"&&e[s][1]._open&&t.sliceSerialize(e[s][1]).charCodeAt(0)===t.sliceSerialize(e[n][1]).charCodeAt(0)){if((e[s][1]._close||e[n][1]._open)&&(e[n][1].end.offset-e[n][1].start.offset)%3&&!((e[s][1].end.offset-e[s][1].start.offset+e[n][1].end.offset-e[n][1].start.offset)%3))continue;l=e[s][1].end.offset-e[s][1].start.offset>1&&e[n][1].end.offset-e[n][1].start.offset>1?2:1;const d={...e[s][1].end},m={...e[n][1].start};Co(d,-l),Co(m,l),o={type:l>1?"strongSequence":"emphasisSequence",start:d,end:{...e[s][1].end}},a={type:l>1?"strongSequence":"emphasisSequence",start:{...e[n][1].start},end:m},i={type:l>1?"strongText":"emphasisText",start:{...e[s][1].end},end:{...e[n][1].start}},r={type:l>1?"strong":"emphasis",start:{...o.start},end:{...a.end}},e[s][1].end={...o.start},e[n][1].start={...a.end},c=[],e[s][1].end.offset-e[s][1].start.offset&&(c=Qe(c,[["enter",e[s][1],t],["exit",e[s][1],t]])),c=Qe(c,[["enter",r,t],["enter",o,t],["exit",o,t],["enter",i,t]]),c=Qe(c,li(t.parser.constructs.insideSpan.null,e.slice(s+1,n),t)),c=Qe(c,[["exit",i,t],["enter",a,t],["exit",a,t],["exit",r,t]]),e[n][1].end.offset-e[n][1].start.offset?(u=2,c=Qe(c,[["enter",e[n][1],t],["exit",e[n][1],t]])):u=0,ot(e,s-1,n-s+3,c),n=s+c.length-u-2;break}}for(n=-1;++n<e.length;)e[n][1].type==="attentionSequence"&&(e[n][1].type="data");return e}function jp(e,t){const n=this.parser.constructs.attentionMarkers.null,s=this.previous,r=vo(s);let i;return o;function o(l){return i=l,e.enter("attentionSequence"),a(l)}function a(l){if(l===i)return e.consume(l),a;const c=e.exit("attentionSequence"),u=vo(l),d=!u||u===2&&r||n.includes(l),m=!r||r===2&&u||n.includes(s);return c._open=!!(i===42?d:d&&(r||!m)),c._close=!!(i===42?m:m&&(u||!d)),t(l)}}function Co(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}const Rp={name:"autolink",tokenize:Mp};function Mp(e,t,n){let s=0;return r;function r(f){return e.enter("autolink"),e.enter("autolinkMarker"),e.consume(f),e.exit("autolinkMarker"),e.enter("autolinkProtocol"),i}function i(f){return st(f)?(e.consume(f),o):f===64?n(f):c(f)}function o(f){return f===43||f===45||f===46||qe(f)?(s=1,a(f)):c(f)}function a(f){return f===58?(e.consume(f),s=0,l):(f===43||f===45||f===46||qe(f))&&s++<32?(e.consume(f),a):(s=0,c(f))}function l(f){return f===62?(e.exit("autolinkProtocol"),e.enter("autolinkMarker"),e.consume(f),e.exit("autolinkMarker"),e.exit("autolink"),t):f===null||f===32||f===60||Rr(f)?n(f):(e.consume(f),l)}function c(f){return f===64?(e.consume(f),u):Cp(f)?(e.consume(f),c):n(f)}function u(f){return qe(f)?d(f):n(f)}function d(f){return f===46?(e.consume(f),s=0,u):f===62?(e.exit("autolinkProtocol").type="autolinkEmail",e.enter("autolinkMarker"),e.consume(f),e.exit("autolinkMarker"),e.exit("autolink"),t):m(f)}function m(f){if((f===45||qe(f))&&s++<63){const g=f===45?m:d;return e.consume(f),g}return n(f)}}const rs={partial:!0,tokenize:Op};function Op(e,t,n){return s;function s(i){return oe(i)?ue(e,r,"linePrefix")(i):r(i)}function r(i){return i===null||Z(i)?t(i):n(i)}}const Xa={continuation:{tokenize:Fp},exit:Bp,name:"blockQuote",tokenize:Dp};function Dp(e,t,n){const s=this;return r;function r(o){if(o===62){const a=s.containerState;return a.open||(e.enter("blockQuote",{_container:!0}),a.open=!0),e.enter("blockQuotePrefix"),e.enter("blockQuoteMarker"),e.consume(o),e.exit("blockQuoteMarker"),i}return n(o)}function i(o){return oe(o)?(e.enter("blockQuotePrefixWhitespace"),e.consume(o),e.exit("blockQuotePrefixWhitespace"),e.exit("blockQuotePrefix"),t):(e.exit("blockQuotePrefix"),t(o))}}function Fp(e,t,n){const s=this;return r;function r(o){return oe(o)?ue(e,i,"linePrefix",s.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(o):i(o)}function i(o){return e.attempt(Xa,t,n)(o)}}function Bp(e){e.exit("blockQuote")}const el={name:"characterEscape",tokenize:$p};function $p(e,t,n){return s;function s(i){return e.enter("characterEscape"),e.enter("escapeMarker"),e.consume(i),e.exit("escapeMarker"),r}function r(i){return Ep(i)?(e.enter("characterEscapeValue"),e.consume(i),e.exit("characterEscapeValue"),e.exit("characterEscape"),t):n(i)}}const tl={name:"characterReference",tokenize:Vp};function Vp(e,t,n){const s=this;let r=0,i,o;return a;function a(d){return e.enter("characterReference"),e.enter("characterReferenceMarker"),e.consume(d),e.exit("characterReferenceMarker"),l}function l(d){return d===35?(e.enter("characterReferenceMarkerNumeric"),e.consume(d),e.exit("characterReferenceMarkerNumeric"),c):(e.enter("characterReferenceValue"),i=31,o=qe,u(d))}function c(d){return d===88||d===120?(e.enter("characterReferenceMarkerHexadecimal"),e.consume(d),e.exit("characterReferenceMarkerHexadecimal"),e.enter("characterReferenceValue"),i=6,o=kp,u):(e.enter("characterReferenceValue"),i=7,o=Mr,u(d))}function u(d){if(d===59&&r){const m=e.exit("characterReferenceValue");return o===qe&&!ai(s.sliceSerialize(m))?n(d):(e.enter("characterReferenceMarker"),e.consume(d),e.exit("characterReferenceMarker"),e.exit("characterReference"),t)}return o(d)&&r++<i?(e.consume(d),u):n(d)}}const ko={partial:!0,tokenize:qp},Eo={concrete:!0,name:"codeFenced",tokenize:Up};function Up(e,t,n){const s=this,r={partial:!0,tokenize:z};let i=0,o=0,a;return l;function l(k){return c(k)}function c(k){const L=s.events[s.events.length-1];return i=L&&L[1].type==="linePrefix"?L[2].sliceSerialize(L[1],!0).length:0,a=k,e.enter("codeFenced"),e.enter("codeFencedFence"),e.enter("codeFencedFenceSequence"),u(k)}function u(k){return k===a?(o++,e.consume(k),u):o<3?n(k):(e.exit("codeFencedFenceSequence"),oe(k)?ue(e,d,"whitespace")(k):d(k))}function d(k){return k===null||Z(k)?(e.exit("codeFencedFence"),s.interrupt?t(k):e.check(ko,x,E)(k)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),m(k))}function m(k){return k===null||Z(k)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),d(k)):oe(k)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),ue(e,f,"whitespace")(k)):k===96&&k===a?n(k):(e.consume(k),m)}function f(k){return k===null||Z(k)?d(k):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),g(k))}function g(k){return k===null||Z(k)?(e.exit("chunkString"),e.exit("codeFencedFenceMeta"),d(k)):k===96&&k===a?n(k):(e.consume(k),g)}function x(k){return e.attempt(r,E,C)(k)}function C(k){return e.enter("lineEnding"),e.consume(k),e.exit("lineEnding"),b}function b(k){return i>0&&oe(k)?ue(e,I,"linePrefix",i+1)(k):I(k)}function I(k){return k===null||Z(k)?e.check(ko,x,E)(k):(e.enter("codeFlowValue"),S(k))}function S(k){return k===null||Z(k)?(e.exit("codeFlowValue"),I(k)):(e.consume(k),S)}function E(k){return e.exit("codeFenced"),t(k)}function z(k,L,R){let O=0;return P;function P(A){return k.enter("lineEnding"),k.consume(A),k.exit("lineEnding"),N}function N(A){return k.enter("codeFencedFence"),oe(A)?ue(k,_,"linePrefix",s.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(A):_(A)}function _(A){return A===a?(k.enter("codeFencedFenceSequence"),D(A)):R(A)}function D(A){return A===a?(O++,k.consume(A),D):O>=o?(k.exit("codeFencedFenceSequence"),oe(A)?ue(k,F,"whitespace")(A):F(A)):R(A)}function F(A){return A===null||Z(A)?(k.exit("codeFencedFence"),L(A)):R(A)}}}function qp(e,t,n){const s=this;return r;function r(o){return o===null?n(o):(e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),i)}function i(o){return s.parser.lazy[s.now().line]?n(o):t(o)}}const cr={name:"codeIndented",tokenize:Hp},Wp={partial:!0,tokenize:Gp};function Hp(e,t,n){const s=this;return r;function r(c){return e.enter("codeIndented"),ue(e,i,"linePrefix",5)(c)}function i(c){const u=s.events[s.events.length-1];return u&&u[1].type==="linePrefix"&&u[2].sliceSerialize(u[1],!0).length>=4?o(c):n(c)}function o(c){return c===null?l(c):Z(c)?e.attempt(Wp,o,l)(c):(e.enter("codeFlowValue"),a(c))}function a(c){return c===null||Z(c)?(e.exit("codeFlowValue"),o(c)):(e.consume(c),a)}function l(c){return e.exit("codeIndented"),t(c)}}function Gp(e,t,n){const s=this;return r;function r(o){return s.parser.lazy[s.now().line]?n(o):Z(o)?(e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),r):ue(e,i,"linePrefix",5)(o)}function i(o){const a=s.events[s.events.length-1];return a&&a[1].type==="linePrefix"&&a[2].sliceSerialize(a[1],!0).length>=4?t(o):Z(o)?r(o):n(o)}}const Qp={name:"codeText",previous:Yp,resolve:Jp,tokenize:Zp};function Jp(e){let t=e.length-4,n=3,s,r;if((e[n][1].type==="lineEnding"||e[n][1].type==="space")&&(e[t][1].type==="lineEnding"||e[t][1].type==="space")){for(s=n;++s<t;)if(e[s][1].type==="codeTextData"){e[n][1].type="codeTextPadding",e[t][1].type="codeTextPadding",n+=2,t-=2;break}}for(s=n-1,t++;++s<=t;)r===void 0?s!==t&&e[s][1].type!=="lineEnding"&&(r=s):(s===t||e[s][1].type==="lineEnding")&&(e[r][1].type="codeTextData",s!==r+2&&(e[r][1].end=e[s-1][1].end,e.splice(r+2,s-r-2),t-=s-r-2,s=r+2),r=void 0);return e}function Yp(e){return e!==96||this.events[this.events.length-1][1].type==="characterEscape"}function Zp(e,t,n){let s=0,r,i;return o;function o(d){return e.enter("codeText"),e.enter("codeTextSequence"),a(d)}function a(d){return d===96?(e.consume(d),s++,a):(e.exit("codeTextSequence"),l(d))}function l(d){return d===null?n(d):d===32?(e.enter("space"),e.consume(d),e.exit("space"),l):d===96?(i=e.enter("codeTextSequence"),r=0,u(d)):Z(d)?(e.enter("lineEnding"),e.consume(d),e.exit("lineEnding"),l):(e.enter("codeTextData"),c(d))}function c(d){return d===null||d===32||d===96||Z(d)?(e.exit("codeTextData"),l(d)):(e.consume(d),c)}function u(d){return d===96?(e.consume(d),r++,u):r===s?(e.exit("codeTextSequence"),e.exit("codeText"),t(d)):(i.type="codeTextData",c(d))}}class Kp{constructor(t){this.left=t?[...t]:[],this.right=[]}get(t){if(t<0||t>=this.left.length+this.right.length)throw new RangeError("Cannot access index `"+t+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return t<this.left.length?this.left[t]:this.right[this.right.length-t+this.left.length-1]}get length(){return this.left.length+this.right.length}shift(){return this.setCursor(0),this.right.pop()}slice(t,n){const s=n??Number.POSITIVE_INFINITY;return s<this.left.length?this.left.slice(t,s):t>this.left.length?this.right.slice(this.right.length-s+this.left.length,this.right.length-t+this.left.length).reverse():this.left.slice(t).concat(this.right.slice(this.right.length-s+this.left.length).reverse())}splice(t,n,s){const r=n||0;this.setCursor(Math.trunc(t));const i=this.right.splice(this.right.length-r,Number.POSITIVE_INFINITY);return s&&on(this.left,s),i.reverse()}pop(){return this.setCursor(Number.POSITIVE_INFINITY),this.left.pop()}push(t){this.setCursor(Number.POSITIVE_INFINITY),this.left.push(t)}pushMany(t){this.setCursor(Number.POSITIVE_INFINITY),on(this.left,t)}unshift(t){this.setCursor(0),this.right.push(t)}unshiftMany(t){this.setCursor(0),on(this.right,t.reverse())}setCursor(t){if(!(t===this.left.length||t>this.left.length&&this.right.length===0||t<0&&this.left.length===0))if(t<this.left.length){const n=this.left.splice(t,Number.POSITIVE_INFINITY);on(this.right,n.reverse())}else{const n=this.right.splice(this.left.length+this.right.length-t,Number.POSITIVE_INFINITY);on(this.left,n.reverse())}}}function on(e,t){let n=0;if(t.length<1e4)e.push(...t);else for(;n<t.length;)e.push(...t.slice(n,n+1e4)),n+=1e4}function nl(e){const t={};let n=-1,s,r,i,o,a,l,c;const u=new Kp(e);for(;++n<u.length;){for(;n in t;)n=t[n];if(s=u.get(n),n&&s[1].type==="chunkFlow"&&u.get(n-1)[1].type==="listItemPrefix"&&(l=s[1]._tokenizer.events,i=0,i<l.length&&l[i][1].type==="lineEndingBlank"&&(i+=2),i<l.length&&l[i][1].type==="content"))for(;++i<l.length&&l[i][1].type!=="content";)l[i][1].type==="chunkText"&&(l[i][1]._isInFirstContentOfListItem=!0,i++);if(s[0]==="enter")s[1].contentType&&(Object.assign(t,Xp(u,n)),n=t[n],c=!0);else if(s[1]._container){for(i=n,r=void 0;i--;)if(o=u.get(i),o[1].type==="lineEnding"||o[1].type==="lineEndingBlank")o[0]==="enter"&&(r&&(u.get(r)[1].type="lineEndingBlank"),o[1].type="lineEnding",r=i);else if(!(o[1].type==="linePrefix"||o[1].type==="listItemIndent"))break;r&&(s[1].end={...u.get(r)[1].start},a=u.slice(r,n),a.unshift(s),u.splice(r,n-r+1,a))}}return ot(e,0,Number.POSITIVE_INFINITY,u.slice(0)),!c}function Xp(e,t){const n=e.get(t)[1],s=e.get(t)[2];let r=t-1;const i=[];let o=n._tokenizer;o||(o=s.parser[n.contentType](n.start),n._contentTypeTextTrailing&&(o._contentTypeTextTrailing=!0));const a=o.events,l=[],c={};let u,d,m=-1,f=n,g=0,x=0;const C=[x];for(;f;){for(;e.get(++r)[1]!==f;);i.push(r),f._tokenizer||(u=s.sliceStream(f),f.next||u.push(null),d&&o.defineSkip(f.start),f._isInFirstContentOfListItem&&(o._gfmTasklistFirstContentOfListItem=!0),o.write(u),f._isInFirstContentOfListItem&&(o._gfmTasklistFirstContentOfListItem=void 0)),d=f,f=f.next}for(f=n;++m<a.length;)a[m][0]==="exit"&&a[m-1][0]==="enter"&&a[m][1].type===a[m-1][1].type&&a[m][1].start.line!==a[m][1].end.line&&(x=m+1,C.push(x),f._tokenizer=void 0,f.previous=void 0,f=f.next);for(o.events=[],f?(f._tokenizer=void 0,f.previous=void 0):C.pop(),m=C.length;m--;){const b=a.slice(C[m],C[m+1]),I=i.pop();l.push([I,I+b.length-1]),e.splice(I,2,b)}for(l.reverse(),m=-1;++m<l.length;)c[g+l[m][0]]=g+l[m][1],g+=l[m][1]-l[m][0]-1;return c}const em={resolve:nm,tokenize:sm},tm={partial:!0,tokenize:rm};function nm(e){return nl(e),e}function sm(e,t){let n;return s;function s(a){return e.enter("content"),n=e.enter("chunkContent",{contentType:"content"}),r(a)}function r(a){return a===null?i(a):Z(a)?e.check(tm,o,i)(a):(e.consume(a),r)}function i(a){return e.exit("chunkContent"),e.exit("content"),t(a)}function o(a){return e.consume(a),e.exit("chunkContent"),n.next=e.enter("chunkContent",{contentType:"content",previous:n}),n=n.next,r}}function rm(e,t,n){const s=this;return r;function r(o){return e.exit("chunkContent"),e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),ue(e,i,"linePrefix")}function i(o){if(o===null||Z(o))return n(o);const a=s.events[s.events.length-1];return!s.parser.constructs.disable.null.includes("codeIndented")&&a&&a[1].type==="linePrefix"&&a[2].sliceSerialize(a[1],!0).length>=4?t(o):e.interrupt(s.parser.constructs.flow,n,t)(o)}}function sl(e,t,n,s,r,i,o,a,l){const c=l||Number.POSITIVE_INFINITY;let u=0;return d;function d(b){return b===60?(e.enter(s),e.enter(r),e.enter(i),e.consume(b),e.exit(i),m):b===null||b===32||b===41||Rr(b)?n(b):(e.enter(s),e.enter(o),e.enter(a),e.enter("chunkString",{contentType:"string"}),x(b))}function m(b){return b===62?(e.enter(i),e.consume(b),e.exit(i),e.exit(r),e.exit(s),t):(e.enter(a),e.enter("chunkString",{contentType:"string"}),f(b))}function f(b){return b===62?(e.exit("chunkString"),e.exit(a),m(b)):b===null||b===60||Z(b)?n(b):(e.consume(b),b===92?g:f)}function g(b){return b===60||b===62||b===92?(e.consume(b),f):f(b)}function x(b){return!u&&(b===null||b===41||Oe(b))?(e.exit("chunkString"),e.exit(a),e.exit(o),e.exit(s),t(b)):u<c&&b===40?(e.consume(b),u++,x):b===41?(e.consume(b),u--,x):b===null||b===32||b===40||Rr(b)?n(b):(e.consume(b),b===92?C:x)}function C(b){return b===40||b===41||b===92?(e.consume(b),x):x(b)}}function rl(e,t,n,s,r,i){const o=this;let a=0,l;return c;function c(f){return e.enter(s),e.enter(r),e.consume(f),e.exit(r),e.enter(i),u}function u(f){return a>999||f===null||f===91||f===93&&!l||f===94&&!a&&"_hiddenFootnoteSupport"in o.parser.constructs?n(f):f===93?(e.exit(i),e.enter(r),e.consume(f),e.exit(r),e.exit(s),t):Z(f)?(e.enter("lineEnding"),e.consume(f),e.exit("lineEnding"),u):(e.enter("chunkString",{contentType:"string"}),d(f))}function d(f){return f===null||f===91||f===93||Z(f)||a++>999?(e.exit("chunkString"),u(f)):(e.consume(f),l||(l=!oe(f)),f===92?m:d)}function m(f){return f===91||f===92||f===93?(e.consume(f),a++,d):d(f)}}function il(e,t,n,s,r,i){let o;return a;function a(m){return m===34||m===39||m===40?(e.enter(s),e.enter(r),e.consume(m),e.exit(r),o=m===40?41:m,l):n(m)}function l(m){return m===o?(e.enter(r),e.consume(m),e.exit(r),e.exit(s),t):(e.enter(i),c(m))}function c(m){return m===o?(e.exit(i),l(o)):m===null?n(m):Z(m)?(e.enter("lineEnding"),e.consume(m),e.exit("lineEnding"),ue(e,c,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),u(m))}function u(m){return m===o||m===null||Z(m)?(e.exit("chunkString"),c(m)):(e.consume(m),m===92?d:u)}function d(m){return m===o||m===92?(e.consume(m),u):u(m)}}function dn(e,t){let n;return s;function s(r){return Z(r)?(e.enter("lineEnding"),e.consume(r),e.exit("lineEnding"),n=!0,s):oe(r)?ue(e,s,n?"linePrefix":"lineSuffix")(r):t(r)}}const im={name:"definition",tokenize:am},om={partial:!0,tokenize:lm};function am(e,t,n){const s=this;let r;return i;function i(f){return e.enter("definition"),o(f)}function o(f){return rl.call(s,e,a,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(f)}function a(f){return r=Ut(s.sliceSerialize(s.events[s.events.length-1][1]).slice(1,-1)),f===58?(e.enter("definitionMarker"),e.consume(f),e.exit("definitionMarker"),l):n(f)}function l(f){return Oe(f)?dn(e,c)(f):c(f)}function c(f){return sl(e,u,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(f)}function u(f){return e.attempt(om,d,d)(f)}function d(f){return oe(f)?ue(e,m,"whitespace")(f):m(f)}function m(f){return f===null||Z(f)?(e.exit("definition"),s.parser.defined.push(r),t(f)):n(f)}}function lm(e,t,n){return s;function s(a){return Oe(a)?dn(e,r)(a):n(a)}function r(a){return il(e,i,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(a)}function i(a){return oe(a)?ue(e,o,"whitespace")(a):o(a)}function o(a){return a===null||Z(a)?t(a):n(a)}}const cm={name:"hardBreakEscape",tokenize:um};function um(e,t,n){return s;function s(i){return e.enter("hardBreakEscape"),e.consume(i),r}function r(i){return Z(i)?(e.exit("hardBreakEscape"),t(i)):n(i)}}const dm={name:"headingAtx",resolve:hm,tokenize:fm};function hm(e,t){let n=e.length-2,s=3,r,i;return e[s][1].type==="whitespace"&&(s+=2),n-2>s&&e[n][1].type==="whitespace"&&(n-=2),e[n][1].type==="atxHeadingSequence"&&(s===n-1||n-4>s&&e[n-2][1].type==="whitespace")&&(n-=s+1===n?2:4),n>s&&(r={type:"atxHeadingText",start:e[s][1].start,end:e[n][1].end},i={type:"chunkText",start:e[s][1].start,end:e[n][1].end,contentType:"text"},ot(e,s,n-s+1,[["enter",r,t],["enter",i,t],["exit",i,t],["exit",r,t]])),e}function fm(e,t,n){let s=0;return r;function r(u){return e.enter("atxHeading"),i(u)}function i(u){return e.enter("atxHeadingSequence"),o(u)}function o(u){return u===35&&s++<6?(e.consume(u),o):u===null||Oe(u)?(e.exit("atxHeadingSequence"),a(u)):n(u)}function a(u){return u===35?(e.enter("atxHeadingSequence"),l(u)):u===null||Z(u)?(e.exit("atxHeading"),t(u)):oe(u)?ue(e,a,"whitespace")(u):(e.enter("atxHeadingText"),c(u))}function l(u){return u===35?(e.consume(u),l):(e.exit("atxHeadingSequence"),a(u))}function c(u){return u===null||u===35||Oe(u)?(e.exit("atxHeadingText"),a(u)):(e.consume(u),c)}}const pm=["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"],Po=["pre","script","style","textarea"],mm={concrete:!0,name:"htmlFlow",resolveTo:xm,tokenize:wm},gm={partial:!0,tokenize:Sm},ym={partial:!0,tokenize:bm};function xm(e){let t=e.length;for(;t--&&!(e[t][0]==="enter"&&e[t][1].type==="htmlFlow"););return t>1&&e[t-2][1].type==="linePrefix"&&(e[t][1].start=e[t-2][1].start,e[t+1][1].start=e[t-2][1].start,e.splice(t-2,2)),e}function wm(e,t,n){const s=this;let r,i,o,a,l;return c;function c(w){return u(w)}function u(w){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(w),d}function d(w){return w===33?(e.consume(w),m):w===47?(e.consume(w),i=!0,x):w===63?(e.consume(w),r=3,s.interrupt?t:y):st(w)?(e.consume(w),o=String.fromCharCode(w),C):n(w)}function m(w){return w===45?(e.consume(w),r=2,f):w===91?(e.consume(w),r=5,a=0,g):st(w)?(e.consume(w),r=4,s.interrupt?t:y):n(w)}function f(w){return w===45?(e.consume(w),s.interrupt?t:y):n(w)}function g(w){const W="CDATA[";return w===W.charCodeAt(a++)?(e.consume(w),a===W.length?s.interrupt?t:_:g):n(w)}function x(w){return st(w)?(e.consume(w),o=String.fromCharCode(w),C):n(w)}function C(w){if(w===null||w===47||w===62||Oe(w)){const W=w===47,ee=o.toLowerCase();return!W&&!i&&Po.includes(ee)?(r=1,s.interrupt?t(w):_(w)):pm.includes(o.toLowerCase())?(r=6,W?(e.consume(w),b):s.interrupt?t(w):_(w)):(r=7,s.interrupt&&!s.parser.lazy[s.now().line]?n(w):i?I(w):S(w))}return w===45||qe(w)?(e.consume(w),o+=String.fromCharCode(w),C):n(w)}function b(w){return w===62?(e.consume(w),s.interrupt?t:_):n(w)}function I(w){return oe(w)?(e.consume(w),I):P(w)}function S(w){return w===47?(e.consume(w),P):w===58||w===95||st(w)?(e.consume(w),E):oe(w)?(e.consume(w),S):P(w)}function E(w){return w===45||w===46||w===58||w===95||qe(w)?(e.consume(w),E):z(w)}function z(w){return w===61?(e.consume(w),k):oe(w)?(e.consume(w),z):S(w)}function k(w){return w===null||w===60||w===61||w===62||w===96?n(w):w===34||w===39?(e.consume(w),l=w,L):oe(w)?(e.consume(w),k):R(w)}function L(w){return w===l?(e.consume(w),l=null,O):w===null||Z(w)?n(w):(e.consume(w),L)}function R(w){return w===null||w===34||w===39||w===47||w===60||w===61||w===62||w===96||Oe(w)?z(w):(e.consume(w),R)}function O(w){return w===47||w===62||oe(w)?S(w):n(w)}function P(w){return w===62?(e.consume(w),N):n(w)}function N(w){return w===null||Z(w)?_(w):oe(w)?(e.consume(w),N):n(w)}function _(w){return w===45&&r===2?(e.consume(w),T):w===60&&r===1?(e.consume(w),B):w===62&&r===4?(e.consume(w),te):w===63&&r===3?(e.consume(w),y):w===93&&r===5?(e.consume(w),q):Z(w)&&(r===6||r===7)?(e.exit("htmlFlowData"),e.check(gm,ae,D)(w)):w===null||Z(w)?(e.exit("htmlFlowData"),D(w)):(e.consume(w),_)}function D(w){return e.check(ym,F,ae)(w)}function F(w){return e.enter("lineEnding"),e.consume(w),e.exit("lineEnding"),A}function A(w){return w===null||Z(w)?D(w):(e.enter("htmlFlowData"),_(w))}function T(w){return w===45?(e.consume(w),y):_(w)}function B(w){return w===47?(e.consume(w),o="",M):_(w)}function M(w){if(w===62){const W=o.toLowerCase();return Po.includes(W)?(e.consume(w),te):_(w)}return st(w)&&o.length<8?(e.consume(w),o+=String.fromCharCode(w),M):_(w)}function q(w){return w===93?(e.consume(w),y):_(w)}function y(w){return w===62?(e.consume(w),te):w===45&&r===2?(e.consume(w),y):_(w)}function te(w){return w===null||Z(w)?(e.exit("htmlFlowData"),ae(w)):(e.consume(w),te)}function ae(w){return e.exit("htmlFlow"),t(w)}}function bm(e,t,n){const s=this;return r;function r(o){return Z(o)?(e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),i):n(o)}function i(o){return s.parser.lazy[s.now().line]?n(o):t(o)}}function Sm(e,t,n){return s;function s(r){return e.enter("lineEnding"),e.consume(r),e.exit("lineEnding"),e.attempt(rs,t,n)}}const vm={name:"htmlText",tokenize:Cm};function Cm(e,t,n){const s=this;let r,i,o;return a;function a(y){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(y),l}function l(y){return y===33?(e.consume(y),c):y===47?(e.consume(y),z):y===63?(e.consume(y),S):st(y)?(e.consume(y),R):n(y)}function c(y){return y===45?(e.consume(y),u):y===91?(e.consume(y),i=0,g):st(y)?(e.consume(y),I):n(y)}function u(y){return y===45?(e.consume(y),f):n(y)}function d(y){return y===null?n(y):y===45?(e.consume(y),m):Z(y)?(o=d,B(y)):(e.consume(y),d)}function m(y){return y===45?(e.consume(y),f):d(y)}function f(y){return y===62?T(y):y===45?m(y):d(y)}function g(y){const te="CDATA[";return y===te.charCodeAt(i++)?(e.consume(y),i===te.length?x:g):n(y)}function x(y){return y===null?n(y):y===93?(e.consume(y),C):Z(y)?(o=x,B(y)):(e.consume(y),x)}function C(y){return y===93?(e.consume(y),b):x(y)}function b(y){return y===62?T(y):y===93?(e.consume(y),b):x(y)}function I(y){return y===null||y===62?T(y):Z(y)?(o=I,B(y)):(e.consume(y),I)}function S(y){return y===null?n(y):y===63?(e.consume(y),E):Z(y)?(o=S,B(y)):(e.consume(y),S)}function E(y){return y===62?T(y):S(y)}function z(y){return st(y)?(e.consume(y),k):n(y)}function k(y){return y===45||qe(y)?(e.consume(y),k):L(y)}function L(y){return Z(y)?(o=L,B(y)):oe(y)?(e.consume(y),L):T(y)}function R(y){return y===45||qe(y)?(e.consume(y),R):y===47||y===62||Oe(y)?O(y):n(y)}function O(y){return y===47?(e.consume(y),T):y===58||y===95||st(y)?(e.consume(y),P):Z(y)?(o=O,B(y)):oe(y)?(e.consume(y),O):T(y)}function P(y){return y===45||y===46||y===58||y===95||qe(y)?(e.consume(y),P):N(y)}function N(y){return y===61?(e.consume(y),_):Z(y)?(o=N,B(y)):oe(y)?(e.consume(y),N):O(y)}function _(y){return y===null||y===60||y===61||y===62||y===96?n(y):y===34||y===39?(e.consume(y),r=y,D):Z(y)?(o=_,B(y)):oe(y)?(e.consume(y),_):(e.consume(y),F)}function D(y){return y===r?(e.consume(y),r=void 0,A):y===null?n(y):Z(y)?(o=D,B(y)):(e.consume(y),D)}function F(y){return y===null||y===34||y===39||y===60||y===61||y===96?n(y):y===47||y===62||Oe(y)?O(y):(e.consume(y),F)}function A(y){return y===47||y===62||Oe(y)?O(y):n(y)}function T(y){return y===62?(e.consume(y),e.exit("htmlTextData"),e.exit("htmlText"),t):n(y)}function B(y){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(y),e.exit("lineEnding"),M}function M(y){return oe(y)?ue(e,q,"linePrefix",s.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(y):q(y)}function q(y){return e.enter("htmlTextData"),o(y)}}const ci={name:"labelEnd",resolveAll:Tm,resolveTo:Im,tokenize:Am},km={tokenize:Nm},Em={tokenize:zm},Pm={tokenize:Lm};function Tm(e){let t=-1;const n=[];for(;++t<e.length;){const s=e[t][1];if(n.push(e[t]),s.type==="labelImage"||s.type==="labelLink"||s.type==="labelEnd"){const r=s.type==="labelImage"?4:2;s.type="data",t+=r}}return e.length!==n.length&&ot(e,0,e.length,n),e}function Im(e,t){let n=e.length,s=0,r,i,o,a;for(;n--;)if(r=e[n][1],i){if(r.type==="link"||r.type==="labelLink"&&r._inactive)break;e[n][0]==="enter"&&r.type==="labelLink"&&(r._inactive=!0)}else if(o){if(e[n][0]==="enter"&&(r.type==="labelImage"||r.type==="labelLink")&&!r._balanced&&(i=n,r.type!=="labelLink")){s=2;break}}else r.type==="labelEnd"&&(o=n);const l={type:e[i][1].type==="labelLink"?"link":"image",start:{...e[i][1].start},end:{...e[e.length-1][1].end}},c={type:"label",start:{...e[i][1].start},end:{...e[o][1].end}},u={type:"labelText",start:{...e[i+s+2][1].end},end:{...e[o-2][1].start}};return a=[["enter",l,t],["enter",c,t]],a=Qe(a,e.slice(i+1,i+s+3)),a=Qe(a,[["enter",u,t]]),a=Qe(a,li(t.parser.constructs.insideSpan.null,e.slice(i+s+4,o-3),t)),a=Qe(a,[["exit",u,t],e[o-2],e[o-1],["exit",c,t]]),a=Qe(a,e.slice(o+1)),a=Qe(a,[["exit",l,t]]),ot(e,i,e.length,a),e}function Am(e,t,n){const s=this;let r=s.events.length,i,o;for(;r--;)if((s.events[r][1].type==="labelImage"||s.events[r][1].type==="labelLink")&&!s.events[r][1]._balanced){i=s.events[r][1];break}return a;function a(m){return i?i._inactive?d(m):(o=s.parser.defined.includes(Ut(s.sliceSerialize({start:i.end,end:s.now()}))),e.enter("labelEnd"),e.enter("labelMarker"),e.consume(m),e.exit("labelMarker"),e.exit("labelEnd"),l):n(m)}function l(m){return m===40?e.attempt(km,u,o?u:d)(m):m===91?e.attempt(Em,u,o?c:d)(m):o?u(m):d(m)}function c(m){return e.attempt(Pm,u,d)(m)}function u(m){return t(m)}function d(m){return i._balanced=!0,n(m)}}function Nm(e,t,n){return s;function s(d){return e.enter("resource"),e.enter("resourceMarker"),e.consume(d),e.exit("resourceMarker"),r}function r(d){return Oe(d)?dn(e,i)(d):i(d)}function i(d){return d===41?u(d):sl(e,o,a,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(d)}function o(d){return Oe(d)?dn(e,l)(d):u(d)}function a(d){return n(d)}function l(d){return d===34||d===39||d===40?il(e,c,n,"resourceTitle","resourceTitleMarker","resourceTitleString")(d):u(d)}function c(d){return Oe(d)?dn(e,u)(d):u(d)}function u(d){return d===41?(e.enter("resourceMarker"),e.consume(d),e.exit("resourceMarker"),e.exit("resource"),t):n(d)}}function zm(e,t,n){const s=this;return r;function r(a){return rl.call(s,e,i,o,"reference","referenceMarker","referenceString")(a)}function i(a){return s.parser.defined.includes(Ut(s.sliceSerialize(s.events[s.events.length-1][1]).slice(1,-1)))?t(a):n(a)}function o(a){return n(a)}}function Lm(e,t,n){return s;function s(i){return e.enter("reference"),e.enter("referenceMarker"),e.consume(i),e.exit("referenceMarker"),r}function r(i){return i===93?(e.enter("referenceMarker"),e.consume(i),e.exit("referenceMarker"),e.exit("reference"),t):n(i)}}const _m={name:"labelStartImage",resolveAll:ci.resolveAll,tokenize:jm};function jm(e,t,n){const s=this;return r;function r(a){return e.enter("labelImage"),e.enter("labelImageMarker"),e.consume(a),e.exit("labelImageMarker"),i}function i(a){return a===91?(e.enter("labelMarker"),e.consume(a),e.exit("labelMarker"),e.exit("labelImage"),o):n(a)}function o(a){return a===94&&"_hiddenFootnoteSupport"in s.parser.constructs?n(a):t(a)}}const Rm={name:"labelStartLink",resolveAll:ci.resolveAll,tokenize:Mm};function Mm(e,t,n){const s=this;return r;function r(o){return e.enter("labelLink"),e.enter("labelMarker"),e.consume(o),e.exit("labelMarker"),e.exit("labelLink"),i}function i(o){return o===94&&"_hiddenFootnoteSupport"in s.parser.constructs?n(o):t(o)}}const ur={name:"lineEnding",tokenize:Om};function Om(e,t){return n;function n(s){return e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),ue(e,t,"linePrefix")}}const Hn={name:"thematicBreak",tokenize:Dm};function Dm(e,t,n){let s=0,r;return i;function i(c){return e.enter("thematicBreak"),o(c)}function o(c){return r=c,a(c)}function a(c){return c===r?(e.enter("thematicBreakSequence"),l(c)):s>=3&&(c===null||Z(c))?(e.exit("thematicBreak"),t(c)):n(c)}function l(c){return c===r?(e.consume(c),s++,l):(e.exit("thematicBreakSequence"),oe(c)?ue(e,a,"whitespace")(c):a(c))}}const Me={continuation:{tokenize:Vm},exit:qm,name:"list",tokenize:$m},Fm={partial:!0,tokenize:Wm},Bm={partial:!0,tokenize:Um};function $m(e,t,n){const s=this,r=s.events[s.events.length-1];let i=r&&r[1].type==="linePrefix"?r[2].sliceSerialize(r[1],!0).length:0,o=0;return a;function a(f){const g=s.containerState.type||(f===42||f===43||f===45?"listUnordered":"listOrdered");if(g==="listUnordered"?!s.containerState.marker||f===s.containerState.marker:Mr(f)){if(s.containerState.type||(s.containerState.type=g,e.enter(g,{_container:!0})),g==="listUnordered")return e.enter("listItemPrefix"),f===42||f===45?e.check(Hn,n,c)(f):c(f);if(!s.interrupt||f===49)return e.enter("listItemPrefix"),e.enter("listItemValue"),l(f)}return n(f)}function l(f){return Mr(f)&&++o<10?(e.consume(f),l):(!s.interrupt||o<2)&&(s.containerState.marker?f===s.containerState.marker:f===41||f===46)?(e.exit("listItemValue"),c(f)):n(f)}function c(f){return e.enter("listItemMarker"),e.consume(f),e.exit("listItemMarker"),s.containerState.marker=s.containerState.marker||f,e.check(rs,s.interrupt?n:u,e.attempt(Fm,m,d))}function u(f){return s.containerState.initialBlankLine=!0,i++,m(f)}function d(f){return oe(f)?(e.enter("listItemPrefixWhitespace"),e.consume(f),e.exit("listItemPrefixWhitespace"),m):n(f)}function m(f){return s.containerState.size=i+s.sliceSerialize(e.exit("listItemPrefix"),!0).length,t(f)}}function Vm(e,t,n){const s=this;return s.containerState._closeFlow=void 0,e.check(rs,r,i);function r(a){return s.containerState.furtherBlankLines=s.containerState.furtherBlankLines||s.containerState.initialBlankLine,ue(e,t,"listItemIndent",s.containerState.size+1)(a)}function i(a){return s.containerState.furtherBlankLines||!oe(a)?(s.containerState.furtherBlankLines=void 0,s.containerState.initialBlankLine=void 0,o(a)):(s.containerState.furtherBlankLines=void 0,s.containerState.initialBlankLine=void 0,e.attempt(Bm,t,o)(a))}function o(a){return s.containerState._closeFlow=!0,s.interrupt=void 0,ue(e,e.attempt(Me,t,n),"linePrefix",s.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(a)}}function Um(e,t,n){const s=this;return ue(e,r,"listItemIndent",s.containerState.size+1);function r(i){const o=s.events[s.events.length-1];return o&&o[1].type==="listItemIndent"&&o[2].sliceSerialize(o[1],!0).length===s.containerState.size?t(i):n(i)}}function qm(e){e.exit(this.containerState.type)}function Wm(e,t,n){const s=this;return ue(e,r,"listItemPrefixWhitespace",s.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function r(i){const o=s.events[s.events.length-1];return!oe(i)&&o&&o[1].type==="listItemPrefixWhitespace"?t(i):n(i)}}const To={name:"setextUnderline",resolveTo:Hm,tokenize:Gm};function Hm(e,t){let n=e.length,s,r,i;for(;n--;)if(e[n][0]==="enter"){if(e[n][1].type==="content"){s=n;break}e[n][1].type==="paragraph"&&(r=n)}else e[n][1].type==="content"&&e.splice(n,1),!i&&e[n][1].type==="definition"&&(i=n);const o={type:"setextHeading",start:{...e[s][1].start},end:{...e[e.length-1][1].end}};return e[r][1].type="setextHeadingText",i?(e.splice(r,0,["enter",o,t]),e.splice(i+1,0,["exit",e[s][1],t]),e[s][1].end={...e[i][1].end}):e[s][1]=o,e.push(["exit",o,t]),e}function Gm(e,t,n){const s=this;let r;return i;function i(c){let u=s.events.length,d;for(;u--;)if(s.events[u][1].type!=="lineEnding"&&s.events[u][1].type!=="linePrefix"&&s.events[u][1].type!=="content"){d=s.events[u][1].type==="paragraph";break}return!s.parser.lazy[s.now().line]&&(s.interrupt||d)?(e.enter("setextHeadingLine"),r=c,o(c)):n(c)}function o(c){return e.enter("setextHeadingLineSequence"),a(c)}function a(c){return c===r?(e.consume(c),a):(e.exit("setextHeadingLineSequence"),oe(c)?ue(e,l,"lineSuffix")(c):l(c))}function l(c){return c===null||Z(c)?(e.exit("setextHeadingLine"),t(c)):n(c)}}const Qm={tokenize:Jm};function Jm(e){const t=this,n=e.attempt(rs,s,e.attempt(this.parser.constructs.flowInitial,r,ue(e,e.attempt(this.parser.constructs.flow,r,e.attempt(em,r)),"linePrefix")));return n;function s(i){if(i===null){e.consume(i);return}return e.enter("lineEndingBlank"),e.consume(i),e.exit("lineEndingBlank"),t.currentConstruct=void 0,n}function r(i){if(i===null){e.consume(i);return}return e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),t.currentConstruct=void 0,n}}const Ym={resolveAll:al()},Zm=ol("string"),Km=ol("text");function ol(e){return{resolveAll:al(e==="text"?Xm:void 0),tokenize:t};function t(n){const s=this,r=this.parser.constructs[e],i=n.attempt(r,o,a);return o;function o(u){return c(u)?i(u):a(u)}function a(u){if(u===null){n.consume(u);return}return n.enter("data"),n.consume(u),l}function l(u){return c(u)?(n.exit("data"),i(u)):(n.consume(u),l)}function c(u){if(u===null)return!0;const d=r[u];let m=-1;if(d)for(;++m<d.length;){const f=d[m];if(!f.previous||f.previous.call(s,s.previous))return!0}return!1}}}function al(e){return t;function t(n,s){let r=-1,i;for(;++r<=n.length;)i===void 0?n[r]&&n[r][1].type==="data"&&(i=r,r++):(!n[r]||n[r][1].type!=="data")&&(r!==i+2&&(n[i][1].end=n[r-1][1].end,n.splice(i+2,r-i-2),r=i+2),i=void 0);return e?e(n,s):n}}function Xm(e,t){let n=0;for(;++n<=e.length;)if((n===e.length||e[n][1].type==="lineEnding")&&e[n-1][1].type==="data"){const s=e[n-1][1],r=t.sliceStream(s);let i=r.length,o=-1,a=0,l;for(;i--;){const c=r[i];if(typeof c=="string"){for(o=c.length;c.charCodeAt(o-1)===32;)a++,o--;if(o)break;o=-1}else if(c===-2)l=!0,a++;else if(c!==-1){i++;break}}if(t._contentTypeTextTrailing&&n===e.length&&(a=0),a){const c={type:n===e.length||l||a<2?"lineSuffix":"hardBreakTrailing",start:{_bufferIndex:i?o:s.start._bufferIndex+o,_index:s.start._index+i,line:s.end.line,column:s.end.column-a,offset:s.end.offset-a},end:{...s.end}};s.end={...c.start},s.start.offset===s.end.offset?Object.assign(s,c):(e.splice(n,0,["enter",c,t],["exit",c,t]),n+=2)}n++}return e}const eg={42:Me,43:Me,45:Me,48:Me,49:Me,50:Me,51:Me,52:Me,53:Me,54:Me,55:Me,56:Me,57:Me,62:Xa},tg={91:im},ng={[-2]:cr,[-1]:cr,32:cr},sg={35:dm,42:Hn,45:[To,Hn],60:mm,61:To,95:Hn,96:Eo,126:Eo},rg={38:tl,92:el},ig={[-5]:ur,[-4]:ur,[-3]:ur,33:_m,38:tl,42:Or,60:[Rp,vm],91:Rm,92:[cm,el],93:ci,95:Or,96:Qp},og={null:[Or,Ym]},ag={null:[42,95]},lg={null:[]},cg=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:ag,contentInitial:tg,disable:lg,document:eg,flow:sg,flowInitial:ng,insideSpan:og,string:rg,text:ig},Symbol.toStringTag,{value:"Module"}));function ug(e,t,n){let s={_bufferIndex:-1,_index:0,line:n&&n.line||1,column:n&&n.column||1,offset:n&&n.offset||0};const r={},i=[];let o=[],a=[];const l={attempt:L(z),check:L(k),consume:I,enter:S,exit:E,interrupt:L(k,{interrupt:!0})},c={code:null,containerState:{},defineSkip:x,events:[],now:g,parser:e,previous:null,sliceSerialize:m,sliceStream:f,write:d};let u=t.tokenize.call(c,l);return t.resolveAll&&i.push(t),c;function d(N){return o=Qe(o,N),C(),o[o.length-1]!==null?[]:(R(t,0),c.events=li(i,c.events,c),c.events)}function m(N,_){return hg(f(N),_)}function f(N){return dg(o,N)}function g(){const{_bufferIndex:N,_index:_,line:D,column:F,offset:A}=s;return{_bufferIndex:N,_index:_,line:D,column:F,offset:A}}function x(N){r[N.line]=N.column,P()}function C(){let N;for(;s._index<o.length;){const _=o[s._index];if(typeof _=="string")for(N=s._index,s._bufferIndex<0&&(s._bufferIndex=0);s._index===N&&s._bufferIndex<_.length;)b(_.charCodeAt(s._bufferIndex));else b(_)}}function b(N){u=u(N)}function I(N){Z(N)?(s.line++,s.column=1,s.offset+=N===-3?2:1,P()):N!==-1&&(s.column++,s.offset++),s._bufferIndex<0?s._index++:(s._bufferIndex++,s._bufferIndex===o[s._index].length&&(s._bufferIndex=-1,s._index++)),c.previous=N}function S(N,_){const D=_||{};return D.type=N,D.start=g(),c.events.push(["enter",D,c]),a.push(D),D}function E(N){const _=a.pop();return _.end=g(),c.events.push(["exit",_,c]),_}function z(N,_){R(N,_.from)}function k(N,_){_.restore()}function L(N,_){return D;function D(F,A,T){let B,M,q,y;return Array.isArray(F)?ae(F):"tokenize"in F?ae([F]):te(F);function te(se){return fe;function fe(ge){const Le=ge!==null&&se[ge],Ae=ge!==null&&se.null,he=[...Array.isArray(Le)?Le:Le?[Le]:[],...Array.isArray(Ae)?Ae:Ae?[Ae]:[]];return ae(he)(ge)}}function ae(se){return B=se,M=0,se.length===0?T:w(se[M])}function w(se){return fe;function fe(ge){return y=O(),q=se,se.partial||(c.currentConstruct=se),se.name&&c.parser.constructs.disable.null.includes(se.name)?ee():se.tokenize.call(_?Object.assign(Object.create(c),_):c,l,W,ee)(ge)}}function W(se){return N(q,y),A}function ee(se){return y.restore(),++M<B.length?w(B[M]):T}}}function R(N,_){N.resolveAll&&!i.includes(N)&&i.push(N),N.resolve&&ot(c.events,_,c.events.length-_,N.resolve(c.events.slice(_),c)),N.resolveTo&&(c.events=N.resolveTo(c.events,c))}function O(){const N=g(),_=c.previous,D=c.currentConstruct,F=c.events.length,A=Array.from(a);return{from:F,restore:T};function T(){s=N,c.previous=_,c.currentConstruct=D,c.events.length=F,a=A,P()}}function P(){s.line in r&&s.column<2&&(s.column=r[s.line],s.offset+=r[s.line]-1)}}function dg(e,t){const n=t.start._index,s=t.start._bufferIndex,r=t.end._index,i=t.end._bufferIndex;let o;if(n===r)o=[e[n].slice(s,i)];else{if(o=e.slice(n,r),s>-1){const a=o[0];typeof a=="string"?o[0]=a.slice(s):o.shift()}i>0&&o.push(e[r].slice(0,i))}return o}function hg(e,t){let n=-1;const s=[];let r;for(;++n<e.length;){const i=e[n];let o;if(typeof i=="string")o=i;else switch(i){case-5:{o="\r";break}case-4:{o=`
|
|
11
|
-
`;break}case-3:{o=`\r
|
|
12
|
-
`;break}case-2:{o=t?" ":" ";break}case-1:{if(!t&&r)continue;o=" ";break}default:o=String.fromCharCode(i)}r=i===-2,s.push(o)}return s.join("")}function fg(e){const s={constructs:bp([cg,...(e||{}).extensions||[]]),content:r(Ip),defined:[],document:r(Np),flow:r(Qm),lazy:{},string:r(Zm),text:r(Km)};return s;function r(i){return o;function o(a){return ug(s,i,a)}}}function pg(e){for(;!nl(e););return e}const Io=/[\0\t\n\r]/g;function mg(){let e=1,t="",n=!0,s;return r;function r(i,o,a){const l=[];let c,u,d,m,f;for(i=t+(typeof i=="string"?i.toString():new TextDecoder(o||void 0).decode(i)),d=0,t="",n&&(i.charCodeAt(0)===65279&&d++,n=void 0);d<i.length;){if(Io.lastIndex=d,c=Io.exec(i),m=c&&c.index!==void 0?c.index:i.length,f=i.charCodeAt(m),!c){t=i.slice(d);break}if(f===10&&d===m&&s)l.push(-3),s=void 0;else switch(s&&(l.push(-5),s=void 0),d<m&&(l.push(i.slice(d,m)),e+=m-d),f){case 0:{l.push(65533),e++;break}case 9:{for(u=Math.ceil(e/4)*4,l.push(-2);e++<u;)l.push(-1);break}case 10:{l.push(-4),e=1;break}default:s=!0,e=1}d=m+1}return a&&(s&&l.push(-5),t&&l.push(t),l.push(null)),l}}const gg=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function yg(e){return e.replace(gg,xg)}function xg(e,t,n){if(t)return t;if(n.charCodeAt(0)===35){const r=n.charCodeAt(1),i=r===120||r===88;return Ka(n.slice(i?2:1),i?16:10)}return ai(n)||e}const ll={}.hasOwnProperty;function wg(e,t,n){return t&&typeof t=="object"&&(n=t,t=void 0),bg(n)(pg(fg(n).document().write(mg()(e,t,!0))))}function bg(e){const t={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:i(re),autolinkProtocol:O,autolinkEmail:O,atxHeading:i(pt),blockQuote:i(Ae),characterEscape:O,characterReference:O,codeFenced:i(he),codeFencedFenceInfo:o,codeFencedFenceMeta:o,codeIndented:i(he,o),codeText:i(ft,o),codeTextData:O,data:O,codeFlowValue:O,definition:i(Lt),definitionDestinationString:o,definitionLabelString:o,definitionTitleString:o,emphasis:i(_t),hardBreakEscape:i(mt),hardBreakTrailing:i(mt),htmlFlow:i(G,o),htmlFlowData:O,htmlText:i(G,o),htmlTextData:O,image:i(K),label:o,link:i(re),listItem:i(We),listItemValue:m,listOrdered:i(be,d),listUnordered:i(be),paragraph:i(de),reference:w,referenceString:o,resourceDestinationString:o,resourceTitleString:o,setextHeading:i(pt),strong:i(Te),thematicBreak:i(Ye)},exit:{atxHeading:l(),atxHeadingSequence:z,autolink:l(),autolinkEmail:Le,autolinkProtocol:ge,blockQuote:l(),characterEscapeValue:P,characterReferenceMarkerHexadecimal:ee,characterReferenceMarkerNumeric:ee,characterReferenceValue:se,characterReference:fe,codeFenced:l(C),codeFencedFence:x,codeFencedFenceInfo:f,codeFencedFenceMeta:g,codeFlowValue:P,codeIndented:l(b),codeText:l(A),codeTextData:P,data:P,definition:l(),definitionDestinationString:E,definitionLabelString:I,definitionTitleString:S,emphasis:l(),hardBreakEscape:l(_),hardBreakTrailing:l(_),htmlFlow:l(D),htmlFlowData:P,htmlText:l(F),htmlTextData:P,image:l(B),label:q,labelText:M,lineEnding:N,link:l(T),listItem:l(),listOrdered:l(),listUnordered:l(),paragraph:l(),referenceString:W,resourceDestinationString:y,resourceTitleString:te,resource:ae,setextHeading:l(R),setextHeadingLineSequence:L,setextHeadingText:k,strong:l(),thematicBreak:l()}};cl(t,(e||{}).mdastExtensions||[]);const n={};return s;function s(j){let U={type:"root",children:[]};const Q={stack:[U],tokenStack:[],config:t,enter:a,exit:c,buffer:o,resume:u,data:n},Y=[];let ie=-1;for(;++ie<j.length;)if(j[ie][1].type==="listOrdered"||j[ie][1].type==="listUnordered")if(j[ie][0]==="enter")Y.push(ie);else{const Ie=Y.pop();ie=r(j,Ie,ie)}for(ie=-1;++ie<j.length;){const Ie=t[j[ie][0]];ll.call(Ie,j[ie][1].type)&&Ie[j[ie][1].type].call(Object.assign({sliceSerialize:j[ie][2].sliceSerialize},Q),j[ie][1])}if(Q.tokenStack.length>0){const Ie=Q.tokenStack[Q.tokenStack.length-1];(Ie[1]||Ao).call(Q,void 0,Ie[0])}for(U.position={start:bt(j.length>0?j[0][1].start:{line:1,column:1,offset:0}),end:bt(j.length>0?j[j.length-2][1].end:{line:1,column:1,offset:0})},ie=-1;++ie<t.transforms.length;)U=t.transforms[ie](U)||U;return U}function r(j,U,Q){let Y=U-1,ie=-1,Ie=!1,Ze,_e,lt,je;for(;++Y<=Q;){const ye=j[Y];switch(ye[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{ye[0]==="enter"?ie++:ie--,je=void 0;break}case"lineEndingBlank":{ye[0]==="enter"&&(Ze&&!je&&!ie&&!lt&&(lt=Y),je=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:je=void 0}if(!ie&&ye[0]==="enter"&&ye[1].type==="listItemPrefix"||ie===-1&&ye[0]==="exit"&&(ye[1].type==="listUnordered"||ye[1].type==="listOrdered")){if(Ze){let He=Y;for(_e=void 0;He--;){const Fe=j[He];if(Fe[1].type==="lineEnding"||Fe[1].type==="lineEndingBlank"){if(Fe[0]==="exit")continue;_e&&(j[_e][1].type="lineEndingBlank",Ie=!0),Fe[1].type="lineEnding",_e=He}else if(!(Fe[1].type==="linePrefix"||Fe[1].type==="blockQuotePrefix"||Fe[1].type==="blockQuotePrefixWhitespace"||Fe[1].type==="blockQuoteMarker"||Fe[1].type==="listItemIndent"))break}lt&&(!_e||lt<_e)&&(Ze._spread=!0),Ze.end=Object.assign({},_e?j[_e][1].start:ye[1].end),j.splice(_e||Y,0,["exit",Ze,ye[2]]),Y++,Q++}if(ye[1].type==="listItemPrefix"){const He={type:"listItem",_spread:!1,start:Object.assign({},ye[1].start),end:void 0};Ze=He,j.splice(Y,0,["enter",He,ye[2]]),Y++,Q++,lt=void 0,je=!0}}}return j[U][1]._spread=Ie,Q}function i(j,U){return Q;function Q(Y){a.call(this,j(Y),Y),U&&U.call(this,Y)}}function o(){this.stack.push({type:"fragment",children:[]})}function a(j,U,Q){this.stack[this.stack.length-1].children.push(j),this.stack.push(j),this.tokenStack.push([U,Q||void 0]),j.position={start:bt(U.start),end:void 0}}function l(j){return U;function U(Q){j&&j.call(this,Q),c.call(this,Q)}}function c(j,U){const Q=this.stack.pop(),Y=this.tokenStack.pop();if(Y)Y[0].type!==j.type&&(U?U.call(this,j,Y[0]):(Y[1]||Ao).call(this,j,Y[0]));else throw new Error("Cannot close `"+j.type+"` ("+un({start:j.start,end:j.end})+"): it’s not open");Q.position.end=bt(j.end)}function u(){return xp(this.stack.pop())}function d(){this.data.expectingFirstListItemValue=!0}function m(j){if(this.data.expectingFirstListItemValue){const U=this.stack[this.stack.length-2];U.start=Number.parseInt(this.sliceSerialize(j),10),this.data.expectingFirstListItemValue=void 0}}function f(){const j=this.resume(),U=this.stack[this.stack.length-1];U.lang=j}function g(){const j=this.resume(),U=this.stack[this.stack.length-1];U.meta=j}function x(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function C(){const j=this.resume(),U=this.stack[this.stack.length-1];U.value=j.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function b(){const j=this.resume(),U=this.stack[this.stack.length-1];U.value=j.replace(/(\r?\n|\r)$/g,"")}function I(j){const U=this.resume(),Q=this.stack[this.stack.length-1];Q.label=U,Q.identifier=Ut(this.sliceSerialize(j)).toLowerCase()}function S(){const j=this.resume(),U=this.stack[this.stack.length-1];U.title=j}function E(){const j=this.resume(),U=this.stack[this.stack.length-1];U.url=j}function z(j){const U=this.stack[this.stack.length-1];if(!U.depth){const Q=this.sliceSerialize(j).length;U.depth=Q}}function k(){this.data.setextHeadingSlurpLineEnding=!0}function L(j){const U=this.stack[this.stack.length-1];U.depth=this.sliceSerialize(j).codePointAt(0)===61?1:2}function R(){this.data.setextHeadingSlurpLineEnding=void 0}function O(j){const Q=this.stack[this.stack.length-1].children;let Y=Q[Q.length-1];(!Y||Y.type!=="text")&&(Y=Ce(),Y.position={start:bt(j.start),end:void 0},Q.push(Y)),this.stack.push(Y)}function P(j){const U=this.stack.pop();U.value+=this.sliceSerialize(j),U.position.end=bt(j.end)}function N(j){const U=this.stack[this.stack.length-1];if(this.data.atHardBreak){const Q=U.children[U.children.length-1];Q.position.end=bt(j.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&t.canContainEols.includes(U.type)&&(O.call(this,j),P.call(this,j))}function _(){this.data.atHardBreak=!0}function D(){const j=this.resume(),U=this.stack[this.stack.length-1];U.value=j}function F(){const j=this.resume(),U=this.stack[this.stack.length-1];U.value=j}function A(){const j=this.resume(),U=this.stack[this.stack.length-1];U.value=j}function T(){const j=this.stack[this.stack.length-1];if(this.data.inReference){const U=this.data.referenceType||"shortcut";j.type+="Reference",j.referenceType=U,delete j.url,delete j.title}else delete j.identifier,delete j.label;this.data.referenceType=void 0}function B(){const j=this.stack[this.stack.length-1];if(this.data.inReference){const U=this.data.referenceType||"shortcut";j.type+="Reference",j.referenceType=U,delete j.url,delete j.title}else delete j.identifier,delete j.label;this.data.referenceType=void 0}function M(j){const U=this.sliceSerialize(j),Q=this.stack[this.stack.length-2];Q.label=yg(U),Q.identifier=Ut(U).toLowerCase()}function q(){const j=this.stack[this.stack.length-1],U=this.resume(),Q=this.stack[this.stack.length-1];if(this.data.inReference=!0,Q.type==="link"){const Y=j.children;Q.children=Y}else Q.alt=U}function y(){const j=this.resume(),U=this.stack[this.stack.length-1];U.url=j}function te(){const j=this.resume(),U=this.stack[this.stack.length-1];U.title=j}function ae(){this.data.inReference=void 0}function w(){this.data.referenceType="collapsed"}function W(j){const U=this.resume(),Q=this.stack[this.stack.length-1];Q.label=U,Q.identifier=Ut(this.sliceSerialize(j)).toLowerCase(),this.data.referenceType="full"}function ee(j){this.data.characterReferenceType=j.type}function se(j){const U=this.sliceSerialize(j),Q=this.data.characterReferenceType;let Y;Q?(Y=Ka(U,Q==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):Y=ai(U);const ie=this.stack[this.stack.length-1];ie.value+=Y}function fe(j){const U=this.stack.pop();U.position.end=bt(j.end)}function ge(j){P.call(this,j);const U=this.stack[this.stack.length-1];U.url=this.sliceSerialize(j)}function Le(j){P.call(this,j);const U=this.stack[this.stack.length-1];U.url="mailto:"+this.sliceSerialize(j)}function Ae(){return{type:"blockquote",children:[]}}function he(){return{type:"code",lang:null,meta:null,value:""}}function ft(){return{type:"inlineCode",value:""}}function Lt(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function _t(){return{type:"emphasis",children:[]}}function pt(){return{type:"heading",depth:0,children:[]}}function mt(){return{type:"break"}}function G(){return{type:"html",value:""}}function K(){return{type:"image",title:null,url:"",alt:null}}function re(){return{type:"link",title:null,url:"",children:[]}}function be(j){return{type:"list",ordered:j.type==="listOrdered",start:null,spread:j._spread,children:[]}}function We(j){return{type:"listItem",spread:j._spread,checked:null,children:[]}}function de(){return{type:"paragraph",children:[]}}function Te(){return{type:"strong",children:[]}}function Ce(){return{type:"text",value:""}}function Ye(){return{type:"thematicBreak"}}}function bt(e){return{line:e.line,column:e.column,offset:e.offset}}function cl(e,t){let n=-1;for(;++n<t.length;){const s=t[n];Array.isArray(s)?cl(e,s):Sg(e,s)}}function Sg(e,t){let n;for(n in t)if(ll.call(t,n))switch(n){case"canContainEols":{const s=t[n];s&&e[n].push(...s);break}case"transforms":{const s=t[n];s&&e[n].push(...s);break}case"enter":case"exit":{const s=t[n];s&&Object.assign(e[n],s);break}}}function Ao(e,t){throw e?new Error("Cannot close `"+e.type+"` ("+un({start:e.start,end:e.end})+"): a different token (`"+t.type+"`, "+un({start:t.start,end:t.end})+") is open"):new Error("Cannot close document, a token (`"+t.type+"`, "+un({start:t.start,end:t.end})+") is still open")}function vg(e){const t=this;t.parser=n;function n(s){return wg(s,{...t.data("settings"),...e,extensions:t.data("micromarkExtensions")||[],mdastExtensions:t.data("fromMarkdownExtensions")||[]})}}function Cg(e,t){const n={type:"element",tagName:"blockquote",properties:{},children:e.wrap(e.all(t),!0)};return e.patch(t,n),e.applyData(t,n)}function kg(e,t){const n={type:"element",tagName:"br",properties:{},children:[]};return e.patch(t,n),[e.applyData(t,n),{type:"text",value:`
|
|
13
|
-
`}]}function Eg(e,t){const n=t.value?t.value+`
|
|
14
|
-
`:"",s={},r=t.lang?t.lang.split(/\s+/):[];r.length>0&&(s.className=["language-"+r[0]]);let i={type:"element",tagName:"code",properties:s,children:[{type:"text",value:n}]};return t.meta&&(i.data={meta:t.meta}),e.patch(t,i),i=e.applyData(t,i),i={type:"element",tagName:"pre",properties:{},children:[i]},e.patch(t,i),i}function Pg(e,t){const n={type:"element",tagName:"del",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function Tg(e,t){const n={type:"element",tagName:"em",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function Ig(e,t){const n=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",s=String(t.identifier).toUpperCase(),r=Ht(s.toLowerCase()),i=e.footnoteOrder.indexOf(s);let o,a=e.footnoteCounts.get(s);a===void 0?(a=0,e.footnoteOrder.push(s),o=e.footnoteOrder.length):o=i+1,a+=1,e.footnoteCounts.set(s,a);const l={type:"element",tagName:"a",properties:{href:"#"+n+"fn-"+r,id:n+"fnref-"+r+(a>1?"-"+a:""),dataFootnoteRef:!0,ariaDescribedBy:["footnote-label"]},children:[{type:"text",value:String(o)}]};e.patch(t,l);const c={type:"element",tagName:"sup",properties:{},children:[l]};return e.patch(t,c),e.applyData(t,c)}function Ag(e,t){const n={type:"element",tagName:"h"+t.depth,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function Ng(e,t){if(e.options.allowDangerousHtml){const n={type:"raw",value:t.value};return e.patch(t,n),e.applyData(t,n)}}function ul(e,t){const n=t.referenceType;let s="]";if(n==="collapsed"?s+="[]":n==="full"&&(s+="["+(t.label||t.identifier)+"]"),t.type==="imageReference")return[{type:"text",value:"!["+t.alt+s}];const r=e.all(t),i=r[0];i&&i.type==="text"?i.value="["+i.value:r.unshift({type:"text",value:"["});const o=r[r.length-1];return o&&o.type==="text"?o.value+=s:r.push({type:"text",value:s}),r}function zg(e,t){const n=String(t.identifier).toUpperCase(),s=e.definitionById.get(n);if(!s)return ul(e,t);const r={src:Ht(s.url||""),alt:t.alt};s.title!==null&&s.title!==void 0&&(r.title=s.title);const i={type:"element",tagName:"img",properties:r,children:[]};return e.patch(t,i),e.applyData(t,i)}function Lg(e,t){const n={src:Ht(t.url)};t.alt!==null&&t.alt!==void 0&&(n.alt=t.alt),t.title!==null&&t.title!==void 0&&(n.title=t.title);const s={type:"element",tagName:"img",properties:n,children:[]};return e.patch(t,s),e.applyData(t,s)}function _g(e,t){const n={type:"text",value:t.value.replace(/\r?\n|\r/g," ")};e.patch(t,n);const s={type:"element",tagName:"code",properties:{},children:[n]};return e.patch(t,s),e.applyData(t,s)}function jg(e,t){const n=String(t.identifier).toUpperCase(),s=e.definitionById.get(n);if(!s)return ul(e,t);const r={href:Ht(s.url||"")};s.title!==null&&s.title!==void 0&&(r.title=s.title);const i={type:"element",tagName:"a",properties:r,children:e.all(t)};return e.patch(t,i),e.applyData(t,i)}function Rg(e,t){const n={href:Ht(t.url)};t.title!==null&&t.title!==void 0&&(n.title=t.title);const s={type:"element",tagName:"a",properties:n,children:e.all(t)};return e.patch(t,s),e.applyData(t,s)}function Mg(e,t,n){const s=e.all(t),r=n?Og(n):dl(t),i={},o=[];if(typeof t.checked=="boolean"){const u=s[0];let d;u&&u.type==="element"&&u.tagName==="p"?d=u:(d={type:"element",tagName:"p",properties:{},children:[]},s.unshift(d)),d.children.length>0&&d.children.unshift({type:"text",value:" "}),d.children.unshift({type:"element",tagName:"input",properties:{type:"checkbox",checked:t.checked,disabled:!0},children:[]}),i.className=["task-list-item"]}let a=-1;for(;++a<s.length;){const u=s[a];(r||a!==0||u.type!=="element"||u.tagName!=="p")&&o.push({type:"text",value:`
|
|
15
|
-
`}),u.type==="element"&&u.tagName==="p"&&!r?o.push(...u.children):o.push(u)}const l=s[s.length-1];l&&(r||l.type!=="element"||l.tagName!=="p")&&o.push({type:"text",value:`
|
|
16
|
-
`});const c={type:"element",tagName:"li",properties:i,children:o};return e.patch(t,c),e.applyData(t,c)}function Og(e){let t=!1;if(e.type==="list"){t=e.spread||!1;const n=e.children;let s=-1;for(;!t&&++s<n.length;)t=dl(n[s])}return t}function dl(e){const t=e.spread;return t??e.children.length>1}function Dg(e,t){const n={},s=e.all(t);let r=-1;for(typeof t.start=="number"&&t.start!==1&&(n.start=t.start);++r<s.length;){const o=s[r];if(o.type==="element"&&o.tagName==="li"&&o.properties&&Array.isArray(o.properties.className)&&o.properties.className.includes("task-list-item")){n.className=["contains-task-list"];break}}const i={type:"element",tagName:t.ordered?"ol":"ul",properties:n,children:e.wrap(s,!0)};return e.patch(t,i),e.applyData(t,i)}function Fg(e,t){const n={type:"element",tagName:"p",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function Bg(e,t){const n={type:"root",children:e.wrap(e.all(t))};return e.patch(t,n),e.applyData(t,n)}function $g(e,t){const n={type:"element",tagName:"strong",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function Vg(e,t){const n=e.all(t),s=n.shift(),r=[];if(s){const o={type:"element",tagName:"thead",properties:{},children:e.wrap([s],!0)};e.patch(t.children[0],o),r.push(o)}if(n.length>0){const o={type:"element",tagName:"tbody",properties:{},children:e.wrap(n,!0)},a=si(t.children[1]),l=Wa(t.children[t.children.length-1]);a&&l&&(o.position={start:a,end:l}),r.push(o)}const i={type:"element",tagName:"table",properties:{},children:e.wrap(r,!0)};return e.patch(t,i),e.applyData(t,i)}function Ug(e,t,n){const s=n?n.children:void 0,i=(s?s.indexOf(t):1)===0?"th":"td",o=n&&n.type==="table"?n.align:void 0,a=o?o.length:t.children.length;let l=-1;const c=[];for(;++l<a;){const d=t.children[l],m={},f=o?o[l]:void 0;f&&(m.align=f);let g={type:"element",tagName:i,properties:m,children:[]};d&&(g.children=e.all(d),e.patch(d,g),g=e.applyData(d,g)),c.push(g)}const u={type:"element",tagName:"tr",properties:{},children:e.wrap(c,!0)};return e.patch(t,u),e.applyData(t,u)}function qg(e,t){const n={type:"element",tagName:"td",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}const No=9,zo=32;function Wg(e){const t=String(e),n=/\r?\n|\r/g;let s=n.exec(t),r=0;const i=[];for(;s;)i.push(Lo(t.slice(r,s.index),r>0,!0),s[0]),r=s.index+s[0].length,s=n.exec(t);return i.push(Lo(t.slice(r),r>0,!1)),i.join("")}function Lo(e,t,n){let s=0,r=e.length;if(t){let i=e.codePointAt(s);for(;i===No||i===zo;)s++,i=e.codePointAt(s)}if(n){let i=e.codePointAt(r-1);for(;i===No||i===zo;)r--,i=e.codePointAt(r-1)}return r>s?e.slice(s,r):""}function Hg(e,t){const n={type:"text",value:Wg(String(t.value))};return e.patch(t,n),e.applyData(t,n)}function Gg(e,t){const n={type:"element",tagName:"hr",properties:{},children:[]};return e.patch(t,n),e.applyData(t,n)}const Qg={blockquote:Cg,break:kg,code:Eg,delete:Pg,emphasis:Tg,footnoteReference:Ig,heading:Ag,html:Ng,imageReference:zg,image:Lg,inlineCode:_g,linkReference:jg,link:Rg,listItem:Mg,list:Dg,paragraph:Fg,root:Bg,strong:$g,table:Vg,tableCell:qg,tableRow:Ug,text:Hg,thematicBreak:Gg,toml:_n,yaml:_n,definition:_n,footnoteDefinition:_n};function _n(){}const hl=-1,is=0,hn=1,ts=2,ui=3,di=4,hi=5,fi=6,fl=7,pl=8,Jg=typeof self=="object"?self:globalThis,_o=(e,t)=>{switch(e){case"Function":case"SharedWorker":case"Worker":case"eval":case"setInterval":case"setTimeout":throw new TypeError("unable to deserialize "+e)}return new Jg[e](t)},Yg=(e,t)=>{const n=(r,i)=>(e.set(i,r),r),s=r=>{if(e.has(r))return e.get(r);const[i,o]=t[r];switch(i){case is:case hl:return n(o,r);case hn:{const a=n([],r);for(const l of o)a.push(s(l));return a}case ts:{const a=n({},r);for(const[l,c]of o)a[s(l)]=s(c);return a}case ui:return n(new Date(o),r);case di:{const{source:a,flags:l}=o;return n(new RegExp(a,l),r)}case hi:{const a=n(new Map,r);for(const[l,c]of o)a.set(s(l),s(c));return a}case fi:{const a=n(new Set,r);for(const l of o)a.add(s(l));return a}case fl:{const{name:a,message:l}=o;return n(_o(a,l),r)}case pl:return n(BigInt(o),r);case"BigInt":return n(Object(BigInt(o)),r);case"ArrayBuffer":return n(new Uint8Array(o).buffer,o);case"DataView":{const{buffer:a}=new Uint8Array(o);return n(new DataView(a),o)}}return n(_o(i,o),r)};return s},jo=e=>Yg(new Map,e)(0),$t="",{toString:Zg}={},{keys:Kg}=Object,an=e=>{const t=typeof e;if(t!=="object"||!e)return[is,t];const n=Zg.call(e).slice(8,-1);switch(n){case"Array":return[hn,$t];case"Object":return[ts,$t];case"Date":return[ui,$t];case"RegExp":return[di,$t];case"Map":return[hi,$t];case"Set":return[fi,$t];case"DataView":return[hn,n]}return n.includes("Array")?[hn,n]:n.includes("Error")?[fl,n]:[ts,n]},jn=([e,t])=>e===is&&(t==="function"||t==="symbol"),Xg=(e,t,n,s)=>{const r=(o,a)=>{const l=s.push(o)-1;return n.set(a,l),l},i=o=>{if(n.has(o))return n.get(o);let[a,l]=an(o);switch(a){case is:{let u=o;switch(l){case"bigint":a=pl,u=o.toString();break;case"function":case"symbol":if(e)throw new TypeError("unable to serialize "+l);u=null;break;case"undefined":return r([hl],o)}return r([a,u],o)}case hn:{if(l){let m=o;return l==="DataView"?m=new Uint8Array(o.buffer):l==="ArrayBuffer"&&(m=new Uint8Array(o)),r([l,[...m]],o)}const u=[],d=r([a,u],o);for(const m of o)u.push(i(m));return d}case ts:{if(l)switch(l){case"BigInt":return r([l,o.toString()],o);case"Boolean":case"Number":case"String":return r([l,o.valueOf()],o)}if(t&&"toJSON"in o)return i(o.toJSON());const u=[],d=r([a,u],o);for(const m of Kg(o))(e||!jn(an(o[m])))&&u.push([i(m),i(o[m])]);return d}case ui:return r([a,o.toISOString()],o);case di:{const{source:u,flags:d}=o;return r([a,{source:u,flags:d}],o)}case hi:{const u=[],d=r([a,u],o);for(const[m,f]of o)(e||!(jn(an(m))||jn(an(f))))&&u.push([i(m),i(f)]);return d}case fi:{const u=[],d=r([a,u],o);for(const m of o)(e||!jn(an(m)))&&u.push(i(m));return d}}const{message:c}=o;return r([a,{name:l,message:c}],o)};return i},Ro=(e,{json:t,lossy:n}={})=>{const s=[];return Xg(!(t||n),!!t,new Map,s)(e),s},ns=typeof structuredClone=="function"?(e,t)=>t&&("json"in t||"lossy"in t)?jo(Ro(e,t)):structuredClone(e):(e,t)=>jo(Ro(e,t));function ey(e,t){const n=[{type:"text",value:"↩"}];return t>1&&n.push({type:"element",tagName:"sup",properties:{},children:[{type:"text",value:String(t)}]}),n}function ty(e,t){return"Back to reference "+(e+1)+(t>1?"-"+t:"")}function ny(e){const t=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",n=e.options.footnoteBackContent||ey,s=e.options.footnoteBackLabel||ty,r=e.options.footnoteLabel||"Footnotes",i=e.options.footnoteLabelTagName||"h2",o=e.options.footnoteLabelProperties||{className:["sr-only"]},a=[];let l=-1;for(;++l<e.footnoteOrder.length;){const c=e.footnoteById.get(e.footnoteOrder[l]);if(!c)continue;const u=e.all(c),d=String(c.identifier).toUpperCase(),m=Ht(d.toLowerCase());let f=0;const g=[],x=e.footnoteCounts.get(d);for(;x!==void 0&&++f<=x;){g.length>0&&g.push({type:"text",value:" "});let I=typeof n=="string"?n:n(l,f);typeof I=="string"&&(I={type:"text",value:I}),g.push({type:"element",tagName:"a",properties:{href:"#"+t+"fnref-"+m+(f>1?"-"+f:""),dataFootnoteBackref:"",ariaLabel:typeof s=="string"?s:s(l,f),className:["data-footnote-backref"]},children:Array.isArray(I)?I:[I]})}const C=u[u.length-1];if(C&&C.type==="element"&&C.tagName==="p"){const I=C.children[C.children.length-1];I&&I.type==="text"?I.value+=" ":C.children.push({type:"text",value:" "}),C.children.push(...g)}else u.push(...g);const b={type:"element",tagName:"li",properties:{id:t+"fn-"+m},children:e.wrap(u,!0)};e.patch(c,b),a.push(b)}if(a.length!==0)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:i,properties:{...ns(o),id:"footnote-label"},children:[{type:"text",value:r}]},{type:"text",value:`
|
|
17
|
-
`},{type:"element",tagName:"ol",properties:{},children:e.wrap(a,!0)},{type:"text",value:`
|
|
18
|
-
`}]}}const ml=(function(e){if(e==null)return oy;if(typeof e=="function")return os(e);if(typeof e=="object")return Array.isArray(e)?sy(e):ry(e);if(typeof e=="string")return iy(e);throw new Error("Expected function, string, or object as test")});function sy(e){const t=[];let n=-1;for(;++n<e.length;)t[n]=ml(e[n]);return os(s);function s(...r){let i=-1;for(;++i<t.length;)if(t[i].apply(this,r))return!0;return!1}}function ry(e){const t=e;return os(n);function n(s){const r=s;let i;for(i in e)if(r[i]!==t[i])return!1;return!0}}function iy(e){return os(t);function t(n){return n&&n.type===e}}function os(e){return t;function t(n,s,r){return!!(ay(n)&&e.call(this,n,typeof s=="number"?s:void 0,r||void 0))}}function oy(){return!0}function ay(e){return e!==null&&typeof e=="object"&&"type"in e}const gl=[],ly=!0,Mo=!1,cy="skip";function uy(e,t,n,s){let r;typeof t=="function"&&typeof n!="function"?(s=n,n=t):r=t;const i=ml(r),o=s?-1:1;a(e,void 0,[])();function a(l,c,u){const d=l&&typeof l=="object"?l:{};if(typeof d.type=="string"){const f=typeof d.tagName=="string"?d.tagName:typeof d.name=="string"?d.name:void 0;Object.defineProperty(m,"name",{value:"node ("+(l.type+(f?"<"+f+">":""))+")"})}return m;function m(){let f=gl,g,x,C;if((!t||i(l,c,u[u.length-1]||void 0))&&(f=dy(n(l,u)),f[0]===Mo))return f;if("children"in l&&l.children){const b=l;if(b.children&&f[0]!==cy)for(x=(s?b.children.length:-1)+o,C=u.concat(b);x>-1&&x<b.children.length;){const I=b.children[x];if(g=a(I,x,C)(),g[0]===Mo)return g;x=typeof g[1]=="number"?g[1]:x+o}}return f}}}function dy(e){return Array.isArray(e)?e:typeof e=="number"?[ly,e]:e==null?gl:[e]}function yl(e,t,n,s){let r,i,o;typeof t=="function"&&typeof n!="function"?(i=void 0,o=t,r=n):(i=t,o=n,r=s),uy(e,i,a,r);function a(l,c){const u=c[c.length-1],d=u?u.children.indexOf(l):void 0;return o(l,d,u)}}const Dr={}.hasOwnProperty,hy={};function fy(e,t){const n=t||hy,s=new Map,r=new Map,i=new Map,o={...Qg,...n.handlers},a={all:c,applyData:my,definitionById:s,footnoteById:r,footnoteCounts:i,footnoteOrder:[],handlers:o,one:l,options:n,patch:py,wrap:yy};return yl(e,function(u){if(u.type==="definition"||u.type==="footnoteDefinition"){const d=u.type==="definition"?s:r,m=String(u.identifier).toUpperCase();d.has(m)||d.set(m,u)}}),a;function l(u,d){const m=u.type,f=a.handlers[m];if(Dr.call(a.handlers,m)&&f)return f(a,u,d);if(a.options.passThrough&&a.options.passThrough.includes(m)){if("children"in u){const{children:x,...C}=u,b=ns(C);return b.children=a.all(u),b}return ns(u)}return(a.options.unknownHandler||gy)(a,u,d)}function c(u){const d=[];if("children"in u){const m=u.children;let f=-1;for(;++f<m.length;){const g=a.one(m[f],u);if(g){if(f&&m[f-1].type==="break"&&(!Array.isArray(g)&&g.type==="text"&&(g.value=Oo(g.value)),!Array.isArray(g)&&g.type==="element")){const x=g.children[0];x&&x.type==="text"&&(x.value=Oo(x.value))}Array.isArray(g)?d.push(...g):d.push(g)}}}return d}}function py(e,t){e.position&&(t.position=Yf(e))}function my(e,t){let n=t;if(e&&e.data){const s=e.data.hName,r=e.data.hChildren,i=e.data.hProperties;if(typeof s=="string")if(n.type==="element")n.tagName=s;else{const o="children"in n?n.children:[n];n={type:"element",tagName:s,properties:{},children:o}}n.type==="element"&&i&&Object.assign(n.properties,ns(i)),"children"in n&&n.children&&r!==null&&r!==void 0&&(n.children=r)}return n}function gy(e,t){const n=t.data||{},s="value"in t&&!(Dr.call(n,"hProperties")||Dr.call(n,"hChildren"))?{type:"text",value:t.value}:{type:"element",tagName:"div",properties:{},children:e.all(t)};return e.patch(t,s),e.applyData(t,s)}function yy(e,t){const n=[];let s=-1;for(t&&n.push({type:"text",value:`
|
|
19
|
-
`});++s<e.length;)s&&n.push({type:"text",value:`
|
|
20
|
-
`}),n.push(e[s]);return t&&e.length>0&&n.push({type:"text",value:`
|
|
21
|
-
`}),n}function Oo(e){let t=0,n=e.charCodeAt(t);for(;n===9||n===32;)t++,n=e.charCodeAt(t);return e.slice(t)}function Do(e,t){const n=fy(e,t),s=n.one(e,void 0),r=ny(n),i=Array.isArray(s)?{type:"root",children:s}:s||{type:"root",children:[]};return r&&i.children.push({type:"text",value:`
|
|
22
|
-
`},r),i}function xy(e,t){return e&&"run"in e?async function(n,s){const r=Do(n,{file:s,...t});await e.run(r,s)}:function(n,s){return Do(n,{file:s,...e||t})}}function Fo(e){if(e)throw e}var dr,Bo;function wy(){if(Bo)return dr;Bo=1;var e=Object.prototype.hasOwnProperty,t=Object.prototype.toString,n=Object.defineProperty,s=Object.getOwnPropertyDescriptor,r=function(c){return typeof Array.isArray=="function"?Array.isArray(c):t.call(c)==="[object Array]"},i=function(c){if(!c||t.call(c)!=="[object Object]")return!1;var u=e.call(c,"constructor"),d=c.constructor&&c.constructor.prototype&&e.call(c.constructor.prototype,"isPrototypeOf");if(c.constructor&&!u&&!d)return!1;var m;for(m in c);return typeof m>"u"||e.call(c,m)},o=function(c,u){n&&u.name==="__proto__"?n(c,u.name,{enumerable:!0,configurable:!0,value:u.newValue,writable:!0}):c[u.name]=u.newValue},a=function(c,u){if(u==="__proto__")if(e.call(c,u)){if(s)return s(c,u).value}else return;return c[u]};return dr=function l(){var c,u,d,m,f,g,x=arguments[0],C=1,b=arguments.length,I=!1;for(typeof x=="boolean"&&(I=x,x=arguments[1]||{},C=2),(x==null||typeof x!="object"&&typeof x!="function")&&(x={});C<b;++C)if(c=arguments[C],c!=null)for(u in c)d=a(x,u),m=a(c,u),x!==m&&(I&&m&&(i(m)||(f=r(m)))?(f?(f=!1,g=d&&r(d)?d:[]):g=d&&i(d)?d:{},o(x,{name:u,newValue:l(I,g,m)})):typeof m<"u"&&o(x,{name:u,newValue:m}));return x},dr}var by=wy();const hr=Ca(by);function Fr(e){if(typeof e!="object"||e===null)return!1;const t=Object.getPrototypeOf(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)}function Sy(){const e=[],t={run:n,use:s};return t;function n(...r){let i=-1;const o=r.pop();if(typeof o!="function")throw new TypeError("Expected function as last argument, not "+o);a(null,...r);function a(l,...c){const u=e[++i];let d=-1;if(l){o(l);return}for(;++d<r.length;)(c[d]===null||c[d]===void 0)&&(c[d]=r[d]);r=c,u?vy(u,a)(...c):o(null,...c)}}function s(r){if(typeof r!="function")throw new TypeError("Expected `middelware` to be a function, not "+r);return e.push(r),t}}function vy(e,t){let n;return s;function s(...o){const a=e.length>o.length;let l;a&&o.push(r);try{l=e.apply(this,o)}catch(c){const u=c;if(a&&n)throw u;return r(u)}a||(l&&l.then&&typeof l.then=="function"?l.then(i,r):l instanceof Error?r(l):i(l))}function r(o,...a){n||(n=!0,t(o,...a))}function i(o){r(null,o)}}const nt={basename:Cy,dirname:ky,extname:Ey,join:Py,sep:"/"};function Cy(e,t){if(t!==void 0&&typeof t!="string")throw new TypeError('"ext" argument must be a string');xn(e);let n=0,s=-1,r=e.length,i;if(t===void 0||t.length===0||t.length>e.length){for(;r--;)if(e.codePointAt(r)===47){if(i){n=r+1;break}}else s<0&&(i=!0,s=r+1);return s<0?"":e.slice(n,s)}if(t===e)return"";let o=-1,a=t.length-1;for(;r--;)if(e.codePointAt(r)===47){if(i){n=r+1;break}}else o<0&&(i=!0,o=r+1),a>-1&&(e.codePointAt(r)===t.codePointAt(a--)?a<0&&(s=r):(a=-1,s=o));return n===s?s=o:s<0&&(s=e.length),e.slice(n,s)}function ky(e){if(xn(e),e.length===0)return".";let t=-1,n=e.length,s;for(;--n;)if(e.codePointAt(n)===47){if(s){t=n;break}}else s||(s=!0);return t<0?e.codePointAt(0)===47?"/":".":t===1&&e.codePointAt(0)===47?"//":e.slice(0,t)}function Ey(e){xn(e);let t=e.length,n=-1,s=0,r=-1,i=0,o;for(;t--;){const a=e.codePointAt(t);if(a===47){if(o){s=t+1;break}continue}n<0&&(o=!0,n=t+1),a===46?r<0?r=t:i!==1&&(i=1):r>-1&&(i=-1)}return r<0||n<0||i===0||i===1&&r===n-1&&r===s+1?"":e.slice(r,n)}function Py(...e){let t=-1,n;for(;++t<e.length;)xn(e[t]),e[t]&&(n=n===void 0?e[t]:n+"/"+e[t]);return n===void 0?".":Ty(n)}function Ty(e){xn(e);const t=e.codePointAt(0)===47;let n=Iy(e,!t);return n.length===0&&!t&&(n="."),n.length>0&&e.codePointAt(e.length-1)===47&&(n+="/"),t?"/"+n:n}function Iy(e,t){let n="",s=0,r=-1,i=0,o=-1,a,l;for(;++o<=e.length;){if(o<e.length)a=e.codePointAt(o);else{if(a===47)break;a=47}if(a===47){if(!(r===o-1||i===1))if(r!==o-1&&i===2){if(n.length<2||s!==2||n.codePointAt(n.length-1)!==46||n.codePointAt(n.length-2)!==46){if(n.length>2){if(l=n.lastIndexOf("/"),l!==n.length-1){l<0?(n="",s=0):(n=n.slice(0,l),s=n.length-1-n.lastIndexOf("/")),r=o,i=0;continue}}else if(n.length>0){n="",s=0,r=o,i=0;continue}}t&&(n=n.length>0?n+"/..":"..",s=2)}else n.length>0?n+="/"+e.slice(r+1,o):n=e.slice(r+1,o),s=o-r-1;r=o,i=0}else a===46&&i>-1?i++:i=-1}return n}function xn(e){if(typeof e!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}const Ay={cwd:Ny};function Ny(){return"/"}function Br(e){return!!(e!==null&&typeof e=="object"&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&e.auth===void 0)}function zy(e){if(typeof e=="string")e=new URL(e);else if(!Br(e)){const t=new TypeError('The "path" argument must be of type string or an instance of URL. Received `'+e+"`");throw t.code="ERR_INVALID_ARG_TYPE",t}if(e.protocol!=="file:"){const t=new TypeError("The URL must be of scheme file");throw t.code="ERR_INVALID_URL_SCHEME",t}return Ly(e)}function Ly(e){if(e.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 t=e.pathname;let n=-1;for(;++n<t.length;)if(t.codePointAt(n)===37&&t.codePointAt(n+1)===50){const s=t.codePointAt(n+2);if(s===70||s===102){const r=new TypeError("File URL path must not include encoded / characters");throw r.code="ERR_INVALID_FILE_URL_PATH",r}}return decodeURIComponent(t)}const fr=["history","path","basename","stem","extname","dirname"];class xl{constructor(t){let n;t?Br(t)?n={path:t}:typeof t=="string"||_y(t)?n={value:t}:n=t:n={},this.cwd="cwd"in n?"":Ay.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let s=-1;for(;++s<fr.length;){const i=fr[s];i in n&&n[i]!==void 0&&n[i]!==null&&(this[i]=i==="history"?[...n[i]]:n[i])}let r;for(r in n)fr.includes(r)||(this[r]=n[r])}get basename(){return typeof this.path=="string"?nt.basename(this.path):void 0}set basename(t){mr(t,"basename"),pr(t,"basename"),this.path=nt.join(this.dirname||"",t)}get dirname(){return typeof this.path=="string"?nt.dirname(this.path):void 0}set dirname(t){$o(this.basename,"dirname"),this.path=nt.join(t||"",this.basename)}get extname(){return typeof this.path=="string"?nt.extname(this.path):void 0}set extname(t){if(pr(t,"extname"),$o(this.dirname,"extname"),t){if(t.codePointAt(0)!==46)throw new Error("`extname` must start with `.`");if(t.includes(".",1))throw new Error("`extname` cannot contain multiple dots")}this.path=nt.join(this.dirname,this.stem+(t||""))}get path(){return this.history[this.history.length-1]}set path(t){Br(t)&&(t=zy(t)),mr(t,"path"),this.path!==t&&this.history.push(t)}get stem(){return typeof this.path=="string"?nt.basename(this.path,this.extname):void 0}set stem(t){mr(t,"stem"),pr(t,"stem"),this.path=nt.join(this.dirname||"",t+(this.extname||""))}fail(t,n,s){const r=this.message(t,n,s);throw r.fatal=!0,r}info(t,n,s){const r=this.message(t,n,s);return r.fatal=void 0,r}message(t,n,s){const r=new ze(t,n,s);return this.path&&(r.name=this.path+":"+r.name,r.file=this.path),r.fatal=!1,this.messages.push(r),r}toString(t){return this.value===void 0?"":typeof this.value=="string"?this.value:new TextDecoder(t||void 0).decode(this.value)}}function pr(e,t){if(e&&e.includes(nt.sep))throw new Error("`"+t+"` cannot be a path: did not expect `"+nt.sep+"`")}function mr(e,t){if(!e)throw new Error("`"+t+"` cannot be empty")}function $o(e,t){if(!e)throw new Error("Setting `"+t+"` requires `path` to be set too")}function _y(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const jy=(function(e){const s=this.constructor.prototype,r=s[e],i=function(){return r.apply(i,arguments)};return Object.setPrototypeOf(i,s),i}),Ry={}.hasOwnProperty;class pi extends jy{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=Sy()}copy(){const t=new pi;let n=-1;for(;++n<this.attachers.length;){const s=this.attachers[n];t.use(...s)}return t.data(hr(!0,{},this.namespace)),t}data(t,n){return typeof t=="string"?arguments.length===2?(xr("data",this.frozen),this.namespace[t]=n,this):Ry.call(this.namespace,t)&&this.namespace[t]||void 0:t?(xr("data",this.frozen),this.namespace=t,this):this.namespace}freeze(){if(this.frozen)return this;const t=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 r=n.call(t,...s);typeof r=="function"&&this.transformers.use(r)}return this.frozen=!0,this.freezeIndex=Number.POSITIVE_INFINITY,this}parse(t){this.freeze();const n=Rn(t),s=this.parser||this.Parser;return gr("parse",s),s(String(n),n)}process(t,n){const s=this;return this.freeze(),gr("process",this.parser||this.Parser),yr("process",this.compiler||this.Compiler),n?r(void 0,n):new Promise(r);function r(i,o){const a=Rn(t),l=s.parse(a);s.run(l,a,function(u,d,m){if(u||!d||!m)return c(u);const f=d,g=s.stringify(f,m);Dy(g)?m.value=g:m.result=g,c(u,m)});function c(u,d){u||!d?o(u):i?i(d):n(void 0,d)}}}processSync(t){let n=!1,s;return this.freeze(),gr("processSync",this.parser||this.Parser),yr("processSync",this.compiler||this.Compiler),this.process(t,r),Uo("processSync","process",n),s;function r(i,o){n=!0,Fo(i),s=o}}run(t,n,s){Vo(t),this.freeze();const r=this.transformers;return!s&&typeof n=="function"&&(s=n,n=void 0),s?i(void 0,s):new Promise(i);function i(o,a){const l=Rn(n);r.run(t,l,c);function c(u,d,m){const f=d||t;u?a(u):o?o(f):s(void 0,f,m)}}}runSync(t,n){let s=!1,r;return this.run(t,n,i),Uo("runSync","run",s),r;function i(o,a){Fo(o),r=a,s=!0}}stringify(t,n){this.freeze();const s=Rn(n),r=this.compiler||this.Compiler;return yr("stringify",r),Vo(t),r(t,s)}use(t,...n){const s=this.attachers,r=this.namespace;if(xr("use",this.frozen),t!=null)if(typeof t=="function")l(t,n);else if(typeof t=="object")Array.isArray(t)?a(t):o(t);else throw new TypeError("Expected usable value, not `"+t+"`");return this;function i(c){if(typeof c=="function")l(c,[]);else if(typeof c=="object")if(Array.isArray(c)){const[u,...d]=c;l(u,d)}else o(c);else throw new TypeError("Expected usable value, not `"+c+"`")}function o(c){if(!("plugins"in c)&&!("settings"in c))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");a(c.plugins),c.settings&&(r.settings=hr(!0,r.settings,c.settings))}function a(c){let u=-1;if(c!=null)if(Array.isArray(c))for(;++u<c.length;){const d=c[u];i(d)}else throw new TypeError("Expected a list of plugins, not `"+c+"`")}function l(c,u){let d=-1,m=-1;for(;++d<s.length;)if(s[d][0]===c){m=d;break}if(m===-1)s.push([c,...u]);else if(u.length>0){let[f,...g]=u;const x=s[m][1];Fr(x)&&Fr(f)&&(f=hr(!0,x,f)),s[m]=[c,f,...g]}}}}const My=new pi().freeze();function gr(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `parser`")}function yr(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `compiler`")}function xr(e,t){if(t)throw new Error("Cannot call `"+e+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function Vo(e){if(!Fr(e)||typeof e.type!="string")throw new TypeError("Expected node, got `"+e+"`")}function Uo(e,t,n){if(!n)throw new Error("`"+e+"` finished async. Use `"+t+"` instead")}function Rn(e){return Oy(e)?e:new xl(e)}function Oy(e){return!!(e&&typeof e=="object"&&"message"in e&&"messages"in e)}function Dy(e){return typeof e=="string"||Fy(e)}function Fy(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const By="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",qo=[],Wo={allowDangerousHtml:!0},$y=/^(https?|ircs?|mailto|xmpp)$/i,Vy=[{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 Uy(e){const t=qy(e),n=Wy(e);return Hy(t.runSync(t.parse(n),n),e)}function qy(e){const t=e.rehypePlugins||qo,n=e.remarkPlugins||qo,s=e.remarkRehypeOptions?{...e.remarkRehypeOptions,...Wo}:Wo;return My().use(vg).use(n).use(xy,s).use(t)}function Wy(e){const t=e.children||"",n=new xl;return typeof t=="string"&&(n.value=t),n}function Hy(e,t){const n=t.allowedElements,s=t.allowElement,r=t.components,i=t.disallowedElements,o=t.skipHtml,a=t.unwrapDisallowed,l=t.urlTransform||Gy;for(const u of Vy)Object.hasOwn(t,u.from)&&(""+u.from+(u.to?"use `"+u.to+"` instead":"remove it")+By+u.id,void 0);return yl(e,c),tp(e,{Fragment:h.Fragment,components:r,ignoreInvalidStyle:!0,jsx:h.jsx,jsxs:h.jsxs,passKeys:!0,passNode:!0});function c(u,d,m){if(u.type==="raw"&&m&&typeof d=="number")return o?m.children.splice(d,1):m.children[d]={type:"text",value:u.value},d;if(u.type==="element"){let f;for(f in lr)if(Object.hasOwn(lr,f)&&Object.hasOwn(u.properties,f)){const g=u.properties[f],x=lr[f];(x===null||x.includes(u.tagName))&&(u.properties[f]=l(String(g||""),f,u))}}if(u.type==="element"){let f=n?!n.includes(u.tagName):i?i.includes(u.tagName):!1;if(!f&&s&&typeof d=="number"&&(f=!s(u,d,m)),f&&m&&typeof d=="number")return a&&u.children?m.children.splice(d,1,...u.children):m.children.splice(d,1),d}}}function Gy(e){const t=e.indexOf(":"),n=e.indexOf("?"),s=e.indexOf("#"),r=e.indexOf("/");return t===-1||r!==-1&&t>r||n!==-1&&t>n||s!==-1&&t>s||$y.test(e.slice(0,t))?e:""}const wl=p.createContext(null);function Qy({children:e,host:t}){return h.jsx(wl.Provider,{value:t,children:e})}function bl(){const e=p.useContext(wl);if(!e)throw new Error("usePluginHost must be used within PluginHostProvider");return e}const Sl="openlearn:dashboardVisibility";function Jy(){try{const e=localStorage.getItem(Sl);if(e)return new Map(JSON.parse(e))}catch{}return new Map}function Ho(e){try{localStorage.setItem(Sl,JSON.stringify([...e.entries()]))}catch{}}const ve=Rh()((e,t)=>({activePlugins:[],extensionPoints:new Map,services:null,dashboardVisibility:Jy(),initialized:!1,initialize:n=>e({services:n,initialized:!0}),addPlugin:n=>e(s=>({activePlugins:[...s.activePlugins,n]})),removePlugin:n=>e(s=>({activePlugins:s.activePlugins.filter(r=>r.id!==n)})),updatePluginState:(n,s)=>e(r=>({activePlugins:r.activePlugins.map(i=>i.id===n?{...i,state:s}:i)})),registerExtensionPoint:(n,s)=>e(r=>{const i=r.extensionPoints.get(n)??[];if(i.find(l=>l.id===s.id)){const l=new Map(r.extensionPoints);return l.set(n,i.map(c=>c.id===s.id?s:c)),{extensionPoints:l}}const a=new Map(r.extensionPoints);return a.set(n,[...i,s]),{extensionPoints:a}}),unregisterExtensionPoint:(n,s)=>e(r=>{const i=r.extensionPoints.get(n);if(!i)return r;const o=i.filter(l=>l.id!==s),a=new Map(r.extensionPoints);return o.length===0?a.delete(n):a.set(n,o),{extensionPoints:a}}),unregisterPluginExtensionPoints:n=>e(s=>{const r=new Map(s.extensionPoints);for(const[i,o]of r){const a=o.filter(l=>l.pluginId!==n);a.length===0?r.delete(i):r.set(i,a)}return{extensionPoints:r}}),getExtensions:n=>[...t().extensionPoints.get(n)??[]].sort((r,i)=>(r.position??100)-(i.position??100)),setDashboardVisibility:(n,s)=>e(r=>{const i=new Map(r.dashboardVisibility);return i.set(n,s),Ho(i),{dashboardVisibility:i}}),setDashboardVisibilityBatch:n=>e(s=>{const r=new Map(s.dashboardVisibility);for(const[i,o]of n)r.set(i,o);return Ho(r),{dashboardVisibility:r}})}));function Yy(){return h.jsx("div",{className:"w-full h-32 bg-gray-100 rounded-xl animate-pulse flex items-center justify-center",children:h.jsxs("div",{className:"flex flex-col items-center gap-2",children:[h.jsx(Xr,{size:24,className:"text-gray-400 animate-spin"}),h.jsx("span",{className:"text-xs text-gray-400",children:"Loading..."})]})})}class Zy extends it.Component{constructor(t){super(t),this.state={hasError:!1},this.props=t}static getDerivedStateFromError(){return{hasError:!0}}render(){return this.state.hasError?this.props.fallback??null:this.props.children}}function Ky({ext:e,route:t,slotProps:n,slot:s}){const r=it.useRef(null),i=JSON.stringify(n||{});it.useEffect(()=>{r.current&&typeof e.render=="function"&&(r.current.innerHTML="",Promise.resolve(e.render(r.current,{route:t,...n})).catch(console.error))},[e,t,i]);const a=s==="teacher.dashboard.widget"?"h-auto":"h-full min-h-0";return h.jsx("div",{ref:r,className:`w-full ${a}`})}const wr=new WeakMap;function Xy(e){const t=e.component,n=wr.get(t);if(n)return n;if(t.__isLazyFactory===!0){const s=it.lazy(t);return wr.set(t,s),s}return wr.set(t,t),t}function R0({slot:e,fallback:t,lang:n,route:s,slotProps:r,placement:i}){let a=bl().getExtensions(e);const l=ve(d=>d.dashboardVisibility),c=ce(d=>d.selectedLesson),u=ce(d=>d.liveClassSelectedClassId);return i&&(a=a.filter(d=>(d.placement??"after")===i)),a.length===0?null:e==="teacher.tab"&&r?.renderType==="button"?h.jsx(h.Fragment,{children:a.map(d=>{const m=`${d.pluginId}/${d.id}`,f=r?.teacherTab===m,g=d.title||d.label||d.id;return h.jsxs("button",{onClick:()=>r?.setTeacherTab?.(m),className:`flex items-center gap-3 p-3 transition-colors text-sm font-medium rounded-xl ${f?"bg-indigo-50 text-indigo-700 font-bold":"text-gray-600 hover:bg-gray-50"} ${r?.mainNavCollapsed?"justify-center px-2":""}`,title:g,children:[h.jsx(Kr,{size:20,className:"shrink-0"}),h.jsx("span",{className:r?.mainNavCollapsed?"hidden":"hidden md:block",children:g})]},`${d.pluginId}/${d.id}`)})}):h.jsx(h.Fragment,{children:a.map(d=>{const m=typeof d.component=="function",f=typeof d.render=="function";return e==="teacher.dashboard.widget"&&l.get(d.pluginId)===!1||!m&&!f?null:h.jsx(Zy,{fallback:h.jsx("div",{className:"bg-red-50 border border-red-200 rounded-lg p-4 text-sm text-red-700",children:h.jsx("p",{children:n==="zh"?"扩展组件加载失败":"Extension failed to load"})}),children:h.jsx(p.Suspense,{fallback:t??h.jsx(Yy,{}),children:m?it.createElement(Xy(d),{route:d.route||s,lessonId:c,classId:u,...d.slotProps,...r}):h.jsx(Ky,{ext:d,route:d.route||s,slotProps:{lessonId:c,classId:u,...d.slotProps,...r},slot:e})})},`${d.pluginId}/${d.id}`)})})}const ex=(e,t)=>{const n=e?e.trim():"New Course";switch(t){case"Mathematics":return`# ${n}
|
|
23
|
-
|
|
24
|
-
## 101 Course Core Foundations
|
|
25
|
-
Welcome to our mathematics laboratory. This course is designed to break down abstract calculations into visual whiteboard proofs and real-world application models.
|
|
26
|
-
|
|
27
|
-
### 📐 Key Theorems & Proof Matrix
|
|
28
|
-
- **Formula A**: $E = mc^2$ or equivalent derivative parameters
|
|
29
|
-
- **Core Axiom**: For every linear projection, a finite dimension defines its trace.
|
|
30
|
-
|
|
31
|
-
### 实践演练随堂真题 Practice Problems
|
|
32
|
-
1. Calculate the local optima for the function on the interactive workspace.
|
|
33
|
-
2. Prove the uniqueness of the residual limit under Gaussian conditions.
|
|
34
|
-
|
|
35
|
-
### 📥 Homework Assignment Task
|
|
36
|
-
Identify three real-world physical structures implementing these spatial principles and coordinate maps.`;case"ComputerScience":return`# ${n}
|
|
37
|
-
|
|
38
|
-
## 💻 Technical Exploration & Engineering Lab
|
|
39
|
-
This session acts as an immersive sandbox exploring core algorithmic structures, optimization mechanics, and data abstractions.
|
|
40
|
-
|
|
41
|
-
### ⚙️ Core Lecture Blueprint & Pseudocode
|
|
42
|
-
\`\`\`python
|
|
43
|
-
def optimize_weights(data, factor=0.01):
|
|
44
|
-
# Initialize local metrics
|
|
45
|
-
scores = [x * factor for x in data]
|
|
46
|
-
return sum(scores) / len(scores)
|
|
47
|
-
\`\`\`
|
|
48
|
-
|
|
49
|
-
### ⚡ Laboratory Workspace Drill
|
|
50
|
-
- **Objective**: Develop a linear hash-map with zero-collision distribution.
|
|
51
|
-
- **Action**: Use the interactive canvas to sketch data pipelines.
|
|
52
|
-
|
|
53
|
-
### 📝 Post-Class Evaluation
|
|
54
|
-
Write a 200-word critique analyzing memory-locality vs execution-speed trade-offs in low-level registers.`;case"Literature":return`# ${n}
|
|
55
|
-
|
|
56
|
-
## ✍️ Literary Critical Analysis Seminar
|
|
57
|
-
This curriculum evaluates textual aesthetics, semantic patterns, subtextual symbols, and historical contexts across classic paradigms.
|
|
58
|
-
|
|
59
|
-
### 🏛️ Classic Textual Excerpts
|
|
60
|
-
> "Reality represents a state of constant translation between what is experienced and what is chronicled."
|
|
61
|
-
|
|
62
|
-
### 💭 Critique Evaluation Metrics
|
|
63
|
-
- **Theme Assessment**: Analyze structural ironies within contemporary essays.
|
|
64
|
-
- **Author Intention**: Focus on pacing triggers and character foils.
|
|
65
|
-
|
|
66
|
-
### 💬 Classroom Collaborative Debate Topics
|
|
67
|
-
Does digital notation diminish the biological connection to textual journaling? Discuss under 15 minutes framework.`;case"Physics":return`# ${n}
|
|
68
|
-
|
|
69
|
-
## ⚡ Experimental Physics & Natural Science Sandbox
|
|
70
|
-
In this session, theoretical models undergo practical validation through interactive virtual whiteboard modeling and numerical measurements.
|
|
71
|
-
|
|
72
|
-
### 🔬 Key Mechanical Principles & Constraints
|
|
73
|
-
- **Axiom 1**: Momentum is conserved in closed coordinate vectors.
|
|
74
|
-
- **Axiom 2**: Resistance is directly proportional to temperature factors.
|
|
75
|
-
|
|
76
|
-
### 🛠️ Lab Step-by-Step Procedure
|
|
77
|
-
1. Plot the force vectors acting on the balance coordinate vertices.
|
|
78
|
-
2. Measure the velocity coefficients across three alternate trial loops.
|
|
79
|
-
|
|
80
|
-
### 📝 Homework Assignment Evaluation
|
|
81
|
-
Calculate energy loss ratios using standard mathematical integrals in your journal.`;case"History":return`# ${n}
|
|
82
|
-
|
|
83
|
-
## 🏛️ Geopolitical Context Mapping & Historical Context
|
|
84
|
-
This course explores historical trends, decision frameworks, resource patterns, and socio-economic influences that shaped modern civilization.
|
|
85
|
-
|
|
86
|
-
### 🗺️ Context Timeline Focus
|
|
87
|
-
- **Phase A**: Resource migration patterns along major trade waterways.
|
|
88
|
-
- **Phase B**: Strategic institutional reforms and cultural integration cycles.
|
|
89
|
-
|
|
90
|
-
### 🔍 Primary Source Critique Work
|
|
91
|
-
Analyze the 18th-century legislative documents for bias, context gaps, and underlying socio-economic drivers.
|
|
92
|
-
|
|
93
|
-
### 💬 Group Discussion Prompts
|
|
94
|
-
How did geography influence the longevity of ancient administrative models?`;case"Art":return`# ${n}
|
|
95
|
-
|
|
96
|
-
## 🎨 Visual Composition & Creative Sketching Studio
|
|
97
|
-
A workshop focusing on aesthetic principles, negative space ratios, visual balance, and dynamic typography models.
|
|
98
|
-
|
|
99
|
-
### 🖌️ Design Principles
|
|
100
|
-
- **Golden Spiral**: Align critical focal points with recursive visual arcs.
|
|
101
|
-
- **Chiaroscuro**: Leverage deep high-contrast shading to establish three-dimensional form.
|
|
102
|
-
|
|
103
|
-
### 🛠️ Whiteboard Practical Sandbox Project
|
|
104
|
-
Collaborate on the dynamic canvas to draft a raw responsive layout using minimal monochromatic blocks.
|
|
105
|
-
|
|
106
|
-
### 🎨 Portfolio Task
|
|
107
|
-
Submit three divergent conceptual drafts representing active space constraints.`;default:return`# ${n}
|
|
108
|
-
|
|
109
|
-
## 🔮 Multidisciplinary Advanced Exploration & Research
|
|
110
|
-
This course integrates cross-subject paradigms, cognitive practices, and critical reasoning methods.
|
|
111
|
-
|
|
112
|
-
### 📚 Course Syllabus Modules
|
|
113
|
-
- **Module 1**: Core theoretical grounding and conceptual models.
|
|
114
|
-
- **Module 2**: Practical exercises combining research and action.
|
|
115
|
-
|
|
116
|
-
### 📝 Interactive Classroom Tasks
|
|
117
|
-
1. Formulate 2 key research queries aligning with this lecture.
|
|
118
|
-
2. Sketch the systemic flow diagram depicting interaction factors.
|
|
119
|
-
|
|
120
|
-
### 📥 Assignment Brief
|
|
121
|
-
Draft a 300-word integration proposal based on today's whiteboard exercises.`}};async function tx(e="all"){const t=await fetch(`/api/activities?role=${encodeURIComponent(e)}`,{headers:{Accept:"application/json"}});if(!t.ok)throw new Error(`Failed to load activities (${t.status})`);return(await t.json()).activities??[]}async function Go(){const e=await fetch("/api/activities/running",{headers:{Accept:"application/json"}});if(!e.ok)throw new Error(`Failed to load running activities (${e.status})`);return(await e.json()).activities??[]}async function nx(e){const t=await fetch(`/api/activities/${encodeURIComponent(e)}/finish`,{method:"POST",headers:{"Content-Type":"application/json"}});if(!t.ok){const n=await t.json().catch(()=>({}));throw new Error(n.error||`Failed to finish activity (${t.status})`)}}async function sx(e){const t=await fetch(`/api/activities/${encodeURIComponent(e)}/pause`,{method:"POST",headers:{"Content-Type":"application/json"}});if(!t.ok){const n=await t.json().catch(()=>({}));throw new Error(n.error||`Failed to pause activity (${t.status})`)}}async function rx(e){const t=await fetch(`/api/activities/${encodeURIComponent(e)}/resume`,{method:"POST",headers:{"Content-Type":"application/json"}});if(!t.ok){const n=await t.json().catch(()=>({}));throw new Error(n.error||`Failed to resume activity (${t.status})`)}}async function ix(e,t,n){const s=await fetch(`/api/activities/${encodeURIComponent(e)}/start`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({payload:t??{},actorId:n})}),r=await s.json();if(!s.ok||r.ok===!1)throw new Error(r.error||`Failed to start activity (${s.status})`);return r}const Mn={padding:"12px",color:"#e2e8f0",fontSize:"13px"},ox={HelpCircle:Th,Vote:Ph,BarChart3:Eh,MessagesSquare:kh,Users:Pa,FileText:za,Trophy:Ch,CheckCircle2:Zr,BookOpen:Na};function ax({name:e,className:t}){const n=e&&ox[e]||Kr;return h.jsx(n,{size:18,className:t})}function lx(e,t){if(!e)return t==="zh"?"进行中":"In progress";const n=Math.max(0,Math.floor((Date.now()-e)/1e3)),s=Math.floor(n/60),r=n%60;return t==="zh"?`${s} 分 ${r} 秒`:`${s}m ${r}s`}const vl=({role:e,actorId:t,lang:n="en",classroomId:s,mode:r="launcher"})=>{const[i,o]=p.useState([]),[a,l]=p.useState(!0),[c,u]=p.useState(null),[d,m]=p.useState({}),[f,g]=p.useState([]),[x,C]=p.useState(!0),[b,I]=p.useState(null),[S,E]=p.useState(null),[z,k]=p.useState(!1),[L,R]=p.useState(null),O=ce(M=>M.setTeacherTab);p.useEffect(()=>{if(r!=="launcher")return;let M=!1;return l(!0),tx(e).then(q=>{M||o(q)}).catch(q=>{M||u(q instanceof Error?q.message:String(q))}).finally(()=>{M||l(!1)}),()=>{M=!0}},[e,r]),p.useEffect(()=>{if(r!=="status")return;let M=!1;const q=async()=>{try{const te=await Go();M||g(te)}catch(te){M||I(te instanceof Error?te.message:String(te))}finally{M||C(!1)}};q();const y=setInterval(q,5e3);return()=>{M=!0,clearInterval(y)}},[r]);const P=async M=>{if(S){k(!0),R(null);try{await M(S),g(await Go())}catch(q){R(q instanceof Error?q.message:String(q))}finally{k(!1)}}},N=()=>P(nx),_=()=>P(sx),D=()=>P(rx),F=()=>{E(null),O("live_class")};if(r==="status"){if(x)return h.jsx("div",{className:"bg-white border border-slate-200/80 rounded-2xl p-5 shadow-sm h-24 animate-pulse"});if(b||f.length===0)return null;const M=f.find(q=>q.id===S)||null;return h.jsxs("div",{className:"bg-white border border-slate-200/80 rounded-2xl p-5 shadow-sm",children:[h.jsxs("div",{className:"flex items-center justify-between mb-3",children:[h.jsxs("div",{className:"flex items-center gap-2 text-slate-800 font-extrabold",children:[h.jsx("span",{children:"🧩"}),h.jsx("span",{children:n==="zh"?"进行中的活动":"Activities in Progress"})]}),h.jsx("span",{className:"text-[10px] font-bold bg-indigo-50 text-indigo-700 px-2 py-0.5 rounded-full",children:f.length})]}),h.jsx("div",{className:"flex flex-col gap-2",children:f.map(q=>{const y=q.state==="running";return h.jsxs("button",{onClick:()=>E(q.id),className:"w-full flex items-center gap-3 text-left bg-slate-50 hover:bg-slate-100 border border-slate-200/70 rounded-xl p-3 transition-colors",children:[h.jsx(ax,{name:q.icon,className:"text-indigo-600 shrink-0"}),h.jsxs("div",{className:"min-w-0 flex-1",children:[h.jsx("div",{className:"font-bold text-slate-800 truncate",children:q.name}),q.category&&h.jsx("div",{className:"text-[11px] text-slate-500 truncate",children:q.category})]}),h.jsxs("div",{className:"flex flex-col items-end gap-1 shrink-0",children:[h.jsx("span",{className:`text-[10px] font-bold px-2 py-0.5 rounded-full ${y?"bg-emerald-100 text-emerald-700":"bg-amber-100 text-amber-700"}`,children:y?n==="zh"?"进行中":"Running":n==="zh"?"已暂停":"Paused"}),h.jsxs("span",{className:"text-[10px] text-slate-400 flex items-center gap-1",children:[h.jsx(bh,{size:10})," ",lx(q.startedAt,n)]})]})]},q.id)})}),M&&h.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/30 p-4",onClick:()=>E(null),children:h.jsxs("div",{className:"bg-white rounded-2xl shadow-xl w-full max-w-sm p-5",onClick:q=>q.stopPropagation(),children:[h.jsxs("div",{className:"flex items-center justify-between mb-3",children:[h.jsx("h3",{className:"font-bold text-slate-800",children:M.name}),h.jsx("button",{onClick:()=>E(null),className:"text-slate-400 hover:text-slate-600","aria-label":"close",children:h.jsx(gn,{size:18})})]}),h.jsxs("div",{className:"text-sm text-slate-500 mb-1",children:[n==="zh"?"状态":"Status",":"," ",M.state==="running"?n==="zh"?"进行中":"Running":n==="zh"?"已暂停":"Paused"]}),h.jsxs("div",{className:"text-sm text-slate-500 mb-4",children:[n==="zh"?"开始时间":"Started",":"," ",M.startedAt?new Date(M.startedAt).toLocaleString():"-"]}),L&&h.jsx("div",{className:"text-xs text-rose-600 mb-2",children:L}),h.jsxs("div",{className:"flex gap-2",children:[M.state==="running"?h.jsxs("button",{disabled:z,onClick:_,className:"flex-1 flex items-center justify-center gap-1 bg-amber-500 hover:bg-amber-600 disabled:opacity-60 text-white rounded-lg py-2 text-sm font-bold",children:[h.jsx(Sh,{size:14})," ",n==="zh"?"暂停":"Pause"]}):h.jsxs("button",{disabled:z,onClick:D,className:"flex-1 flex items-center justify-center gap-1 bg-indigo-500 hover:bg-indigo-600 disabled:opacity-60 text-white rounded-lg py-2 text-sm font-bold",children:[h.jsx(vh,{size:14})," ",n==="zh"?"恢复":"Resume"]}),h.jsx("button",{disabled:z,onClick:N,className:"flex-1 flex items-center justify-center gap-1 bg-rose-600 hover:bg-rose-700 disabled:opacity-60 text-white rounded-lg py-2 text-sm font-bold",children:z?n==="zh"?"处理中…":"Working…":n==="zh"?"结束":"End"})]}),h.jsx("button",{onClick:F,className:"w-full mt-2 bg-slate-100 hover:bg-slate-200 text-slate-700 rounded-lg py-2 text-sm font-bold",children:n==="zh"?"进入课堂":"Enter Classroom"})]})})]})}const A=p.useMemo(()=>{const M=new Map;for(const q of i){const y=q.category;M.has(y)||M.set(y,[]),M.get(y).push(q)}return Array.from(M.entries())},[i]),T=async M=>{m(q=>({...q,[M.id]:n==="zh"?"启动中…":"Starting…"}));try{const q=await ix(M.id,{classroomId:s,role:e},t);m(y=>({...y,[M.id]:q.dispatched?n==="zh"?"已启动 ✓":"Started ✓":n==="zh"?"已通知 ✓":"Notified ✓"}))}catch(q){m(y=>({...y,[M.id]:q instanceof Error?q.message:String(q)}))}};if(a)return h.jsx("div",{style:Mn,children:n==="zh"?"加载活动中…":"Loading activities…"});if(c)return h.jsxs("div",{style:Mn,children:[h.jsxs("div",{style:{fontWeight:600,marginBottom:6},children:["🧩 ",n==="zh"?"活动中心":"Activity Center"]}),h.jsx("div",{style:{opacity:.7},children:c})]});const B=e==="teacher"?n==="zh"?"活动中心(教师)":"Activity Center":n==="zh"?"活动(学生)":"Activities";return i.length===0?h.jsxs("div",{style:Mn,children:[h.jsxs("div",{style:{fontWeight:600,marginBottom:6},children:["🧩 ",B]}),h.jsx("div",{style:{opacity:.7},children:n==="zh"?"暂无可用活动。":"No activities available."})]}):h.jsxs("div",{style:Mn,children:[h.jsxs("div",{style:{fontWeight:600,marginBottom:8},children:["🧩 ",B]}),A.map(([M,q])=>h.jsxs("div",{style:{marginBottom:10},children:[h.jsx("div",{style:{opacity:.6,fontSize:11,textTransform:"uppercase",marginBottom:4},children:M}),h.jsx("div",{style:{display:"flex",flexWrap:"wrap",gap:8},children:q.map(y=>h.jsxs("div",{style:{border:"1px solid #334155",borderRadius:8,padding:"8px 10px",minWidth:150,background:"#0f172a"},children:[h.jsxs("div",{style:{fontWeight:600},children:[y.icon?`${y.icon} `:"▫️ ",y.name]}),y.description&&h.jsx("div",{style:{opacity:.7,fontSize:11,margin:"2px 0 6px"},children:y.description}),h.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6},children:[h.jsx("button",{onClick:()=>T(y),style:{cursor:"pointer",background:e==="teacher"?"#2563eb":"#0ea5e9",color:"#fff",border:"none",borderRadius:6,padding:"4px 10px",fontSize:12},children:e==="teacher"?n==="zh"?"启动":"Start":n==="zh"?"参与":"Open"}),d[y.id]&&h.jsx("span",{style:{fontSize:11,opacity:.85},children:d[y.id]})]}),h.jsx("div",{style:{opacity:.5,fontSize:10,marginTop:4},children:y.provider==="official"?"official":y.provider})]},y.id))})]},M))]})},cx=Object.freeze(Object.defineProperty({__proto__:null,ActivityWorkspaceWidget:vl},Symbol.toStringTag,{value:"Module"}));let Qo=!1;function ux(){if(Qo)return;Qo=!0;const e=()=>Ne(()=>Promise.resolve().then(()=>cx),void 0).then(t=>({default:()=>h.jsx(vl,{role:"teacher",mode:"status"})}));e.__isLazyFactory=!0,ve.getState().registerExtensionPoint("teacher.dashboard.widget",{id:"official_activity_center",label:"Activity Center",icon:"Puzzle",pluginId:"openlearn-official",component:e})}const Jo="@openlearn/frontend:IFrontendAPI",Yo="@openlearn/frontend:ISocketService",Zo="@openlearn/frontend:IUIService",Ko="@openlearn/frontend:IStorageService",dx="@openlearn/frontend:ISemesterGradeService";var pe=(e=>(e.INSTALLED="installed",e.ACTIVATING="activating",e.ACTIVE="active",e.DEACTIVATING="deactivating",e.INACTIVE="inactive",e.ERROR="error",e.UNINSTALLED="uninstalled",e))(pe||{});const hx=p.lazy(()=>Ne(()=>import("./StudentView-DT-373QP.js"),[]).then(e=>({default:e.StudentView}))),fx=p.lazy(()=>Ne(()=>import("./TeacherView-XdD-y67J.js"),[]).then(e=>({default:e.TeacherView})));function px(e){const{activeRole:t}=e;return h.jsx(p.Suspense,{fallback:h.jsxs("div",{className:"flex-1 flex flex-col items-center justify-center min-h-[50vh] text-slate-400 gap-3",children:[h.jsx(Xr,{className:"w-8 h-8 animate-spin text-indigo-500"}),h.jsx("span",{className:"text-sm font-medium tracking-wide",children:"正在加载工作台..."})]}),children:t==="student"?h.jsx(hx,{...e}):h.jsx(fx,{...e})})}const mi=p.createContext({});function gi(e){const t=p.useRef(null);return t.current===null&&(t.current=e()),t.current}const mx=typeof window<"u",Cl=mx?p.useLayoutEffect:p.useEffect,as=p.createContext(null),yi=p.createContext({transformPagePoint:e=>e,isStatic:!1,reducedMotion:"never"});function Xo(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function gx(...e){return t=>{let n=!1;const s=e.map(r=>{const i=Xo(r,t);return!n&&typeof i=="function"&&(n=!0),i});if(n)return()=>{for(let r=0;r<s.length;r++){const i=s[r];typeof i=="function"?i():Xo(e[r],null)}}}}function yx(...e){return p.useCallback(gx(...e),e)}class xx extends p.Component{getSnapshotBeforeUpdate(t){const n=this.props.childRef.current;if(ir(n)&&t.isPresent&&!this.props.isPresent&&this.props.pop!==!1){const s=n.offsetParent,r=ir(s)&&s.offsetWidth||0,i=ir(s)&&s.offsetHeight||0,o=getComputedStyle(n),a=this.props.sizeRef.current;a.height=parseFloat(o.height),a.width=parseFloat(o.width),a.top=n.offsetTop,a.left=n.offsetLeft,a.right=r-a.width-a.left,a.bottom=i-a.height-a.top,a.direction=o.direction}return null}componentDidUpdate(){}render(){return this.props.children}}function wx({children:e,isPresent:t,anchorX:n,anchorY:s,root:r,pop:i}){const o=p.useId(),a=p.useRef(null),l=p.useRef({width:0,height:0,top:0,left:0,right:0,bottom:0,direction:"ltr"}),{nonce:c}=p.useContext(yi),u=e.props?.ref??e?.ref,d=yx(a,u);return p.useInsertionEffect(()=>{const{width:m,height:f,top:g,left:x,right:C,bottom:b,direction:I}=l.current;if(t||i===!1||!a.current||!m||!f)return;const S=I==="rtl",E=n==="left"?S?`right: ${C}`:`left: ${x}`:S?`left: ${x}`:`right: ${C}`,z=s==="bottom"?`bottom: ${b}`:`top: ${g}`;a.current.dataset.motionPopId=o;const k=document.createElement("style");c&&(k.nonce=c);const L=r??document.head;return L.appendChild(k),k.sheet&&k.sheet.insertRule(`
|
|
122
|
-
[data-motion-pop-id="${o}"] {
|
|
123
|
-
position: absolute !important;
|
|
124
|
-
width: ${m}px !important;
|
|
125
|
-
height: ${f}px !important;
|
|
126
|
-
${E}px !important;
|
|
127
|
-
${z}px !important;
|
|
128
|
-
}
|
|
129
|
-
`),()=>{a.current?.removeAttribute("data-motion-pop-id"),L.contains(k)&&L.removeChild(k)}},[t]),h.jsx(xx,{isPresent:t,childRef:a,sizeRef:l,pop:i,children:i===!1?e:p.cloneElement(e,{ref:d})})}const bx=({children:e,initial:t,isPresent:n,onExitComplete:s,custom:r,presenceAffectsLayout:i,mode:o,anchorX:a,anchorY:l,root:c})=>{const u=gi(Sx),d=p.useId();let m=!0,f=p.useMemo(()=>(m=!1,{id:d,initial:t,isPresent:n,custom:r,onExitComplete:g=>{u.set(g,!0);for(const x of u.values())if(!x)return;s&&s()},register:g=>(u.set(g,!1),()=>u.delete(g))}),[n,u,s]);return i&&m&&(f={...f}),p.useMemo(()=>{u.forEach((g,x)=>u.set(x,!1))},[n]),p.useEffect(()=>{!n&&!u.size&&s&&s()},[n]),e=h.jsx(wx,{pop:o==="popLayout",isPresent:n,anchorX:a,anchorY:l,root:c,children:e}),h.jsx(as.Provider,{value:f,children:e})};function Sx(){return new Map}function kl(e=!0){const t=p.useContext(as);if(t===null)return[!0,null];const{isPresent:n,onExitComplete:s,register:r}=t,i=p.useId();p.useEffect(()=>{if(e)return r(i)},[e]);const o=p.useCallback(()=>e&&s&&s(i),[i,s,e]);return!n&&s?[!1,o]:[!0]}const On=e=>e.key||"";function ea(e){const t=[];return p.Children.forEach(e,n=>{p.isValidElement(n)&&t.push(n)}),t}const vx=({children:e,custom:t,initial:n=!0,onExitComplete:s,presenceAffectsLayout:r=!0,mode:i="sync",propagate:o=!1,anchorX:a="left",anchorY:l="top",root:c})=>{const[u,d]=kl(o),m=p.useMemo(()=>ea(e),[e]),f=o&&!u?[]:m.map(On),g=p.useRef(!0),x=p.useRef(m),C=gi(()=>new Map),b=p.useRef(new Set),[I,S]=p.useState(m),[E,z]=p.useState(m);Cl(()=>{g.current=!1,x.current=m;for(let R=0;R<E.length;R++){const O=On(E[R]);f.includes(O)?(C.delete(O),b.current.delete(O)):C.get(O)!==!0&&C.set(O,!1)}},[E,f.length,f.join("-")]);const k=[];if(m!==I){let R=[...m];for(let O=0;O<E.length;O++){const P=E[O],N=On(P);f.includes(N)||(R.splice(O,0,P),k.push(P))}return i==="wait"&&k.length&&(R=k),z(ea(R)),S(m),null}const{forceRender:L}=p.useContext(mi);return h.jsx(h.Fragment,{children:E.map(R=>{const O=On(R),P=o&&!u?!1:m===E||f.includes(O),N=()=>{if(b.current.has(O))return;if(C.has(O))b.current.add(O),C.set(O,!0);else return;let _=!0;C.forEach(D=>{D||(_=!1)}),_&&(L?.(),z(x.current),o&&d?.(),s&&s())};return h.jsx(bx,{isPresent:P,initial:!g.current||n?void 0:!1,custom:t,presenceAffectsLayout:r,mode:i,root:c,onExitComplete:P?void 0:N,anchorX:a,anchorY:l,children:R},O)})})},El=p.createContext({strict:!1}),ta={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 na=!1;function Cx(){if(na)return;const e={};for(const t in ta)e[t]={isEnabled:n=>ta[t].some(s=>!!n[s])};La(e),na=!0}function Pl(){return Cx(),Oh()}function kx(e){const t=Pl();for(const n in e)t[n]={...t[n],...e[n]};La(t)}const Ex=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 ss(e){return e.startsWith("while")||e.startsWith("drag")&&e!=="draggable"||e.startsWith("layout")||e.startsWith("onTap")||e.startsWith("onPan")||e.startsWith("onLayout")||Ex.has(e)}let Tl=e=>!ss(e);function Px(e){typeof e=="function"&&(Tl=t=>t.startsWith("on")?!ss(t):e(t))}try{Px(require("@emotion/is-prop-valid").default)}catch{}function Tx(e,t,n){const s={};for(const r in e)r==="values"&&typeof e.values=="object"||ei(e[r])||(Tl(r)||n===!0&&ss(r)||!t&&!ss(r)||e.draggable&&r.startsWith("onDrag"))&&(s[r]=e[r]);return s}const ls=p.createContext({});function Ix(e,t){if(_a(e)){const{initial:n,animate:s}=e;return{initial:n===!1||eo(n)?n:void 0,animate:eo(s)?s:void 0}}return e.inherit!==!1?t:{}}function Ax(e){const{initial:t,animate:n}=Ix(e,p.useContext(ls));return p.useMemo(()=>({initial:t,animate:n}),[sa(t),sa(n)])}function sa(e){return Array.isArray(e)?e.join(" "):e}const xi=()=>({style:{},transform:{},transformOrigin:{},vars:{}});function Il(e,t,n){for(const s in t)!ei(t[s])&&!Dh(s,n)&&(e[s]=t[s])}function Nx({transformTemplate:e},t){return p.useMemo(()=>{const n=xi();return Fh(n,t,e),Object.assign({},n.vars,n.style)},[t])}function zx(e,t){const n=e.style||{},s={};return Il(s,n,e),Object.assign(s,Nx(e,t)),s}function Lx(e,t){const n={},s=zx(e,t);return e.drag&&e.dragListener!==!1&&(n.draggable=!1,s.userSelect=s.WebkitUserSelect=s.WebkitTouchCallout="none",s.touchAction=e.drag===!0?"none":`pan-${e.drag==="x"?"y":"x"}`),e.tabIndex===void 0&&(e.onTap||e.onTapStart||e.whileTap)&&(n.tabIndex=0),n.style=s,n}const Al=()=>({...xi(),attrs:{}});function _x(e,t,n,s){const r=p.useMemo(()=>{const i=Al();return Bh(i,t,$h(s),e.transformTemplate,e.style),{...i.attrs,style:{...i.style}}},[t]);if(e.style){const i={};Il(i,e.style,e),r.style={...i,...r.style}}return r}const jx=["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 wi(e){return typeof e!="string"||e.includes("-")?!1:!!(jx.indexOf(e)>-1||/[A-Z]/u.test(e))}function Rx(e,t,n,{latestValues:s},r,i=!1,o){const l=(o??wi(e)?_x:Lx)(t,s,r,e),c=Tx(t,typeof e=="string",i),u=e!==p.Fragment?{...c,...l,ref:n}:{},{children:d}=t,m=p.useMemo(()=>ei(d)?d.get():d,[d]);return p.createElement(e,{...u,children:m})}function Mx({scrapeMotionValuesFromProps:e,createRenderState:t},n,s,r){return{latestValues:Ox(n,s,r,e),renderState:t()}}function Ox(e,t,n,s){const r={},i=s(e,{});for(const m in i)r[m]=Vh(i[m]);let{initial:o,animate:a}=e;const l=_a(e),c=Uh(e);t&&c&&!l&&e.inherit!==!1&&(o===void 0&&(o=t.initial),a===void 0&&(a=t.animate));let u=n?n.initial===!1:!1;u=u||o===!1;const d=u?a:o;if(d&&typeof d!="boolean"&&!ja(d)){const m=Array.isArray(d)?d:[d];for(let f=0;f<m.length;f++){const g=qh(e,m[f]);if(g){const{transitionEnd:x,transition:C,...b}=g;for(const I in b){let S=b[I];if(Array.isArray(S)){const E=u?S.length-1:0;S=S[E]}S!==null&&(r[I]=S)}for(const I in x)r[I]=x[I]}}}return r}const Nl=e=>(t,n)=>{const s=p.useContext(ls),r=p.useContext(as),i=()=>Mx(e,t,s,r);return n?i():gi(i)},Dx=Nl({scrapeMotionValuesFromProps:Wh,createRenderState:xi}),Fx=Nl({scrapeMotionValuesFromProps:Hh,createRenderState:Al}),Bx=Symbol.for("motionComponentSymbol");function $x(e,t,n){const s=p.useRef(n);p.useInsertionEffect(()=>{s.current=n});const r=p.useRef(null);return p.useCallback(i=>{i&&e.onMount?.(i),t&&(i?t.mount(i):t.unmount());const o=s.current;if(typeof o=="function")if(i){const a=o(i);typeof a=="function"&&(r.current=a)}else r.current?(r.current(),r.current=null):o(i);else o&&(o.current=i)},[t])}const zl=p.createContext({});function Vt(e){return e&&typeof e=="object"&&Object.prototype.hasOwnProperty.call(e,"current")}function Vx(e,t,n,s,r,i){const{visualElement:o}=p.useContext(ls),a=p.useContext(El),l=p.useContext(as),c=p.useContext(yi),u=c.reducedMotion,d=c.skipAnimations,m=p.useRef(null),f=p.useRef(!1);s=s||a.renderer,!m.current&&s&&(m.current=s(e,{visualState:t,parent:o,props:n,presenceContext:l,blockInitialAnimation:l?l.initial===!1:!1,reducedMotionConfig:u,skipAnimations:d,isSVG:i}),f.current&&m.current&&(m.current.manuallyAnimateOnMount=!0));const g=m.current,x=p.useContext(zl);g&&!g.projection&&r&&(g.type==="html"||g.type==="svg")&&Ux(m.current,n,r,x);const C=p.useRef(!1);p.useInsertionEffect(()=>{g&&C.current&&g.update(n,l)});const b=n[Gh],I=p.useRef(!!b&&typeof window<"u"&&!window.MotionHandoffIsComplete?.(b)&&window.MotionHasOptimisedAnimation?.(b));return Cl(()=>{f.current=!0,g&&(C.current=!0,window.MotionIsMounted=!0,g.updateFeatures(),g.scheduleRenderMicrotask(),I.current&&g.animationState&&g.animationState.animateChanges())}),p.useEffect(()=>{g&&(!I.current&&g.animationState&&g.animationState.animateChanges(),I.current&&(queueMicrotask(()=>{window.MotionHandoffMarkAsComplete?.(b)}),I.current=!1),g.enteringChildren=void 0)}),g}function Ux(e,t,n,s){const{layoutId:r,layout:i,drag:o,dragConstraints:a,layoutScroll:l,layoutRoot:c,layoutAnchor:u,layoutCrossfade:d}=t;e.projection=new n(e.latestValues,t["data-framer-portal-id"]?void 0:Ll(e.parent)),e.projection.setOptions({layoutId:r,layout:i,alwaysMeasureLayout:!!o||a&&Vt(a),visualElement:e,animationType:typeof i=="string"?i:"both",initialPromotionConfig:s,crossfade:d,layoutScroll:l,layoutRoot:c,layoutAnchor:u})}function Ll(e){if(e)return e.options.allowProjection!==!1?e.projection:Ll(e.parent)}function br(e,{forwardMotionProps:t=!1,type:n}={},s,r){s&&kx(s);const i=n?n==="svg":wi(e),o=i?Fx:Dx;function a(c,u){let d;const m={...p.useContext(yi),...c,layoutId:qx(c)},{isStatic:f}=m,g=Ax(c),x=o(c,f);if(!f&&typeof window<"u"){Wx();const C=Hx(m);d=C.MeasureLayout,g.visualElement=Vx(e,x,m,r,C.ProjectionNode,i)}return h.jsxs(ls.Provider,{value:g,children:[d&&g.visualElement?h.jsx(d,{visualElement:g.visualElement,...m}):null,Rx(e,c,$x(x,g.visualElement,u),x,f,t,i)]})}a.displayName=`motion.${typeof e=="string"?e:`create(${e.displayName??e.name??""})`}`;const l=p.forwardRef(a);return l[Bx]=e,l}function qx({layoutId:e}){const t=p.useContext(mi).id;return t&&e!==void 0?t+"-"+e:e}function Wx(e,t){p.useContext(El).strict}function Hx(e){const t=Pl(),{drag:n,layout:s}=t;if(!n&&!s)return{};const r={...n,...s};return{MeasureLayout:n?.isEnabled(e)||s?.isEnabled(e)?r.MeasureLayout:void 0,ProjectionNode:r.ProjectionNode}}function Gx(e,t){if(typeof Proxy>"u")return br;const n=new Map,s=(i,o)=>br(i,o,e,t),r=(i,o)=>s(i,o);return new Proxy(r,{get:(i,o)=>o==="create"?s:(n.has(o)||n.set(o,br(o,void 0,e,t)),n.get(o))})}const Qx=(e,t)=>t.isSVG??wi(e)?new Qh(t):new Jh(t,{allowProjection:e!==p.Fragment});class Jx extends vt{constructor(t){super(t),t.animationState||(t.animationState=Yh(t))}updateAnimationControlsSubscription(){const{animate:t}=this.node.getProps();ja(t)&&(this.unmountControls=t.subscribe(this.node))}mount(){this.updateAnimationControlsSubscription()}update(){const{animate:t}=this.node.getProps(),{animate:n}=this.node.prevProps||{};t!==n&&this.updateAnimationControlsSubscription()}unmount(){this.node.animationState.reset(),this.unmountControls?.()}}let Yx=0;class Zx extends vt{constructor(){super(...arguments),this.id=Yx++,this.isExitComplete=!1}update(){if(!this.node.presenceContext)return;const{isPresent:t,onExitComplete:n}=this.node.presenceContext,{isPresent:s}=this.node.prevPresenceContext||{};if(!this.node.animationState||t===s)return;if(t&&s===!1){if(this.isExitComplete){const{initial:i,custom:o}=this.node.getProps();if(typeof i=="string"||typeof i=="object"&&i!==null&&!Array.isArray(i)){const a=Zh(this.node,i,o);if(a){const{transition:l,transitionEnd:c,...u}=a;for(const d in u)this.node.getValue(d)?.jump(u[d])}}this.node.animationState.reset(),this.node.animationState.animateChanges()}else this.node.animationState.setActive("exit",!1);this.isExitComplete=!1;return}const r=this.node.animationState.setActive("exit",!t);n&&!t&&r.then(()=>{this.isExitComplete=!0,n(this.id)})}mount(){const{register:t,onExitComplete:n}=this.node.presenceContext||{};n&&n(this.id),t&&(this.unmount=t(this.id))}unmount(){}}const Kx={animation:{Feature:Jx},exit:{Feature:Zx}};function wn(e){return{point:{x:e.pageX,y:e.pageY}}}const Xx=e=>t=>Ra(t)&&e(t,wn(t));function fn(e,t,n,s){return Xn(e,t,Xx(n),s)}const _l=({current:e})=>e?e.ownerDocument.defaultView:null,ra=(e,t)=>Math.abs(e-t);function ew(e,t){const n=ra(e.x,t.x),s=ra(e.y,t.y);return Math.sqrt(n**2+s**2)}const ia=new Set(["auto","scroll"]);class jl{constructor(t,n,{transformPagePoint:s,contextWindow:r=window,dragSnapToOrigin:i=!1,distanceThreshold:o=3,element:a}={}){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=f=>{this.handleScroll(f.target)},this.onWindowScroll=()=>{this.handleScroll(window)},this.updatePoint=()=>{if(!(this.lastMoveEvent&&this.lastMoveEventInfo))return;this.lastRawMoveEventInfo&&(this.lastMoveEventInfo=Dn(this.lastRawMoveEventInfo,this.transformPagePoint));const f=Sr(this.lastMoveEventInfo,this.history),g=this.startEvent!==null,x=ew(f.offset,{x:0,y:0})>=this.distanceThreshold;if(!g&&!x)return;const{point:C}=f,{timestamp:b}=to;this.history.push({...C,timestamp:b});const{onStart:I,onMove:S}=this.handlers;g||(I&&I(this.lastMoveEvent,f),this.startEvent=this.lastMoveEvent),S&&S(this.lastMoveEvent,f)},this.handlePointerMove=(f,g)=>{this.lastMoveEvent=f,this.lastRawMoveEventInfo=g,this.lastMoveEventInfo=Dn(g,this.transformPagePoint),Xe.update(this.updatePoint,!0)},this.handlePointerUp=(f,g)=>{this.end();const{onEnd:x,onSessionEnd:C,resumeAnimation:b}=this.handlers;if((this.dragSnapToOrigin||!this.startEvent)&&b&&b(),!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const I=Sr(f.type==="pointercancel"?this.lastMoveEventInfo:Dn(g,this.transformPagePoint),this.history);this.startEvent&&x&&x(f,I),C&&C(f,I)},!Ra(t))return;this.dragSnapToOrigin=i,this.handlers=n,this.transformPagePoint=s,this.distanceThreshold=o,this.contextWindow=r||window;const l=wn(t),c=Dn(l,this.transformPagePoint),{point:u}=c,{timestamp:d}=to;this.history=[{...u,timestamp:d}];const{onSessionStart:m}=n;m&&m(t,Sr(c,this.history)),this.removeListeners=Ma(fn(this.contextWindow,"pointermove",this.handlePointerMove),fn(this.contextWindow,"pointerup",this.handlePointerUp),fn(this.contextWindow,"pointercancel",this.handlePointerUp)),a&&this.startScrollTracking(a)}startScrollTracking(t){let n=t.parentElement;for(;n;){const s=getComputedStyle(n);(ia.has(s.overflowX)||ia.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(t){const n=this.scrollPositions.get(t);if(!n)return;const s=t===window,r=s?{x:window.scrollX,y:window.scrollY}:{x:t.scrollLeft,y:t.scrollTop},i={x:r.x-n.x,y:r.y-n.y};i.x===0&&i.y===0||(s?this.lastMoveEventInfo&&(this.lastMoveEventInfo.point.x+=i.x,this.lastMoveEventInfo.point.y+=i.y):this.history.length>0&&(this.history[0].x-=i.x,this.history[0].y-=i.y),this.scrollPositions.set(t,r),Xe.update(this.updatePoint,!0))}updateHandlers(t){this.handlers=t}end(){this.removeListeners&&this.removeListeners(),this.removeScrollListeners&&this.removeScrollListeners(),this.scrollPositions.clear(),Kh(this.updatePoint)}}function Dn(e,t){return t?{point:t(e.point)}:e}function oa(e,t){return{x:e.x-t.x,y:e.y-t.y}}function Sr({point:e},t){return{point:e,delta:oa(e,Rl(t)),offset:oa(e,tw(t)),velocity:nw(t,.1)}}function tw(e){return e[0]}function Rl(e){return e[e.length-1]}function nw(e,t){if(e.length<2)return{x:0,y:0};let n=e.length-1,s=null;const r=Rl(e);for(;n>=0&&(s=e[n],!(r.timestamp-s.timestamp>no(t)));)n--;if(!s)return{x:0,y:0};s===e[0]&&e.length>2&&r.timestamp-s.timestamp>no(t)*2&&(s=e[1]);const i=Xh(r.timestamp-s.timestamp);if(i===0)return{x:0,y:0};const o={x:(r.x-s.x)/i,y:(r.y-s.y)/i};return o.x===1/0&&(o.x=0),o.y===1/0&&(o.y=0),o}function sw(e,{min:t,max:n},s){return t!==void 0&&e<t?e=s?es(t,e,s.min):Math.max(e,t):n!==void 0&&e>n&&(e=s?es(n,e,s.max):Math.min(e,n)),e}function aa(e,t,n){return{min:t!==void 0?e.min+t:void 0,max:n!==void 0?e.max+n-(e.max-e.min):void 0}}function rw(e,{top:t,left:n,bottom:s,right:r}){return{x:aa(e.x,n,r),y:aa(e.y,t,s)}}function la(e,t){let n=t.min-e.min,s=t.max-e.max;return t.max-t.min<e.max-e.min&&([n,s]=[s,n]),{min:n,max:s}}function iw(e,t){return{x:la(e.x,t.x),y:la(e.y,t.y)}}function ow(e,t){let n=.5;const s=Nr(e),r=Nr(t);return r>s?n=so(t.min,t.max-s,e.min):s>r&&(n=so(e.min,e.max-r,t.min)),ef(0,1,n)}function aw(e,t){const n={};return t.min!==void 0&&(n.min=t.min-e.min),t.max!==void 0&&(n.max=t.max-e.min),n}const $r=.35;function lw(e=$r){return e===!1?e=0:e===!0&&(e=$r),{x:ca(e,"left","right"),y:ca(e,"top","bottom")}}function ca(e,t,n){return{min:ua(e,t),max:ua(e,n)}}function ua(e,t){return typeof e=="number"?e:e[t]||0}const cw=new WeakMap;class uw{constructor(t){this.openDragLock=null,this.isDragging=!1,this.currentDirection=null,this.originPoint={x:0,y:0},this.constraints=!1,this.hasMutatedConstraints=!1,this.elastic=tf(),this.latestPointerEvent=null,this.latestPanInfo=null,this.visualElement=t}start(t,{snapToCursor:n=!1,distanceThreshold:s}={}){const{presenceContext:r}=this.visualElement;if(r&&r.isPresent===!1)return;const i=d=>{n&&this.snapToCursor(wn(d).point),this.stopAnimation()},o=(d,m)=>{const{drag:f,dragPropagation:g,onDragStart:x}=this.getProps();if(f&&!g&&(this.openDragLock&&this.openDragLock(),this.openDragLock=af(f),!this.openDragLock))return;this.latestPointerEvent=d,this.latestPanInfo=m,this.isDragging=!0,this.currentDirection=null,this.resolveConstraints(),this.visualElement.projection&&(this.visualElement.projection.isAnimationBlocked=!0,this.visualElement.projection.target=void 0),wt(b=>{let I=this.getAxisMotionValue(b).get()||0;if(lf.test(I)){const{projection:S}=this.visualElement;if(S&&S.layout){const E=S.layout.layoutBox[b];E&&(I=Nr(E)*(parseFloat(I)/100))}}this.originPoint[b]=I}),x&&Xe.update(()=>x(d,m),!1,!0),ro(this.visualElement,"transform");const{animationState:C}=this.visualElement;C&&C.setActive("whileDrag",!0)},a=(d,m)=>{this.latestPointerEvent=d,this.latestPanInfo=m;const{dragPropagation:f,dragDirectionLock:g,onDirectionLock:x,onDrag:C}=this.getProps();if(!f&&!this.openDragLock)return;const{offset:b}=m;if(g&&this.currentDirection===null){this.currentDirection=hw(b),this.currentDirection!==null&&x&&x(this.currentDirection);return}this.updateAxis("x",m.point,b),this.updateAxis("y",m.point,b),this.visualElement.render(),C&&Xe.update(()=>C(d,m),!1,!0)},l=(d,m)=>{this.latestPointerEvent=d,this.latestPanInfo=m,this.stop(d,m),this.latestPointerEvent=null,this.latestPanInfo=null},c=()=>{const{dragSnapToOrigin:d}=this.getProps();(d||this.constraints)&&this.startAnimation({x:0,y:0})},{dragSnapToOrigin:u}=this.getProps();this.panSession=new jl(t,{onSessionStart:i,onStart:o,onMove:a,onSessionEnd:l,resumeAnimation:c},{transformPagePoint:this.visualElement.getTransformPagePoint(),dragSnapToOrigin:u,distanceThreshold:s,contextWindow:_l(this.visualElement),element:this.visualElement.current})}stop(t,n){const s=t||this.latestPointerEvent,r=n||this.latestPanInfo,i=this.isDragging;if(this.cancel(),!i||!r||!s)return;const{velocity:o}=r;this.startAnimation(o);const{onDragEnd:a}=this.getProps();a&&Xe.postRender(()=>a(s,r))}cancel(){this.isDragging=!1;const{projection:t,animationState:n}=this.visualElement;t&&(t.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(t,n,s){const{drag:r}=this.getProps();if(!s||!Fn(t,r,this.currentDirection))return;const i=this.getAxisMotionValue(t);let o=this.originPoint[t]+s[t];this.constraints&&this.constraints[t]&&(o=sw(o,this.constraints[t],this.elastic[t])),i.set(o)}resolveConstraints(){const{dragConstraints:t,dragElastic:n}=this.getProps(),s=this.visualElement.projection&&!this.visualElement.projection.layout?this.visualElement.projection.measure(!1):this.visualElement.projection?.layout,r=this.constraints;t&&Vt(t)?this.constraints||(this.constraints=this.resolveRefConstraints()):t&&s?this.constraints=rw(s.layoutBox,t):this.constraints=!1,this.elastic=lw(n),r!==this.constraints&&!Vt(t)&&s&&this.constraints&&!this.hasMutatedConstraints&&wt(i=>{this.constraints!==!1&&this.getAxisMotionValue(i)&&(this.constraints[i]=aw(s.layoutBox[i],this.constraints[i]))})}resolveRefConstraints(){const{dragConstraints:t,onMeasureDragConstraints:n}=this.getProps();if(!t||!Vt(t))return!1;const s=t.current,{projection:r}=this.visualElement;if(!r||!r.layout)return!1;r.root&&(r.root.scroll=void 0,r.root.updateScroll());const i=nf(s,r.root,this.visualElement.getTransformPagePoint());let o=iw(r.layout.layoutBox,i);if(n){const a=n(sf(o));this.hasMutatedConstraints=!!a,a&&(o=rf(a))}return o}startAnimation(t){const{drag:n,dragMomentum:s,dragElastic:r,dragTransition:i,dragSnapToOrigin:o,onDragTransitionEnd:a}=this.getProps(),l=this.constraints||{},c=wt(u=>{if(!Fn(u,n,this.currentDirection))return;let d=l&&l[u]||{};(o===!0||o===u)&&(d={min:0,max:0});const m=r?200:1e6,f=r?40:1e7,g={type:"inertia",velocity:s?t[u]:0,bounceStiffness:m,bounceDamping:f,timeConstant:750,restDelta:1,restSpeed:10,...i,...d};return this.startAxisValueAnimation(u,g)});return Promise.all(c).then(a)}startAxisValueAnimation(t,n){const s=this.getAxisMotionValue(t);return ro(this.visualElement,t),s.start(of(t,s,0,n,this.visualElement,!1))}stopAnimation(){wt(t=>this.getAxisMotionValue(t).stop())}getAxisMotionValue(t){const n=`_drag${t.toUpperCase()}`,r=this.visualElement.getProps()[n];return r||this.visualElement.getValue(t,this.visualElement.latestValues[t]??0)}snapToCursor(t){wt(n=>{const{drag:s}=this.getProps();if(!Fn(n,s,this.currentDirection))return;const{projection:r}=this.visualElement,i=this.getAxisMotionValue(n);if(r&&r.layout){const{min:o,max:a}=r.layout.layoutBox[n],l=i.get()||0;i.set(t[n]-es(o,a,.5)+l)}})}scalePositionWithinConstraints(){if(!this.visualElement.current)return;const{drag:t,dragConstraints:n}=this.getProps(),{projection:s}=this.visualElement;if(!Vt(n)||!s||!this.constraints)return;this.stopAnimation();const r={x:0,y:0};wt(o=>{const a=this.getAxisMotionValue(o);if(a&&this.constraints!==!1){const l=a.get();r[o]=ow({min:l,max:l},this.constraints[o])}});const{transformTemplate:i}=this.visualElement.getProps();this.visualElement.current.style.transform=i?i({},""):"none",s.root&&s.root.updateScroll(),s.updateLayout(),this.constraints=!1,this.resolveConstraints(),wt(o=>{if(!Fn(o,t,null))return;const a=this.getAxisMotionValue(o),{min:l,max:c}=this.constraints[o];a.set(es(l,c,r[o]))}),this.visualElement.render()}addListeners(){if(!this.visualElement.current)return;cw.set(this.visualElement,this);const t=this.visualElement.current,n=fn(t,"pointerdown",c=>{const{drag:u,dragListener:d=!0}=this.getProps(),m=c.target,f=m!==t&&cf(m);u&&d&&!f&&this.start(c)});let s;const r=()=>{const{dragConstraints:c}=this.getProps();Vt(c)&&c.current&&(this.constraints=this.resolveRefConstraints(),s||(s=dw(t,c.current,()=>this.scalePositionWithinConstraints())))},{projection:i}=this.visualElement,o=i.addEventListener("measure",r);i&&!i.layout&&(i.root&&i.root.updateScroll(),i.updateLayout()),Xe.read(r);const a=Xn(window,"resize",()=>this.scalePositionWithinConstraints()),l=i.addEventListener("didUpdate",(({delta:c,hasLayoutChanged:u})=>{this.isDragging&&u&&(wt(d=>{const m=this.getAxisMotionValue(d);m&&(this.originPoint[d]+=c[d].translate,m.set(m.get()+c[d].translate))}),this.visualElement.render())}));return()=>{a(),n(),o(),l&&l(),s&&s()}}getProps(){const t=this.visualElement.getProps(),{drag:n=!1,dragDirectionLock:s=!1,dragPropagation:r=!1,dragConstraints:i=!1,dragElastic:o=$r,dragMomentum:a=!0}=t;return{...t,drag:n,dragDirectionLock:s,dragPropagation:r,dragConstraints:i,dragElastic:o,dragMomentum:a}}}function da(e){let t=!0;return()=>{if(t){t=!1;return}e()}}function dw(e,t,n){const s=io(e,da(n)),r=io(t,da(n));return()=>{s(),r()}}function Fn(e,t,n){return(t===!0||t===e)&&(n===null||n===e)}function hw(e,t=10){let n=null;return Math.abs(e.y)>t?n="y":Math.abs(e.x)>t&&(n="x"),n}class fw extends vt{constructor(t){super(t),this.removeGroupControls=Wn,this.removeListeners=Wn,this.controls=new uw(t)}mount(){const{dragControls:t}=this.node.getProps();t&&(this.removeGroupControls=t.subscribe(this.controls)),this.removeListeners=this.controls.addListeners()||Wn}update(){const{dragControls:t}=this.node.getProps(),{dragControls:n}=this.node.prevProps||{};t!==n&&(this.removeGroupControls(),t&&(this.removeGroupControls=t.subscribe(this.controls)))}unmount(){this.removeGroupControls(),this.removeListeners(),this.controls.isDragging||this.controls.endPanSession()}}const vr=e=>(t,n)=>{e&&Xe.update(()=>e(t,n),!1,!0)};class pw extends vt{constructor(){super(...arguments),this.removePointerDownListener=Wn}onPointerDown(t){this.session=new jl(t,this.createPanHandlers(),{transformPagePoint:this.node.getTransformPagePoint(),contextWindow:_l(this.node)})}createPanHandlers(){const{onPanSessionStart:t,onPanStart:n,onPan:s,onPanEnd:r}=this.node.getProps();return{onSessionStart:vr(t),onStart:vr(n),onMove:vr(s),onEnd:(i,o)=>{delete this.session,r&&Xe.postRender(()=>r(i,o))}}}mount(){this.removePointerDownListener=fn(this.node.current,"pointerdown",t=>this.onPointerDown(t))}update(){this.session&&this.session.updateHandlers(this.createPanHandlers())}unmount(){this.removePointerDownListener(),this.session&&this.session.end()}}let Cr=!1;class mw extends p.Component{componentDidMount(){const{visualElement:t,layoutGroup:n,switchLayoutGroup:s,layoutId:r}=this.props,{projection:i}=t;i&&(n.group&&n.group.add(i),s&&s.register&&r&&s.register(i),Cr&&i.root.didUpdate(),i.addEventListener("animationComplete",()=>{this.safeToRemove()}),i.setOptions({...i.options,layoutDependency:this.props.layoutDependency,onExitComplete:()=>this.safeToRemove()})),df.hasEverUpdated=!0}getSnapshotBeforeUpdate(t){const{layoutDependency:n,visualElement:s,drag:r,isPresent:i}=this.props,{projection:o}=s;return o&&(o.isPresent=i,t.layoutDependency!==n&&o.setOptions({...o.options,layoutDependency:n}),Cr=!0,r||t.layoutDependency!==n||n===void 0||t.isPresent!==i?o.willUpdate():this.safeToRemove(),t.isPresent!==i&&(i?o.promote():o.relegate()||Xe.postRender(()=>{const a=o.getStack();(!a||!a.members.length)&&this.safeToRemove()}))),null}componentDidUpdate(){const{visualElement:t,layoutAnchor:n}=this.props,{projection:s}=t;s&&(s.options.layoutAnchor=n,s.root.didUpdate(),uf.postRender(()=>{!s.currentAnimation&&s.isLead()&&this.safeToRemove()}))}componentWillUnmount(){const{visualElement:t,layoutGroup:n,switchLayoutGroup:s}=this.props,{projection:r}=t;Cr=!0,r&&(r.scheduleCheckAfterUnmount(),n&&n.group&&n.group.remove(r),s&&s.deregister&&s.deregister(r))}safeToRemove(){const{safeToRemove:t}=this.props;t&&t()}render(){return null}}function Ml(e){const[t,n]=kl(),s=p.useContext(mi);return h.jsx(mw,{...e,layoutGroup:s,switchLayoutGroup:p.useContext(zl),isPresent:t,safeToRemove:n})}const gw={pan:{Feature:pw},drag:{Feature:fw,ProjectionNode:Oa,MeasureLayout:Ml}};function ha(e,t,n){const{props:s}=e;e.animationState&&s.whileHover&&e.animationState.setActive("whileHover",n==="Start");const r="onHover"+n,i=s[r];i&&Xe.postRender(()=>i(t,wn(t)))}class yw extends vt{mount(){const{current:t}=this.node;t&&(this.unmount=hf(t,(n,s)=>(ha(this.node,s,"Start"),r=>ha(this.node,r,"End"))))}unmount(){}}class xw extends vt{constructor(){super(...arguments),this.isActive=!1}onFocus(){let t=!1;try{t=this.node.current.matches(":focus-visible")}catch{t=!0}!t||!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=Ma(Xn(this.node.current,"focus",()=>this.onFocus()),Xn(this.node.current,"blur",()=>this.onBlur()))}unmount(){}}function fa(e,t,n){const{props:s}=e;if(e.current instanceof HTMLButtonElement&&e.current.disabled)return;e.animationState&&s.whileTap&&e.animationState.setActive("whileTap",n==="Start");const r="onTap"+(n==="End"?"":n),i=s[r];i&&Xe.postRender(()=>i(t,wn(t)))}class ww extends vt{mount(){const{current:t}=this.node;if(!t)return;const{globalTapTarget:n,propagate:s}=this.node.props;this.unmount=ff(t,(r,i)=>(fa(this.node,i,"Start"),(o,{success:a})=>fa(this.node,o,a?"End":"Cancel")),{useGlobalTarget:n,stopPropagation:s?.tap===!1})}unmount(){}}const Vr=new WeakMap,kr=new WeakMap,bw=e=>{const t=Vr.get(e.target);t&&t(e)},Sw=e=>{e.forEach(bw)};function vw({root:e,...t}){const n=e||document;kr.has(n)||kr.set(n,{});const s=kr.get(n),r=JSON.stringify(t);return s[r]||(s[r]=new IntersectionObserver(Sw,{root:e,...t})),s[r]}function Cw(e,t,n){const s=vw(t);return Vr.set(e,n),s.observe(e),()=>{Vr.delete(e),s.unobserve(e)}}const kw={some:0,all:1};class Ew extends vt{constructor(){super(...arguments),this.hasEnteredView=!1,this.isInView=!1}startObserver(){this.stopObserver?.();const{viewport:t={}}=this.node.getProps(),{root:n,margin:s,amount:r="some",once:i}=t,o={root:n?n.current:void 0,rootMargin:s,threshold:typeof r=="number"?r:kw[r]},a=l=>{const{isIntersecting:c}=l;if(this.isInView===c||(this.isInView=c,i&&!c&&this.hasEnteredView))return;c&&(this.hasEnteredView=!0),this.node.animationState&&this.node.animationState.setActive("whileInView",c);const{onViewportEnter:u,onViewportLeave:d}=this.node.getProps(),m=c?u:d;m&&m(l)};this.stopObserver=Cw(this.node.current,o,a)}mount(){this.startObserver()}update(){if(typeof IntersectionObserver>"u")return;const{props:t,prevProps:n}=this.node;["amount","margin","root"].some(Pw(t,n))&&this.startObserver()}unmount(){this.stopObserver?.(),this.hasEnteredView=!1,this.isInView=!1}}function Pw({viewport:e={}},{viewport:t={}}={}){return n=>e[n]!==t[n]}const Tw={inView:{Feature:Ew},tap:{Feature:ww},focus:{Feature:xw},hover:{Feature:yw}},Iw={layout:{ProjectionNode:Oa,MeasureLayout:Ml}},Aw={...Kx,...Tw,...gw,...Iw},Nw=Gx(Aw,Qx);function zw(){const e=ce(t=>t.toasts);return h.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:h.jsx(vx,{children:e.map(t=>h.jsxs(Nw.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 ring-1 ring-black/5 shadow-2xl rounded-xl p-4 flex gap-3 border-l-4 border-emerald-500 overflow-hidden",id:`toast-${t.id}`,children:[h.jsxs("div",{className:"flex-1",children:[h.jsxs("div",{className:"flex items-center gap-2",children:[h.jsx("span",{className:"p-1 rounded-full bg-emerald-50 text-emerald-600",children:h.jsx(Ih,{size:16})}),h.jsx("p",{className:"font-semibold text-gray-900 text-sm font-sans",children:t.title})]}),h.jsx("p",{className:"text-xs text-gray-500 mt-2 leading-relaxed font-sans",children:t.message})]}),h.jsx("button",{type:"button",onClick:()=>Pe.getState().removeToast(t.id),className:"text-gray-400 hover:text-gray-600 hover:bg-gray-50 rounded p-1 h-fit transition-colors shrink-0 cursor-pointer",children:h.jsx(gn,{size:14})})]},t.id))})})}function Lw({showRightSidebar:e,setShowRightSidebar:t,rightSidebarTab:n,setRightSidebarTab:s,effectiveAgentProviderId:r,agentProviderId:i,setAgentProviderId:o,aiProviders:a,selectedAgentProvider:l,chatLog:c,loading:u,input:d,setInput:m,handleSend:f,chatAttachments:g,setChatAttachments:x,handleChatFileChange:C,handleChatDrop:b,onClearAgentMemory:I,events:S,lang:E,t:z}){const k=p.useRef(null);return p.useEffect(()=>{k.current?.scrollIntoView({behavior:"smooth"})},[c]),h.jsx("div",{className:`transition-all duration-300 bg-white border-l border-gray-200 flex flex-col shadow-xl relative z-30 shrink-0 ${e?"w-96":"w-12 items-center cursor-pointer hover:bg-gray-50"}`,children:e?h.jsxs(h.Fragment,{children:[h.jsxs("div",{className:"flex bg-gray-100 p-1 m-4 rounded-lg shrink-0",children:[h.jsxs("button",{onClick:()=>s("agent"),className:`flex-1 py-1.5 text-xs font-medium rounded-md transition-colors flex items-center justify-center gap-1 ${n==="agent"?"bg-white shadow text-indigo-600":"text-gray-500 hover:text-gray-700"}`,children:[h.jsx(rr,{size:14})," Agent"]}),h.jsxs("button",{onClick:()=>s("shell"),className:`flex-1 py-1.5 text-xs font-medium rounded-md transition-colors flex items-center justify-center gap-1 ${n==="shell"?"bg-white shadow text-indigo-600":"text-gray-500 hover:text-gray-700"}`,children:[h.jsx(qn,{size:14})," Shell"]}),h.jsx("button",{onClick:()=>t(!1),className:"ml-1 p-1.5 text-gray-400 hover:text-gray-600 rounded-md",children:h.jsx(Ah,{size:14})})]}),n==="agent"?h.jsxs("div",{className:"flex-1 flex flex-col min-h-0",children:[h.jsx("div",{className:"p-4 border-b border-gray-100 shrink-0",children:h.jsxs("div",{className:"flex items-start justify-between gap-3",children:[h.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[h.jsx("div",{className:"p-1.5 bg-indigo-50 text-indigo-600 rounded-lg",children:h.jsx(rr,{size:16})}),h.jsxs("div",{className:"min-w-0",children:[h.jsx("h2",{className:"font-semibold text-gray-900 text-sm",children:z.agentTitle}),h.jsx("p",{className:"text-[10px] text-gray-500",children:z.agentSubtitle}),h.jsxs("button",{onClick:I,title:E==="zh"?"清除内核助手的对话记忆":"Clear the kernel assistant's conversation memory",className:"mt-1 inline-flex items-center gap-1 text-[10px] text-gray-400 hover:text-red-500 transition-colors",children:["🧹 ",E==="zh"?"清除记忆":"Clear memory"]})]})]}),h.jsxs("div",{className:"flex flex-col items-end gap-1.5 min-w-[150px] max-w-[50%]",children:[h.jsx("span",{className:"text-[10px] font-semibold uppercase tracking-[0.18em] text-gray-400",children:E==="zh"?"AI 提供商":"AI Provider"}),h.jsxs("div",{className:"relative w-full",children:[h.jsxs("select",{value:r,onChange:L=>o(L.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-[11px] font-medium text-gray-700 shadow-sm outline-none transition-colors focus:border-indigo-400 focus:ring-2 focus:ring-indigo-100",children:[h.jsx("option",{value:"system",children:E==="zh"?"系统默认(Gemini)":"System Default (Gemini)"}),a.map(L=>h.jsx("option",{value:L.id,children:L.name},L.id))]}),h.jsx(Ta,{size:12,className:"pointer-events-none absolute right-3 top-1/2 -translate-y-1/2 text-gray-400"})]}),h.jsx("div",{className:"text-[10px] text-gray-400 truncate w-full text-right",title:r==="system"?E==="zh"?"使用内置 Gemini 系统模型":"Using the built-in Gemini system model":l?.model_name||"",children:r==="system"?E==="zh"?"内置系统模型":"Built-in system model":`${l?.name||(E==="zh"?"已选提供商":"Selected provider")}`})]})]})}),h.jsxs("div",{className:"flex-1 overflow-y-auto p-4 space-y-4",children:[c.map((L,R)=>h.jsx("div",{className:`flex flex-col ${L.role==="user"?"items-end":"items-start"}`,children:h.jsx("div",{className:`px-4 py-2.5 rounded-2xl max-w-[85%] text-xs whitespace-pre-wrap ${L.role==="user"?"bg-indigo-600 text-white rounded-br-none":"bg-gray-100 text-gray-800 rounded-bl-none"}`,children:L.content})},R)),u&&h.jsx("div",{className:"flex items-start",children:h.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:[h.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-gray-400 animate-bounce"}),h.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-gray-400 animate-bounce",style:{animationDelay:"0.1s"}}),h.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-gray-400 animate-bounce",style:{animationDelay:"0.2s"}})]})}),h.jsx("div",{ref:k})]}),h.jsxs("form",{onSubmit:f,className:"p-3 border-t border-gray-100 bg-white shrink-0 font-sans",onDragOver:L=>L.preventDefault(),onDrop:b,children:[g.length>0&&h.jsx("div",{className:"flex flex-wrap gap-1 mb-2 px-1",children:g.map((L,R)=>h.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-[10px]",children:[h.jsx(za,{size:10,className:"shrink-0"}),h.jsx("span",{className:"truncate max-w-[100px]",title:L.name,children:L.name}),h.jsx("button",{type:"button",onClick:()=>x(O=>O.filter((P,N)=>N!==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:h.jsx(gn,{size:10})})]},R))}),h.jsxs("div",{className:"flex items-center gap-1.5",children:[h.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:[h.jsx(Nh,{size:14}),h.jsx("input",{type:"file",multiple:!0,className:"hidden",onChange:C,accept:".csv,.txt,.json,.md"})]}),h.jsxs("div",{className:"relative flex-1",children:[h.jsx("input",{type:"text",value:d,onChange:L=>m(L.target.value),placeholder:z.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"}),h.jsx("button",{type:"submit",disabled:u||!d.trim(),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",children:h.jsx(zh,{size:10})})]})]})]})]}):h.jsxs("div",{className:"flex-1 flex flex-col bg-black text-green-400 font-mono text-[10px] min-h-0 mx-4 mb-4 rounded-xl shadow-inner border border-gray-800 overflow-hidden",children:[h.jsx("div",{className:"p-3 border-b border-gray-800 flex items-center justify-between shrink-0 bg-gray-900",children:h.jsxs("div",{className:"flex items-center gap-2 text-gray-300 font-sans tracking-wide",children:[h.jsx(qn,{size:14}),h.jsx("span",{className:"text-xs",children:z.eventStream})]})}),h.jsx("div",{className:"p-3 overflow-y-auto flex-1 flex flex-col gap-1 select-text",children:S.length===0?h.jsx("div",{className:"text-gray-600 italic",children:"Waiting for events..."}):S.map((L,R)=>h.jsxs("div",{className:"flex flex-col gap-1 hover:bg-gray-800/50 p-2 rounded mb-1",children:[h.jsxs("div",{className:"flex items-center gap-2 justify-between",children:[h.jsxs("span",{className:"text-gray-500 shrink-0 text-[9px]",children:["[",new Date(L.timestamp).toLocaleTimeString(),"]"]}),h.jsx("span",{className:"text-blue-400 shrink-0 truncate text-[9px]",title:L.source,children:L.source})]}),h.jsx("div",{className:"text-green-300 font-bold",children:L.type}),h.jsx("div",{className:"text-gray-400 break-words mt-1 leading-tight",children:L.payload})]},R))})]})]}):h.jsxs("div",{className:"flex flex-col items-center py-6 h-full text-gray-400 w-full",onClick:()=>t(!0),children:[h.jsx(rr,{size:18,className:"mb-6 hover:text-indigo-500"}),h.jsx(qn,{size:18,className:"hover:text-indigo-500"}),h.jsx("div",{className:"mt-8 flex-1 flex flex-col justify-end pb-8",children:h.jsx("div",{className:"uppercase tracking-widest text-[9px] rotate-180",style:{writingMode:"vertical-rl"},children:"OS Core Options"})})]})})}const _w=p.lazy(()=>Ne(()=>import("./ImportModal-CmUt1YeX.js"),[]).then(e=>({default:e.ImportModal}))),jw=p.lazy(()=>Ne(()=>import("./CourseWizardModal-BOgLpLz7.js"),[]).then(e=>({default:e.CourseWizardModal}))),Rw=p.lazy(()=>Ne(()=>import("./ImportLessonsModal-Bwy2r-96.js"),[]).then(e=>({default:e.ImportLessonsModal}))),Mw=p.lazy(()=>Ne(()=>import("./QuizGeneratorModal-DWH1zP0X.js"),[]).then(e=>({default:e.QuizGeneratorModal}))),Ow=p.lazy(()=>Ne(()=>import("./StudentPreviewModal-BwXG6Cis.js"),[]).then(e=>({default:e.StudentPreviewModal}))),Dw=p.lazy(()=>Ne(()=>import("./ProcessLogsModal-B-PY780w.js"),[]).then(e=>({default:e.ProcessLogsModal}))),Fw=p.lazy(()=>Ne(()=>import("./CloudDriveModal-cPtTMriS.js"),[]).then(e=>({default:e.CloudDriveModal}))),Bw=p.lazy(()=>Ne(()=>import("./SystemResourceLibraryModal-BTL8rB0g.js"),[]).then(e=>({default:e.SystemResourceLibraryModal}))),$w=p.lazy(()=>Ne(()=>import("./BatchPickerModal-9BhmNM2R.js"),[]).then(e=>({default:e.BatchPickerModal}))),Vw=p.lazy(()=>Ne(()=>import("./ExportWeightModal-DSzySeqh.js"),[]).then(e=>({default:e.ExportWeightModal}))),Uw=p.lazy(()=>Ne(()=>import("./NotificationDetailModal-Bk1g_prI.js"),[]).then(e=>({default:e.NotificationDetailModal}))),qw=p.lazy(()=>Ne(()=>import("./HelpTour-DwM9UBiA.js"),[]).then(e=>({default:e.HelpTour}))),Ww=p.lazy(()=>Ne(()=>import("./CoursewareHubPanel-Cb1mAqHS.js"),[]).then(e=>({default:e.CoursewareHubPanel})));function Hw(e){const{lang:t,t:n,showImportModal:s=!1,setShowImportModal:r=()=>{},handleImportFile:i=()=>{},importError:o=null,importSuccess:a=null,isImporting:l=!1,downloadCSVTemplate:c=()=>{},addToast:u=()=>{},generateTemplateContent:d=()=>"",isImportLessonsOpen:m=!1,setIsImportLessonsOpen:f=()=>{},importStatus:g="idle",setIsDraggingImport:x=()=>{},handleCSVFileChange:C=()=>{},downloadCsvTemplate:b=()=>{},isDraggingImport:I=!1,previewImportData:S=[],setPreviewImportData:E=()=>{},setImportStatus:z=()=>{},importProgress:k=0,importProgressTotal:L=0,importErrorMsg:R="",setImportErrorMsg:O=()=>{},handleCSVImportSubmit:P=()=>{},lessons:N=[],fetchClassDashboard:_=()=>{},isLessonPreviewVisible:D=!1,setIsLessonPreviewVisible:F=()=>{},selectedLesson:A=null,previewFullscreenPanel:T="none",setPreviewFullscreenPanel:B=()=>{},previewLessonTab:M="whiteboard",setPreviewLessonTab:q=()=>{},activeRole:y="teacher",elements:te=[],activeSegmentId:ae=null,setActiveSegmentId:w=()=>{},fetchElements:W=()=>{},currentVfsParent:ee=null,setCurrentVfsParent:se=()=>{},vfsNodes:fe=[],previewSelectedCourseware:ge=null,setPreviewSelectedCourseware:Le=()=>{},showProcessLogs:Ae=null,setShowProcessLogs:he=()=>{},processLogsContent:ft="",isCloudDriveOpen:Lt=!1,setIsCloudDriveOpen:_t=()=>{},cloudDrivePreviewNode:pt=null,setCloudDrivePreviewNode:mt=()=>{},isSystemResourceLibraryOpen:G=!1,setIsSystemResourceLibraryOpen:K=()=>{},systemResourceTab:re="system",setSystemResourceTab:be=()=>{},selectedLibraryResourceId:We=null,setSelectedLibraryResourceId:de=()=>{},loadingLibraryResources:Te=!1,libraryResources:Ce=[],fetchLibraryResources:Ye=()=>{},classes:j=[],expandedClassId:U=null,isExportWeightModalOpen:Q=!1,setIsExportWeightModalOpen:Y=()=>{},quizzesWeight:ie=40,setQuizzesWeight:Ie=()=>{},assignmentsWeight:Ze=60,setAssignmentsWeight:_e=()=>{},handleQuizzesWeightChange:lt=()=>{},handleAssignmentsWeightChange:je=()=>{},customCategoryOverrides:ye={},setCustomCategoryOverrides:He=()=>{},classDashboardMap:Fe={},exportClassId:ds="",exportClassName:hs="",csvPreviewData:fs=null,handleExportGrades:ps=()=>{},setSelectedAssignment:ms=()=>{},setStudentViewStatus:gs=()=>{},setQuizStudentAnswers:ys=()=>{},setSubAssignmentTab:bn=()=>{},isTourOpen:xs=!1,setIsTourOpen:ws=()=>{},handleSeedSuccess:bs=()=>{},setTeacherTab:Qt=()=>{},showCoursewareHub:Jt=!1,setShowCoursewareHub:Sn=()=>{}}=e,ke=e.courseWizard,jt=ke?.isCourseWizardOpen??e.isCourseWizardOpen??!1,Ss=ke?.setIsCourseWizardOpen??e.setIsCourseWizardOpen??(()=>{}),et=ke?.wizardStep??e.wizardStep??1,vn=ke?.setWizardStep??e.setWizardStep??(()=>{}),vs=ke?.wizardIsSubmitting??e.wizardIsSubmitting??!1,Cn=ke?.wizardCourseTitle??e.wizardCourseTitle??"",Cs=ke?.setWizardCourseTitle??e.setWizardCourseTitle??(()=>{}),Rt=ke?.wizardCourseDescription??e.wizardCourseDescription??"",ks=ke?.setWizardCourseDescription??e.setWizardCourseDescription??(()=>{}),kn=ke?.wizardCourseCategory??e.wizardCourseCategory??"",Es=ke?.setWizardCourseCategory??e.setWizardCourseCategory??(()=>{}),Ps=ke?.wizardCourseTimeline??e.wizardCourseTimeline??[],Ts=ke?.setWizardCourseTimeline??e.setWizardCourseTimeline??(()=>{}),Is=ke?.wizardCourseContent??e.wizardCourseContent??"",As=ke?.setWizardCourseContent??e.setWizardCourseContent??(()=>{}),Ns=ke?.handleDeployWizardCourse??e.handleDeployWizardCourse??(()=>{}),me=e.quizGenerator,zs=me?.isQuizGeneratorOpen??e.isQuizGeneratorOpen??!1,kt=me?.setIsQuizGeneratorOpen??e.setIsQuizGeneratorOpen??(()=>{}),Ls=me?.quizGenMode??e.quizGenMode??"scan_lesson",_s=me?.setQuizGenMode??e.setQuizGenMode??(()=>{}),js=me?.quizGenSelectedLessonId??e.quizGenSelectedLessonId??"",En=me?.setQuizGenSelectedLessonId??e.setQuizGenSelectedLessonId??(()=>{}),Pn=me?.quizGenTopic??e.quizGenTopic??"",Rs=me?.setQuizGenTopic??e.setQuizGenTopic??(()=>{}),Ms=me?.isGeneratingSuggestions??e.isGeneratingSuggestions??!1,Tn=me?.setIsGeneratingSuggestions??e.setIsGeneratingSuggestions??(()=>{}),Yt=me?.suggestedObjectives??e.suggestedObjectives??[],Zt=me?.setSuggestedObjectives??e.setSuggestedObjectives??(()=>{}),Os=me?.suggestedQuestions??e.suggestedQuestions??[],Ds=me?.setSuggestedQuestions??e.setSuggestedQuestions??(()=>{}),Se=me?.quizGenTimeLimit??e.quizGenTimeLimit??0,Et=me?.setQuizGenTimeLimit??e.setQuizGenTimeLimit??(()=>{}),In=me?.savingQuiz??e.savingQuiz??!1,An=me?.setSavingQuiz??e.setSavingQuiz??(()=>{}),Be=me?.quizGeneratorClassId??e.quizGeneratorClassId??null,Re=e.classBatch,Fs=Re?.batchPicker??e.batchPicker??null,Bs=Re?.setBatchPicker??e.setBatchPicker??(()=>{}),$s=Re?.batchPickerLesson??e.batchPickerLesson??"",Mt=Re?.setBatchPickerLesson??e.setBatchPickerLesson??(()=>{}),Vs=Re?.batchPickerDate??e.batchPickerDate??"",Pt=Re?.setBatchPickerDate??e.setBatchPickerDate??(()=>{}),gt=Re?.batchPickerTargetClass??e.batchPickerTargetClass??"",$e=Re?.setBatchPickerTargetClass??e.setBatchPickerTargetClass??(()=>{}),Us=Re?.confirmBatchPicker??e.confirmBatchPicker??(()=>{}),Ot=e.studentNotificationsHook,qs=Ot?.selectedNotificationForModal??e.selectedNotificationForModal??null,Ws=Ot?.setSelectedNotificationForModal??e.setSelectedNotificationForModal??(()=>{});return h.jsxs(p.Suspense,{fallback:null,children:[h.jsx(_w,{show:s,onClose:()=>r(!1),lang:t,handleImportFile:i,importError:o,importSuccess:a,isImporting:l,downloadCSVTemplate:c}),h.jsx(jw,{isCourseWizardOpen:jt,setIsCourseWizardOpen:Ss,lang:t,wizardStep:et,setWizardStep:vn,wizardIsSubmitting:vs,wizardCourseTitle:Cn,setWizardCourseTitle:Cs,wizardCourseDescription:Rt,setWizardCourseDescription:ks,wizardCourseCategory:kn,setWizardCourseCategory:Es,wizardCourseTimeline:Ps,setWizardCourseTimeline:Ts,wizardCourseContent:Is,setWizardCourseContent:As,addToast:u,generateTemplateContent:d,handleDeployWizardCourse:Ns}),h.jsx(Rw,{isImportLessonsOpen:m,setIsImportLessonsOpen:f,lang:t,importStatus:g,setIsDraggingImport:x,handleCSVFileChange:C,downloadCsvTemplate:b,isDraggingImport:I,previewImportData:S,setPreviewImportData:E,setImportStatus:z,importProgress:k,importProgressTotal:L,importErrorMsg:R,setImportErrorMsg:O,handleCSVImportSubmit:P}),h.jsx(Mw,{isQuizGeneratorOpen:zs,setIsQuizGeneratorOpen:kt,lessons:N,quizGenMode:Ls,setQuizGenMode:_s,quizGenSelectedLessonId:js,setQuizGenSelectedLessonId:En,quizGenTopic:Pn,setQuizGenTopic:Rs,isGeneratingSuggestions:Ms,setIsGeneratingSuggestions:Tn,suggestedObjectives:Yt,setSuggestedObjectives:Zt,suggestedQuestions:Os,setSuggestedQuestions:Ds,quizGenTimeLimit:Se,setQuizGenTimeLimit:Et,savingQuiz:In,setSavingQuiz:An,quizGeneratorClassId:Be,fetchClassDashboard:_}),h.jsx(Ow,{isLessonPreviewVisible:D,setIsLessonPreviewVisible:F,lessons:N,selectedLesson:A,previewFullscreenPanel:T,setPreviewFullscreenPanel:B,previewLessonTab:M,setPreviewLessonTab:q,activeRole:y,elements:te,activeSegmentId:ae,setActiveSegmentId:w,fetchElements:W,currentVfsParent:ee,setCurrentVfsParent:se,vfsNodes:fe,previewSelectedCourseware:ge,setPreviewSelectedCourseware:Le}),h.jsx(Dw,{showProcessLogs:Ae,setShowProcessLogs:he,processLogsContent:ft,t:n}),h.jsx(Fw,{isOpen:Lt,onClose:()=>_t(!1),vfsNodes:fe,currentVfsParent:ee,setCurrentVfsParent:se,cloudDrivePreviewNode:pt,setCloudDrivePreviewNode:mt}),h.jsx(Bw,{isSystemResourceLibraryOpen:G,setIsSystemResourceLibraryOpen:K,lang:t,systemResourceTab:re,setSystemResourceTab:be,selectedLibraryResourceId:We,setSelectedLibraryResourceId:de,vfsNodes:fe,currentVfsParent:ee,setCurrentVfsParent:se,cloudDrivePreviewNode:pt,setCloudDrivePreviewNode:mt,loadingLibraryResources:Te,libraryResources:Ce,fetchLibraryResources:Ye}),h.jsx($w,{batchPicker:Fs,setBatchPicker:Bs,batchPickerLesson:$s,setBatchPickerLesson:Mt,batchPickerDate:Vs,setBatchPickerDate:Pt,batchPickerTargetClass:gt,setBatchPickerTargetClass:$e,lessons:N,classes:j,expandedClassId:U,confirmBatchPicker:Us,lang:t}),h.jsx(Vw,{isExportWeightModalOpen:Q,setIsExportWeightModalOpen:Y,lang:t,quizzesWeight:ie,setQuizzesWeight:Ie,assignmentsWeight:Ze,setAssignmentsWeight:_e,handleQuizzesWeightChange:lt,handleAssignmentsWeightChange:je,customCategoryOverrides:ye,setCustomCategoryOverrides:He,classDashboardMap:Fe,exportClassId:ds,exportClassName:hs,csvPreviewData:fs,handleExportGrades:ps}),h.jsx(Uw,{notification:qs,onClose:()=>Ws(null),lang:t,onOpenWorkspace:Kt=>{ms(Kt),gs("assignment"),ys({}),bn("quiz")}}),h.jsx(qw,{isOpen:xs,onClose:()=>ws(!1),lang:t,onSeedSuccess:bs,onJumpTab:Kt=>Qt(Kt)}),Jt&&h.jsx(Ww,{onClose:()=>Sn(!1),lang:t})]})}const Gw=["whiteboard.","courseware.","quiz.","rollcall."];class Qw{constructor(){this.handlers=new Map}setSocketBridge(t){this.socketBridge=t}hasSocketBridge(){return!!this.socketBridge}subscribe(t,n){return this.handlers.has(t)||this.handlers.set(t,new Set),this.handlers.get(t).add(n),()=>{this.handlers.get(t)?.delete(n)}}async publish(t){const n=this.handlers.get(t.type);if(n)for(const s of n)try{s(t)}catch(r){console.error("[FrontendEventBus] handler error:",r)}this.socketBridge&&Gw.some(s=>t.type.startsWith(s))&&this.socketBridge(t)}}const Jw=new Qw;async function Yw(e){const t=e.data;if(!t||typeof t!="object")return;if(typeof window<"u"&&typeof document<"u"&&e.source)try{if(!Array.from(document.querySelectorAll("iframe")).some(c=>c.contentWindow===e.source)&&e.source!==window)return}catch{}let n=t.attempt_id;const s=t.type||"",r=t.payload||t;if(!n&&e.source)try{const a=Array.from(document.querySelectorAll("iframe")).find(l=>l.contentWindow===e.source);if(a&&a.contentWindow){const l=a.contentWindow;l.__LMS_STUDENT__?.attempt_id&&(n=l.__LMS_STUDENT__.attempt_id)}}catch{}if(!n||typeof n!="string")return;if(s==="LMS_CONFIG"){Bn("courseware.config_reported",n,t.config??r);return}if(s==="LMS_GET_PROGRESS"){const a=t.requestId,l=e.source;if(a&&l&&typeof l.postMessage=="function"){let c=null;try{c=(await(await fetch(`/api/courseware/attempts/${encodeURIComponent(n)}/progress`)).json()).progress??null}catch{c=null}l.postMessage({type:"LMS_PROGRESS_RESPONSE",requestId:a,progress:c},"*")}return}const i=s==="LMS_SUBMIT"||s==="LMS_FINISH"||s==="submit"||s==="finish"||s==="completed"||r&&typeof r=="object"&&(r.score!==void 0||r.grade!==void 0||r.result!==void 0||r.points!==void 0),o=s==="LMS_SAVE_PROGRESS"||s==="saveProgress";if(i){Bn("courseware.submitted",n,r);try{await fetch(`/api/courseware/attempts/${encodeURIComponent(n)}/submit`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({score:r?.score??r?.grade??r?.result??r?.points??void 0,comment:r?.comment??r?.feedback??r?.note??void 0,completion:r?.completion??1,status:"submitted",extra:r})})}catch(a){console.error("[LMS Bridge] Failed to submit attempt data to backend:",a)}}else if(o){Bn("courseware.progress_saved",n,r);try{await fetch(`/api/courseware/attempts/${encodeURIComponent(n)}/submit`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({score:r?.score??r?.grade??r?.result??r?.points??void 0,comment:r?.comment??r?.feedback??void 0,completion:r?.completion??void 0,status:"inprogress",extra:r})})}catch(a){console.error("[LMS Bridge] Failed to save progress to backend:",a)}}else{Bn("courseware.event_logged",n,r);try{await fetch(`/api/courseware/attempts/${encodeURIComponent(n)}/log`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({eventType:s||"log",payload:r})})}catch(a){console.error("[LMS Bridge] Failed to log event to backend:",a)}}}function Bn(e,t,n){Jw.publish({id:pf(),type:e,source:"courseware-bridge",payload:{attemptId:t,data:n},timestamp:Date.now(),correlationId:t})}function Zw(e){p.useEffect(()=>{if(!e)return;const t=n=>{Yw(n)};return window.addEventListener("message",t),()=>{window.removeEventListener("message",t)}},[e])}function Kw(e){const{session:t,showProcessLogs:n,activeStudentId:s,currentVfsParent:r,selectedLesson:i,selectedAssignment:o,expandedClassId:a,fetchLessons:l,fetchPlugins:c,fetchRegisteredCommands:u,fetchEvents:d,fetchApprovals:m,fetchProcesses:f,fetchClasses:g,fetchTodaySchedules:x,fetchStudents:C,fetchLabs:b,fetchVfs:I,fetchProcessLogs:S,fetchClassStudents:E,fetchElements:z}=e,k=p.useRef(r),L=p.useRef(i),R=p.useRef(o),O=p.useRef(a);p.useEffect(()=>{k.current=r},[r]),p.useEffect(()=>{L.current=i},[i]),p.useEffect(()=>{R.current=o},[o]),p.useEffect(()=>{O.current=a},[a]),p.useEffect(()=>{if(!t)return;l(),c(),u(),d(),m(),f(),g(),x(),C(),b(),I(k.current);let P=!1;const N=setInterval(async()=>{if(!P){P=!0;try{if(await d(),await l(),await m(),await f(),await g(),await x().catch(()=>{}),await C(),await b(),await I(k.current),await u(),n&&await S(n),O.current&&await E(O.current),L.current&&await z(L.current),R.current){const _=s||R.current.student_id;await z(`assignment-${R.current.id}-student-${_}`)}}finally{P=!1}}},2e3);return()=>clearInterval(N)},[t,n,s]),p.useEffect(()=>{I(r)},[r]),p.useEffect(()=>{i&&z(i)},[i])}function Xw(e){const{lang:t,t:n,selectedLesson:s,effectiveAgentProviderId:r,expandedClassId:i,fetchLessons:o,fetchClasses:a,fetchStudents:l,fetchClassStudents:c,fetchClassProgress:u,fetchClassDashboard:d,fetchElements:m}=e,[f,g]=p.useState([{role:"agent",content:n.agentIntro||""}]),[x,C]=p.useState(""),[b,I]=p.useState(!1),[S,E]=p.useState([]);p.useEffect(()=>{f.length===1&&f[0].role==="agent"&&g([{role:"agent",content:n.agentIntro}])},[t,n.agentIntro]);const z=p.useCallback(async P=>{try{const N=await fetch(`/api/agent/conversations?lessonId=${encodeURIComponent(P||"")}`);if(!N.ok)return;const _=await N.json(),D=Array.isArray(_.messages)?_.messages:[];D.length>0?g(D.map(F=>({role:F.role==="assistant"?"agent":"user",content:F.content}))):g([{role:"agent",content:n.agentIntro}])}catch{}},[n.agentIntro]),k=p.useCallback(async()=>{try{await fetch(`/api/agent/conversations?lessonId=${encodeURIComponent(s||"")}`,{method:"DELETE"})}catch{}g([{role:"agent",content:n.agentIntro}])},[s,n.agentIntro]);return p.useEffect(()=>{z(s)},[s,z]),{chatLog:f,setChatLog:g,input:x,setInput:C,loading:b,setLoading:I,chatAttachments:S,setChatAttachments:E,handleChatFileChange:P=>{P.target.files&&Array.from(P.target.files).forEach(N=>{const _=new FileReader;_.onload=D=>{D.target?.result&&E(F=>[...F,{name:N.name,content:D.target.result}])},N.name.endsWith(".zip")?_.readAsDataURL(N):_.readAsText(N)})},handleChatDrop:P=>{P.preventDefault(),P.dataTransfer.files&&Array.from(P.dataTransfer.files).forEach(N=>{const _=new FileReader;_.onload=D=>{D.target?.result&&E(F=>[...F,{name:N.name,content:D.target.result}])},N.name.endsWith(".zip")?_.readAsDataURL(N):_.readAsText(N)})},handleSend:async P=>{if(P.preventDefault(),!x.trim()||b)return;const N=[...S];let _=x;N.length>0&&(_+=`
|
|
130
|
-
(📁 ${t==="zh"?"附件":"Attachments"}: ${N.map(D=>D.name).join(", ")})`),g(D=>[...D,{role:"user",content:_}]),C(""),E([]),I(!0);try{const D=await fetch("/api/agent/chat",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({message:x,lang:t,currentLessonId:s,attachments:N,providerId:r==="system"?null:r})}),F=await D.json();let A="";!D.ok||F.success===!1?A=`⚠️ [System Error] ${F.error||(t==="zh"?"未知系统错误":"Unknown System Error")}`:(A=F.agentText||"",F.toolResults&&F.toolResults.length>0&&(A+=`
|
|
131
|
-
|
|
132
|
-
${n.executedCommands}`+F.toolResults.map(T=>T.callName).join(", "))),g(T=>[...T,{role:"agent",content:A}]),await o(),await a(),await l(),i&&(await c(i),await u(i),await d(i)),s&&await m(s)}catch{g(D=>[...D,{role:"agent",content:n.simulationError}])}finally{I(!1)}},handleClearAgentMemory:k,restoreAgentMemory:z}}const at=Object.create(null);at.open="0";at.close="1";at.ping="2";at.pong="3";at.message="4";at.upgrade="5";at.noop="6";const Gn=Object.create(null);Object.keys(at).forEach(e=>{Gn[at[e]]=e});const Ur={type:"error",data:"parser error"},Ol=typeof Blob=="function"||typeof Blob<"u"&&Object.prototype.toString.call(Blob)==="[object BlobConstructor]",Dl=typeof ArrayBuffer=="function",Fl=e=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(e):e&&e.buffer instanceof ArrayBuffer,bi=({type:e,data:t},n,s)=>Ol&&t instanceof Blob?n?s(t):pa(t,s):Dl&&(t instanceof ArrayBuffer||Fl(t))?n?s(t):pa(new Blob([t]),s):s(at[e]+(t||"")),pa=(e,t)=>{const n=new FileReader;return n.onload=function(){const s=n.result.split(",")[1];t("b"+(s||""))},n.readAsDataURL(e)};function ma(e){return e instanceof Uint8Array?e:e instanceof ArrayBuffer?new Uint8Array(e):new Uint8Array(e.buffer,e.byteOffset,e.byteLength)}let Er;function eb(e,t){if(Ol&&e.data instanceof Blob)return e.data.arrayBuffer().then(ma).then(t);if(Dl&&(e.data instanceof ArrayBuffer||Fl(e.data)))return t(ma(e.data));bi(e,!1,n=>{Er||(Er=new TextEncoder),t(Er.encode(n))})}const ga="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",cn=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(let e=0;e<ga.length;e++)cn[ga.charCodeAt(e)]=e;const tb=e=>{let t=e.length*.75,n=e.length,s,r=0,i,o,a,l;e[e.length-1]==="="&&(t--,e[e.length-2]==="="&&t--);const c=new ArrayBuffer(t),u=new Uint8Array(c);for(s=0;s<n;s+=4)i=cn[e.charCodeAt(s)],o=cn[e.charCodeAt(s+1)],a=cn[e.charCodeAt(s+2)],l=cn[e.charCodeAt(s+3)],u[r++]=i<<2|o>>4,u[r++]=(o&15)<<4|a>>2,u[r++]=(a&3)<<6|l&63;return c},nb=typeof ArrayBuffer=="function",Si=(e,t)=>{if(typeof e!="string")return{type:"message",data:Bl(e,t)};const n=e.charAt(0);return n==="b"?{type:"message",data:sb(e.substring(1),t)}:Gn[n]?e.length>1?{type:Gn[n],data:e.substring(1)}:{type:Gn[n]}:Ur},sb=(e,t)=>{if(nb){const n=tb(e);return Bl(n,t)}else return{base64:!0,data:e}},Bl=(e,t)=>{switch(t){case"blob":return e instanceof Blob?e:new Blob([e]);case"arraybuffer":default:return e instanceof ArrayBuffer?e:e.buffer}},$l="",rb=(e,t)=>{const n=e.length,s=new Array(n);let r=0;e.forEach((i,o)=>{bi(i,!1,a=>{s[o]=a,++r===n&&t(s.join($l))})})},ib=(e,t)=>{const n=e.split($l),s=[];for(let r=0;r<n.length;r++){const i=Si(n[r],t);if(s.push(i),i.type==="error")break}return s};function ob(){return new TransformStream({transform(e,t){eb(e,n=>{const s=n.length;let r;if(s<126)r=new Uint8Array(1),new DataView(r.buffer).setUint8(0,s);else if(s<65536){r=new Uint8Array(3);const i=new DataView(r.buffer);i.setUint8(0,126),i.setUint16(1,s)}else{r=new Uint8Array(9);const i=new DataView(r.buffer);i.setUint8(0,127),i.setBigUint64(1,BigInt(s))}e.data&&typeof e.data!="string"&&(r[0]|=128),t.enqueue(r),t.enqueue(n)})}})}let Pr;function $n(e){return e.reduce((t,n)=>t+n.length,0)}function Vn(e,t){if(e[0].length===t)return e.shift();const n=new Uint8Array(t);let s=0;for(let r=0;r<t;r++)n[r]=e[0][s++],s===e[0].length&&(e.shift(),s=0);return e.length&&s<e[0].length&&(e[0]=e[0].slice(s)),n}function ab(e,t){Pr||(Pr=new TextDecoder);const n=[];let s=0,r=-1,i=!1;return new TransformStream({transform(o,a){for(n.push(o);;){if(s===0){if($n(n)<1)break;const l=Vn(n,1);i=(l[0]&128)===128,r=l[0]&127,r<126?s=3:r===126?s=1:s=2}else if(s===1){if($n(n)<2)break;const l=Vn(n,2);r=new DataView(l.buffer,l.byteOffset,l.length).getUint16(0),s=3}else if(s===2){if($n(n)<8)break;const l=Vn(n,8),c=new DataView(l.buffer,l.byteOffset,l.length),u=c.getUint32(0);if(u>Math.pow(2,21)-1){a.enqueue(Ur);break}r=u*Math.pow(2,32)+c.getUint32(4),s=3}else{if($n(n)<r)break;const l=Vn(n,r);a.enqueue(Si(i?l:Pr.decode(l),t)),s=0}if(r===0||r>e){a.enqueue(Ur);break}}}})}const Vl=4;function we(e){if(e)return lb(e)}function lb(e){for(var t in we.prototype)e[t]=we.prototype[t];return e}we.prototype.on=we.prototype.addEventListener=function(e,t){return this._callbacks=this._callbacks||{},(this._callbacks["$"+e]=this._callbacks["$"+e]||[]).push(t),this};we.prototype.once=function(e,t){function n(){this.off(e,n),t.apply(this,arguments)}return n.fn=t,this.on(e,n),this};we.prototype.off=we.prototype.removeListener=we.prototype.removeAllListeners=we.prototype.removeEventListener=function(e,t){if(this._callbacks=this._callbacks||{},arguments.length==0)return this._callbacks={},this;var n=this._callbacks["$"+e];if(!n)return this;if(arguments.length==1)return delete this._callbacks["$"+e],this;for(var s,r=0;r<n.length;r++)if(s=n[r],s===t||s.fn===t){n.splice(r,1);break}return n.length===0&&delete this._callbacks["$"+e],this};we.prototype.emit=function(e){this._callbacks=this._callbacks||{};for(var t=new Array(arguments.length-1),n=this._callbacks["$"+e],s=1;s<arguments.length;s++)t[s-1]=arguments[s];if(n){n=n.slice(0);for(var s=0,r=n.length;s<r;++s)n[s].apply(this,t)}return this};we.prototype.emitReserved=we.prototype.emit;we.prototype.listeners=function(e){return this._callbacks=this._callbacks||{},this._callbacks["$"+e]||[]};we.prototype.hasListeners=function(e){return!!this.listeners(e).length};const cs=typeof Promise=="function"&&typeof Promise.resolve=="function"?t=>Promise.resolve().then(t):(t,n)=>n(t,0),Je=typeof self<"u"?self:typeof window<"u"?window:Function("return this")(),cb="arraybuffer";function Ul(e,...t){return t.reduce((n,s)=>(e.hasOwnProperty(s)&&(n[s]=e[s]),n),{})}const ub=Je.setTimeout,db=Je.clearTimeout;function us(e,t){t.useNativeTimers?(e.setTimeoutFn=ub.bind(Je),e.clearTimeoutFn=db.bind(Je)):(e.setTimeoutFn=Je.setTimeout.bind(Je),e.clearTimeoutFn=Je.clearTimeout.bind(Je))}const hb=1.33;function fb(e){return typeof e=="string"?pb(e):Math.ceil((e.byteLength||e.size)*hb)}function pb(e){let t=0,n=0;for(let s=0,r=e.length;s<r;s++)t=e.charCodeAt(s),t<128?n+=1:t<2048?n+=2:t<55296||t>=57344?n+=3:(s++,n+=4);return n}function ql(){return Date.now().toString(36).substring(3)+Math.random().toString(36).substring(2,5)}function mb(e){let t="";for(let n in e)e.hasOwnProperty(n)&&(t.length&&(t+="&"),t+=encodeURIComponent(n)+"="+encodeURIComponent(e[n]));return t}function gb(e){let t={},n=e.split("&");for(let s=0,r=n.length;s<r;s++){let i=n[s].split("=");t[decodeURIComponent(i[0])]=decodeURIComponent(i[1])}return t}class yb extends Error{constructor(t,n,s){super(t),this.description=n,this.context=s,this.type="TransportError"}}class vi extends we{constructor(t){super(),this.writable=!1,us(this,t),this.opts=t,this.query=t.query,this.socket=t.socket,this.supportsBinary=!t.forceBase64}onError(t,n,s){return super.emitReserved("error",new yb(t,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(t){this.readyState==="open"&&this.write(t)}onOpen(){this.readyState="open",this.writable=!0,super.emitReserved("open")}onData(t){const n=Si(t,this.socket.binaryType);this.onPacket(n)}onPacket(t){super.emitReserved("packet",t)}onClose(t){this.readyState="closed",super.emitReserved("close",t)}pause(t){}createUri(t,n={}){return t+"://"+this._hostname()+this._port()+this.opts.path+this._query(n)}_hostname(){const t=this.opts.hostname;return t.indexOf(":")===-1?t:"["+t+"]"}_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(t){const n=mb(t);return n.length?"?"+n:""}}class xb extends vi{constructor(){super(...arguments),this._polling=!1}get name(){return"polling"}doOpen(){this._poll()}pause(t){this.readyState="pausing";const n=()=>{this.readyState="paused",t()};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(t){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)};ib(t,this.socket.binaryType).forEach(n),this.readyState!=="closed"&&(this._polling=!1,this.emitReserved("pollComplete"),this.readyState==="open"&&this._poll())}doClose(){const t=()=>{this.write([{type:"close"}])};this.readyState==="open"?t():this.once("open",t)}write(t){this.writable=!1,rb(t,n=>{this.doWrite(n,()=>{this.writable=!0,this.emitReserved("drain")})})}uri(){const t=this.opts.secure?"https":"http",n=this.query||{};return this.opts.timestampRequests!==!1&&(n[this.opts.timestampParam]=ql()),!this.supportsBinary&&!n.sid&&(n.b64=1),this.createUri(t,n)}}let Wl=!1;try{Wl=typeof XMLHttpRequest<"u"&&"withCredentials"in new XMLHttpRequest}catch{}const wb=Wl;function bb(){}class Sb extends xb{constructor(t){if(super(t),typeof location<"u"){const n=location.protocol==="https:";let s=location.port;s||(s=n?"443":"80"),this.xd=typeof location<"u"&&t.hostname!==location.hostname||s!==t.port}}doWrite(t,n){const s=this.request({method:"POST",data:t});s.on("success",n),s.on("error",(r,i)=>{this.onError("xhr post error",r,i)})}doPoll(){const t=this.request();t.on("data",this.onData.bind(this)),t.on("error",(n,s)=>{this.onError("xhr poll error",n,s)}),this.pollXhr=t}}class rt extends we{constructor(t,n,s){super(),this.createRequest=t,us(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 t;const n=Ul(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 r in this._opts.extraHeaders)this._opts.extraHeaders.hasOwnProperty(r)&&s.setRequestHeader(r,this._opts.extraHeaders[r])}}catch{}if(this._method==="POST")try{s.setRequestHeader("Content-type","text/plain;charset=UTF-8")}catch{}try{s.setRequestHeader("Accept","*/*")}catch{}(t=this._opts.cookieJar)===null||t===void 0||t.addCookies(s),"withCredentials"in s&&(s.withCredentials=this._opts.withCredentials),this._opts.requestTimeout&&(s.timeout=this._opts.requestTimeout),s.onreadystatechange=()=>{var r;s.readyState===3&&((r=this._opts.cookieJar)===null||r===void 0||r.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(r){this.setTimeoutFn(()=>{this._onError(r)},0);return}typeof document<"u"&&(this._index=rt.requestsCount++,rt.requests[this._index]=this)}_onError(t){this.emitReserved("error",t,this._xhr),this._cleanup(!0)}_cleanup(t){if(!(typeof this._xhr>"u"||this._xhr===null)){if(this._xhr.onreadystatechange=bb,t)try{this._xhr.abort()}catch{}typeof document<"u"&&delete rt.requests[this._index],this._xhr=null}}_onLoad(){const t=this._xhr.responseText;t!==null&&(this.emitReserved("data",t),this.emitReserved("success"),this._cleanup())}abort(){this._cleanup()}}rt.requestsCount=0;rt.requests={};if(typeof document<"u"){if(typeof attachEvent=="function")attachEvent("onunload",ya);else if(typeof addEventListener=="function"){const e="onpagehide"in Je?"pagehide":"unload";addEventListener(e,ya,!1)}}function ya(){for(let e in rt.requests)rt.requests.hasOwnProperty(e)&&rt.requests[e].abort()}const vb=(function(){const e=Hl({xdomain:!1});return e&&e.responseType!==null})();class Cb extends Sb{constructor(t){super(t);const n=t&&t.forceBase64;this.supportsBinary=vb&&!n}request(t={}){return Object.assign(t,{xd:this.xd},this.opts),new rt(Hl,this.uri(),t)}}function Hl(e){const t=e.xdomain;try{if(typeof XMLHttpRequest<"u"&&(!t||wb))return new XMLHttpRequest}catch{}if(!t)try{return new Je[["Active"].concat("Object").join("X")]("Microsoft.XMLHTTP")}catch{}}const Gl=typeof navigator<"u"&&typeof navigator.product=="string"&&navigator.product.toLowerCase()==="reactnative";class kb extends vi{get name(){return"websocket"}doOpen(){const t=this.uri(),n=this.opts.protocols,s=Gl?{}:Ul(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(t,n,s)}catch(r){return this.emitReserved("error",r)}this.ws.binaryType=this.socket.binaryType,this.addEventListeners()}addEventListeners(){this.ws.onopen=()=>{this.opts.autoUnref&&this.ws._socket.unref(),this.onOpen()},this.ws.onclose=t=>this.onClose({description:"websocket connection closed",context:t}),this.ws.onmessage=t=>this.onData(t.data),this.ws.onerror=t=>this.onError("websocket error",t)}write(t){this.writable=!1;for(let n=0;n<t.length;n++){const s=t[n],r=n===t.length-1;bi(s,this.supportsBinary,i=>{try{this.doWrite(s,i)}catch{}r&&cs(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){typeof this.ws<"u"&&(this.ws.onerror=()=>{},this.ws.close(),this.ws=null)}uri(){const t=this.opts.secure?"wss":"ws",n=this.query||{};return this.opts.timestampRequests&&(n[this.opts.timestampParam]=ql()),this.supportsBinary||(n.b64=1),this.createUri(t,n)}}const Tr=Je.WebSocket||Je.MozWebSocket;class Eb extends kb{createSocket(t,n,s){return Gl?new Tr(t,n,s):n?new Tr(t,n):new Tr(t)}doWrite(t,n){this.ws.send(n)}}class Pb extends vi{get name(){return"webtransport"}doOpen(){try{this._transport=new WebTransport(this.createUri("https"),this.opts.transportOptions[this.name])}catch(t){return this.emitReserved("error",t)}this._transport.closed.then(()=>{this.onClose()}).catch(t=>{this.onError("webtransport error",t)}),this._transport.ready.then(()=>{this._transport.createBidirectionalStream().then(t=>{const n=ab(Number.MAX_SAFE_INTEGER,this.socket.binaryType),s=t.readable.pipeThrough(n).getReader(),r=ob();r.readable.pipeTo(t.writable),this._writer=r.writable.getWriter();const i=()=>{s.read().then(({done:a,value:l})=>{a||(this.onPacket(l),i())}).catch(a=>{})};i();const o={type:"open"};this.query.sid&&(o.data=`{"sid":"${this.query.sid}"}`),this._writer.write(o).then(()=>this.onOpen())})})}write(t){this.writable=!1;for(let n=0;n<t.length;n++){const s=t[n],r=n===t.length-1;this._writer.write(s).then(()=>{r&&cs(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){var t;(t=this._transport)===null||t===void 0||t.close()}}const Tb={websocket:Eb,webtransport:Pb,polling:Cb},Ib=/^(?:(?![^:@\/?#]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@\/?#]*)(?::([^:@\/?#]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,Ab=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"];function qr(e){if(e.length>8e3)throw"URI too long";const t=e,n=e.indexOf("["),s=e.indexOf("]");n!=-1&&s!=-1&&(e=e.substring(0,n)+e.substring(n,s).replace(/:/g,";")+e.substring(s,e.length));let r=Ib.exec(e||""),i={},o=14;for(;o--;)i[Ab[o]]=r[o]||"";return n!=-1&&s!=-1&&(i.source=t,i.host=i.host.substring(1,i.host.length-1).replace(/;/g,":"),i.authority=i.authority.replace("[","").replace("]","").replace(/;/g,":"),i.ipv6uri=!0),i.pathNames=Nb(i,i.path),i.queryKey=zb(i,i.query),i}function Nb(e,t){const n=/\/{2,9}/g,s=t.replace(n,"/").split("/");return(t.slice(0,1)=="/"||t.length===0)&&s.splice(0,1),t.slice(-1)=="/"&&s.splice(s.length-1,1),s}function zb(e,t){const n={};return t.replace(/(?:^|&)([^&=]*)=?([^&]*)/g,function(s,r,i){r&&(n[r]=i)}),n}const Wr=typeof addEventListener=="function"&&typeof removeEventListener=="function",Qn=[];Wr&&addEventListener("offline",()=>{Qn.forEach(e=>e())},!1);class St extends we{constructor(t,n){if(super(),this.binaryType=cb,this.writeBuffer=[],this._prevBufferLen=0,this._pingInterval=-1,this._pingTimeout=-1,this._maxPayload=-1,this._pingTimeoutTime=1/0,t&&typeof t=="object"&&(n=t,t=null),t){const s=qr(t);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=qr(n.host).host);us(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 r=s.prototype.name;this.transports.push(r),this._transportsByName[r]=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=gb(this.opts.query)),Wr&&(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"})},Qn.push(this._offlineEventListener))),this.opts.withCredentials&&(this._cookieJar=void 0),this._open()}createTransport(t){const n=Object.assign({},this.opts.query);n.EIO=Vl,n.transport=t,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[t]);return new this._transportsByName[t](s)}_open(){if(this.transports.length===0){this.setTimeoutFn(()=>{this.emitReserved("error","No transports available")},0);return}const t=this.opts.rememberUpgrade&&St.priorWebsocketSuccess&&this.transports.indexOf("websocket")!==-1?"websocket":this.transports[0];this.readyState="opening";const n=this.createTransport(t);n.open(),this.setTransport(n)}setTransport(t){this.transport&&this.transport.removeAllListeners(),this.transport=t,t.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",St.priorWebsocketSuccess=this.transport.name==="websocket",this.emitReserved("open"),this.flush()}_onPacket(t){if(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing")switch(this.emitReserved("packet",t),this.emitReserved("heartbeat"),t.type){case"open":this.onHandshake(JSON.parse(t.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=t.data,this._onError(n);break;case"message":this.emitReserved("data",t.data),this.emitReserved("message",t.data);break}}onHandshake(t){this.emitReserved("handshake",t),this.id=t.sid,this.transport.query.sid=t.sid,this._pingInterval=t.pingInterval,this._pingTimeout=t.pingTimeout,this._maxPayload=t.maxPayload,this.onOpen(),this.readyState!=="closed"&&this._resetPingTimeout()}_resetPingTimeout(){this.clearTimeoutFn(this._pingTimeoutTimer);const t=this._pingInterval+this._pingTimeout;this._pingTimeoutTime=Date.now()+t,this._pingTimeoutTimer=this.setTimeoutFn(()=>{this._onClose("ping timeout")},t),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 t=this._getWritablePackets();this.transport.send(t),this._prevBufferLen=t.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 r=this.writeBuffer[s].data;if(r&&(n+=fb(r)),s>0&&n>this._maxPayload)return this.writeBuffer.slice(0,s);n+=2}return this.writeBuffer}_hasPingExpired(){if(!this._pingTimeoutTime)return!0;const t=Date.now()>this._pingTimeoutTime;return t&&(this._pingTimeoutTime=0,cs(()=>{this._onClose("ping timeout")},this.setTimeoutFn)),t}write(t,n,s){return this._sendPacket("message",t,n,s),this}send(t,n,s){return this._sendPacket("message",t,n,s),this}_sendPacket(t,n,s,r){if(typeof n=="function"&&(r=n,n=void 0),typeof s=="function"&&(r=s,s=null),this.readyState==="closing"||this.readyState==="closed")return;s=s||{},s.compress=s.compress!==!1;const i={type:t,data:n,options:s};this.emitReserved("packetCreate",i),this.writeBuffer.push(i),r&&this.once("flush",r),this.flush()}close(){const t=()=>{this._onClose("forced close"),this.transport.close()},n=()=>{this.off("upgrade",n),this.off("upgradeError",n),t()},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():t()}):this.upgrading?s():t()),this}_onError(t){if(St.priorWebsocketSuccess=!1,this.opts.tryAllTransports&&this.transports.length>1&&this.readyState==="opening")return this.transports.shift(),this._open();this.emitReserved("error",t),this._onClose("transport error",t)}_onClose(t,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(),Wr&&(this._beforeunloadEventListener&&removeEventListener("beforeunload",this._beforeunloadEventListener,!1),this._offlineEventListener)){const s=Qn.indexOf(this._offlineEventListener);s!==-1&&Qn.splice(s,1)}this.readyState="closed",this.id=null,this.emitReserved("close",t,n),this.writeBuffer=[],this._prevBufferLen=0}}}St.protocol=Vl;class Lb extends St{constructor(){super(...arguments),this._upgrades=[]}onOpen(){if(super.onOpen(),this.readyState==="open"&&this.opts.upgrade)for(let t=0;t<this._upgrades.length;t++)this._probe(this._upgrades[t])}_probe(t){let n=this.createTransport(t),s=!1;St.priorWebsocketSuccess=!1;const r=()=>{s||(n.send([{type:"ping",data:"probe"}]),n.once("packet",d=>{if(!s)if(d.type==="pong"&&d.data==="probe"){if(this.upgrading=!0,this.emitReserved("upgrading",n),!n)return;St.priorWebsocketSuccess=n.name==="websocket",this.transport.pause(()=>{s||this.readyState!=="closed"&&(u(),this.setTransport(n),n.send([{type:"upgrade"}]),this.emitReserved("upgrade",n),n=null,this.upgrading=!1,this.flush())})}else{const m=new Error("probe error");m.transport=n.name,this.emitReserved("upgradeError",m)}}))};function i(){s||(s=!0,u(),n.close(),n=null)}const o=d=>{const m=new Error("probe error: "+d);m.transport=n.name,i(),this.emitReserved("upgradeError",m)};function a(){o("transport closed")}function l(){o("socket closed")}function c(d){n&&d.name!==n.name&&i()}const u=()=>{n.removeListener("open",r),n.removeListener("error",o),n.removeListener("close",a),this.off("close",l),this.off("upgrading",c)};n.once("open",r),n.once("error",o),n.once("close",a),this.once("close",l),this.once("upgrading",c),this._upgrades.indexOf("webtransport")!==-1&&t!=="webtransport"?this.setTimeoutFn(()=>{s||n.open()},200):n.open()}onHandshake(t){this._upgrades=this._filterUpgrades(t.upgrades),super.onHandshake(t)}_filterUpgrades(t){const n=[];for(let s=0;s<t.length;s++)~this.transports.indexOf(t[s])&&n.push(t[s]);return n}}let _b=class extends Lb{constructor(t,n={}){const s=typeof t=="object"?t:n;(!s.transports||s.transports&&typeof s.transports[0]=="string")&&(s.transports=(s.transports||["polling","websocket","webtransport"]).map(r=>Tb[r]).filter(r=>!!r)),super(t,s)}};function jb(e,t="",n){let s=e;n=n||typeof location<"u"&&location,e==null&&(e=n.protocol+"//"+n.host),typeof e=="string"&&(e.charAt(0)==="/"&&(e.charAt(1)==="/"?e=n.protocol+e:e=n.host+e),/^(https?|wss?):\/\//.test(e)||(typeof n<"u"?e=n.protocol+"//"+e:e="https://"+e),s=qr(e)),s.port||(/^(http|ws)$/.test(s.protocol)?s.port="80":/^(http|ws)s$/.test(s.protocol)&&(s.port="443")),s.path=s.path||"/";const i=s.host.indexOf(":")!==-1?"["+s.host+"]":s.host;return s.id=s.protocol+"://"+i+":"+s.port+t,s.href=s.protocol+"://"+i+(n&&n.port===s.port?"":":"+s.port),s}const Rb=typeof ArrayBuffer=="function",Mb=e=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(e):e.buffer instanceof ArrayBuffer,Ql=Object.prototype.toString,Ob=typeof Blob=="function"||typeof Blob<"u"&&Ql.call(Blob)==="[object BlobConstructor]",Db=typeof File=="function"||typeof File<"u"&&Ql.call(File)==="[object FileConstructor]";function Ci(e){return Rb&&(e instanceof ArrayBuffer||Mb(e))||Ob&&e instanceof Blob||Db&&e instanceof File}function Jn(e,t){if(!e||typeof e!="object")return!1;if(Array.isArray(e)){for(let n=0,s=e.length;n<s;n++)if(Jn(e[n]))return!0;return!1}if(Ci(e))return!0;if(e.toJSON&&typeof e.toJSON=="function"&&arguments.length===1)return Jn(e.toJSON(),!0);for(const n in e)if(Object.prototype.hasOwnProperty.call(e,n)&&Jn(e[n]))return!0;return!1}function Fb(e){const t=[],n=e.data,s=e;return s.data=Hr(n,t),s.attachments=t.length,{packet:s,buffers:t}}function Hr(e,t){if(!e)return e;if(Ci(e)){const n={_placeholder:!0,num:t.length};return t.push(e),n}else if(Array.isArray(e)){const n=new Array(e.length);for(let s=0;s<e.length;s++)n[s]=Hr(e[s],t);return n}else if(typeof e=="object"&&!(e instanceof Date)){const n={};for(const s in e)Object.prototype.hasOwnProperty.call(e,s)&&(n[s]=Hr(e[s],t));return n}return e}function Bb(e,t){return e.data=Gr(e.data,t),delete e.attachments,e}function Gr(e,t){if(!e)return e;if(e&&e._placeholder===!0){if(typeof e.num=="number"&&e.num>=0&&e.num<t.length)return t[e.num];throw new Error("illegal attachments")}else if(Array.isArray(e))for(let n=0;n<e.length;n++)e[n]=Gr(e[n],t);else if(typeof e=="object")for(const n in e)Object.prototype.hasOwnProperty.call(e,n)&&(e[n]=Gr(e[n],t));return e}const $b=["connect","connect_error","disconnect","disconnecting","newListener","removeListener"];var ne;(function(e){e[e.CONNECT=0]="CONNECT",e[e.DISCONNECT=1]="DISCONNECT",e[e.EVENT=2]="EVENT",e[e.ACK=3]="ACK",e[e.CONNECT_ERROR=4]="CONNECT_ERROR",e[e.BINARY_EVENT=5]="BINARY_EVENT",e[e.BINARY_ACK=6]="BINARY_ACK"})(ne||(ne={}));class Vb{constructor(t){this.replacer=t}encode(t){return(t.type===ne.EVENT||t.type===ne.ACK)&&Jn(t)?this.encodeAsBinary({type:t.type===ne.EVENT?ne.BINARY_EVENT:ne.BINARY_ACK,nsp:t.nsp,data:t.data,id:t.id}):[this.encodeAsString(t)]}encodeAsString(t){let n=""+t.type;return(t.type===ne.BINARY_EVENT||t.type===ne.BINARY_ACK)&&(n+=t.attachments+"-"),t.nsp&&t.nsp!=="/"&&(n+=t.nsp+","),t.id!=null&&(n+=t.id),t.data!=null&&(n+=JSON.stringify(t.data,this.replacer)),n}encodeAsBinary(t){const n=Fb(t),s=this.encodeAsString(n.packet),r=n.buffers;return r.unshift(s),r}}class ki extends we{constructor(t){super(),this.opts=Object.assign({reviver:void 0,maxAttachments:10},typeof t=="function"?{reviver:t}:t)}add(t){let n;if(typeof t=="string"){if(this.reconstructor)throw new Error("got plaintext data when reconstructing a packet");n=this.decodeString(t);const s=n.type===ne.BINARY_EVENT;s||n.type===ne.BINARY_ACK?(n.type=s?ne.EVENT:ne.ACK,this.reconstructor=new Ub(n),n.attachments===0&&super.emitReserved("decoded",n)):super.emitReserved("decoded",n)}else if(Ci(t)||t.base64)if(this.reconstructor)n=this.reconstructor.takeBinaryData(t),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: "+t)}decodeString(t){let n=0;const s={type:Number(t.charAt(0))};if(ne[s.type]===void 0)throw new Error("unknown packet type "+s.type);if(s.type===ne.BINARY_EVENT||s.type===ne.BINARY_ACK){const i=n+1;for(;t.charAt(++n)!=="-"&&n!=t.length;);const o=t.substring(i,n);if(o!=Number(o)||t.charAt(n)!=="-")throw new Error("Illegal attachments");const a=Number(o);if(!qb(a)||a<0)throw new Error("Illegal attachments");if(a>this.opts.maxAttachments)throw new Error("too many attachments");s.attachments=a}if(t.charAt(n+1)==="/"){const i=n+1;for(;++n&&!(t.charAt(n)===","||n===t.length););s.nsp=t.substring(i,n)}else s.nsp="/";const r=t.charAt(n+1);if(r!==""&&Number(r)==r){const i=n+1;for(;++n;){const o=t.charAt(n);if(o==null||Number(o)!=o){--n;break}if(n===t.length)break}s.id=Number(t.substring(i,n+1))}if(t.charAt(++n)){const i=this.tryParse(t.substr(n));if(ki.isPayloadValid(s.type,i))s.data=i;else throw new Error("invalid payload")}return s}tryParse(t){try{return JSON.parse(t,this.opts.reviver)}catch{return!1}}static isPayloadValid(t,n){switch(t){case ne.CONNECT:return xa(n);case ne.DISCONNECT:return n===void 0;case ne.CONNECT_ERROR:return typeof n=="string"||xa(n);case ne.EVENT:case ne.BINARY_EVENT:return Array.isArray(n)&&(typeof n[0]=="number"||typeof n[0]=="string"&&$b.indexOf(n[0])===-1);case ne.ACK:case ne.BINARY_ACK:return Array.isArray(n)}}destroy(){this.reconstructor&&(this.reconstructor.finishedReconstruction(),this.reconstructor=null)}}class Ub{constructor(t){this.packet=t,this.buffers=[],this.reconPack=t}takeBinaryData(t){if(this.buffers.push(t),this.buffers.length===this.reconPack.attachments){const n=Bb(this.reconPack,this.buffers);return this.finishedReconstruction(),n}return null}finishedReconstruction(){this.reconPack=null,this.buffers=[]}}const qb=Number.isInteger||function(e){return typeof e=="number"&&isFinite(e)&&Math.floor(e)===e};function xa(e){return Object.prototype.toString.call(e)==="[object Object]"}const Wb=Object.freeze(Object.defineProperty({__proto__:null,Decoder:ki,Encoder:Vb,get PacketType(){return ne}},Symbol.toStringTag,{value:"Module"}));function Ke(e,t,n){return e.on(t,n),function(){e.off(t,n)}}const Hb=Object.freeze({connect:1,connect_error:1,disconnect:1,disconnecting:1,newListener:1,removeListener:1});class Jl extends we{constructor(t,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=t,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 t=this.io;this.subs=[Ke(t,"open",this.onopen.bind(this)),Ke(t,"packet",this.onpacket.bind(this)),Ke(t,"error",this.onerror.bind(this)),Ke(t,"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(...t){return t.unshift("message"),this.emit.apply(this,t),this}emit(t,...n){var s,r,i;if(Hb.hasOwnProperty(t))throw new Error('"'+t.toString()+'" is a reserved event name');if(n.unshift(t),this._opts.retries&&!this.flags.fromQueue&&!this.flags.volatile)return this._addToQueue(n),this;const o={type:ne.EVENT,data:n};if(o.options={},o.options.compress=this.flags.compress!==!1,typeof n[n.length-1]=="function"){const u=this.ids++,d=n.pop();this._registerAckCallback(u,d),o.id=u}const a=(r=(s=this.io.engine)===null||s===void 0?void 0:s.transport)===null||r===void 0?void 0:r.writable,l=this.connected&&!(!((i=this.io.engine)===null||i===void 0)&&i._hasPingExpired());return this.flags.volatile&&!a||(l?(this.notifyOutgoingListeners(o),this.packet(o)):this.sendBuffer.push(o)),this.flags={},this}_registerAckCallback(t,n){var s;const r=(s=this.flags.timeout)!==null&&s!==void 0?s:this._opts.ackTimeout;if(r===void 0){this.acks[t]=n;return}const i=this.io.setTimeoutFn(()=>{delete this.acks[t];for(let a=0;a<this.sendBuffer.length;a++)this.sendBuffer[a].id===t&&this.sendBuffer.splice(a,1);n.call(this,new Error("operation has timed out"))},r),o=(...a)=>{this.io.clearTimeoutFn(i),n.apply(this,a)};o.withError=!0,this.acks[t]=o}emitWithAck(t,...n){return new Promise((s,r)=>{const i=(o,a)=>o?r(o):s(a);i.withError=!0,n.push(i),this.emit(t,...n)})}_addToQueue(t){let n;typeof t[t.length-1]=="function"&&(n=t.pop());const s={id:this._queueSeq++,tryCount:0,pending:!1,args:t,flags:Object.assign({fromQueue:!0},this.flags)};t.push((r,...i)=>(this._queue[0],r!==null?s.tryCount>this._opts.retries&&(this._queue.shift(),n&&n(r)):(this._queue.shift(),n&&n(null,...i)),s.pending=!1,this._drainQueue())),this._queue.push(s),this._drainQueue()}_drainQueue(t=!1){if(!this.connected||this._queue.length===0)return;const n=this._queue[0];n.pending&&!t||(n.pending=!0,n.tryCount++,this.flags=n.flags,this.emit.apply(this,n.args))}packet(t){t.nsp=this.nsp,this.io._packet(t)}onopen(){typeof this.auth=="function"?this.auth(t=>{this._sendConnectPacket(t)}):this._sendConnectPacket(this.auth)}_sendConnectPacket(t){this.packet({type:ne.CONNECT,data:this._pid?Object.assign({pid:this._pid,offset:this._lastOffset},t):t})}onerror(t){this.connected||this.emitReserved("connect_error",t)}onclose(t,n){this.connected=!1,delete this.id,this.emitReserved("disconnect",t,n),this._clearAcks()}_clearAcks(){Object.keys(this.acks).forEach(t=>{if(!this.sendBuffer.some(s=>String(s.id)===t)){const s=this.acks[t];delete this.acks[t],s.withError&&s.call(this,new Error("socket has been disconnected"))}})}onpacket(t){if(t.nsp===this.nsp)switch(t.type){case ne.CONNECT:t.data&&t.data.sid?this.onconnect(t.data.sid,t.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 ne.EVENT:case ne.BINARY_EVENT:this.onevent(t);break;case ne.ACK:case ne.BINARY_ACK:this.onack(t);break;case ne.DISCONNECT:this.ondisconnect();break;case ne.CONNECT_ERROR:this.destroy();const s=new Error(t.data.message);s.data=t.data.data,this.emitReserved("connect_error",s);break}}onevent(t){const n=t.data||[];t.id!=null&&n.push(this.ack(t.id)),this.connected?this.emitEvent(n):this.receiveBuffer.push(Object.freeze(n))}emitEvent(t){if(this._anyListeners&&this._anyListeners.length){const n=this._anyListeners.slice();for(const s of n)s.apply(this,t)}super.emit.apply(this,t),this._pid&&t.length&&typeof t[t.length-1]=="string"&&(this._lastOffset=t[t.length-1])}ack(t){const n=this;let s=!1;return function(...r){s||(s=!0,n.packet({type:ne.ACK,id:t,data:r}))}}onack(t){const n=this.acks[t.id];typeof n=="function"&&(delete this.acks[t.id],n.withError&&t.data.unshift(null),n.apply(this,t.data))}onconnect(t,n){this.id=t,this.recovered=n&&this._pid===n,this._pid=n,this.connected=!0,this.emitBuffered(),this._drainQueue(!0),this.emitReserved("connect")}emitBuffered(){this.receiveBuffer.forEach(t=>this.emitEvent(t)),this.receiveBuffer=[],this.sendBuffer.forEach(t=>{this.notifyOutgoingListeners(t),this.packet(t)}),this.sendBuffer=[]}ondisconnect(){this.destroy(),this.onclose("io server disconnect")}destroy(){this.subs&&(this.subs.forEach(t=>t()),this.subs=void 0),this.io._destroy(this)}disconnect(){return this.connected&&this.packet({type:ne.DISCONNECT}),this.destroy(),this.connected&&this.onclose("io client disconnect"),this}close(){return this.disconnect()}compress(t){return this.flags.compress=t,this}get volatile(){return this.flags.volatile=!0,this}timeout(t){return this.flags.timeout=t,this}onAny(t){return this._anyListeners=this._anyListeners||[],this._anyListeners.push(t),this}prependAny(t){return this._anyListeners=this._anyListeners||[],this._anyListeners.unshift(t),this}offAny(t){if(!this._anyListeners)return this;if(t){const n=this._anyListeners;for(let s=0;s<n.length;s++)if(t===n[s])return n.splice(s,1),this}else this._anyListeners=[];return this}listenersAny(){return this._anyListeners||[]}onAnyOutgoing(t){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.push(t),this}prependAnyOutgoing(t){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.unshift(t),this}offAnyOutgoing(t){if(!this._anyOutgoingListeners)return this;if(t){const n=this._anyOutgoingListeners;for(let s=0;s<n.length;s++)if(t===n[s])return n.splice(s,1),this}else this._anyOutgoingListeners=[];return this}listenersAnyOutgoing(){return this._anyOutgoingListeners||[]}notifyOutgoingListeners(t){if(this._anyOutgoingListeners&&this._anyOutgoingListeners.length){const n=this._anyOutgoingListeners.slice();for(const s of n)s.apply(this,t.data)}}}function Gt(e){e=e||{},this.ms=e.min||100,this.max=e.max||1e4,this.factor=e.factor||2,this.jitter=e.jitter>0&&e.jitter<=1?e.jitter:0,this.attempts=0}Gt.prototype.duration=function(){var e=this.ms*Math.pow(this.factor,this.attempts++);if(this.jitter){var t=Math.random(),n=Math.floor(t*this.jitter*e);e=(Math.floor(t*10)&1)==0?e-n:e+n}return Math.min(e,this.max)|0};Gt.prototype.reset=function(){this.attempts=0};Gt.prototype.setMin=function(e){this.ms=e};Gt.prototype.setMax=function(e){this.max=e};Gt.prototype.setJitter=function(e){this.jitter=e};class Qr extends we{constructor(t,n){var s;super(),this.nsps={},this.subs=[],t&&typeof t=="object"&&(n=t,t=void 0),n=n||{},n.path=n.path||"/socket.io",this.opts=n,us(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 Gt({min:this.reconnectionDelay(),max:this.reconnectionDelayMax(),jitter:this.randomizationFactor()}),this.timeout(n.timeout==null?2e4:n.timeout),this._readyState="closed",this.uri=t;const r=n.parser||Wb;this.encoder=new r.Encoder,this.decoder=new r.Decoder,this._autoConnect=n.autoConnect!==!1,this._autoConnect&&this.open()}reconnection(t){return arguments.length?(this._reconnection=!!t,t||(this.skipReconnect=!0),this):this._reconnection}reconnectionAttempts(t){return t===void 0?this._reconnectionAttempts:(this._reconnectionAttempts=t,this)}reconnectionDelay(t){var n;return t===void 0?this._reconnectionDelay:(this._reconnectionDelay=t,(n=this.backoff)===null||n===void 0||n.setMin(t),this)}randomizationFactor(t){var n;return t===void 0?this._randomizationFactor:(this._randomizationFactor=t,(n=this.backoff)===null||n===void 0||n.setJitter(t),this)}reconnectionDelayMax(t){var n;return t===void 0?this._reconnectionDelayMax:(this._reconnectionDelayMax=t,(n=this.backoff)===null||n===void 0||n.setMax(t),this)}timeout(t){return arguments.length?(this._timeout=t,this):this._timeout}maybeReconnectOnOpen(){!this._reconnecting&&this._reconnection&&this.backoff.attempts===0&&this.reconnect()}open(t){if(~this._readyState.indexOf("open"))return this;this.engine=new _b(this.uri,this.opts);const n=this.engine,s=this;this._readyState="opening",this.skipReconnect=!1;const r=Ke(n,"open",function(){s.onopen(),t&&t()}),i=a=>{this.cleanup(),this._readyState="closed",this.emitReserved("error",a),t?t(a):this.maybeReconnectOnOpen()},o=Ke(n,"error",i);if(this._timeout!==!1){const a=this._timeout,l=this.setTimeoutFn(()=>{r(),i(new Error("timeout")),n.close()},a);this.opts.autoUnref&&l.unref(),this.subs.push(()=>{this.clearTimeoutFn(l)})}return this.subs.push(r),this.subs.push(o),this}connect(t){return this.open(t)}onopen(){this.cleanup(),this._readyState="open",this.emitReserved("open");const t=this.engine;this.subs.push(Ke(t,"ping",this.onping.bind(this)),Ke(t,"data",this.ondata.bind(this)),Ke(t,"error",this.onerror.bind(this)),Ke(t,"close",this.onclose.bind(this)),Ke(this.decoder,"decoded",this.ondecoded.bind(this)))}onping(){this.emitReserved("ping")}ondata(t){try{this.decoder.add(t)}catch(n){this.onclose("parse error",n)}}ondecoded(t){cs(()=>{this.emitReserved("packet",t)},this.setTimeoutFn)}onerror(t){this.emitReserved("error",t)}socket(t,n){let s=this.nsps[t];return s?this._autoConnect&&!s.active&&s.connect():(s=new Jl(this,t,n),this.nsps[t]=s),s}_destroy(t){const n=Object.keys(this.nsps);for(const s of n)if(this.nsps[s].active)return;this._close()}_packet(t){const n=this.encoder.encode(t);for(let s=0;s<n.length;s++)this.engine.write(n[s],t.options)}cleanup(){this.subs.forEach(t=>t()),this.subs.length=0,this.decoder.destroy()}_close(){this.skipReconnect=!0,this._reconnecting=!1,this.onclose("forced close")}disconnect(){return this._close()}onclose(t,n){var s;this.cleanup(),(s=this.engine)===null||s===void 0||s.close(),this.backoff.reset(),this._readyState="closed",this.emitReserved("close",t,n),this._reconnection&&!this.skipReconnect&&this.reconnect()}reconnect(){if(this._reconnecting||this.skipReconnect)return this;const t=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(()=>{t.skipReconnect||(this.emitReserved("reconnect_attempt",t.backoff.attempts),!t.skipReconnect&&t.open(r=>{r?(t._reconnecting=!1,t.reconnect(),this.emitReserved("reconnect_error",r)):t.onreconnect()}))},n);this.opts.autoUnref&&s.unref(),this.subs.push(()=>{this.clearTimeoutFn(s)})}}onreconnect(){const t=this.backoff.attempts;this._reconnecting=!1,this.backoff.reset(),this.emitReserved("reconnect",t)}}const ln={};function Yn(e,t){typeof e=="object"&&(t=e,e=void 0),t=t||{};const n=jb(e,t.path||"/socket.io"),s=n.source,r=n.id,i=n.path,o=ln[r]&&i in ln[r].nsps,a=t.forceNew||t["force new connection"]||t.multiplex===!1||o;let l;return a?l=new Qr(s,t):(ln[r]||(ln[r]=new Qr(s,t)),l=ln[r]),n.query&&!t.query&&(t.query=n.queryKey),l.socket(n.path,t)}Object.assign(Yn,{Manager:Qr,Socket:Jl,io:Yn,connect:Yn});class Gb{constructor(t=""){this.baseUrl=t}async get(t){return this.request("GET",t)}async post(t,n){return this.request("POST",t,n)}async del(t){return this.request("DELETE",t)}async request(t,n,s){try{const r=`${this.baseUrl}${n}`,i={method:t,credentials:"same-origin",headers:{"Content-Type":"application/json"}};return s!==void 0&&t!=="GET"&&t!=="DELETE"&&(i.body=JSON.stringify(s)),await(await fetch(r,i)).json()}catch(r){return{success:!1,error:r.message??"Network error"}}}}let Jr=null;function Qb(e){Jr=e}function O0(){if(!Jr)throw new Error("Socket instance not initialized. Call setSocketInstance() first.");return Jr}class Jb{constructor(t){this.socket=t,Qb(t)}emit(t,...n){this.socket.emit(t,...n)}on(t,n){this.socket.on(t,n)}off(t,n){this.socket.off(t,n)}disconnect(){this.socket.disconnect()}}class Yb{constructor(t){this.modalState=null,this.addToastFn=t??null}showToast(t,n,s="info"){this.addToastFn?this.addToastFn(t,n,s):console.warn("[UIService] No addToast callback registered — toast not shown:",t,n)}showModal(t,n){this.modalState={visible:!0,title:t,content:n}}closeModal(){this.modalState=null}getModalState(){return this.modalState}downloadFile(t,n,s="application/octet-stream"){const r=typeof t=="string"?new Blob([t],{type:s}):t,i=URL.createObjectURL(r),o=document.createElement("a");o.href=i,o.download=n,document.body.appendChild(o),o.click(),document.body.removeChild(o),URL.revokeObjectURL(i)}}class Zb{constructor(t){this.prefix=`edu_os_plugin:${t}:`}get(t){return localStorage.getItem(this.prefix+t)}set(t,n){localStorage.setItem(this.prefix+t,n)}delete(t){localStorage.removeItem(this.prefix+t)}clear(){this.prefix.length;const t=[];for(let n=0;n<localStorage.length;n++){const s=localStorage.key(n);s&&s.startsWith(this.prefix)&&t.push(s)}for(const n of t)localStorage.removeItem(n)}}function Kb(e){const{session:t,host:n,activeRole:s,activeStudentId:r,selectedLesson:i,activeSegmentId:o,studentViewStatus:a,lang:l,students:c,addToast:u,setOnlineStudentIds:d,setActiveStudentLessons:m,setLessons:f,setActiveSegmentId:g,setLiveClassStudentProgress:x,setLiveClassAcknowledgedMap:C,setLiveClassFeed:b,setSelectedLesson:I,setStudentViewStatus:S,setLocalProgressPercent:E,fetchStudentDashboard:z,fetchStudents:k,fetchElements:L}=e,R=p.useRef(null),O=p.useRef(s),P=p.useRef(r),N=p.useRef(l),_=p.useRef(c),D=p.useRef(u),F=p.useRef(i);return p.useEffect(()=>{O.current=s},[s]),p.useEffect(()=>{P.current=r},[r]),p.useEffect(()=>{N.current=l},[l]),p.useEffect(()=>{_.current=c},[c]),p.useEffect(()=>{D.current=u},[u]),p.useEffect(()=>{F.current=i},[i]),p.useEffect(()=>{if(!t)return;const A=Yn();return R.current=A,n.isInitialized()||n.initialize(new Gb,new Jb(A),new Yb(D.current),new Zb("__app__")),O.current==="student"&&P.current&&A.emit("register-student",{studentId:P.current,name:_.current.find(T=>T.id===P.current)?.name||P.current}),A.emit("join-room","whiteboard-broadcast"),A.on("presence-update",T=>{d(T.onlineStudentIds),m(T.activeStudentLessons)}),A.on("lesson-progress-mode-changed",T=>{const{lessonId:B,progressMode:M,progressConditions:q}=T;f(y=>y.map(te=>te.id===B?{...te,progress_mode:M,progress_conditions:q}:te))}),A.on("student-active-segment-changed",T=>{const{activeSegmentId:B}=T;g(B)}),A.on("student-pinged",T=>{const B=T.message||(N.current==="zh"?"⚠️ 学习进度预警:老师注意到您的进度有些落后,请抓紧时间跟上!":"⚠️ Progress Alert: The teacher noticed you are falling behind. Please keep up!");u(N.current==="zh"?"⚠️ 学习进度预警":"⚠️ Progress Warning",B,"warning")}),A.on("student-progress-updated",T=>{const{studentId:B,progressPercent:M,completed:q}=T;x(y=>{const te=y.findIndex(ae=>ae.student_id===B);if(te!==-1){const ae=[...y];return ae[te]={...ae[te],progress_percent:M,completed:q?1:0},ae}else return[...y,{student_id:B,progress_percent:M,completed:q?1:0}]})}),A.on("assignment-graded-toast",T=>{if(O.current==="student"&&P.current&&T.studentId===P.current){const B=T.assignmentTitle||T.assignmentId,M=N.current==="zh"?`您的作业"${B}"已完成评分!得分:${T.score}%。建议反馈已收到,快去查看。`:`Your assignment "${B}" was graded. Score: ${T.score}%. Tutoring feedback has been posted.`;u(N.current==="zh"?"🎓 作业已评分":"🎓 Assignment Graded",M,"success"),z(P.current)}}),A.on("student-picked",T=>{if(O.current==="student"&&P.current&&T.studentId===P.current){const B=N.current==="zh"?"闪电警报!您已被老师在课程随机提问点名中抽中!请立即集中注意力参与课堂。":"Attention alert! You have been randomly picked by the teacher! Please pay immediate attention.";u(N.current==="zh"?"⚡️ 随机点名提问":"⚡️ Classroom Pick Alert",B,"warning"),z(P.current)}b(B=>[{id:`feed-pick-${T.studentId}-${T.pickedTime||Date.now()}`,time:new Date(T.pickedTime||Date.now()).toLocaleTimeString(),type:"picked",message:N.current==="zh"?`点名互动:随机抽中学生【${T.studentName}】。`:`Classroom Pick: Randomly selected student "${T.studentName}".`},...B])}),A.on("student-acknowledged",T=>{const{studentId:B}=T;C(M=>{const q=new Map(M);return q.set(B,!0),q}),b(M=>[{id:`feed-ack-${B}-${Date.now()}`,time:new Date().toLocaleTimeString(),type:"checkin",message:N.current==="zh"?`学生已确认收到提问点名(学生 ID: ${B})。`:`Student acknowledged the classroom call (Student ID: ${B}).`},...M]),k()}),A.on("class-lock-status-changed",T=>{const{lessonId:B,locked:M}=T;O.current==="student"&&P.current?(Promise.resolve(k()).then(()=>{M&&B&&(I(B),S("lesson"),u(N.current==="zh"?"🔒 课程已被锁定":"🔒 Lesson Locked",N.current==="zh"?"老师已锁定当前授课,您将无法切换到其他页面。":"The teacher has locked the active lesson. You cannot leave this page.","info"))}),z(P.current)):k()}),A.on("whiteboard-sync",T=>{const{roomId:B,type:M}=T||{};M==="refresh"&&B&&(L(B),!F.current&&O.current==="student"&&(I(B),S("lesson")),A.emit("join-room",B))}),()=>{A.disconnect(),R.current=null}},[t,s,r]),p.useEffect(()=>{R.current&&s==="student"&&r&&(a==="lesson"&&i?(R.current.emit("enter-lesson",{studentId:r,lessonId:i}),fetch(`/api/students/${r}/progress`).then(A=>A.json()).then(A=>{if(Array.isArray(A)){const T=A.find(B=>B.lesson_id===i);E(T?T.progress_percent:0)}}).catch(console.error)):R.current.emit("leave-lesson",{studentId:r}))},[a,i,s,r]),p.useEffect(()=>{s==="teacher"&&i&&o&&R.current&&R.current.emit("teacher-broadcast-segment",{lessonId:i,activeSegmentId:o})},[o,i,s]),{socketRef:R}}const Xb=`exports.default = {
|
|
133
|
-
manifest: {
|
|
134
|
-
id: "@my-scope/hello-world",
|
|
135
|
-
name: "Hello World Plugin",
|
|
136
|
-
version: "1.0.0",
|
|
137
|
-
capabilitiesProposed: ["lesson:read"]
|
|
138
|
-
},
|
|
139
|
-
activate: async (ctx) => {
|
|
140
|
-
ctx.log.info('Hello World plugin activated');
|
|
141
|
-
}
|
|
142
|
-
};`;function eS(e){const{host:t,lang:n,addToast:s,setChatLog:r,setTeacherTab:i,fetchLessons:o}=e,[a,l]=p.useState([]),[c,u]=p.useState([]),[d,m]=p.useState(!1),[f,g]=p.useState(null),[x,C]=p.useState(""),[b,I]=p.useState(""),[S,E]=p.useState(""),[z,k]=p.useState(""),[L,R]=p.useState(null),[O,P]=p.useState(!1),[N,_]=p.useState("store"),[D,F]=p.useState(Xb),[A,T]=p.useState(!1),[B,M]=p.useState([]),[q,y]=p.useState([]),[te,ae]=p.useState({}),w=p.useRef(new Set),W=p.useCallback(async()=>{try{const G=await fetch("/api/plugins");if(G.ok){const K=await G.json();l(K)}}catch(G){console.warn("Failed to fetch plugins",G)}},[]),ee=p.useCallback(async()=>{try{const G=await fetch("/api/ai-providers");if(G.ok){const K=await G.json();u(K)}}catch(G){console.warn("Failed to fetch AI Providers",G)}},[]),se=p.useCallback(async()=>{try{const G=await fetch("/api/events");G.ok&&M(await G.json())}catch{}},[]),fe=p.useCallback(async()=>{try{const G=await fetch("/api/approvals");G.ok&&y(await G.json())}catch{}},[]);return{plugins:a,setPlugins:l,fetchPlugins:W,aiProviders:c,setAiProviders:u,fetchAIProviders:ee,isAIProviderModalOpen:d,setIsAIProviderModalOpen:m,editingAIProvider:f,setEditingAIProvider:g,providerName:x,setProviderName:C,providerApiUrl:b,setProviderApiUrl:I,providerApiKey:S,setProviderApiKey:E,providerModelName:z,setProviderModelName:k,testingProviderId:L,setTestingProviderId:R,showPluginModal:O,setShowPluginModal:P,storeTab:N,setStoreTab:_,pluginCode:D,setPluginCode:F,installingPlugin:A,setInstallingPlugin:T,events:B,setEvents:M,fetchEvents:se,approvals:q,setApprovals:y,fetchApprovals:fe,scoreOverrides:te,setScoreOverrides:ae,handleSaveAIProvider:async()=>{if(!x.trim()||!b.trim()||!z.trim()){s(n==="zh"?"表单不完整":"Incomplete Form",n==="zh"?"请填写提供商名称、API 基础地址与模型标识。":"Please fill in Name, API URL, and Model Name.","warning");return}try{let G;if(f?G=await fetch(`/api/ai-providers/${f.id}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:x,api_url:b,api_key:S,model_name:z})}):G=await fetch("/api/ai-providers",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:x,api_url:b,api_key:S,model_name:z})}),G.ok)s(n==="zh"?"保存成功":"Saved Successfully",n==="zh"?`AI 提供商 [${x}] 已保存。`:`AI Provider [${x}] has been updated.`,"success"),m(!1),g(null),C(""),I(""),E(""),k(""),ee();else{const K=await G.json().catch(()=>({}));s(n==="zh"?"保存失败":"Failed to Save",K.error||(n==="zh"?"无法写入数据库":"Failed to write to database"),"warning")}}catch(G){console.error(G),s(n==="zh"?"保存异常":"Execution Error",G.message||"Error occurred","warning")}},handleDeleteAIProvider:async(G,K)=>{if(confirm(n==="zh"?`确定要删除 AI 提供商 [${K}] 吗?此操作无法撤销。`:`Are you sure you want to delete AI Provider [${K}]?`))try{(await fetch(`/api/ai-providers/${G}`,{method:"DELETE"})).ok?(s(n==="zh"?"删除成功":"Deleted Successfully",n==="zh"?`AI 提供商 [${K}] 已经被清除。`:`AI Provider [${K}] has been removed.`,"success"),ee()):s(n==="zh"?"删除失败":"Failed to Delete","Database error","warning")}catch(re){console.error(re),s(n==="zh"?"操作异常":"Execution Error",re.message||"Error occurred","warning")}},handleTestAIProvider:async G=>{R(G.id);try{const K=await fetch("/api/ai-providers/test",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({api_url:G.api_url,api_key:G.api_key,model_name:G.model_name})}),re=await K.json();K.ok&&re.success?s(n==="zh"?"测试通过":"Test Succeeded",n==="zh"?`成功连接至 [${G.name}]。${re.message}`:`Successfully connected to [${G.name}]. ${re.message}`,"success"):s(n==="zh"?"测试失败":"Test Failed",re.error||"Connection error","warning")}catch(K){console.error(K),s(n==="zh"?"连接异常":"Connection Exception",K.message||"Error occurred","warning")}finally{R(null)}},handleInstallPlugin:async()=>{if(D.trim()){T(!0);try{const K=await(await fetch("/api/plugins",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({sourceCode:D})})).json();K.success?(await W(),P(!1),r(re=>[...re,{role:"agent",content:`[System] Plugin "${K.manifest.name}" installed successfully. You can now prompt me to use it.`}])):alert("Plugin installation failed: "+K.error)}catch(G){alert("Error: "+G.message)}finally{T(!1)}}},handleZipPluginUpload:async(G,K,re)=>{T(!0);const be=re?.mode==="update";try{const We={"Content-Type":"application/octet-stream","X-Filename":encodeURIComponent(G.name),"X-Execution-Mode":K,"X-Install-Mode":be?"update":"install","X-Allow-Downgrade":re?.allowDowngrade?"true":"false"};re?.targetPluginId&&(We["X-Target-Plugin-Id"]=encodeURIComponent(re.targetPluginId));const de=be&&re?.targetPluginId?`/api/plugins/${encodeURIComponent(re.targetPluginId)}/update-zip-raw`:"/api/plugins/upload-zip-raw",Te=await fetch(de,{method:"POST",headers:We,body:G}),Ce=await Te.json().catch(()=>({}));if(!Te.ok||!Ce.success){const Q=Ce.error||"Unknown error";throw s(n==="zh"?be?"更新失败":"安装失败":be?"Update Failed":"Installation Failed",Q,"error"),new Error(Q)}const Ye=Ce.pluginId||Ce.manifest?.pluginId||Ce.manifest?.id,j=!!(Ce.updated||be);if(!j&&Ye)await fetch(`/api/plugins/${encodeURIComponent(Ye)}/toggle`,{method:"POST"}).catch(()=>{});else if(j&&Ce.wasActive&&Ye)try{await t.deactivatePlugin(Ye)}catch{}i("plugins"),_("store"),await W(),setTimeout(()=>{W()},1e3);const U=Ce.manifest?.name||Ye||G.name;if(j){const Q=Ce.oldVersion||"?",Y=Ce.newVersion||Ce.manifest?.version||"?";s(n==="zh"?"插件更新成功":"Plugin Updated",n==="zh"?`"${U}" 已从 v${Q} 更新到 v${Y}(配置与数据已保留)`:`"${U}" updated v${Q} → v${Y} (config & data preserved)`,"success"),r(ie=>[...ie,{role:"agent",content:`[System] Plugin "${U}" updated ${Q} → ${Y}.`}])}else s(n==="zh"?"插件安装成功":"Plugin Installed",n==="zh"?`三方插件 "${U}" 已成功上传并以 [${K==="worker"?"Worker 隔离":"VM 嵌入"}] 模式激活运行!`:`Plugin "${U}" installed and activated in [${K}] mode!`,"success"),r(Q=>[...Q,{role:"agent",content:`[System] Plugin "${U}" installed successfully from ZIP file.`}])}catch(We){const de=We?.message?String(We.message):"";throw de&&de!=="Failed to fetch"&&de!=="Network error"||s(n==="zh"?"网络错误":"Network Error",de||"Network error","error"),We}finally{T(!1)}},handleTogglePlugin:async G=>{if(!w.current.has(G)){w.current.add(G);try{const K=await fetch(`/api/plugins/${encodeURIComponent(G)}/toggle`,{method:"POST"}),re=await K.json().catch(()=>({}));if(K.ok)await W();else{const be=re.error||"Unknown error";be.includes("requires human approval")||be.includes("queued")?(alert(n==="zh"?'该操作已加入"待审批高危操作"列表,请在右侧侧边栏中通过审批以生效。':"This action has been queued. Please approve it in the Pending Approvals list on the right side."),await fe()):alert((n==="zh"?"切换插件状态失败: ":"Failed to toggle plugin: ")+be)}}catch(K){console.error("Failed to toggle plugin:",K),alert(n==="zh"?"网络错误,切换插件失败":"Network error, failed to toggle plugin")}finally{w.current.delete(G)}}},handleDeletePlugin:async G=>{if(window.confirm(n==="zh"?"确定要彻底删除该插件吗?删除后此插件相关的功能将无法使用。":"Are you sure you want to completely delete this plugin? This cannot be undone."))try{const K=await fetch(`/api/plugins/${encodeURIComponent(G)}`,{method:"DELETE"});if(K.ok)i("plugins"),_("store"),await W(),r(re=>[...re,{role:"agent",content:"[System] Plugin uninstalled and deleted."}]);else{const re=await K.json().catch(()=>({}));alert(re.error||(n==="zh"?"删除插件失败":"Failed to delete plugin"))}}catch(K){console.error("Failed to delete plugin:",K),alert(n==="zh"?"删除插件失败":"Failed to delete plugin")}},handleApprove:async(G,K)=>{try{const be=await(await fetch(`/api/approvals/${G}/approve`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({payloadOverride:K})})).json();be.success?(await fe(),await o(),await W()):alert("Action failed: "+be.error)}catch(re){console.error(re)}},handleReject:async G=>{try{await fetch(`/api/approvals/${G}/reject`,{method:"POST"}),await fe(),await W()}catch(K){console.error(K)}}}}function tS(e){const{lang:t,addToast:n,fetchLessons:s,setSelectedLesson:r,setTeacherTab:i}=e,[o,a]=p.useState(!1),[l,c]=p.useState(1),[u,d]=p.useState(""),[m,f]=p.useState("Mathematics"),[g,x]=p.useState(""),[C,b]=p.useState(""),[I,S]=p.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"}]),[E,z]=p.useState(!1);return{isCourseWizardOpen:o,setIsCourseWizardOpen:a,wizardStep:l,setWizardStep:c,wizardCourseTitle:u,setWizardCourseTitle:d,wizardCourseCategory:m,setWizardCourseCategory:f,wizardCourseDescription:g,setWizardCourseDescription:x,wizardCourseContent:C,setWizardCourseContent:b,wizardCourseTimeline:I,setWizardCourseTimeline:S,wizardIsSubmitting:E,setWizardIsSubmitting:z,handleDeployWizardCourse:async()=>{if(!u.trim()){alert(t==="zh"?"请输入课程标题!":"Please provide a course title!");return}z(!0);try{const L=C.trim()||`Course outline for ${u} (${m})`,R=await fetch("/api/lessons",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({title:u,content:L})});if(R.ok){const P=(await R.json()).result?.lessonId;P&&await fetch(`/api/lessons/${P}/timeline`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({timeline:I})}),await s(),P&&(r(P),i("lesson_editor")),n(t==="zh"?"⭐ 课程发布成功":"⭐ Course Deployed Successfully",t==="zh"?`课程《${u}》已成功保存到核心SQLite并已自动激活!`:`Course "${u}" is now live in SQLite and auto-activated.`,"success"),a(!1),d(""),f("Mathematics"),x(""),b(""),c(1)}else n("Error","SQLite save failed","warning")}catch(L){console.error(L),n("Error","Launch Exception","warning")}finally{z(!1)}}}}function nS(){const[e,t]=p.useState(!1),[n,s]=p.useState(null),[r,i]=p.useState("scan_lesson"),[o,a]=p.useState(""),[l,c]=p.useState(""),[u,d]=p.useState(!1),[m,f]=p.useState([]),[g,x]=p.useState([]),[C,b]=p.useState(!1),[I,S]=p.useState({}),[E,z]=p.useState(10),[k,L]=p.useState("quiz"),R=p.useRef(I);return p.useEffect(()=>{R.current=I},[I]),{isQuizGeneratorOpen:e,setIsQuizGeneratorOpen:t,quizGeneratorClassId:n,setQuizGeneratorClassId:s,quizGenMode:r,setQuizGenMode:i,quizGenSelectedLessonId:o,setQuizGenSelectedLessonId:a,quizGenTopic:l,setQuizGenTopic:c,isGeneratingSuggestions:u,setIsGeneratingSuggestions:d,suggestedObjectives:m,setSuggestedObjectives:f,suggestedQuestions:g,setSuggestedQuestions:x,savingQuiz:C,setSavingQuiz:b,quizStudentAnswers:I,setQuizStudentAnswers:S,quizGenTimeLimit:E,setQuizGenTimeLimit:z,quizStudentAnswersRef:R,subAssignmentTab:k,setSubAssignmentTab:L}}function sS(e){const{lang:t,classes:n,expandedClassId:s,fetchClasses:r,fetchClassStudents:i,handleExportAllClassesCombined:o}=e,[a,l]=p.useState(!1),[c,u]=p.useState(new Set),[d,m]=p.useState(new Set),[f,g]=p.useState(null),[x,C]=p.useState(""),[b,I]=p.useState(""),[S,E]=p.useState("");return{batchMode:a,setBatchMode:l,selectedClassIds:c,setSelectedClassIds:u,selectedStudentIds:d,setSelectedStudentIds:m,batchPicker:f,setBatchPicker:g,batchPickerLesson:x,setBatchPickerLesson:C,batchPickerDate:b,setBatchPickerDate:I,batchPickerTargetClass:S,setBatchPickerTargetClass:E,toggleClassSelection:M=>{u(q=>{const y=new Set(q);return y.has(M)?y.delete(M):y.add(M),y})},toggleSelectAllClasses:()=>{u(M=>M.size===n.length&&n.length>0?new Set:new Set(n.map(q=>q.id)))},toggleStudentSelection:M=>{m(q=>{const y=new Set(q);return y.has(M)?y.delete(M):y.add(M),y})},toggleSelectAllStudents:M=>{m(q=>q.size===M.length&&M.length>0?new Set:new Set(M.map(y=>y.id)))},handleBatchDeleteClasses:async()=>{if(c.size!==0&&confirm(t==="zh"?`确认彻底删除选中的 ${c.size} 个班级吗?该操作不可恢复。`:`Delete ${c.size} selected classes permanently?`)){for(const M of c)await fetch(`/api/classes/${M}`,{method:"DELETE"});u(new Set),await r()}},handleBatchExportClasses:async()=>{c.size!==0&&await o(n.filter(M=>c.has(M.id)))},handleBatchSetPasscode:async()=>{if(c.size===0)return;const M=window.prompt(t==="zh"?"请输入临时班级密码(留空则清除):":"Enter temporary passcode (leave empty to clear):");if(M!==null){for(const q of c)await fetch(`/api/classes/${q}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({class_passcode:M===""?null:M})});u(new Set),await r()}},handleBatchScheduleClasses:()=>{c.size!==0&&(C(""),I(new Date().toISOString().split("T")[0]),g("schedule"))},handleBatchDeleteStudents:async()=>{if(!(d.size===0||!s)&&confirm(t==="zh"?`确认彻底删除选中的 ${d.size} 名学生账号吗?将删除其全部关联数据,不可恢复。`:`Permanently delete ${d.size} selected student accounts?`)){for(const M of d)await fetch(`/api/students/${M}`,{method:"DELETE"});m(new Set),await i(s)}},handleBatchResetPassword:async()=>{if(d.size===0||!s)return;const M=window.prompt(t==="zh"?"请输入要为选中学生设置的新密码:":"Enter new password for selected students:");if(!(M===null||M.trim()==="")){for(const q of d)await fetch(`/api/students/${q}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({password:M})});m(new Set),await i(s)}},handleBatchTransferStudents:()=>{d.size===0||!s||(E(""),g("transfer"))},handleBatchSetLockedLesson:()=>{d.size===0||!s||(C(""),g("lockedLesson"))},confirmBatchPicker:async()=>{if(s){if(f==="schedule"){if(!x){alert(t==="zh"?"请选择课程":"Please select a lesson");return}for(const M of c)await fetch(`/api/classes/${M}/schedules`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({lessonId:x,scheduledDate:b+" 09:00:00",status:"scheduled"})});u(new Set)}else if(f==="lockedLesson"){if(!x){alert(t==="zh"?"请选择课程":"Please select a lesson");return}for(const M of d)await fetch(`/api/students/${M}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({locked_lesson_id:x})});m(new Set)}else if(f==="transfer"){if(!S||S===s){alert(t==="zh"?"请选择不同的目标班级":"Please select a different target class");return}for(const M of d)await fetch(`/api/classes/${s}/students/${M}`,{method:"DELETE"}),await fetch(`/api/classes/${S}/students`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({studentId:M})});m(new Set)}g(null),s&&await i(s)}}}}function rS(){const[e,t]=p.useState([]),[n,s]=p.useState(!1),[r,i]=p.useState({lab_id:null,seats:[]}),[o,a]=p.useState(!1),[l,c]=p.useState([]),[u,d]=p.useState({}),[m,f]=p.useState({}),[g,x]=p.useState(null),[C,b]=p.useState(""),[I,S]=p.useState(""),E=p.useCallback(async()=>{try{s(!0);const O=await fetch("/api/labs");O.ok&&t(await O.json())}catch(O){console.error(O)}finally{s(!1)}},[]),z=p.useCallback(async O=>{try{const P=await fetch(`/api/classes/${O}/seats`);if(P.ok){const N=await P.json();i(N)}}catch(P){console.error(P)}},[]),k=p.useCallback(async()=>{try{const O=new Date().toISOString().split("T")[0],P=await fetch(`/api/schedules/today?date=${O}`);if(P.ok){const N=await P.json();N.success&&N.schedules&&c(N.schedules)}}catch(O){console.warn("Failed to fetch today schedules",O)}},[]),L=p.useCallback(async O=>{try{const P=await fetch(`/api/classes/${O}/schedules`);if(P.ok){const N=await P.json();d(_=>({..._,[O]:N}))}}catch{}},[]),R=p.useCallback(async O=>{try{const P=await fetch(`/api/schedules/${O}/attendance`);if(P.ok){const N=await P.json();f(_=>({..._,[O]:N}))}}catch{}},[]);return{computerLabs:e,setComputerLabs:t,loadingLabs:n,setLoadingLabs:s,fetchLabs:E,classSeats:r,setClassSeats:i,savingSeats:o,setSavingSeats:a,fetchClassSeats:z,todaySchedules:l,setTodaySchedules:c,fetchTodaySchedules:k,classSchedulesMap:u,setClassSchedulesMap:d,fetchClassSchedules:L,scheduleAttendanceMap:m,setScheduleAttendanceMap:f,fetchScheduleAttendance:R,expandedScheduleId:g,setExpandedScheduleId:x,newScheduleDate:C,setNewScheduleDate:b,newScheduleLessonId:I,setNewScheduleLessonId:S}}function iS(e){const{selectedLesson:t,lessons:n,setLessons:s}=e,[r,i]=p.useState([]),[o,a]=p.useState("seg-1"),[l,c]=p.useState(null),[u,d]=p.useState(null),[m,f]=p.useState("none"),[g,x]=p.useState(null),[C,b]=p.useState(!0),I=p.useRef(null),S=async(E,z)=>{f("saving");try{(await fetch(`/api/lessons/${E}/timeline`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({timeline:z})})).ok?(s(L=>L.map(R=>R.id===E?{...R,timeline:JSON.stringify(z)}:R)),i(z),f("saved"),x(new Date)):f("error")}catch(k){console.error("Failed to save timeline:",k),f("error")}};return p.useEffect(()=>{if(t){const E=n.find(z=>z.id===t);if(E){let z=[];if(E.timeline)try{z=typeof E.timeline=="string"?JSON.parse(E.timeline):E.timeline}catch{z=[{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 z=[{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"}];i(z);const k=I.current!==t;I.current=t,z.length>0?(k||!z.some(L=>L.id===o))&&a(z[0].id):a(null)}}},[t,n]),{timelineSegments:r,setTimelineSegments:i,activeSegmentId:o,setActiveSegmentId:a,segmentToEdit:l,setSegmentToEdit:c,draggedSegmentIdx:u,setDraggedSegmentIdx:d,editorSaveStatus:m,setEditorSaveStatus:f,editorLastSavedTime:g,setEditorLastSavedTime:x,editorPanelsExpanded:C,setEditorPanelsExpanded:b,saveTimeline:S}}function oS(e,t,n){const[s,r]=p.useState(new Set),[i,o]=p.useState(null),[a,l]=p.useState(!1),c=p.useMemo(()=>{if(e!=="student"||!t)return[];const d=[],m=t.assignments||[];for(const g of m)if(!g.submission_status)d.push({id:`new-${g.id}`,type:"new_assignment",title:n==="zh"?"新发布作业":"New Assignment",message:n==="zh"?`您有一项新作业:"${g.title}"`:`You have a new assignment: ${g.title}`,date:g.created_at,relatedId:g.id});else if(g.submission_status==="graded"){const x=!!g.feedback;d.push({id:`graded-${g.id}`,type:"graded",title:x?n==="zh"?"收到新成绩与反馈":"Grade & Feedback Posted":n==="zh"?"新成绩发布":"Assignment Graded",message:x?n==="zh"?`您的作业"${g.title}"已评分,得分:${g.score}%。反馈:"${g.feedback}"`:`Your assignment "${g.title}" was graded. Score: ${g.score}%. Teacher feedback: "${g.feedback}"`:n==="zh"?`您的作业"${g.title}"已评分,得分:${g.score}%`:`Your assignment "${g.title}" was graded. Score: ${g.score}%`,date:g.submitted_at||g.created_at,relatedId:g.id})}const f=t.rollcalls||[];for(const g of f)d.push({id:g.id,type:"rollcall_picked",title:n==="zh"?"⚡️ 随机提问选中通知":"⚡️ Random Pick Notification",message:n==="zh"?`您已被老师在课程"${g.lesson_title||"课堂"}"中随机选中提问!请立即确认您的出勤与注意。`:`You have been randomly picked by the teacher in lesson "${g.lesson_title||"Class"}"! Please pay immediate attention.`,date:g.picked_time,relatedId:g.lesson_id});return d.sort((g,x)=>x.date-g.date)},[e,t,n]),u=p.useMemo(()=>c.filter(d=>!s.has(d.id)),[c,s]);return{studentNotifications:c,unreadNotifications:u,readNotifications:s,setReadNotifications:r,selectedNotificationForModal:i,setSelectedNotificationForModal:o,isNotificationsOpen:a,setIsNotificationsOpen:l}}function Yl(e){if(e==null)return"";const t=String(e);return t.includes(",")||t.includes('"')||t.includes(`
|
|
143
|
-
`)?`"${t.replace(/"/g,'""')}"`:t}async function aS(e){const{classId:t,className:n,students:s,dashData:r,lang:i,addToast:o,setIsGeneratingPDFReport:a}=e;a(l=>({...l,[t]:!0}));try{if(!r){o(i==="zh"?"暂无班级评分数据":"No Class Performance Data",i==="zh"?"请确保在此班级加载了作业与测验。":"Please check if assignments or quizzes are present for this class.","warning");return}const l=r.performance||[],c=r.assignments||[],u={};s.forEach(T=>{u[T.id]={id:T.id,name:T.name,totalGradesSum:0,gradedCount:0,submittedCount:0,totalCount:0}}),l.forEach(T=>{const B=T.student_id;u[B]&&(u[B].totalCount++,(T.submission_status==="submitted"||T.submission_status==="graded")&&u[B].submittedCount++,T.score!==null&&T.score!==void 0&&(u[B].totalGradesSum+=T.score,u[B].gradedCount++))});const d=Object.values(u).map(T=>{const B=T.gradedCount>0?T.totalGradesSum/T.gradedCount:0,M=T.totalCount>0?T.submittedCount/T.totalCount*100:0;return{...T,avgScore:B,submissionRate:M}});d.sort((T,B)=>B.avgScore-T.avgScore);let m=0,f=0,g=0,x=0;l.forEach(T=>{x++,(T.submission_status==="submitted"||T.submission_status==="graded")&&g++,T.score!==null&&T.score!==void 0&&(m+=T.score,f++)});const C=f>0?m/f:0,b=x>0?g/x*100:0,I={};c.forEach(T=>{I[T.id]={id:T.id,title:T.title,scores:[],submittedCount:0,totalCount:0}}),l.forEach(T=>{const B=T.assignment_id;I[B]&&(I[B].totalCount++,(T.submission_status==="submitted"||T.submission_status==="graded")&&I[B].submittedCount++,T.score!==null&&T.score!==void 0&&I[B].scores.push(T.score))});const S=Object.values(I).map(T=>{const B=T.scores.length,M=T.scores.reduce((w,W)=>w+W,0),q=B>0?M/B:0,y=B>0?Math.max(...T.scores):0,te=B>0?Math.min(...T.scores):0,ae=T.totalCount>0?T.submittedCount/T.totalCount*100:0;return{...T,avg:q,max:y,min:te,subRate:ae}}),E=new Mh({orientation:"p",unit:"mm",format:"a4"}),z=[15,23,42],k=[79,70,229],L=[51,65,85],R=[226,232,240],O=T=>{E.setDrawColor(R[0],R[1],R[2]),E.setLineWidth(.3),E.line(14,T,196,T)};E.setFillColor(z[0],z[1],z[2]),E.rect(0,0,210,42,"F"),E.setTextColor(255,255,255),E.setFont("helvetica","bold"),E.setFontSize(20),E.text("CLASS PERFORMANCE REPORT",14,18),E.setFont("helvetica","normal"),E.setFontSize(10),E.setTextColor(194,205,225),E.text("Academic Insights • Generative Report Summary",14,25),E.text(`Classroom: ${n} | Date: ${new Date().toLocaleDateString()} ${new Date().toLocaleTimeString()}`,14,32),E.setFillColor(k[0],k[1],k[2]),E.rect(172,10,24,24,"F"),E.setFont("helvetica","bold"),E.setFontSize(14),E.setTextColor(255,255,255),E.text("OS",180,26);let P=52;E.setTextColor(z[0],z[1],z[2]),E.setFont("helvetica","bold"),E.setFontSize(12),E.text("I. EXECUTIVE OVERVIEW",14,P),P+=6;const N=[["Classroom/Subject Name",n],["Total Enrolled Students",`${s.length} student(s)`],["Curriculum Items (Assignments/Quizzes)",`${c.length} items`],["Global Assignment Submission Rate",`${b.toFixed(1)}%`],["Class Average Performance Score",`${C.toFixed(1)}%`]];E.autoTable({startY:P,head:[["Metric Indicator","Class-wide Metric Value"]],body:N,theme:"striped",headStyles:{fillColor:z,textColor:[255,255,255],fontStyle:"bold",fontSize:9},bodyStyles:{textColor:L,fontSize:8.5},margin:{left:14,right:14}}),P=E.lastAutoTable.finalY+12,E.setTextColor(z[0],z[1],z[2]),E.setFont("helvetica","bold"),E.setFontSize(12),E.text("II. STUDENT RANKING DISTRIBUTION",14,P),P+=6;const _=d.map((T,B)=>{let M="Excellent";return T.avgScore>=90?M="Excellent (A)":T.avgScore>=75?M="Good (B)":T.avgScore>=60?M="Satisfactory (C)":M="Needs Improvement (D)",[`${B+1}`,T.name,`${T.submittedCount}/${T.totalCount} (${T.submissionRate.toFixed(0)}%)`,`${T.avgScore.toFixed(1)}%`,M]});E.autoTable({startY:P,head:[["Rank","Student Name","Completion Rate","Average Score","Academic Standing Tier"]],body:_,theme:"grid",headStyles:{fillColor:k,textColor:[255,255,255],fontStyle:"bold",fontSize:8.5},bodyStyles:{textColor:L,fontSize:8},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}}),P=E.lastAutoTable.finalY+12,P>210&&(E.addPage(),P=20),E.setTextColor(z[0],z[1],z[2]),E.setFont("helvetica","bold"),E.setFontSize(12),E.text("III. ASSIGNMENT PERFORMANCE METRICS",14,P),P+=6;const D=S.map(T=>[T.title,`${T.subRate.toFixed(0)}%`,`${T.avg.toFixed(1)}%`,`${T.min.toFixed(0)}% - ${T.max.toFixed(0)}%`]);E.autoTable({startY:P,head:[["Assignment/Quiz Title","Submission Rate","Average Grade","Range (Min - Max)"]],body:D.length>0?D:[["No assignment performance records found.","-","-","-"]],theme:"striped",headStyles:{fillColor:[100,116,139],textColor:[255,255,255],fontStyle:"bold",fontSize:8.5},bodyStyles:{textColor:L,fontSize:8},columnStyles:{1:{halign:"center"},2:{halign:"center",fontStyle:"bold"},3:{halign:"center"}},margin:{left:14,right:14}}),P=E.lastAutoTable.finalY+15,O(275),E.setFontSize(8),E.setTextColor(148,163,184),E.text("Generated by OpenLearn Next • Educational Operating System",14,282),E.text("Page 1 of 1 • Internal Educational Audit",196,282,{align:"right"});const F=n.replace(/[^a-z0-9]/gi,"_").toLowerCase(),A=new Date().toISOString().split("T")[0];E.save(`Class_Report_${F}_${A}.pdf`),o(i==="zh"?"📄 PDF 报告导出完成":"📄 PDF Report Generated",i==="zh"?`班级【${n}】的综合学情 PDF 报告已生成并下载。`:`Class performance report for ${n} saved to your device.`,"success")}catch(l){console.error("PDF Generation Failed:",l),o(i==="zh"?"❌ PDF 报告生成失败":"❌ PDF Report Failed",l.message||"Error occurred during PDF generation","warning")}finally{a(l=>({...l,[t]:!1}))}}function lS(e){const{className:t,students:n,dashData:s,qWeight:r=40,aWeight:i=60,overrides:o={}}=e;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 a=s.assignments||[],l=s.performance||[],c=a.map(S=>{let E="assignment";if(o[S.id])E=o[S.id];else{const z=S.content&&S.content.startsWith('{"quizType":"mcq_learning_objectives"'),k=S.title&&(S.title.toLowerCase().includes("quiz")||S.title.toLowerCase().includes("test")||S.title.includes("测验")||S.title.includes("测试"));E=z||k?"quiz":"assignment"}return{...S,category:E}}),u=["Student Name","Student Email"];c.forEach(S=>{const E=S.category==="quiz"?"Quiz":"Assignment";u.push(`${E}: ${S.title}`)}),u.push("Quizzes Average","Assignments Average",`Weighted Average (${r}% Quizzes, ${i}% Assignments)`,"Simple Average Score","Submitted Count","Total Items");const d=[u];n.forEach(S=>{const E=[S.name,S.email];let z=0,k=0,L=0,R=0,O=0,P=0,N=0;c.forEach(M=>{const q=l.find(y=>y.assignment_id===M.id&&y.student_id===S.id);if(q&&q.score!==null&&q.score!==void 0){E.push(`${q.score}%`);const y=Number(q.score);M.category==="quiz"?(z+=y,k++):(L+=y,R++),O+=y,P++,N++}else q&&q.submission_status==="submitted"?(E.push("Pending Grade"),N++):E.push("Not Submitted")});const _=k>0?Math.round(z/k):null,D=R>0?Math.round(L/R):null;let F="N/A";if(_!==null&&D!==null){const M=_*(r/100)+D*(i/100);F=`${Math.round(M)}%`}else _!==null?F=`${_}%`:D!==null&&(F=`${D}%`);const A=_!==null?`${_}%`:"N/A",T=D!==null?`${D}%`:"N/A",B=P>0?`${Math.round(O/P)}%`:"N/A";E.push(A,T,F,B,`${N}`,`${a.length}`),d.push(E.map(Yl))});const m=d.map(S=>S.join(",")).join(`
|
|
144
|
-
`),f=new Blob(["\uFEFF"+m],{type:"text/csv;charset=utf-8;"}),g=URL.createObjectURL(f),x=document.createElement("a"),C=t.replace(/[^a-z0-9]/gi,"_").toLowerCase(),b=new Date().toISOString().split("T")[0],I=`${C}_grades_report_${b}.csv`;x.setAttribute("href",g),x.setAttribute("download",I),x.style.visibility="hidden",document.body.appendChild(x),x.click(),document.body.removeChild(x),URL.revokeObjectURL(g)}function cS(e){const{exportClassId:t,classStudentsMap:n,classDashboardMap:s,quizzesWeight:r,assignmentsWeight:i,customCategoryOverrides:o,lang:a}=e;if(!t)return null;const l=n[t]||[],c=s[t];if(!c||!c.assignments||l.length===0)return null;const u=c.assignments||[],d=c.performance||[],m=u.map(C=>{let b="assignment";if(o[C.id])b=o[C.id];else{const I=C.content&&C.content.startsWith('{"quizType":"mcq_learning_objectives"'),S=C.title&&(C.title.toLowerCase().includes("quiz")||C.title.toLowerCase().includes("test")||C.title.includes("测验")||C.title.includes("测试"));b=I||S?"quiz":"assignment"}return{...C,category:b}}),f=["Student Name","Student Email"];m.forEach(C=>{const b=C.category==="quiz"?"Quiz":"Assignment";f.push(`${b}: ${C.title}`)}),f.push("Quizzes Average","Assignments Average",`Weighted Average (${r}% Quizzes, ${i}% Assignments)`,"Simple Average Score","Submitted Count","Total Items");const g=[];return l.slice(0,5).forEach(C=>{const b=[C.name,C.email];let I=0,S=0,E=0,z=0,k=0,L=0,R=0;m.forEach(A=>{const T=d.find(B=>B.assignment_id===A.id&&B.student_id===C.id);if(T&&T.score!==null&&T.score!==void 0){b.push(`${T.score}%`);const B=Number(T.score);A.category==="quiz"?(I+=B,S++):(E+=B,z++),k+=B,L++,R++}else T&&T.submission_status==="submitted"?(b.push(a==="zh"?"待评分":"Pending Grade"),R++):b.push(a==="zh"?"未提交":"Not Submitted")});const O=S>0?Math.round(I/S):null,P=z>0?Math.round(E/z):null;let N="N/A";if(O!==null&&P!==null){const A=O*(r/100)+P*(i/100);N=`${Math.round(A)}%`}else O!==null?N=`${O}%`:P!==null&&(N=`${P}%`);const _=O!==null?`${O}%`:"N/A",D=P!==null?`${P}%`:"N/A",F=L>0?`${Math.round(k/L)}%`:"N/A";b.push(_,D,N,F,`${R}`,`${u.length}`),g.push(b)}),{headers:f,rows:g,totalStudents:l.length}}function uS(e){const{classes:t,classStudentsMap:n,classDashboardMap:s,lang:r}=e,o=[["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(t.forEach(u=>{const d=n[u.id]||[],m=s[u.id];if(!m||!m.assignments||d.length===0)return;const f=m.assignments||[],g=f.map(x=>{const C=x.content&&x.content.startsWith('{"quizType":"mcq_learning_objectives"'),b=x.title&&(x.title.toLowerCase().includes("quiz")||x.title.toLowerCase().includes("test")||x.title.includes("测验")||x.title.includes("测试"));return{...x,category:C||b?"quiz":"assignment"}});d.forEach(x=>{let C=0,b=0,I=0,S=0,E=0,z=0;g.forEach(N=>{const _=m.performance?.find(D=>D.student_id===x.id&&D.assignment_id===N.id&&D.submission_status==="graded"&&D.score!==null);if(_){const D=Number(_.score);E+=D,z++,N.category==="quiz"?(C+=D,b++):(I+=D,S++)}});const k=b>0?Math.round(C/b):null,L=S>0?Math.round(I/S):null;let R=0;k!==null&&L!==null?R=Math.round(k*.4+L*.6):k!==null?R=Math.round(k):L!==null&&(R=Math.round(L));const O=z>0?Math.round(E/z):0,P=[u.name,x.name,x.email,k!==null?`${k}%`:"N/A",L!==null?`${L}%`:"N/A",`${R}%`,`${O}%`,`${z}`,`${f.length}`];o.push(P)})}),o.length<=1){alert(r==="zh"?"暂无可导出的成绩数据。请确保班级中有已评分的作业。":"No graded performance data available to export.");return}const a="data:text/csv;charset=utf-8,\uFEFF"+o.map(u=>u.map(Yl).join(",")).join(`
|
|
145
|
-
`),l=encodeURI(a),c=document.createElement("a");c.setAttribute("href",l),c.setAttribute("download",`All_Classes_Combined_Grades_${new Date().toISOString().slice(0,10)}.csv`),document.body.appendChild(c),c.click(),document.body.removeChild(c)}function dS(e){const{lang:t,classes:n,classStudentsMap:s,classDashboardMap:r,fetchClassStudents:i,fetchClassDashboard:o,fetchClassProgress:a,addToast:l=()=>{}}=e,[c,u]=p.useState(!1),[d,m]=p.useState(""),[f,g]=p.useState(""),[x,C]=p.useState(40),[b,I]=p.useState(60),[S,E]=p.useState({}),[z,k]=p.useState(!1),[L,R]=p.useState(!1),[O,P]=p.useState(null),[N,_]=p.useState(!1),[D,F]=p.useState({}),A=p.useCallback(w=>{const W=Math.min(100,Math.max(0,w));C(W),I(100-W)},[]),T=p.useCallback(w=>{const W=Math.min(100,Math.max(0,w));I(W),C(100-W)},[]),B=p.useMemo(()=>cS({exportClassId:d,classStudentsMap:s,classDashboardMap:r,quizzesWeight:x,assignmentsWeight:b,customCategoryOverrides:S,lang:t}),[d,x,b,S,s,r,t]),M=p.useCallback(async(w,W)=>{P(w);try{await i(w),await o(w),await a(w),m(w),g(W),C(40),I(60),E({}),u(!0)}catch(ee){console.error(ee)}finally{P(null),k(!1)}},[i,o,a]),q=p.useCallback((w,W,ee=40,se=60,fe={})=>{lS({className:W,students:s[w]||[],dashData:r[w],qWeight:ee,aWeight:se,overrides:fe})},[s,r]),y=p.useCallback(async(w,W)=>{await i(w),await o(w),await a(w),await aS({classId:w,className:W,students:s[w]||[],dashData:r[w],lang:t,addToast:l,setIsGeneratingPDFReport:F})},[s,r,t,l,i,o,a]),te=p.useCallback(async()=>{_(!0);try{await uS({classes:n,classStudentsMap:s,classDashboardMap:r,lang:t})}catch(w){console.error("Export all classes error:",w)}finally{_(!1),k(!1)}},[n,s,r,t]),ae=p.useCallback((w,W)=>{const ee=r[W];if(!ee||!ee.performance)return null;const se=Date.now()-2592e6,ge=ee.performance.filter(he=>he.student_id===w).filter(he=>he.submitted_at&&he.submitted_at>=se&&he.score!==null&&he.score!==void 0);if(ge.length===0)return null;const Ae=ge.reduce((he,ft)=>he+Number(ft.score),0)/ge.length;return Ae<60?Math.round(Ae):null},[r]);return{isExportWeightModalOpen:c,setIsExportWeightModalOpen:u,exportClassId:d,setExportClassId:m,exportClassName:f,setExportClassName:g,quizzesWeight:x,setQuizzesWeight:C,assignmentsWeight:b,setAssignmentsWeight:I,customCategoryOverrides:S,setCustomCategoryOverrides:E,exportDropdownOpen:z,setExportDropdownOpen:k,exportTooltipOpen:L,setExportTooltipOpen:R,loadingExportClassId:O,setLoadingExportClassId:P,isExportingAllCombined:N,setIsExportingAllCombined:_,isGeneratingPDFReport:D,setIsGeneratingPDFReport:F,handleQuizzesWeightChange:A,handleAssignmentsWeightChange:T,csvPreviewData:B,triggerExportForClass:M,handleExportGrades:q,handleGeneratePDFReport:y,handleExportAllClassesCombined:te,get30DayAverageWarning:ae}}function hS(e){const[t,n]=p.useState(""),[s,r]=p.useState("recent"),[i,o]=p.useState(!1),[a,l]=p.useState(!1),[c,u]=p.useState(!1),[d,m]=p.useState(null),f=p.useMemo(()=>{let g=[...e];if(t.trim()){const x=t.toLowerCase();g=g.filter(C=>C.title.toLowerCase().includes(x)||C.content.toLowerCase().includes(x))}if(i&&(g=g.filter(x=>(x.enrollment_count||0)>0)),a&&(g=g.filter(x=>x.content&&x.content.trim().length>0)),c){const x=new Date(new Date().getFullYear(),new Date().getMonth(),1).getTime();g=g.filter(C=>(C.created_at||0)>=x)}return s==="recent"?g.sort((x,C)=>(C.created_at||0)-(x.created_at||0)):s==="alphabetical"?g.sort((x,C)=>x.title.localeCompare(C.title)):s==="enrollment"&&g.sort((x,C)=>(C.enrollment_count||0)-(x.enrollment_count||0)),g},[e,t,s,i,a,c]);return{lessonsSearchQuery:t,setLessonsSearchQuery:n,lessonsSortOrder:s,setLessonsSortOrder:r,filterEnrollment:i,setFilterEnrollment:o,filterHasContent:a,setFilterHasContent:l,filterThisMonth:c,setFilterThisMonth:u,copyingLessonId:d,setCopyingLessonId:m,filteredAndSortedLessons:f}}function wa(e,t){let n="",s="",r="";e==="class"?(n=t==="zh"?"班级及学生批量导入模板.csv":"class_import_template.csv",s="Class Name,Class Desc,Student Name,Student Email",r=t==="zh"?`高一A班,基础英语课程,李明,liming@example.com
|
|
146
|
-
高一A班,基础英语课程,王华,wanghua@example.com`:`Class 101,Introduction to English,John Doe,john@example.com
|
|
147
|
-
Class 101,Introduction to English,Jane Smith,jane@example.com`):(n=t==="zh"?"学生批量导入模板.csv":"student_import_template.csv",s="Student Name,Student Email",r=t==="zh"?`张三,zhangsan@example.com
|
|
148
|
-
李四,lisi@example.com`:`Alice Cooper,alice@example.com
|
|
149
|
-
Bob Dylan,bob@example.com`);const i=new Blob(["\uFEFF"+s+`
|
|
150
|
-
`+r],{type:"text/csv;charset=utf-8;"}),o=URL.createObjectURL(i),a=document.createElement("a");a.href=o,a.setAttribute("download",n),document.body.appendChild(a),a.click(),document.body.removeChild(a)}async function fS(e,t){const{lang:n,fetchClasses:s,fetchStudents:r}=t;return new Promise((i,o)=>{const a=new FileReader;a.onload=async l=>{try{const c=l.target?.result;if(!c)throw new Error("File content is empty");let u=[],d=[],m=!0;if(e.name.endsWith(".json")){const f=JSON.parse(c);if(!Array.isArray(f))throw new Error("JSON structure must be an array");f.some(x=>x.className||x.name&&(x.students||x.classDescription))?(m=!0,u=f.map(x=>{const C=x.name||x.className||x.class_name,b=x.description||x.classDescription||"",I=x.students||x.studentList||[],S=(Array.isArray(I)?I:[]).map(E=>({name:E.name||E.studentName||"",email:E.email||E.studentEmail||""})).filter(E=>E.name);return{name:C,description:b,students:S}}).filter(x=>x.name)):(m=!1,d=f.map(x=>({name:x.name||x.studentName||x.student_name||"",email:x.email||x.studentEmail||x.student_email||""})).filter(x=>x.name))}else{const f=c.split(/\r?\n/);if(f.length<2)throw new Error("CSV has empty or insufficient data");const g=f[0].split(",").map(S=>S.trim().toLowerCase()),x=g.findIndex(S=>S.includes("class name")||S.includes("班级名称")||S.includes("班级")||S.includes("classname")||S.includes("class_name")),C=g.findIndex(S=>S.includes("class desc")||S.includes("班级描述")||S.includes("描述")||S.includes("class_desc")),b=g.findIndex(S=>S.includes("student name")||S.includes("学生姓名")||S.includes("姓名")||S.includes("学生")||S.includes("studentname")||S.includes("student_name")),I=g.findIndex(S=>S.includes("student email")||S.includes("学生邮箱")||S.includes("邮箱")||S.includes("email")||S.includes("studentemail")||S.includes("student_email"));if(b===-1)throw new Error('CSV is missing column: "Student Name" (学生姓名/姓名/学生)');if(x!==-1){m=!0;const S={};for(let E=1;E<f.length;E++){const z=f[E].trim();if(!z)continue;const L=(z.match(/(".*?"|[^",]+)(?=\s*,|\s*$)/g)||z.split(",")).map(_=>_.replace(/^"|"$/g,"").trim()),R=L[x];if(!R)continue;const O=C!==-1&&L[C]||"",P=b!==-1&&L[b]||"",N=I!==-1&&L[I]||"";S[R]||(S[R]={name:R,description:O,students:[]}),P&&S[R].students.push({name:P,email:N})}u=Object.values(S)}else{m=!1;for(let S=1;S<f.length;S++){const E=f[S].trim();if(!E)continue;const k=(E.match(/(".*?"|[^",]+)(?=\s*,|\s*$)/g)||E.split(",")).map(O=>O.replace(/^"|"$/g,"").trim()),L=b!==-1&&k[b]||"",R=I!==-1&&k[I]||"";L&&d.push({name:L,email:R})}}}if(m){if(u.length===0)throw new Error("No valid class elements found inside file.");const f=await fetch("/api/classes/import",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({classes:u})});if(!f.ok){const x=await f.json();throw new Error(x.error||"Server importation failed")}const g=await f.json();await s(),await r(),i({success:!0,message:n==="zh"?`成功导入 ${g.imported.length} 个班级数据!`:`Successfully imported ${g.imported.length} classes data!`})}else{if(d.length===0)throw new Error("No valid student elements found inside file.");const f=await fetch("/api/students/import",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({students:d})});if(!f.ok){const x=await f.json();throw new Error(x.error||"Server student importation failed")}const g=await f.json();await r(),i({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(c){o(c)}},a.onerror=()=>{o(new Error("Failed to read file from disk."))},a.readAsText(e)})}function pS(e,t){return new Promise((n,s)=>{const r=new FileReader;r.onload=i=>{try{const o=i.target?.result;if(!o)throw new Error("Empty CSV file");const a=o.split(/\r?\n/);if(a.length<2)throw new Error(t==="zh"?"CSV 文件行数不足,请包含标题和至少一行数据。":"CSV is missing content or headers.");const l=a[0].split(",").map(m=>m.trim().toLowerCase()),c=l.findIndex(m=>m.includes("title")||m.includes("标题")||m.includes("课程")),u=l.findIndex(m=>m.includes("content")||m.includes("内容")||m.includes("正文"));if(c===-1||u===-1)throw new Error(t==="zh"?'CSV 缺少必要表头列:必须包含 "Title"(课程标题)和 "Content"(课程内容)。':'CSV must contain "Title" and "Content" headers.');const d=[];for(let m=1;m<a.length;m++){const f=a[m].trim();if(!f)continue;const x=(f.match(/(".*?"|[^",]+)(?=\s*,|\s*$)/g)||f.split(",")).map(I=>I.replace(/^"|"$/g,"").trim()),C=x[c],b=x[u];C&&b&&d.push({title:C,content:b})}if(d.length===0)throw new Error(t==="zh"?"未能从 CSV 解析出有效课程数据。":"No valid courses found in CSV.");n(d)}catch(o){s(o)}},r.onerror=()=>{s(new Error(t==="zh"?"无法读取选取的 CSV 文件!":"Failure to read the CSV!"))},r.readAsText(e)})}async function mS(e,t){const{lang:n,setImportProgress:s,fetchLessons:r}=t;let i=0;for(let o=0;o<e.length;o++){const a=e[o];try{const l=await fetch("/api/lessons",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({title:a.title,content:a.content})});if(l.ok)i++;else{const c=await l.json();console.warn(`Failed to import item ${o+1}:`,c)}}catch(l){console.warn(`Error importing item ${o+1}:`,l)}s(o+1)}return i>0?(await r(),{success:!0}):{success:!1,errorMsg:n==="zh"?"所有课程项导入均失败。请检查控制台或格式。":"Failed to import any of the courses. Please check your console or schema."}}function gS(e){return"#/"+e}function ba(e){const t=e.replace(/^#/,"");return!t||t==="/"?null:t.replace(/^\//,"")}ux();const Sa="openlearnv2.agentProviderId";function yS(){const e=ce(v=>v.lang),t=ce(v=>v.setLang),n=oo[e]??oo.zh,[s,r]=p.useState(!1),i=ce(v=>v.liveClassSelectedClassId),o=ce(v=>v.setLiveClassSelectedClassId),a=ce(v=>v.liveClassIsActive),l=ce(v=>v.setLiveClassIsActive),[c,u]=p.useState(0),[d,m]=p.useState([]),[f,g]=p.useState(new Map),x=bl(),[C,b]=p.useState([]),[I,S]=p.useState({}),[E,z]=p.useState([]),[k,L]=p.useState(0),[R,O]=p.useState(!1),[P,N]=p.useState(null),[_,D]=p.useState(!1),[F,A]=p.useState("system"),[T,B]=p.useState(null),[M,q]=p.useState([]),[y,te]=p.useState(!1),[ae,w]=p.useState(!1),W=async()=>{try{te(!0);const v=await fetch("/api/resources");if(v.ok){const $=await v.json();q($)}}catch(v){console.warn("Error fetching library resources:",v)}finally{te(!1)}};it.useEffect(()=>{_&&W()},[_]);const ee=ce(v=>v.lessons),se=ce(v=>v.setLessons),{lessonsSearchQuery:fe,setLessonsSearchQuery:ge,lessonsSortOrder:Le,setLessonsSortOrder:Ae,filterEnrollment:he,setFilterEnrollment:ft,filterHasContent:Lt,setFilterHasContent:_t,filterThisMonth:pt,setFilterThisMonth:mt,copyingLessonId:G,setCopyingLessonId:K,filteredAndSortedLessons:re}=hS(ee),[be,We]=p.useState([]),de=ce(v=>v.selectedLesson),Te=ce(v=>v.setSelectedLesson),Ce=ce(v=>v.elements),Ye=ce(v=>v.setElements),[j,U]=p.useState(!1),[Q,Y]=p.useState("idle"),[ie,Ie]=p.useState(0),[Ze,_e]=p.useState(0),[lt,je]=p.useState(""),[ye,He]=p.useState([]),[Fe,ds]=p.useState(!1),[hs,fs]=p.useState(!1),[ps,ms]=p.useState("agent"),[gs,ys]=p.useState(!1),[bn,xs]=p.useState([]),[ws,bs]=p.useState([]),[Qt,Jt]=p.useState(null),[Sn,ke]=p.useState(""),jt=ce(v=>v.classes),Ss=ce(v=>v.setClasses),et=ce(v=>v.students),vn=ce(v=>v.setStudents),{computerLabs:vs,fetchLabs:Cn,todaySchedules:Cs,fetchTodaySchedules:Rt,classSchedulesMap:ks,fetchClassSchedules:kn,scheduleAttendanceMap:Es,fetchScheduleAttendance:Ps,expandedScheduleId:Ts,setExpandedScheduleId:Is,newScheduleDate:As,setNewScheduleDate:Ns,newScheduleLessonId:me,setNewScheduleLessonId:zs}=rS(),[kt,Ls]=p.useState(null),_s=p.useRef(null),js=v=>{Ls(v),_s.current=v},[En,Pn]=p.useState({}),[Rs,Ms]=p.useState(null),Tn=p.useRef(null),[Yt,Zt]=p.useState(null),Os=v=>{const $=vf[v];$&&Zt({type:v,data:{...$.defaultData}})},Ds=async v=>{Yt&&await Tn.current?.addElementAtCenter(Yt.type,v),Zt(null)},Se=ce(v=>v.session),Et=ce(v=>v.setSession),In=ce(v=>v.siteInfo),An=ce(v=>v.setSiteInfo),[Be,Re]=p.useState("teacher"),[Fs,Bs]=p.useState(!0),[$s,Mt]=p.useState(!0),[Vs,Pt]=p.useState("normal");p.useEffect(()=>{if(!Se)return;const v=async()=>{try{const H=await fetch("/api/db-status");if(H.ok){const J=await H.json().catch(()=>({}));J.status==="warning"||J.warning?Pt("warning"):Pt("normal"),Mt(!0)}else H.status===429||H.status===503?(Pt("warning"),Mt(!0)):(Pt("error"),Mt(!1))}catch{Pt("error"),Mt(!1)}};v();const $=setInterval(v,5e3);return()=>clearInterval($)},[Se]),p.useEffect(()=>{(async()=>{try{const $=await fetch("/api/auth/session");if($.ok){const H=await $.json();H.session&&(Et(H.session),Re(H.session.role),H.session.role==="student"&&H.session.studentId&&(Nn(H.session.studentId),At()))}}catch($){console.warn("Session check failed",$)}finally{Bs(!1)}})()},[]),p.useEffect(()=>{(async()=>{try{const $=await fetch("/api/site-settings");if($.ok){const H=await $.json();An({siteName:H.siteName||"",slogan:H.slogan||"",logoUrl:H.logoUrl||null})}}catch($){console.warn("Failed to fetch site settings:",$)}})()},[]);const gt=ce(v=>v.teacherTab),$e=ce(v=>v.setTeacherTab);p.useEffect(()=>{const v=()=>{const H=ba(window.location.hash);H&&H!==Pe.getState().teacherTab&&$e(H)};window.addEventListener("hashchange",v);const $=ba(window.location.hash);return $&&$e($),()=>window.removeEventListener("hashchange",v)},[$e]),p.useEffect(()=>{const v=gS(gt);window.location.hash!==v&&(window.location.hash=v)},[gt,$e]);const[Us,Ot]=p.useState(!1),[qs,Ws]=p.useState(!1),[Kt,Zl]=p.useState(!1);p.useEffect(()=>{Se?.subRole==="administrator"&&localStorage.getItem("edu_os_tour_completed")!=="true"&&Ot(!0)},[Se]);const Kl=async v=>{await Dt(),await ct(),await Rt().catch(()=>{}),o(v.classId),Te(v.lessonId),l(!0),Ge(e==="zh"?"示范课堂准备就绪":"Demo Classroom Ready",e==="zh"?"示范班级与课件已加载,已自动开启授课状态!":"Demo class & courseware loaded. Live class session is now active!","success")};p.useEffect(()=>{gt==="live_class"&&r(!0)},[gt]);const{timelineSegments:Xl,activeSegmentId:Hs,setActiveSegmentId:Gs,draggedSegmentIdx:ec,setDraggedSegmentIdx:tc,editorSaveStatus:nc,setEditorSaveStatus:sc,editorLastSavedTime:rc,setEditorLastSavedTime:ic,editorPanelsExpanded:oc,setEditorPanelsExpanded:ac,saveTimeline:lc}=iS({selectedLesson:de,lessons:ee,setLessons:se}),[Ee,Nn]=p.useState(null),[Qs,cc]=p.useState(null),Ge=(v,$,H="info")=>{const J=Math.random().toString(36).substring(2,9);Pe.getState().addToast({id:J,title:v,message:$,type:H}),setTimeout(()=>{Pe.getState().removeToast(J)},6e3)},ct=async()=>{try{const v=await fetch("/api/lessons");if(v.ok){const $=await v.json();se($),!Pe.getState().selectedLesson&&$.length>0&&Te($[0].id)}}catch(v){console.warn("Failed to fetch lessons",v)}},Ei=p.useRef(()=>{}),Pi=tS({lang:e,addToast:Ge,fetchLessons:ct,setSelectedLesson:Te,setTeacherTab:$e}),{isCourseWizardOpen:MS,setIsCourseWizardOpen:uc,wizardStep:OS,setWizardStep:dc,wizardCourseTitle:DS,setWizardCourseTitle:FS,wizardCourseCategory:BS,setWizardCourseCategory:$S,wizardCourseDescription:VS,setWizardCourseDescription:US,wizardCourseContent:qS,setWizardCourseContent:WS,wizardCourseTimeline:HS,setWizardCourseTimeline:GS,wizardIsSubmitting:QS,handleDeployWizardCourse:JS}=Pi,{plugins:yt,fetchPlugins:hc,aiProviders:Tt,fetchAIProviders:fc,testingProviderId:pc,storeTab:mc,setStoreTab:gc,pluginCode:yc,setPluginCode:xc,installingPlugin:wc,events:bc,fetchEvents:Sc,approvals:vc,fetchApprovals:Cc,scoreOverrides:kc,setScoreOverrides:Ec,handleInstallPlugin:Pc,handleZipPluginUpload:Tc,handleTogglePlugin:Ic,handleDeletePlugin:Ac,handleApprove:Nc,handleReject:zc}=eS({host:x,lang:e,addToast:Ge,setChatLog:v=>Ei.current(v),setTeacherTab:$e,fetchLessons:ct}),[ut,Ti]=p.useState(()=>typeof window>"u"?"system":window.localStorage.getItem(Sa)||"system"),Js=ut==="system"||Tt.some(v=>v.id===ut)?ut:"system",Lc=Tt.find(v=>v.id===Js)||null,[Xt,It]=p.useState("dashboard"),[_c,jc]=p.useState("whiteboard"),[Rc,Mc]=p.useState(null),[xt,Ys]=p.useState(null),[Oc,Ii]=p.useState(!1),[Dc,Ai]=p.useState(null),[Fc,Ni]=p.useState("whiteboard"),[Bc,$c]=p.useState("none"),[Vc,Uc]=p.useState("none"),[qc,zi]=p.useState(!0);p.useEffect(()=>{Xt!=="lesson"&&zi(!0)},[Xt]);const Li=nS(),{isQuizGeneratorOpen:YS,setIsQuizGeneratorOpen:Wc,quizGeneratorClassId:ZS,setQuizGeneratorClassId:Hc,quizGenMode:KS,setQuizGenMode:Gc,quizGenSelectedLessonId:XS,setQuizGenSelectedLessonId:Qc,quizGenTopic:e0,setQuizGenTopic:Jc,isGeneratingSuggestions:t0,setIsGeneratingSuggestions:n0,suggestedObjectives:s0,setSuggestedObjectives:Yc,suggestedQuestions:r0,setSuggestedQuestions:Zc,savingQuiz:i0,setSavingQuiz:o0,quizStudentAnswers:Kc,setQuizStudentAnswers:_i,quizGenTimeLimit:a0,setQuizGenTimeLimit:l0,quizStudentAnswersRef:Xc,subAssignmentTab:eu,setSubAssignmentTab:ji}=Li,[tu,nu]=p.useState(""),[su,ru]=p.useState("all"),[iu,ou]=p.useState("grid"),[au,lu]=p.useState({}),[cu,uu]=p.useState({}),[du,hu]=p.useState({}),Ri=oS(Be,Qs,e),{studentNotifications:fu,unreadNotifications:pu,readNotifications:Mi,setReadNotifications:zn,selectedNotificationForModal:mu,setSelectedNotificationForModal:gu,isNotificationsOpen:yu,setIsNotificationsOpen:xu}=Ri;p.useEffect(()=>{Ee&&fetch(`/api/students/${Ee}/read_notifications`).then(v=>v.ok?v.json():[]).then(v=>{zn(new Set(v))}).catch(v=>{console.warn("Failed to load read notifications from DB",v),zn(new Set)})},[Ee]);const wu=p.useRef(null),bu=v=>{Ms(v),wu.current=v},[Su,vu]=p.useState({}),[Cu,ku]=p.useState({}),[c0,u0]=p.useState({}),[d0,h0]=p.useState({}),[Eu,f0]=p.useState(null),[Pu,Tu]=p.useState("dueDate"),[p0,m0]=p.useState(null),[Iu,Au]=p.useState({}),[Nu,Oi]=p.useState(!1),[zu,Di]=p.useState(!1),[Lu,Zs]=p.useState(null),[_u,Ks]=p.useState(null),[Xs,ju]=p.useState(null),Ru=p.useRef(null),Fi=v=>{ju(v),Ru.current=v};p.useEffect(()=>{typeof window<"u"&&window.localStorage.setItem(Sa,ut)},[ut]),p.useEffect(()=>{ut!=="system"&&Tt.length>0&&!Tt.some(v=>v.id===ut)&&Ti("system")},[Tt,ut]);const Mu=async(v,$,H)=>{try{if((await fetch(`/api/classes/${v}/schedules`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({lessonId:$,scheduledDate:H})})).ok)return await kn(v),!0}catch(J){console.error("Quick schedule class failed",J)}return!1},Ou=async(v,$,H)=>{try{const J=$||H||"Assignment",Ve=await fetch(`/api/classes/${v}/assignments/generate`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({topic:J})});if(Ve.ok){const dt=await Ve.json().catch(()=>({}));return await en(v),dt.id||"assignment-created"}}catch(J){console.error("Quick generate assignment failed",J)}return null},Du=async(v,$)=>{try{const H=await fetch("/api/lessons",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({title:v,content:$})});if(H.ok){const J=await H.json().catch(()=>({}));return await ct(),J.id||"lesson-created"}}catch(H){console.error("Quick create lesson failed",H)}return""},Fu=()=>{wa("class",e)},Bu=async v=>{if(v){if(!v.name.toLowerCase().endsWith(".csv")){Y("error"),je(e==="zh"?"只支持包含 .csv 后缀名的文件!":"Only files ending in .csv are supported!");return}Y("parsing"),je("");try{const $=await pS(v,e);He($),Y("idle")}catch($){Y("error"),je($.message||String($))}}},$u=async()=>{if(ye.length===0)return;Y("importing"),Ie(0),_e(ye.length);const v=await mS(ye,{lang:e,setImportProgress:Ie,fetchLessons:ct});v.success?Y("success"):(Y("error"),je(v.errorMsg||""))},Vu=async v=>{const $=await fetch(`/api/lessons/${v}`,{method:"DELETE"});if(!$.ok){const H=await $.json().catch(()=>({}));throw new Error(H.error||"Failed to delete course")}await ct(),de===v&&Te(null),Ge(e==="zh"?"课程已删除":"Course Deleted",e==="zh"?"课程及其所有关联数据已被删除。":"The course and all associated data have been deleted.","success")},Uu=async v=>{K(v);try{const $=await fetch(`/api/lessons/${v}/clone`,{method:"POST"});if(!$.ok){const H=await $.json().catch(()=>({}));throw new Error(H.error||"Failed to copy course")}await ct(),Ge(e==="zh"?"复制成功":"Course Copied",e==="zh"?"课程已成功复制。":"Course has been copied successfully.","success")}catch($){Ge(e==="zh"?"复制失败":"Copy Failed",$.message||(e==="zh"?"复制课程时发生错误。":"An error occurred while copying the course."),"error")}finally{K(null)}},Bi=async()=>{try{const v=await fetch("/api/commands/registered");if(!v.ok)return;const $=v.headers.get("content-type");if($&&$.includes("application/json")){const H=await v.json();Array.isArray(H)&&We(H)}}catch(v){console.warn("Failed to fetch registered commands",v)}},qu=async v=>{try{const $=await fetch(`/api/vfs${v?`?parentId=${v}`:""}`);if($.ok){const H=await $.json();xs(H)}}catch($){console.warn("Failed to fetch VFS nodes",$)}},Wu=async()=>{try{const v=await fetch("/api/processes");v.ok&&bs(await v.json())}catch{}},Dt=async()=>{try{const v=await fetch("/api/classes");v.ok&&Ss(await v.json())}catch{}},At=async()=>{try{const v=await fetch("/api/students");v.ok&&vn(await v.json())}catch{}},Ft=async v=>{try{const $=await fetch(`/api/classes/${v}/students`);if($.ok){const H=await $.json();Pn(J=>({...J,[v]:H}))}}catch{}},er=async v=>{try{const $=await fetch(`/api/classes/${v}/progress`);if($.ok){const H=await $.json();ku(J=>({...J,[v]:H}))}}catch{}},[tr,Hu]=p.useState({}),en=async v=>{try{const $=await fetch(`/api/classes/${v}/dashboard`);if($.ok){const H=await $.json();Hu(J=>({...J,[v]:H}))}}catch{}},Gu=dS({lang:e,classes:jt,classStudentsMap:En,classDashboardMap:tr,fetchClassStudents:Ft,fetchClassDashboard:en,fetchClassProgress:er}),{isExportWeightModalOpen:Qu,setIsExportWeightModalOpen:$i,exportClassId:Ju,setExportClassId:Yu,exportClassName:Zu,setExportClassName:Ku,quizzesWeight:Xu,setQuizzesWeight:Vi,assignmentsWeight:ed,setAssignmentsWeight:Ui,customCategoryOverrides:td,setCustomCategoryOverrides:qi,exportDropdownOpen:nd,setExportDropdownOpen:sd,exportTooltipOpen:rd,setExportTooltipOpen:id,loadingExportClassId:od,isExportingAllCombined:ad,isGeneratingPDFReport:ld,handleQuizzesWeightChange:cd,handleAssignmentsWeightChange:ud,csvPreviewData:dd,triggerExportForClass:hd,handleExportGrades:fd,handleGeneratePDFReport:pd,handleExportAllClassesCombined:Wi,get30DayAverageWarning:md}=Gu,Hi=sS({lang:e,classes:jt,expandedClassId:kt,fetchClasses:Dt,fetchClassStudents:Ft,handleExportAllClassesCombined:Wi}),{batchMode:gd,setBatchMode:yd,selectedClassIds:xd,setSelectedClassIds:wd,selectedStudentIds:bd,setSelectedStudentIds:Sd,batchPicker:g0,setBatchPicker:y0,batchPickerLesson:x0,setBatchPickerLesson:w0,batchPickerDate:b0,setBatchPickerDate:S0,batchPickerTargetClass:v0,setBatchPickerTargetClass:C0,toggleClassSelection:vd,toggleSelectAllClasses:Cd,toggleStudentSelection:kd,toggleSelectAllStudents:Ed,handleBatchDeleteClasses:Pd,handleBatchExportClasses:Td,handleBatchSetPasscode:Id,handleBatchScheduleClasses:Ad,handleBatchDeleteStudents:Nd,handleBatchResetPassword:zd,handleBatchTransferStudents:Ld,handleBatchSetLockedLesson:_d,confirmBatchPicker:k0}=Hi,nr=async v=>{try{const $=await fetch(`/api/students/${v}/dashboard`);if($.ok){const H=await $.json();cc(H),H.profile&&H.profile.locked_lesson_id&&(Te(H.profile.locked_lesson_id),It("lesson"))}}catch{}},jd=async(v=!1)=>{if(!xt)return;const H=xt?.content&&xt.content.startsWith('{"quizType":"mcq_learning_objectives"')?JSON.stringify(Xc.current):"Submitted via Whiteboard";try{(await fetch(`/api/assignments/${xt.id}/submissions`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({studentId:Ee,content:H})})).ok&&(v&&alert("Time is up! Your assessment was successfully submitted automatically."),await nr(Ee),It("dashboard"),Ys(null))}catch(J){console.error(J)}};p.useEffect(()=>{if(Se&&Be==="student"&&Ee){nr(Ee);const v=et.find($=>$.id===Ee);v&&v.locked_lesson_id&&(Te(v.locked_lesson_id),It("lesson"))}},[Se,Be,Ee,et]);const Rd=p.useRef(Be),Md=p.useRef(Ee),Od=p.useRef(e),Dd=p.useRef(et),Fd=p.useRef(Ge),Ln=p.useRef(new Set);p.useRef(new Set),p.useEffect(()=>{Rd.current=Be},[Be]),p.useEffect(()=>{Md.current=Ee},[Ee]),p.useEffect(()=>{Od.current=e},[e]),p.useEffect(()=>{Dd.current=et},[et]),p.useEffect(()=>{Fd.current=Ge},[Ge]),p.useEffect(()=>{if(!x.isInitialized()||yt.length===0)return;const v=ve.getState(),$=yt.filter(J=>J.status==="active");for(const J of $){if(!J.has_frontend||Ln.current.has(J.id))continue;const Ve=v.activePlugins.find(ht=>ht.id===J.id),dt=!!(Ve&&J.version&&Ve.version!==J.version);if(!(!Ve||dt||Ve.state!==pe.ACTIVE&&Ve.state!==pe.ACTIVATING))continue;Ln.current.add(J.id);const Ji=()=>{if(!v.activePlugins.find(ht=>ht.id===J.id))v.addPlugin({id:J.id,name:J.name,version:J.version,state:pe.INSTALLED,executionMode:"inline"});else if(dt)try{ve.setState(ht=>({activePlugins:ht.activePlugins.map(nn=>nn.id===J.id?{...nn,version:J.version,name:J.name}:nn)}))}catch{}try{const ht=JSON.parse(J.manifest);x.activateRemotePlugin(J.id,ht).catch(nn=>{console.error(`[App] Failed to activate remote plugin "${J.name}":`,nn)}).finally(()=>{Ln.current.delete(J.id)})}catch(ht){Ln.current.delete(J.id),console.error(`[App] Failed to parse manifest for plugin "${J.name}":`,ht)}};Ve&&Ve.state===pe.ACTIVE&&dt?x.deactivatePlugin(J.id).catch(()=>{}).finally(Ji):Ji()}const H=yt.filter(J=>J.status!=="active");for(const J of H){if(!J.has_frontend)continue;const Ve=v.activePlugins.find(dt=>dt.id===J.id);Ve&&Ve.state===pe.ACTIVE&&x.deactivatePlugin(J.id).catch(dt=>{console.error(`[App] Failed to deactivate remote plugin "${J.name}":`,dt)})}},[yt,x]),it.useEffect(()=>{if(!x.isInitialized()||yt.length===0)return;const v=ve.getState();for(const $ of yt)$.status==="active"&&(v.dashboardVisibility.has($.id)||v.setDashboardVisibility($.id,!0))},[yt,x]);const Bd=async v=>{if(Be==="student"&&Ee&&de)try{await fetch(`/api/students/${Ee}/progress`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({lessonId:de,completed:v===100,progressPercent:v})})}catch($){console.error("Failed to update student progress:",$)}},$d=async(v,$)=>{try{const H=await fetch(`/api/classes/${v}/lessons/${$}/progress`);H.ok&&z(await H.json())}catch{}};p.useEffect(()=>{i&&de?$d(i,de):z([])},[i,de]),p.useEffect(()=>{i&&Ft(i)},[i]);const Vd=async v=>{try{const $=await fetch(`/api/students/${v}/progress`);if($.ok){const H=await $.json();vu(J=>({...J,[v]:H}))}}catch{}},Gi=async v=>{try{const $=await fetch(`/api/processes/${v}/logs`);if($.ok){const H=await $.json();ke(H.logs||""),Jt(v)}}catch{}},tn=async v=>{const H=await(await fetch(`/api/lessons/${v}/whiteboard`)).json();Ye(H)},Ud=p.useRef(null);p.useRef(null);const qd=p.useRef(null);p.useEffect(()=>{Ud.current=de},[de]),p.useEffect(()=>{qd.current=xt},[xt]),Zw(Se);const{chatLog:Wd,setChatLog:Hd,input:Gd,setInput:Qd,loading:Jd,chatAttachments:Yd,setChatAttachments:Zd,handleChatFileChange:Kd,handleChatDrop:Xd,handleSend:eh,handleClearAgentMemory:th}=Xw({lang:e,t:n,selectedLesson:de,effectiveAgentProviderId:Js,expandedClassId:kt,fetchLessons:ct,fetchClasses:Dt,fetchStudents:At,fetchClassStudents:Ft,fetchClassProgress:er,fetchClassDashboard:en,fetchElements:tn});Ei.current=Hd,Kw({session:Se,showProcessLogs:Qt,activeStudentId:Ee,currentVfsParent:Xs,selectedLesson:de,selectedAssignment:xt,expandedClassId:kt,fetchLessons:ct,fetchPlugins:hc,fetchRegisteredCommands:Bi,fetchEvents:Sc,fetchApprovals:Cc,fetchProcesses:Wu,fetchClasses:Dt,fetchTodaySchedules:Rt,fetchStudents:At,fetchLabs:Cn,fetchVfs:qu,fetchProcessLogs:Gi,fetchClassStudents:Ft,fetchElements:tn});const{socketRef:nh}=Kb({session:Se,host:x,activeRole:Be,activeStudentId:Ee,selectedLesson:de,activeSegmentId:Hs,studentViewStatus:Xt,lang:e,students:et,addToast:Ge,setOnlineStudentIds:b,setActiveStudentLessons:S,setLessons:se,setActiveSegmentId:Gs,setLiveClassStudentProgress:z,setLiveClassAcknowledgedMap:g,setLiveClassFeed:m,setSelectedLesson:Te,setStudentViewStatus:It,setLocalProgressPercent:L,fetchStudentDashboard:nr,fetchStudents:At,fetchElements:tn}),sh=v=>{wa(v,e)},rh=async v=>{Di(!0),Zs(null),Ks(null);try{const $=await fS(v,{lang:e,fetchClasses:Dt,fetchStudents:At});Ks($.message)}catch($){Zs($.message||String($))}finally{Di(!1)}},ih=()=>{t(e==="zh"?"en":"zh")},oh=p.useCallback(v=>{Et(v),v.role==="teacher"?(Re("teacher"),$e("dashboard")):(Re("student"),Nn(v.studentId),At())},[]),Qi=async()=>{try{await fetch("/api/auth/logout",{method:"POST"})}catch(v){console.error("Logout failed",v)}Et(null)},[ah,sr]=p.useState(!1);return Fs?h.jsxs("div",{className:"min-h-screen bg-slate-900 flex flex-col items-center justify-center p-4 relative overflow-hidden font-sans",children:[h.jsx(Xr,{size:48,className:"text-indigo-500 animate-spin"}),h.jsx("span",{className:"text-white text-sm mt-4 font-semibold tracking-wide",children:e==="zh"?"正在连接安全核心数据库...":"Connecting Secure OS Core Database..."})]}):Se?h.jsx(h.Fragment,{children:h.jsxs("div",{className:"flex h-screen bg-gray-50 text-gray-900 font-sans",children:[h.jsxs("div",{className:"flex-1 flex flex-col bg-gray-50 h-full overflow-hidden",children:[h.jsx(wf,{activeRole:Be,lang:e,teacherTab:gt,studentViewStatus:Xt,session:Se,activeStudentId:Ee,students:et,studentDashboardData:Qs,isNotificationsOpen:yu,studentNotifications:fu,unreadNotifications:pu,readNotifications:Mi,selectedNotificationForModal:mu,dbConnected:$s,dbStatus:Vs,siteInfo:In,setActiveStudentId:Nn,setReadNotifications:zn,setIsSystemResourceLibraryOpen:D,setProfileOpen:sr,setTeacherTab:$e,setStudentViewStatus:It,setIsNotificationsOpen:xu,setSelectedNotificationForModal:gu,handleLogout:Qi,toggleLanguage:ih}),h.jsx(bf,{open:ah,session:Se,lang:e,onClose:()=>sr(!1),onSaved:v=>{Se&&Et({...Se,name:v}),sr(!1)},onAvatar:v=>{Se&&Et({...Se,avatar:v??void 0})}}),h.jsx(px,{students:et,activeStudentId:Ee,studentViewStatus:Xt,studentDashboardData:Qs,readNotifications:Mi,setReadNotifications:zn,addToast:Ge,lang:e,setSelectedLesson:Te,setStudentViewStatus:It,setSelectedAssignment:Ys,setQuizStudentAnswers:_i,setSubAssignmentTab:ji,lessons:ee,selectedLesson:de,studentFullscreenPanel:Vc,setStudentFullscreenPanel:Uc,timelineSegments:Xl,activeSegmentId:Hs,setActiveSegmentId:Gs,localProgressPercent:k,setLocalProgressPercent:L,updateStudentProgress:Bd,isStudentLessonContentCollapsed:qc,setIsStudentLessonContentCollapsed:zi,studentLessonTab:_c,setStudentLessonTab:jc,elements:Ce,activeRole:Be,fetchElements:tn,currentVfsParent:Xs,setCurrentVfsParent:Fi,vfsNodes:bn,studentSelectedCourseware:Rc,setStudentSelectedCourseware:Mc,selectedAssignment:xt,quizStudentAnswers:Kc,submitQuizAssignment:jd,subAssignmentTab:eu,mainNavCollapsed:s,setMainNavCollapsed:r,teacherTab:gt,setTeacherTab:$e,session:Se,todaySchedules:Cs,t:n,classes:jt,approvals:vc,processes:ws,isApprovalsCollapsed:qs,setIsApprovalsCollapsed:Ws,isProcessesCollapsed:Kt,setIsProcessesCollapsed:Zl,scoreOverrides:kc,setScoreOverrides:Ec,handleApprove:Nc,handleReject:zc,showLogs:gs,setShowLogs:ys,processLogsContent:Sn,showProcessLogs:Qt,fetchProcessLogs:Gi,setShowProcessLogs:Jt,handleQuickScheduleClass:Mu,handleQuickGenerateAssignment:Ou,handleQuickCreateLesson:Du,setActiveRole:Re,editorSaveStatus:nc,setEditorSaveStatus:sc,editorLastSavedTime:rc,setEditorLastSavedTime:ic,setIsLessonPreviewVisible:Ii,setPreviewLessonTab:Ni,setPreviewSelectedCourseware:Ai,handlePaletteActivate:Os,draggedSegmentIdx:ec,setDraggedSegmentIdx:tc,saveTimeline:lc,editorPanelsExpanded:oc,setEditorPanelsExpanded:ac,whiteboardRef:Tn,paletteEdit:Yt,handlePaletteConfirm:Ds,setPaletteEdit:Zt,plugins:yt,liveClassSelectedClassId:i,setLiveClassSelectedClassId:o,liveClassIsActive:a,setLiveClassIsActive:l,liveClassTimeRemaining:c,setLiveClassTimeRemaining:u,liveClassFeed:d,setLiveClassFeed:m,liveClassAcknowledgedMap:f,setLiveClassAcknowledgedMap:g,onlineStudentIds:C,activeStudentLessons:I,liveClassStudentProgress:E,storeTab:mc,setStoreTab:gc,pluginCode:yc,setPluginCode:xc,installingPlugin:wc,onInstall:Pc,onZipUpload:Tc,onToggle:Ic,onDelete:Ac,lessonsSearchQuery:fe,setLessonsSearchQuery:ge,lessonsSortOrder:Le,setLessonsSortOrder:Ae,filteredLessons:re,onOpenImportLessons:()=>{Y("idle"),Ie(0),_e(0),je(""),He([]),U(!0)},onOpenCourseWizard:()=>{dc(1),uc(!0)},onViewCourse:v=>{$e("lesson_editor"),Te(v)},onDeleteCourse:Vu,onCopyCourse:Uu,filterEnrollment:he,setFilterEnrollment:ft,filterHasContent:Lt,setFilterHasContent:_t,filterThisMonth:pt,setFilterThisMonth:mt,copyingLessonId:G,onSchedulesUpdated:Rt,onLogout:Qi,aiProviders:Tt,testingProviderId:pc,onAIProvidersChanged:fc,onTriggerTour:()=>Ot(!0),siteInfo:In,onSiteInfoChanged:An,computerLabs:vs,onRefresh:Cn,registeredCommands:be,fetchRegisteredCommands:Bi,batchMode:gd,selectedClassIds:xd,setSelectedClassIds:wd,setSelectedStudentIds:Sd,setBatchMode:yd,expandedClassId:kt,setExpandedClassId:js,exportTooltipOpen:rd,setExportTooltipOpen:id,exportDropdownOpen:nd,setExportDropdownOpen:sd,isExportingAllCombined:ad,loadingExportClassId:od,classStudentsMap:En,setClassStudentsMap:Pn,expandedStudentId:Rs,setExpandedStudentId:bu,selectedStudentIds:bd,rosterViewMode:iu,setRosterViewMode:ou,rosterSearchQuery:tu,setRosterSearchQuery:nu,rosterTagFilter:su,setRosterTagFilter:ru,toggleSelectAllStudents:Ed,handleBatchDeleteStudents:Nd,handleBatchResetPassword:zd,handleBatchTransferStudents:Ld,handleBatchSetLockedLesson:_d,toggleStudentSelection:kd,get30DayAverageWarning:md,studentProgressMap:Su,studentActiveTabs:du,setStudentActiveTabs:hu,setStudents:vn,fetchClassStudents:Ft,fetchStudents:At,parseCSV:gf,setImportError:Zs,setImportSuccess:Ks,setShowImportModal:Oi,fetchClasses:Dt,classSubmissionFilters:au,setClassSubmissionFilters:lu,classActiveTabs:cu,setClassActiveTabs:uu,classProgressMap:Cu,classSchedulesMap:ks,classDashboardMap:tr,assignmentSortOrder:Pu,setAssignmentSortOrder:Tu,isGeneratingPDFReport:ld,handleGeneratePDFReport:pd,setExportClassId:Yu,setExportClassName:Ku,setQuizzesWeight:Vi,setAssignmentsWeight:Ui,setCustomCategoryOverrides:qi,setIsExportWeightModalOpen:$i,isGeneratingAssignment:Eu,setQuizGeneratorClassId:Hc,setQuizGenMode:Gc,setQuizGenSelectedLessonId:Qc,setQuizGenTopic:Jc,setSuggestedObjectives:Yc,setSuggestedQuestions:Zc,setIsQuizGeneratorOpen:Wc,setActiveStudentId:Nn,isGrading:Iu,setIsGrading:Au,fetchClassDashboard:en,newScheduleDate:As,setNewScheduleDate:Ns,newScheduleLessonId:me,setNewScheduleLessonId:zs,expandedScheduleId:Ts,setExpandedScheduleId:Is,fetchScheduleAttendance:Ps,scheduleAttendanceMap:Es,toggleSelectAllClasses:Cd,handleBatchDeleteClasses:Pd,handleBatchExportClasses:Td,handleBatchSetPasscode:Id,handleBatchScheduleClasses:Ad,handleExportAllClassesCombined:Wi,triggerExportForClass:hd,fetchClassProgress:er,fetchClassSchedules:kn,fetchStudentProgress:Vd,toggleClassSelection:vd,socketRef:nh,setShowCoursewareHub:w,fetchTodaySchedules:Rt})]}),h.jsx(Lw,{showRightSidebar:hs,setShowRightSidebar:fs,rightSidebarTab:ps,setRightSidebarTab:ms,effectiveAgentProviderId:Js,agentProviderId:ut,setAgentProviderId:Ti,aiProviders:Tt,selectedAgentProvider:Lc,chatLog:Wd,loading:Jd,input:Gd,setInput:Qd,handleSend:eh,chatAttachments:Yd,setChatAttachments:Zd,handleChatFileChange:Kd,handleChatDrop:Xd,onClearAgentMemory:th,events:bc,lang:e,t:n}),h.jsx(Hw,{lang:e,t:n,courseWizard:Pi,quizGenerator:Li,classBatch:Hi,studentNotificationsHook:Ri,showImportModal:Nu,setShowImportModal:Oi,handleImportFile:rh,importError:Lu,importSuccess:_u,isImporting:zu,downloadCSVTemplate:sh,addToast:Ge,generateTemplateContent:ex,isImportLessonsOpen:j,setIsImportLessonsOpen:U,importStatus:Q,setIsDraggingImport:ds,handleCSVFileChange:Bu,downloadCsvTemplate:Fu,isDraggingImport:Fe,previewImportData:ye,setPreviewImportData:He,setImportStatus:Y,importProgress:ie,importProgressTotal:Ze,importErrorMsg:lt,setImportErrorMsg:je,handleCSVImportSubmit:$u,lessons:ee,fetchClassDashboard:en,isLessonPreviewVisible:Oc,setIsLessonPreviewVisible:Ii,selectedLesson:de,previewFullscreenPanel:Bc,setPreviewFullscreenPanel:$c,previewLessonTab:Fc,setPreviewLessonTab:Ni,activeRole:Be,elements:Ce,activeSegmentId:Hs,setActiveSegmentId:Gs,fetchElements:tn,currentVfsParent:Xs,setCurrentVfsParent:Fi,vfsNodes:bn,previewSelectedCourseware:Dc,setPreviewSelectedCourseware:Ai,showProcessLogs:Qt,setShowProcessLogs:Jt,processLogsContent:Sn,isCloudDriveOpen:R,setIsCloudDriveOpen:O,cloudDrivePreviewNode:P,setCloudDrivePreviewNode:N,isSystemResourceLibraryOpen:_,setIsSystemResourceLibraryOpen:D,systemResourceTab:F,setSystemResourceTab:A,selectedLibraryResourceId:T,setSelectedLibraryResourceId:B,loadingLibraryResources:y,libraryResources:M,fetchLibraryResources:W,classes:jt,expandedClassId:kt,isExportWeightModalOpen:Qu,setIsExportWeightModalOpen:$i,quizzesWeight:Xu,setQuizzesWeight:Vi,assignmentsWeight:ed,setAssignmentsWeight:Ui,handleQuizzesWeightChange:cd,handleAssignmentsWeightChange:ud,customCategoryOverrides:td,setCustomCategoryOverrides:qi,classDashboardMap:tr,exportClassId:Ju,exportClassName:Zu,csvPreviewData:dd,handleExportGrades:fd,setSelectedAssignment:Ys,setStudentViewStatus:It,setQuizStudentAnswers:_i,setSubAssignmentTab:ji,isTourOpen:Us,setIsTourOpen:Ot,handleSeedSuccess:Kl,setTeacherTab:$e,showCoursewareHub:ae,setShowCoursewareHub:w}),h.jsx(zw,{})]})}):h.jsx(yf,{onLoginSuccess:oh,lang:e})}class xS{constructor(){this.services=new Map}async register(t,n){if(this.services.has(t))throw new Error(`Service already registered: ${t}`);this.services.set(t,n)}async resolve(t){const n=this.services.get(t);if(!n)throw new Error(`No provider registered for token: ${t}`);return n}async unregister(t){this.services.delete(t)}has(t){return this.services.has(t)}list(){return Array.from(this.services.entries()).map(([t,n])=>({name:t,instance:n}))}}const wS=/^[0-9a-f]{8}-[0-9a-f]{4}-7[0-9a-f]{3}-[0-9a-f]{4}-[0-9a-f]{12}\./i;function bS(e,t){const n=t+".";return e.startsWith(n)||wS.test(e)?e:n+e}let SS=0;function vS(e,t){const s={student_id:"teacher_preview",student_name:"Teacher (Preview)",class_id:"",attempt_id:`att_srcdoc_${t}_${Date.now()}_${++SS}`},r={uuid:t,name:"Whiteboard HTML Applet"};return`<!DOCTYPE html>
|
|
151
|
-
<html><head>
|
|
152
|
-
<script>
|
|
153
|
-
window.__LMS_STUDENT__ = ${JSON.stringify(s)};
|
|
154
|
-
window.__LMS_COURSEWARE__ = ${JSON.stringify(r)};
|
|
155
|
-
(function() {
|
|
156
|
-
try {
|
|
157
|
-
// Override window.postMessage (self-targeting, always works)
|
|
158
|
-
var origPM = window.postMessage;
|
|
159
|
-
window.postMessage = function(msg, targetOrigin, transfer) {
|
|
160
|
-
var origin = (targetOrigin === 'null' || targetOrigin === null) ? '*' : targetOrigin;
|
|
161
|
-
try { return origPM.call(this, msg, origin, transfer); }
|
|
162
|
-
catch(err) { if (err.name === 'SyntaxError') return origPM.call(this, msg, '*', transfer); throw err; }
|
|
163
|
-
};
|
|
164
|
-
// Shadow window.parent / window.top with Proxy to intercept .postMessage()
|
|
165
|
-
// Direct assignment (window.parent.postMessage = ...) silently fails on cross-origin WindowProxy
|
|
166
|
-
function proxyWin(realRef, propName) {
|
|
167
|
-
try {
|
|
168
|
-
var safePost = function(msg, targetOrigin, transfer) {
|
|
169
|
-
var origin = (targetOrigin === 'null' || targetOrigin === null) ? '*' : targetOrigin;
|
|
170
|
-
try { return realRef.postMessage.call(realRef, msg, origin, transfer); }
|
|
171
|
-
catch(err) { if (err.name === 'SyntaxError') return realRef.postMessage.call(realRef, msg, '*', transfer); throw err; }
|
|
172
|
-
};
|
|
173
|
-
var px = new Proxy(realRef, {
|
|
174
|
-
get: function(t, p) {
|
|
175
|
-
if (p === 'postMessage') return safePost;
|
|
176
|
-
try { var v = t[p]; return typeof v === 'function' ? v.bind(t) : v; } catch(e) { return undefined; }
|
|
177
|
-
}
|
|
178
|
-
});
|
|
179
|
-
Object.defineProperty(window, propName, { get: function() { return px; }, configurable: true });
|
|
180
|
-
} catch(e) {}
|
|
181
|
-
}
|
|
182
|
-
if (window.parent && window.parent !== window) proxyWin(window.parent, 'parent');
|
|
183
|
-
try { if (window.top && window.top !== window) proxyWin(window.top, 'top'); } catch(e) {}
|
|
184
|
-
} catch(e) {}
|
|
185
|
-
})();
|
|
186
|
-
<\/script>
|
|
187
|
-
<script src="/bridge.js"><\/script>
|
|
188
|
-
</head><body>
|
|
189
|
-
${e||""}
|
|
190
|
-
</body></html>`}class CS{constructor(){this.loaders=new Map}register(t,n){this.loaders.set(t.id,{impl:t,pluginId:n})}unregister(t,n){const s=this.loaders.get(t);s&&(n&&s.pluginId!==n||this.loaders.delete(t))}unregisterPlugin(t){for(const[n,s]of this.loaders)s.pluginId===t&&this.loaders.delete(n)}resolve(t,n){for(const{impl:s}of this.loaders.values())try{const r=s.resolve(t,n);if(r)return r}catch{}return null}}const Zn=new CS,kS=4;let Un=0;const Yr=new Set;function va(){return Un>=kS?null:(Un+=1,()=>{Un=Math.max(0,Un-1);for(const e of Yr)e()})}function ES(e){return Yr.add(e),()=>{Yr.delete(e)}}function PS(e,t){const[n,s]=p.useState(!e),[r,i]=p.useState(!1),o=p.useRef(null);return p.useEffect(()=>{if(!e||n)return;const a=t.current;if(!a)return;if(typeof IntersectionObserver>"u"){s(!0);return}const l=new IntersectionObserver(c=>{c.some(u=>u.isIntersecting)&&(s(!0),l.disconnect())},{rootMargin:"200px"});return l.observe(a),()=>l.disconnect()},[e,n,t]),p.useEffect(()=>{if(!n){o.current?.(),o.current=null,i(!1);return}const a=va();if(a)o.current=a,i(!0);else{const l=ES(()=>{const c=va();c&&(l(),o.current=c,i(!0))});return()=>l()}},[n]),p.useEffect(()=>()=>{o.current?.()},[]),r}function TS({data:e,lessonId:t,className:n,title:s,lazy:r=!0}){const i=it.useRef(null),o=PS(r,i),a=Zn.resolve(e,{lessonId:t}),l=e.coursewareUuid?`/runtime/${e.coursewareUuid}/`:e.resourceId?`/api/resources/${e.resourceId}/`:a??void 0;return h.jsx("div",{ref:i,className:n??"w-full h-full",children:o?h.jsx("iframe",{className:"w-full h-full border-none",src:l,srcDoc:l?void 0:vS(e.code||"",t),sandbox:"allow-scripts allow-forms allow-downloads",referrerPolicy:"no-referrer",title:s??e.title??"Interactive Courseware",credentialless:!0}):h.jsx("div",{className:"w-full h-full flex items-center justify-center text-xs text-gray-400 bg-slate-50 rounded-xl",children:"课件未加载"})})}class IS{constructor(){this.renderers=new Map}register(t,n,s){this.renderers.set(t,{impl:n,pluginId:s})}get(t){return this.renderers.get(t)?.impl}has(t){return this.renderers.has(t)}unregister(t,n){const s=this.renderers.get(t);s&&(n&&s.pluginId!==n||this.renderers.delete(t))}unregisterPlugin(t){for(const[n,s]of this.renderers)s.pluginId===t&&this.renderers.delete(n)}}const Kn=new IS,D0=({type:e,title:t,data:n,containerSize:s,onClose:r,lessonId:i})=>{it.useEffect(()=>{const u=d=>{d.key==="Escape"&&r()};return window.addEventListener("keydown",u),()=>window.removeEventListener("keydown",u)},[r]);const o=Kn.get(e),[a,l]=p.useState({width:window.innerWidth,height:window.innerHeight});p.useEffect(()=>{const u=()=>l({width:window.innerWidth,height:window.innerHeight});return window.addEventListener("resize",u),()=>window.removeEventListener("resize",u)},[]);const c=h.jsx("div",{className:"fixed inset-0 z-[99999] bg-black/60 flex items-center justify-center",style:{pointerEvents:"auto"},children:h.jsxs("div",{className:"relative bg-white rounded-xl shadow-2xl overflow-hidden flex flex-col",style:{width:Math.max(400,a.width-32),height:Math.max(300,a.height-32)},children:[h.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:[h.jsx("span",{className:"truncate",children:t}),h.jsxs("button",{onClick:r,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:[h.jsx(Lh,{size:14})," 退出全屏"]})]}),h.jsx("div",{className:"absolute top-3 right-3 z-10",children:h.jsx("button",{onClick:r,className:"w-8 h-8 flex items-center justify-center rounded-full bg-black/20 hover:bg-black/40 text-white transition-colors cursor-pointer",title:"关闭 (ESC)",children:h.jsx(gn,{size:16})})}),h.jsx("div",{className:"flex-1 overflow-auto p-6",children:o?h.jsx(o,{elementType:e,data:n,onClose:r,containerSize:a,lessonId:i}):h.jsx(NS,{elementType:e,data:n,onClose:r,containerSize:a,lessonId:i})})]})});return lh.createPortal(c,document.body)},AS=[{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 NS({data:e,lessonId:t}){const n=AS.find(a=>e[a.field]!==void 0&&e[a.field]!==null&&e[a.field]!=="");if(!n)return h.jsxs("div",{className:"flex flex-col items-center justify-center h-full gap-4 text-gray-500",children:[h.jsx(Na,{size:48,className:"opacity-30"}),h.jsx("div",{className:"text-sm font-medium",children:"自动识别渲染"}),h.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(e,null,2)})]});const{field:s,icon:r,label:i,extra:o}=n;if(s==="markdown")return h.jsx("div",{className:"prose prose-sm max-w-none",children:h.jsx(Uy,{children:String(e.markdown)})});if(s==="code")return h.jsx("textarea",{value:String(e.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 h.jsx("div",{className:"flex items-start h-full",children:h.jsx("div",{className:"text-lg whitespace-pre-wrap leading-relaxed",children:String(e.text)})});if(s==="question"){const a=Array.isArray(e.options)?e.options:[];return h.jsxs("div",{className:"max-w-2xl mx-auto space-y-6",children:[h.jsx("h3",{className:"text-xl font-bold text-gray-800",children:e.question}),h.jsx("div",{className:"flex flex-col gap-3",children:a.map((l,c)=>h.jsxs("div",{className:"px-5 py-4 text-left bg-gray-50 border-2 border-gray-200 rounded-xl text-base",children:[h.jsxs("span",{className:"font-bold text-indigo-600 mr-3",children:["ABCDEFGHIJKLMNOPQRSTUVWXYZ"[c],"."]}),l]},c))})]})}return s==="url"?h.jsx("div",{className:"flex items-center justify-center h-full",children:h.jsx("a",{href:String(e.url),target:"_blank",rel:"noopener noreferrer",className:"text-indigo-600 underline text-lg",children:String(e.url)})}):s==="src"?h.jsx("div",{className:"flex items-center justify-center h-full",children:h.jsx("img",{src:String(e.src),alt:"",className:"max-w-full max-h-full object-contain rounded-lg"})}):s==="coursewareUuid"?h.jsx(TS,{data:{coursewareUuid:String(e.coursewareUuid)},lessonId:t,className:"w-full h-full rounded-xl border"}):s==="equation"?h.jsx("div",{className:"flex items-center justify-center h-full",children:h.jsx("div",{className:"text-2xl font-mono text-gray-800 bg-gray-50 px-8 py-4 rounded-xl border",children:String(e.equation)})}):h.jsx("div",{className:"flex items-center justify-center h-full",children:h.jsxs("div",{className:"text-center",children:[h.jsx("div",{className:"text-4xl mb-2",children:r}),h.jsx("div",{className:"text-lg font-semibold text-gray-800",children:i}),h.jsx("pre",{className:"mt-4 text-xs text-gray-500 max-w-md overflow-auto",children:JSON.stringify(e,null,2)})]})})}class zS{constructor(){this.editors=new Map}register(t,n,s){this.editors.set(t,{impl:n,pluginId:s})}get(t){return this.editors.get(t)?.impl}has(t){return this.editors.has(t)}unregister(t,n){const s=this.editors.get(t);s&&(n&&s.pluginId!==n||this.editors.delete(t))}unregisterPlugin(t){for(const[n,s]of this.editors)s.pluginId===t&&this.editors.delete(n)}}const Ir=new zS,LS=["@openlearn/frontend:IFrontendAPI","@openlearn/frontend:ISocketService","@openlearn/frontend:IUIService","@openlearn/frontend:IStorageService","@openlearn/frontend:ISemesterGradeService"];class _S{constructor(t){this.registry=null,this.initialized=!1,this.sourceCodes=new Map,this.pluginModules=new Map,this.workerManager=null,this.moduleLoader=t?.moduleLoader??this.defaultModuleLoader}setWorkerManager(t){this.workerManager=t}async initialize(t,n,s,r){const i=new xS;await i.register(Jo,t),await i.register(Yo,n),await i.register(Zo,s),await i.register(Ko,r),await i.register(dx,new jS(t)),this.registry=i,this.initialized=!0,ve.getState().initialize(i)}getRegistry(){return this.registry}isInitialized(){return this.initialized}async installPlugin(t,n){this.sourceCodes.set(t.id,n),ve.getState().addPlugin({id:t.id,name:t.name,version:t.version,state:pe.INSTALLED,executionMode:"inline"})}async activateRemotePlugin(t,n){const s=ve.getState(),r=s.activePlugins.find(i=>i.id===t);if(!(r&&(r.state===pe.ACTIVE||r.state===pe.ACTIVATING))){s.updatePluginState(t,pe.ACTIVATING);try{const i=`/plugins/${t}/frontend.js`,o=await fetch(i);if(!o.ok)throw new Error(`Failed to fetch frontend.js for plugin "${t}": HTTP ${o.status}`);let a=await o.text();window.HostSharedDeps&&(a=a.replace(/import\s+(\w+)\s+from\s+['"]react['"];?/g,"const $1 = window.HostSharedDeps.React;").replace(/import\s+\*\s+as\s+(\w+)\s+from\s+['"]react['"];?/g,"const $1 = window.HostSharedDeps.React;").replace(/import\s+\{\s*([^}]+)\s*\}\s+from\s+['"]react['"];?/g,(f,g)=>`const { ${g} } = window.HostSharedDeps.React;`).replace(/import\s+\{\s*([^}]+)\s*\}\s+from\s+['"]lucide-react['"];?/g,(f,g)=>`const { ${g} } = window.HostSharedDeps.LucideReact;`).replace(/import\s+\{\s*([^}]+)\s*\}\s+from\s+['"]recharts['"];?/g,(f,g)=>`const { ${g} } = window.HostSharedDeps.Recharts;`));const l=new Blob([a],{type:"text/javascript"}),c=URL.createObjectURL(l);let u;try{u=await import(c)}finally{URL.revokeObjectURL(c)}const d=u.default??u;if(typeof d.activate!="function")throw new Error("Invalid remote frontend plugin: missing activate function");const m=await this.buildContext(t,n);await Promise.race([d.activate(m),new Promise((f,g)=>setTimeout(()=>g(new Error("Activation timeout (5000ms)")),5e3))]),this.pluginModules.set(t,{manifest:n,activate:d.activate,deactivate:typeof d.deactivate=="function"?d.deactivate:void 0}),s.updatePluginState(t,pe.ACTIVE)}catch(i){throw console.error(`[FrontendPluginHost] Failed to activate remote plugin "${t}":`,i),s.updatePluginState(t,pe.ERROR),this.unregisterPluginResources(t),i}}}async activatePlugin(t){const n=ve.getState(),s=n.activePlugins.find(r=>r.id===t);if(!s)throw new Error(`Plugin not found: ${t}`);if(s.executionMode==="worker")return this.activateWorkerPlugin(t,s);if(s.executionMode!=="inline")throw new Error(`Unsupported execution mode for activation: ${s.executionMode}`);n.updatePluginState(t,pe.ACTIVATING);try{const r=this.sourceCodes.get(t);if(!r)throw new Error(`No source code found for plugin: ${t}`);const i=await this.moduleLoader(r),o=i.default??i,a=o.manifest??i.manifest,l=o.activate??i.activate,c=o.deactivate??i.deactivate;if(!a||typeof l!="function")throw new Error("Invalid plugin: missing manifest or activate function");if(a.id!==t)throw new Error(`Manifest id mismatch: expected "${t}", got "${a.id}"`);if(a.classroomTools)for(const d of a.classroomTools)n.registerExtensionPoint("classroom.tool",{id:d.id,label:d.name,icon:d.icon,component:()=>Promise.resolve({default:(()=>null)}),pluginId:t});const u=await this.buildContext(t,a);await Promise.race([l(u),new Promise((d,m)=>setTimeout(()=>m(new Error("Activation timeout (5000ms)")),5e3))]),this.pluginModules.set(t,{manifest:a,activate:l,deactivate:typeof c=="function"?c:void 0}),n.updatePluginState(t,pe.ACTIVE)}catch(r){throw n.updatePluginState(t,pe.ERROR),this.unregisterPluginResources(t),r}}async activateWorkerPlugin(t,n){if(!this.workerManager)throw new Error(`Cannot activate plugin "${t}" in worker mode: BrowserWorkerManager not set. Call setWorkerManager() first.`);const s=ve.getState(),r=this.sourceCodes.get(t);if(!r)throw new Error(`No source code found for plugin: ${t}`);const i={id:t,name:n.name,version:n.version};s.updatePluginState(t,pe.ACTIVATING);try{let o;if(this.registry)try{o=await this.registry.resolve("@openlearn/frontend:ISocketService")}catch{}const{serviceHost:a}=await this.workerManager.createWorker(t,i,r,LS,o);this.pluginModules.set(t,{manifest:i,activate:async()=>{},deactivate:async()=>{await this.workerManager.terminateWorker(t)}}),s.updatePluginState(t,pe.ACTIVE)}catch(o){throw s.updatePluginState(t,pe.ERROR),this.unregisterPluginResources(t),o}}async deactivatePlugin(t){const n=ve.getState(),s=n.activePlugins.find(r=>r.id===t);if(!(!s||s.state!==pe.ACTIVE)){n.updatePluginState(t,pe.DEACTIVATING);try{const r=this.pluginModules.get(t);r?.deactivate&&await Promise.race([r.deactivate(),new Promise((i,o)=>setTimeout(()=>o(new Error("Deactivation timeout (5000ms)")),5e3))])}catch(r){console.error(`[FrontendPluginHost] Deactivation error for "${t}":`,r)}finally{this.unregisterPluginResources(t),this.pluginModules.delete(t),n.updatePluginState(t,pe.INACTIVE)}}}async uninstallPlugin(t){const n=ve.getState();n.activePlugins.find(r=>r.id===t)?.state===pe.ACTIVE&&await this.deactivatePlugin(t);try{await fetch(`/api/plugins/${t}`,{method:"DELETE"})}catch(r){console.error(`[FrontendPluginHost] Failed to DELETE plugin "${t}" on server:`,r)}this.sourceCodes.delete(t),this.pluginModules.delete(t),this.unregisterPluginResources(t),n.removePlugin(t)}getExtensions(t){return ve.getState().getExtensions(t)}unregisterPluginResources(t){ve.getState().unregisterPluginExtensionPoints(t),Kn.unregisterPlugin(t),Ir.unregisterPlugin(t),Zn.unregisterPlugin(t)}async defaultModuleLoader(t){const n=new Blob([t],{type:"text/javascript"}),s=URL.createObjectURL(n);try{return await import(s)}finally{URL.revokeObjectURL(s)}}async buildContext(t,n){if(!this.registry)throw new Error("FrontendPluginHost not initialized");const s=await this.registry.resolve(Jo),r=await this.registry.resolve(Yo),i=await this.registry.resolve(Zo),o=await this.registry.resolve(Ko);return{services:{frontendApi:s,socketService:r,uiService:i,storageService:o},pluginId:t,manifest:n,ui:{registerExtensionPoint:(a,l)=>{ve.getState().registerExtensionPoint(a,{...l,pluginId:t})},unregisterExtensionPoint:(a,l)=>{ve.getState().unregisterExtensionPoint(a,l)},registerFullscreenRenderer:(a,l)=>{Kn.register(a,l,t)},unregisterFullscreenRenderer:a=>{Kn.unregister(a,t)},registerPropertyEditor:(a,l)=>{Ir.register(a,l,t)},unregisterPropertyEditor:a=>{Ir.unregister(a,t)},registerCoursewareSource:a=>{Zn.register(a,t)},unregisterCoursewareSource:a=>{Zn.unregister(a,t)}},navigation:{getTeacherTab:()=>Pe.getState().teacherTab,setTeacherTab:a=>Pe.getState().setTeacherTab(a),subscribeTeacherTab:a=>{let l=Pe.getState().teacherTab;return Pe.subscribe(c=>{const u=c.teacherTab;u!==l&&(l=u,a(u))})}},context:{get:()=>{const a=Pe.getState();return{lessonId:a.selectedLesson,classId:a.liveClassSelectedClassId}},subscribe:a=>{const l=Pe.getState();let c={lessonId:l.selectedLesson,classId:l.liveClassSelectedClassId};return Pe.subscribe(u=>{const d={lessonId:u.selectedLesson,classId:u.liveClassSelectedClassId};(d.lessonId!==c.lessonId||d.classId!==c.classId)&&(c=d,a(d))})}},invokeCommand:async(a,l)=>{if(!s)throw new Error(`Plugin "${t}" cannot invoke command: frontendApi is not available. Has FrontendPluginHost initialized?`);const c=bS(a,n.id),u=await s.post("/api/plugins/execute-command",{type:c,payload:l});if(u.success&&u.result!==void 0)return u.result;throw new Error(u.error||"Command execution failed")},registerPanel:a=>{const l=a.slot||"teacher.dashboard.widget";ve.getState().registerExtensionPoint(l,{...a,pluginId:t})},registerMenu:a=>{const l=a.slot||"teacher.panel";ve.getState().registerExtensionPoint(l,{...a,pluginId:t})},registerToolbarButton:a=>{ve.getState().registerExtensionPoint("classroom.tool",{...a,pluginId:t})}}}}class jS{constructor(t){this.frontendApi=t}async saveSemesterGrade(t,n,s){const r=await this.frontendApi.post("/api/grade-sync",{lessonId:t,studentId:n,grade:s});if(!r.success)throw new Error(r.error||"Failed to sync semester grade")}}window.React=ka;window.ReactDOM=Ea;window.HostSharedDeps={React:ka,ReactDOM:Ea,Recharts:mf,LucideReact:_h};const RS=new _S;ch.createRoot(document.getElementById("root")).render(h.jsx(p.StrictMode,{children:h.jsx(Qy,{host:RS,children:h.jsx(yS,{})})}));export{vx as A,_0 as C,Ky as D,R0 as E,D0 as F,TS as H,Uy as M,Sf as P,ce as a,j0 as b,vf as c,O0 as d,Kn as e,Jw as f,ex as g,Yn as l,Nw as m,Ir as p,bS as r,ve as u};
|