openlearn-next 0.3.22 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -0
- package/dist/assets/AdminDirectoryView-DY--WM5Z.js +1 -0
- package/dist/assets/{BatchPickerModal-C9FH3J57.js → BatchPickerModal-BobcoTtn.js} +1 -1
- package/dist/assets/ClassesView-DtO0PJXQ.js +22 -0
- package/dist/assets/ClassroomCountdownWidget-AWnCu4JJ.js +2 -0
- package/dist/assets/CloudDriveModal-Dr4kDySU.js +1 -0
- package/dist/assets/ComputerLabView-1qWDNRQ2.js +1 -0
- package/dist/assets/CourseManagement-DtInD0J-.js +1 -0
- package/dist/assets/CourseWizardModal-B16QBckO.js +3 -0
- package/dist/assets/CoursewareHubPanel-CaEizhxl.js +1 -0
- package/dist/assets/Dashboard-D1gZ_4NI.js +8 -0
- package/dist/assets/{ExportWeightModal-C4d-0uTM.js → ExportWeightModal-UPsVax6L.js} +1 -1
- package/dist/assets/HelpTour-CMJbbGne.js +1 -0
- package/dist/assets/{HelpView-B9Pny6u9.js → HelpView-BryOHwLE.js} +4 -4
- package/dist/assets/{ImportLessonsModal-hKRuw9p4.js → ImportLessonsModal-Dnx_QR0Z.js} +1 -1
- package/dist/assets/{ImportModal-CVXHZ1Ei.js → ImportModal-D7L-KNhZ.js} +1 -1
- package/dist/assets/{InteractiveCoursewareViewer-DMMAs2k_.js → InteractiveCoursewareViewer-BYMKvIHi.js} +1 -1
- package/dist/assets/InteractiveWhiteboard-550JMFBu.js +77 -0
- package/dist/assets/LazyCourseware-CLHWQJ8g.js +2 -0
- package/dist/assets/LazyWhiteboard-DJWh6sdV.js +2 -0
- package/dist/assets/LessonEditorView-DRwi0sjA.js +1 -0
- package/dist/assets/LiveClassroomView-DgN2Zqe6.js +59 -0
- package/dist/assets/{NotificationDetailModal-1MOkBDr_.js → NotificationDetailModal-CMKHpWX1.js} +1 -1
- package/dist/assets/PluginView-BQVWPofY.js +66 -0
- package/dist/assets/{ProcessLogsModal-gZ9LILYM.js → ProcessLogsModal-DmFXg9mG.js} +1 -1
- package/dist/assets/QuizGeneratorModal-BeaBRn1w.js +1 -0
- package/dist/assets/StudentAssignmentView-Dn4Bgqr2.js +1 -0
- package/dist/assets/StudentLessonView-CMPqL1ia.js +1 -0
- package/dist/assets/StudentPreviewModal-0QSLnD9u.js +1 -0
- package/dist/assets/StudentView-9pjzjJgG.js +2 -0
- package/dist/assets/{SystemResourceLibraryModal-Ce-Dis6M.js → SystemResourceLibraryModal-COrhUd53.js} +1 -1
- package/dist/assets/TeacherView-mP2YucVr.js +2 -0
- package/dist/assets/{TimetableView-0VaTfpz3.js → TimetableView-BQG-rEb5.js} +4 -4
- package/dist/assets/index-C70OJPV_.js +217 -0
- package/dist/assets/index-CvGu7LSj.css +1 -0
- package/dist/assets/{index.es-CkgATcHw.js → index.es-C5eWEO4o.js} +1 -1
- package/dist/assets/{vendor-charts-U9fLlNC_.js → vendor-charts-qLbgF1eL.js} +1 -1
- package/dist/assets/{vendor-icons-30iiuCQb.js → vendor-icons-BRmhY6fg.js} +1 -1
- package/dist/assets/vendor-motion-BFAPOs-b.js +1 -0
- package/dist/assets/{vendor-pdf-Bw0ZQZtM.js → vendor-pdf-D7rGevI1.js} +3 -2
- package/dist/index.html +12 -13
- package/dist/server.cjs +4955 -623
- package/package.json +9 -4
- package/dist/assets/AdminDirectoryView-D-AOtp1o.js +0 -1
- package/dist/assets/ClassesView-DTuyCvYd.js +0 -19
- package/dist/assets/CloudDriveModal-Bi-aMuax.js +0 -1
- package/dist/assets/ComputerLabView-DWMtMSHV.js +0 -1
- package/dist/assets/CourseManagement-CeelAyst.js +0 -1
- package/dist/assets/CourseWizardModal-m7TDgcB2.js +0 -3
- package/dist/assets/CoursewareHubPanel-C4LQjt4v.js +0 -1
- package/dist/assets/Dashboard-CiBtG7Ge.js +0 -8
- package/dist/assets/HelpTour-00eT17Vg.js +0 -1
- package/dist/assets/InteractiveWhiteboard-jpweQ094.js +0 -77
- package/dist/assets/LazyCourseware-DVgyrg3r.js +0 -2
- package/dist/assets/LazyWhiteboard-BSzsAPXC.js +0 -2
- package/dist/assets/LessonEditorView-D4g48fr5.js +0 -1
- package/dist/assets/LiveClassroomView-HQGhVwd_.js +0 -1
- package/dist/assets/PluginView-D8cQ8mLM.js +0 -65
- package/dist/assets/QuizGeneratorModal-BFCJe1cm.js +0 -1
- package/dist/assets/StudentAssignmentView-C34nleZT.js +0 -1
- package/dist/assets/StudentLessonView-DNbu2o04.js +0 -1
- package/dist/assets/StudentPreviewModal-BXbKzQgo.js +0 -1
- package/dist/assets/StudentView-BF2WjF4_.js +0 -2
- package/dist/assets/TeacherView-BySyCiZG.js +0 -2
- package/dist/assets/index-C7jMgry5.js +0 -216
- package/dist/assets/index-huP36ZNf.css +0 -1
- package/dist/assets/vendor-motion-DjY2czvL.js +0 -1
- /package/dist/assets/{vendor-content-CYR4BTuT.js → purify.es-CYR4BTuT.js} +0 -0
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/InteractiveCoursewareViewer-BYMKvIHi.js","assets/vendor-react-B0t7H3hh.js","assets/vendor-utils-m0Urvtws.js","assets/index-C70OJPV_.js","assets/vendor-icons-BRmhY6fg.js","assets/vendor-pdf-D7rGevI1.js","assets/vendor-motion-BFAPOs-b.js","assets/vendor-pptx-C5-U7ieS.js","assets/vendor-charts-qLbgF1eL.js","assets/index-CvGu7LSj.css"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{_ as a}from"./vendor-pdf-D7rGevI1.js";import{j as e,r}from"./vendor-react-B0t7H3hh.js";const i=r.lazy(()=>a(()=>import("./InteractiveCoursewareViewer-BYMKvIHi.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9])));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};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/InteractiveWhiteboard-550JMFBu.js","assets/vendor-react-B0t7H3hh.js","assets/vendor-utils-m0Urvtws.js","assets/vendor-konva-CEOq4dcl.js","assets/index-C70OJPV_.js","assets/vendor-icons-BRmhY6fg.js","assets/vendor-pdf-D7rGevI1.js","assets/vendor-motion-BFAPOs-b.js","assets/vendor-pptx-C5-U7ieS.js","assets/vendor-charts-qLbgF1eL.js","assets/index-CvGu7LSj.css","assets/vendor-reveal-DcQQzuI9.css"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{_ as s}from"./vendor-pdf-D7rGevI1.js";import{r as t,j as e}from"./vendor-react-B0t7H3hh.js";const i=t.lazy(()=>s(()=>import("./InteractiveWhiteboard-550JMFBu.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11])).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};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{j as e,r as g}from"./vendor-react-B0t7H3hh.js";import{C as H,b as ue,P as pe,c as be,f as U,a as fe,d as ge,E as Y,g as K}from"./index-C70OJPV_.js";import{L as ye}from"./LazyWhiteboard-DJWh6sdV.js";import{x as ve,O as ae,aR as je,aS as X,aT as we,aF as Ne,X as ne,F as Q,f as oe,N as ze,b as ke,ag as Ce,u as Te,aU as Ee,a2 as Se,r as W,aV as $e,au as De,n as Ie,aD as Me,g as Pe,T as Ae,_ as ee,h as _e,P as Re,a5 as Fe,z as te,t as Le,aB as Oe,E as Ze,a4 as He,j as Ue,at as Be}from"./vendor-icons-BRmhY6fg.js";import{v as B}from"./vendor-pptx-C5-U7ieS.js";import"./vendor-utils-m0Urvtws.js";import"./vendor-pdf-D7rGevI1.js";import"./vendor-motion-BFAPOs-b.js";import"./vendor-charts-qLbgF1eL.js";function se({config:t,lang:s,onActivate:m,disabled:u=!1,isFavorite:a=!1,onToggleFavorite:n}){const p=t.icon||ve,b=H[t.color]||H.indigo;return e.jsxs("div",{draggable:!u,onDragStart:l=>{if(u){l.preventDefault();return}const v={type:t.type,...t.defaultData},w=JSON.stringify(v);l.dataTransfer.effectAllowed="copy",l.dataTransfer.setData("application/json",w),l.dataTransfer.setData("text/plain",w)},onClick:()=>!u&&m(t.type),title:u?s==="zh"?"当前为只读模式":"Read-only mode":s==="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"} ${b.cardHoverBorder} ${b.cardHoverRing} ${b.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 ${b.iconBg} ${b.iconText} transition-transform group-hover:scale-105 shrink-0`,children:e.jsx(p,{size:16})}),n&&e.jsx("button",{type:"button",onClick:l=>{l.stopPropagation(),n(t.type,l)},className:`p-1 rounded-md transition-colors ${a?"text-amber-400 opacity-100":"text-slate-300 opacity-0 group-hover:opacity-100 hover:text-amber-400 hover:bg-surface-secondary"}`,title:a?s==="zh"?"取消收藏":"Remove favorite":s==="zh"?"收藏组件":"Add favorite",children:e.jsx(ae,{size:13,className:a?"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:s==="zh"?t.labelZh:t.labelEn}),e.jsx("span",{className:"text-xs text-muted leading-tight mt-0.5 truncate",children:s==="zh"?t.descriptionZh:t.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"})})]})}function Ge({lang:t,onActivate:s,readOnly:m=!1,collapsed:u,onToggleCollapse:a}){const[n,p]=g.useState(!1),b=u!==void 0?u:n,l=()=>{const o=!b;p(o),a&&a(o)},[v,w]=g.useState(""),[f,k]=g.useState("all"),[T,d]=g.useState(()=>{try{const o=localStorage.getItem("openlearn_palette_favs");return o?JSON.parse(o):[]}catch{return[]}}),[h,c]=g.useState(()=>{try{const o=localStorage.getItem("openlearn_palette_recent");return o?JSON.parse(o):[]}catch{return[]}}),[r,y]=g.useState({}),E=o=>{m||(c(x=>{const j=[o,...x.filter(I=>I!==o)].slice(0,6);try{localStorage.setItem("openlearn_palette_recent",JSON.stringify(j))}catch{}return j}),s(o))},D=(o,x)=>{x.stopPropagation(),d(j=>{const _=j.includes(o)?j.filter(M=>M!==o):[...j,o];try{localStorage.setItem("openlearn_palette_favs",JSON.stringify(_))}catch{}return _})},P=o=>{y(x=>({...x,[o]:!x[o]}))},F=ue(),A=[...pe,...F],C=A.filter(o=>{if(v.trim()){const x=v.toLowerCase(),j=o.labelZh.toLowerCase().includes(x)||o.descriptionZh.toLowerCase().includes(x),I=o.labelEn.toLowerCase().includes(x)||o.descriptionEn.toLowerCase().includes(x);if(!j&&!I)return!1}return f==="favorites"?T.includes(o.type):f==="recent"?h.includes(o.type):!0});return b?e.jsxs("div",{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",children:[e.jsx("button",{type:"button",onClick:l,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:t==="zh"?"展开备课组件库 (Ctrl+B)":"Expand Component Palette",children:e.jsx(je,{size:16})}),e.jsx("div",{className:"w-8 h-px bg-border/60 my-0.5"}),e.jsx("div",{className:"flex flex-col gap-2 overflow-y-auto max-h-[calc(100vh-220px)] p-0.5",children:A.slice(0,8).map(o=>{const x=o.icon||X;return e.jsx("button",{type:"button",onClick:()=>E(o.type),disabled:m,"aria-disabled":m,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 ${m?"opacity-50 cursor-not-allowed":"hover:bg-primary-theme/10 hover:border-primary-theme cursor-pointer"}`,title:`${t==="zh"?o.labelZh:o.labelEn} - ${t==="zh"?"点击配置":"Configure"}`,children:e.jsx(x,{size:16,className:"text-primary-theme transition-transform group-hover:scale-110"})},o.type)})})]}):e.jsxs("div",{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",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(X,{size:15})}),e.jsxs("div",{children:[e.jsx("h3",{className:"text-xs font-black text-main uppercase tracking-wider",children:t==="zh"?"备课组件画板":"Palette"}),e.jsxs("span",{className:"text-[10px] text-muted",children:[C.length," ",t==="zh"?"个可用组件":"components"]})]})]}),e.jsx("button",{type:"button",onClick:l,className:"p-1.5 rounded-lg text-muted hover:text-main hover:bg-surface border border-theme/50 transition-colors cursor-pointer",title:t==="zh"?"收起组件面板以扩大画布":"Collapse Palette",children:e.jsx(we,{size:14})})]}),e.jsxs("div",{className:"relative",children:[e.jsx(Ne,{size:13,className:"absolute left-2.5 top-1/2 -translate-y-1/2 text-muted"}),e.jsx("input",{type:"text",value:v,onChange:o=>w(o.target.value),placeholder:t==="zh"?"搜索画板组件...":"Search components...",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"}),v&&e.jsx("button",{onClick:()=>w(""),className:"absolute right-2.5 top-1/2 -translate-y-1/2 text-muted hover:text-main cursor-pointer",children:e.jsx(ne,{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:()=>k("all"),className:`flex-1 py-1 text-xs rounded-lg transition-all cursor-pointer ${f==="all"?"bg-surface-secondary text-main font-bold shadow-2xs":"text-muted hover:text-main font-medium"}`,children:t==="zh"?"全部":"All"}),e.jsxs("button",{type:"button",onClick:()=>k("favorites"),className:`flex-1 py-1 text-xs rounded-lg transition-all flex items-center justify-center gap-1 cursor-pointer ${f==="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(ae,{size:11,className:f==="favorites"?"fill-amber-500":""}),e.jsx("span",{children:t==="zh"?"常用":"Favs"})]}),e.jsxs("button",{type:"button",onClick:()=>k("recent"),className:`flex-1 py-1 text-xs rounded-lg transition-all flex items-center justify-center gap-1 cursor-pointer ${f==="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(Q,{size:11}),e.jsx("span",{children:t==="zh"?"最近":"Recent"})]})]}),e.jsx("div",{className:"flex-1 flex flex-col gap-3 overflow-y-auto pr-0.5",children:C.length===0?e.jsxs("div",{className:"text-center py-8 text-muted text-xs",children:[e.jsx(oe,{size:24,className:"mx-auto mb-2 opacity-30 text-primary-theme"}),e.jsx("p",{className:"font-bold text-main",children:t==="zh"?"未找到相关组件":"No components found"}),e.jsx("p",{className:"text-[11px] mt-1 text-muted",children:f!=="all"?t==="zh"?"尝试切换回「全部」标签":"Try switching to All tab":t==="zh"?"请更换关键词重新搜索":"Try a different keyword"})]}):f!=="all"||v.trim()?e.jsx("div",{className:"grid grid-cols-2 gap-2",children:C.map(o=>e.jsx(se,{config:o,lang:t,onActivate:E,disabled:m,isFavorite:T.includes(o.type),onToggleFavorite:D},o.type))}):(()=>{const o=[...be];return C.forEach(x=>{o.some(j=>j.id===x.group)||o.push({id:x.group,labelZh:x.group,labelEn:x.group})}),o.map(x=>{const j=C.filter(M=>M.group===x.id);if(j.length===0)return null;const I=H[j[0].color]||H.indigo,_=r[x.id];return e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsxs("button",{type:"button",onClick:()=>P(x.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 ${I.groupAccent}`}),e.jsx("span",{className:`text-[11px] font-black uppercase tracking-wider ${I.groupText}`,children:t==="zh"?x.labelZh:x.labelEn})]}),e.jsxs("div",{className:"flex items-center gap-1 text-muted",children:[e.jsxs("span",{className:"text-[10px] font-mono opacity-80",children:["(",j.length,")"]}),_?e.jsx(ze,{size:12}):e.jsx(ke,{size:12})]})]}),!_&&e.jsx("div",{className:"grid grid-cols-2 gap-2",children:j.map(M=>e.jsx(se,{config:M,lang:t,onActivate:E,disabled:m,isFavorite:T.includes(M.type),onToggleFavorite:D},M.type))})]},x.id)})})()})]})}const q=[{id:"intro",labelZh:"准备环节",labelEn:"Intro",icon:Ce},{id:"lecture",labelZh:"讲授新课",labelEn:"Lecture",icon:Te},{id:"practice",labelZh:"互动练习",labelEn:"Practice",icon:Ee},{id:"quiz",labelZh:"随堂测试",labelEn:"Quiz",icon:Se},{id:"summary",labelZh:"要点总结",labelEn:"Summary",icon:W}],Je=new Map;function Qe(){return[...q,...Array.from(Je.values())]}const G=[{name:"Blue",color:"bg-blue-50 text-blue-700 border-blue-200 hover:bg-blue-100",solid:"bg-blue-500 text-white border-blue-500 shadow-md ring-2 ring-blue-200",rail:"bg-blue-400"},{name:"Indigo",color:"bg-indigo-50 text-indigo-700 border-indigo-200 hover:bg-indigo-100",solid:"bg-indigo-500 text-white border-indigo-500 shadow-md ring-2 ring-indigo-200",rail:"bg-indigo-400"},{name:"Green",color:"bg-green-50 text-green-700 border-green-200 hover:bg-green-100",solid:"bg-green-500 text-white border-green-500 shadow-md ring-2 ring-green-200",rail:"bg-green-400"},{name:"Purple",color:"bg-purple-50 text-purple-700 border-purple-200 hover:bg-purple-100",solid:"bg-purple-500 text-white border-purple-500 shadow-md ring-2 ring-purple-200",rail:"bg-purple-400"},{name:"Amber",color:"bg-amber-50 text-amber-700 border-amber-200 hover:bg-amber-100",solid:"bg-amber-500 text-white border-amber-500 shadow-md ring-2 ring-amber-200",rail:"bg-amber-400"}],We=G[1].color;function qe(t){return Qe().find(s=>s.id===t)||q[1]}function re(t){return G.find(s=>s.color===t)||G[1]}function Ve({lang:t,segments:s,activeSegmentId:m,setActiveSegmentId:u,draggedSegmentIdx:a,setDraggedSegmentIdx:n,selectedLesson:p,saveTimeline:b,readOnly:l=!1,editorPanelsExpanded:v,setEditorPanelsExpanded:w}){const f=s.findIndex(r=>r.id===m),k=s.length>1&&f>=0?f/(s.length-1):0,T=f>=0?re(s[f].color):null,d=s.reduce((r,y)=>{const E=String(y.duration||"10m"),D=parseInt(E.replace(/[^\d]/g,""),10)||10;return r+D},0),h=r=>{if(l)return;if(a===null||a===r){n(null);return}const y=[...s],[E]=y.splice(a,1);y.splice(r,0,E),n(null),p&&b(p,y)},c=()=>{if(l||!p)return;const r="seg-"+Math.random().toString(36).slice(2,9),y={id:r,title:t==="zh"?`新环节 ${s.length+1}`:`Segment ${s.length+1}`,notes:"",type:"lecture",duration:"10m",color:We};b(p,[...s,y]),u(r)};return e.jsxs("div",{className:"relative flex items-center justify-between gap-3 px-3.5 py-2 border-b border-theme bg-surface-secondary/50 backdrop-blur-xs shrink-0 select-none overflow-x-auto text-main",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($e,{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:t==="zh"?"教学流程":"Lesson Flow"}),e.jsxs("span",{className:"text-[10px] font-mono text-muted flex items-center gap-0.5",children:[e.jsx(Q,{size:9}),e.jsxs("span",{children:[d," 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"}),f>=0&&e.jsx("div",{className:`absolute left-3 top-1/2 h-0.5 -translate-y-1/2 rounded-full transition-all duration-300 ${T?.rail||"bg-primary-theme"}`,style:{width:`calc(${k*100}% - 0.5rem)`}}),s.map((r,y)=>{const E=r.id===m,D=f>=0&&y<f,P=a===y,F=qe(r.type),A=re(r.color),C=F.icon,o=E?A.solid+" shadow-md ring-2 ring-primary-theme/30 scale-105":D?"bg-surface-secondary/90 text-main/80 border-primary-theme/30":A.color;return e.jsxs("div",{draggable:!l,onDragStart:x=>{if(l){x.preventDefault();return}n(y),x.dataTransfer.effectAllowed="move"},onDragOver:x=>!l&&x.preventDefault(),onDrop:()=>h(y),onClick:()=>u(r.id),"aria-disabled":l,className:`relative z-10 flex items-center gap-1.5 px-2.5 py-1 rounded-xl text-xs font-semibold ${l?"cursor-pointer":"cursor-grab"} transition-all duration-200 border border-theme/60 shadow-2xs group ${o} ${P?"opacity-40 scale-95":"hover:scale-102"}`,children:[e.jsx(De,{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:y+1}),e.jsx(C,{size:12,className:"shrink-0"}),e.jsx("span",{className:"truncate max-w-[90px]",children:r.title}),e.jsxs("span",{className:"text-[10px] font-mono opacity-60",children:["(",r.duration||"10m",")"]}),D&&e.jsx(W,{size:11,className:"text-emerald-500 shrink-0 ml-0.5"})]},r.id)}),p&&!l&&e.jsxs("button",{type:"button",onClick:c,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:t==="zh"?"追加新环节":"Add new segment",children:[e.jsx(Ie,{size:12}),e.jsx("span",{className:"hidden sm:inline",children:t==="zh"?"加环节":"Add"})]})]}),e.jsxs("button",{type:"button",onClick:()=>w(r=>!r),"aria-expanded":v,className:`px-3 py-1 text-xs font-bold rounded-xl border transition-all flex items-center gap-1.5 cursor-pointer shrink-0 ${v?"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:t==="zh"?"展开/收起环节设置面板":"Toggle Segment Settings",children:[e.jsx(Me,{size:13,className:v?"rotate-90 transition-transform text-white":""}),e.jsx("span",{children:t==="zh"?"环节参数":"Settings"}),v&&e.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-white animate-ping ml-0.5"})]})]})}function Ye({lang:t,segment:s,readOnly:m=!1,onPatch:u,onDelete:a}){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(Pe,{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"}),t==="zh"?`环节参数配置:${s.title}`:`Segment Config: ${s.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(oe,{size:10}),t==="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: ",s.id]})]})]}),m?e.jsx("span",{className:"text-2xs font-semibold text-muted px-2 py-1 rounded-lg border border-theme",children:t==="zh"?"只读":"Read-only"}):e.jsxs("button",{type:"button",onClick:a,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:t==="zh"?"删除当前环节":"Delete Segment",children:[e.jsx(Ae,{size:12}),e.jsx("span",{children:t==="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(ee,{size:11,className:"text-primary-theme"}),e.jsx("span",{children:t==="zh"?"环节名称":"Title"})]}),e.jsx("input",{type:"text",value:s.title||"",onChange:n=>u({title:n.target.value}),disabled:m,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(Q,{size:11,className:"text-primary-theme"}),e.jsx("span",{children:t==="zh"?"预计用时":"Duration"})]}),e.jsx("input",{type:"text",value:s.duration||"10m",onChange:n=>u({duration:n.target.value}),disabled:m,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(_e,{size:11,className:"text-primary-theme"}),e.jsx("span",{children:t==="zh"?"教学形态":"Instructional Type"})]}),e.jsx("select",{value:s.type||"lecture",onChange:n=>u({type:n.target.value}),disabled:m,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:q.map(n=>e.jsx("option",{value:n.id,className:"bg-surface text-main",children:t==="zh"?n.labelZh:n.labelEn},n.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(Re,{size:11,className:"text-primary-theme"}),e.jsx("span",{children:t==="zh"?"环节标识色":"Accent Color"})]}),e.jsx("div",{className:"flex items-center gap-1.5 pt-1",children:G.map(n=>e.jsx("button",{type:"button",onClick:()=>u({color:n.color}),disabled:m,"aria-label":t==="zh"?`选择颜色 ${n.name}`:`Choose color ${n.name}`,className:`w-5 h-5 rounded-full border border-theme/60 transition-all hover:scale-115 cursor-pointer ${n.color.split(" ")[0]} ${s.color===n.color?"ring-2 ring-primary-theme ring-offset-2 scale-110 shadow-xs":""}`,title:n.name},n.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(ee,{size:12,className:"text-amber-500"}),e.jsx("span",{children:t==="zh"?"教师备课备忘 & 教学设计要点":"Instructional Notes"})]}),e.jsx("textarea",{rows:2,value:s.notes||"",onChange:n=>u({notes:n.target.value}),disabled:m,placeholder:t==="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"})]})]})]})}function Ke({config:t,lang:s,initialData:m,onConfirm:u,onCancel:a}){const[n,p]=g.useState(()=>({...m})),[b,l]=g.useState({}),v=t.icon,w=H[t.color];g.useEffect(()=>{let d=!1;const h=t.editFields.filter(c=>c.kind==="select"&&c.loadOptions);if(h.length!==0)return Promise.all(h.map(async c=>{try{const r=await c.loadOptions();return[c.key,r]}catch{return[c.key,[]]}})).then(c=>{d||l(Object.fromEntries(c))}),()=>{d=!0}},[t]);const f=(d,h)=>{p(c=>({...c,[d]:h}))},k=Array.isArray(n.options)?n.options:[],T=(d,h)=>{p(c=>({...c,options:k.map((r,y)=>y===d?h:r)}))};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 ${w.iconBg} ${w.iconText}`,children:e.jsx(v,{size:18})}),e.jsx("h2",{className:"font-bold text-gray-800 text-base",children:s==="zh"?`编辑:${t.labelZh}`:`Edit: ${t.labelEn}`})]}),e.jsx("button",{onClick:a,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:t.editFields.length===0?e.jsx("p",{className:"text-sm text-gray-500 leading-relaxed",children:s==="zh"?"该组件无需预编辑内容,确认后即可添加到画板。":"No content to edit for this component. Confirm to add it to the board."}):t.editFields.map(d=>e.jsxs("div",{className:"space-y-1.5",children:[e.jsx("label",{className:"text-xs font-semibold text-gray-600",children:s==="zh"?d.labelZh:d.labelEn}),d.kind==="options"?e.jsx("div",{className:"grid grid-cols-2 gap-2",children:k.map((h,c)=>e.jsx("input",{value:h,onChange:r=>T(c,r.target.value),placeholder:`${String.fromCharCode(65+c)}`,className:"border border-gray-200 rounded-lg px-3 py-2 text-sm focus:outline-none focus:ring-2 focus:ring-indigo-500"},c))}):d.kind==="textarea"?e.jsx("textarea",{value:n[d.key]??"",onChange:h=>f(d.key,h.target.value),placeholder:s==="zh"?d.placeholderZh:d.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 ${d.key==="code"||d.key==="markdown"?"font-mono text-[12px]":""}`}):d.kind==="select"?e.jsxs("select",{value:n[d.key]??"",onChange:h=>f(d.key,h.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:s==="zh"?"— 不选择 —":"— None —"}),(b[d.key]??d.options??[]).map(h=>e.jsx("option",{value:h.value,children:h.label},h.value))]}):e.jsx("input",{type:"text",value:n[d.key]??"",onChange:h=>f(d.key,h.target.value),placeholder:s==="zh"?d.placeholderZh:d.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"})]},d.key))}),e.jsxs("div",{className:"p-4 border-t border-gray-100 flex justify-end gap-2",children:[e.jsx("button",{onClick:a,className:"px-4 py-2 text-sm rounded-lg border border-gray-200 text-gray-600 hover:bg-gray-100 cursor-pointer",children:s==="zh"?"取消":"Cancel"}),e.jsx("button",{onClick:()=>u(n),className:"px-4 py-2 text-sm rounded-lg bg-indigo-600 text-white hover:bg-indigo-700 cursor-pointer",children:s==="zh"?"添加到画板":"Add to Board"})]})]})})}class Xe{constructor(s){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,s?.debounceDelay!==void 0&&(this.debounceDelay=s.debounceDelay),s?.saveHandler&&(this.saveHandler=s.saveHandler)}setLessonId(s){this.lessonId!==s&&(this.pendingMap.size>0&&this.lessonId&&this.flush(),this.lessonId=s,this.status=s?"saved":"none",this.notifyListeners())}getLessonId(){return this.lessonId}setSaveHandler(s){this.saveHandler=s}setDebounceDelay(s){this.debounceDelay=Math.max(100,s)}getDebounceDelay(){return this.debounceDelay}getStatus(){return this.status}getLastSavedTime(){return this.lastSavedTime}getPendingCount(){return this.pendingMap.size}getLastError(){return this.lastError}registerInterceptor(s){return this.interceptors.add(s),()=>{this.interceptors.delete(s)}}registerListener(s){return this.listeners.add(s),s(this.status,{lessonId:this.lessonId||void 0,lastSavedTime:this.lastSavedTime,count:this.pendingMap.size}),()=>{this.listeners.delete(s)}}notifyListeners(){this.listeners.forEach(s=>{try{s(this.status,{lessonId:this.lessonId||void 0,lastSavedTime:this.lastSavedTime,error:this.lastError,count:this.pendingMap.size})}catch(m){console.error("[WhiteboardAutoSaveManager] Listener error:",m)}})}queueUpdate(s,m){if(!this.lessonId)return;const u=this.pendingMap.get(s)||{};this.pendingMap.set(s,{...u,...m}),this.status="pending",this.notifyListeners(),U.publish({id:B(),type:"whiteboard.autosave.pending",source:"whiteboard.autosave",payload:{lessonId:this.lessonId,elementId:s,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 s=!1;const m={lessonId:this.lessonId,pendingElements:new Map(this.pendingMap),cancel:()=>{s=!0}};for(const p of this.interceptors)try{if(await p(m)===!1||s){s=!0;break}}catch(b){console.error("[WhiteboardAutoSaveManager] Interceptor error:",b)}if(s)return!1;this.isFlushing=!0,this.status="saving",this.notifyListeners(),U.publish({id:B(),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()),a=[];let n=!1;try{for(const[p,b]of u)await this.saveHandler(this.lessonId,p,b)?(a.push(p),this.pendingMap.get(p)===b&&this.pendingMap.delete(p)):n=!0;if(n)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(),U.publish({id:B(),type:"whiteboard.autosave.saved",source:"whiteboard.autosave",payload:{lessonId:this.lessonId,savedElementIds:a,lastSavedTime:this.lastSavedTime.toISOString()},timestamp:Date.now(),correlationId:this.lessonId}),!0}catch(p){return this.lastError=p,this.status="error",this.notifyListeners(),U.publish({id:B(),type:"whiteboard.autosave.error",source:"whiteboard.autosave",payload:{lessonId:this.lessonId,error:p?.message||String(p)},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 z=new Xe;function et({lessonId:t,onSaveToServer:s,debounceDelay:m=800,onStatusChange:u}){const[a,n]=g.useState(()=>z.getStatus()),[p,b]=g.useState(()=>z.getLastSavedTime()),[l,v]=g.useState(()=>z.getPendingCount()),w=g.useRef(s);w.current=s;const f=g.useRef(u);f.current=u,g.useEffect(()=>{z.setLessonId(t),z.setDebounceDelay(m),z.setSaveHandler(async(h,c,r)=>w.current(h,c,r))},[t,m]),g.useEffect(()=>{const h=z.registerListener((c,r)=>{n(c),r?.lastSavedTime!==void 0&&b(r.lastSavedTime),r?.count!==void 0&&v(r.count),f.current?.(c,r?.lastSavedTime??null)});return()=>{h()}},[]),g.useEffect(()=>{const h=()=>{z.getPendingCount()>0&&z.flush()};return window.addEventListener("beforeunload",h),()=>{window.removeEventListener("beforeunload",h),z.flush()}},[]);const k=g.useCallback((h,c)=>{z.queueUpdate(h,c)},[]),T=g.useCallback(async()=>z.flush(),[]),d=g.useCallback(()=>{z.cancel()},[]);return{status:a,lastSavedTime:p,pendingCount:l,queueUpdate:k,flush:T,cancel:d,registry:z}}function ct({lang:t,session:s,onCopyCourse:m,lessons:u,selectedLesson:a,activeRole:n,setActiveRole:p,editorSaveStatus:b,setEditorSaveStatus:l,editorLastSavedTime:v,setEditorLastSavedTime:w,setIsLessonPreviewVisible:f,setPreviewLessonTab:k,setPreviewSelectedCourseware:T,setTeacherTab:d,handlePaletteActivate:h,timelineSegments:c,activeSegmentId:r,setActiveSegmentId:y,draggedSegmentIdx:E,setDraggedSegmentIdx:D,saveTimeline:P,editorPanelsExpanded:F,setEditorPanelsExpanded:A,fetchElements:C,whiteboardRef:o,elements:x,paletteEdit:j,handlePaletteConfirm:I,setPaletteEdit:_}){const M=fe(i=>i.session),L=s||M,S=u.find(i=>i.id===a),ie=L?.username==="admin"||L?.userId==="usr_admin"||L?.role==="administrator"||L?.subRole==="administrator",le=!S?.creator_id||S.creator_id===L?.userId||S.creator_id===L?.username,J=ie||le,$=!J||n!=="teacher",[de,ce]=g.useState(!1),he=async(i,N,Z)=>{try{return(await fetch(`/api/lessons/${i}/whiteboard/${N}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({data:Z})})).ok}catch(V){return console.error("[LessonEditorView] autosave element failed:",V),!1}},{queueUpdate:me,flush:O,pendingCount:R}=et({lessonId:a,onSaveToServer:he,debounceDelay:800,onStatusChange:(i,N)=>{i!=="pending"&&l(i),N&&w(N)}});g.useEffect(()=>{if(!a)return;const i=new ge;i.broadcastChangeLesson(a),r&&i.broadcastChangeSegment(r);const N=i.onMessage(Z=>{Z.type==="STUDENT_HANDSHAKE_REQUEST"&&i.broadcastInitState({selectedLesson:a,activeSegmentId:r,activeTab:"whiteboard",isClassLocked:!1,liveClassTimeRemaining:0,liveClassSelectedClassId:"",liveClassIsActive:!1})});return()=>{N(),i.destroy()}},[a,r]);const xe=i=>{if($){alert(J?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}h(i)};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(Fe,{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"}),$&&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"?`课程编辑器: ${S?.title||"未选择课程"}`:`Lesson Editor: ${S?.title||"No Lesson Selected"}`})]})]}),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:()=>p("teacher"),className:`px-3 py-1 text-xs font-bold rounded-lg transition-all cursor-pointer flex items-center gap-1.5 ${n==="teacher"?"bg-surface text-primary-theme font-black shadow-xs border border-theme/60 scale-102":"text-muted hover:text-main"}`,children:[e.jsx("span",{children:"👨🏫"}),e.jsx("span",{children:t==="zh"?"教师视角":"Teacher"})]}),e.jsxs("button",{type:"button",onClick:()=>p("student"),className:`px-3 py-1 text-xs font-bold rounded-lg transition-all cursor-pointer flex items-center gap-1.5 ${n==="student"?"bg-primary-theme text-white font-black shadow-xs scale-102":"text-muted hover:text-main"}`,children:[e.jsx("span",{children:"🎓"}),e.jsx("span",{children:t==="zh"?"学生视角":"Student"})]})]}),a&&e.jsxs("div",{className:"hidden sm:flex items-center gap-1.5 shrink-0",children:[R>0&&b!=="saving"&&e.jsxs("button",{type:"button",onClick:()=>void O(),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(te,{size:11,className:"animate-spin text-amber-600"}),e.jsx("span",{children:t==="zh"?`${R} 项待写入 (点击立即保存)`:`${R} pending (sync now)`})]}),b==="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(te,{size:11,className:"animate-spin text-amber-600"}),e.jsx("span",{children:t==="zh"?"同步 SQLite...":"Saving SQLite..."})]}),b==="saved"&&R===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(W,{size:11,className:"text-emerald-500"}),e.jsx("span",{children:t==="zh"?"已自动保存":"Auto-Saved"}),v&&e.jsx("span",{className:"text-[11px] font-mono opacity-70",children:v.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit",second:"2-digit"})})]}),b==="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(ne,{size:11,className:"text-rose-600"}),e.jsx("span",{children:t==="zh"?"写入失败":"Failed to save"})]}),b==="none"&&R===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(Le,{size:11,className:"text-muted"}),e.jsx("span",{children:t==="zh"?"同步就绪":"Ready"})]}),e.jsx(Y,{slot:"whiteboard.autosave.status",slotProps:{lessonId:a,status:b,pendingCount:R,lastSavedTime:v}}),e.jsx(Y,{slot:"whiteboard.autosave.action",slotProps:{lessonId:a,flush:O,pendingCount:R}})]})]}),e.jsxs("div",{className:"flex items-center gap-2 shrink-0",children:[a&&e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsxs("button",{type:"button",onClick:()=>{const i=`${window.location.origin}${window.location.pathname}?mode=student_live&lessonId=${encodeURIComponent(a)}#/student_live`;window.open(i,"_blank")},className:"px-3 py-1.5 bg-primary-theme hover:bg-primary-theme-hover text-white text-xs font-bold rounded-xl flex items-center gap-1.5 shadow-2xs transition-all hover:scale-102 cursor-pointer",title:t==="zh"?"在独立浏览器标签页中开启学生视角双屏备课":"Open student perspective in a new independent tab",children:[e.jsx(Oe,{size:13}),e.jsx("span",{children:t==="zh"?"学生视角预览 (独立Tab)":"Student Preview (Tab)"})]}),e.jsx("button",{type:"button",onClick:()=>{f(!0),k("whiteboard"),T(null)},className:"p-2 bg-surface hover:bg-surface-secondary border border-theme text-muted hover:text-main rounded-xl transition-all cursor-pointer shadow-2xs hover:scale-105",title:t==="zh"?"当前窗口快速弹窗预览":"Preview inside modal",children:e.jsx(Ze,{size:14})})]}),e.jsx("button",{type:"button",onClick:()=>d("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"})]})]}),!J&&S&&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(He,{size:15,className:"text-amber-500 shrink-0"}),e.jsx("span",{children:t==="zh"?`【他人课程只读模式】当前课程由教师「${S.creator_name||S.creator_id}」创建。您拥有完整查看与备课参考权限。如需编辑调整,请克隆为您的专属教案。`:`[Read-Only Mode] This lesson was created by teacher "${S.creator_name||S.creator_id}". To customize, please clone it.`})]}),m&&e.jsxs("button",{onClick:()=>m(S.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(Ue,{size:13}),e.jsx("span",{children:t==="zh"?"一键克隆为我的备课":"Clone as My Lesson"})]})]}),e.jsxs("div",{className:"flex-1 flex overflow-hidden",children:[e.jsx(Ge,{lang:t,onActivate:xe,readOnly:$,collapsed:de,onToggleCollapse:ce}),e.jsxs("div",{className:"flex-1 relative bg-surface flex flex-col min-w-0 overflow-y-auto",children:[e.jsx(Ve,{lang:t,segments:c,activeSegmentId:r,setActiveSegmentId:y,draggedSegmentIdx:E,setDraggedSegmentIdx:D,selectedLesson:a,saveTimeline:P,readOnly:$,editorPanelsExpanded:F,setEditorPanelsExpanded:A}),a&&r&&F&&c.some(i=>i.id===r)&&e.jsx(Ye,{lang:t,segment:c.find(i=>i.id===r),readOnly:$,onPatch:i=>P(a,c.map(N=>N.id===r?{...N,...i}:N)),onDelete:()=>{if(c.length<=1){alert("无法删除!课程必须包含至少一个环节。");return}if(window.confirm(`确定要删除环节"${c.find(i=>i.id===r)?.title}"吗?`)){const i=c.filter(N=>N.id!==r);P(a,i),y(i[0]?.id||null)}}},r),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(ye,{ref:o,lessonId:a,userRole:n,readOnly:$,elements:x,activeSegmentId:r,onSegmentSync:i=>y(i),onElementAdd:async(i,N)=>{if(!$){await O(),l("saving");try{(await fetch(`/api/lessons/${a}/whiteboard`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({type:i,data:N})})).ok?(l("saved"),w(new Date),C(a)):l("error")}catch{l("error")}}},onElementUpdate:(i,N)=>{$||me(i,N)},onElementDelete:async i=>{if(!$){await O(),l("saving");try{(await fetch(`/api/lessons/${a}/whiteboard/${i}`,{method:"DELETE"})).ok?(l("saved"),w(new Date),C(a)):l("error")}catch{l("error")}}},onClearBoard:async()=>{if(!$){await O(),l("saving");try{(await fetch(`/api/lessons/${a}/whiteboard`,{method:"DELETE"})).ok?(l("saved"),w(new Date),C(a)):l("error")}catch{l("error")}}},onRefresh:()=>C(a)}),j&&!$&&K(j.type)&&e.jsx(Ke,{config:K(j.type),lang:t,initialData:j.data,onConfirm:I,onCancel:()=>_(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(Be,{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{ct as LessonEditorView};
|