openlearn-next 0.7.5 → 0.7.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (66) hide show
  1. package/README.md +66 -150
  2. package/dist/assets/{AcademicYearFilter-DUUGpDKt.js → AcademicYearFilter-Dm3no4Nb.js} +1 -1
  3. package/dist/assets/ActivityWorkspaceWidget-BLJAc5g8.js +1 -0
  4. package/dist/assets/{AdminDirectoryView-B6OAs5Rj.js → AdminDirectoryView-D6sMmobg.js} +1 -1
  5. package/dist/assets/{AssessmentCenter-B3f1DxSG.js → AssessmentCenter-3Cu5DE67.js} +1 -1
  6. package/dist/assets/{AssignmentFilePreview-DQbvbgnd.js → AssignmentFilePreview-DvBdEpB3.js} +2 -2
  7. package/dist/assets/{BatchPickerModal-CoOWloSS.js → BatchPickerModal-D1kEgc4L.js} +1 -1
  8. package/dist/assets/{ClassesView-Q56Kf4eL.js → ClassesView-DpC-D2y5.js} +10 -10
  9. package/dist/assets/{ClassroomCountdownWidget-C6luhy8P.js → ClassroomCountdownWidget-DFGC4XNs.js} +2 -2
  10. package/dist/assets/{CloudDriveModal-DLf4fbKR.js → CloudDriveModal-drWgNbEq.js} +1 -1
  11. package/dist/assets/ComputerLabView-BnfpX3XL.js +1 -0
  12. package/dist/assets/CourseManagement-DuVTm_hD.js +1 -0
  13. package/dist/assets/{CourseWizardModal-DAueHXcl.js → CourseWizardModal-BvQ4d1tN.js} +1 -1
  14. package/dist/assets/{CoursewareHubPanel-DLjH-UzF.js → CoursewareHubPanel-Ct9hTAOu.js} +1 -1
  15. package/dist/assets/{Dashboard-qMVadkd2.js → Dashboard-D3yj1oZj.js} +2 -2
  16. package/dist/assets/{ExportWeightModal-Dkh7OC8U.js → ExportWeightModal-CnbJuOav.js} +1 -1
  17. package/dist/assets/{HelpTour-BLuiS8rr.js → HelpTour-COz9zyR9.js} +1 -1
  18. package/dist/assets/{HelpView-CTF6B9ml.js → HelpView-PmIyAO8_.js} +2 -2
  19. package/dist/assets/{ImportLessonsModal-Ra-OF_Vo.js → ImportLessonsModal-CSlMGoet.js} +1 -1
  20. package/dist/assets/{ImportModal-H5s5MyZY.js → ImportModal-CCzFqKY0.js} +1 -1
  21. package/dist/assets/{InteractiveCoursewareViewer-BfHEDrCf.js → InteractiveCoursewareViewer-bgyDq7MF.js} +1 -1
  22. package/dist/assets/{InteractiveWhiteboard-KBzmiNBG.js → InteractiveWhiteboard-v8FqsMj3.js} +8 -8
  23. package/dist/assets/LazyCourseware-Bt31zjJT.js +2 -0
  24. package/dist/assets/LazyWhiteboard-Da0K2ZR1.js +2 -0
  25. package/dist/assets/LessonEditorView-DT3M9p_4.js +1 -0
  26. package/dist/assets/{LiveClassroomView-DezAlve2.js → LiveClassroomView-CrLRO8vI.js} +1 -1
  27. package/dist/assets/NotificationDetailModal-BgqbD3Gh.js +1 -0
  28. package/dist/assets/PluginView-CkICwR16.js +77 -0
  29. package/dist/assets/{ProcessLogsModal-_BwkmJVw.js → ProcessLogsModal-zO4lMuUa.js} +1 -1
  30. package/dist/assets/{QuizGeneratorModal-CTj2moWM.js → QuizGeneratorModal-D60-HJGk.js} +1 -1
  31. package/dist/assets/StudentAssignmentEvalPanel-C336iZSv.js +1 -0
  32. package/dist/assets/{StudentAssignmentView-D_EhblVQ.js → StudentAssignmentView--JlShlDQ.js} +1 -1
  33. package/dist/assets/{StudentLessonView-BHG50-4M.js → StudentLessonView-BgjjfEfD.js} +1 -1
  34. package/dist/assets/StudentView-Cjq1QOvV.js +2 -0
  35. package/dist/assets/{SystemResourceLibraryModal-C5y8H5Pf.js → SystemResourceLibraryModal-pPdl2NHf.js} +1 -1
  36. package/dist/assets/TeacherView-dLr1v6tY.js +2 -0
  37. package/dist/assets/{TimetableView-C8kdJlf7.js → TimetableView-CVAD4LYw.js} +1 -1
  38. package/dist/assets/{UTIF-4E-wdh3X.js → UTIF-p6fKAG_V.js} +1 -1
  39. package/dist/assets/index-BfKoCpo_.js +131 -0
  40. package/dist/assets/{index-DPky2leG.css → index-DIcDOunT.css} +1 -1
  41. package/dist/assets/{index.es-WXdI0L-F.js → index.es-B8wsP9dg.js} +1 -1
  42. package/dist/assets/{pluginParsers-DkiO-BBu.js → pluginParsers-D5PQwW_l.js} +1 -1
  43. package/dist/assets/{student-workspace-1yVTbWHC.js → student-workspace-C2tppsk6.js} +1 -1
  44. package/dist/assets/{vendor-charts-SrpBsvM3.js → vendor-charts-skggaP9D.js} +1 -1
  45. package/dist/assets/{vendor-icons-hc6MjYFv.js → vendor-icons-DGdjNlGa.js} +2 -2
  46. package/dist/assets/{vendor-konva-Dne0Z-WC.js → vendor-konva-BOuJWFuE.js} +1 -1
  47. package/dist/assets/{vendor-pdf-By0fofA0.js → vendor-pdf-DmaV9d9t.js} +3 -3
  48. package/dist/assets/{vendor-pptx-EjNUtdws.js → vendor-pptx-CpYklkz2.js} +4 -4
  49. package/dist/assets/{vendor-react-Kv_JATwr.js → vendor-react-DHoBZpn2.js} +2 -2
  50. package/dist/assets/{vendor-utils-aM7aYvPP.js → vendor-utils-BxOuk3id.js} +1 -1
  51. package/dist/env-validation.cjs +7 -1
  52. package/dist/index.html +5 -5
  53. package/dist/server.cjs +352 -51
  54. package/package.json +1 -1
  55. package/dist/assets/ActivityWorkspaceWidget-Dq4kjBS2.js +0 -1
  56. package/dist/assets/ComputerLabView-D9-Tk7yA.js +0 -1
  57. package/dist/assets/CourseManagement-DNSfyre-.js +0 -1
  58. package/dist/assets/LazyCourseware-BaZS8-i1.js +0 -2
  59. package/dist/assets/LazyWhiteboard-DGyln3JC.js +0 -2
  60. package/dist/assets/LessonEditorView-B5JXYyup.js +0 -1
  61. package/dist/assets/NotificationDetailModal-DbMMrIHQ.js +0 -1
  62. package/dist/assets/PluginView-CvIr-ANj.js +0 -77
  63. package/dist/assets/StudentAssignmentEvalPanel-DrfZT8Lr.js +0 -1
  64. package/dist/assets/StudentView-DKDhnJQx.js +0 -2
  65. package/dist/assets/TeacherView-CWDK3DOe.js +0 -2
  66. package/dist/assets/index-BBznBaN5.js +0 -131
@@ -1 +0,0 @@
1
- import{r as o,j as e}from"./vendor-react-Kv_JATwr.js";import{e as D}from"./index-BBznBaN5.js";import{$ as q,X as H,j as J,i as Q,B as V,o as X,y as _,w as G,U as K,b1 as Y,b0 as Z,b2 as ee,e as te,P as se}from"./vendor-icons-hc6MjYFv.js";import"./vendor-utils-aM7aYvPP.js";import"./vendor-pdf-By0fofA0.js";import"./vendor-motion-BFAPOs-b.js";import"./vendor-charts-SrpBsvM3.js";async function ie(n="all"){const a=await fetch(`/api/activities?role=${encodeURIComponent(n)}`,{headers:{Accept:"application/json"}});if(!a.ok)throw new Error(`Failed to load activities (${a.status})`);return(await a.json()).activities??[]}async function k(){const n=await fetch("/api/activities/running",{headers:{Accept:"application/json"}});if(!n.ok)throw new Error(`Failed to load running activities (${n.status})`);return(await n.json()).activities??[]}async function ne(n){const a=await fetch(`/api/activities/${encodeURIComponent(n)}/finish`,{method:"POST",headers:{"Content-Type":"application/json"}});if(!a.ok){const s=await a.json().catch(()=>({}));throw new Error(s.error||`Failed to finish activity (${a.status})`)}}async function ae(n){const a=await fetch(`/api/activities/${encodeURIComponent(n)}/pause`,{method:"POST",headers:{"Content-Type":"application/json"}});if(!a.ok){const s=await a.json().catch(()=>({}));throw new Error(s.error||`Failed to pause activity (${a.status})`)}}async function re(n){const a=await fetch(`/api/activities/${encodeURIComponent(n)}/resume`,{method:"POST",headers:{"Content-Type":"application/json"}});if(!a.ok){const s=await a.json().catch(()=>({}));throw new Error(s.error||`Failed to resume activity (${a.status})`)}}async function oe(n,a,s){const l=await fetch(`/api/activities/${encodeURIComponent(n)}/start`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({payload:a??{},actorId:s})}),c=await l.json();if(!l.ok||c.ok===!1)throw new Error(c.error||`Failed to start activity (${l.status})`);return c}const x={padding:"12px",color:"#e2e8f0",fontSize:"13px"},ce={HelpCircle:te,Vote:ee,BarChart3:Z,MessagesSquare:Y,Users:K,FileText:G,Trophy:_,CheckCircle2:X,BookOpen:V};function le({name:n,className:a}){const s=n&&ce[n]||se;return e.jsx(s,{size:18,className:a})}function de(n,a){if(!n)return a==="zh"?"进行中":"In progress";const s=Math.max(0,Math.floor((Date.now()-n)/1e3)),l=Math.floor(s/60),c=s%60;return a==="zh"?`${l} 分 ${c} 秒`:`${l}m ${c}s`}const ge=({role:n,actorId:a,lang:s="en",classroomId:l,mode:c="launcher"})=>{const[p,E]=o.useState([]),[A,j]=o.useState(!0),[b,$]=o.useState(null),[v,m]=o.useState({}),[h,w]=o.useState([]),[T,R]=o.useState(!0),[P,I]=o.useState(null),[y,u]=o.useState(null),[f,z]=o.useState(!1),[S,C]=o.useState(null),B=D(i=>i.setTeacherTab),F=o.useMemo(()=>{const i=new Map;for(const t of p){const r=t.category;i.has(r)||i.set(r,[]),i.get(r).push(t)}return Array.from(i.entries())},[p]);o.useEffect(()=>{if(c!=="launcher")return;let i=!1;return j(!0),ie(n).then(t=>{i||E(t)}).catch(t=>{i||$(t instanceof Error?t.message:String(t))}).finally(()=>{i||j(!1)}),()=>{i=!0}},[n,c]),o.useEffect(()=>{if(c!=="status")return;let i=!1;const t=async()=>{try{const d=await k();i||w(d)}catch(d){i||I(d instanceof Error?d.message:String(d))}finally{i||R(!1)}};t();const r=setInterval(t,5e3);return()=>{i=!0,clearInterval(r)}},[c]);const g=async i=>{if(y){z(!0),C(null);try{await i(y),w(await k())}catch(t){C(t instanceof Error?t.message:String(t))}finally{z(!1)}}},W=()=>g(ne),M=()=>g(ae),O=()=>g(re),L=()=>{u(null),B("live_class")};if(c==="status"){if(T)return e.jsx("div",{className:"bg-white border border-slate-200/80 rounded-2xl p-5 shadow-sm h-24 animate-pulse"});if(P||h.length===0)return null;const i=h.find(t=>t.id===y)||null;return e.jsxs("div",{className:"bg-white border border-slate-200/80 rounded-2xl p-5 shadow-sm",children:[e.jsxs("div",{className:"flex items-center justify-between mb-3",children:[e.jsxs("div",{className:"flex items-center gap-2 text-slate-800 font-extrabold",children:[e.jsx("span",{children:"🧩"}),e.jsx("span",{children:s==="zh"?"进行中的活动":"Activities in Progress"})]}),e.jsx("span",{className:"text-xs font-bold bg-indigo-50 text-indigo-700 px-2 py-0.5 rounded-full",children:h.length})]}),e.jsx("div",{className:"flex flex-col gap-2",children:h.map(t=>{const r=t.state==="running";return e.jsxs("button",{onClick:()=>u(t.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:[e.jsx(le,{name:t.icon,className:"text-indigo-600 shrink-0"}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("div",{className:"font-bold text-slate-800 truncate",children:t.name}),t.category&&e.jsx("div",{className:"text-xs text-slate-500 truncate",children:t.category})]}),e.jsxs("div",{className:"flex flex-col items-end gap-1 shrink-0",children:[e.jsx("span",{className:`text-xs font-bold px-2 py-0.5 rounded-full ${r?"bg-emerald-100 text-emerald-700":"bg-amber-100 text-amber-700"}`,children:r?s==="zh"?"进行中":"Running":s==="zh"?"已暂停":"Paused"}),e.jsxs("span",{className:"text-xs text-slate-400 flex items-center gap-1",children:[e.jsx(q,{size:10})," ",de(t.startedAt,s)]})]})]},t.id)})}),i&&e.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/30 p-4",onClick:()=>u(null),children:e.jsxs("div",{className:"bg-white rounded-2xl shadow-xl w-full max-w-sm p-5",onClick:t=>t.stopPropagation(),children:[e.jsxs("div",{className:"flex items-center justify-between mb-3",children:[e.jsx("h3",{className:"font-bold text-slate-800",children:i.name}),e.jsx("button",{onClick:()=>u(null),className:"text-slate-400 hover:text-slate-600","aria-label":"close",children:e.jsx(H,{size:18})})]}),e.jsxs("div",{className:"text-sm text-slate-500 mb-1",children:[s==="zh"?"状态":"Status",":"," ",i.state==="running"?s==="zh"?"进行中":"Running":s==="zh"?"已暂停":"Paused"]}),e.jsxs("div",{className:"text-sm text-slate-500 mb-4",children:[s==="zh"?"开始时间":"Started",":"," ",i.startedAt?new Date(i.startedAt).toLocaleString():"-"]}),S&&e.jsx("div",{className:"text-xs text-rose-600 mb-2",children:S}),e.jsxs("div",{className:"flex gap-2",children:[i.state==="running"?e.jsxs("button",{disabled:f,onClick:M,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:[e.jsx(J,{size:14})," ",s==="zh"?"暂停":"Pause"]}):e.jsxs("button",{disabled:f,onClick:O,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:[e.jsx(Q,{size:14})," ",s==="zh"?"恢复":"Resume"]}),e.jsx("button",{disabled:f,onClick:W,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:f?s==="zh"?"处理中…":"Working…":s==="zh"?"结束":"End"})]}),e.jsx("button",{onClick:L,className:"w-full mt-2 bg-slate-100 hover:bg-slate-200 text-slate-700 rounded-lg py-2 text-sm font-bold",children:s==="zh"?"进入课堂":"Enter Classroom"})]})})]})}const U=async i=>{m(t=>({...t,[i.id]:s==="zh"?"启动中…":"Starting…"}));try{const t=await oe(i.id,{classroomId:l,role:n},a);m(r=>({...r,[i.id]:t.dispatched?s==="zh"?"已启动 ✓":"Started ✓":s==="zh"?"已通知 ✓":"Notified ✓"}))}catch(t){m(r=>({...r,[i.id]:t instanceof Error?t.message:String(t)}))}};if(A)return e.jsx("div",{style:x,children:s==="zh"?"加载活动中…":"Loading activities…"});if(b)return e.jsxs("div",{style:x,children:[e.jsxs("div",{style:{fontWeight:600,marginBottom:6},children:["🧩 ",s==="zh"?"活动中心":"Activity Center"]}),e.jsx("div",{style:{opacity:.7},children:b})]});const N=n==="teacher"?s==="zh"?"活动中心(教师)":"Activity Center":s==="zh"?"活动(学生)":"Activities";return p.length===0?e.jsxs("div",{style:x,children:[e.jsxs("div",{style:{fontWeight:600,marginBottom:6},children:["🧩 ",N]}),e.jsx("div",{style:{opacity:.7},children:s==="zh"?"暂无可用活动。":"No activities available."})]}):e.jsxs("div",{style:x,children:[e.jsxs("div",{style:{fontWeight:600,marginBottom:8},children:["🧩 ",N]}),F.map(([i,t])=>e.jsxs("div",{style:{marginBottom:10},children:[e.jsx("div",{style:{opacity:.6,fontSize:12,textTransform:"uppercase",marginBottom:4},children:i}),e.jsx("div",{style:{display:"flex",flexWrap:"wrap",gap:8},children:t.map(r=>e.jsxs("div",{style:{border:"1px solid #334155",borderRadius:8,padding:"8px 10px",minWidth:150,background:"#0f172a"},children:[e.jsxs("div",{style:{fontWeight:600},children:[r.icon?`${r.icon} `:"▫️ ",r.name]}),r.description&&e.jsx("div",{style:{opacity:.7,fontSize:12,margin:"2px 0 6px"},children:r.description}),e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6},children:[e.jsx("button",{onClick:()=>U(r),style:{cursor:"pointer",background:n==="teacher"?"#2563eb":"#0ea5e9",color:"#fff",border:"none",borderRadius:6,padding:"4px 10px",fontSize:12},children:n==="teacher"?s==="zh"?"启动":"Start":s==="zh"?"参与":"Open"}),v[r.id]&&e.jsx("span",{style:{fontSize:12,opacity:.85},children:v[r.id]})]}),e.jsx("div",{style:{opacity:.5,fontSize:12,marginTop:4},children:r.provider==="official"?"official":r.provider})]},r.id))})]},i))]})};export{ge as ActivityWorkspaceWidget};
@@ -1 +0,0 @@
1
- import{r as l,j as e}from"./vendor-react-Kv_JATwr.js";import{_ as Ae,E as M,c as Te}from"./index-BBznBaN5.js";import{am as fe,ak as Le,bu as J,bt as Pe,ac as Me,X as te,V as Re,a9 as be,U as je,z as Oe,ad as Fe,c as ye,ae as Ue,C as Be,Z as Je}from"./vendor-icons-hc6MjYFv.js";import"./vendor-utils-aM7aYvPP.js";import"./vendor-pdf-By0fofA0.js";import"./vendor-motion-BFAPOs-b.js";import"./vendor-charts-SrpBsvM3.js";function qe({computerLabs:h,onRefresh:y,lang:n,classes:b}){const[q,w]=l.useState(!1),[R,V]=l.useState(null),[G,H]=l.useState(""),[N,K]=l.useState(5),[S,Y]=l.useState(6),[O,p]=l.useState(""),[se,ae]=l.useState(!1),ne="openlearn_computer_lab_selected",X="openlearn_computer_lab_selected_class",[A,re]=l.useState(()=>{try{const t=localStorage.getItem(ne);if(t&&h.some(s=>s.id===t))return t}catch{}return h.length>0?h[0].id:null}),o=h.find(t=>t.id===(A||h[0]?.id)),[ve,ie]=l.useState([]),[d,F]=l.useState(()=>{const t=o??h[0];if(!t)return null;const s=b||[];try{const a=localStorage.getItem(X),i=a?s.find(c=>c.id===a):void 0;if(i&&i.lab_id===t.id)return i.id}catch{}const r=s.find(a=>a.lab_id===t.id);return r?r.id:null}),[E,oe]=l.useState([]),[g,C]=l.useState([]),[le,de]=l.useState(!1),[Z,ce]=l.useState(!1),[xe,Q]=l.useState(""),[W,k]=l.useState(!1),[f,v]=l.useState(null),[we,$]=l.useState(null),[x,T]=l.useState(null),[I,L]=l.useState(null);l.useEffect(()=>{b&&b.length>0?ie(b):fetch("/api/classes?pageSize=all").then(t=>t.ok?t.json():{data:[]}).then(t=>{const s=Ae(t);(s.length>0||Array.isArray(t?.data))&&ie(s)}).catch(t=>console.error("Failed to fetch classes in ComputerLabManager:",t))},[b]);const _=b&&b.length>0?b:ve,ue=l.useMemo(()=>o?_.filter(t=>t.lab_id===o.id):[],[_,o]);l.useEffect(()=>{if(!o)return;if(d){_.find(s=>s.id===d);return}try{const s=localStorage.getItem(X),r=s?_.find(a=>a.id===s):void 0;if(r&&r.lab_id===o.id){F(r.id);return}}catch{}const t=_.find(s=>s.lab_id===o.id);t&&F(t.id)},[o?.id,_]),l.useEffect(()=>{try{A&&localStorage.setItem(ne,A)}catch{}},[A]),l.useEffect(()=>{try{d&&localStorage.setItem(X,d)}catch{}},[d]);const me=l.useCallback(async(t,s)=>{de(!0),p(""),v(null),$(null);try{const[r,a]=await Promise.all([fetch(`/api/classes/${t}/seats`),fetch(`/api/classes/${t}/students`)]);let i=[];if(a.ok&&(i=await a.json(),oe(i)),r.ok){const u=(await r.json()).seats||[],D=new Map(i.map(j=>[j.id,j])),U=u.map(j=>{const B=D.get(j.student_id);return{...j,student_name:j.student_name||B?.name||"",student_number:j.student_number||B?.student_number||""}});C(U)}k(!1)}catch(r){console.error("Error loading seating:",r),p(r.message||"Failed to load class seating data")}finally{de(!1)}},[]);l.useEffect(()=>{d?me(d,o?.id):(oe([]),C([]),k(!1),v(null),$(null))},[d,me]);const ee=l.useMemo(()=>{const t=new Map;for(const s of g)t.set(`${s.row_idx}_${s.col_idx}`,s);return t},[g]),he=l.useMemo(()=>new Set(g.map(t=>t.student_id)),[g]),z=l.useMemo(()=>E.filter(t=>!he.has(t.id)).sort((t,s)=>String(t.student_number??t.name??"").localeCompare(String(s.student_number??s.name??""),"zh-Hans-CN",{numeric:!0})),[E,he]),pe=(t,s,r)=>{const a=g.find(u=>u.row_idx===s.row&&u.col_idx===s.col),i=!!r&&!!a&&a.student_id!==t.id;let c=g.filter(u=>!(u.row_idx===s.row&&u.col_idx===s.col)&&u.student_id!==t.id);i&&r&&(c=c.filter(u=>!(u.row_idx===r.row&&u.col_idx===r.col)),c=[...c,{...a,row_idx:r.row,col_idx:r.col}]),c=[...c,{student_id:t.id,row_idx:s.row,col_idx:s.col,student_name:t.name,student_number:t.student_number}],C(c),k(!0)},Ne=(t,s)=>{if(!d||!o)return;const r=ee.get(`${t}_${s}`);if(f){pe(f,{row:t,col:s},we),v(null),$(null);return}if(r){const a=E.find(i=>i.id===r.student_id)||{id:r.student_id,name:r.student_name||"Student",student_number:r.student_number||""};v(a),$({row:t,col:s})}},Se=(t,s,r)=>{t.stopPropagation(),C(a=>a.filter(i=>!(i.row_idx===s&&i.col_idx===r))),k(!0)},_e=()=>{if(!o||z.length===0)return;const t=[];for(let a=0;a<o.rows;a++)for(let i=0;i<o.cols;i++)ee.has(`${a}_${i}`)||t.push([a,i]);if(t.length===0)return;const r=z.slice(0,t.length).map((a,i)=>{const[c,u]=t[i];return{student_id:a.id,row_idx:c,col_idx:u,student_name:a.name,student_number:a.student_number}});C(a=>[...a,...r]),k(!0),v(null)},ze=()=>{g.length!==0&&confirm(n==="zh"?"确定要清空当前班级在该机房的所有机位排座吗?":"Are you sure you want to clear all seat assignments for this class in this lab?")&&(C([]),k(!0),v(null))},Ce=async()=>{if(!(!d||!o))try{ce(!0),p(""),Q("");const t=await fetch(`/api/classes/${d}/seats`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({lab_id:o.id,seats:g.map(s=>({student_id:s.student_id,row_idx:s.row_idx,col_idx:s.col_idx}))})});if(t.ok)k(!1),Q(n==="zh"?"统一机房排座已成功持久化至系统 student_seats 数据表!":"Seating assignments saved to system student_seats table successfully!"),y(),setTimeout(()=>Q(""),4e3);else{const s=await t.json();p(s.error||"Failed to save seats")}}catch(t){p(t.message||"Network error saving seats")}finally{ce(!1)}},ke=()=>{H(""),K(5),Y(6),p(""),V(null),w(!0)},$e=t=>{H(t.room_number),K(t.rows),Y(t.cols),p(""),V(t.id),w(!0)},Ee=async t=>{if(t.preventDefault(),!G.trim()){p(n==="zh"?"请输入机房编号/名称":"Please enter room name or number");return}if(N<=0||N>15){p(n==="zh"?"行数应在 1 至 15 之间":"Rows should be between 1 and 15");return}if(S<=0||S>15){p(n==="zh"?"列数应在 1 至 15 之间":"Columns should be between 1 and 15");return}try{ae(!0),p("");const s=R?`/api/labs/${R}`:"/api/labs",a=await fetch(s,{method:R?"PUT":"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({room_number:G.trim(),rows:N,cols:S})});if(a.ok)y(),w(!1),V(null);else{const i=await a.json();p(i.error||"Server error saving lab")}}catch(s){p(s.message||"Network error")}finally{ae(!1)}},De=async t=>{if(confirm(n==="zh"?"确定要删除该机房吗?删除后对应的座位分配也会被重置。":"Are you sure you want to delete this lab? Seat mappings will be cleared."))try{(await fetch(`/api/labs/${t}`,{method:"DELETE"})).ok&&(y(),A===t&&re(null))}catch(s){console.error(s)}};return e.jsxs("div",{className:"flex-1 flex flex-col h-full overflow-hidden",id:"lab_manager_root",children:[e.jsxs("div",{className:"flex flex-col md:flex-row md:items-center justify-between pb-4 border-b border-gray-200 gap-4 shrink-0",children:[e.jsxs("div",{children:[e.jsxs("h2",{className:"text-xl font-bold text-gray-800 flex items-center gap-2",children:[e.jsx(fe,{className:"text-indigo-600",size:24}),n==="zh"?"统一机房座位管理":"Unified Computer Lab Seating"]}),e.jsx("p",{className:"text-xs text-gray-500 mt-1",children:n==="zh"?"维护物理机房规格及其行列排列规则,并直接根据班级信息读取并编排系统中已存的统一机房座位数据(student_seats 表)。":"Maintain physical lab layouts and manage unified student seat allocations directly synced with existing system data tables."})]}),e.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[e.jsxs("button",{onClick:ke,className:"bg-indigo-600 hover:bg-indigo-700 text-white px-4 py-2 rounded-xl text-xs font-semibold flex items-center gap-1.5 shadow-sm transition-all focus:ring-2 focus:ring-indigo-500 cursor-pointer",children:[e.jsx(Le,{size:14}),n==="zh"?"新增机房规则":"New Lab Config"]}),e.jsx(M,{slot:"computer_lab.toolbar.action",slotProps:{activeLab:o,computerLabs:h,onRefresh:y,lang:n}})]})]}),e.jsxs("div",{className:"flex-1 min-h-0 grid grid-cols-1 lg:grid-cols-12 gap-6 pt-5 overflow-hidden",children:[e.jsxs("div",{className:"lg:col-span-4 flex flex-col min-h-0 bg-white border border-gray-200 rounded-2xl shadow-xs overflow-hidden",children:[e.jsxs("div",{className:"p-4 border-b border-gray-100 bg-gray-50 flex justify-between items-center shrink-0",children:[e.jsx("span",{className:"text-xs font-bold text-gray-700 uppercase tracking-wider block",children:n==="zh"?"机房列表":"Computer Labs"}),e.jsx("span",{className:"bg-gray-200 text-gray-700 font-bold px-2 py-0.5 rounded-full text-xs",children:h.length})]}),e.jsx("div",{className:"flex-1 overflow-y-auto p-4 space-y-3",children:h.length===0?e.jsxs("div",{className:"flex flex-col items-center justify-center p-8 text-center text-gray-400 h-full",children:[e.jsx(fe,{size:40,className:"mb-2 opacity-30"}),e.jsx("p",{className:"text-xs font-medium",children:n==="zh"?"暂无机房编号规则":"No Computer Labs configured yet."}),e.jsx("p",{className:"text-xs text-gray-500 mt-1",children:n==="zh"?"点击右上角按钮添加首个机房规格。":"Click the button above to add your first computer room."})]}):h.map(t=>{const s=o?.id===t.id,r=_.filter(a=>a.lab_id===t.id);return e.jsxs("div",{onClick:()=>{re(t.id),w(!1)},className:`p-3 rounded-xl border transition-all cursor-pointer flex flex-col gap-2 group ${s?"border-indigo-300 bg-indigo-50/60 shadow-xs ring-1 ring-indigo-200":"border-gray-150 hover:border-gray-300 hover:bg-gray-50"}`,children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:`p-2 rounded-lg ${s?"bg-indigo-600 text-white":"bg-gray-100 text-gray-500 group-hover:bg-gray-200"}`,children:e.jsx(J,{size:16})}),e.jsxs("div",{children:[e.jsx("div",{className:"text-sm font-bold text-gray-800 flex items-center gap-1.5",children:t.room_number}),e.jsxs("div",{className:"text-xs text-gray-400 font-mono mt-0.5",children:[t.rows," ",n==="zh"?"行":"Rows"," × ",t.cols," ",n==="zh"?"列":"Cols",e.jsx("span",{className:"mx-1.5",children:"•"}),t.rows*t.cols," ",n==="zh"?"个机位":"Seats"]})]})]}),e.jsxs("div",{className:"flex items-center gap-1.5 opacity-0 group-hover:opacity-100 focus-within:opacity-100 transition-opacity",children:[e.jsx("button",{onClick:a=>{a.stopPropagation(),$e(t)},className:"p-1 text-gray-500 hover:text-indigo-600 hover:bg-white rounded transition-colors",title:n==="zh"?"编辑规则":"Edit Rule",children:e.jsx(Pe,{size:13})}),e.jsx("button",{onClick:a=>{a.stopPropagation(),De(t.id)},className:"p-1 text-gray-500 hover:text-rose-600 hover:bg-white rounded transition-colors",title:n==="zh"?"删除机房间":"Delete Lab",children:e.jsx(Me,{size:14})})]})]}),r.length>0&&e.jsxs("div",{className:"flex items-center gap-1 flex-wrap pt-1 border-t border-gray-100/80",children:[e.jsx("span",{className:"text-[10px] text-gray-400 font-medium",children:n==="zh"?"绑定班级:":"Bound:"}),r.map(a=>e.jsx("span",{className:"text-[10px] font-semibold bg-indigo-100/70 text-indigo-700 px-1.5 py-0.5 rounded-md",children:a.name},a.id))]})]},t.id)})})]}),e.jsx("div",{className:"lg:col-span-8 flex flex-col min-h-0 bg-white border border-gray-200 rounded-2xl shadow-xs overflow-hidden",children:q?e.jsxs("form",{onSubmit:Ee,className:"flex-1 flex flex-col min-h-0",children:[e.jsxs("div",{className:"p-4 border-b border-gray-100 bg-gray-50 font-bold text-xs text-gray-700 uppercase tracking-wider shrink-0 flex items-center justify-between",children:[e.jsx("span",{children:R?n==="zh"?"编辑机房规则":"Edit Lab Seating":n==="zh"?"创建全新上机机房":"Create Computer Lab"}),e.jsx("button",{type:"button",onClick:()=>w(!1),className:"text-gray-400 hover:text-gray-600",children:e.jsx(te,{size:16})})]}),e.jsxs("div",{className:"flex-1 overflow-y-auto p-6 space-y-4",children:[O&&e.jsxs("div",{className:"p-3 bg-red-50 border border-red-200 text-red-700 text-xs rounded-xl flex items-center gap-1.5",children:[e.jsx(Re,{size:14}),e.jsx("span",{children:O})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("label",{className:"block text-xs font-bold text-gray-500 uppercase tracking-wide",children:n==="zh"?"机房编号 / 场所名称 *":"Lab Name / Number *"}),e.jsx("input",{type:"text",value:G,onChange:t=>H(t.target.value),placeholder:n==="zh"?"例如:305综合机房、软创中心、Lab A":"e.g. Lab 404, Software Sandbox, Suite C",className:"w-full text-xs p-2.5 border border-gray-300 focus:border-indigo-500 focus:outline-none focus:ring-1 focus:ring-indigo-500 rounded-xl mt-1.5",maxLength:32,required:!0})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsx("label",{className:"block text-xs font-bold text-gray-500 uppercase tracking-wide",children:n==="zh"?"排列行数 (Rows) *":"Rows Direction *"}),e.jsx("input",{type:"number",value:N,onChange:t=>K(Math.max(1,parseInt(t.target.value)||1)),min:1,max:15,className:"w-full text-xs p-2.5 border border-gray-300 focus:border-indigo-500 focus:outline-none focus:ring-1 focus:ring-indigo-500 rounded-xl mt-1.5",required:!0}),e.jsx("span",{className:"text-xs text-gray-400 block mt-0.5",children:n==="zh"?"上下方向机位数 (最大15行)":"Horizontal sets count (Max 15)"})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("label",{className:"block text-xs font-bold text-gray-500 uppercase tracking-wide",children:n==="zh"?"排列列数 (Columns) *":"Columns Direction *"}),e.jsx("input",{type:"number",value:S,onChange:t=>Y(Math.max(1,parseInt(t.target.value)||1)),min:1,max:15,className:"w-full text-xs p-2.5 border border-gray-300 focus:border-indigo-500 focus:outline-none focus:ring-1 focus:ring-indigo-500 rounded-xl mt-1.5",required:!0}),e.jsx("span",{className:"text-xs text-gray-400 block mt-0.5",children:n==="zh"?"左右方向机位数 (最大15列)":"Vertical sets count (Max 15)"})]})]}),e.jsxs("div",{className:"border border-dashed border-gray-200 bg-gray-50/50 p-4 rounded-xl",children:[e.jsx("span",{className:"text-xs font-bold text-gray-400 uppercase tracking-wider block mb-2",children:n==="zh"?"布局网格缩略结构":"Layout Aspect Schema"}),e.jsxs("div",{className:"flex flex-col gap-1 items-center justify-center p-3 bg-white rounded-lg border border-gray-100 min-h-[120px]",children:[e.jsxs("div",{className:"flex flex-col gap-1",children:[Array.from({length:Math.min(N,6)}).map((t,s)=>e.jsxs("div",{className:"flex gap-1 justify-center",children:[Array.from({length:Math.min(S,8)}).map((r,a)=>e.jsx("div",{className:"w-4 h-4 rounded bg-indigo-100 border border-indigo-200 shrink-0"},a)),S>8&&e.jsx("div",{className:"w-4 text-xs text-gray-400 flex items-center justify-center",children:"..."})]},s)),N>6&&e.jsx("div",{className:"text-xs text-center text-gray-400 mt-1",children:"..."})]}),e.jsxs("span",{className:"text-xs text-gray-450 mt-3 font-medium",children:["配置容量:",N," × ",S," = ",N*S," 座位"]})]})]})]}),e.jsxs("div",{className:"p-4 border-t border-gray-100 shrink-0 flex items-center justify-end gap-2 bg-gray-50",children:[e.jsx("button",{type:"button",onClick:()=>w(!1),className:"px-4 py-2 text-xs font-semibold text-gray-500 hover:text-gray-700 bg-white hover:bg-gray-100 border border-gray-200 rounded-xl transition-all cursor-pointer",children:n==="zh"?"取消":"Cancel"}),e.jsxs("button",{type:"submit",disabled:se,className:"px-4 py-2 text-xs font-bold text-white bg-indigo-600 hover:bg-indigo-700 disabled:opacity-50 rounded-xl flex items-center gap-1 shadow-sm transition-all cursor-pointer",children:[e.jsx(be,{size:14}),e.jsx("span",{children:se?n==="zh"?"提交中...":"Saving...":n==="zh"?"提交保存":"Save Config"})]})]})]}):e.jsxs("div",{className:"flex-1 flex flex-col min-h-0",children:[e.jsxs("div",{className:"p-3 border-b border-gray-100 bg-gray-50 flex flex-wrap items-center justify-between gap-3 shrink-0",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("span",{className:"text-xs font-bold text-gray-700 uppercase tracking-wider flex items-center gap-1.5",children:[e.jsx(je,{size:14,className:"text-indigo-600"}),n==="zh"?"班级机位联动:":"Class Seating Link:"]}),e.jsxs("select",{value:d||"",onChange:t=>F(t.target.value?t.target.value:null),className:"text-xs font-semibold bg-white border border-gray-300 rounded-lg px-2.5 py-1.5 text-gray-700 focus:outline-none focus:ring-1 focus:ring-indigo-500 cursor-pointer shadow-2xs",children:[e.jsx("option",{value:"",children:n==="zh"?"📐 物理规格总览 (无班级)":"📐 Physical Blueprint (No Class)"}),_.map(t=>{const s=t.lab_id===o?.id;return e.jsxs("option",{value:t.id,children:[t.name," ",s?n==="zh"?"★ 已绑定此机房":"★ Bound":""]},t.id)})]})]}),d&&o&&e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("button",{type:"button",onClick:_e,disabled:z.length===0,className:"px-2.5 py-1.5 text-xs font-semibold bg-indigo-50 hover:bg-indigo-100 text-indigo-700 border border-indigo-200 rounded-lg flex items-center gap-1 transition-colors cursor-pointer disabled:opacity-40 disabled:cursor-not-allowed",title:n==="zh"?"将未排座学生按学号依次填入空闲机位":"Auto assign unplaced students",children:[e.jsx(Oe,{size:13}),e.jsx("span",{children:n==="zh"?"一键排座":"Auto Fill"})]}),e.jsxs("button",{type:"button",onClick:ze,disabled:g.length===0,className:"px-2.5 py-1.5 text-xs font-semibold bg-gray-100 hover:bg-rose-50 text-gray-600 hover:text-rose-600 border border-gray-200 rounded-lg flex items-center gap-1 transition-colors cursor-pointer disabled:opacity-40 disabled:cursor-not-allowed",title:n==="zh"?"清空当前班级排座":"Clear Seating",children:[e.jsx(Fe,{size:13}),e.jsx("span",{children:n==="zh"?"清空":"Clear"})]}),e.jsxs("button",{type:"button",onClick:Ce,disabled:Z||!W&&!o,className:`px-3 py-1.5 text-xs font-bold rounded-lg flex items-center gap-1.5 shadow-xs transition-all cursor-pointer ${W?"bg-emerald-600 hover:bg-emerald-700 text-white animate-pulse":"bg-indigo-600 hover:bg-indigo-700 text-white disabled:opacity-60 disabled:cursor-not-allowed"}`,children:[Z?e.jsx(ye,{size:13,className:"animate-spin"}):e.jsx(Ue,{size:13}),e.jsx("span",{children:Z?n==="zh"?"保存中...":"Saving...":W?n==="zh"?"保存排座 (已修改)":"Save (Modified)":n==="zh"?"已保存":"Saved"})]}),e.jsx(M,{slot:"computer_lab.seating.toolbar",slotProps:{labId:o.id,classId:d,assignedSeats:g,setAssignedSeats:C,lang:n}})]})]}),xe&&e.jsxs("div",{className:"bg-emerald-50 border-b border-emerald-200 text-emerald-800 text-xs px-4 py-2 flex items-center gap-1.5 animate-fadeIn",children:[e.jsx(be,{size:14,className:"text-emerald-600 shrink-0"}),e.jsx("span",{className:"font-medium",children:xe})]}),O&&e.jsxs("div",{className:"bg-red-50 border-b border-red-200 text-red-700 text-xs px-4 py-2 flex items-center gap-1.5",children:[e.jsx(Be,{size:14,className:"text-red-500 shrink-0"}),e.jsx("span",{children:O})]}),o?e.jsxs("div",{className:"flex-1 flex flex-col min-h-0 bg-slate-950 text-white overflow-hidden relative",children:[e.jsx("div",{className:"py-2.5 flex justify-center shrink-0 border-b border-slate-900 bg-slate-950/80 backdrop-blur-xs z-10",children:e.jsx("div",{className:"w-56 bg-slate-900 border border-slate-700 py-1 rounded text-center text-xs font-bold text-slate-300 uppercase tracking-widest select-none shadow-sm flex items-center justify-center gap-1.5",children:e.jsxs("span",{children:["📽️ ",n==="zh"?"讲台 / 教师主荧幕":"Classroom Stage / Screen"]})})}),e.jsx("div",{className:"flex-1 overflow-auto p-4 flex flex-col items-center",children:le?e.jsxs("div",{className:"flex flex-col items-center justify-center h-48 gap-2 text-slate-400",children:[e.jsx(ye,{size:24,className:"animate-spin text-indigo-400"}),e.jsx("span",{className:"text-xs",children:n==="zh"?"正在读取统一机房座位数据...":"Loading lab seating data..."})]}):e.jsx("div",{className:"flex flex-col gap-2.5 py-2 max-w-full",children:Array.from({length:o.rows}).map((t,s)=>e.jsxs("div",{className:"flex gap-2.5 justify-center items-center",children:[e.jsxs("span",{className:"text-xs font-bold font-mono text-slate-500 w-6 text-right select-none pr-0.5",children:["R",s+1]}),Array.from({length:o.cols}).map((r,a)=>{const i=ee.get(`${s}_${a}`),c=!!i,u=f&&(!c||i.student_id!==f.id),D=!!x?.from&&x.from.row===s&&x.from.col===a,U=!!x&&!!I&&I.row===s&&I.col===a&&!D,j=U&&c&&x?.type==="seat"&&i.student_id!==x.studentId,B=U&&(!c||x?.type==="pool");return e.jsx("div",{"data-seat-id":`${s}_${a}`,onClick:()=>Ne(s,a),draggable:!!d&&c,onDragStart:m=>{!d||!i||(T({type:"seat",studentId:i.student_id,from:{row:s,col:a}}),m.dataTransfer.setData("text/plain",JSON.stringify({type:"seat",studentId:i.student_id,from:{row:s,col:a}})),m.dataTransfer.effectAllowed="move")},onDragEnd:()=>{T(null),L(null)},onDragOver:m=>{!x||D||(m.preventDefault(),m.dataTransfer.dropEffect="move",L({row:s,col:a}))},onDragLeave:()=>{L(m=>m&&m.row===s&&m.col===a?null:m)},onDrop:m=>{if(m.preventDefault(),x&&!D){const ge=x.type==="pool"?z.find(P=>P.id===x.studentId)||E.find(P=>P.id===x.studentId):E.find(P=>P.id===x.studentId);ge&&(pe(ge,{row:s,col:a},x.from),v(null),$(null))}T(null),L(null)},className:`group relative rounded-xl flex flex-col items-center justify-center transition-all select-none shadow-sm ${d&&c?"cursor-grab":"cursor-pointer"} ${d?"w-20 h-14":"w-11 h-11"} ${c?"bg-slate-850 border border-indigo-500/70 hover:border-indigo-400 shadow-indigo-950/50":u?"bg-indigo-950/40 border border-dashed border-indigo-400 hover:bg-indigo-900/50 ring-1 ring-indigo-400/50 animate-pulse":"bg-slate-900 border border-slate-800 hover:border-slate-700 hover:bg-slate-850"}${j?" ring-2 ring-amber-400 border-amber-400 bg-amber-950/40":""}${B&&!j?" ring-2 ring-emerald-400 border-emerald-400 bg-emerald-950/40":""}${D?" opacity-40":""}`,children:c?e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"w-full h-full p-1.5 flex flex-col justify-between items-center text-center",children:[e.jsxs("div",{className:"flex items-center justify-between w-full px-0.5",children:[e.jsxs("span",{className:"text-[10px] font-mono text-indigo-300/80",children:[s+1,"-",a+1]}),d&&e.jsx("button",{type:"button",onClick:m=>Se(m,s,a),className:"opacity-0 group-hover:opacity-100 text-slate-400 hover:text-rose-400 p-0.5 rounded transition-opacity",title:n==="zh"?"移出此座位":"Unseat student",children:e.jsx(te,{size:11})})]}),e.jsx("div",{className:"font-bold text-xs text-white truncate max-w-[70px] leading-tight",children:i.student_name||"Student"}),e.jsx("div",{className:"text-[9px] font-mono text-slate-400 truncate max-w-[70px]",children:i.student_number||`ID:${i.student_id.slice(-4)}`}),e.jsx("div",{className:"w-full min-w-0",onClick:m=>m.stopPropagation(),children:e.jsx(M,{slot:"computer_lab.seat.overlay",slotProps:{labId:o.id,row:s,col:a,seat:i,isOccupied:!0}})})]}),e.jsxs("div",{className:"absolute bottom-16 bg-slate-900 text-white text-xs rounded-lg px-2.5 py-1.5 hidden group-hover:block whitespace-nowrap z-30 font-sans border border-indigo-700 shadow-2xl pointer-events-none",children:[e.jsx("div",{className:"font-bold text-indigo-300",children:i.student_name}),e.jsxs("div",{className:"text-[10px] text-slate-400 font-mono",children:[n==="zh"?"学号:":"No: ",i.student_number||i.student_id]}),e.jsx("div",{className:"text-[10px] text-slate-300 mt-0.5",children:n==="zh"?`第 ${s+1} 排,第 ${a+1} 列`:`Row ${s+1}, Col ${a+1}`})]})]}):e.jsxs(e.Fragment,{children:[e.jsx(J,{size:d?14:15,className:u?"text-indigo-400 animate-bounce":"text-slate-600 opacity-60"}),e.jsxs("span",{className:"text-[10px] font-mono text-slate-500 mt-0.5",children:[s+1,"-",a+1]}),e.jsx("div",{className:"absolute bottom-12 bg-slate-900 text-white text-xs rounded px-2 py-1 hidden group-hover:block whitespace-nowrap z-30 font-sans border border-slate-700 shadow-xl pointer-events-none",children:f?n==="zh"?`点击安排 [${f.name}] 到第 ${s+1} 排第 ${a+1} 列`:`Place [${f.name}] here`:n==="zh"?`第 ${s+1} 排第 ${a+1} 列 (空闲)`:`Row ${s+1} / Column ${a+1} (Empty)`})]})},a)})]},s))})}),d&&o&&!le&&e.jsx("div",{className:"shrink-0 px-4 pb-2",children:e.jsx(M,{slot:"computer_lab.seating.sidebar",slotProps:{labId:o.id,classId:d,assignedSeats:g,unassignedStudents:z}})}),d?e.jsxs("div",{className:"border-t border-slate-900 bg-slate-900/90 p-3 shrink-0 flex flex-col gap-2",children:[e.jsxs("div",{className:"flex items-center justify-between text-xs",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("span",{className:"font-bold text-slate-300 flex items-center gap-1.5",children:[e.jsx(je,{size:13,className:"text-indigo-400"}),n==="zh"?"待排座学生池:":"Unassigned Students Pool:"]}),e.jsxs("span",{className:"text-[11px] font-mono text-slate-400",children:[z.length," ",n==="zh"?"人未排":"unplaced"," / ",E.length," ",n==="zh"?"人总计":"total"]}),f&&e.jsxs("span",{className:"bg-indigo-900/80 text-indigo-300 border border-indigo-700 text-[11px] px-2 py-0.5 rounded-full flex items-center gap-1 animate-pulse",children:[e.jsx("span",{children:n==="zh"?`当前选择: ${f.name} (点击上方空位落座)`:`Selected: ${f.name} (click empty seat)`}),e.jsx("button",{type:"button",onClick:()=>{v(null),$(null)},className:"hover:text-white",children:e.jsx(te,{size:10})})]})]}),e.jsxs("div",{className:"text-[11px] font-mono text-slate-400",children:[n==="zh"?"机房已占:":"Occupied: ",e.jsx("span",{className:"text-indigo-400 font-bold",children:g.length})," /"," ",o.rows*o.cols]})]}),z.length===0?e.jsxs("div",{className:"text-xs text-slate-500 py-1 italic flex items-center gap-1",children:[e.jsx(Je,{size:13,className:"text-emerald-400"}),e.jsx("span",{children:n==="zh"?"当前班级全部学生均已成功分配机位!":"All students in this class have been assigned seats!"})]}):e.jsx("div",{className:"flex items-center gap-1.5 overflow-x-auto py-1 max-h-16 pr-2",children:z.map(t=>{const s=f?.id===t.id,r=x?.type==="pool"&&x.studentId===t.id;return e.jsxs("div",{className:"shrink-0 flex items-center gap-1","data-unassigned-id":t.id,children:[e.jsxs("button",{type:"button",draggable:!0,onDragStart:a=>{T({type:"pool",studentId:t.id}),a.dataTransfer.setData("text/plain",JSON.stringify({type:"pool",studentId:t.id})),a.dataTransfer.effectAllowed="move"},onDragEnd:()=>{T(null),L(null)},onClick:()=>{v(s?null:t),$(null)},className:`px-2.5 py-1 rounded-lg text-xs font-medium border transition-all cursor-grab active:cursor-grabbing flex items-center gap-1.5 ${s?"bg-indigo-600 text-white border-indigo-400 ring-2 ring-indigo-400/50 shadow-md":"bg-slate-800 text-slate-300 border-slate-700 hover:border-indigo-500 hover:bg-slate-750"}${r?" opacity-40":""}`,children:[e.jsx("span",{children:t.name}),t.student_number&&e.jsx("span",{className:"text-[10px] font-mono text-slate-400",children:t.student_number})]}),e.jsx(M,{slot:"computer_lab.unassigned.item",slotProps:{student:t,classId:d,labId:o?.id}})]},t.id)})})]}):e.jsxs("div",{className:"border-t border-slate-900 bg-slate-900/60 p-3 shrink-0 flex items-center justify-between text-xs text-slate-400 select-none",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx("div",{className:"w-3.5 h-3.5 rounded bg-slate-800 border border-slate-700 flex items-center justify-center p-0.5",children:e.jsx(J,{size:10,className:"text-indigo-400 opacity-60"})}),e.jsx("span",{children:n==="zh"?"标准上机终端":"Console Terminals"})]}),ue.length>0&&e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx("span",{className:"text-slate-500",children:n==="zh"?"已绑定班级:":"Bound Classes:"}),ue.map(t=>e.jsx("button",{type:"button",onClick:()=>F(t.id),className:"text-indigo-400 hover:text-indigo-300 underline font-semibold text-xs cursor-pointer ml-1",children:t.name},t.id))]})]}),e.jsxs("div",{className:"font-mono text-slate-500",children:[n==="zh"?"总行数:":"Rows: ",e.jsx("span",{className:"text-indigo-400 font-bold",children:o.rows})," |",n==="zh"?" 总列数:":" Columns: ",e.jsx("span",{className:"text-indigo-400 font-bold",children:o.cols})," |",n==="zh"?" 配置席位:":" Total: ",e.jsx("span",{className:"text-white font-bold",children:o.rows*o.cols})]})]})]}):e.jsxs("div",{className:"flex-1 flex flex-col items-center justify-center text-center p-8 text-gray-400 h-full",children:[e.jsx(J,{size:48,className:"opacity-20 mb-3"}),e.jsx("p",{className:"text-xs font-medium",children:n==="zh"?"请选择一个机房以预览其座位图":"Please select a lab config to preview details."})]})]})})]})]})}function Qe(h={}){const y=Te(),n=h.computerLabs??y?.computerLabs??[],b=h.onRefresh??y?.fetchLabs??(async()=>{}),q=h.lang??y?.lang??"zh",w=h.classes??y?.classes??[];return e.jsx(qe,{computerLabs:n,onRefresh:b,lang:q,classes:w})}export{Qe as ComputerLabView};
@@ -1 +0,0 @@
1
- import{r as i,j as e}from"./vendor-react-Kv_JATwr.js";import{b as ee,E as y}from"./index-BBznBaN5.js";import{B as j,a8 as se,aW as te,ak as _,a$ as D,X as re,Z as ae,U as T,bX as ne,bY as ie,t as oe,u as le,af as de,ac as I,T as ce,c as O}from"./vendor-icons-hc6MjYFv.js";import"./vendor-utils-aM7aYvPP.js";import"./vendor-pdf-By0fofA0.js";import"./vendor-motion-BFAPOs-b.js";import"./vendor-charts-SrpBsvM3.js";function xe(s){if(typeof s!="string")return"";let a=s;return a=a.replace(/<(think|thinking|reasoning|analysis)(?:\s+[^>]*)?>[\s\S]*?<\/\1>/gi,""),a=a.replace(/<(think|thinking|reasoning|analysis)(?:\s+[^>]*)?>[\s\S]*$/gi,""),a=a.replace(/```(?:think|thinking|reasoning|analysis)[\s\S]*?```/gi,""),a=a.replace(/^```(?:json|markdown|md)?\s*/i,"").replace(/```\s*$/i,""),a.trim()}function me(s,a=160){if(!s||typeof s!="string")return"";let r=xe(s);return r?(r=r.replace(/```[\s\S]*?```/g," "),r=r.replace(/!\[.*?\]\(.*?\)/g,""),r=r.replace(/\[(.*?)\]\(.*?\)/g,"$1"),r=r.replace(/^#+\s+/gm,""),r=r.replace(/^\s*[-*+]\s+/gm,""),r=r.replace(/^\s*\d+\.\s+/gm,""),r=r.replace(/^\s*>\s+/gm,""),r=r.replace(/\*\*([^*]+)\*\*/g,"$1"),r=r.replace(/\*([^*]+)\*/g,"$1"),r=r.replace(/__([^_]+)__/g,"$1"),r=r.replace(/_([^_]+)_/g,"$1"),r=r.replace(/~~(.*?)~~/g,"$1"),r=r.replace(/`([^`]+)`/g,"$1"),r=r.replace(/\s+/g," ").trim(),r.length<=a?r:r.slice(0,a).trimEnd()+"..."):""}function ve(){const{lang:s,session:a,lessons:r,lessonsSearchQuery:g,setLessonsSearchQuery:h,lessonsSortOrder:E,setLessonsSortOrder:A,filteredAndSortedLessons:u,isImportLessonsOpen:ge,setIsImportLessonsOpen:P,isCourseWizardOpen:he,setIsCourseWizardOpen:F,onViewCourse:N,onDeleteCourse:M,onCopyCourse:R,filterEnrollment:v,setFilterEnrollment:W,filterHasContent:C,setFilterHasContent:U,filterThisMonth:w,setFilterThisMonth:X,copyingLessonId:B,fetchLessons:H,downloadCourseTemplate:Q}=ee(),V=()=>P(!0),z=()=>F(!0),n=a,Z=n?.username==="admin"||n?.userId==="usr_admin"||n?.role==="administrator"||n?.subRole==="administrator",[p,J]=i.useState(!1),[o,b]=i.useState(null),[l,d]=i.useState(null),[k,S]=i.useState(!1),[Y,L]=i.useState(!1),[x,$]=i.useState(null),q=t=>{navigator.clipboard.writeText(t).then(()=>{$(t),setTimeout(()=>$(null),1500)})},G=async t=>{b(t),d(null),L(!0);try{const m=await fetch(`/api/lessons/${t.id}/stats`);if(m.ok){const c=await m.json();d(c)}}catch{d({whiteboardCount:0,scheduleCount:0,enrollmentCount:0,assignmentCount:0})}finally{L(!1)}},K=async()=>{if(o){S(!0);try{await M(o.id),b(null),d(null)}finally{S(!1)}}};return e.jsxs("div",{className:"flex-1 flex flex-col gap-6 h-full overflow-y-auto",children:[e.jsxs("div",{className:"flex-1 bg-white border border-gray-200 rounded-xl shadow-sm flex flex-col min-h-0",children:[e.jsxs("div",{className:"p-4 border-b border-gray-100 flex items-center justify-between shrink-0",children:[e.jsxs("h3",{className:"font-medium text-gray-700 flex items-center gap-2",children:[e.jsx(j,{size:16,className:"text-gray-400"}),s==="zh"?"课程与教学环节管理 (SQLite)":"Courses & Lessons Management"]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("button",{id:"import-lessons-csv-btn",onClick:V,className:"flex items-center gap-1.5 px-3 py-1.5 text-xs bg-indigo-50 hover:bg-indigo-100 text-indigo-700 border border-indigo-200 font-semibold rounded-lg shadow-3xs transition-all hover:shadow-xs hover:-translate-y-0.5 cursor-pointer",children:[e.jsx(se,{size:14}),s==="zh"?"批量导入课程":"Import Lessons"]}),e.jsxs("button",{id:"download-course-template-btn",onClick:()=>void Q(),title:s==="zh"?"下载自包含的课程模板(教学环节 + 全部预设组件 + PDF/PPTX 课件附件)":"Download a self-contained course template (segments + every preset component + PDF/PPTX assets)",className:"flex items-center gap-1.5 px-3 py-1.5 text-xs bg-emerald-50 hover:bg-emerald-100 text-emerald-700 border border-emerald-200 font-semibold rounded-lg shadow-3xs transition-all hover:shadow-xs hover:-translate-y-0.5 cursor-pointer",children:[e.jsx(te,{size:14}),s==="zh"?"下载课程模板":"Course Template"]}),e.jsxs("button",{id:"add-course-wizard-btn",onClick:z,className:"flex items-center gap-1.5 px-3 py-1.5 text-xs bg-indigo-600 hover:bg-indigo-700 text-white font-semibold rounded-lg shadow-sm transition-all hover:shadow-md hover:-translate-y-0.5 cursor-pointer",children:[e.jsx(_,{size:14}),s==="zh"?"手动添加课程 (向导)":"Add Course Wizard"]}),e.jsx(y,{slot:"course.list.toolbar.action",slotProps:{lang:s,onRefresh:H}})]})]}),r.length>0&&e.jsxs("div",{className:"px-5 py-3.5 border-b border-gray-100 bg-gray-50/50 flex flex-col sm:flex-row items-center justify-between gap-3 shrink-0",children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-3 w-full sm:w-auto",children:[e.jsxs("div",{className:"relative w-full sm:w-64",children:[e.jsx("span",{className:"absolute inset-y-0 left-0 flex items-center pl-3 pointer-events-none text-gray-400",children:e.jsx(D,{size:14})}),e.jsx("input",{type:"text",placeholder:"Search courses by title...",value:g,onChange:t=>h(t.target.value),className:"w-full pl-9 pr-8 py-1.5 text-xs bg-white border border-gray-200 rounded-lg focus:outline-none focus:ring-2 focus:ring-indigo-500 text-gray-800 shadow-sm"}),g&&e.jsx("button",{onClick:()=>h(""),className:"absolute inset-y-0 right-0 flex items-center pr-2.5 text-gray-400 hover:text-gray-600",children:e.jsx(re,{size:12,className:"bg-gray-100 hover:bg-gray-200 rounded-full p-0.5"})})]}),e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx("span",{className:"text-xs font-bold text-subtle uppercase tracking-wider",children:s==="zh"?"排序方式:":"Sort by:"}),e.jsxs("select",{"aria-label":s==="zh"?"课程排序方式":"Course sort order",value:E,onChange:t=>A(t.target.value),className:"bg-white border border-gray-200 text-xs text-gray-755 font-bold px-2.5 py-1.5 rounded-lg focus:outline-none focus:ring-2 focus:ring-indigo-500 shadow-sm",id:"courses-sort-select",children:[e.jsx("option",{value:"recent",children:s==="zh"?"最新创建":"Most Recent"}),e.jsx("option",{value:"alphabetical",children:s==="zh"?"按名称 (A-Z)":"Alphabetical (A-Z)"}),e.jsx("option",{value:"enrollment",children:s==="zh"?"学生选课人次":"Student Enrollment Count"})]})]})]}),e.jsxs("div",{className:"flex items-center gap-3 flex-wrap",children:[e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsxs("button",{onClick:()=>J(!p),className:`px-2 py-1 text-xs font-bold rounded-md border transition-all cursor-pointer ${p?"bg-indigo-600 text-white border-indigo-600 shadow-2xs":"bg-white text-gray-600 border-gray-200 hover:border-gray-300"}`,title:s==="zh"?"只看我创建的课程":"Only show courses created by me",children:[e.jsx(ae,{size:11,className:"inline mr-0.5 -mt-0.5"}),s==="zh"?"我的备课":"My Courses"]}),e.jsxs("button",{onClick:()=>W(!v),className:`px-2 py-1 text-xs font-bold rounded-md border transition-all cursor-pointer ${v?"bg-emerald-50 text-emerald-700 border-emerald-200":"bg-white text-gray-500 border-gray-200 hover:border-gray-300"}`,children:[e.jsx(T,{size:11,className:"inline mr-0.5 -mt-0.5"}),s==="zh"?"有人选":"Enrolled"]}),e.jsxs("button",{onClick:()=>U(!C),className:`px-2 py-1 text-xs font-bold rounded-md border transition-all cursor-pointer ${C?"bg-indigo-50 text-indigo-700 border-indigo-200":"bg-white text-gray-500 border-gray-200 hover:border-gray-300"}`,children:[e.jsx(j,{size:11,className:"inline mr-0.5 -mt-0.5"}),s==="zh"?"有内容":"Has Content"]}),e.jsx("button",{onClick:()=>X(!w),className:`px-2 py-1 text-xs font-bold rounded-md border transition-all cursor-pointer ${w?"bg-amber-50 text-amber-700 border-amber-200":"bg-white text-gray-500 border-gray-200 hover:border-gray-300"}`,children:s==="zh"?"本月":"This Month"})]}),e.jsxs("div",{className:"text-xs font-semibold text-gray-500",children:["Found ",e.jsx("span",{className:"text-indigo-650 font-bold",children:u.length})," of"," ",e.jsx("span",{className:"text-gray-700 font-bold",children:r.length})," course",r.length===1?"":"s"]})]})]}),e.jsx("div",{className:"flex-1 overflow-y-auto p-4",children:r.length===0?e.jsxs("div",{className:"flex flex-col items-center justify-center h-full text-gray-400 min-h-[300px]",children:[e.jsx(j,{size:48,className:"mb-4 opacity-30 text-indigo-500"}),e.jsx("h3",{className:"text-lg font-bold text-gray-800",children:s==="zh"?"暂无可用课程":"No Courses Available"}),e.jsx("p",{className:"mt-2 text-sm text-gray-500 text-center max-w-xs",children:s==="zh"?"系统中暂未部署任何课程。请通过下方按钮启动添加向导指南。":"There are no courses active in the system yet. Build your first curriculum!"}),e.jsxs("button",{id:"empty-add-course-btn",onClick:z,className:"mt-5 flex items-center gap-2 px-5 py-2.5 bg-indigo-600 hover:bg-indigo-700 text-white font-bold rounded-xl shadow-md transition-all cursor-pointer",children:[e.jsx(_,{size:16}),s==="zh"?"使用向导指南来创建新课程":"Create Course via Wizard"]})]}):u.length===0?e.jsxs("div",{className:"flex flex-col items-center justify-center h-full py-12 text-gray-450 text-center",children:[e.jsx(D,{size:44,className:"mb-3 opacity-30 text-gray-450"}),e.jsxs("h4",{className:"font-semibold text-gray-700 text-sm",children:['No Courses Match "',g,'"']}),e.jsx("p",{className:"text-xs text-gray-500 mt-1 max-w-xs",children:"Double-check the spelling or try searching for another curriculum keyword."}),e.jsx("button",{onClick:()=>h(""),className:"mt-3 text-xs bg-indigo-50 hover:bg-indigo-100 text-indigo-700 border border-indigo-200 font-semibold px-3 py-1.5 rounded-lg transition-colors",children:"Clear Search Filter"})]}):e.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 xl:grid-cols-3 gap-4",children:u.filter(t=>p?!t.creator_id||t.creator_id===n?.userId||t.creator_id===n?.username:!0).map(t=>{const m=B===t.id,c=!t.creator_id||t.creator_id===n?.userId||t.creator_id===n?.username,f=Z||c;return e.jsxs("div",{className:`border border-gray-200 hover:border-indigo-300 rounded-xl p-4 flex flex-col bg-gray-50/50 hover:shadow-md transition-all ${m?"opacity-60 pointer-events-none":""}`,children:[e.jsxs("div",{className:"flex items-center justify-between mb-2 gap-2",children:[e.jsx("div",{className:"font-semibold text-gray-800 text-lg truncate cursor-pointer hover:text-indigo-600 transition-colors",title:t.title,onClick:()=>N(t.id),children:t.title}),e.jsxs("div",{className:"flex items-center gap-1.5 shrink-0",children:[e.jsx(y,{slot:"course.card.badge",slotProps:{course:t}}),t.creator_name?e.jsxs("span",{className:`text-xs font-medium px-1.5 py-0.5 rounded border flex items-center gap-0.5 ${c?"bg-indigo-50 text-indigo-700 border-indigo-200 font-semibold":"bg-slate-100 text-slate-600 border-slate-200"}`,title:s==="zh"?`创建教师: ${t.creator_name}`:`Created by: ${t.creator_name}`,children:[c?"👑 ":"👤 ",t.creator_name]}):null,e.jsxs("span",{className:"inline-flex items-center gap-1 bg-indigo-50 text-indigo-700 px-1.5 py-0.5 border border-indigo-100 rounded text-xs font-bold",children:[e.jsx(T,{size:10,className:"text-indigo-500"}),t.enrollment_count||0]})]})]}),e.jsx("div",{className:"text-sm text-gray-500 line-clamp-3 mb-4 flex-1 leading-relaxed",children:me(t.content)||e.jsx("span",{className:"italic text-gray-400",children:s==="zh"?"暂无课程大纲与简介":"No outline or summary available."})}),e.jsxs("div",{className:"flex justify-between items-center mt-auto",children:[e.jsxs("button",{onClick:()=>q(t.id),className:`flex items-center gap-1 text-xs rounded px-1.5 py-0.5 transition-all cursor-pointer ${x===t.id?"text-emerald-700 bg-emerald-50 border border-emerald-200":"text-subtle hover:text-indigo-600 hover:bg-indigo-50 border border-transparent"}`,title:x===t.id?s==="zh"?"已复制!":"Copied!":s==="zh"?"复制课程 ID":"Copy Course ID",children:[x===t.id?e.jsx(ne,{size:12}):e.jsx(ie,{size:12}),e.jsx("span",{className:"font-mono",children:x===t.id?s==="zh"?"已复制!":"Copied!":`${t.id.substring(0,8)}…`})]}),e.jsxs("div",{className:"flex items-center gap-0.5",children:[e.jsx("button",{onClick:()=>N(t.id),className:"p-1.5 text-gray-400 hover:text-indigo-600 hover:bg-indigo-50 rounded transition-colors cursor-pointer",title:f?s==="zh"?"查看与编辑":"View & Edit":s==="zh"?"查看只读 (他人课程)":"View Read-Only",children:f?e.jsx(oe,{size:15}):e.jsx(le,{size:15})}),e.jsx("button",{onClick:()=>R(t.id),className:"p-1.5 text-gray-400 hover:text-emerald-600 hover:bg-emerald-50 rounded transition-colors cursor-pointer",title:s==="zh"?"克隆为我的备课":"Clone Course",children:e.jsx(de,{size:14})}),f?e.jsx("button",{onClick:()=>G(t),className:"p-1.5 text-gray-400 hover:text-red-600 hover:bg-red-50 rounded transition-colors cursor-pointer",title:s==="zh"?"删除课程":"Delete Course",children:e.jsx(I,{size:14})}):e.jsx("span",{className:"p-1.5 text-gray-300 cursor-not-allowed",title:s==="zh"?"仅创建教师或管理员可删除":"Only creator or admin can delete",children:e.jsx(I,{size:14})}),e.jsx(y,{slot:"course.card.action",slotProps:{course:t,lang:s}})]})]})]},t.id)})})})]}),o&&e.jsx("div",{className:"fixed inset-0 bg-black/40 backdrop-blur-[2px] flex items-center justify-center z-[9999] p-4",children:e.jsxs("div",{className:"bg-white rounded-xl shadow-2xl max-w-md w-full border border-gray-100 overflow-hidden",children:[e.jsxs("div",{className:"px-5 py-4 border-b border-gray-100 bg-red-50 flex items-center gap-2",children:[e.jsx(ce,{size:18,className:"text-red-600"}),e.jsx("h3",{className:"font-bold text-red-800 text-sm",children:s==="zh"?"确认删除课程":"Confirm Course Deletion"})]}),e.jsxs("div",{className:"p-5 space-y-3",children:[e.jsx("p",{className:"text-sm text-gray-700",children:s==="zh"?e.jsxs(e.Fragment,{children:["确定要删除课程 ",e.jsx("span",{className:"font-bold text-red-600",children:o.title})," 吗?"]}):e.jsxs(e.Fragment,{children:["Are you sure you want to delete ",e.jsx("span",{className:"font-bold text-red-600",children:o.title}),"?"]})}),e.jsx("p",{className:"text-xs text-red-600 font-medium",children:s==="zh"?"此操作不可撤销,将删除课程的所有关联数据。":"This action is irreversible and will delete all associated data."}),Y?e.jsxs("div",{className:"flex items-center gap-2 text-xs text-gray-500 py-2",children:[e.jsx(O,{size:14,className:"animate-spin"}),s==="zh"?"正在统计关联数据...":"Counting related data..."]}):l?e.jsxs("div",{className:"bg-gray-50 rounded-lg p-3 space-y-1.5 text-xs",children:[e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{className:"text-gray-600",children:s==="zh"?"白板元素":"Whiteboard Elements"}),e.jsx("span",{className:"font-bold text-gray-800",children:l.whiteboardCount})]}),e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{className:"text-gray-600",children:s==="zh"?"排课记录":"Schedules"}),e.jsx("span",{className:"font-bold text-gray-800",children:l.scheduleCount})]}),e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{className:"text-gray-600",children:s==="zh"?"选课学生":"Enrollments"}),e.jsx("span",{className:"font-bold text-gray-800",children:l.enrollmentCount})]}),e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{className:"text-gray-600",children:s==="zh"?"作业任务":"Assignments"}),e.jsx("span",{className:"font-bold text-gray-800",children:l.assignmentCount})]})]}):null]}),e.jsxs("div",{className:"px-5 py-3 border-t border-gray-100 bg-gray-50 flex justify-end gap-2",children:[e.jsx("button",{onClick:()=>{b(null),d(null)},className:"px-4 py-2 text-xs font-medium text-gray-600 hover:bg-gray-100 border border-gray-200 rounded-lg transition-colors cursor-pointer",children:s==="zh"?"取消":"Cancel"}),e.jsxs("button",{onClick:K,disabled:k,className:"px-4 py-2 text-xs font-bold text-white bg-red-600 hover:bg-red-700 rounded-lg transition-colors cursor-pointer disabled:opacity-50 flex items-center gap-1.5",children:[k&&e.jsx(O,{size:12,className:"animate-spin"}),s==="zh"?"确认删除":"Confirm Delete"]})]})]})})]})}export{ve as CourseManagement};
@@ -1,2 +0,0 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/InteractiveCoursewareViewer-BfHEDrCf.js","assets/vendor-react-Kv_JATwr.js","assets/vendor-utils-aM7aYvPP.js","assets/index-BBznBaN5.js","assets/vendor-icons-hc6MjYFv.js","assets/vendor-motion-BFAPOs-b.js","assets/index-DPky2leG.css"])))=>i.map(i=>d[i]);
2
- import{_ as a}from"./vendor-pdf-By0fofA0.js";import{j as e,r}from"./vendor-react-Kv_JATwr.js";const i=r.lazy(()=>a(()=>import("./InteractiveCoursewareViewer-BfHEDrCf.js"),__vite__mapDeps([0,1,2,3,4,5,6])));function n(s){return e.jsx(r.Suspense,{fallback:e.jsx("div",{className:"flex items-center justify-center h-full bg-gray-50",children:e.jsx("div",{className:"animate-spin rounded-full h-8 w-8 border-b-2 border-indigo-500"})}),children:e.jsx(i,{...s})})}export{n as L};
@@ -1,2 +0,0 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/InteractiveWhiteboard-KBzmiNBG.js","assets/vendor-react-Kv_JATwr.js","assets/vendor-utils-aM7aYvPP.js","assets/index-BBznBaN5.js","assets/vendor-icons-hc6MjYFv.js","assets/vendor-motion-BFAPOs-b.js","assets/AssignmentFilePreview-DQbvbgnd.js","assets/index-DPky2leG.css","assets/vendor-pptx-DIWdXF1L.css","assets/vendor-reveal-DcQQzuI9.css"])))=>i.map(i=>d[i]);
2
- import{_ as s}from"./vendor-pdf-By0fofA0.js";import{r as t,j as e}from"./vendor-react-Kv_JATwr.js";const i=t.lazy(()=>s(()=>import("./InteractiveWhiteboard-KBzmiNBG.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9])).then(r=>({default:r.InteractiveWhiteboard}))),n=t.forwardRef((r,a)=>e.jsx(t.Suspense,{fallback:e.jsx("div",{className:"flex items-center justify-center h-full bg-gray-50",children:e.jsx("div",{className:"animate-spin rounded-full h-8 w-8 border-b-2 border-indigo-500"})}),children:e.jsx(i,{ref:a,...r})}));export{n as L};
@@ -1 +0,0 @@
1
- import{j as e,r as x,R as ne}from"./vendor-react-Kv_JATwr.js";import{l as ee,d as $e,n as Pe,p as Ae,q as ue,v as Re,w as Le,x as _e,y as Me,z as Se,B as Fe,F as Qe,E as G,G as ge,H as Oe,I as qe,e as Ce,J as Ze,S as Be,i as ie,K as oe,L as Ge,b as We,N as He,O as ye}from"./index-BBznBaN5.js";import{L as Ue}from"./LazyWhiteboard-DGyln3JC.js";import{P as Je,p as Ie,b9 as Ke,aU as ve,ba as je,bb as Ye,a6 as we,ak as me,t as Ve,ac as pe,a$ as Xe,X as Ee,$ as xe,z as Te,f as et,bc as tt,aR as st,o as De,aZ as rt,L as at,aa as nt,w as Ne,ab as it,a7 as ot,ar as lt,c as ke,ap as ct,T as dt,af as ut,aQ as ht}from"./vendor-icons-hc6MjYFv.js";import{r as mt}from"./timeline-duration-BgdJCSrW.js";import"./vendor-utils-aM7aYvPP.js";import"./vendor-pdf-By0fofA0.js";import"./vendor-motion-BFAPOs-b.js";import"./vendor-charts-SrpBsvM3.js";function ze({config:s,lang:t,onActivate:n,disabled:u=!1,isFavorite:p=!1,onToggleFavorite:a}){const i=s.icon||Je,N=ee[s.color]||ee.indigo;return e.jsxs("div",{draggable:!u,onDragStart:f=>{if(u){f.preventDefault();return}const y={type:s.type,...s.defaultData},h=JSON.stringify(y);f.dataTransfer.effectAllowed="copy",f.dataTransfer.setData("application/json",h),f.dataTransfer.setData("text/plain",h)},onClick:()=>!u&&n(s.type),title:u?t==="zh"?"当前为只读模式":"Read-only mode":t==="zh"?"点击编辑并添加到画板,或拖拽到画板":"Click to edit & add, or drag onto the board","aria-disabled":u,className:`group relative bg-surface border border-theme rounded-xl p-2.5 shadow-sm transition-all duration-200 ${u?"opacity-60 cursor-not-allowed":"cursor-grab active:cursor-grabbing hover:shadow-md hover:-translate-y-0.5"} ${N.cardHoverBorder} ${N.cardHoverRing} ${N.cardHoverShadow} flex flex-col justify-between min-h-[92px]`,children:[e.jsxs("div",{className:"flex items-center justify-between gap-1",children:[e.jsx("div",{className:`p-2 rounded-lg ${N.iconBg} ${N.iconText} transition-transform group-hover:scale-105 shrink-0`,children:e.jsx(i,{size:16})}),a&&e.jsx("button",{type:"button",onClick:f=>{f.stopPropagation(),a(s.type,f)},className:`p-1 rounded-md transition-colors ${p?"text-amber-400 opacity-100":"text-slate-300 opacity-0 group-hover:opacity-100 hover:text-amber-400 hover:bg-surface-secondary"}`,title:p?t==="zh"?"取消收藏":"Remove favorite":t==="zh"?"收藏组件":"Add favorite",children:e.jsx(Ie,{size:13,className:p?"fill-amber-400":""})})]}),e.jsxs("div",{className:"flex flex-col min-w-0 mt-1.5",children:[e.jsx("span",{className:"font-semibold text-xs text-main truncate group-hover:text-primary-theme transition-colors",children:t==="zh"?s.labelZh:s.labelEn}),e.jsx("span",{className:"text-xs text-muted leading-tight mt-0.5 truncate",children:t==="zh"?s.descriptionZh:s.descriptionEn})]}),e.jsx("div",{className:"absolute top-1.5 right-1.5 opacity-0 group-hover:opacity-100 transition-opacity pointer-events-none",children:e.jsx("span",{className:"text-xs font-bold text-indigo-500 bg-indigo-50 px-1 py-0.5 rounded border border-indigo-100",children:"+ Drag"})})]})}class pt{constructor(){this.items=new Map,this.providers=new Map,this.recents=[],this.favorites=new Set}registerItem(t){if(!t||!t.id)throw new Error("QuickInsertRegistry Error: QuickInsertItemDescriptor must have a valid ID.");this.items.set(t.id,t)}registerProvider(t){if(!t||!t.id)throw new Error("QuickInsertRegistry Error: QuickInsertProvider must have a valid ID.");this.providers.set(t.id,t);const n=t.getItems();for(const u of n)this.registerItem(u)}unregisterItem(t){return this.recents=this.recents.filter(n=>n!==t),this.favorites.delete(t),this.items.delete(t)}getItem(t){return this.items.get(t)}search(t="",n){const p=(t.startsWith("/")?t.slice(1):t).trim().toLowerCase(),a=Array.from(this.items.values());return Object.freeze(a.filter(i=>{if(n&&i.category!==n)return!1;if(!p)return!0;const N=i.title.toLowerCase().includes(p),f=i.description?.toLowerCase().includes(p)??!1,y=i.keywords?.some(h=>h.toLowerCase().includes(p))??!1;return N||f||y}))}async executeItem(t,n){const u=this.items.get(t);if(!u)throw new Error(`QuickInsertRegistry Error: Item '${t}' not found.`);this.recents=[t,...this.recents.filter(p=>p!==t)].slice(0,10),await u.execute(n)}getRecents(){const t=this.recents.map(n=>this.items.get(n)).filter(n=>n!==void 0);return Object.freeze(t)}getFavorites(){const t=Array.from(this.favorites).map(n=>this.items.get(n)).filter(n=>n!==void 0);return Object.freeze(t)}toggleFavorite(t){this.favorites.has(t)?this.favorites.delete(t):this.items.has(t)&&this.favorites.add(t)}listAll(){return Object.freeze(Array.from(this.items.values()))}clear(){this.items.clear(),this.providers.clear(),this.recents=[],this.favorites.clear()}}const xt=["Media","Shape","Tool","AI","Widget","Plugin"],he=new pt,ft=({isOpen:s,onClose:t,registry:n=he,initialQuery:u="/"})=>{const[p,a]=x.useState(u),[i,N]=x.useState("All"),[f,y]=x.useState(0),h=$e(c=>c.extensionPoints),b=x.useMemo(()=>{const c=i==="All"?void 0:i,o=n.search(p,c),v=(h.get("quick_insert.item")??[]).map(w=>{const I=Pe(w.slotProps),A=Ae(I.category,xt,"Plugin"),_=ue(I,"title"),M=ue(I,"commandType"),g=Re(I.payload);return{id:w.id,title:w.label||_||w.id,description:ue(I,"description"),icon:typeof w.icon=="string"?w.icon:void 0,category:A,keywords:Me(I.keywords),execute:async j=>{if(M){const S=await Le.post("/api/plugins/execute-command",{type:M,payload:g??j});S.success||_e.getState().addToast({id:`plugin-cmd-error-${Date.now()}`,type:"error",title:"插件命令执行失败",message:S.error||`命令 ${M} 未能执行`})}}}}).filter(w=>{if(c&&w.category!==c)return!1;const A=(p.startsWith("/")?p.slice(1):p).trim().toLowerCase();if(!A)return!0;const _=w.title.toLowerCase().includes(A),M=w.description?.toLowerCase().includes(A)??!1,g=w.keywords?.some(j=>j.toLowerCase().includes(A))??!1;return _||M||g});return[...o,...v]},[n,p,i,h]),k=x.useCallback(c=>{if(c.key==="ArrowDown")c.preventDefault(),y(o=>o+1<b.length?o+1:0);else if(c.key==="ArrowUp")c.preventDefault(),y(o=>o-1>=0?o-1:b.length-1);else if(c.key==="Enter"){c.preventDefault();const o=b[f];o&&(n.getItem?.(o.id)?n.executeItem(o.id):o.execute(),t())}else c.key==="Escape"&&(c.preventDefault(),t())},[b,f,n,t]);return x.useEffect(()=>{y(0)},[p,i]),s?e.jsx("div",{className:"quick-insert-backdrop fixed inset-0 bg-slate-950/40 backdrop-blur-xs z-50 flex items-center justify-center",onClick:t,"data-testid":"quick-insert-backdrop",children:e.jsxs("div",{className:"quick-insert-container w-full max-w-lg bg-slate-900 border border-slate-800 rounded-xl shadow-2xl overflow-hidden flex flex-col",onClick:c=>c.stopPropagation(),"data-testid":"quick-insert-modal",children:[e.jsxs("div",{className:"flex items-center px-4 py-3 border-b border-slate-800 bg-slate-900/90",children:[e.jsx("span",{className:"text-indigo-400 font-mono font-bold text-lg mr-2",children:"/"}),e.jsx("input",{type:"text",className:"w-full bg-transparent text-slate-100 placeholder-slate-400 outline-none text-sm font-medium",placeholder:"Type a command or filter...",value:p.startsWith("/")?p.slice(1):p,onChange:c=>a("/"+c.target.value),onKeyDown:k,autoFocus:!0,"data-testid":"quick-insert-search-input"}),e.jsx("kbd",{className:"text-xs bg-slate-800 text-slate-400 px-2 py-0.5 rounded border border-slate-700 font-mono",children:"ESC"})]}),e.jsx("div",{className:"flex items-center space-x-1 px-3 py-1.5 border-b border-slate-800 bg-slate-900/50 overflow-x-auto",children:["All","Media","Shape","Tool","AI","Widget","Plugin"].map(c=>e.jsx("button",{className:`px-2 py-0.5 text-xs rounded-md transition-colors font-medium ${i===c?"bg-indigo-600 text-white":"text-slate-400 hover:bg-slate-800 hover:text-slate-200"}`,onClick:()=>N(c),children:c},c))}),e.jsx("div",{className:"max-h-80 overflow-y-auto p-2 divide-y divide-slate-800/40",children:b.length===0?e.jsx("div",{className:"py-6 text-center text-slate-500 text-sm",children:"No insertable items match slash command."}):b.map((c,o)=>e.jsxs("div",{className:`flex items-center justify-between px-3 py-2 rounded-lg cursor-pointer transition-colors ${o===f?"bg-indigo-600/20 text-white":"text-slate-300 hover:bg-slate-800/60"}`,onClick:()=>{n.getItem?.(c.id)?n.executeItem(c.id):c.execute(),t()},"data-testid":`quick-insert-item-${c.id}`,children:[e.jsxs("div",{className:"flex items-center space-x-2.5",children:[e.jsx("span",{className:"text-xs font-semibold px-2 py-0.5 rounded bg-slate-800 text-indigo-400 border border-slate-700",children:c.category}),e.jsxs("div",{children:[e.jsx("div",{className:"text-sm font-medium text-slate-100",children:c.title}),c.description&&e.jsx("div",{className:"text-xs text-slate-400",children:c.description})]})]}),c.shortcut&&e.jsx("kbd",{className:"text-xs font-mono text-slate-400 bg-slate-800 px-1.5 py-0.5 rounded border border-slate-700",children:c.shortcut})]},c.id))})]})}):null},bt={present:"Media",media:"Media",interact:"Tool",tool:"Tool",ai:"AI",widget:"Widget"};function gt(s){return Se.map(t=>{const n=s.lang==="zh"?t.labelZh:t.labelEn,u=s.lang==="zh"?t.descriptionZh:t.descriptionEn;return{id:`builtin.quickInsert.${t.type}`,title:n,description:u,category:bt[t.group]??"Widget",keywords:[t.type,...s.lang==="zh"?[t.labelZh]:[t.labelEn]],execute:()=>{s.readOnly||s.onActivate(t.type)}}})}function yt(s,t){for(const n of gt(t))s.registerItem(n)}function vt({lang:s,onActivate:t,readOnly:n=!1,collapsed:u,onToggleCollapse:p,pages:a,currentPage:i=0,onSwitchPage:N,onAddPage:f,onDeletePage:y,onRenamePage:h,dragState:b,onHoverDropTarget:k}){const[c,o]=x.useState(!1),m=u!==void 0?u:c,v=()=>{const l=!m;o(l),p&&p(l)},[w,I]=x.useState(""),[A,_]=x.useState(!1),[M,g]=x.useState(""),[j,S]=x.useState(!1),[F,Q]=x.useState(null),[P,Z]=x.useState(""),[E,T]=x.useState("all"),[J,W]=x.useState(()=>{try{const l=localStorage.getItem("openlearn_palette_favs");return l?JSON.parse(l):[]}catch{return[]}}),[V,R]=x.useState(()=>{try{const l=localStorage.getItem("openlearn_palette_recent");return l?JSON.parse(l):[]}catch{return[]}}),[le,ce]=x.useState({}),H=l=>{n||(R(r=>{const d=[l,...r.filter(z=>z!==l)].slice(0,6);try{localStorage.setItem("openlearn_palette_recent",JSON.stringify(d))}catch{}return d}),t(l))},te=(l,r)=>{r.stopPropagation(),W(d=>{const C=d.includes(l)?d.filter($=>$!==l):[...d,l];try{localStorage.setItem("openlearn_palette_favs",JSON.stringify(C))}catch{}return C})},de=l=>{ce(r=>({...r,[l]:!r[l]}))},se=x.useRef(H);se.current=H,x.useEffect(()=>{yt(he,{lang:s,onActivate:l=>se.current(l),readOnly:n})},[s,n]);const Y=Fe(),re=[...Se,...Y],B=re.filter(l=>{if(w.trim()){const r=w.toLowerCase(),d=l.labelZh.toLowerCase().includes(r)||l.descriptionZh.toLowerCase().includes(r),z=l.labelEn.toLowerCase().includes(r)||l.descriptionEn.toLowerCase().includes(r);if(!d&&!z)return!1}return E==="favorites"?J.includes(l.type):E==="recent"?V.includes(l.type):!0}),U=ne.useRef(null),K=ne.useRef(null),O=ne.useRef(null),D=ne.useRef(null),[q,X]=x.useState(null);return x.useEffect(()=>{if(!b){D.current&&(clearTimeout(D.current),D.current=null),O.current&&(clearTimeout(O.current),O.current=null),X(null),k?.(null);return}const{clientX:l,clientY:r}=b;if(U.current){const d=U.current.getBoundingClientRect(),z=l>=d.left&&l<=d.right&&r>=d.top&&r<=d.bottom;z&&m?O.current||(O.current=setTimeout(()=>{o(!1),p?.(!1),O.current=null},250)):!z&&O.current&&(clearTimeout(O.current),O.current=null)}if(K.current){const d=K.current.getBoundingClientRect(),z=l>=d.left&&l<=d.right&&r>=d.top&&r<=d.bottom;if(z&&j?D.current||(D.current=setTimeout(()=>{S(!1),D.current=null},250)):!z&&D.current&&(clearTimeout(D.current),D.current=null),!j&&a&&a.length>0){let C=null;K.current.querySelectorAll("[data-page-index]").forEach(fe=>{const ae=fe.getBoundingClientRect();if(l>=ae.left&&l<=ae.right&&r>=ae.top&&r<=ae.bottom){const be=fe.getAttribute("data-page-index");be!==null&&(C=parseInt(be,10))}}),C!==null&&C!==b.initialPage?(X(C),k?.({type:"page",pageIndex:C})):(X(null),k?.(null))}}},[b,m,j,a,p,k]),m?e.jsxs("div",{ref:U,className:`w-14 shrink-0 border-r border-theme bg-surface-secondary/40 backdrop-blur-md p-2 flex flex-col items-center gap-3 select-none transition-all duration-300 ${b?"ring-2 ring-primary-theme/50 bg-primary-theme/10":""}`,children:[e.jsx("button",{type:"button",onClick:v,className:"w-10 h-10 rounded-xl bg-surface hover:bg-surface-secondary border border-theme text-muted hover:text-main flex items-center justify-center transition-all cursor-pointer shadow-2xs hover:scale-105",title:s==="zh"?"展开备课组件库 (Ctrl+B)":"Expand Component Palette",children:e.jsx(Ke,{size:16})}),e.jsx("div",{className:"w-8 h-px bg-border/60 my-0.5"}),a&&a.length>0&&e.jsxs("button",{type:"button",onClick:v,className:"w-10 h-10 rounded-xl bg-surface hover:bg-primary-theme/10 border border-theme text-primary-theme flex items-center justify-center transition-all cursor-pointer shadow-2xs group relative",title:`${s==="zh"?"页面大纲":"Outline"} (P${i+1}/${a.length}) - ${s==="zh"?"点击展开":"Click to expand"}`,children:[e.jsx(ve,{size:16}),e.jsx("span",{className:"absolute -top-1 -right-1 text-[9px] bg-primary-theme text-white rounded-full w-4 h-4 flex items-center justify-center font-bold",children:i+1})]}),e.jsx("div",{className:"flex flex-col gap-2 overflow-y-auto max-h-[calc(100vh-220px)] p-0.5",children:re.slice(0,8).map(l=>{const r=l.icon||je;return e.jsx("button",{type:"button",onClick:()=>H(l.type),disabled:n,"aria-disabled":n,className:`w-10 h-10 rounded-xl bg-surface border border-theme text-main flex items-center justify-center transition-all shadow-2xs group relative ${n?"opacity-50 cursor-not-allowed":"hover:bg-primary-theme/10 hover:border-primary-theme cursor-pointer"}`,title:`${s==="zh"?l.labelZh:l.labelEn} - ${s==="zh"?"点击配置":"Configure"}`,children:e.jsx(r,{size:16,className:"text-primary-theme transition-transform group-hover:scale-110"})},l.type)})})]}):e.jsxs("div",{ref:U,className:`w-[260px] shrink-0 border-r border-theme bg-surface-secondary/40 backdrop-blur-md p-3.5 overflow-y-auto flex flex-col gap-3.5 font-sans select-none text-main transition-all duration-300 ${b&&q!==null?"ring-1 ring-primary-theme/30":""}`,children:[e.jsxs("div",{className:"flex items-center justify-between border-b border-theme/60 pb-2.5",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:"w-7 h-7 rounded-lg bg-primary-theme/10 text-primary-theme flex items-center justify-center",children:e.jsx(je,{size:15})}),e.jsxs("div",{children:[e.jsx("h3",{className:"text-xs font-black text-main uppercase tracking-wider",children:s==="zh"?"备课组件画板":"Palette"}),e.jsxs("span",{className:"text-[10px] text-muted",children:[B.length," ",s==="zh"?"个可用组件":"components"]})]})]}),e.jsx("button",{type:"button",onClick:v,className:"p-1.5 rounded-lg text-muted hover:text-main hover:bg-surface border border-theme/50 transition-colors cursor-pointer",title:s==="zh"?"收起组件面板以扩大画布":"Collapse Palette",children:e.jsx(Ye,{size:14})})]}),a&&a.length>0&&e.jsxs("div",{ref:K,className:`bg-surface rounded-xl border border-theme p-2.5 flex flex-col gap-2 shadow-2xs transition-all duration-200 ${q!==null?"border-primary-theme shadow-md ring-1 ring-primary-theme/30":""}`,children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("button",{type:"button",onClick:()=>S(l=>!l),className:"flex items-center gap-1.5 text-xs font-bold text-main hover:text-primary-theme transition-colors cursor-pointer",children:[e.jsx(ve,{size:14,className:"text-primary-theme"}),e.jsxs("span",{children:[s==="zh"?"页面大纲":"Outline"," (",a.length,")"]}),e.jsx(we,{size:13,className:`text-muted transition-transform duration-200 ${j?"-rotate-90":""}`})]}),!n&&f&&e.jsx("button",{type:"button",onClick:()=>f(),className:"p-1 rounded-md text-muted hover:text-primary-theme hover:bg-primary-theme/10 transition-colors cursor-pointer",title:s==="zh"?"新建白板页面":"Add page",children:e.jsx(me,{size:13})})]}),j?e.jsxs("div",{onClick:()=>S(!1),className:`flex items-center justify-between text-2xs px-2 py-1 bg-surface-secondary/70 rounded-lg text-muted hover:text-main cursor-pointer transition-colors ${b?"border border-dashed border-primary-theme/60 bg-primary-theme/10 text-primary-theme font-medium animate-pulse":""}`,children:[e.jsx("span",{className:"truncate max-w-[170px]",children:b?s==="zh"?"🎯 悬停自动展开页面大纲":"🎯 Hover to expand outline":`${s==="zh"?"当前":"Current"}: ${a[i]?.title||`P${i+1}`}`}),e.jsx("span",{className:"text-[10px] text-primary-theme font-medium",children:s==="zh"?"展开":"Expand"})]}):e.jsx("div",{className:"flex flex-col gap-1 max-h-48 overflow-y-auto pr-0.5 no-scrollbar",children:a.map((l,r)=>{const d=r===i,z=F===r,C=q===r;return e.jsxs("div",{"data-page-index":r,onClick:()=>{z||N?.(r)},className:`group flex items-center justify-between px-2.5 py-1.5 rounded-lg text-xs transition-all cursor-pointer ${C?"ring-2 ring-primary-theme ring-offset-1 border-dashed border-2 border-primary-theme bg-primary-theme/15 animate-pulse":d?"bg-primary-theme text-white font-semibold shadow-xs":"bg-surface hover:bg-surface-secondary text-main border border-theme/40"}`,children:[e.jsxs("div",{className:"flex items-center gap-1.5 truncate min-w-0 flex-1",children:[e.jsxs("span",{className:`text-[10px] px-1 py-0.2 rounded font-mono shrink-0 ${C?"bg-primary-theme text-white font-bold":d?"bg-white/20 text-white":"bg-surface-secondary text-muted"}`,children:["P",r+1]}),z?e.jsx("input",{type:"text",autoFocus:!0,value:P,onChange:$=>Z($.target.value),onKeyDown:$=>{$.key==="Enter"&&(P.trim()&&h?.(r,P.trim()),Q(null)),$.key==="Escape"&&Q(null)},onBlur:()=>{P.trim()&&h?.(r,P.trim()),Q(null)},className:"px-1.5 py-0.5 text-xs bg-surface border border-primary-theme rounded text-main outline-none w-full",onClick:$=>$.stopPropagation()}):e.jsx("span",{className:"truncate",children:l.title})]}),C&&e.jsxs("span",{className:"text-[10px] font-bold text-primary-theme animate-bounce shrink-0 flex items-center gap-1 pl-1",children:[e.jsx("span",{children:"📥"}),e.jsx("span",{children:s==="zh"?"松开移入":"Drop"})]}),!n&&!z&&e.jsxs("div",{className:"flex items-center gap-0.5 opacity-0 group-hover:opacity-100 transition-opacity ml-1 shrink-0",onClick:$=>$.stopPropagation(),children:[h&&e.jsx("button",{type:"button",onClick:()=>{Q(r),Z(l.title)},className:`p-0.5 rounded hover:bg-black/10 cursor-pointer ${d?"text-white":"text-muted hover:text-main"}`,title:"重命名",children:e.jsx(Ve,{size:11})}),a.length>1&&y&&e.jsx("button",{type:"button",onClick:()=>{window.confirm(`确定删除页面"${l.title}"吗?页面内的组件也将被清理。`)&&y(r)},className:`p-0.5 rounded hover:bg-rose-500/20 text-rose-500 cursor-pointer ${d?"text-white hover:bg-white/20":""}`,title:"删除此页",children:e.jsx(pe,{size:11})})]})]},l.id||r)})})]}),e.jsxs("div",{className:"relative",children:[e.jsx(Xe,{size:13,className:"absolute left-2.5 top-1/2 -translate-y-1/2 text-muted"}),e.jsx("input",{type:"text",value:w,onChange:l=>{const r=l.target.value;if(r.startsWith("/")){g(r),_(!0),I("");return}I(r)},placeholder:s==="zh"?"搜索画板组件...(输入 / 快速插入)":"Search components... (type / to quick insert)",className:"w-full pl-8 pr-7 py-1.5 bg-surface border border-theme rounded-xl text-xs text-main placeholder-muted outline-none focus:border-primary-theme focus:ring-1 focus:ring-primary-theme transition-all shadow-2xs"}),w&&e.jsx("button",{onClick:()=>I(""),className:"absolute right-2.5 top-1/2 -translate-y-1/2 text-muted hover:text-main cursor-pointer",children:e.jsx(Ee,{size:12})})]}),e.jsxs("div",{className:"flex items-center gap-1 bg-surface border border-theme p-1 rounded-xl shadow-2xs",children:[e.jsx("button",{type:"button",onClick:()=>T("all"),className:`flex-1 py-1 text-xs rounded-lg transition-all cursor-pointer ${E==="all"?"bg-surface-secondary text-main font-bold shadow-2xs":"text-muted hover:text-main font-medium"}`,children:s==="zh"?"全部":"All"}),e.jsxs("button",{type:"button",onClick:()=>T("favorites"),className:`flex-1 py-1 text-xs rounded-lg transition-all flex items-center justify-center gap-1 cursor-pointer ${E==="favorites"?"bg-amber-500/10 text-amber-600 font-bold border border-amber-500/20 shadow-2xs":"text-muted hover:text-amber-500 font-medium"}`,children:[e.jsx(Ie,{size:11,className:E==="favorites"?"fill-amber-500":""}),e.jsx("span",{children:s==="zh"?"常用":"Favs"})]}),e.jsxs("button",{type:"button",onClick:()=>T("recent"),className:`flex-1 py-1 text-xs rounded-lg transition-all flex items-center justify-center gap-1 cursor-pointer ${E==="recent"?"bg-primary-theme/10 text-primary-theme font-bold border border-primary-theme/20 shadow-2xs":"text-muted hover:text-primary-theme font-medium"}`,children:[e.jsx(xe,{size:11}),e.jsx("span",{children:s==="zh"?"最近":"Recent"})]})]}),e.jsxs("div",{className:"flex-1 flex flex-col gap-3 overflow-y-auto pr-0.5",children:[B.length===0?e.jsxs("div",{className:"text-center py-8 text-muted text-xs",children:[e.jsx(Te,{size:24,className:"mx-auto mb-2 opacity-30 text-primary-theme"}),e.jsx("p",{className:"font-bold text-main",children:s==="zh"?"未找到相关组件":"No components found"}),e.jsx("p",{className:"text-[11px] mt-1 text-muted",children:E!=="all"?s==="zh"?"尝试切换回「全部」标签":"Try switching to All tab":s==="zh"?"请更换关键词重新搜索":"Try a different keyword"})]}):E!=="all"||w.trim()?e.jsx("div",{className:"grid grid-cols-2 gap-2",children:B.map(l=>e.jsx(ze,{config:l,lang:s,onActivate:H,disabled:n,isFavorite:J.includes(l.type),onToggleFavorite:te},l.type))}):(()=>{const l=[...Qe];return B.forEach(r=>{l.some(d=>d.id===r.group)||l.push({id:r.group,labelZh:r.group,labelEn:r.group})}),l.map(r=>{const d=B.filter($=>$.group===r.id);if(d.length===0)return null;const z=ee[d[0].color]||ee.indigo,C=le[r.id];return e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsxs("button",{type:"button",onClick:()=>de(r.id),className:"flex items-center justify-between px-1.5 py-1 text-left rounded-lg transition-colors cursor-pointer hover:bg-surface-secondary/60",children:[e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx("span",{className:`w-1.5 h-1.5 rounded-full ${z.groupAccent}`}),e.jsx("span",{className:`text-[11px] font-black uppercase tracking-wider ${z.groupText}`,children:s==="zh"?r.labelZh:r.labelEn})]}),e.jsxs("div",{className:"flex items-center gap-1 text-muted",children:[e.jsxs("span",{className:"text-[10px] font-mono opacity-80",children:["(",d.length,")"]}),C?e.jsx(et,{size:12}):e.jsx(we,{size:12})]})]}),!C&&e.jsx("div",{className:"grid grid-cols-2 gap-2",children:d.map($=>e.jsx(ze,{config:$,lang:s,onActivate:H,disabled:n,isFavorite:J.includes($.type),onToggleFavorite:te},$.type))})]},r.id)})})(),e.jsx(G,{slot:"editor.palette_item",slotProps:{lang:s,onActivate:H,readOnly:n}})]}),e.jsx(ft,{isOpen:A,onClose:()=>{_(!1),g("")},registry:he,initialQuery:M})]})}function jt({lang:s,segments:t,activeSegmentId:n,setActiveSegmentId:u,draggedSegmentIdx:p,setDraggedSegmentIdx:a,selectedLesson:i,saveTimeline:N,readOnly:f=!1,editorPanelsExpanded:y,setEditorPanelsExpanded:h,dragState:b,onHoverDropTarget:k}){const c=t.findIndex(g=>g.id===n),o=t.length>1&&c>=0?c/(t.length-1):0,m=c>=0?ge(t[c].color):null,v=x.useRef(null),[w,I]=x.useState(null);x.useEffect(()=>{if(!b){I(null),k?.(null);return}const{clientX:g,clientY:j}=b;if(v.current&&t&&t.length>0){let S=null;v.current.querySelectorAll("[data-segment-id]").forEach(Q=>{const P=Q.getBoundingClientRect();if(g>=P.left&&g<=P.right&&j>=P.top&&j<=P.bottom){const Z=Q.getAttribute("data-segment-id");Z&&(S=Z)}}),S!==null&&S!==b.initialSegmentId?(I(S),k?.({type:"segment",segmentId:S})):(I(null),k?.(null))}},[b,t,k]);const A=t.reduce((g,j)=>{const{seconds:S}=mt(j,{fallbackSeconds:600});return S==null||!Number.isFinite(S)?g:g+Math.round(S/60)},0),_=g=>{if(f)return;if(p===null||p===g){a(null);return}const j=[...t],[S]=j.splice(p,1);j.splice(g,0,S),a(null),i&&N(i,j)},M=()=>{if(f||!i)return;const g="seg-"+Math.random().toString(36).slice(2,9),j={id:g,title:s==="zh"?`新环节 ${t.length+1}`:`Segment ${t.length+1}`,notes:"",type:"lecture",duration:"10m",color:qe};N(i,[...t,j]),u(g),h(!0)};return e.jsxs("div",{ref:v,className:`sticky top-0 z-30 flex items-center justify-between gap-3 px-3.5 py-2 border-b border-theme bg-surface/95 backdrop-blur-md shrink-0 select-none overflow-x-auto text-main shadow-2xs transition-all ${b?"ring-1 ring-primary-theme/30":""}`,children:[e.jsxs("div",{className:"flex items-center gap-2 shrink-0 border-r border-theme pr-3",children:[e.jsx("div",{className:"w-6 h-6 rounded-lg bg-primary-theme/10 text-primary-theme flex items-center justify-center",children:e.jsx(tt,{size:14})}),e.jsxs("div",{className:"flex flex-col",children:[e.jsx("span",{className:"text-xs font-black uppercase tracking-wider text-main whitespace-nowrap",children:s==="zh"?"教学流程":"Lesson Flow"}),e.jsxs("span",{className:"text-[10px] font-mono text-muted flex items-center gap-0.5",children:[e.jsx(xe,{size:9}),e.jsxs("span",{children:[A," min"]})]})]})]}),e.jsxs("div",{className:"relative flex items-center gap-2 py-0.5 min-w-0 flex-1",children:[e.jsx("div",{className:"absolute left-3 right-3 top-1/2 h-0.5 -translate-y-1/2 bg-border/80 rounded-full"}),c>=0&&e.jsx("div",{className:`absolute left-3 top-1/2 h-0.5 -translate-y-1/2 rounded-full transition-all duration-300 ${m?.rail||"bg-primary-theme"}`,style:{width:`calc(${o*100}% - 0.5rem)`}}),t.map((g,j)=>{const S=g.id===n,F=c>=0&&j<c,Q=p===j,P=w===g.id,Z=Oe(g.type),E=ge(g.color),T=Z.icon,J=P?"ring-2 ring-primary-theme ring-offset-2 border-dashed border-2 border-primary-theme bg-primary-theme/20 shadow-md scale-108 animate-pulse text-primary-theme font-bold":S?E.solid+" shadow-md ring-2 ring-primary-theme/30 scale-105":F?"bg-surface-secondary/90 text-main/80 border-primary-theme/30":E.color;return e.jsxs("div",{"data-segment-id":g.id,draggable:!f,onDragStart:W=>{if(f){W.preventDefault();return}a(j),W.dataTransfer.effectAllowed="move"},onDragOver:W=>!f&&W.preventDefault(),onDrop:()=>_(j),onClick:()=>u(g.id),"aria-disabled":f,className:`relative z-10 flex items-center gap-1.5 px-2.5 py-1 rounded-xl text-xs font-semibold ${f?"cursor-pointer":"cursor-grab"} transition-all duration-200 border border-theme/60 shadow-2xs group ${J} ${Q?"opacity-40 scale-95":"hover:scale-102"}`,children:[e.jsx(st,{size:11,className:"opacity-0 group-hover:opacity-60 -ml-0.5 text-muted cursor-grab"}),e.jsx("span",{className:"text-[10px] font-mono font-bold opacity-75",children:j+1}),e.jsx(T,{size:12,className:"shrink-0"}),e.jsx("span",{className:"truncate max-w-[90px]",children:g.title}),e.jsxs("span",{className:"text-[10px] font-mono opacity-60",children:["(",g.duration||"10m",")"]}),F&&e.jsx(De,{size:11,className:"text-emerald-500 shrink-0 ml-0.5"}),e.jsx(G,{slot:"editor.timeline.node_badge",slotProps:{segment:g,idx:j,isActive:S,isCompleted:F,lang:s}}),P&&e.jsxs("span",{className:"text-[10px] font-bold text-primary-theme animate-bounce flex items-center gap-0.5 ml-1",children:[e.jsx("span",{children:"📥"}),e.jsx("span",{children:s==="zh"?"移入此环节":"Move here"})]})]},g.id)}),i&&!f&&e.jsxs("button",{type:"button",onClick:M,className:"relative z-10 flex items-center gap-1 px-2 py-1 rounded-xl text-xs font-medium text-muted hover:text-primary-theme bg-surface hover:bg-surface-secondary border border-dashed border-theme hover:border-primary-theme transition-all cursor-pointer shadow-2xs",title:s==="zh"?"追加新环节":"Add new segment",children:[e.jsx(me,{size:12}),e.jsx("span",{className:"hidden sm:inline",children:s==="zh"?"加环节":"Add"})]})]}),e.jsxs("button",{type:"button",onClick:()=>h(g=>!g),"aria-expanded":y,className:`px-3 py-1 text-xs font-bold rounded-xl border transition-all flex items-center gap-1.5 cursor-pointer shrink-0 ${y?"bg-primary-theme text-white border-primary-theme shadow-md shadow-primary-theme/30 ring-2 ring-primary-theme/30 scale-102":"bg-surface hover:bg-surface-secondary text-muted hover:text-main border-theme shadow-2xs"}`,title:s==="zh"?"展开/收起环节设置面板":"Toggle Segment Settings",children:[e.jsx(rt,{size:13,className:y?"rotate-90 transition-transform text-white":""}),e.jsx("span",{children:s==="zh"?"环节参数":"Settings"}),y&&e.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-white animate-ping ml-0.5"})]})]})}const wt=[{type:"quiz_completed",labelZh:"完成练习",labelEn:"Quiz completed"},{type:"quiz_accuracy",labelZh:"练习正确率",labelEn:"Quiz accuracy"},{type:"assignment_submitted",labelZh:"已提交作业",labelEn:"Assignment submitted"},{type:"dwell_seconds",labelZh:"停留时长",labelEn:"Dwell time"},{type:"checked_in",labelZh:"已签到",labelEn:"Checked in"}];function Nt(s){const t=[];for(const n of s){if(n.status!=="active")continue;let u={};try{u=JSON.parse(n.manifest)}catch{continue}const p=u.contributes?.["segment.gate_type"];if(Array.isArray(p))for(const a of p){if(!a||typeof a!="object")continue;const i=a.id,N=a.commandType;typeof i!="string"||typeof N!="string"||t.push(a)}}return t}function kt(s){return Array.isArray(s)?s.filter(t=>t&&typeof t=="object"&&typeof t.type=="string"):[]}function zt({lang:s,segment:t,readOnly:n=!1,onPatch:u}){const p=Ce(h=>h.plugins),a=Nt(p),i=kt(t.gates),N=[...wt.map(h=>({type:h.type,label:s==="zh"?h.labelZh:h.labelEn})),...a.map(h=>({type:h.id,label:(s==="zh"?h.labelZh:h.labelEn)||h.id}))],f=h=>u({gates:h}),y=(h,b)=>{const k=i.map((c,o)=>o===h?{...c,...b,params:{...c.params||{},...b.params||{}}}:c);f(k)};return e.jsxs("div",{className:"flex flex-col gap-2 rounded-xl p-2.5 bg-indigo-500/5 border border-indigo-500/20",children:[e.jsxs("div",{className:"flex items-center justify-between gap-2",children:[e.jsxs("span",{className:"text-[11px] font-bold text-indigo-700 dark:text-indigo-300 flex items-center gap-1.5",children:[e.jsx(at,{size:12}),e.jsx("span",{children:s==="zh"?"进入条件":"Entry conditions"})]}),!n&&e.jsxs("button",{type:"button",onClick:()=>f([...i,{type:"quiz_completed",params:{}}]),className:"text-[11px] font-bold text-indigo-700 flex items-center gap-1 cursor-pointer",children:[e.jsx(me,{size:12}),s==="zh"?"添加条件":"Add condition"]})]}),e.jsx("p",{className:"text-[10px] text-muted leading-snug",children:s==="zh"?"课级 progress_mode 已废弃。条件写在本环节上,全部满足后学生才能看到这一环节。全班仍跟随教师的当前环节。":"Lesson-level progress_mode is deprecated. Students see this segment only after every condition below is met. The class still shares one current segment."}),i.length===0&&e.jsx("p",{className:"text-[11px] text-muted",children:s==="zh"?"未设置条件,跟随课堂即可进入。":"No conditions. Following the class is enough."}),i.map((h,b)=>e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-4 gap-2 items-end",children:[e.jsxs("label",{className:"flex flex-col gap-1 sm:col-span-2",children:[e.jsx("span",{className:"text-[10px] font-bold text-muted",children:s==="zh"?"条件类型":"Type"}),e.jsxs("select",{"aria-label":s==="zh"?"条件类型":"Condition type",value:h.type,disabled:n,onChange:k=>{const c=i.map((o,m)=>m===b?{type:k.target.value,params:{}}:o);f(c)},className:"border border-theme/80 px-2 py-1.5 rounded-xl bg-surface text-xs",children:[N.map(k=>e.jsx("option",{value:k.type,children:k.label},k.type)),!N.some(k=>k.type===h.type)&&e.jsx("option",{value:h.type,children:h.type})]})]}),e.jsx(Ct,{lang:s,gate:h,readOnly:n,onChange:k=>y(b,{params:k})}),!n&&e.jsxs("button",{type:"button",onClick:()=>f(i.filter((k,c)=>c!==b)),className:"px-2 py-1.5 text-xs text-rose-600 border border-rose-200 rounded-xl cursor-pointer flex items-center justify-center gap-1",children:[e.jsx(pe,{size:12}),s==="zh"?"移除":"Remove"]})]},`${h.type}-${b}`))]})}function St(s,t){const n=s?.[t];return typeof n=="string"||typeof n=="number"?String(n):""}function Ct({lang:s,gate:t,readOnly:n,onChange:u}){const p=t.params||{},a=(i,N,f,y=!1)=>e.jsxs("label",{className:"flex flex-col gap-1",children:[e.jsx("span",{className:"text-[10px] font-bold text-muted",children:N}),e.jsx("input",{value:St(p,i),disabled:n,placeholder:f,onChange:h=>{if(!y){u({[i]:h.target.value});return}const b=Number(h.target.value);u({[i]:h.target.value.trim()===""||!Number.isFinite(b)?h.target.value:b})},className:"border border-theme/80 px-2 py-1.5 rounded-xl bg-surface text-xs"})]});return t.type==="checked_in"?e.jsx("div",{}):t.type==="quiz_accuracy"?e.jsxs(e.Fragment,{children:[a("minScore",s==="zh"?"最低分":"Min score","60",!0),a("elementId",s==="zh"?"题目 ID":"Element ID","")]}):t.type==="dwell_seconds"?a("seconds",s==="zh"?"秒":"Seconds","60",!0):t.type==="assignment_submitted"?a("assignmentId",s==="zh"?"作业 ID":"Assignment ID",""):t.type==="quiz_completed"?a("elementId",s==="zh"?"题目 ID":"Element ID",""):a("segmentId",s==="zh"?"环节 ID":"Segment ID","")}function It({lang:s,segment:t,readOnly:n=!1,onPatch:u,onDelete:p}){const a=Ze();return e.jsxs("div",{className:"relative mx-3 sm:mx-4 my-3 rounded-2xl bg-surface/98 backdrop-blur-xl border-2 border-primary-theme/50 dark:border-primary-theme/60 shadow-2xl shadow-primary-theme/20 ring-4 ring-primary-theme/15 overflow-hidden shrink-0 text-main animate-in fade-in-0 zoom-in-[0.98] slide-in-from-top-3 duration-300 ease-out transition-all",children:[e.jsx("div",{className:"pointer-events-none absolute -top-12 -left-12 w-64 h-32 bg-primary-theme/15 rounded-full blur-2xl opacity-60"}),e.jsx("div",{className:"pointer-events-none absolute -bottom-12 -right-12 w-64 h-32 bg-indigo-500/10 rounded-full blur-2xl opacity-60"}),e.jsx("div",{className:"relative h-1.5 w-full bg-gradient-to-r from-primary-theme via-indigo-500 to-sky-400 shadow-sm shadow-primary-theme/30",children:e.jsx("div",{className:"absolute inset-0 bg-gradient-to-r from-transparent via-white/40 to-transparent animate-pulse"})}),e.jsxs("div",{className:"p-3.5 sm:p-4 flex flex-col gap-3.5 relative z-1",children:[e.jsxs("div",{className:"flex items-center justify-between gap-2 pb-2.5 border-b border-primary-theme/15",children:[e.jsxs("div",{className:"flex items-center gap-2.5 min-w-0",children:[e.jsxs("div",{className:"relative w-8 h-8 rounded-xl bg-gradient-to-br from-primary-theme/25 to-primary-theme/10 text-primary-theme flex items-center justify-center shrink-0 border border-primary-theme/40 shadow-xs",children:[e.jsx(nt,{size:15}),e.jsxs("span",{className:"absolute -top-1 -right-1 flex h-3 w-3",children:[e.jsx("span",{className:"animate-ping absolute inline-flex h-full w-full rounded-full bg-primary-theme opacity-80"}),e.jsx("span",{className:"relative inline-flex rounded-full h-3 w-3 bg-primary-theme ring-2 ring-surface shadow-xs"})]})]}),e.jsxs("div",{className:"flex items-center gap-2 truncate",children:[e.jsxs("span",{className:"text-xs sm:text-sm font-black text-main tracking-tight truncate flex items-center gap-1.5",children:[e.jsx("span",{className:"inline-block w-2 h-2 rounded-full bg-primary-theme animate-pulse"}),s==="zh"?`环节参数配置:${t.title}`:`Segment Config: ${t.title}`]}),e.jsxs("span",{className:"hidden sm:inline-flex items-center gap-1 px-2.5 py-0.5 rounded-full text-[10px] font-black uppercase tracking-wider bg-primary-theme text-white shadow-xs shadow-primary-theme/30 animate-pulse",children:[e.jsx(Te,{size:10}),s==="zh"?"正在聚焦编辑":"Active Editing"]}),e.jsxs("span",{className:"text-[10px] text-muted font-mono opacity-80 bg-surface-secondary/80 px-1.5 py-0.5 rounded-md border border-theme/50",children:["ID: ",t.id]})]})]}),e.jsxs("div",{className:"flex items-center gap-1.5 shrink-0",children:[e.jsx(G,{slot:"editor.timeline.node_badge",slotProps:{segment:t,lang:s,isActive:!0,isCompleted:!1}}),e.jsx(G,{slot:"editor.segment.action",slotProps:{segmentId:t.id,segment:t,lang:s,readOnly:n,onPatch:u}}),n?e.jsx("span",{className:"text-2xs font-semibold text-muted px-2 py-1 rounded-lg border border-theme",children:s==="zh"?"只读":"Read-only"}):e.jsxs("button",{type:"button",onClick:p,className:"px-2.5 py-1 text-xs text-rose-600 hover:text-white bg-rose-500/10 hover:bg-rose-600 border border-rose-500/25 rounded-xl flex items-center gap-1.5 transition-all hover:scale-102 cursor-pointer shadow-2xs shrink-0",title:s==="zh"?"删除当前环节":"Delete Segment",children:[e.jsx(pe,{size:12}),e.jsx("span",{children:s==="zh"?"删除环节":"Delete"})]})]})]}),e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-4 gap-2.5",children:[e.jsxs("label",{className:"flex flex-col gap-1",children:[e.jsxs("span",{className:"text-[11px] font-bold text-muted flex items-center gap-1",children:[e.jsx(Ne,{size:11,className:"text-primary-theme"}),e.jsx("span",{children:s==="zh"?"环节名称":"Title"})]}),e.jsx("input",{type:"text",value:t.title||"",onChange:i=>u({title:i.target.value}),disabled:n,className:"border border-theme/80 px-2.5 py-1.5 rounded-xl bg-surface-secondary/80 focus:bg-surface text-xs text-main font-medium outline-none focus:border-primary-theme focus:ring-2 focus:ring-primary-theme/25 transition-all shadow-2xs"})]}),e.jsxs("label",{className:"flex flex-col gap-1",children:[e.jsxs("span",{className:"text-[11px] font-bold text-muted flex items-center gap-1",children:[e.jsx(xe,{size:11,className:"text-primary-theme"}),e.jsx("span",{children:s==="zh"?"预计用时":"Duration"})]}),e.jsx("input",{type:"text",value:t.duration||"10m",onChange:i=>u({duration:i.target.value}),disabled:n,placeholder:"例如: 10m",className:"border border-theme/80 px-2.5 py-1.5 rounded-xl bg-surface-secondary/80 focus:bg-surface text-xs text-main font-mono outline-none focus:border-primary-theme focus:ring-2 focus:ring-primary-theme/25 transition-all shadow-2xs"})]}),e.jsxs("label",{className:"flex flex-col gap-1",children:[e.jsxs("span",{className:"text-[11px] font-bold text-muted flex items-center gap-1",children:[e.jsx(it,{size:11,className:"text-primary-theme"}),e.jsx("span",{children:s==="zh"?"教学形态":"Instructional Type"})]}),e.jsx("select",{value:t.type||"lecture",onChange:i=>u({type:i.target.value}),disabled:n,className:"border border-theme/80 px-2.5 py-1.5 rounded-xl bg-surface-secondary/80 focus:bg-surface text-xs text-main font-medium outline-none focus:border-primary-theme focus:ring-2 focus:ring-primary-theme/25 transition-all shadow-2xs cursor-pointer",children:a.map(i=>e.jsx("option",{value:i.id,className:"bg-surface text-main",children:s==="zh"?i.labelZh:i.labelEn},i.id))})]}),e.jsxs("div",{className:"flex flex-col gap-1",children:[e.jsxs("span",{className:"text-[11px] font-bold text-muted flex items-center gap-1",children:[e.jsx(ot,{size:11,className:"text-primary-theme"}),e.jsx("span",{children:s==="zh"?"环节标识色":"Accent Color"})]}),e.jsx("div",{className:"flex items-center gap-1.5 pt-1",children:Be.map(i=>e.jsx("button",{type:"button",onClick:()=>u({color:i.color}),disabled:n,"aria-label":s==="zh"?`选择颜色 ${i.name}`:`Choose color ${i.name}`,className:`w-5 h-5 rounded-full border border-theme/60 transition-all hover:scale-115 cursor-pointer ${i.color.split(" ")[0]} ${t.color===i.color?"ring-2 ring-primary-theme ring-offset-2 scale-110 shadow-xs":""}`,title:i.name},i.name))})]})]}),e.jsxs("div",{className:"flex flex-col gap-1 rounded-xl p-2.5 bg-amber-500/5 dark:bg-amber-500/10 border border-amber-500/20",children:[e.jsxs("span",{className:"text-[11px] font-bold text-amber-700 dark:text-amber-400 flex items-center gap-1.5",children:[e.jsx(Ne,{size:12,className:"text-amber-500"}),e.jsx("span",{children:s==="zh"?"教师备课备忘 & 教学设计要点":"Instructional Notes"})]}),e.jsx("textarea",{rows:2,value:t.notes||"",onChange:i=>u({notes:i.target.value}),disabled:n,placeholder:s==="zh"?"写给自己的教学小抄:本环节核心提问、白板板书重点、容易卡壳的步骤…":"Teaching points, blackboard highlights, key student friction points…",className:"w-full border border-theme/70 px-3 py-1.5 rounded-xl bg-surface/90 focus:bg-surface text-xs text-main placeholder-muted outline-none focus:border-primary-theme focus:ring-2 focus:ring-primary-theme/20 transition-all resize-y shadow-2xs leading-relaxed"})]}),e.jsx(zt,{lang:s,segment:t,readOnly:n,onPatch:u}),e.jsx(G,{slot:"editor.segment.type_config",slotProps:{segmentType:t.type||"lecture",segment:t,lang:s,readOnly:n,onPatch:u}}),e.jsx(G,{slot:"editor.timeline_segment",slotProps:{segment:t,lang:s,readOnly:n,onPatch:u}})]})]})}function Et({config:s,lang:t,initialData:n,onConfirm:u,onCancel:p}){const[a,i]=x.useState(()=>({...n})),[N,f]=x.useState({}),y=s.icon,h=ee[s.color];x.useEffect(()=>{let o=!1;const m=s.editFields.filter(v=>v.kind==="select"&&v.loadOptions);if(m.length!==0)return Promise.all(m.map(async v=>{try{const w=await v.loadOptions();return[v.key,w]}catch{return[v.key,[]]}})).then(v=>{o||f(Object.fromEntries(v))}),()=>{o=!0}},[s]);const b=(o,m)=>{i(v=>({...v,[o]:m}))},k=Array.isArray(a.options)?a.options:[],c=(o,m)=>{i(v=>({...v,options:k.map((w,I)=>I===o?m:w)}))};return e.jsx("div",{className:"fixed inset-0 bg-gray-900/40 backdrop-blur-sm flex items-center justify-center p-6 z-50",children:e.jsxs("div",{className:"bg-white border text-gray-900 border-gray-200 rounded-2xl shadow-2xl w-full max-w-md flex flex-col overflow-hidden",children:[e.jsxs("div",{className:"p-4 border-b border-gray-100 flex items-center justify-between bg-gray-50/80",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:`p-2 rounded-xl ${h.iconBg} ${h.iconText}`,children:y?e.jsx(y,{size:18}):null}),e.jsx("h2",{className:"font-bold text-gray-800 text-base",children:t==="zh"?`编辑:${s.labelZh}`:`Edit: ${s.labelEn}`})]}),e.jsx("button",{onClick:p,className:"text-gray-400 hover:text-gray-600 font-bold p-1 hover:bg-gray-200 rounded transition-colors text-lg",children:"×"})]}),e.jsx("div",{className:"p-5 space-y-4",children:s.editFields.length===0?e.jsx("p",{className:"text-sm text-gray-500 leading-relaxed",children:t==="zh"?"该组件无需预编辑内容,确认后即可添加到画板。":"No content to edit for this component. Confirm to add it to the board."}):s.editFields.map(o=>e.jsxs("div",{className:"space-y-1.5",children:[e.jsx("label",{className:"text-xs font-semibold text-gray-600",children:t==="zh"?o.labelZh:o.labelEn}),o.kind==="options"?e.jsx("div",{className:"grid grid-cols-2 gap-2",children:k.map((m,v)=>e.jsx("input",{value:m,onChange:w=>c(v,w.target.value),placeholder:`${String.fromCharCode(65+v)}`,className:"border border-gray-200 rounded-lg px-3 py-2 text-sm focus:outline-none focus:ring-2 focus:ring-indigo-500"},v))}):o.kind==="textarea"?e.jsx("textarea",{value:a[o.key]??"",onChange:m=>b(o.key,m.target.value),placeholder:t==="zh"?o.placeholderZh:o.placeholderEn,rows:5,className:`w-full border border-gray-200 rounded-lg px-3 py-2 text-sm focus:outline-none focus:ring-2 focus:ring-indigo-500 resize-y ${o.key==="code"||o.key==="markdown"?"font-mono text-[12px]":""}`}):o.kind==="select"?e.jsxs("select",{value:a[o.key]??"",onChange:m=>b(o.key,m.target.value),className:"w-full border border-gray-200 rounded-lg px-3 py-2 text-sm focus:outline-none focus:ring-2 focus:ring-indigo-500 bg-white",children:[e.jsx("option",{value:"",children:t==="zh"?"— 不选择 —":"— None —"}),(N[o.key]??o.options??[]).map(m=>e.jsx("option",{value:m.value,children:m.label},m.value))]}):e.jsx("input",{type:"text",value:a[o.key]??"",onChange:m=>b(o.key,m.target.value),placeholder:t==="zh"?o.placeholderZh:o.placeholderEn,className:"w-full border border-gray-200 rounded-lg px-3 py-2 text-sm focus:outline-none focus:ring-2 focus:ring-indigo-500"})]},o.key))}),e.jsxs("div",{className:"p-4 border-t border-gray-100 flex justify-end gap-2",children:[e.jsx("button",{onClick:p,className:"px-4 py-2 text-sm rounded-lg border border-gray-200 text-gray-600 hover:bg-gray-100 cursor-pointer",children:t==="zh"?"取消":"Cancel"}),e.jsx("button",{onClick:()=>u(a),className:"px-4 py-2 text-sm rounded-lg bg-indigo-600 text-white hover:bg-indigo-700 cursor-pointer",children:t==="zh"?"添加到画板":"Add to Board"})]})]})})}class Tt{constructor(t){this.lessonId=null,this.debounceDelay=800,this.status="none",this.lastSavedTime=null,this.pendingMap=new Map,this.timer=null,this.isFlushing=!1,this.lastError=null,this.saveHandler=null,this.interceptors=new Set,this.listeners=new Set,t?.debounceDelay!==void 0&&(this.debounceDelay=t.debounceDelay),t?.saveHandler&&(this.saveHandler=t.saveHandler)}setLessonId(t){this.lessonId!==t&&(this.pendingMap.size>0&&this.lessonId&&this.flush(),this.lessonId=t,this.status=t?"saved":"none",this.notifyListeners())}getLessonId(){return this.lessonId}setSaveHandler(t){this.saveHandler=t}setDebounceDelay(t){this.debounceDelay=Math.max(100,t)}getDebounceDelay(){return this.debounceDelay}getStatus(){return this.status}getLastSavedTime(){return this.lastSavedTime}getPendingCount(){return this.pendingMap.size}getLastError(){return this.lastError}registerInterceptor(t){return this.interceptors.add(t),()=>{this.interceptors.delete(t)}}registerListener(t){return this.listeners.add(t),t(this.status,{lessonId:this.lessonId||void 0,lastSavedTime:this.lastSavedTime,count:this.pendingMap.size}),()=>{this.listeners.delete(t)}}notifyListeners(){this.listeners.forEach(t=>{try{t(this.status,{lessonId:this.lessonId||void 0,lastSavedTime:this.lastSavedTime,error:this.lastError,count:this.pendingMap.size})}catch(n){console.error("[WhiteboardAutoSaveManager] Listener error:",n)}})}queueUpdate(t,n){if(!this.lessonId)return;const u=this.pendingMap.get(t)||{};this.pendingMap.set(t,{...u,...n}),this.status="pending",this.notifyListeners(),ie.publish({id:oe(),type:"whiteboard.autosave.pending",source:"whiteboard.autosave",payload:{lessonId:this.lessonId,elementId:t,pendingCount:this.pendingMap.size},timestamp:Date.now(),correlationId:this.lessonId}),this.timer&&clearTimeout(this.timer),this.timer=setTimeout(()=>{this.flush()},this.debounceDelay)}async flush(){if(this.timer&&(clearTimeout(this.timer),this.timer=null),this.pendingMap.size===0||!this.lessonId||!this.saveHandler)return this.status==="pending"&&(this.status="saved",this.notifyListeners()),!0;if(this.isFlushing)return!1;let t=!1;const n={lessonId:this.lessonId,pendingElements:new Map(this.pendingMap),cancel:()=>{t=!0}};for(const i of this.interceptors)try{if(await i(n)===!1||t){t=!0;break}}catch(N){console.error("[WhiteboardAutoSaveManager] Interceptor error:",N)}if(t)return!1;this.isFlushing=!0,this.status="saving",this.notifyListeners(),ie.publish({id:oe(),type:"whiteboard.autosave.saving",source:"whiteboard.autosave",payload:{lessonId:this.lessonId,pendingCount:this.pendingMap.size},timestamp:Date.now(),correlationId:this.lessonId});const u=Array.from(this.pendingMap.entries()),p=[];let a=!1;try{for(const[i,N]of u)await this.saveHandler(this.lessonId,i,N)?(p.push(i),this.pendingMap.get(i)===N&&this.pendingMap.delete(i)):a=!0;if(a)throw new Error("One or more element updates failed to save");return this.lastSavedTime=new Date,this.lastError=null,this.status=this.pendingMap.size>0?"pending":"saved",this.notifyListeners(),ie.publish({id:oe(),type:"whiteboard.autosave.saved",source:"whiteboard.autosave",payload:{lessonId:this.lessonId,savedElementIds:p,lastSavedTime:this.lastSavedTime.toISOString()},timestamp:Date.now(),correlationId:this.lessonId}),!0}catch(i){return this.lastError=i,this.status="error",this.notifyListeners(),ie.publish({id:oe(),type:"whiteboard.autosave.error",source:"whiteboard.autosave",payload:{lessonId:this.lessonId,error:i?.message||String(i)},timestamp:Date.now(),correlationId:this.lessonId}),!1}finally{this.isFlushing=!1,this.pendingMap.size>0&&!this.timer&&(this.timer=setTimeout(()=>{this.flush()},this.debounceDelay))}}cancel(){this.timer&&(clearTimeout(this.timer),this.timer=null),this.pendingMap.clear(),this.status=this.lessonId?"saved":"none",this.lastError=null,this.notifyListeners()}}const L=new Tt;function Dt({lessonId:s,onSaveToServer:t,debounceDelay:n=800,onStatusChange:u}){const[p,a]=x.useState(()=>L.getStatus()),[i,N]=x.useState(()=>L.getLastSavedTime()),[f,y]=x.useState(()=>L.getPendingCount()),h=x.useRef(t);h.current=t;const b=x.useRef(u);b.current=u,x.useEffect(()=>{L.setLessonId(s),L.setDebounceDelay(n),L.setSaveHandler(async(m,v,w)=>h.current(m,v,w))},[s,n]),x.useEffect(()=>{const m=L.registerListener((v,w)=>{a(v),w?.lastSavedTime!==void 0&&N(w.lastSavedTime),w?.count!==void 0&&y(w.count),b.current?.(v,w?.lastSavedTime??null)});return()=>{m()}},[]),x.useEffect(()=>{const m=()=>{L.getPendingCount()>0&&L.flush()};return window.addEventListener("beforeunload",m),()=>{window.removeEventListener("beforeunload",m),L.flush()}},[]);const k=x.useCallback((m,v)=>{L.queueUpdate(m,v)},[]),c=x.useCallback(async()=>L.flush(),[]),o=x.useCallback(()=>{L.cancel()},[]);return{status:p,lastSavedTime:i,pendingCount:f,queueUpdate:k,flush:c,cancel:o,registry:L}}function Ot(){const s=Ge(),{lang:t,session:n,onCopyCourse:u,lessons:p,selectedLesson:a,activeRole:i,setActiveRole:N,editorSaveStatus:f,setEditorSaveStatus:y,editorLastSavedTime:h,setEditorLastSavedTime:b,setTeacherTab:k,handlePaletteActivate:c,timelineSegments:o,activeSegmentId:m,setActiveSegmentId:v,draggedSegmentIdx:w,setDraggedSegmentIdx:I,saveTimeline:A,editorPanelsExpanded:_,setEditorPanelsExpanded:M,fetchElements:g,whiteboardRef:j,elements:S,paletteEdit:F,handlePaletteConfirm:Q,setPaletteEdit:P}=We(),Z=Ce(r=>r.session),E=n||Z,T=p.find(r=>r.id===a),J=E?.username==="admin"||E?.userId==="usr_admin"||E?.role==="administrator"||E?.subRole==="administrator",W=!T?.creator_id||T.creator_id===E?.userId||T.creator_id===E?.username,V=J||W,R=!V||i!=="teacher",[le,ce]=x.useState(!1),[H,te]=x.useState([]),[de,se]=x.useState(0),[Y,re]=x.useState(null),B=x.useRef(null),U=x.useRef(null);x.useEffect(()=>{Y||(B.current=null,U.current=null)},[Y]),x.useEffect(()=>{if(!s)return;const r=s.getDispatcher?.();if(!r)return;const d=r.registerHandler("host:refresh",async z=>{const C=z.action.payload.target;if(C==="lessons"||C==="all")return a&&g&&await g(a),{success:!0,refreshed:["lessons"]}});return()=>{d.dispose()}},[s,a,g]);const K=async(r,d,z)=>{try{return(await fetch(`/api/lessons/${r}/whiteboard/${d}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({data:z})})).ok}catch(C){return console.error("[LessonEditorView] autosave element failed:",C),!1}},{queueUpdate:O,flush:D,pendingCount:q}=Dt({lessonId:a,onSaveToServer:K,debounceDelay:800,onStatusChange:(r,d)=>{r!=="pending"&&y(r),d&&b(d)}}),X=x.useCallback((r,d)=>{const z=B.current||U.current;return z?z.type==="page"?((async()=>(await j.current?.moveElementToPage?.(d,z.pageIndex),a&&(await D(),await g(a))))(),!0):z.type==="segment"?((async()=>(await j.current?.moveElementToSegment?.(d,z.segmentId),a&&(await D(),await g(a))))(),!0):!1:!1},[j,a,D,g]);x.useEffect(()=>{if(!a)return;const r=new He;return r.broadcastChangeLesson(a),m&&r.broadcastChangeSegment(m),()=>{r.destroy()}},[a,m]);const l=r=>{if(R){alert(V?t==="zh"?"学生视角预览为只读模式。":"Student preview is read-only.":t==="zh"?"【只读模式】您无法直接修改其他教师创建的课程。请点击上方的「一键克隆为我的备课」生成您的专属教案副本。":"[Read-Only Mode] You cannot modify lessons created by other teachers. Please clone it to your own lessons.");return}c(r)};return e.jsxs("div",{className:"flex-1 flex flex-col min-h-0 min-w-0 bg-surface rounded-2xl border border-theme overflow-hidden shadow-sm text-main transition-colors",children:[e.jsxs("div",{className:"px-4 py-2.5 border-b border-theme flex flex-wrap items-center justify-between gap-3 shrink-0 bg-surface/85 backdrop-blur-md",children:[e.jsxs("div",{className:"flex items-center gap-3 min-w-0 flex-wrap",children:[e.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[e.jsx("div",{className:"w-8 h-8 rounded-xl bg-primary-theme/10 text-primary-theme border border-primary-theme/20 flex items-center justify-center shrink-0",children:e.jsx(lt,{size:16})}),e.jsxs("div",{className:"flex flex-col min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-[10px] font-black uppercase tracking-wider text-primary-theme",children:t==="zh"?"教案与白板编排":"Lesson Orchestrator"}),R&&e.jsx("span",{className:"text-[9px] px-1.5 py-0.2 rounded-full font-bold bg-amber-500/15 text-amber-600 border border-amber-500/30",children:t==="zh"?"只读预览":"Read-Only Preview"})]}),e.jsx("h2",{className:"text-xs sm:text-sm font-black text-main truncate tracking-tight",children:t==="zh"?`课程编辑器: ${T?.title||"未选择课程"}`:`Lesson Editor: ${T?.title||"No Lesson Selected"}`})]})]}),a&&e.jsxs("div",{className:"hidden sm:flex items-center gap-1.5 shrink-0",children:[q>0&&f!=="saving"&&e.jsxs("button",{type:"button",onClick:()=>void D(),title:t==="zh"?"有未保存改动,点击立即写入服务器":"Pending changes, click to sync now",className:"flex items-center gap-1.5 text-xs font-bold text-amber-700 dark:text-amber-300 bg-amber-500/10 hover:bg-amber-500/20 border border-amber-500/30 px-2.5 py-1 rounded-full transition-all cursor-pointer shadow-2xs hover:scale-102",children:[e.jsx(ke,{size:11,className:"animate-spin text-amber-600"}),e.jsx("span",{children:t==="zh"?`${q} 项待写入 (点击立即保存)`:`${q} pending (sync now)`})]}),f==="saving"&&e.jsxs("div",{className:"flex items-center gap-1.5 text-xs font-bold text-amber-700 dark:text-amber-300 bg-amber-500/10 border border-amber-500/30 px-2.5 py-1 rounded-full animate-pulse shadow-2xs",children:[e.jsx(ke,{size:11,className:"animate-spin text-amber-600"}),e.jsx("span",{children:t==="zh"?"同步 SQLite...":"Saving SQLite..."})]}),f==="saved"&&q===0&&e.jsxs("div",{className:"flex items-center gap-1.5 text-xs font-bold text-emerald-700 dark:text-emerald-300 bg-emerald-500/10 border border-emerald-500/30 px-2.5 py-1 rounded-full shadow-2xs",children:[e.jsx(De,{size:11,className:"text-emerald-500"}),e.jsx("span",{children:t==="zh"?"已自动保存":"Auto-Saved"}),h&&e.jsx("span",{className:"text-[11px] font-mono opacity-70",children:h.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit",second:"2-digit"})})]}),f==="error"&&e.jsxs("div",{className:"flex items-center gap-1.5 text-xs font-bold text-rose-600 bg-rose-500/10 border border-rose-500/30 px-2.5 py-1 rounded-full shadow-2xs",children:[e.jsx(Ee,{size:11,className:"text-rose-600"}),e.jsx("span",{children:t==="zh"?"写入失败":"Failed to save"})]}),f==="none"&&q===0&&e.jsxs("div",{className:"flex items-center gap-1.5 text-xs font-bold text-muted bg-surface-secondary border border-theme px-2.5 py-1 rounded-full shadow-2xs",children:[e.jsx(ct,{size:11,className:"text-muted"}),e.jsx("span",{children:t==="zh"?"同步就绪":"Ready"})]}),e.jsx(G,{slot:"whiteboard.autosave.status",slotProps:{lessonId:a,status:f,pendingCount:q,lastSavedTime:h}}),e.jsx(G,{slot:"whiteboard.autosave.action",slotProps:{lessonId:a,flush:D,pendingCount:q}})]})]}),e.jsxs("div",{className:"flex items-center gap-2 shrink-0",children:[e.jsxs("div",{className:"bg-surface-secondary border border-theme p-1 rounded-xl flex items-center gap-1 shadow-2xs",children:[e.jsxs("button",{type:"button",onClick:()=>N("teacher"),className:`px-3 py-1 text-xs font-bold rounded-lg transition-all cursor-pointer flex items-center gap-1.5 ${i==="teacher"?"bg-surface text-primary-theme font-black shadow-xs border border-theme/60 scale-102":"text-muted hover:text-main"}`,title:t==="zh"?"在当前窗口切回教师编辑视角":"Switch back to the teacher editor view",children:[e.jsx("span",{children:"👨‍🏫"}),e.jsx("span",{children:t==="zh"?"教师视角":"Teacher"})]}),e.jsxs("button",{type:"button",onClick:()=>{const r=`${window.location.origin}${window.location.pathname}?mode=student_preview&lessonId=${encodeURIComponent(a||"")}#/student_preview`;window.open(r,"_blank")||alert(t==="zh"?"新标签页被浏览器拦截,请允许本站打开弹出窗口后重试。":"The new tab was blocked. Please allow pop-ups for this site and retry.")},className:`px-3 py-1 text-xs font-bold rounded-lg transition-all cursor-pointer flex items-center gap-1.5 ${i==="student"?"bg-primary-theme text-white font-black shadow-xs scale-102":"text-muted hover:text-main"}`,title:t==="zh"?"在新标签页中以学生身份预览本课节(不影响当前备课窗口)":"Open a student-perspective preview of this lesson in a new tab",children:[e.jsx("span",{children:"🎓"}),e.jsx("span",{children:t==="zh"?"学生视角":"Student"})]})]}),e.jsx(G,{slot:"editor.header.action",slotProps:{lessonId:a,currentLesson:T,lang:t,isReadOnly:R,activeRole:i,onSave:K}}),e.jsx("button",{type:"button",onClick:()=>k("courses"),className:"px-3 py-1.5 bg-surface hover:bg-surface-secondary border border-theme text-muted hover:text-main text-xs font-bold rounded-xl transition-all cursor-pointer shadow-2xs hover:scale-102",children:t==="zh"?"返回课程库":"Back to Courses"})]})]}),!V&&T&&e.jsxs("div",{className:"bg-amber-500/10 border-b border-amber-500/20 px-4 py-2.5 flex items-center justify-between text-xs text-amber-800 dark:text-amber-300 backdrop-blur-xs shrink-0",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(dt,{size:15,className:"text-amber-500 shrink-0"}),e.jsx("span",{children:t==="zh"?`【他人课程只读模式】当前课程由教师「${T.creator_name||T.creator_id}」创建。您拥有完整查看与备课参考权限。如需编辑调整,请克隆为您的专属教案。`:`[Read-Only Mode] This lesson was created by teacher "${T.creator_name||T.creator_id}". To customize, please clone it.`})]}),u&&e.jsxs("button",{onClick:()=>u(T.id),className:"flex items-center gap-1.5 bg-amber-600 hover:bg-amber-500 text-white font-semibold px-3 py-1.5 rounded-xl shadow-xs transition-all hover:scale-102 cursor-pointer shrink-0",children:[e.jsx(ut,{size:13}),e.jsx("span",{children:t==="zh"?"一键克隆为我的备课":"Clone as My Lesson"})]})]}),e.jsxs("div",{className:"flex-1 flex overflow-hidden",children:[e.jsx(vt,{lang:t,onActivate:l,readOnly:R,collapsed:le,onToggleCollapse:ce,pages:H,currentPage:de,onSwitchPage:r=>j.current?.switchPage?.(r),onAddPage:r=>j.current?.addPage?.(r),onDeletePage:r=>j.current?.deletePage?.(r),onRenamePage:(r,d)=>j.current?.renamePage?.(r,d),dragState:Y,onHoverDropTarget:r=>{B.current=r}}),e.jsxs("div",{className:"flex-1 relative bg-surface flex flex-col min-w-0",children:[e.jsx(jt,{lang:t,segments:o,activeSegmentId:m,setActiveSegmentId:v,draggedSegmentIdx:w,setDraggedSegmentIdx:I,selectedLesson:a,saveTimeline:A,readOnly:R,editorPanelsExpanded:_,setEditorPanelsExpanded:M,dragState:Y,onHoverDropTarget:r=>{U.current=r}}),e.jsxs("div",{className:"flex-1 relative flex flex-col min-w-0 overflow-y-auto",children:[a&&m&&_&&o.some(r=>r.id===m)&&e.jsx(It,{lang:t,segment:o.find(r=>r.id===m),readOnly:R,onPatch:r=>A(a,o.map(d=>d.id===m?{...d,...r}:d)),onDelete:()=>{if(o.length<=1){alert("无法删除!课程必须包含至少一个环节。");return}if(window.confirm(`确定要删除环节"${o.find(r=>r.id===m)?.title}"吗?`)){const r=o.filter(d=>d.id!==m);A(a,r),v(r[0]?.id||null)}}},m),e.jsx("div",{className:"flex-1 min-h-[380px] relative flex flex-col min-w-0",children:a?e.jsxs(e.Fragment,{children:[e.jsx(Ue,{ref:j,lessonId:a,userRole:i,readOnly:R,elements:S,activeSegmentId:m,hidePageBar:!0,onPagesStateChange:({pages:r,currentPage:d})=>{te(r),se(d)},onSegmentSync:r=>v(r),onElementDragChange:re,onElementDropCheck:X,onElementAdd:async(r,d)=>{if(!R){await D(),y("saving");try{(await fetch(`/api/lessons/${a}/whiteboard`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({type:r,data:d})})).ok?(y("saved"),b(new Date),g(a)):y("error")}catch{y("error")}}},onElementUpdate:(r,d)=>{R||O(r,d)},onElementDelete:async r=>{if(!R){await D(),y("saving");try{(await fetch(`/api/lessons/${a}/whiteboard/${r}`,{method:"DELETE"})).ok?(y("saved"),b(new Date),g(a)):y("error")}catch{y("error")}}},onClearBoard:async()=>{if(!R){await D(),y("saving");try{(await fetch(`/api/lessons/${a}/whiteboard`,{method:"DELETE"})).ok?(y("saved"),b(new Date),g(a)):y("error")}catch{y("error")}}},onRefresh:()=>g(a)}),F&&!R&&ye(F.type)&&e.jsx(Et,{config:ye(F.type),lang:t,initialData:F.data,onConfirm:Q,onCancel:()=>P(null)})]}):e.jsx("div",{className:"absolute inset-0 flex items-center justify-center text-muted p-8 text-center bg-surface-secondary/50",children:e.jsxs("div",{children:[e.jsx(ht,{size:48,className:"mx-auto mb-4 opacity-30"}),e.jsx("p",{className:"font-medium text-lg text-main mb-2",children:"No active lesson selected"}),e.jsx("p",{className:"text-sm",children:"Please select a lesson from the Dashboard to orchestrate."})]})})})]})]})]})]})}export{Ot as LessonEditorView};
@@ -1 +0,0 @@
1
- import{j as e}from"./vendor-react-Kv_JATwr.js";import{m as n}from"./index-BBznBaN5.js";import{a2 as d,o,$ as l,aQ as i}from"./vendor-icons-hc6MjYFv.js";import"./vendor-utils-aM7aYvPP.js";import"./vendor-pdf-By0fofA0.js";import"./vendor-motion-BFAPOs-b.js";import"./vendor-charts-SrpBsvM3.js";function y({notification:s,onClose:t,lang:r,onOpenWorkspace:a}){return s?e.jsx("div",{className:"fixed inset-0 bg-gray-900/40 backdrop-blur-sm flex items-center justify-center p-6 z-50",children:e.jsxs(n.div,{initial:{opacity:0,scale:.95},animate:{opacity:1,scale:1},exit:{opacity:0,scale:.95},className:"bg-white border text-gray-900 border-gray-200 rounded-2xl shadow-2xl w-full max-w-xl flex flex-col overflow-hidden max-h-[85vh] font-sans",children:[e.jsxs("div",{className:"p-4 border-b border-gray-100 flex items-center justify-between bg-gray-50/80 shrink-0",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(d,{className:"text-indigo-600 font-sans shrink-0",size:20}),e.jsx("h2",{className:"font-bold text-gray-800 text-base font-sans truncate",children:s.title})]}),e.jsx("button",{onClick:t,className:"text-gray-400 hover:text-gray-600 font-bold p-1 hover:bg-gray-200 rounded transition-colors text-lg",children:"×"})]}),e.jsxs("div",{className:"flex-1 overflow-y-auto p-6 space-y-4",children:[e.jsx("div",{className:"p-4 bg-indigo-50/50 rounded-xl border border-indigo-100 text-sm text-gray-700 leading-relaxed font-sans",children:s.message}),s.assignment&&e.jsxs("div",{className:"space-y-4 font-sans",children:[e.jsxs("div",{className:"border border-gray-150 rounded-xl p-4 bg-gray-50/50 space-y-3",children:[e.jsxs("div",{className:"flex justify-between items-center",children:[e.jsx("span",{className:"text-xs text-gray-400 uppercase tracking-wider font-semibold font-sans",children:r==="zh"?"关联作业":"Associated Assignment"}),s.assignment.submission_status==="graded"&&e.jsx("span",{className:"bg-green-100 border border-green-200 text-green-800 text-xs font-bold px-2.5 py-1 rounded-full shadow-sm font-mono",children:r==="zh"?`得分:${s.assignment.score}%`:`Score: ${s.assignment.score}%`})]}),e.jsxs("div",{children:[e.jsx("h4",{className:"font-bold text-base text-indigo-900 font-sans",children:s.assignment.title}),e.jsx("p",{className:"text-xs text-gray-500 mt-1 font-sans",children:s.assignment.class_name})]}),s.assignment.feedback&&e.jsxs("div",{className:"mt-3 bg-white p-3 rounded-lg border border-gray-150 space-y-1 font-sans",children:[e.jsxs("div",{className:"text-xs font-bold text-green-700 flex items-center justify-between gap-2 font-sans",children:[e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx(o,{size:14,className:"font-sans"}),e.jsx("span",{children:r==="zh"?"教师评审意见与反馈":"Teacher Feedback & Recommendations"})]}),s.assignment.graded_at&&e.jsxs("div",{className:"text-xs text-gray-400 font-mono flex items-center gap-1 font-normal select-none",children:[e.jsx(l,{size:11,className:"text-neutral-400"}),e.jsx("span",{children:new Date(s.assignment.graded_at).toLocaleString(r==="zh"?"zh-CN":"en-US",{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"})})]})]}),e.jsx("div",{className:"text-xs text-gray-600 italic bg-green-50/30 p-2 rounded border border-green-50 mt-1 leading-relaxed whitespace-pre-wrap font-sans",children:s.assignment.feedback})]})]}),s.assignment.submission_content&&e.jsxs("div",{className:"space-y-1.5 font-sans",children:[e.jsx("div",{className:"text-xs text-gray-400 font-bold uppercase tracking-wider font-sans",children:r==="zh"?"我提交的内容":"My Submission Content"}),e.jsx("div",{className:"bg-gray-900 text-gray-100 p-4 rounded-xl border border-gray-800 overflow-x-auto max-h-40 overflow-y-auto text-xs font-mono leading-relaxed whitespace-pre-wrap",children:s.assignment.submission_content})]})]})]}),e.jsxs("div",{className:"p-4 border-t border-gray-100 bg-gray-50/85 flex justify-end gap-2.5 shrink-0 font-sans",children:[e.jsx("button",{type:"button",onClick:t,className:"px-4 py-2 text-xs font-semibold border border-gray-200 text-gray-700 bg-white rounded-lg hover:bg-gray-100 transition-colors cursor-pointer",children:r==="zh"?"关闭":"Close"}),s.assignment&&e.jsxs("button",{type:"button",onClick:()=>a(s.assignment),className:"px-4 py-2 text-xs font-bold bg-indigo-600 text-white border border-indigo-700 rounded-lg hover:bg-indigo-700 hover:shadow shadow-sm transition-all cursor-pointer flex items-center gap-1.5 font-sans",children:[e.jsx(i,{size:14,className:"font-sans"}),r==="zh"?"打开画布 / 查看详情":"Open Workspace Canvas"]})]})]})}):null}export{y as NotificationDetailModal};