openlearn-next 0.3.1 → 0.3.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (30) hide show
  1. package/cli.mjs +2 -0
  2. package/dist/assets/{BatchPickerModal-of9a5EJz.js → BatchPickerModal-VYKUF5TC.js} +1 -1
  3. package/dist/assets/{ClassesView-CefnsjZ8.js → ClassesView-dDPegGIu.js} +1 -1
  4. package/dist/assets/{CloudDriveModal-DgVQLbO5.js → CloudDriveModal-DiEEoAK5.js} +1 -1
  5. package/dist/assets/{CourseManagement-Cxhc784Q.js → CourseManagement-Dys0J3Xl.js} +1 -1
  6. package/dist/assets/{CourseWizardModal-Da6PKhnU.js → CourseWizardModal-DFZzYcbL.js} +1 -1
  7. package/dist/assets/{Dashboard-LWbFbup4.js → Dashboard-Bnxuy2BQ.js} +1 -1
  8. package/dist/assets/{ExportWeightModal-Cyg1zMEd.js → ExportWeightModal-DPriCEO9.js} +1 -1
  9. package/dist/assets/{HelpView-CvpgBpdr.js → HelpView-CTErIWbE.js} +1 -1
  10. package/dist/assets/{ImportLessonsModal-CfWIrW1K.js → ImportLessonsModal-BleM5Z-r.js} +1 -1
  11. package/dist/assets/{InteractiveCoursewareViewer-CS5BqfJZ.js → InteractiveCoursewareViewer-DBCbyDmo.js} +1 -1
  12. package/dist/assets/{InteractiveWhiteboard-U23CsqGo.js → InteractiveWhiteboard-DnnYVSpP.js} +1 -1
  13. package/dist/assets/{LazyCourseware-DXL9IxZO.js → LazyCourseware-BtliMSwD.js} +1 -1
  14. package/dist/assets/{LazyWhiteboard-CtkzSFtN.js → LazyWhiteboard-D_U3t5Ft.js} +1 -1
  15. package/dist/assets/{LessonEditorView-Bfxf4VVB.js → LessonEditorView-Lejw223i.js} +1 -1
  16. package/dist/assets/{LiveClassroomView-DHzCM4qQ.js → LiveClassroomView-DW7gWs1X.js} +1 -1
  17. package/dist/assets/{NotificationDetailModal-BxrpnlWV.js → NotificationDetailModal-me41YjnW.js} +1 -1
  18. package/dist/assets/{PluginView-12qYzmnq.js → PluginView-pof_3sut.js} +1 -1
  19. package/dist/assets/{QuizGeneratorModal-DfZI40Ii.js → QuizGeneratorModal-UEVoYkB6.js} +1 -1
  20. package/dist/assets/{StudentAssignmentView-BP6zbHuM.js → StudentAssignmentView-BTfMYbmx.js} +1 -1
  21. package/dist/assets/{StudentLessonView-DEpMzrH2.js → StudentLessonView-Bb5HQ6Kx.js} +1 -1
  22. package/dist/assets/{StudentPreviewModal-DCmai53s.js → StudentPreviewModal-Bx86ogm7.js} +1 -1
  23. package/dist/assets/{StudentView-CcGlfW25.js → StudentView-5bdEpjwh.js} +1 -1
  24. package/dist/assets/{SystemResourceLibraryModal-BzHw1edT.js → SystemResourceLibraryModal-CRsieL1o.js} +1 -1
  25. package/dist/assets/{TeacherView-Dw6mKwcv.js → TeacherView-DCTHvypF.js} +1 -1
  26. package/dist/assets/{index-C8sCKzmN.js → index-Bve0X_Y7.js} +1 -1
  27. package/dist/assets/{index-CYzNsYZB.js → index-CerSuw-h.js} +3 -3
  28. package/dist/index.html +1 -1
  29. package/dist/server.cjs +5 -5
  30. package/package.json +2 -2
@@ -1,4 +1,4 @@
1
- import{r as h,j as e,R as Z}from"./vendor-react-0Lg0vA-4.js";import{aE as ue,X as ce,w as J,i as $e,S as ve,at as pe,f as Ne,ae as Pe,aF as Ue,a9 as ge,aq as Te,ay as De,U as Ee,aG as we,am as le,I as Me,ao as me,o as de,d as ze,W as Fe,u as ke,aH as Re,s as Ae,aC as Le}from"./vendor-icons-Dq6MhgH9.js";import{n as Oe}from"./vendor-pptx-B_NheIKl.js";import{u as be}from"./index-CYzNsYZB.js";import"./vendor-pdf-Cp-cYteE.js";import"./vendor-utils-BEhuP0Zq.js";import"./vendor-motion-DjY2czvL.js";import"./vendor-charts-CRXa4AlU.js";function Ve({pluginId:r,pluginName:s,manifestStr:t,lang:d,onClose:p}){const[u,v]=h.useState(null),[b,k]=h.useState({}),[x,D]=h.useState(!0),[C,L]=h.useState(!1),[A,$]=h.useState(null),o=h.useCallback(async()=>{D(!0);try{const m=await fetch(`/api/plugins/${encodeURIComponent(r)}/config`);if(m.ok){const g=await m.json();if(g.success){v(g.result.schema),k(g.result.values);return}}}catch{}try{const g=JSON.parse(t).configuration?.properties??{};v(g);const l={};for(const[P,M]of Object.entries(g))l[P]=M.default;k(l)}catch{v({})}D(!1)},[r,t]);h.useEffect(()=>{o().finally(()=>D(!1))},[o]);const n=async()=>{L(!0),$(null);try{const g=await(await fetch(`/api/plugins/${encodeURIComponent(r)}/config`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(b)})).json();g.success?$(d==="zh"?"✓ 已保存":"✓ Saved"):$(`✗ ${g.error}`)}catch(m){$(`✗ ${m.message}`)}L(!1)},c=(m,g)=>{k(l=>({...l,[m]:g})),$(null)},j=(m,g)=>d==="zh"?m:g,N=(m,g)=>{const l=b[m],P=g.description??"";switch(g.type){case"boolean":return e.jsxs("div",{className:"flex items-center justify-between py-2.5 border-b border-gray-100",children:[e.jsxs("div",{className:"flex-1",children:[e.jsx("label",{className:"text-sm font-medium text-gray-700",children:m}),P&&e.jsx("p",{className:"text-xs text-gray-400 mt-0.5",children:P})]}),e.jsx("button",{type:"button",onClick:()=>c(m,!l),className:`relative w-10 h-5 rounded-full transition-colors ${l?"bg-indigo-600":"bg-gray-300"}`,children:e.jsx("span",{className:`absolute top-0.5 w-4 h-4 rounded-full bg-white shadow transition-transform ${l?"translate-x-5":"translate-x-0.5"}`})})]},m);case"number":case"integer":return e.jsxs("div",{className:"py-2.5 border-b border-gray-100",children:[e.jsx("label",{className:"text-sm font-medium text-gray-700 block mb-1",children:m}),P&&e.jsx("p",{className:"text-xs text-gray-400 mb-1.5",children:P}),e.jsx("input",{type:"number",step:g.type==="integer"?1:"any",min:g.minimum,max:g.maximum,value:l!=null?String(l):"",onChange:M=>{const U=M.target.value===""?void 0:Number(M.target.value);c(m,U)},className:"w-full px-3 py-1.5 text-sm border border-gray-200 rounded-lg focus:ring-2 focus:ring-indigo-200 focus:border-indigo-400 outline-none",placeholder:g.default!==void 0?String(g.default):""})]},m);default:return g.enum&&g.enum.length>0?e.jsxs("div",{className:"py-2.5 border-b border-gray-100",children:[e.jsx("label",{className:"text-sm font-medium text-gray-700 block mb-1",children:m}),P&&e.jsx("p",{className:"text-xs text-gray-400 mb-1.5",children:P}),e.jsx("select",{value:String(l??g.default??""),onChange:M=>c(m,M.target.value),className:"w-full px-3 py-1.5 text-sm border border-gray-200 rounded-lg focus:ring-2 focus:ring-indigo-200 focus:border-indigo-400 outline-none bg-white",children:g.enum.map(M=>e.jsx("option",{value:String(M),children:String(M)},String(M)))})]},m):e.jsxs("div",{className:"py-2.5 border-b border-gray-100",children:[e.jsx("label",{className:"text-sm font-medium text-gray-700 block mb-1",children:m}),P&&e.jsx("p",{className:"text-xs text-gray-400 mb-1.5",children:P}),e.jsx("input",{type:"text",value:l!=null?String(l):"",onChange:M=>c(m,M.target.value),className:"w-full px-3 py-1.5 text-sm border border-gray-200 rounded-lg focus:ring-2 focus:ring-indigo-200 focus:border-indigo-400 outline-none",placeholder:g.default!==void 0?String(g.default):""})]},m)}},i=u&&Object.keys(u).length>0;return e.jsx("div",{className:"fixed inset-0 bg-black/40 flex items-center justify-center z-50 p-4",onClick:p,children:e.jsxs("div",{className:"bg-white rounded-xl shadow-xl w-full max-w-md flex flex-col max-h-[85vh]",onClick:m=>m.stopPropagation(),children:[e.jsxs("div",{className:"p-4 border-b border-gray-100 flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(ue,{size:18,className:"text-gray-500"}),e.jsxs("div",{children:[e.jsx("h3",{className:"font-semibold text-gray-800 text-sm",children:j("插件设置","Plugin Settings")}),e.jsx("p",{className:"text-xs text-gray-400",children:s})]})]}),e.jsx("button",{onClick:p,className:"text-gray-400 hover:text-gray-600 p-1",children:e.jsx(ce,{size:18})})]}),e.jsx("div",{className:"p-4 flex-1 overflow-auto",children:x?e.jsx("div",{className:"flex items-center justify-center py-12",children:e.jsx(J,{size:24,className:"text-gray-400 animate-spin"})}):i?e.jsx("div",{className:"space-y-0.5",children:Object.entries(u).map(([m,g])=>N(m,g))}):e.jsxs("div",{className:"text-center py-8",children:[e.jsx(ue,{size:32,className:"text-gray-300 mx-auto mb-3"}),e.jsx("p",{className:"text-sm text-gray-400",children:j("此插件没有可配置项。","This plugin has no configurable settings.")}),e.jsx("p",{className:"text-xs text-gray-300 mt-1",children:j("在 manifest.configuration 中声明配置项即可在此处显示。","Declare settings in manifest.configuration to see them here.")})]})}),i&&e.jsxs("div",{className:"p-4 border-t border-gray-100 flex items-center justify-between",children:[A&&e.jsx("span",{className:`text-xs ${A.startsWith("✓")?"text-green-600":"text-red-500"}`,children:A}),e.jsxs("div",{className:"flex gap-2 ml-auto",children:[e.jsx("button",{onClick:p,className:"px-4 py-2 text-xs font-medium text-gray-600 hover:bg-gray-50 rounded-lg transition-colors",children:j("取消","Cancel")}),e.jsxs("button",{onClick:n,disabled:C,className:"px-4 py-2 text-xs font-medium bg-indigo-600 text-white hover:bg-indigo-700 rounded-lg transition-colors flex items-center gap-1.5 disabled:opacity-50",children:[C?e.jsx(J,{size:14,className:"animate-spin"}):e.jsx($e,{size:14}),j("保存","Save")]})]})]})]})})}function he(r){return r.replace(/\\u\{([0-9a-fA-F]+)\}/g,(s,t)=>{try{return String.fromCodePoint(parseInt(t,16))}catch{return s}}).replace(/\\u([0-9a-fA-F]{4})/g,(s,t)=>String.fromCharCode(parseInt(t,16))).replace(/\\x([0-9a-fA-F]{2})/g,(s,t)=>String.fromCharCode(parseInt(t,16))).replace(/\\n/g,`
1
+ import{r as h,j as e,R as Z}from"./vendor-react-0Lg0vA-4.js";import{aE as ue,X as ce,w as J,i as $e,S as ve,at as pe,f as Ne,ae as Pe,aF as Ue,a9 as ge,aq as Te,ay as De,U as Ee,aG as we,am as le,I as Me,ao as me,o as de,d as ze,W as Fe,u as ke,aH as Re,s as Ae,aC as Le}from"./vendor-icons-Dq6MhgH9.js";import{n as Oe}from"./vendor-pptx-B_NheIKl.js";import{u as be}from"./index-CerSuw-h.js";import"./vendor-pdf-Cp-cYteE.js";import"./vendor-utils-BEhuP0Zq.js";import"./vendor-motion-DjY2czvL.js";import"./vendor-charts-CRXa4AlU.js";function Ve({pluginId:r,pluginName:s,manifestStr:t,lang:d,onClose:p}){const[u,v]=h.useState(null),[b,k]=h.useState({}),[x,D]=h.useState(!0),[C,L]=h.useState(!1),[A,$]=h.useState(null),o=h.useCallback(async()=>{D(!0);try{const m=await fetch(`/api/plugins/${encodeURIComponent(r)}/config`);if(m.ok){const g=await m.json();if(g.success){v(g.result.schema),k(g.result.values);return}}}catch{}try{const g=JSON.parse(t).configuration?.properties??{};v(g);const l={};for(const[P,M]of Object.entries(g))l[P]=M.default;k(l)}catch{v({})}D(!1)},[r,t]);h.useEffect(()=>{o().finally(()=>D(!1))},[o]);const n=async()=>{L(!0),$(null);try{const g=await(await fetch(`/api/plugins/${encodeURIComponent(r)}/config`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(b)})).json();g.success?$(d==="zh"?"✓ 已保存":"✓ Saved"):$(`✗ ${g.error}`)}catch(m){$(`✗ ${m.message}`)}L(!1)},c=(m,g)=>{k(l=>({...l,[m]:g})),$(null)},j=(m,g)=>d==="zh"?m:g,N=(m,g)=>{const l=b[m],P=g.description??"";switch(g.type){case"boolean":return e.jsxs("div",{className:"flex items-center justify-between py-2.5 border-b border-gray-100",children:[e.jsxs("div",{className:"flex-1",children:[e.jsx("label",{className:"text-sm font-medium text-gray-700",children:m}),P&&e.jsx("p",{className:"text-xs text-gray-400 mt-0.5",children:P})]}),e.jsx("button",{type:"button",onClick:()=>c(m,!l),className:`relative w-10 h-5 rounded-full transition-colors ${l?"bg-indigo-600":"bg-gray-300"}`,children:e.jsx("span",{className:`absolute top-0.5 w-4 h-4 rounded-full bg-white shadow transition-transform ${l?"translate-x-5":"translate-x-0.5"}`})})]},m);case"number":case"integer":return e.jsxs("div",{className:"py-2.5 border-b border-gray-100",children:[e.jsx("label",{className:"text-sm font-medium text-gray-700 block mb-1",children:m}),P&&e.jsx("p",{className:"text-xs text-gray-400 mb-1.5",children:P}),e.jsx("input",{type:"number",step:g.type==="integer"?1:"any",min:g.minimum,max:g.maximum,value:l!=null?String(l):"",onChange:M=>{const U=M.target.value===""?void 0:Number(M.target.value);c(m,U)},className:"w-full px-3 py-1.5 text-sm border border-gray-200 rounded-lg focus:ring-2 focus:ring-indigo-200 focus:border-indigo-400 outline-none",placeholder:g.default!==void 0?String(g.default):""})]},m);default:return g.enum&&g.enum.length>0?e.jsxs("div",{className:"py-2.5 border-b border-gray-100",children:[e.jsx("label",{className:"text-sm font-medium text-gray-700 block mb-1",children:m}),P&&e.jsx("p",{className:"text-xs text-gray-400 mb-1.5",children:P}),e.jsx("select",{value:String(l??g.default??""),onChange:M=>c(m,M.target.value),className:"w-full px-3 py-1.5 text-sm border border-gray-200 rounded-lg focus:ring-2 focus:ring-indigo-200 focus:border-indigo-400 outline-none bg-white",children:g.enum.map(M=>e.jsx("option",{value:String(M),children:String(M)},String(M)))})]},m):e.jsxs("div",{className:"py-2.5 border-b border-gray-100",children:[e.jsx("label",{className:"text-sm font-medium text-gray-700 block mb-1",children:m}),P&&e.jsx("p",{className:"text-xs text-gray-400 mb-1.5",children:P}),e.jsx("input",{type:"text",value:l!=null?String(l):"",onChange:M=>c(m,M.target.value),className:"w-full px-3 py-1.5 text-sm border border-gray-200 rounded-lg focus:ring-2 focus:ring-indigo-200 focus:border-indigo-400 outline-none",placeholder:g.default!==void 0?String(g.default):""})]},m)}},i=u&&Object.keys(u).length>0;return e.jsx("div",{className:"fixed inset-0 bg-black/40 flex items-center justify-center z-50 p-4",onClick:p,children:e.jsxs("div",{className:"bg-white rounded-xl shadow-xl w-full max-w-md flex flex-col max-h-[85vh]",onClick:m=>m.stopPropagation(),children:[e.jsxs("div",{className:"p-4 border-b border-gray-100 flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(ue,{size:18,className:"text-gray-500"}),e.jsxs("div",{children:[e.jsx("h3",{className:"font-semibold text-gray-800 text-sm",children:j("插件设置","Plugin Settings")}),e.jsx("p",{className:"text-xs text-gray-400",children:s})]})]}),e.jsx("button",{onClick:p,className:"text-gray-400 hover:text-gray-600 p-1",children:e.jsx(ce,{size:18})})]}),e.jsx("div",{className:"p-4 flex-1 overflow-auto",children:x?e.jsx("div",{className:"flex items-center justify-center py-12",children:e.jsx(J,{size:24,className:"text-gray-400 animate-spin"})}):i?e.jsx("div",{className:"space-y-0.5",children:Object.entries(u).map(([m,g])=>N(m,g))}):e.jsxs("div",{className:"text-center py-8",children:[e.jsx(ue,{size:32,className:"text-gray-300 mx-auto mb-3"}),e.jsx("p",{className:"text-sm text-gray-400",children:j("此插件没有可配置项。","This plugin has no configurable settings.")}),e.jsx("p",{className:"text-xs text-gray-300 mt-1",children:j("在 manifest.configuration 中声明配置项即可在此处显示。","Declare settings in manifest.configuration to see them here.")})]})}),i&&e.jsxs("div",{className:"p-4 border-t border-gray-100 flex items-center justify-between",children:[A&&e.jsx("span",{className:`text-xs ${A.startsWith("✓")?"text-green-600":"text-red-500"}`,children:A}),e.jsxs("div",{className:"flex gap-2 ml-auto",children:[e.jsx("button",{onClick:p,className:"px-4 py-2 text-xs font-medium text-gray-600 hover:bg-gray-50 rounded-lg transition-colors",children:j("取消","Cancel")}),e.jsxs("button",{onClick:n,disabled:C,className:"px-4 py-2 text-xs font-medium bg-indigo-600 text-white hover:bg-indigo-700 rounded-lg transition-colors flex items-center gap-1.5 disabled:opacity-50",children:[C?e.jsx(J,{size:14,className:"animate-spin"}):e.jsx($e,{size:14}),j("保存","Save")]})]})]})]})})}function he(r){return r.replace(/\\u\{([0-9a-fA-F]+)\}/g,(s,t)=>{try{return String.fromCodePoint(parseInt(t,16))}catch{return s}}).replace(/\\u([0-9a-fA-F]{4})/g,(s,t)=>String.fromCharCode(parseInt(t,16))).replace(/\\x([0-9a-fA-F]{2})/g,(s,t)=>String.fromCharCode(parseInt(t,16))).replace(/\\n/g,`
2
2
  `).replace(/\\t/g," ").replace(/\\r/g,"\r").replace(/\\'/g,"'").replace(/\\"/g,'"').replace(/\\\\/g,"\\")}function fe(r,s){if(!r)return s;for(const t of["label","name","title","displayName"]){const d=r[t];if(typeof d=="string"&&d.trim())return d.trim()}return s}function je(r){if(!r||typeof r!="object")return[];const s=[],t=new Set,d=(u,v,b)=>{const k=`${u}::${v}`;t.has(k)||(t.add(k),s.push({slot:u,id:v,label:b||v||u,source:"manifest"}))},p=r.contributes;if(p&&typeof p=="object"){for(const[u,v]of Object.entries(p))if(Array.isArray(v))for(const b of v){const k=b&&typeof b=="object"?b:{},x=typeof k.id=="string"?k.id:"?";d(u,x,fe(k,x))}}if(Array.isArray(r.classroomTools))for(const u of r.classroomTools){const v=u&&typeof u=="object"?u:{},b=typeof v.id=="string"?v.id:"?";d("classroom.tool",b,fe(v,b))}return s}function qe(r){if(!r)return[];const s=[],t=/registerExtensionPoint\s*\(\s*['"]([^'"]+)['"]\s*,\s*\{((?:[^{}]|\{[^{}]*\})*)\}/g;let d;for(;(d=t.exec(r))!==null;){const p=he(d[1]),u=d[2],v=u.match(/\bid\s*:\s*['"]([^'"]*)['"]/),b=u.match(/\blabel\s*:\s*['"]([^'"]*)['"]/),k=u.match(/\bname\s*:\s*['"]([^'"]*)['"]/),x=he(v?.[1]||"?"),D=b?.[1]??k?.[1]??x;s.push({slot:p,id:x,label:he(D)||x||p,source:"frontend"})}return s}function Ze(r,s){const t=new Map;for(const d of r)t.set(`${d.slot}::${d.id}`,d);for(const d of s){const p=`${d.slot}::${d.id}`,u=t.get(p);if(!u){t.set(p,d);continue}const v=u.label&&u.label!==u.id&&u.label!==u.slot?u.label:d.label;t.set(p,{...u,label:v||u.label})}return Array.from(t.values())}const We=new Set(["teacher.tab","teacher.dashboard.widget","workspace.view","classroom.tool","command.palette"]),Be=new Set(["student.view","student.dashboard.widget"]);function ye(r){if(!r||typeof r!="string")return"0.0.0";const s=r.trim().match(/(\d+)(?:\.(\d+))?(?:\.(\d+))?/);return s?`${s[1]}.${s[2]||"0"}.${s[3]||"0"}`:"0.0.0"}function _e(r,s){const t=ye(r).split(".").map(p=>parseInt(p,10)),d=ye(s).split(".").map(p=>parseInt(p,10));for(let p=0;p<3;p++){if(t[p]<d[p])return-1;if(t[p]>d[p])return 1}return 0}function Je({isOpen:r,onClose:s,lang:t,file:d,onConfirmInstall:p,lockedTargetPluginId:u=null,installedPlugins:v=[]}){const[b,k]=h.useState(0),[x,D]=h.useState(null),[C,L]=h.useState([]),[A,$]=h.useState([]),[o,n]=h.useState(null),[c,j]=h.useState(!1),[N,i]=h.useState(!1),[m,g]=h.useState("worker"),[l,P]=h.useState(null),[M,U]=h.useState(null),[ee,ie]=h.useState(!1),[G,Q]=h.useState(!1),[te,_]=h.useState(""),[se,F]=h.useState(0),[q,K]=h.useState("teacher"),[E,re]=h.useState([]),[oe,ae]=h.useState(!1),[T,H]=h.useState(null),[X,f]=h.useState(!1),[w,R]=h.useState(!1);h.useEffect(()=>{r&&d&&(k(0),D(null),L([]),n(null),j(!1),i(!1),g("worker"),P(null),U(null),re([]),$([]),K("teacher"),H(null),f(!1),R(!1),O(d))},[r,d]);const O=async a=>{ie(!0),U(null);try{const y=await Oe.loadAsync(a);P(y);const S=y.file("manifest.json");if(!S)throw new Error(t==="zh"?"ZIP 包中缺少 manifest.json 声明文件":"manifest.json missing in ZIP package");const I=await S.async("string"),V=JSON.parse(I);if(!V.id||!V.name)throw new Error(t==="zh"?"manifest.json 缺少必填字段 id 或 name":"manifest.json missing required id or name field");D(V),L(V.capabilitiesProposed||[]),n(V.contributes||null),j(!!y.file("frontend.js")),re(je(V)),V.executionMode==="inline"&&g("inline"),await W(V)}catch(y){U(y.message||"ZIP parse error")}finally{ie(!1)}},W=async a=>{if(H(null),f(!1),R(!1),!a?.id)return;if(u){const S=v.find(V=>V.id===u);let I=null;try{I=S?JSON.parse(S.manifest):null}catch{I=null}if(I?.id&&I.id!==a.id){U(t==="zh"?`ZIP 的插件 ID(${a.id})与当前卡片(${I.id})不一致,无法更新。`:`ZIP manifest.id (${a.id}) does not match this plugin (${I.id}).`);return}if(String(a.id).startsWith("@openlearn/")){U(t==="zh"?"系统核心插件禁止通过插件中心更新。":"System plugins cannot be updated here.");return}H({pluginId:u,name:S?.name||I?.name||a.name,version:S?.version||I?.version||"0.0.0",status:S?.status||"unknown",isSystem:!1,manifestId:a.id});return}const y=v.find(S=>{try{return JSON.parse(S.manifest)?.id===a.id}catch{return!1}});if(y){let S={};try{S=JSON.parse(y.manifest)}catch{S={}}if(String(a.id).startsWith("@openlearn/")||y.id.startsWith("@openlearn/")){U(t==="zh"?"系统核心插件禁止通过插件中心更新。":"System plugins cannot be updated here.");return}H({pluginId:y.id,name:y.name||S.name||a.name,version:y.version||S.version||"0.0.0",status:y.status,isSystem:!1,manifestId:a.id});return}try{const I=await(await fetch(`/api/plugins/by-manifest/${encodeURIComponent(a.id)}`)).json();if(I?.success&&I.installed){if(I.isSystem){U(t==="zh"?"系统核心插件禁止通过插件中心更新。":"System plugins cannot be updated here.");return}H({pluginId:I.pluginId,name:I.name,version:I.version||"0.0.0",status:I.status,isSystem:!!I.isSystem,manifestId:a.id})}}catch(S){console.warn("Failed to detect existing plugin install",S)}};h.useEffect(()=>{if(b!==3||!l)return;let a=!1;return(async()=>{ae(!0);try{const y=l.file("frontend.js"),S=y?await y.async("string"):"",I=je(x),V=qe(S);if(a)return;re(Ze(I,V)),$([{name:"index.js",size:l.file("index.js")?(await l.file("index.js").async("string")).length:0},{name:"frontend.js",size:S.length},{name:"manifest.json",size:l.file("manifest.json")?(await l.file("manifest.json").async("string")).length:0}])}catch(y){console.warn("Extension point preview failed:",y)}finally{a||ae(!1)}})(),()=>{a=!0}},[b,l,x,c]);const Y=h.useMemo(()=>{const a=q==="teacher"?We:Be,y=E.filter(S=>a.has(S.slot));return y.length>0?y:E},[E,q]),z=!!T,B=z&&_e(x?.version||"0.0.0",T.version)<0,ne=z&&T.status==="active"&&(E.some(a=>["classroom.tool","student.view","teacher.tab","workspace.view"].includes(a.slot))||!!(x?.classroomTools&&x.classroomTools.length>0)||!!(x?.contributes&&Object.keys(x.contributes).length>0)),xe=!(!d||!x||T?.isSystem||B&&!X||ne&&!w),Se=async()=>{if(!(!d||!xe)){Q(!0),U(null),F(10),_(t==="zh"?z?"正在上传并更新...":"正在上传并安装...":z?"Uploading and updating...":"Uploading and installing...");try{await p(d,m,{mode:z?"update":"install",targetPluginId:T?.pluginId,allowDowngrade:B?X:!1}),F(100),_(t==="zh"?z?"更新完成":"安装完成":z?"Updated":"Complete"),s()}catch(a){console.error(a),U(a?.message||(t==="zh"?z?"更新失败":"安装失败":z?"Update failed":"Installation failed")),F(0),_("")}finally{Q(!1)}}},Ce=async()=>{if(!(!d||ee||G)){i(!0),f(!0),R(!0),Q(!0),U(null),F(20),_(t==="zh"?z?"极速同意全套授权,正在更新...":"极速同意全套授权,正在安装...":z?"Express approving terms & updating...":"Express approving terms & installing...");try{await p(d,m,{mode:z?"update":"install",targetPluginId:T?.pluginId,allowDowngrade:!0}),F(100),_(t==="zh"?z?"更新完成":"安装完成":z?"Updated":"Complete"),s()}catch(a){console.error(a),U(a?.message||(t==="zh"?z?"更新失败":"安装失败":z?"Update failed":"Installation failed")),F(0),_("")}finally{Q(!1)}}};if(!r)return null;const Ie=a=>{const y=["db:schema","management:write","network:access"],S=["whiteboard:write","vfs:write","lesson:write","class:write"];return y.includes(a)?{level:"high",label:t==="zh"?"🔴 高危":"🔴 High",desc:t==="zh"?"可读写数据库、获取网络数据,存在敏感信息暴露与跨站点数据隐患。":"Can read/write DB or access network, sensitive data risk.",rowClass:"bg-rose-50/80 border-rose-200/90 hover:border-rose-300 shadow-2xs text-rose-950",badgeClass:"bg-rose-100 text-rose-700 border-rose-200 font-extrabold",codeClass:"bg-white border-rose-200 text-rose-900",descClass:"text-rose-800/90"}:S.includes(a)?{level:"medium",label:t==="zh"?"🟡 中危":"🟡 Medium",desc:t==="zh"?"可在课表、白板中进行绘制修改或写入局部业务持久化数据。":"Can write to whiteboards or control course schedules.",rowClass:"bg-amber-50/80 border-amber-200/90 hover:border-amber-300 shadow-2xs text-amber-950",badgeClass:"bg-amber-100 text-amber-800 border-amber-200 font-extrabold",codeClass:"bg-white border-amber-200 text-amber-900",descClass:"text-amber-800/90"}:{level:"low",label:t==="zh"?"🟢 低危":"🟢 Low",desc:t==="zh"?"常规的基础界面弹窗与局域隔离存储能力,安全可信。":"Basic UI elements or isolated local storage.",rowClass:"bg-emerald-50/70 border-emerald-200/90 hover:border-emerald-300 shadow-2xs text-emerald-950",badgeClass:"bg-emerald-100 text-emerald-800 border-emerald-200 font-extrabold",codeClass:"bg-white border-emerald-200 text-emerald-900",descClass:"text-emerald-800/90"}};return e.jsx("div",{className:"fixed inset-0 bg-slate-900/60 backdrop-blur-2xs flex items-center justify-center overflow-y-auto select-none",style:{zIndex:9999},children:e.jsxs("div",{className:"bg-white border border-slate-200 shadow-2xl rounded-2xl w-full max-w-2xl p-6 md:p-7 relative flex flex-col justify-between max-h-[90vh]",children:[e.jsxs("div",{className:"flex justify-between items-center border-b border-slate-100 pb-4 shrink-0",children:[e.jsxs("h2",{className:"font-extrabold text-base md:text-lg text-slate-800 flex items-center gap-2",children:[e.jsx(ve,{className:"text-indigo-600 animate-pulse",size:20}),t==="zh"?`${z?"三方插件更新向导":"三方插件安装向导"} (${b+1}/5)`:`${z?"Plugin Update Wizard":"Plugin Setup Wizard"} (${b+1}/5)`]}),e.jsx("button",{onClick:s,className:"text-gray-400 hover:text-gray-650 cursor-pointer",children:e.jsx(ce,{size:18})})]}),e.jsx("div",{className:"flex-1 overflow-y-auto py-5 min-h-[300px]",children:ee?e.jsxs("div",{className:"flex flex-col items-center justify-center py-20 text-indigo-600 gap-2",children:[e.jsx(J,{size:36,className:"animate-spin"}),e.jsx("span",{className:"text-sm font-semibold",children:t==="zh"?"正在解压并审计文件...":"Extracting and auditing package..."})]}):M?e.jsxs("div",{className:"bg-red-50 border border-red-200 rounded-xl p-4 text-red-700 flex items-start gap-2.5",children:[e.jsx(pe,{size:18,className:"shrink-0 mt-0.5"}),e.jsxs("div",{children:[e.jsx("h4",{className:"font-bold text-sm",children:t==="zh"?"校验未通过,安装中断":"Verification Failed"}),e.jsx("p",{className:"text-xs mt-1 leading-relaxed",children:M})]})]}):e.jsxs(e.Fragment,{children:[b===0&&x&&e.jsxs("div",{className:"flex flex-col gap-4",children:[e.jsxs("div",{className:"bg-indigo-50/50 border border-indigo-100 rounded-xl p-4 flex gap-4",children:[e.jsx("div",{className:"w-12 h-12 bg-indigo-600 text-white rounded-lg flex items-center justify-center shrink-0 shadow-sm font-bold text-lg uppercase",children:x.name.charAt(0)}),e.jsxs("div",{children:[e.jsx("h3",{className:"font-extrabold text-slate-900 text-base",children:x.name}),e.jsxs("p",{className:"text-[10px] font-mono text-gray-500 mt-1",children:["ID: ",x.id," | v",x.version||"1.0.0"]})]})]}),e.jsxs("div",{children:[e.jsx("h4",{className:"font-bold text-slate-700 text-xs mb-1.5",children:t==="zh"?"功能描述":"Description"}),e.jsx("p",{className:"text-xs text-gray-600 leading-relaxed bg-slate-50 border border-slate-100 p-3 rounded-lg font-medium",children:x.description||(t==="zh"?"该插件暂无详细描述信息。":"No description provided for this plugin.")})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-4 mt-2",children:[e.jsxs("div",{className:"border border-slate-100 rounded-xl p-3 bg-slate-50/30",children:[e.jsx("span",{className:"text-[10px] text-gray-400 block font-semibold",children:t==="zh"?"主程序入口":"Main Entry"}),e.jsx("span",{className:"text-xs font-bold text-slate-700 font-mono mt-0.5 block",children:x.main||"index.js"})]}),e.jsxs("div",{className:"border border-slate-100 rounded-xl p-3 bg-slate-50/30",children:[e.jsx("span",{className:"text-[10px] text-gray-400 block font-semibold",children:t==="zh"?"前端沙箱包":"Frontend UI Asset"}),e.jsx("span",{className:`text-xs font-bold mt-0.5 block ${c?"text-indigo-600":"text-gray-500"}`,children:c?t==="zh"?"包含 (frontend.js)":"Included (frontend.js)":t==="zh"?"无":"None"})]})]}),T&&e.jsxs("div",{className:`mt-1 rounded-xl border p-4 ${B?"border-red-200 bg-red-50/50":"border-amber-200 bg-amber-50/40"}`,children:[e.jsx("h4",{className:"text-xs font-extrabold text-slate-800 mb-2",children:t==="zh"?"检测到已安装同一插件 — 将执行原地更新":"Same plugin already installed — in-place update"}),e.jsxs("div",{className:"grid grid-cols-2 gap-2 text-[11px]",children:[e.jsxs("div",{className:"bg-white/70 border border-slate-100 rounded-lg p-2",children:[e.jsx("div",{className:"text-slate-400 font-semibold",children:t==="zh"?"当前版本":"Installed"}),e.jsxs("div",{className:"font-bold text-slate-800 mt-0.5",children:[T.name,e.jsxs("span",{className:"font-mono text-slate-500 ml-1",children:["v",T.version]})]}),e.jsx("div",{className:"text-[10px] text-slate-400 mt-1 font-mono",children:T.status==="active"?t==="zh"?"状态: 运行中":"status: active":t==="zh"?"状态: 未启用":"status: inactive"})]}),e.jsxs("div",{className:"bg-white/70 border border-slate-100 rounded-lg p-2",children:[e.jsx("div",{className:"text-slate-400 font-semibold",children:t==="zh"?"ZIP 新版本":"Package"}),e.jsxs("div",{className:"font-bold text-slate-800 mt-0.5",children:[x.name,e.jsxs("span",{className:"font-mono text-indigo-600 ml-1",children:["v",x.version||"0.0.0"]})]}),e.jsx("div",{className:"text-[10px] text-slate-400 mt-1",children:t==="zh"?"保留配置 / 业务数据 / UUID":"Keeps config, data & UUID"})]})]}),B&&e.jsxs("label",{className:"mt-3 flex items-start gap-2 text-[11px] font-bold text-red-700 cursor-pointer",children:[e.jsx("input",{type:"checkbox",className:"mt-0.5",checked:X,onChange:a=>f(a.target.checked)}),e.jsx("span",{children:t==="zh"?`确认强制降级:v${T.version} → v${x.version||"0.0.0"}(可能不兼容)`:`Force downgrade v${T.version} → v${x.version||"0.0.0"} (may be incompatible)`})]}),ne&&e.jsxs("label",{className:"mt-2 flex items-start gap-2 text-[11px] font-bold text-amber-800 cursor-pointer",children:[e.jsx("input",{type:"checkbox",className:"mt-0.5",checked:w,onChange:a=>R(a.target.checked)}),e.jsx("span",{children:t==="zh"?"该插件当前为启用状态且声明了课堂/教学扩展点,热更新可能导致课中 UI 短暂异常。我已知晓并继续。":"Plugin is active with classroom UI contributions. Hot-update may briefly disrupt live class UI. I understand."})]})]})]}),b===1&&e.jsxs("div",{className:"flex flex-col gap-4",children:[e.jsx("p",{className:"text-xs text-slate-500 font-medium mb-1",children:t==="zh"?"此插件申请了以下系统权限,请仔细评估安装后可能产生的风控隐患:":"This plugin requests the following capabilities, please review carefully:"}),C.length===0?e.jsx("div",{className:"text-center p-8 bg-emerald-50 border border-emerald-100 rounded-xl text-emerald-700 font-bold text-xs",children:t==="zh"?"✓ 该插件未申请任何敏感系统权限,可安全安装。":"✓ This plugin requires no system capabilities, very safe."}):e.jsx("div",{className:"space-y-3 max-h-[220px] overflow-y-auto pr-1",children:C.map(a=>{const y=Ie(a);return e.jsxs("div",{className:`border rounded-xl p-3.5 flex flex-col gap-1 transition-all ${y.rowClass}`,children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{className:`font-mono text-xs font-bold rounded px-2 py-0.5 shadow-2xs ${y.codeClass}`,children:a}),e.jsx("span",{className:`text-[10px] px-2 py-0.5 rounded-md border ${y.badgeClass}`,children:y.label})]}),e.jsx("p",{className:`text-[11px] leading-relaxed font-medium mt-1 ${y.descClass}`,children:y.desc})]},a)})}),C.length>0&&e.jsxs("label",{className:"flex items-start gap-2 border border-orange-100 rounded-xl p-3 bg-orange-50/30 cursor-pointer mt-2 text-[11px] text-orange-850 font-bold leading-normal",children:[e.jsx("input",{type:"checkbox",checked:N,onChange:a=>i(a.target.checked),className:"mt-0.5 w-3.5 h-3.5 rounded text-orange-600 border-orange-300 focus:ring-orange-500 cursor-pointer shrink-0"}),e.jsx("span",{children:t==="zh"?"我已了解并信任此插件的提供商,愿意授予上述高级系统权限。":"I trust the developer and agree to grant all requested capabilities."})]})]}),b===2&&e.jsxs("div",{className:"flex flex-col gap-4",children:[e.jsx("p",{className:"text-xs text-slate-500 font-medium",children:t==="zh"?"插件将向系统注册并扩展以下槽位(Slots)与自定义命令:":"The plugin will inject UI slots or register custom commands:"}),e.jsx("div",{className:"border border-slate-150/65 rounded-xl p-4 bg-slate-50/50 space-y-4",children:o?e.jsxs(e.Fragment,{children:[o.teacher?.dashboard?.widget&&e.jsxs("div",{className:"text-xs",children:[e.jsx("span",{className:"font-bold text-slate-700 block mb-1",children:"插槽: 教师端侧栏卡片"}),e.jsxs("span",{className:"text-gray-500 font-mono",children:["teacher.dashboard.widget → ",o.teacher.dashboard.widget]})]}),o.student?.view&&e.jsxs("div",{className:"text-xs",children:[e.jsx("span",{className:"font-bold text-slate-700 block mb-1",children:"插槽: 学生答题看板"}),e.jsxs("span",{className:"text-gray-500 font-mono",children:["student.view → ",o.student.view]})]}),x.capabilitiesProposed&&x.capabilitiesProposed.length>0&&e.jsxs("div",{className:"text-xs border-t border-slate-100 pt-3",children:[e.jsx("span",{className:"font-bold text-slate-700 block mb-1",children:t==="zh"?"注册指令集":"Commands Registered"}),e.jsx("div",{className:"flex gap-1.5 flex-wrap",children:x.capabilitiesProposed.map(a=>e.jsx("span",{className:"bg-indigo-50 border border-indigo-150/60 rounded px-1.5 py-0.5 text-indigo-700 font-mono",children:a.replace(":write",".create")},a))})]})]}):e.jsx("div",{className:"text-center text-xs text-slate-400 italic py-6",children:t==="zh"?"此插件没有提供任何额外的槽位注册项。":"This plugin contributes no extension points."})})]}),b===3&&e.jsxs("div",{className:"flex flex-col gap-3 h-full",children:[e.jsxs("div",{className:"flex items-center justify-between shrink-0 gap-3",children:[e.jsx("p",{className:"text-xs text-slate-500 font-semibold",children:t==="zh"?"检测到的扩展点(静态分析预览):":"Detected extension points (static analysis):"}),e.jsxs("div",{className:"flex bg-slate-100 p-0.5 rounded-lg border border-slate-200 shrink-0",children:[e.jsx("button",{type:"button",onClick:()=>K("teacher"),className:`px-3 py-1 rounded-md text-[11px] font-bold transition-all cursor-pointer ${q==="teacher"?"bg-white shadow text-indigo-650":"text-slate-550 hover:text-slate-800"}`,children:t==="zh"?"教师端相关":"Teacher slots"}),e.jsx("button",{type:"button",onClick:()=>K("student"),className:`px-3 py-1 rounded-md text-[11px] font-bold transition-all cursor-pointer ${q==="student"?"bg-white shadow text-indigo-650":"text-slate-550 hover:text-slate-800"}`,children:t==="zh"?"学生端相关":"Student slots"})]})]}),e.jsx("div",{className:"border border-slate-200/80 rounded-xl p-4 bg-slate-50/50 flex-grow overflow-auto min-h-[220px] max-h-[300px]",children:e.jsx("div",{className:"h-full bg-white rounded-lg p-4 border border-slate-100 shadow-sm",children:oe?e.jsxs("div",{className:"flex flex-col items-center justify-center h-full gap-2 text-indigo-600",children:[e.jsx(J,{size:22,className:"animate-spin"}),e.jsx("span",{className:"text-xs font-semibold",children:t==="zh"?"正在分析扩展点…":"Analyzing extension points…"})]}):Y.length===0?e.jsx("div",{className:"flex items-center justify-center h-full text-center text-xs text-slate-400 italic px-4",children:t==="zh"?"未检测到扩展点注册(manifest.contributes / frontend.js)。":"No extension points detected in manifest or frontend.js."}):e.jsxs("div",{className:"flex flex-col gap-3",children:[e.jsx("div",{className:"text-[11px] font-semibold text-slate-500",children:t==="zh"?`共 ${Y.length} 项(按「${q==="teacher"?"教师端":"学生端"}」筛选)`:`${Y.length} item(s) for ${q} view`}),e.jsx("ul",{className:"space-y-2",children:Y.map(a=>e.jsxs("li",{className:"flex items-start justify-between gap-3 rounded-lg border border-slate-100 bg-slate-50/60 px-3 py-2",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("div",{className:"text-sm font-bold text-slate-800 truncate",children:a.label}),e.jsxs("div",{className:"text-[11px] text-slate-500 font-mono mt-0.5 truncate",children:[a.slot,a.id&&a.id!=="?"?` · ${a.id}`:""]})]}),e.jsx("span",{className:`shrink-0 text-[10px] font-semibold px-1.5 py-0.5 rounded border ${a.source==="manifest"?"bg-emerald-50 text-emerald-700 border-emerald-100":"bg-indigo-50 text-indigo-700 border-indigo-100"}`,children:a.source==="manifest"?"manifest":"frontend.js"})]},`${a.source}-${a.slot}-${a.id}`))}),A.length>0&&e.jsxs("div",{className:"pt-2 border-t border-slate-100",children:[e.jsx("div",{className:"text-[10px] font-semibold text-slate-400 mb-1",children:t==="zh"?"包内文件":"Package files"}),e.jsx("div",{className:"flex flex-wrap gap-1.5",children:A.map(a=>e.jsxs("span",{className:"text-[10px] font-mono bg-white border border-slate-150 rounded px-1.5 py-0.5 text-slate-600",children:[a.name,a.size>0?` (${Math.max(1,Math.round(a.size/1024))} KB)`:""]},a.name))})]})]})})}),e.jsxs("div",{className:"flex items-center gap-1.5 text-[10px] text-gray-550 font-medium shrink-0 bg-indigo-50/40 p-2 border border-indigo-100/40 rounded-lg",children:[e.jsx(Ne,{size:11,className:"text-indigo-600"}),e.jsx("span",{children:t==="zh"?"此步骤为静态扫描结果,不会执行插件代码。中文标签已从 JS 转义序列还原;优先展示 manifest 声明,frontend.js 作为补充。":"Static scan only — plugin code is not executed. Unicode escapes in JS labels are decoded; manifest entries take priority over frontend.js."})]})]}),b===4&&e.jsxs("div",{className:"flex flex-col gap-4",children:[T&&e.jsxs("div",{className:`rounded-xl border p-3 text-[11px] ${B?"border-red-200 bg-red-50/60":"border-amber-200 bg-amber-50/50"}`,children:[e.jsx("div",{className:"font-extrabold text-slate-800 mb-1",children:t==="zh"?`更新确认:v${T.version} → v${x?.version||"0.0.0"}`:`Update: v${T.version} → v${x?.version||"0.0.0"}`}),e.jsx("div",{className:"text-slate-600",children:t==="zh"?"将原地替换代码与静态资源,保留 UUID、配置与业务数据。":"Replaces code/assets in place. UUID, config and data are preserved."}),B&&e.jsxs("label",{className:"mt-2 flex items-start gap-2 font-bold text-red-700 cursor-pointer",children:[e.jsx("input",{type:"checkbox",className:"mt-0.5",checked:X,onChange:a=>f(a.target.checked)}),e.jsx("span",{children:t==="zh"?"确认强制降级":"Confirm forced downgrade"})]}),ne&&e.jsxs("label",{className:"mt-2 flex items-start gap-2 font-bold text-amber-800 cursor-pointer",children:[e.jsx("input",{type:"checkbox",className:"mt-0.5",checked:w,onChange:a=>R(a.target.checked)}),e.jsx("span",{children:t==="zh"?"已知晓课中热更新风险":"I accept live-class hot-update risk"})]}),!xe&&e.jsx("p",{className:"mt-2 text-red-600 font-semibold",children:t==="zh"?"请先完成上方确认项后再更新。":"Complete the confirmation checks above before updating."})]}),e.jsx("p",{className:"text-xs text-slate-500 font-medium",children:t==="zh"?"设置该插件启动时的微前端沙箱执行模式:":"Configure micro-frontend sandbox execution model:"}),e.jsxs("div",{className:"space-y-3",children:[e.jsxs("label",{className:`border rounded-xl p-4 flex gap-3 cursor-pointer transition-all ${m==="worker"?"bg-indigo-50/40 border-indigo-300 shadow-xs":"border-slate-150 hover:border-indigo-200 bg-white"}`,children:[e.jsx("input",{type:"radio",name:"sandbox_mode",checked:m==="worker",onChange:()=>g("worker"),className:"mt-1 w-4 h-4 text-indigo-600 border-gray-300 focus:ring-indigo-500 cursor-pointer shrink-0"}),e.jsxs("div",{children:[e.jsx("h4",{className:"font-extrabold text-xs md:text-sm text-slate-800",children:t==="zh"?"Worker 强沙箱隔离模式 (推荐)":"Worker Sandbox Isolation (Recommended)"}),e.jsx("p",{className:"text-[11px] text-slate-550 mt-1 leading-normal font-medium",children:t==="zh"?"插件代码在独立的后台 Worker 线程中加载运行。即便发生死循环、崩溃抛错也不会株连系统主服务崩溃,安全性最高。":"Loads in isolated background worker threads. Uncaught plugin errors won't crash main system."})]})]}),e.jsxs("label",{className:`border rounded-xl p-4 flex gap-3 cursor-pointer transition-all ${m==="inline"?"bg-indigo-50/40 border-indigo-300 shadow-xs":"border-slate-150 hover:border-indigo-200 bg-white"}`,children:[e.jsx("input",{type:"radio",name:"sandbox_mode",checked:m==="inline",onChange:()=>g("inline"),className:"mt-1 w-4 h-4 text-indigo-600 border-gray-300 focus:ring-indigo-500 cursor-pointer shrink-0"}),e.jsxs("div",{children:[e.jsx("h4",{className:"font-extrabold text-xs md:text-sm text-slate-800",children:t==="zh"?"VM Inline 主进程运行模式":"VM Inline Execution"}),e.jsx("p",{className:"text-[11px] text-slate-550 mt-1 leading-normal font-medium",children:t==="zh"?"插件在主进程上下文中运行,执行性能极高。但如果代码发生不可捕获错误,可能会造成服务崩溃,适合受信任的代码。":"Runs in host process, higher execution speed. Uncaught plugin failures might cause host server to stop."})]})]})]})]})]})}),e.jsxs("div",{className:"flex items-center justify-between border-t border-slate-100 pt-4 shrink-0",children:[e.jsx("div",{className:"flex items-center gap-1.5",children:[0,1,2,3,4].map(a=>e.jsx("div",{className:`h-1.5 rounded-full transition-all duration-300 ${a===b?"w-4 bg-indigo-650":"w-1.5 bg-slate-200"}`},a))}),e.jsxs("div",{className:"flex items-center gap-2",children:[b>0?e.jsxs("button",{type:"button",onClick:()=>k(a=>a-1),className:"flex items-center gap-1.5 px-3.5 py-2 border border-slate-200 rounded-lg text-xs font-semibold text-slate-600 hover:bg-slate-50 transition-colors cursor-pointer",children:[e.jsx(Pe,{size:12}),t==="zh"?"上一步":"Back"]}):e.jsx("button",{type:"button",onClick:s,className:"px-3.5 py-2 border border-slate-200 rounded-lg text-xs font-semibold text-slate-400 hover:bg-slate-50 transition-colors cursor-pointer",children:t==="zh"?"取消":"Cancel"}),!G&&d&&x&&!T?.isSystem&&e.jsxs("button",{type:"button",onClick:Ce,className:"flex items-center gap-1.5 px-3.5 py-2 bg-gradient-to-r from-amber-500 to-amber-600 hover:from-amber-600 hover:to-amber-700 text-white rounded-lg text-xs font-bold shadow-xs transition-all cursor-pointer",title:t==="zh"?"同意全套权限与提示,直接安装完成":"Approve terms and install directly",children:[e.jsx(Ue,{size:13,className:"fill-amber-200"}),e.jsx("span",{children:t==="zh"?z?"一键极速更新":"一键极速安装":z?"Express Update":"Express Install"})]}),b===1&&C.length>0&&!N?e.jsxs("button",{type:"button",disabled:!0,className:"flex items-center gap-1.5 px-4 py-2 bg-gray-200 text-gray-400 rounded-lg text-xs font-semibold cursor-not-allowed",children:[t==="zh"?"请先授权同意":"Accept terms first",e.jsx(ge,{size:12})]}):b<4?e.jsxs("button",{type:"button",onClick:()=>k(a=>a+1),className:"flex items-center gap-1.5 px-4 py-2 bg-slate-900 text-white rounded-lg text-xs font-semibold hover:bg-slate-800 transition-colors cursor-pointer",children:[t==="zh"?"下一步":"Next",e.jsx(ge,{size:12})]}):e.jsx("button",{type:"button",onClick:Se,disabled:G||!xe,className:"flex items-center gap-1.5 px-5 py-2 bg-indigo-600 hover:bg-indigo-700 text-white rounded-lg text-xs font-bold shadow-sm transition-colors cursor-pointer disabled:bg-indigo-400",children:G?e.jsxs("div",{className:"flex flex-col gap-1.5 min-w-32",children:[e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx(J,{size:13,className:"animate-spin"}),e.jsx("span",{children:t==="zh"?z?"更新中...":"安装中...":z?"Updating...":"Installing..."})]}),e.jsx("div",{className:"w-full h-1 bg-indigo-400/30 rounded-full overflow-hidden",children:e.jsx("div",{className:"h-full bg-white/80 rounded-full transition-all duration-500",style:{width:`${Math.max(se,5)}%`}})}),te&&e.jsxs("div",{className:"text-[10px] text-indigo-200 truncate max-w-40",children:[se,"% — ",te]})]}):e.jsxs(e.Fragment,{children:[e.jsx(Te,{size:13}),t==="zh"?z?"确认更新并上传":"确认安装并上传":z?"Confirm & Update":"Confirm & Install"]})})]})]})]})})}function Ge({lang:r}){return e.jsxs("span",{className:"inline-flex items-center gap-1 bg-amber-50 text-amber-700 border border-amber-200 text-xs font-bold px-2 py-1 rounded uppercase tracking-wider",title:r==="zh"?"该插件使用旧执行格式运行。新格式版本可能可用。":"This plugin uses the old execution format. A new-format version may be available.",children:[e.jsx(pe,{size:10}),r==="zh"?"可迁移":"Migratable"]})}function He({plugins:r,lang:s,showSystemPlugins:t,marketMap:d,checkingUpdateId:p,oneClickUpdatingId:u,handleCheckUpdate:v,handleOneClickUpdate:b,setChangelogModalPlugin:k,setSettingsPlugin:x,setUpdateTargetPluginId:D,updateFileInputRef:C,onToggle:L,onDelete:A}){const $=be(o=>o.dashboardVisibility);return e.jsx("div",{className:"flex-1 overflow-y-auto p-6 bg-gray-50/30",children:e.jsx("div",{className:"grid grid-cols-1 xl:grid-cols-2 2xl:grid-cols-4 gap-4",children:r.filter(o=>{const n=o.id.startsWith("@openlearn/");return t?!0:!n}).map(o=>{let n={description:"扩展 Edu OS 功能的自定义插件。",author:"Community",version:"",manifestId:"",capabilities:[],toolCount:0,studentViewCount:0,teacherWidgetCount:0,hasConfig:!1,repository:"",homepage:""};try{const l=JSON.parse(o.manifest);l.description&&(n.description=l.description),l.author&&(n.author=l.author),l.version&&(n.version=l.version),l.id&&(n.manifestId=l.id),l.repository&&(n.repository=typeof l.repository=="string"?l.repository:l.repository.url||""),l.homepage&&(n.homepage=l.homepage),l.capabilitiesProposed&&(n.capabilities=l.capabilitiesProposed),l.contributes?.["classroom.tool"]?n.toolCount=l.contributes["classroom.tool"].length:l.classroomTools&&(n.toolCount=l.classroomTools.length),l.contributes?.["student.view"]&&(n.studentViewCount=l.contributes["student.view"].length),l.contributes?.["teacher.dashboard.widget"]&&(n.teacherWidgetCount=l.contributes["teacher.dashboard.widget"].length);const P=l.configuration?.properties;P&&Object.keys(P).length>0&&(n.hasConfig=!0),l.updateSource?.type&&l.updateSource?.repo&&(n.updateSource=l.updateSource)}catch{}const c=o.created_at?new Date(o.created_at).toLocaleDateString(s==="zh"?"zh-CN":"en-US",{year:"numeric",month:"short",day:"numeric"}):"—",j=o.id.startsWith("@openlearn/"),N=$.get(o.id)??!0,i=d.get(n.manifestId||o.id),m=!!i?.hasUpdate,g=i?.error||null;return e.jsxs("div",{className:`bg-white rounded-xl border border-gray-200 p-5 shadow-sm hover:shadow-md transition-all relative overflow-hidden group flex flex-col gap-3 h-full ${o.status!=="active"?"opacity-75":""}`,children:[e.jsxs("div",{className:"absolute top-0 right-0 p-3 flex items-center gap-1.5 flex-wrap justify-end",children:[m&&e.jsx("span",{title:s==="zh"?`点击查看新特性${i.isPrerelease?"(预发布版本)":""}并升级至 v${i.latestVersion}`:`Upgradeable to v${i.latestVersion}${i.isPrerelease?" (pre-release)":""}`,className:`text-[10px] font-bold px-2.5 py-0.5 rounded-full shadow-sm flex items-center gap-1 shrink-0 cursor-pointer ${i.isPrerelease?"bg-gradient-to-r from-amber-500 to-orange-500 text-white animate-pulse":"bg-gradient-to-r from-blue-600 to-indigo-600 text-white animate-pulse"}`,onClick:()=>k({...o,marketItem:i}),children:e.jsxs("span",{children:[i.isPrerelease?"🔶 ":"⚡ ",s==="zh"?`${i.isPrerelease?"预发布 ":"发现新版本 "}v${i.latestVersion}`:`${i.isPrerelease?"Pre-release ":"New "}v${i.latestVersion}`]})}),g&&!m&&e.jsx("span",{title:g,className:"text-[10px] font-semibold bg-amber-50 text-amber-700 border border-amber-200 px-2.5 py-0.5 rounded-full flex items-center gap-1 shrink-0 cursor-default",children:e.jsxs("span",{children:["⚠️ ",s==="zh"?"检查失败":"Check failed"]})}),e.jsxs("span",{className:`text-[10px] font-semibold px-2.5 py-0.5 rounded-full flex items-center gap-1 border transition-all ${o.status==="active"?"bg-emerald-50 text-emerald-750 border-emerald-250":"bg-slate-100 text-slate-500 border-slate-200"}`,children:[e.jsx("span",{className:`w-1.5 h-1.5 rounded-full ${o.status==="active"?"bg-emerald-500 animate-pulse":"bg-slate-400"}`}),e.jsx("span",{children:o.status==="active"?s==="zh"?"已启用":"ACTIVE":s==="zh"?"已停用":"INACTIVE"})]}),o.execution_mode==="esm"&&e.jsx("span",{className:"text-[10px] font-bold bg-indigo-50 text-indigo-700 border border-indigo-150 px-1.5 py-0.5 rounded uppercase tracking-wider",children:"ESM"}),o.execution_mode==="legacy"&&e.jsx(Ge,{lang:s}),j&&e.jsx("span",{className:"text-[10px] font-bold bg-violet-50 text-violet-700 border border-violet-200 px-1.5 py-0.5 rounded uppercase tracking-wider",children:s==="zh"?"系统":"SYSTEM"})]}),e.jsxs("div",{className:"flex items-start gap-3 pr-24",children:[e.jsx("div",{className:"w-11 h-11 bg-indigo-50 text-indigo-600 rounded-lg flex items-center justify-center border border-indigo-100 group-hover:bg-indigo-600 group-hover:text-white transition-colors shrink-0",children:e.jsx(De,{size:22})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[e.jsx("h4",{className:"font-semibold text-gray-900 line-clamp-1",children:o.name}),n.version&&e.jsxs("span",{className:"text-[10px] font-mono font-bold bg-gray-100 text-gray-500 border border-gray-200 px-1.5 py-0.5 rounded shrink-0",children:["v",n.version]})]}),n.manifestId&&e.jsx("p",{className:"text-[10px] text-gray-400 font-mono truncate mt-0.5",title:n.manifestId,children:n.manifestId})]})]}),e.jsx("p",{className:"text-xs text-gray-500 line-clamp-2 leading-relaxed",children:n.description}),(n.toolCount>0||n.studentViewCount>0||n.teacherWidgetCount>0)&&e.jsxs("div",{className:"flex flex-wrap gap-1.5",children:[n.toolCount>0&&e.jsxs("span",{className:"inline-flex items-center gap-1 text-[10px] font-medium bg-indigo-50 text-indigo-600 border border-indigo-100 px-2 py-0.5 rounded-full",children:[e.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-indigo-400"}),s==="zh"?`${n.toolCount} 个课堂工具`:`${n.toolCount} classroom tool${n.toolCount>1?"s":""}`]}),n.studentViewCount>0&&e.jsxs("span",{className:"inline-flex items-center gap-1 text-[10px] font-medium bg-sky-50 text-sky-600 border border-sky-100 px-2 py-0.5 rounded-full",children:[e.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-sky-400"}),s==="zh"?`${n.studentViewCount} 个学生视图`:`${n.studentViewCount} student view${n.studentViewCount>1?"s":""}`]}),n.teacherWidgetCount>0&&e.jsxs("span",{className:"inline-flex items-center gap-1 text-[10px] font-medium bg-amber-50 text-amber-600 border border-amber-100 px-2 py-0.5 rounded-full",children:[e.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-amber-400"}),s==="zh"?`${n.teacherWidgetCount} 个教师组件`:`${n.teacherWidgetCount} teacher widget${n.teacherWidgetCount>1?"s":""}`]}),n.capabilities.length>0&&e.jsxs("span",{className:"inline-flex items-center gap-1 text-[10px] font-medium bg-rose-50 text-rose-600 border border-rose-100 px-2 py-0.5 rounded-full",children:[e.jsx(ve,{size:9}),s==="zh"?`${n.capabilities.length} 项权限`:`${n.capabilities.length} permission${n.capabilities.length>1?"s":""}`]})]}),e.jsxs("div",{className:"mt-auto flex flex-col gap-3 pt-1",children:[e.jsxs("div",{className:"flex items-center justify-between text-[10px] text-gray-400 border-t border-gray-100 pt-2 gap-2 flex-wrap",children:[e.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[e.jsxs("span",{className:"flex items-center gap-1 min-w-0",children:[e.jsx(Ee,{size:10,className:"shrink-0 text-gray-400"}),e.jsx("span",{className:"truncate",children:n.author})]}),(n.repository||n.homepage||i?.repository)&&e.jsxs("a",{href:n.repository||n.homepage||i?.repository,target:"_blank",rel:"noopener noreferrer",title:s==="zh"?"查看 Git 开源仓库 (GitHub/Gitee)":"View Git Repository",className:"inline-flex items-center gap-1 text-[10px] font-mono text-indigo-600 hover:text-indigo-800 bg-indigo-50 hover:bg-indigo-100 px-1.5 py-0.5 rounded border border-indigo-200/60 transition-colors shrink-0",children:[e.jsx(we,{size:10}),e.jsx("span",{className:"truncate max-w-[130px]",children:(n.repository||n.homepage||i?.repository).replace(/^https?:\/\//,"")})]})]}),e.jsxs("span",{className:"flex items-center gap-1 shrink-0 ml-auto",children:[e.jsx("span",{children:s==="zh"?"安装于":"Installed"}),e.jsx("span",{className:"font-mono",children:c})]})]}),e.jsxs("div",{className:"flex items-center gap-1.5 flex-wrap min-h-[34px]",children:[n.updateSource&&e.jsxs("button",{onClick:()=>v(o.id,n.manifestId||o.id),disabled:p===o.id,className:`px-2.5 py-1.5 text-xs font-medium rounded-lg border transition-colors flex items-center gap-1 cursor-pointer disabled:opacity-50 ${m?"border-blue-200 bg-blue-50 text-blue-700 hover:bg-blue-100":g?"border-amber-200 bg-amber-50 text-amber-700 hover:bg-amber-100":"border-gray-200 bg-gray-50 text-gray-600 hover:bg-gray-100"}`,title:s==="zh"?"手动检查远端更新":"Check for updates",children:[p===o.id?e.jsx(le,{size:12,className:"animate-spin"}):e.jsx(le,{size:12}),e.jsx("span",{children:s==="zh"?"检查更新":"Check"})]}),m?e.jsxs(e.Fragment,{children:[e.jsx("button",{onClick:()=>b(o.id,i),disabled:u===o.id,className:"px-3 py-1.5 text-xs font-semibold rounded-lg bg-gradient-to-r from-blue-600 to-indigo-600 text-white hover:from-blue-700 hover:to-indigo-700 shadow-sm transition-all flex items-center gap-1.5 disabled:opacity-50 cursor-pointer",children:u===o.id?e.jsx(le,{size:12,className:"animate-spin"}):e.jsxs("span",{children:["🚀 ",s==="zh"?`一键热更新 v${i.latestVersion}`:`Update v${i.latestVersion}`]})}),e.jsxs("button",{onClick:()=>k({...o,marketItem:i}),className:"px-2.5 py-1.5 text-xs font-medium rounded-lg bg-indigo-50 text-indigo-700 hover:bg-indigo-100 border border-indigo-200/60 transition-colors flex items-center gap-1 cursor-pointer",children:[e.jsx(Me,{size:12}),e.jsx("span",{children:s==="zh"?"新特性":"Notes"})]})]}):null,e.jsx("button",{onClick:()=>L(o.id),className:`px-3 py-1.5 text-xs font-medium rounded-lg transition-colors ${o.status==="active"?"bg-amber-50 text-amber-600 hover:bg-amber-100":"bg-green-50 text-green-600 hover:bg-green-100"}`,children:o.status==="active"?s==="zh"?"禁用":"Disable":s==="zh"?"启用":"Enable"}),e.jsxs("button",{onClick:()=>{const l=!N;be.getState().setDashboardVisibility(o.id,l)},title:N?s==="zh"?"在系统总览中隐藏":"Hide from Dashboard":s==="zh"?"在系统总览中显示":"Show in Dashboard",className:`px-3 py-1.5 text-xs font-medium rounded-lg transition-colors flex items-center gap-1.5 ${N?"bg-indigo-50 text-indigo-700 hover:bg-indigo-100 border border-indigo-200/60":"bg-gray-50 text-gray-500 hover:bg-gray-100 border border-gray-200/60"}`,children:[e.jsx("span",{children:s==="zh"?"总览":"Dash"}),e.jsx("span",{className:`w-7 h-3.5 rounded-full transition-colors flex items-center p-0.5 shrink-0 ${N?"bg-indigo-600":"bg-gray-300"}`,children:e.jsx("span",{className:`w-2.5 h-2.5 rounded-full bg-white shadow-sm transition-transform ${N?"translate-x-3.5":"translate-x-0"}`})})]}),n.hasConfig&&e.jsxs("button",{onClick:()=>x({id:o.id,name:o.name,manifest:o.manifest}),className:"px-3 py-1.5 text-xs font-medium rounded-lg bg-indigo-50 text-indigo-600 hover:bg-indigo-100 transition-colors flex items-center gap-1",children:[e.jsx(ue,{size:12}),s==="zh"?"设置":"Settings"]}),!j&&e.jsxs(e.Fragment,{children:[e.jsx("button",{onClick:()=>{D(o.id),C.current?.click()},className:"px-3 py-1.5 text-xs font-medium rounded-lg bg-sky-50 text-sky-700 hover:bg-sky-100 transition-colors",children:s==="zh"?"更新":"Update"}),e.jsx("button",{onClick:()=>A(o.id),className:"px-3 py-1.5 text-xs font-medium rounded-lg bg-red-50 text-red-600 hover:bg-red-100 transition-colors",children:s==="zh"?"删除":"Delete"})]}),o.execution_mode==="legacy"&&e.jsx("button",{onClick:()=>document.getElementById("zip-plugin-uploader")?.click(),className:"px-3 py-1.5 text-xs font-medium rounded-lg bg-amber-600 text-white hover:bg-amber-700 transition-colors",title:s==="zh"?"上传新格式 ZIP 包以完成迁移":"Upload new-format ZIP package to migrate",children:s==="zh"?"迁移":"Migrate"})]})]})]},o.id)})})})}function Qe(r){if(!r||typeof r!="string")return null;try{const s=new Function("exports","require","module",r),t={},d={exports:t};return s(t,u=>u==="@openlearn/plugin-sdk"?{ICommandBusServiceToken:"@openlearn/core:ICommandBusService",IEventBusServiceToken:"@openlearn/core:IEventBusService",IActionRegistryServiceToken:"@openlearn/core:IActionRegistryService",ICapabilityServiceToken:"@openlearn/core:ICapabilityService",IProcessServiceToken:"@openlearn/core:IProcessService",IStorageServiceToken:"@openlearn/core:IStorageService",IAIServiceToken:"@openlearn/core:IAIService",IDatabaseToken:"@openlearn/core:IDatabase",IPluginHostToken:"@openlearn/core:IPluginHost"}:{},d),d.exports.default||t.default||d.exports}catch{return null}}const Ke=`exports.default = {
3
3
  manifest: {
4
4
  id: "ext-ai-quiz-gen",
@@ -1 +1 @@
1
- import{j as e}from"./vendor-react-0Lg0vA-4.js";import{m as O}from"./index-CYzNsYZB.js";import{W as w,w as C,o as k}from"./vendor-icons-Dq6MhgH9.js";import"./vendor-pdf-Cp-cYteE.js";import"./vendor-utils-BEhuP0Zq.js";import"./vendor-motion-DjY2czvL.js";import"./vendor-pptx-B_NheIKl.js";import"./vendor-charts-CRXa4AlU.js";function _(z){const{isQuizGeneratorOpen:S,setIsQuizGeneratorOpen:x,lessons:g,quizGenMode:n,setQuizGenMode:u,quizGenSelectedLessonId:l,setQuizGenSelectedLessonId:Q,quizGenTopic:d,setQuizGenTopic:M,isGeneratingSuggestions:p,setIsGeneratingSuggestions:h,suggestedObjectives:b,setSuggestedObjectives:f,suggestedQuestions:r,setSuggestedQuestions:m,quizGenTimeLimit:j,setQuizGenTimeLimit:G,savingQuiz:y,setSavingQuiz:v,quizGeneratorClassId:o,fetchClassDashboard:N}=z;return e.jsx(e.Fragment,{children:S&&e.jsx("div",{className:"fixed inset-0 bg-gray-900/40 backdrop-blur-sm flex items-center justify-center p-6 z-50 overflow-y-auto text-gray-850",children:e.jsxs(O.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-3xl flex flex-col overflow-hidden max-h-[90vh]",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(w,{className:"text-indigo-600 animate-pulse",size:20}),e.jsx("h2",{className:"font-bold text-gray-800 text-lg",children:"AI-Objective Quiz Generator"})]}),e.jsx("button",{onClick:()=>x(!1),className:"text-gray-400 hover:text-gray-600 font-bold p-1 hover:bg-gray-200 rounded transition-colors",children:"×"})]}),e.jsxs("div",{className:"flex-1 overflow-y-auto p-6 space-y-6",children:[r.length===0&&e.jsxs("div",{className:"space-y-4",children:[e.jsx("div",{className:"bg-indigo-50/80 p-4 rounded-xl border border-indigo-100 text-xs text-indigo-800 leading-relaxed font-sans",children:"Choose a lesson to scan. Our advanced AI model will run a deep semantic scan across the entire lesson curriculum content, discover your core learning objectives, and construct interactive multiple-choice questions aligning precisely with each of them."}),e.jsxs("div",{className:"font-sans",children:[e.jsx("label",{className:"block text-xs font-semibold text-gray-500 uppercase tracking-wider mb-2",children:"Scan Core Selection Mode"}),e.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[e.jsxs("button",{onClick:()=>u("scan_lesson"),className:`p-3 rounded-lg border text-left flex flex-col transition-all ${n==="scan_lesson"?"border-indigo-600 bg-indigo-50/40 ring-2 ring-indigo-100":"border-gray-200 hover:border-gray-300"}`,children:[e.jsx("span",{className:"font-semibold text-sm text-indigo-900",children:"Curriculum Lesson Scanning"}),e.jsx("span",{className:"text-[10px] text-gray-500 mt-1",children:"Examines real Markdown content inside virtual lesson modules."})]}),e.jsxs("button",{onClick:()=>u("topic"),className:`p-3 rounded-lg border text-left flex flex-col transition-all ${n==="topic"?"border-indigo-600 bg-indigo-50/40 ring-2 ring-indigo-100":"border-gray-200 hover:border-gray-300"}`,children:[e.jsx("span",{className:"font-semibold text-sm text-indigo-900",children:"Custom Keyword / Topic"}),e.jsx("span",{className:"text-[10px] text-gray-500 mt-1",children:"Provide a custom prompt keyword or objective manually."})]})]})]}),n==="scan_lesson"?e.jsxs("div",{className:"font-sans",children:[e.jsx("label",{className:"block text-xs font-semibold text-gray-500 uppercase tracking-wider mb-2",children:"Select Lesson to Scan"}),g.length===0?e.jsx("div",{className:"text-gray-500 text-xs py-3 border rounded border-dashed text-center",children:"No lessons available. Please create a lesson first."}):e.jsxs("select",{value:l,onChange:s=>Q(s.target.value),className:"w-full p-2.5 bg-white border border-gray-200 rounded-lg text-sm text-gray-800 focus:border-indigo-500 focus:outline-none shadow-sm",children:[e.jsx("option",{value:"",children:"-- Choose a lesson --"}),g.map(s=>e.jsx("option",{value:s.id,children:s.title},s.id))]})]}):e.jsxs("div",{className:"font-sans",children:[e.jsx("label",{className:"block text-xs font-semibold text-gray-505 uppercase tracking-wider mb-2",children:"Custom Topic Prompt"}),e.jsx("input",{type:"text",placeholder:"e.g. Introduction to React state, Cloud SQL setup...",value:d,onChange:s=>M(s.target.value),className:"w-full p-2.5 bg-white border border-gray-200 rounded-lg text-sm focus:border-indigo-500 focus:outline-none shadow-sm text-gray-800"})]}),e.jsx("div",{className:"pt-4 flex justify-end font-sans",children:e.jsx("button",{disabled:p||n==="scan_lesson"&&!l||n==="topic"&&!d.trim(),onClick:async()=>{h(!0);try{if(n==="scan_lesson"){const s=await fetch(`/api/classes/${o}/assignments/suggest`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({lessonId:l})});if(s.ok){const t=await s.json();f(t.learningObjectives||[]),m((t.questions||[]).map(a=>({...a,selected:!0})))}else alert("Error generating suggestions. Please make sure the selected lesson has content.")}else(await fetch(`/api/classes/${o}/assignments/generate`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({topic:d})})).ok?(await N(o),x(!1)):alert("Error generating topic quiz.")}catch(s){console.error(s),alert(s.message)}finally{h(!1)}},className:"px-5 py-2.5 bg-indigo-600 hover:bg-indigo-700 disabled:opacity-50 text-white rounded-lg font-medium text-xs shadow transition flex items-center gap-2",children:p?e.jsxs(e.Fragment,{children:[e.jsx(C,{size:16,className:"animate-spin"}),e.jsx("span",{children:"AI Scanning Content..."})]}):e.jsxs(e.Fragment,{children:[e.jsx(w,{size:16}),e.jsx("span",{children:"Generate Key MCQ Quiz"})]})})})]}),r.length>0&&e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"font-sans",children:[e.jsx("div",{className:"text-xs font-bold text-gray-500 uppercase tracking-wider mb-2",children:"Identified Core Objectives"}),e.jsx("div",{className:"flex flex-wrap gap-2",children:b.map((s,t)=>e.jsxs("span",{className:"px-2.5 py-1 bg-teal-50 text-teal-800 border border-teal-200 rounded-full text-xs font-semibold",children:["🎯 ",s]},t))})]}),e.jsxs("div",{className:"space-y-4 font-sans",children:[e.jsx("div",{className:"text-xs font-bold text-gray-500 uppercase tracking-wider font-semibold",children:"Suggested MCQ Questions"}),e.jsx("div",{className:"space-y-3",children:r.map((s,t)=>e.jsxs("div",{className:"p-4 rounded-xl border border-gray-150 bg-gray-50/50 hover:bg-gray-50 transition space-y-3 text-gray-800 text-gray-850",children:[e.jsxs("div",{className:"flex items-start justify-between",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"w-5 h-5 rounded-full bg-indigo-150 text-indigo-700 flex items-center justify-center text-xs font-bold shrink-0",children:t+1}),e.jsxs("span",{className:"text-[10px] font-semibold text-teal-700 bg-teal-50 px-2.5 py-0.5 rounded border border-teal-100",children:["objective: ",s.objective]})]}),e.jsx("input",{type:"checkbox",checked:!!s.selected,onChange:a=>{const i=[...r];i[t].selected=a.target.checked,m(i)},className:"w-4 h-4 text-indigo-600 border-gray-300 rounded focus:ring-indigo-500"})]}),e.jsx("p",{className:"font-semibold text-gray-800 text-sm leading-relaxed",children:s.question}),e.jsx("div",{className:"grid grid-cols-2 gap-2 text-xs",children:s.options.map((a,i)=>{const c=a===s.correctAnswer;return e.jsxs("div",{className:`p-2 rounded border flex items-center justify-between ${c?"bg-green-50 border-green-200 text-green-955 font-semibold":"bg-white border-gray-100 text-gray-700"}`,children:[e.jsx("span",{children:a}),c&&e.jsx(k,{size:12,className:"text-green-600 shrink-0"})]},i)})})]},t))})]}),e.jsxs("div",{className:"pt-4 border-t border-gray-100 flex justify-between items-center font-sans",children:[e.jsx("button",{onClick:()=>{f([]),m([])},className:"px-4 py-2 bg-gray-100 hover:bg-gray-200 text-gray-700 rounded-lg text-xs font-semibold transition",children:"Back / Scan New"}),e.jsxs("div",{className:"flex items-center gap-2 border border-indigo-150 bg-indigo-50/50 px-3 py-1.5 rounded-lg text-xs font-semibold text-indigo-900",children:[e.jsx("span",{children:"⏱️ Quiz Time Limit:"}),e.jsxs("select",{value:j,onChange:s=>G(Number(s.target.value)),className:"bg-transparent text-xs text-indigo-950 font-bold focus:outline-none cursor-pointer",children:[e.jsx("option",{className:"text-gray-800",value:0,children:"No Limit"}),e.jsx("option",{className:"text-gray-800",value:1,children:"1 Min"}),e.jsx("option",{className:"text-gray-800",value:2,children:"2 Mins"}),e.jsx("option",{className:"text-gray-800",value:5,children:"5 Mins"}),e.jsx("option",{className:"text-gray-800",value:10,children:"10 Mins"}),e.jsx("option",{className:"text-gray-800",value:15,children:"15 Mins"}),e.jsx("option",{className:"text-gray-800",value:20,children:"20 Mins"}),e.jsx("option",{className:"text-gray-800",value:30,children:"30 Mins"}),e.jsx("option",{className:"text-gray-800",value:45,children:"45 Mins"}),e.jsx("option",{className:"text-gray-800",value:60,children:"60 Mins"})]})]}),e.jsxs("button",{disabled:y||r.filter(s=>s.selected).length===0,onClick:async()=>{v(!0);try{const s=g.find(i=>i.id===l),t=s?s.title:d||"Custom Objective";(await fetch(`/api/classes/${o}/assignments/create-suggested-quiz`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({title:`MCQ Evaluation: ${t}`,description:"Automatic evaluation based on core learning objectives.",questions:r.filter(i=>i.selected).map(({selected:i,...c})=>c),learningObjectives:b,timeLimit:j})})).ok?(await N(o),x(!1)):alert("Failed to save suggested quiz.")}catch(s){console.error(s),alert(s.message)}finally{v(!1)}},className:"px-5 py-2.5 bg-indigo-600 hover:bg-indigo-700 text-white rounded-lg font-medium text-xs shadow hover:shadow-md transition flex items-center gap-2",children:[y?e.jsx(C,{size:16,className:"animate-spin"}):e.jsx(k,{size:16}),e.jsx("span",{children:"Create Assessment Quiz"})]})]})]})]})]})})})}export{_ as QuizGeneratorModal};
1
+ import{j as e}from"./vendor-react-0Lg0vA-4.js";import{m as O}from"./index-CerSuw-h.js";import{W as w,w as C,o as k}from"./vendor-icons-Dq6MhgH9.js";import"./vendor-pdf-Cp-cYteE.js";import"./vendor-utils-BEhuP0Zq.js";import"./vendor-motion-DjY2czvL.js";import"./vendor-pptx-B_NheIKl.js";import"./vendor-charts-CRXa4AlU.js";function _(z){const{isQuizGeneratorOpen:S,setIsQuizGeneratorOpen:x,lessons:g,quizGenMode:n,setQuizGenMode:u,quizGenSelectedLessonId:l,setQuizGenSelectedLessonId:Q,quizGenTopic:d,setQuizGenTopic:M,isGeneratingSuggestions:p,setIsGeneratingSuggestions:h,suggestedObjectives:b,setSuggestedObjectives:f,suggestedQuestions:r,setSuggestedQuestions:m,quizGenTimeLimit:j,setQuizGenTimeLimit:G,savingQuiz:y,setSavingQuiz:v,quizGeneratorClassId:o,fetchClassDashboard:N}=z;return e.jsx(e.Fragment,{children:S&&e.jsx("div",{className:"fixed inset-0 bg-gray-900/40 backdrop-blur-sm flex items-center justify-center p-6 z-50 overflow-y-auto text-gray-850",children:e.jsxs(O.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-3xl flex flex-col overflow-hidden max-h-[90vh]",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(w,{className:"text-indigo-600 animate-pulse",size:20}),e.jsx("h2",{className:"font-bold text-gray-800 text-lg",children:"AI-Objective Quiz Generator"})]}),e.jsx("button",{onClick:()=>x(!1),className:"text-gray-400 hover:text-gray-600 font-bold p-1 hover:bg-gray-200 rounded transition-colors",children:"×"})]}),e.jsxs("div",{className:"flex-1 overflow-y-auto p-6 space-y-6",children:[r.length===0&&e.jsxs("div",{className:"space-y-4",children:[e.jsx("div",{className:"bg-indigo-50/80 p-4 rounded-xl border border-indigo-100 text-xs text-indigo-800 leading-relaxed font-sans",children:"Choose a lesson to scan. Our advanced AI model will run a deep semantic scan across the entire lesson curriculum content, discover your core learning objectives, and construct interactive multiple-choice questions aligning precisely with each of them."}),e.jsxs("div",{className:"font-sans",children:[e.jsx("label",{className:"block text-xs font-semibold text-gray-500 uppercase tracking-wider mb-2",children:"Scan Core Selection Mode"}),e.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[e.jsxs("button",{onClick:()=>u("scan_lesson"),className:`p-3 rounded-lg border text-left flex flex-col transition-all ${n==="scan_lesson"?"border-indigo-600 bg-indigo-50/40 ring-2 ring-indigo-100":"border-gray-200 hover:border-gray-300"}`,children:[e.jsx("span",{className:"font-semibold text-sm text-indigo-900",children:"Curriculum Lesson Scanning"}),e.jsx("span",{className:"text-[10px] text-gray-500 mt-1",children:"Examines real Markdown content inside virtual lesson modules."})]}),e.jsxs("button",{onClick:()=>u("topic"),className:`p-3 rounded-lg border text-left flex flex-col transition-all ${n==="topic"?"border-indigo-600 bg-indigo-50/40 ring-2 ring-indigo-100":"border-gray-200 hover:border-gray-300"}`,children:[e.jsx("span",{className:"font-semibold text-sm text-indigo-900",children:"Custom Keyword / Topic"}),e.jsx("span",{className:"text-[10px] text-gray-500 mt-1",children:"Provide a custom prompt keyword or objective manually."})]})]})]}),n==="scan_lesson"?e.jsxs("div",{className:"font-sans",children:[e.jsx("label",{className:"block text-xs font-semibold text-gray-500 uppercase tracking-wider mb-2",children:"Select Lesson to Scan"}),g.length===0?e.jsx("div",{className:"text-gray-500 text-xs py-3 border rounded border-dashed text-center",children:"No lessons available. Please create a lesson first."}):e.jsxs("select",{value:l,onChange:s=>Q(s.target.value),className:"w-full p-2.5 bg-white border border-gray-200 rounded-lg text-sm text-gray-800 focus:border-indigo-500 focus:outline-none shadow-sm",children:[e.jsx("option",{value:"",children:"-- Choose a lesson --"}),g.map(s=>e.jsx("option",{value:s.id,children:s.title},s.id))]})]}):e.jsxs("div",{className:"font-sans",children:[e.jsx("label",{className:"block text-xs font-semibold text-gray-505 uppercase tracking-wider mb-2",children:"Custom Topic Prompt"}),e.jsx("input",{type:"text",placeholder:"e.g. Introduction to React state, Cloud SQL setup...",value:d,onChange:s=>M(s.target.value),className:"w-full p-2.5 bg-white border border-gray-200 rounded-lg text-sm focus:border-indigo-500 focus:outline-none shadow-sm text-gray-800"})]}),e.jsx("div",{className:"pt-4 flex justify-end font-sans",children:e.jsx("button",{disabled:p||n==="scan_lesson"&&!l||n==="topic"&&!d.trim(),onClick:async()=>{h(!0);try{if(n==="scan_lesson"){const s=await fetch(`/api/classes/${o}/assignments/suggest`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({lessonId:l})});if(s.ok){const t=await s.json();f(t.learningObjectives||[]),m((t.questions||[]).map(a=>({...a,selected:!0})))}else alert("Error generating suggestions. Please make sure the selected lesson has content.")}else(await fetch(`/api/classes/${o}/assignments/generate`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({topic:d})})).ok?(await N(o),x(!1)):alert("Error generating topic quiz.")}catch(s){console.error(s),alert(s.message)}finally{h(!1)}},className:"px-5 py-2.5 bg-indigo-600 hover:bg-indigo-700 disabled:opacity-50 text-white rounded-lg font-medium text-xs shadow transition flex items-center gap-2",children:p?e.jsxs(e.Fragment,{children:[e.jsx(C,{size:16,className:"animate-spin"}),e.jsx("span",{children:"AI Scanning Content..."})]}):e.jsxs(e.Fragment,{children:[e.jsx(w,{size:16}),e.jsx("span",{children:"Generate Key MCQ Quiz"})]})})})]}),r.length>0&&e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"font-sans",children:[e.jsx("div",{className:"text-xs font-bold text-gray-500 uppercase tracking-wider mb-2",children:"Identified Core Objectives"}),e.jsx("div",{className:"flex flex-wrap gap-2",children:b.map((s,t)=>e.jsxs("span",{className:"px-2.5 py-1 bg-teal-50 text-teal-800 border border-teal-200 rounded-full text-xs font-semibold",children:["🎯 ",s]},t))})]}),e.jsxs("div",{className:"space-y-4 font-sans",children:[e.jsx("div",{className:"text-xs font-bold text-gray-500 uppercase tracking-wider font-semibold",children:"Suggested MCQ Questions"}),e.jsx("div",{className:"space-y-3",children:r.map((s,t)=>e.jsxs("div",{className:"p-4 rounded-xl border border-gray-150 bg-gray-50/50 hover:bg-gray-50 transition space-y-3 text-gray-800 text-gray-850",children:[e.jsxs("div",{className:"flex items-start justify-between",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"w-5 h-5 rounded-full bg-indigo-150 text-indigo-700 flex items-center justify-center text-xs font-bold shrink-0",children:t+1}),e.jsxs("span",{className:"text-[10px] font-semibold text-teal-700 bg-teal-50 px-2.5 py-0.5 rounded border border-teal-100",children:["objective: ",s.objective]})]}),e.jsx("input",{type:"checkbox",checked:!!s.selected,onChange:a=>{const i=[...r];i[t].selected=a.target.checked,m(i)},className:"w-4 h-4 text-indigo-600 border-gray-300 rounded focus:ring-indigo-500"})]}),e.jsx("p",{className:"font-semibold text-gray-800 text-sm leading-relaxed",children:s.question}),e.jsx("div",{className:"grid grid-cols-2 gap-2 text-xs",children:s.options.map((a,i)=>{const c=a===s.correctAnswer;return e.jsxs("div",{className:`p-2 rounded border flex items-center justify-between ${c?"bg-green-50 border-green-200 text-green-955 font-semibold":"bg-white border-gray-100 text-gray-700"}`,children:[e.jsx("span",{children:a}),c&&e.jsx(k,{size:12,className:"text-green-600 shrink-0"})]},i)})})]},t))})]}),e.jsxs("div",{className:"pt-4 border-t border-gray-100 flex justify-between items-center font-sans",children:[e.jsx("button",{onClick:()=>{f([]),m([])},className:"px-4 py-2 bg-gray-100 hover:bg-gray-200 text-gray-700 rounded-lg text-xs font-semibold transition",children:"Back / Scan New"}),e.jsxs("div",{className:"flex items-center gap-2 border border-indigo-150 bg-indigo-50/50 px-3 py-1.5 rounded-lg text-xs font-semibold text-indigo-900",children:[e.jsx("span",{children:"⏱️ Quiz Time Limit:"}),e.jsxs("select",{value:j,onChange:s=>G(Number(s.target.value)),className:"bg-transparent text-xs text-indigo-950 font-bold focus:outline-none cursor-pointer",children:[e.jsx("option",{className:"text-gray-800",value:0,children:"No Limit"}),e.jsx("option",{className:"text-gray-800",value:1,children:"1 Min"}),e.jsx("option",{className:"text-gray-800",value:2,children:"2 Mins"}),e.jsx("option",{className:"text-gray-800",value:5,children:"5 Mins"}),e.jsx("option",{className:"text-gray-800",value:10,children:"10 Mins"}),e.jsx("option",{className:"text-gray-800",value:15,children:"15 Mins"}),e.jsx("option",{className:"text-gray-800",value:20,children:"20 Mins"}),e.jsx("option",{className:"text-gray-800",value:30,children:"30 Mins"}),e.jsx("option",{className:"text-gray-800",value:45,children:"45 Mins"}),e.jsx("option",{className:"text-gray-800",value:60,children:"60 Mins"})]})]}),e.jsxs("button",{disabled:y||r.filter(s=>s.selected).length===0,onClick:async()=>{v(!0);try{const s=g.find(i=>i.id===l),t=s?s.title:d||"Custom Objective";(await fetch(`/api/classes/${o}/assignments/create-suggested-quiz`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({title:`MCQ Evaluation: ${t}`,description:"Automatic evaluation based on core learning objectives.",questions:r.filter(i=>i.selected).map(({selected:i,...c})=>c),learningObjectives:b,timeLimit:j})})).ok?(await N(o),x(!1)):alert("Failed to save suggested quiz.")}catch(s){console.error(s),alert(s.message)}finally{v(!1)}},className:"px-5 py-2.5 bg-indigo-600 hover:bg-indigo-700 text-white rounded-lg font-medium text-xs shadow hover:shadow-md transition flex items-center gap-2",children:[y?e.jsx(C,{size:16,className:"animate-spin"}):e.jsx(k,{size:16}),e.jsx("span",{children:"Create Assessment Quiz"})]})]})]})]})]})})})}export{_ as QuizGeneratorModal};
@@ -1 +1 @@
1
- import{j as e,r as N}from"./vendor-react-0Lg0vA-4.js";import{a9 as k,W as T,o as A,as as S,at as q,X as _}from"./vendor-icons-Dq6MhgH9.js";import{M as C}from"./index-CYzNsYZB.js";import{L as E}from"./LazyWhiteboard-CtkzSFtN.js";import"./vendor-pdf-Cp-cYteE.js";import"./vendor-utils-BEhuP0Zq.js";import"./vendor-motion-DjY2czvL.js";import"./vendor-pptx-B_NheIKl.js";import"./vendor-charts-CRXa4AlU.js";function O(l){const{setStudentViewStatus:t,setSelectedAssignment:r,selectedAssignment:d}=l;return e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("button",{onClick:()=>{t("dashboard"),r(null)},className:"flex items-center gap-2 text-indigo-600 hover:text-indigo-800 transition-colors font-medium text-sm",children:[e.jsx(k,{className:"rotate-180",size:16})," Back to Dashboard"]}),e.jsxs("h2",{className:"text-xl font-bold text-gray-800",children:["Assignment: ",d.title]})]})}function I(l){const{selectedAssignment:t,quizStudentAnswers:r,submitQuizAssignment:d}=l;return e.jsxs("div",{className:"w-1/3 border-r border-gray-100 pr-4 overflow-y-auto hidden md:block",children:[e.jsx("div",{className:"flex justify-between items-center mb-4",children:e.jsx("div",{className:"text-xs font-semibold uppercase tracking-wider text-gray-400",children:t?.content&&t.content.startsWith('{"quizType":"mcq_learning_objectives"')?"Assessment":"Question"})}),t?.content&&t.content.startsWith('{"quizType":"mcq_learning_objectives"')?e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"text-xs font-semibold uppercase tracking-wider text-teal-700 bg-teal-50 border border-teal-100 p-2.5 rounded-lg flex items-center gap-1.5 font-sans",children:[e.jsx(T,{size:12,className:"text-teal-600 animate-pulse"})," AI Interactive Evaluation"]}),e.jsx("p",{className:"text-xs text-gray-500 leading-relaxed font-sans",children:"This assessment was automatically mapped to the core learning objectives of your lesson by our tutoring assistant compiler."}),(()=>{try{const s=JSON.parse(t.content);return e.jsxs("div",{className:"space-y-2 font-sans",children:[e.jsx("div",{className:"text-[10px] font-bold text-gray-400 uppercase tracking-wider",children:"Lesson Learning Objectives:"}),e.jsx("ul",{className:"space-y-1.5",children:(s.learningObjectives||[]).map((i,c)=>e.jsxs("li",{className:"text-xs text-gray-755 flex items-start gap-1.5 font-medium leading-normal",children:[e.jsx("span",{className:"text-indigo-500 shrink-0 select-none",children:"🎯"}),e.jsx("span",{children:i})]},c))})]})}catch{return null}})()]}):e.jsx("div",{className:"prose prose-sm prose-indigo max-w-none mb-6",children:e.jsx(C,{children:t.content||""})}),!t.submission_status&&e.jsxs("div",{className:"mt-8 border-t border-gray-100 pt-6",children:[e.jsx("div",{className:"text-xs font-semibold uppercase tracking-wider text-gray-400 mb-2",children:"Ready to submit?"}),e.jsx("p",{className:"text-xs text-gray-500 mb-4",children:t?.content&&t.content.startsWith('{"quizType":"mcq_learning_objectives"')?"Please answer all the interactive questions on the evaluation sheet, then click Submit.":"You can use the whiteboard to draw or answer, then click submit when finished."}),e.jsx("button",{onClick:async()=>{const s=t?.content&&t.content.startsWith('{"quizType":"mcq_learning_objectives"');if(s&&JSON.stringify(r),s)try{const i=JSON.parse(t.content),c=Object.keys(r).length;if(c<i.questions.length&&!window.confirm(`You have only answered ${c}/${i.questions.length} questions. Are you sure you want to submit your answers?`))return}catch{}await d(!1)},className:"w-full py-2 bg-indigo-600 text-white rounded-lg shadow font-medium hover:bg-indigo-700 transition",children:"Submit"})]}),t.submission_status==="graded"&&t.feedback&&e.jsxs("div",{className:"mt-6 bg-green-50 p-4 rounded-xl border border-green-100",children:[e.jsxs("div",{className:"font-semibold text-green-800 text-sm mb-1 flex items-center gap-1",children:[e.jsx(A,{size:16})," Grade: ",t.score,"%"]}),e.jsx("div",{className:"text-xs text-green-700 whitespace-pre-wrap leading-relaxed font-sans",children:t.feedback})]})]})}function R({assignmentId:l,timeLimitMinutes:t,onTimeUp:r,isSubmitted:d}){const[s,i]=N.useState(null);if(N.useEffect(()=>{if(d||!t||t<=0){i(null);return}const n=`quiz_timer_start_${l}`;let m=sessionStorage.getItem(n),x=m?parseInt(m,10):null;x||(x=Date.now(),sessionStorage.setItem(n,x.toString()));const a=t*60,o=()=>{const j=Math.floor((Date.now()-x)/1e3),b=a-j;b<=0?(i(0),r()):i(b)};o();const g=setInterval(o,1e3);return()=>clearInterval(g)},[l,t,d,r]),!t||t<=0)return null;if(d)return e.jsxs("div",{className:"flex items-center gap-2 font-sans text-xs bg-gray-100 text-gray-600 px-3 py-1.5 rounded-lg border border-gray-200",children:[e.jsx(S,{size:14}),e.jsxs("span",{children:["Time Limit: ",t," mins (Completed)"]})]});if(s===null)return null;const c=Math.floor(s/60),p=s%60,u=s<60;return e.jsxs("div",{className:`flex items-center gap-3 font-sans px-4 py-2.5 rounded-xl border transition-all ${u?"bg-red-50 text-red-700 border-red-200 animate-pulse font-bold":s<180?"bg-amber-50 text-amber-700 border-amber-200 font-semibold":"bg-indigo-50 text-indigo-700 border-indigo-100"}`,children:[e.jsx(S,{size:16,className:u?"text-red-600 animate-pulse":"text-indigo-600"}),e.jsxs("div",{className:"flex-1 flex justify-between items-center text-xs gap-4",children:[e.jsxs("div",{children:[e.jsx("span",{className:"font-medium",children:"Time Remaining:"}),e.jsxs("span",{className:"font-mono ml-1 text-sm bg-black/5 text-slate-800 px-1.5 py-0.5 rounded font-bold",children:[c.toString().padStart(2,"0"),":",p.toString().padStart(2,"0")]})]}),u&&e.jsxs("span",{className:"flex items-center gap-1 text-[10px] uppercase tracking-wider text-red-600 font-bold animate-pulse",children:[e.jsx(q,{size:12})," Time is almost up!"]})]})]})}function W(l){const{selectedAssignment:t,subAssignmentTab:r,setSubAssignmentTab:d,quizStudentAnswers:s,setQuizStudentAnswers:i,submitQuizAssignment:c,elements:p,activeRole:u,activeStudentId:n,fetchElements:m}=l;return e.jsx("div",{className:"flex-1 relative flex flex-col min-h-0",children:(()=>{const x=t?.content&&t.content.startsWith('{"quizType":"mcq_learning_objectives"');return e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex justify-between items-center mb-2",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("span",{className:"text-xs font-semibold uppercase tracking-wider text-gray-500 pointer-events-none",children:x&&r==="quiz"?"Evaluation Sheet":"Live Canvas"}),x&&e.jsxs("div",{className:"flex bg-gray-100 p-0.5 rounded-lg border border-gray-200 text-xs",children:[e.jsx("button",{onClick:()=>d("quiz"),className:`px-2.5 py-0.5 rounded text-[10px] font-bold transition-all ${r==="quiz"?"bg-white text-indigo-700 shadow-sm":"text-gray-500 hover:text-gray-900"}`,children:"Interactive Test"}),e.jsx("button",{onClick:()=>d("whiteboard"),className:`px-2.5 py-0.5 rounded text-[10px] font-bold transition-all ${r==="whiteboard"?"bg-white text-indigo-700 shadow-sm":"text-gray-500 hover:text-gray-900"}`,children:"Sketch Whiteboard"})]})]}),t.submission_status&&e.jsx("div",{className:"text-[10px] uppercase font-bold text-gray-400 bg-gray-100 px-2 py-0.5 rounded",children:"Read Only"})]}),x&&r==="quiz"?e.jsx("div",{className:"flex-1 bg-gray-50/50 rounded-xl border border-gray-200 p-6 overflow-y-auto space-y-6",children:(()=>{try{const a=JSON.parse(t.content);return e.jsxs(e.Fragment,{children:[a.timeLimit>0&&e.jsx(R,{assignmentId:t.id,timeLimitMinutes:a.timeLimit,onTimeUp:()=>c(!0),isSubmitted:!!t.submission_status}),a.questions.map((o,g)=>{const j=s[g],b=!!t.submission_status,w=s[g]===o.correctAnswer;return e.jsxs("div",{className:"bg-white p-5 rounded-xl border border-gray-100 shadow-sm space-y-3 font-sans",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"w-6 h-6 rounded-full bg-indigo-50 text-indigo-700 flex items-center justify-center text-xs font-bold ring-1 ring-indigo-100",children:g+1}),e.jsxs("span",{className:"text-[10px] font-semibold text-teal-700 bg-teal-50 px-2.5 py-0.5 rounded-full border border-teal-100",children:["evaluates: ",o.objective]})]}),b&&e.jsx("span",{className:`text-[10px] font-bold px-2.5 py-0.5 rounded-full ${w?"bg-green-100 text-green-800":"bg-red-100 text-red-800"}`,children:w?"Correct ✓":`Incorrect (Correct Option: ${o.correctAnswer})`})]}),e.jsx("div",{className:"font-semibold text-gray-800 text-sm",children:o.question}),e.jsx("div",{className:"grid grid-cols-2 gap-3 text-xs pt-1",children:o.options.map((f,$)=>{const y=j===f,v=f===o.correctAnswer;let h="border-gray-200 hover:border-gray-300 bg-white text-gray-700 hover:bg-gray-50/50 cursor-pointer";return b?y?h=v?"border-green-600 bg-green-50 text-green-900 ring-2 ring-green-100":"border-red-600 bg-red-50 text-red-900 ring-2 ring-red-100":v?h="border-green-400 bg-green-50/20 text-green-900":h="border-gray-200 opacity-60 text-gray-400":y&&(h="border-indigo-600 bg-indigo-50/30 text-indigo-900 ring-2 ring-indigo-100 font-medium cursor-pointer"),e.jsxs("div",{onClick:()=>{b||i(z=>({...z,[g]:f}))},className:`p-3 rounded-xl border transition-all duration-150 flex items-center justify-between ${h}`,children:[e.jsx("span",{children:f}),y&&(b?v?e.jsx(A,{size:14,className:"text-green-600 shrink-0"}):e.jsx(_,{size:14,className:"text-red-600 shrink-0"}):e.jsx("div",{className:"w-2 h-2 rounded-full bg-indigo-600 shadow-sm shrink-0"}))]},$)})})]},g)})]})}catch{return e.jsx("div",{className:"text-xs text-red-500 font-sans",children:"Error parsing quiz structure."})}})()}):e.jsx("div",{className:`flex-1 min-h-0 flex flex-col ${t.submission_status?"opacity-90 pointer-events-none filter grayscale-[0.2]":""}`,children:e.jsx(E,{lessonId:`assignment-${t.id}-student-${n}`,elements:p,userRole:u,enableAutoAI:u==="student"&&!t.submission_status,onElementAdd:async(a,o)=>{await fetch(`/api/lessons/assignment-${t.id}-student-${n}/whiteboard`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({type:a,data:o})}),m(`assignment-${t.id}-student-${n}`)},onElementUpdate:async(a,o)=>{await fetch(`/api/lessons/assignment-${t.id}-student-${n}/whiteboard/${a}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({data:o})}),m(`assignment-${t.id}-student-${n}`)},onElementDelete:async a=>{await fetch(`/api/lessons/assignment-${t.id}-student-${n}/whiteboard/${a}`,{method:"DELETE"}),m(`assignment-${t.id}-student-${n}`)},onClearBoard:async()=>{await fetch(`/api/lessons/assignment-${t.id}-student-${n}/whiteboard`,{method:"DELETE"}),m(`assignment-${t.id}-student-${n}`)},onRefresh:()=>m(`assignment-${t.id}-student-${n}`)})})]})})()})}function G(l){const{selectedAssignment:t,setStudentViewStatus:r,setSelectedAssignment:d,quizStudentAnswers:s,submitQuizAssignment:i,subAssignmentTab:c,setSubAssignmentTab:p,setQuizStudentAnswers:u,elements:n,activeRole:m,activeStudentId:x,fetchElements:a}=l;return e.jsxs("div",{className:"flex flex-col h-full space-y-4",children:[e.jsx(O,{setStudentViewStatus:r,setSelectedAssignment:d,selectedAssignment:t}),e.jsxs("div",{className:"flex-1 flex gap-6 min-h-0 bg-white border border-gray-200 rounded-xl p-4 shadow-sm",children:[e.jsx(I,{selectedAssignment:t,quizStudentAnswers:s,submitQuizAssignment:i}),e.jsx(W,{selectedAssignment:t,subAssignmentTab:c,setSubAssignmentTab:p,quizStudentAnswers:s,setQuizStudentAnswers:u,submitQuizAssignment:i,elements:n,activeRole:m,activeStudentId:x,fetchElements:a})]})]})}export{G as StudentAssignmentView};
1
+ import{j as e,r as N}from"./vendor-react-0Lg0vA-4.js";import{a9 as k,W as T,o as A,as as S,at as q,X as _}from"./vendor-icons-Dq6MhgH9.js";import{M as C}from"./index-CerSuw-h.js";import{L as E}from"./LazyWhiteboard-D_U3t5Ft.js";import"./vendor-pdf-Cp-cYteE.js";import"./vendor-utils-BEhuP0Zq.js";import"./vendor-motion-DjY2czvL.js";import"./vendor-pptx-B_NheIKl.js";import"./vendor-charts-CRXa4AlU.js";function O(l){const{setStudentViewStatus:t,setSelectedAssignment:r,selectedAssignment:d}=l;return e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("button",{onClick:()=>{t("dashboard"),r(null)},className:"flex items-center gap-2 text-indigo-600 hover:text-indigo-800 transition-colors font-medium text-sm",children:[e.jsx(k,{className:"rotate-180",size:16})," Back to Dashboard"]}),e.jsxs("h2",{className:"text-xl font-bold text-gray-800",children:["Assignment: ",d.title]})]})}function I(l){const{selectedAssignment:t,quizStudentAnswers:r,submitQuizAssignment:d}=l;return e.jsxs("div",{className:"w-1/3 border-r border-gray-100 pr-4 overflow-y-auto hidden md:block",children:[e.jsx("div",{className:"flex justify-between items-center mb-4",children:e.jsx("div",{className:"text-xs font-semibold uppercase tracking-wider text-gray-400",children:t?.content&&t.content.startsWith('{"quizType":"mcq_learning_objectives"')?"Assessment":"Question"})}),t?.content&&t.content.startsWith('{"quizType":"mcq_learning_objectives"')?e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"text-xs font-semibold uppercase tracking-wider text-teal-700 bg-teal-50 border border-teal-100 p-2.5 rounded-lg flex items-center gap-1.5 font-sans",children:[e.jsx(T,{size:12,className:"text-teal-600 animate-pulse"})," AI Interactive Evaluation"]}),e.jsx("p",{className:"text-xs text-gray-500 leading-relaxed font-sans",children:"This assessment was automatically mapped to the core learning objectives of your lesson by our tutoring assistant compiler."}),(()=>{try{const s=JSON.parse(t.content);return e.jsxs("div",{className:"space-y-2 font-sans",children:[e.jsx("div",{className:"text-[10px] font-bold text-gray-400 uppercase tracking-wider",children:"Lesson Learning Objectives:"}),e.jsx("ul",{className:"space-y-1.5",children:(s.learningObjectives||[]).map((i,c)=>e.jsxs("li",{className:"text-xs text-gray-755 flex items-start gap-1.5 font-medium leading-normal",children:[e.jsx("span",{className:"text-indigo-500 shrink-0 select-none",children:"🎯"}),e.jsx("span",{children:i})]},c))})]})}catch{return null}})()]}):e.jsx("div",{className:"prose prose-sm prose-indigo max-w-none mb-6",children:e.jsx(C,{children:t.content||""})}),!t.submission_status&&e.jsxs("div",{className:"mt-8 border-t border-gray-100 pt-6",children:[e.jsx("div",{className:"text-xs font-semibold uppercase tracking-wider text-gray-400 mb-2",children:"Ready to submit?"}),e.jsx("p",{className:"text-xs text-gray-500 mb-4",children:t?.content&&t.content.startsWith('{"quizType":"mcq_learning_objectives"')?"Please answer all the interactive questions on the evaluation sheet, then click Submit.":"You can use the whiteboard to draw or answer, then click submit when finished."}),e.jsx("button",{onClick:async()=>{const s=t?.content&&t.content.startsWith('{"quizType":"mcq_learning_objectives"');if(s&&JSON.stringify(r),s)try{const i=JSON.parse(t.content),c=Object.keys(r).length;if(c<i.questions.length&&!window.confirm(`You have only answered ${c}/${i.questions.length} questions. Are you sure you want to submit your answers?`))return}catch{}await d(!1)},className:"w-full py-2 bg-indigo-600 text-white rounded-lg shadow font-medium hover:bg-indigo-700 transition",children:"Submit"})]}),t.submission_status==="graded"&&t.feedback&&e.jsxs("div",{className:"mt-6 bg-green-50 p-4 rounded-xl border border-green-100",children:[e.jsxs("div",{className:"font-semibold text-green-800 text-sm mb-1 flex items-center gap-1",children:[e.jsx(A,{size:16})," Grade: ",t.score,"%"]}),e.jsx("div",{className:"text-xs text-green-700 whitespace-pre-wrap leading-relaxed font-sans",children:t.feedback})]})]})}function R({assignmentId:l,timeLimitMinutes:t,onTimeUp:r,isSubmitted:d}){const[s,i]=N.useState(null);if(N.useEffect(()=>{if(d||!t||t<=0){i(null);return}const n=`quiz_timer_start_${l}`;let m=sessionStorage.getItem(n),x=m?parseInt(m,10):null;x||(x=Date.now(),sessionStorage.setItem(n,x.toString()));const a=t*60,o=()=>{const j=Math.floor((Date.now()-x)/1e3),b=a-j;b<=0?(i(0),r()):i(b)};o();const g=setInterval(o,1e3);return()=>clearInterval(g)},[l,t,d,r]),!t||t<=0)return null;if(d)return e.jsxs("div",{className:"flex items-center gap-2 font-sans text-xs bg-gray-100 text-gray-600 px-3 py-1.5 rounded-lg border border-gray-200",children:[e.jsx(S,{size:14}),e.jsxs("span",{children:["Time Limit: ",t," mins (Completed)"]})]});if(s===null)return null;const c=Math.floor(s/60),p=s%60,u=s<60;return e.jsxs("div",{className:`flex items-center gap-3 font-sans px-4 py-2.5 rounded-xl border transition-all ${u?"bg-red-50 text-red-700 border-red-200 animate-pulse font-bold":s<180?"bg-amber-50 text-amber-700 border-amber-200 font-semibold":"bg-indigo-50 text-indigo-700 border-indigo-100"}`,children:[e.jsx(S,{size:16,className:u?"text-red-600 animate-pulse":"text-indigo-600"}),e.jsxs("div",{className:"flex-1 flex justify-between items-center text-xs gap-4",children:[e.jsxs("div",{children:[e.jsx("span",{className:"font-medium",children:"Time Remaining:"}),e.jsxs("span",{className:"font-mono ml-1 text-sm bg-black/5 text-slate-800 px-1.5 py-0.5 rounded font-bold",children:[c.toString().padStart(2,"0"),":",p.toString().padStart(2,"0")]})]}),u&&e.jsxs("span",{className:"flex items-center gap-1 text-[10px] uppercase tracking-wider text-red-600 font-bold animate-pulse",children:[e.jsx(q,{size:12})," Time is almost up!"]})]})]})}function W(l){const{selectedAssignment:t,subAssignmentTab:r,setSubAssignmentTab:d,quizStudentAnswers:s,setQuizStudentAnswers:i,submitQuizAssignment:c,elements:p,activeRole:u,activeStudentId:n,fetchElements:m}=l;return e.jsx("div",{className:"flex-1 relative flex flex-col min-h-0",children:(()=>{const x=t?.content&&t.content.startsWith('{"quizType":"mcq_learning_objectives"');return e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex justify-between items-center mb-2",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("span",{className:"text-xs font-semibold uppercase tracking-wider text-gray-500 pointer-events-none",children:x&&r==="quiz"?"Evaluation Sheet":"Live Canvas"}),x&&e.jsxs("div",{className:"flex bg-gray-100 p-0.5 rounded-lg border border-gray-200 text-xs",children:[e.jsx("button",{onClick:()=>d("quiz"),className:`px-2.5 py-0.5 rounded text-[10px] font-bold transition-all ${r==="quiz"?"bg-white text-indigo-700 shadow-sm":"text-gray-500 hover:text-gray-900"}`,children:"Interactive Test"}),e.jsx("button",{onClick:()=>d("whiteboard"),className:`px-2.5 py-0.5 rounded text-[10px] font-bold transition-all ${r==="whiteboard"?"bg-white text-indigo-700 shadow-sm":"text-gray-500 hover:text-gray-900"}`,children:"Sketch Whiteboard"})]})]}),t.submission_status&&e.jsx("div",{className:"text-[10px] uppercase font-bold text-gray-400 bg-gray-100 px-2 py-0.5 rounded",children:"Read Only"})]}),x&&r==="quiz"?e.jsx("div",{className:"flex-1 bg-gray-50/50 rounded-xl border border-gray-200 p-6 overflow-y-auto space-y-6",children:(()=>{try{const a=JSON.parse(t.content);return e.jsxs(e.Fragment,{children:[a.timeLimit>0&&e.jsx(R,{assignmentId:t.id,timeLimitMinutes:a.timeLimit,onTimeUp:()=>c(!0),isSubmitted:!!t.submission_status}),a.questions.map((o,g)=>{const j=s[g],b=!!t.submission_status,w=s[g]===o.correctAnswer;return e.jsxs("div",{className:"bg-white p-5 rounded-xl border border-gray-100 shadow-sm space-y-3 font-sans",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"w-6 h-6 rounded-full bg-indigo-50 text-indigo-700 flex items-center justify-center text-xs font-bold ring-1 ring-indigo-100",children:g+1}),e.jsxs("span",{className:"text-[10px] font-semibold text-teal-700 bg-teal-50 px-2.5 py-0.5 rounded-full border border-teal-100",children:["evaluates: ",o.objective]})]}),b&&e.jsx("span",{className:`text-[10px] font-bold px-2.5 py-0.5 rounded-full ${w?"bg-green-100 text-green-800":"bg-red-100 text-red-800"}`,children:w?"Correct ✓":`Incorrect (Correct Option: ${o.correctAnswer})`})]}),e.jsx("div",{className:"font-semibold text-gray-800 text-sm",children:o.question}),e.jsx("div",{className:"grid grid-cols-2 gap-3 text-xs pt-1",children:o.options.map((f,$)=>{const y=j===f,v=f===o.correctAnswer;let h="border-gray-200 hover:border-gray-300 bg-white text-gray-700 hover:bg-gray-50/50 cursor-pointer";return b?y?h=v?"border-green-600 bg-green-50 text-green-900 ring-2 ring-green-100":"border-red-600 bg-red-50 text-red-900 ring-2 ring-red-100":v?h="border-green-400 bg-green-50/20 text-green-900":h="border-gray-200 opacity-60 text-gray-400":y&&(h="border-indigo-600 bg-indigo-50/30 text-indigo-900 ring-2 ring-indigo-100 font-medium cursor-pointer"),e.jsxs("div",{onClick:()=>{b||i(z=>({...z,[g]:f}))},className:`p-3 rounded-xl border transition-all duration-150 flex items-center justify-between ${h}`,children:[e.jsx("span",{children:f}),y&&(b?v?e.jsx(A,{size:14,className:"text-green-600 shrink-0"}):e.jsx(_,{size:14,className:"text-red-600 shrink-0"}):e.jsx("div",{className:"w-2 h-2 rounded-full bg-indigo-600 shadow-sm shrink-0"}))]},$)})})]},g)})]})}catch{return e.jsx("div",{className:"text-xs text-red-500 font-sans",children:"Error parsing quiz structure."})}})()}):e.jsx("div",{className:`flex-1 min-h-0 flex flex-col ${t.submission_status?"opacity-90 pointer-events-none filter grayscale-[0.2]":""}`,children:e.jsx(E,{lessonId:`assignment-${t.id}-student-${n}`,elements:p,userRole:u,enableAutoAI:u==="student"&&!t.submission_status,onElementAdd:async(a,o)=>{await fetch(`/api/lessons/assignment-${t.id}-student-${n}/whiteboard`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({type:a,data:o})}),m(`assignment-${t.id}-student-${n}`)},onElementUpdate:async(a,o)=>{await fetch(`/api/lessons/assignment-${t.id}-student-${n}/whiteboard/${a}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({data:o})}),m(`assignment-${t.id}-student-${n}`)},onElementDelete:async a=>{await fetch(`/api/lessons/assignment-${t.id}-student-${n}/whiteboard/${a}`,{method:"DELETE"}),m(`assignment-${t.id}-student-${n}`)},onClearBoard:async()=>{await fetch(`/api/lessons/assignment-${t.id}-student-${n}/whiteboard`,{method:"DELETE"}),m(`assignment-${t.id}-student-${n}`)},onRefresh:()=>m(`assignment-${t.id}-student-${n}`)})})]})})()})}function G(l){const{selectedAssignment:t,setStudentViewStatus:r,setSelectedAssignment:d,quizStudentAnswers:s,submitQuizAssignment:i,subAssignmentTab:c,setSubAssignmentTab:p,setQuizStudentAnswers:u,elements:n,activeRole:m,activeStudentId:x,fetchElements:a}=l;return e.jsxs("div",{className:"flex flex-col h-full space-y-4",children:[e.jsx(O,{setStudentViewStatus:r,setSelectedAssignment:d,selectedAssignment:t}),e.jsxs("div",{className:"flex-1 flex gap-6 min-h-0 bg-white border border-gray-200 rounded-xl p-4 shadow-sm",children:[e.jsx(I,{selectedAssignment:t,quizStudentAnswers:s,submitQuizAssignment:i}),e.jsx(W,{selectedAssignment:t,subAssignmentTab:c,setSubAssignmentTab:p,quizStudentAnswers:s,setQuizStudentAnswers:u,submitQuizAssignment:i,elements:n,activeRole:m,activeStudentId:x,fetchElements:a})]})]})}export{G as StudentAssignmentView};
@@ -1 +1 @@
1
- import{j as e,r as y}from"./vendor-react-0Lg0vA-4.js";import{ao as H,a9 as O,B as U,$ as q,ah as G,t as W,am as A,d as B,ap as J,x as Y,C as K,a4 as Q,_ as X,a as Z,I as ee,aq as te,ar as se,ai as ae,p as ne}from"./vendor-icons-Dq6MhgH9.js";import{M as re}from"./index-CYzNsYZB.js";import{L as ie}from"./LazyWhiteboard-CtkzSFtN.js";import{L as le}from"./LazyCourseware-DXL9IxZO.js";import"./vendor-pdf-Cp-cYteE.js";import"./vendor-utils-BEhuP0Zq.js";import"./vendor-motion-DjY2czvL.js";import"./vendor-pptx-B_NheIKl.js";import"./vendor-charts-CRXa4AlU.js";function oe(u){const{students:i,activeStudentId:p,setStudentViewStatus:r,setSelectedLesson:S,lessons:c,selectedLesson:o}=u;return e.jsxs("div",{className:"flex items-center justify-between",children:[i.find(f=>f.id===p)?.locked_lesson_id?e.jsxs("div",{className:"text-indigo-600 font-medium text-sm flex items-center gap-2 px-2",children:[e.jsx(H,{size:16})," Restricted Mode"]}):e.jsxs("button",{onClick:()=>{r("dashboard"),S(null)},className:"flex items-center gap-2 text-indigo-600 hover:text-indigo-800 transition-colors font-medium text-sm",children:[e.jsx(O,{className:"rotate-180",size:16})," Back to Dashboard"]}),e.jsx("h2",{className:"text-xl font-bold text-gray-800",children:c.find(f=>f.id===o)?.title})]})}function de(u){const{students:i,activeStudentId:p,studentFullscreenPanel:r,setStudentFullscreenPanel:S,timelineSegments:c,lang:o,activeSegmentId:f,setActiveSegmentId:d,localProgressPercent:g,setLocalProgressPercent:C,updateStudentProgress:j,selectedLesson:v,lessons:k,isStudentLessonContentCollapsed:z}=u;return e.jsxs("div",{className:`${z?"hidden":r==="left"?"w-full":"w-1/3 md:block hidden"} border-gray-100 pr-4 overflow-y-auto ${r==="right"?"hidden":""} ${r==="left"?"":"border-r"} transition-all duration-300`,children:[e.jsxs("div",{className:"text-xs font-semibold uppercase tracking-wider text-gray-400 mb-4 flex items-center justify-between pointer-events-auto shrink-0 select-none border-b border-gray-100 pb-2",children:[e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(U,{size:14,className:"text-indigo-500"})," Lesson Content (课程内容)"]}),e.jsx("button",{onClick:()=>S(n=>n==="left"?"none":"left"),className:"p-1 hover:bg-gray-100 text-gray-400 hover:text-gray-700 rounded transition-colors cursor-pointer flex items-center gap-1",title:r==="left"?"退出全屏":"全屏",children:r==="left"?e.jsxs(e.Fragment,{children:[e.jsx(q,{size:13}),e.jsx("span",{className:"text-[10px] font-medium",children:"退出全屏"})]}):e.jsxs(e.Fragment,{children:[e.jsx(G,{size:13}),e.jsx("span",{className:"text-[10px] font-medium",children:"全屏"})]})})]}),e.jsxs("div",{className:"prose prose-sm prose-indigo max-w-none",children:[!i.find(n=>n.id===p)?.locked_lesson_id&&c.length>0&&e.jsxs("div",{className:"mb-4 flex flex-col gap-2 p-3 bg-slate-50/70 border border-slate-200/50 rounded-xl shadow-3xs text-left",onClick:n=>n.stopPropagation(),children:[e.jsxs("div",{className:"text-[10px] font-bold text-gray-500 uppercase tracking-wider flex items-center gap-1.5 mb-1 select-none",children:[e.jsx(W,{size:12,className:"text-indigo-500"}),o==="zh"?"教学环节 (点击切换)":"Timeline Segments"]}),e.jsx("div",{className:"flex flex-wrap gap-1.5",children:c.map((n,m)=>e.jsxs("button",{onClick:()=>d(n.id),className:`px-2.5 py-1 text-xs font-semibold rounded-lg border transition-all cursor-pointer shadow-3xs ${n.color} ${f===n.id?"ring-2 ring-indigo-500 scale-[1.02] shadow-sm border-indigo-400 font-bold":"opacity-85 hover:opacity-100"}`,children:[n.title," (",n.duration,")"]},n.id||m))})]}),e.jsxs("div",{className:"mb-4 bg-slate-50 p-2.5 rounded-xl border border-slate-200/60 shadow-3xs flex flex-col gap-1.5 text-left select-none",children:[e.jsxs("div",{className:"flex justify-between items-center text-[10px] font-bold text-gray-500",children:[e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(W,{size:12,className:"text-indigo-500 animate-pulse"}),o==="zh"?"自主学习进度反馈":"Learning Progress"]}),e.jsxs("span",{className:"font-mono text-indigo-600 font-extrabold",children:[g,"%"]})]}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("input",{type:"range",min:"0",max:"100",value:g,onChange:n=>{const m=parseInt(n.target.value);C(m)},onMouseUp:()=>j(g),onTouchEnd:()=>j(g),className:"flex-grow h-1.5 bg-gray-200 rounded-lg appearance-none cursor-pointer accent-indigo-600"}),e.jsx("button",{onClick:()=>{C(100),j(100)},className:`text-[9px] font-bold rounded-lg px-2 py-1 transition-all ${g===100?"bg-emerald-100 text-emerald-700 border border-emerald-200":"bg-white hover:bg-slate-50 text-slate-650 border border-slate-200 hover:border-indigo-200 shadow-3xs cursor-pointer"}`,children:o==="zh"?"已完成":"Done"})]})]}),e.jsx(re,{children:k.find(n=>n.id===v)?.content||""})]})]})}function ce({lessonId:u,studentId:i,lang:p,addToast:r}){const[S,c]=y.useState(!1),[o,f]=y.useState(!1),[d,g]=y.useState(null),[C,j]=y.useState([]),[v,k]=y.useState("/files/my-homework.pdf"),[z,n]=y.useState(!1),[m,P]=y.useState({}),[L,$]=y.useState({}),[E,a]=y.useState({}),t=p==="zh",R=async(s=!1)=>{s?f(!0):c(!0);try{const x=await(await fetch(`/api/lessons/${u}/students/${i}/eval-status`)).json();g(x);const b=await(await fetch(`/api/lessons/${u}/eval-submissions`)).json();j(b)}catch(l){console.error("Error fetching eval data:",l),r(t?"数据加载失败":"Failed to Load Data",t?"请检查网络连接或刷新页面。":"Please check your connection and try again.","warning")}finally{c(!1),f(!1)}};y.useEffect(()=>{u&&i&&R()},[u,i]);const M=async s=>{if(s.preventDefault(),!!v.trim()){n(!0);try{const x=await(await fetch("/api/commands",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({commandType:"assignment.submit",payload:{lessonId:u,studentId:i,filePath:v.trim()}})})).json();if(x.success)r(t?"作业提交成功":"Assignment Submitted",t?`成功提交版本 ${x.result.version}!`:`Successfully submitted version ${x.result.version}!`,"success"),R(!0);else throw new Error(x.error||"Failed to submit assignment")}catch(l){r(t?"提交失败":"Submission Failed",l.message,"warning")}finally{n(!1)}}},D=async(s,l)=>{const x=m[s],T=L[s]||"";if(x===void 0||isNaN(x)||x<0||x>100){r(t?"评分无效":"Invalid Score",t?"分数必须在 0 到 100 之间!":"Score must be between 0 and 100!","warning");return}a(b=>({...b,[s]:!0}));try{const N=await(await fetch("/api/commands",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({commandType:"assignment.peer_review",payload:{submissionId:s,reviewerId:i,score:Number(x),comment:T}})})).json();if(N.success)r(t?"互评提交成功":"Review Submitted",t?"成功对同学的作品完成了评价!":"Successfully completed review for classmate!","success"),$(_=>{const F={..._};return delete F[s],F}),R(!0);else throw new Error(N.error||"Failed to submit review")}catch(b){r(t?"评价提交失败":"Review Failed",b.message,"warning")}finally{a(b=>({...b,[s]:!1}))}};if(S)return e.jsxs("div",{className:"flex-1 flex flex-col items-center justify-center py-12 text-gray-500",children:[e.jsx(A,{className:"animate-spin text-indigo-500 mb-2",size:32}),e.jsx("p",{children:t?"正在读取作业互评状态...":"Loading assignment status..."})]});const w=d?.submission,h=d?.grade,I=d?.reviewsWritten||[],V=C.filter(s=>s.student_id!==i);return e.jsxs("div",{className:"flex-1 flex flex-col lg:flex-row gap-6 overflow-y-auto pr-2",children:[e.jsxs("div",{className:"w-full lg:w-5/12 flex flex-col gap-6",children:[e.jsxs("div",{className:"bg-slate-50 border border-slate-200/80 rounded-2xl p-5 shadow-3xs text-left",children:[e.jsxs("div",{className:"flex justify-between items-center mb-4",children:[e.jsxs("h3",{className:"text-sm font-bold text-slate-800 flex items-center gap-1.5 select-none",children:[e.jsx(B,{size:16,className:"text-indigo-650"}),t?"我的作业提交":"My Assignment Submission"]}),e.jsx("button",{onClick:()=>R(!0),className:"p-1 hover:bg-slate-200/50 rounded transition-colors text-slate-550",title:t?"刷新数据":"Refresh Data",children:e.jsx(A,{size:14,className:o?"animate-spin":""})})]}),w?e.jsxs("div",{className:"bg-white border border-slate-200 p-4 rounded-xl space-y-3 mb-4",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"bg-emerald-50 text-emerald-600 p-2.5 rounded-lg border border-emerald-100",children:e.jsx(J,{size:20})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("p",{className:"text-xs text-slate-400 font-medium",children:t?"当前已提交版本":"Currently Submitted Version"}),e.jsx("p",{className:"text-sm font-semibold text-slate-700 truncate",children:w.file_path.split("/").pop()})]}),e.jsxs("span",{className:"bg-indigo-100 text-indigo-700 text-[10px] font-bold px-2 py-0.5 rounded-full border border-indigo-200",children:["V",w.version]})]}),e.jsxs("div",{className:"border-t border-slate-100 pt-2.5 flex justify-between items-center text-[10px] text-slate-400",children:[e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(Y,{size:11}),t?"更新时间:":"Updated At:"," ",new Date(w.updated_at).toLocaleString()]}),e.jsx("span",{className:"font-mono text-slate-350 select-all truncate max-w-[120px]",title:w.file_path,children:w.file_path})]})]}):e.jsxs("div",{className:"bg-amber-50/50 border border-amber-100 p-4 rounded-xl flex items-start gap-3 mb-4 text-left",children:[e.jsx(K,{className:"text-amber-500 shrink-0 mt-0.5",size:16}),e.jsxs("div",{className:"text-xs text-amber-700",children:[e.jsx("p",{className:"font-bold",children:t?"未提交作业":"No Submission Yet"}),e.jsx("p",{className:"mt-1",children:t?"在此上传提交后,其他同学将可以对您的作业进行评分互评。":"Once submitted, other students can view and peer-review your work."})]})]}),e.jsx("form",{onSubmit:M,className:"space-y-3",children:e.jsxs("div",{children:[e.jsx("label",{className:"block text-[11px] font-bold text-slate-500 uppercase tracking-wider mb-1",children:t?"输入作品文件路径 / 虚拟路径":"Simulated File Path"}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx("input",{type:"text",value:v,onChange:s=>k(s.target.value),placeholder:"/files/homework.pdf",required:!0,className:"flex-1 bg-white border border-slate-200 px-3 py-2 text-xs rounded-lg text-slate-700 focus:outline-none focus:border-indigo-400 font-mono transition-colors"}),e.jsxs("button",{type:"submit",disabled:z,className:"bg-indigo-650 hover:bg-indigo-700 text-white font-bold text-xs px-4 py-2 rounded-lg transition-colors cursor-pointer disabled:opacity-50 flex items-center gap-1.5 shadow-3xs",children:[z?e.jsx(A,{className:"animate-spin",size:13}):e.jsx(B,{size:13}),w?t?"重新提交":"Re-submit":t?"上传作品":"Submit"]})]})]})})]}),w&&e.jsxs("div",{className:"bg-slate-50 border border-slate-200/80 rounded-2xl p-5 shadow-3xs text-left",children:[e.jsxs("h3",{className:"text-sm font-bold text-slate-800 flex items-center gap-1.5 mb-4 select-none",children:[e.jsx(Q,{size:16,className:"text-pink-650"}),t?"我的平时学习得分":"My Score & Feedback"]}),h?e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"bg-white border border-slate-200 p-4 rounded-xl flex items-center justify-between shadow-3xs",children:[e.jsxs("div",{children:[e.jsx("span",{className:"text-[10px] text-slate-400 font-bold uppercase tracking-wider",children:t?"学期对接总分":"Weighted Final Grade"}),e.jsxs("h2",{className:"text-3xl font-extrabold text-indigo-700 font-mono mt-1",children:[h.calculated_final_score," ",e.jsx("span",{className:"text-xs text-slate-455 font-normal",children:"/ 100"})]})]}),e.jsxs("div",{className:"text-right",children:[e.jsx("span",{className:`inline-block px-2.5 py-1 text-[10px] font-bold rounded-lg border ${h.status==="confirmed"?"bg-emerald-50 text-emerald-700 border-emerald-100":"bg-amber-50 text-amber-700 border-amber-100"}`,children:h.status==="confirmed"?t?"已确认同步":"Synced":t?"教师评分草稿":"Draft"}),e.jsx("p",{className:"text-[9px] text-slate-400 mt-1.5 font-medium",children:t?`教师分 ${h.teacher_score} (占 ${(h.teacher_weight*100).toFixed(0)}%)`:`Teacher ${h.teacher_score} (${(h.teacher_weight*100).toFixed(0)}%)`}),e.jsx("p",{className:"text-[9px] text-slate-400 mt-0.5 font-medium",children:t?`学生互评 (占 ${(h.peer_weight*100).toFixed(0)}%)`:`Peer Review (${(h.peer_weight*100).toFixed(0)}%)`})]})]}),h.teacher_comment&&e.jsxs("div",{className:"bg-slate-100/60 p-3 rounded-lg border border-slate-200 flex gap-2",children:[e.jsx(X,{size:14,className:"text-slate-400 shrink-0 mt-0.5"}),e.jsxs("div",{children:[e.jsx("p",{className:"text-[10px] font-bold text-slate-500",children:t?"教师寄语":"Teacher Comments"}),e.jsx("p",{className:"text-xs text-slate-650 mt-0.5",children:h.teacher_comment})]})]})]}):e.jsx("div",{className:"bg-white border border-slate-150 p-4 rounded-xl flex items-center justify-center text-slate-400 italic text-xs py-8",children:t?"教师尚未确认最终成绩与权重折算。":"Teacher grading is in progress."})]})]}),e.jsxs("div",{className:"flex-grow bg-slate-50 border border-slate-200/80 rounded-2xl p-5 shadow-3xs flex flex-col min-h-[400px] text-left",children:[e.jsxs("h3",{className:"text-sm font-bold text-slate-800 flex items-center gap-1.5 mb-4 shrink-0 select-none",children:[e.jsx(Z,{size:16,className:"text-teal-650"}),t?"同学作业互评公开板":"Classmate Submissions for Peer Review"]}),V.length===0?e.jsx("div",{className:"flex-grow flex items-center justify-center text-slate-400 italic text-xs py-12 border border-dashed border-slate-200 rounded-xl bg-white",children:t?"当前暂无同学提交作业作品。":"No classmate submissions available yet."}):e.jsx("div",{className:"flex-grow overflow-y-auto space-y-4 pr-1",children:V.map(s=>{const l=I.find(N=>N.submission_id===s.id),x=m[s.id]!==void 0?m[s.id]:l?l.score:85,T=L[s.id]!==void 0?L[s.id]:l?l.comment:"",b=E[s.id]||!1;return e.jsxs("div",{className:"bg-white border border-slate-200 rounded-xl p-4 shadow-3xs flex flex-col gap-3",children:[e.jsxs("div",{className:"flex justify-between items-start border-b border-slate-100 pb-2",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:"w-8 h-8 rounded-full bg-indigo-50 text-indigo-700 flex items-center justify-center font-bold text-xs select-none",children:s.student_name?s.student_name[0]:"?"}),e.jsxs("div",{children:[e.jsx("h4",{className:"text-xs font-bold text-slate-700",children:s.student_name||s.student_id}),e.jsxs("p",{className:"text-[10px] text-slate-400 font-mono flex items-center gap-1 mt-0.5 truncate max-w-[200px]",title:s.file_path,children:[e.jsx(ee,{size:11,className:"text-slate-350"}),s.file_path.split("/").pop()," (V",s.version,")"]})]})]}),e.jsx("a",{href:s.file_path,target:"_blank",rel:"noopener noreferrer",className:"text-[10px] font-bold text-indigo-650 hover:text-indigo-800 transition-colors border border-indigo-100 px-2 py-1 rounded bg-indigo-50/50 hover:bg-indigo-50",children:t?"下载查阅":"Download File"})]}),l&&e.jsxs("div",{className:"bg-emerald-50/50 border border-emerald-100 p-2.5 rounded-lg flex items-start gap-2 text-xs text-emerald-800",children:[e.jsx(te,{className:"text-emerald-500 shrink-0 mt-0.5",size:14}),e.jsxs("div",{className:"flex-1",children:[e.jsx("p",{className:"font-bold flex items-center gap-1",children:t?`我已评分:${l.score} 分`:`My Score: ${l.score} pts`}),l.comment&&e.jsxs("p",{className:"text-[11px] text-emerald-700/80 mt-0.5 italic",children:['"',l.comment,'"']})]})]}),e.jsxs("div",{className:"bg-slate-50/60 border border-slate-100 rounded-lg p-3 space-y-3",children:[e.jsxs("div",{className:"flex justify-between items-center",children:[e.jsx("span",{className:"text-[10px] font-bold text-slate-500 uppercase tracking-wider",children:t?"滑动或输入互评分数":"Peer Rating"}),e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx("input",{type:"number",min:"0",max:"100",value:x,onChange:N=>{const _=Math.min(100,Math.max(0,parseInt(N.target.value)||0));P(F=>({...F,[s.id]:_}))},className:"w-12 text-center text-xs font-bold font-mono border border-slate-200 rounded px-1 py-0.5 bg-white text-indigo-750"}),e.jsx("span",{className:"text-[10px] text-slate-400 font-bold",children:t?"分":"pts"})]})]}),e.jsx("input",{type:"range",min:"0",max:"100",value:x,onChange:N=>{const _=parseInt(N.target.value);P(F=>({...F,[s.id]:_}))},className:"w-full h-1.5 bg-gray-200 rounded-lg appearance-none cursor-pointer accent-indigo-650"}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx("textarea",{rows:1,value:T,onChange:N=>{$(_=>({..._,[s.id]:N.target.value}))},placeholder:t?"简要评语反馈...":"Brief feedback comment...",className:"flex-1 bg-white border border-slate-200 px-2 py-1 text-xs rounded-lg text-slate-700 focus:outline-none focus:border-indigo-400 resize-none transition-colors"}),e.jsxs("button",{onClick:()=>D(s.id,s.student_id),disabled:b,className:"bg-indigo-650 hover:bg-indigo-700 text-white font-bold text-xs px-3 rounded-lg transition-colors cursor-pointer disabled:opacity-50 flex items-center justify-center",children:[b?e.jsx(A,{className:"animate-spin",size:13}):e.jsx(se,{size:13}),e.jsx("span",{className:"ml-1 shrink-0",children:l?t?"修改评分":"Update":t?"确认提交":"Submit"})]})]})]})]},s.id)})})]})]})}function xe(u){const{studentLessonTab:i,setStudentLessonTab:p,isStudentLessonContentCollapsed:r,setIsStudentLessonContentCollapsed:S,lang:c,studentFullscreenPanel:o,setStudentFullscreenPanel:f,selectedLesson:d,elements:g,activeRole:C,activeSegmentId:j,setActiveSegmentId:v,fetchElements:k,currentVfsParent:z,setCurrentVfsParent:n,vfsNodes:m,studentSelectedCourseware:P,setStudentSelectedCourseware:L,activeStudentId:$,addToast:E}=u;return e.jsxs("div",{className:`${r||o==="right"?"w-full flex-grow":"flex-grow flex-1"} relative flex flex-col min-h-0 ${o==="left"?"hidden":""} transition-all duration-300`,children:[e.jsxs("div",{className:"flex items-center justify-between mb-2",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("button",{onClick:()=>S(!r),className:"flex items-center gap-1.5 px-3 py-1.5 text-xs font-bold bg-primary-theme/10 text-primary-theme rounded-lg hover:bg-primary-theme/20 transition-colors border border-primary-theme/20 cursor-pointer shadow-3xs",title:r?"展开课程内容":"折叠课程内容",children:[e.jsx(U,{size:13,className:"text-primary-theme"}),e.jsx("span",{children:r?c==="zh"?"展开课程内容":"Expand Content":c==="zh"?"折叠课程内容":"Collapse Content"})]}),e.jsx("button",{onClick:()=>p("whiteboard"),className:`px-3 py-1.5 text-xs font-medium rounded-md transition-colors cursor-pointer ${i==="whiteboard"?"bg-primary-theme/10 text-primary-theme shadow-sm font-bold":"text-muted hover:bg-surface-secondary"}`,children:"Interactive Whiteboard"}),e.jsx("button",{onClick:()=>p("courseware"),className:`px-3 py-1.5 text-xs font-medium rounded-md transition-colors cursor-pointer ${i==="courseware"?"bg-primary-theme/10 text-primary-theme shadow-sm font-bold":"text-muted hover:bg-surface-secondary"}`,children:"Interactive Courseware Viewer"}),e.jsx("button",{onClick:()=>p("assignment"),className:`px-3 py-1.5 text-xs font-medium rounded-md transition-colors cursor-pointer ${i==="assignment"?"bg-primary-theme/10 text-primary-theme shadow-sm font-bold":"text-muted hover:bg-surface-secondary"}`,children:c==="zh"?"作业提交与互评":"Assignments & Peer Reviews"})]}),e.jsx("button",{onClick:()=>f(a=>a==="right"?"none":"right"),className:"p-1 hover:bg-gray-100 text-gray-400 hover:text-gray-700 rounded transition-colors cursor-pointer flex items-center gap-1",title:o==="right"?"退出全屏":"全屏",children:o==="right"?e.jsxs(e.Fragment,{children:[e.jsx(q,{size:13}),e.jsx("span",{className:"text-[10px] font-medium",children:"退出全屏"})]}):e.jsxs(e.Fragment,{children:[e.jsx(G,{size:13}),e.jsx("span",{className:"text-[10px] font-medium",children:"全屏"})]})})]}),i==="whiteboard"&&e.jsx(ie,{lessonId:d,elements:g,userRole:C,activeSegmentId:j,onSegmentSync:a=>v(a),onElementUpdate:async()=>{},onElementDelete:async a=>{await fetch(`/api/lessons/${d}/whiteboard/${a}`,{method:"DELETE"}),k(d)},onClearBoard:async()=>{await fetch(`/api/lessons/${d}/whiteboard`,{method:"DELETE"}),k(d)},onElementAdd:async()=>{},onRefresh:()=>k(d)}),i==="courseware"&&e.jsxs("div",{className:"flex-1 flex gap-4 min-h-0",children:[e.jsxs("div",{className:"w-48 flex-shrink-0 bg-gray-50 border border-gray-200 rounded-lg p-3 flex flex-col min-h-0",children:[e.jsx("h4",{className:"text-xs font-semibold uppercase tracking-wider text-gray-500 mb-2 border-b border-gray-200 pb-2",children:"Cloud Apps"}),e.jsxs("div",{className:"flex-1 overflow-y-auto space-y-1",children:[z!==null&&e.jsxs("button",{onClick:()=>n(null),className:"flex items-center gap-2 p-1.5 text-xs text-indigo-600 w-full hover:bg-gray-200 rounded mb-1 font-medium",children:[e.jsx(O,{className:"rotate-180",size:14})," Back to Root"]}),m.filter(a=>a.type==="dir").map(a=>e.jsxs("button",{onClick:()=>n(a.id),className:"w-full text-left p-1.5 rounded text-xs text-gray-700 hover:bg-gray-200 flex items-center gap-2 group truncate",title:a.name,children:[e.jsx(ae,{size:14,className:"text-indigo-400 shrink-0 group-hover:text-indigo-600"}),e.jsx("span",{className:"truncate",children:a.name})]},a.id)),m.filter(a=>a.type==="file"&&(a.name.endsWith(".html")||a.name.endsWith(".htm")||a.content?.includes("<html"))).length===0?e.jsx("div",{className:"text-xs text-center text-gray-400 italic py-4",children:"No interactive HTML apps found."}):m.filter(a=>a.type==="file"&&(a.name.endsWith(".html")||a.name.endsWith(".htm")||a.content?.includes("<html"))).map(a=>e.jsxs("button",{onClick:()=>L(a.id),className:`w-full text-left p-2 rounded text-xs flex items-center gap-2 truncate transition-colors ${P===a.id?"bg-indigo-100 text-indigo-700 font-medium":"text-gray-600 hover:bg-gray-100"}`,title:a.name,children:[e.jsx(ne,{size:14,className:"shrink-0"}),e.jsx("span",{className:"truncate",children:a.name})]},a.id))]}),e.jsx("div",{className:"mt-2 text-[10px] text-gray-400 leading-tight",children:"Note: Showing HTML courseware from current OS drive directory. Ask agent to generate courseware."})]}),e.jsx("div",{className:"flex-1 relative bg-white min-h-0",children:e.jsx(le,{coursewareId:P,onClose:()=>L(null)})})]}),i==="assignment"&&e.jsx(ce,{lessonId:d,studentId:$,lang:c,addToast:E})]})}function Ne(u){const{students:i,activeStudentId:p,setStudentViewStatus:r,setSelectedLesson:S,lessons:c,selectedLesson:o,studentFullscreenPanel:f,setStudentFullscreenPanel:d,timelineSegments:g,lang:C,activeSegmentId:j,setActiveSegmentId:v,localProgressPercent:k,setLocalProgressPercent:z,updateStudentProgress:n,isStudentLessonContentCollapsed:m,setIsStudentLessonContentCollapsed:P,studentLessonTab:L,setStudentLessonTab:$,elements:E,activeRole:a,fetchElements:t,currentVfsParent:R,setCurrentVfsParent:M,vfsNodes:D,studentSelectedCourseware:w,setStudentSelectedCourseware:h,addToast:I}=u;return e.jsxs("div",{className:"flex flex-col h-full space-y-4",children:[e.jsx(oe,{students:i,activeStudentId:p,setStudentViewStatus:r,setSelectedLesson:S,lessons:c,selectedLesson:o}),e.jsxs("div",{className:"flex-1 flex gap-6 min-h-0 bg-surface border border-theme rounded-xl p-4 shadow-sm text-main",children:[e.jsx(de,{students:i,activeStudentId:p,studentFullscreenPanel:f,setStudentFullscreenPanel:d,timelineSegments:g,lang:C,activeSegmentId:j,setActiveSegmentId:v,localProgressPercent:k,setLocalProgressPercent:z,updateStudentProgress:n,selectedLesson:o,lessons:c,isStudentLessonContentCollapsed:m}),e.jsx(xe,{studentLessonTab:L,setStudentLessonTab:$,isStudentLessonContentCollapsed:m,setIsStudentLessonContentCollapsed:P,lang:C,studentFullscreenPanel:f,setStudentFullscreenPanel:d,selectedLesson:o,elements:E,activeRole:a,activeSegmentId:j,setActiveSegmentId:v,fetchElements:t,currentVfsParent:R,setCurrentVfsParent:M,vfsNodes:D,studentSelectedCourseware:w,setStudentSelectedCourseware:h,activeStudentId:p,addToast:I})]})]})}export{Ne as StudentLessonView};
1
+ import{j as e,r as y}from"./vendor-react-0Lg0vA-4.js";import{ao as H,a9 as O,B as U,$ as q,ah as G,t as W,am as A,d as B,ap as J,x as Y,C as K,a4 as Q,_ as X,a as Z,I as ee,aq as te,ar as se,ai as ae,p as ne}from"./vendor-icons-Dq6MhgH9.js";import{M as re}from"./index-CerSuw-h.js";import{L as ie}from"./LazyWhiteboard-D_U3t5Ft.js";import{L as le}from"./LazyCourseware-BtliMSwD.js";import"./vendor-pdf-Cp-cYteE.js";import"./vendor-utils-BEhuP0Zq.js";import"./vendor-motion-DjY2czvL.js";import"./vendor-pptx-B_NheIKl.js";import"./vendor-charts-CRXa4AlU.js";function oe(u){const{students:i,activeStudentId:p,setStudentViewStatus:r,setSelectedLesson:S,lessons:c,selectedLesson:o}=u;return e.jsxs("div",{className:"flex items-center justify-between",children:[i.find(f=>f.id===p)?.locked_lesson_id?e.jsxs("div",{className:"text-indigo-600 font-medium text-sm flex items-center gap-2 px-2",children:[e.jsx(H,{size:16})," Restricted Mode"]}):e.jsxs("button",{onClick:()=>{r("dashboard"),S(null)},className:"flex items-center gap-2 text-indigo-600 hover:text-indigo-800 transition-colors font-medium text-sm",children:[e.jsx(O,{className:"rotate-180",size:16})," Back to Dashboard"]}),e.jsx("h2",{className:"text-xl font-bold text-gray-800",children:c.find(f=>f.id===o)?.title})]})}function de(u){const{students:i,activeStudentId:p,studentFullscreenPanel:r,setStudentFullscreenPanel:S,timelineSegments:c,lang:o,activeSegmentId:f,setActiveSegmentId:d,localProgressPercent:g,setLocalProgressPercent:C,updateStudentProgress:j,selectedLesson:v,lessons:k,isStudentLessonContentCollapsed:z}=u;return e.jsxs("div",{className:`${z?"hidden":r==="left"?"w-full":"w-1/3 md:block hidden"} border-gray-100 pr-4 overflow-y-auto ${r==="right"?"hidden":""} ${r==="left"?"":"border-r"} transition-all duration-300`,children:[e.jsxs("div",{className:"text-xs font-semibold uppercase tracking-wider text-gray-400 mb-4 flex items-center justify-between pointer-events-auto shrink-0 select-none border-b border-gray-100 pb-2",children:[e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(U,{size:14,className:"text-indigo-500"})," Lesson Content (课程内容)"]}),e.jsx("button",{onClick:()=>S(n=>n==="left"?"none":"left"),className:"p-1 hover:bg-gray-100 text-gray-400 hover:text-gray-700 rounded transition-colors cursor-pointer flex items-center gap-1",title:r==="left"?"退出全屏":"全屏",children:r==="left"?e.jsxs(e.Fragment,{children:[e.jsx(q,{size:13}),e.jsx("span",{className:"text-[10px] font-medium",children:"退出全屏"})]}):e.jsxs(e.Fragment,{children:[e.jsx(G,{size:13}),e.jsx("span",{className:"text-[10px] font-medium",children:"全屏"})]})})]}),e.jsxs("div",{className:"prose prose-sm prose-indigo max-w-none",children:[!i.find(n=>n.id===p)?.locked_lesson_id&&c.length>0&&e.jsxs("div",{className:"mb-4 flex flex-col gap-2 p-3 bg-slate-50/70 border border-slate-200/50 rounded-xl shadow-3xs text-left",onClick:n=>n.stopPropagation(),children:[e.jsxs("div",{className:"text-[10px] font-bold text-gray-500 uppercase tracking-wider flex items-center gap-1.5 mb-1 select-none",children:[e.jsx(W,{size:12,className:"text-indigo-500"}),o==="zh"?"教学环节 (点击切换)":"Timeline Segments"]}),e.jsx("div",{className:"flex flex-wrap gap-1.5",children:c.map((n,m)=>e.jsxs("button",{onClick:()=>d(n.id),className:`px-2.5 py-1 text-xs font-semibold rounded-lg border transition-all cursor-pointer shadow-3xs ${n.color} ${f===n.id?"ring-2 ring-indigo-500 scale-[1.02] shadow-sm border-indigo-400 font-bold":"opacity-85 hover:opacity-100"}`,children:[n.title," (",n.duration,")"]},n.id||m))})]}),e.jsxs("div",{className:"mb-4 bg-slate-50 p-2.5 rounded-xl border border-slate-200/60 shadow-3xs flex flex-col gap-1.5 text-left select-none",children:[e.jsxs("div",{className:"flex justify-between items-center text-[10px] font-bold text-gray-500",children:[e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(W,{size:12,className:"text-indigo-500 animate-pulse"}),o==="zh"?"自主学习进度反馈":"Learning Progress"]}),e.jsxs("span",{className:"font-mono text-indigo-600 font-extrabold",children:[g,"%"]})]}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("input",{type:"range",min:"0",max:"100",value:g,onChange:n=>{const m=parseInt(n.target.value);C(m)},onMouseUp:()=>j(g),onTouchEnd:()=>j(g),className:"flex-grow h-1.5 bg-gray-200 rounded-lg appearance-none cursor-pointer accent-indigo-600"}),e.jsx("button",{onClick:()=>{C(100),j(100)},className:`text-[9px] font-bold rounded-lg px-2 py-1 transition-all ${g===100?"bg-emerald-100 text-emerald-700 border border-emerald-200":"bg-white hover:bg-slate-50 text-slate-650 border border-slate-200 hover:border-indigo-200 shadow-3xs cursor-pointer"}`,children:o==="zh"?"已完成":"Done"})]})]}),e.jsx(re,{children:k.find(n=>n.id===v)?.content||""})]})]})}function ce({lessonId:u,studentId:i,lang:p,addToast:r}){const[S,c]=y.useState(!1),[o,f]=y.useState(!1),[d,g]=y.useState(null),[C,j]=y.useState([]),[v,k]=y.useState("/files/my-homework.pdf"),[z,n]=y.useState(!1),[m,P]=y.useState({}),[L,$]=y.useState({}),[E,a]=y.useState({}),t=p==="zh",R=async(s=!1)=>{s?f(!0):c(!0);try{const x=await(await fetch(`/api/lessons/${u}/students/${i}/eval-status`)).json();g(x);const b=await(await fetch(`/api/lessons/${u}/eval-submissions`)).json();j(b)}catch(l){console.error("Error fetching eval data:",l),r(t?"数据加载失败":"Failed to Load Data",t?"请检查网络连接或刷新页面。":"Please check your connection and try again.","warning")}finally{c(!1),f(!1)}};y.useEffect(()=>{u&&i&&R()},[u,i]);const M=async s=>{if(s.preventDefault(),!!v.trim()){n(!0);try{const x=await(await fetch("/api/commands",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({commandType:"assignment.submit",payload:{lessonId:u,studentId:i,filePath:v.trim()}})})).json();if(x.success)r(t?"作业提交成功":"Assignment Submitted",t?`成功提交版本 ${x.result.version}!`:`Successfully submitted version ${x.result.version}!`,"success"),R(!0);else throw new Error(x.error||"Failed to submit assignment")}catch(l){r(t?"提交失败":"Submission Failed",l.message,"warning")}finally{n(!1)}}},D=async(s,l)=>{const x=m[s],T=L[s]||"";if(x===void 0||isNaN(x)||x<0||x>100){r(t?"评分无效":"Invalid Score",t?"分数必须在 0 到 100 之间!":"Score must be between 0 and 100!","warning");return}a(b=>({...b,[s]:!0}));try{const N=await(await fetch("/api/commands",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({commandType:"assignment.peer_review",payload:{submissionId:s,reviewerId:i,score:Number(x),comment:T}})})).json();if(N.success)r(t?"互评提交成功":"Review Submitted",t?"成功对同学的作品完成了评价!":"Successfully completed review for classmate!","success"),$(_=>{const F={..._};return delete F[s],F}),R(!0);else throw new Error(N.error||"Failed to submit review")}catch(b){r(t?"评价提交失败":"Review Failed",b.message,"warning")}finally{a(b=>({...b,[s]:!1}))}};if(S)return e.jsxs("div",{className:"flex-1 flex flex-col items-center justify-center py-12 text-gray-500",children:[e.jsx(A,{className:"animate-spin text-indigo-500 mb-2",size:32}),e.jsx("p",{children:t?"正在读取作业互评状态...":"Loading assignment status..."})]});const w=d?.submission,h=d?.grade,I=d?.reviewsWritten||[],V=C.filter(s=>s.student_id!==i);return e.jsxs("div",{className:"flex-1 flex flex-col lg:flex-row gap-6 overflow-y-auto pr-2",children:[e.jsxs("div",{className:"w-full lg:w-5/12 flex flex-col gap-6",children:[e.jsxs("div",{className:"bg-slate-50 border border-slate-200/80 rounded-2xl p-5 shadow-3xs text-left",children:[e.jsxs("div",{className:"flex justify-between items-center mb-4",children:[e.jsxs("h3",{className:"text-sm font-bold text-slate-800 flex items-center gap-1.5 select-none",children:[e.jsx(B,{size:16,className:"text-indigo-650"}),t?"我的作业提交":"My Assignment Submission"]}),e.jsx("button",{onClick:()=>R(!0),className:"p-1 hover:bg-slate-200/50 rounded transition-colors text-slate-550",title:t?"刷新数据":"Refresh Data",children:e.jsx(A,{size:14,className:o?"animate-spin":""})})]}),w?e.jsxs("div",{className:"bg-white border border-slate-200 p-4 rounded-xl space-y-3 mb-4",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"bg-emerald-50 text-emerald-600 p-2.5 rounded-lg border border-emerald-100",children:e.jsx(J,{size:20})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("p",{className:"text-xs text-slate-400 font-medium",children:t?"当前已提交版本":"Currently Submitted Version"}),e.jsx("p",{className:"text-sm font-semibold text-slate-700 truncate",children:w.file_path.split("/").pop()})]}),e.jsxs("span",{className:"bg-indigo-100 text-indigo-700 text-[10px] font-bold px-2 py-0.5 rounded-full border border-indigo-200",children:["V",w.version]})]}),e.jsxs("div",{className:"border-t border-slate-100 pt-2.5 flex justify-between items-center text-[10px] text-slate-400",children:[e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(Y,{size:11}),t?"更新时间:":"Updated At:"," ",new Date(w.updated_at).toLocaleString()]}),e.jsx("span",{className:"font-mono text-slate-350 select-all truncate max-w-[120px]",title:w.file_path,children:w.file_path})]})]}):e.jsxs("div",{className:"bg-amber-50/50 border border-amber-100 p-4 rounded-xl flex items-start gap-3 mb-4 text-left",children:[e.jsx(K,{className:"text-amber-500 shrink-0 mt-0.5",size:16}),e.jsxs("div",{className:"text-xs text-amber-700",children:[e.jsx("p",{className:"font-bold",children:t?"未提交作业":"No Submission Yet"}),e.jsx("p",{className:"mt-1",children:t?"在此上传提交后,其他同学将可以对您的作业进行评分互评。":"Once submitted, other students can view and peer-review your work."})]})]}),e.jsx("form",{onSubmit:M,className:"space-y-3",children:e.jsxs("div",{children:[e.jsx("label",{className:"block text-[11px] font-bold text-slate-500 uppercase tracking-wider mb-1",children:t?"输入作品文件路径 / 虚拟路径":"Simulated File Path"}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx("input",{type:"text",value:v,onChange:s=>k(s.target.value),placeholder:"/files/homework.pdf",required:!0,className:"flex-1 bg-white border border-slate-200 px-3 py-2 text-xs rounded-lg text-slate-700 focus:outline-none focus:border-indigo-400 font-mono transition-colors"}),e.jsxs("button",{type:"submit",disabled:z,className:"bg-indigo-650 hover:bg-indigo-700 text-white font-bold text-xs px-4 py-2 rounded-lg transition-colors cursor-pointer disabled:opacity-50 flex items-center gap-1.5 shadow-3xs",children:[z?e.jsx(A,{className:"animate-spin",size:13}):e.jsx(B,{size:13}),w?t?"重新提交":"Re-submit":t?"上传作品":"Submit"]})]})]})})]}),w&&e.jsxs("div",{className:"bg-slate-50 border border-slate-200/80 rounded-2xl p-5 shadow-3xs text-left",children:[e.jsxs("h3",{className:"text-sm font-bold text-slate-800 flex items-center gap-1.5 mb-4 select-none",children:[e.jsx(Q,{size:16,className:"text-pink-650"}),t?"我的平时学习得分":"My Score & Feedback"]}),h?e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"bg-white border border-slate-200 p-4 rounded-xl flex items-center justify-between shadow-3xs",children:[e.jsxs("div",{children:[e.jsx("span",{className:"text-[10px] text-slate-400 font-bold uppercase tracking-wider",children:t?"学期对接总分":"Weighted Final Grade"}),e.jsxs("h2",{className:"text-3xl font-extrabold text-indigo-700 font-mono mt-1",children:[h.calculated_final_score," ",e.jsx("span",{className:"text-xs text-slate-455 font-normal",children:"/ 100"})]})]}),e.jsxs("div",{className:"text-right",children:[e.jsx("span",{className:`inline-block px-2.5 py-1 text-[10px] font-bold rounded-lg border ${h.status==="confirmed"?"bg-emerald-50 text-emerald-700 border-emerald-100":"bg-amber-50 text-amber-700 border-amber-100"}`,children:h.status==="confirmed"?t?"已确认同步":"Synced":t?"教师评分草稿":"Draft"}),e.jsx("p",{className:"text-[9px] text-slate-400 mt-1.5 font-medium",children:t?`教师分 ${h.teacher_score} (占 ${(h.teacher_weight*100).toFixed(0)}%)`:`Teacher ${h.teacher_score} (${(h.teacher_weight*100).toFixed(0)}%)`}),e.jsx("p",{className:"text-[9px] text-slate-400 mt-0.5 font-medium",children:t?`学生互评 (占 ${(h.peer_weight*100).toFixed(0)}%)`:`Peer Review (${(h.peer_weight*100).toFixed(0)}%)`})]})]}),h.teacher_comment&&e.jsxs("div",{className:"bg-slate-100/60 p-3 rounded-lg border border-slate-200 flex gap-2",children:[e.jsx(X,{size:14,className:"text-slate-400 shrink-0 mt-0.5"}),e.jsxs("div",{children:[e.jsx("p",{className:"text-[10px] font-bold text-slate-500",children:t?"教师寄语":"Teacher Comments"}),e.jsx("p",{className:"text-xs text-slate-650 mt-0.5",children:h.teacher_comment})]})]})]}):e.jsx("div",{className:"bg-white border border-slate-150 p-4 rounded-xl flex items-center justify-center text-slate-400 italic text-xs py-8",children:t?"教师尚未确认最终成绩与权重折算。":"Teacher grading is in progress."})]})]}),e.jsxs("div",{className:"flex-grow bg-slate-50 border border-slate-200/80 rounded-2xl p-5 shadow-3xs flex flex-col min-h-[400px] text-left",children:[e.jsxs("h3",{className:"text-sm font-bold text-slate-800 flex items-center gap-1.5 mb-4 shrink-0 select-none",children:[e.jsx(Z,{size:16,className:"text-teal-650"}),t?"同学作业互评公开板":"Classmate Submissions for Peer Review"]}),V.length===0?e.jsx("div",{className:"flex-grow flex items-center justify-center text-slate-400 italic text-xs py-12 border border-dashed border-slate-200 rounded-xl bg-white",children:t?"当前暂无同学提交作业作品。":"No classmate submissions available yet."}):e.jsx("div",{className:"flex-grow overflow-y-auto space-y-4 pr-1",children:V.map(s=>{const l=I.find(N=>N.submission_id===s.id),x=m[s.id]!==void 0?m[s.id]:l?l.score:85,T=L[s.id]!==void 0?L[s.id]:l?l.comment:"",b=E[s.id]||!1;return e.jsxs("div",{className:"bg-white border border-slate-200 rounded-xl p-4 shadow-3xs flex flex-col gap-3",children:[e.jsxs("div",{className:"flex justify-between items-start border-b border-slate-100 pb-2",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:"w-8 h-8 rounded-full bg-indigo-50 text-indigo-700 flex items-center justify-center font-bold text-xs select-none",children:s.student_name?s.student_name[0]:"?"}),e.jsxs("div",{children:[e.jsx("h4",{className:"text-xs font-bold text-slate-700",children:s.student_name||s.student_id}),e.jsxs("p",{className:"text-[10px] text-slate-400 font-mono flex items-center gap-1 mt-0.5 truncate max-w-[200px]",title:s.file_path,children:[e.jsx(ee,{size:11,className:"text-slate-350"}),s.file_path.split("/").pop()," (V",s.version,")"]})]})]}),e.jsx("a",{href:s.file_path,target:"_blank",rel:"noopener noreferrer",className:"text-[10px] font-bold text-indigo-650 hover:text-indigo-800 transition-colors border border-indigo-100 px-2 py-1 rounded bg-indigo-50/50 hover:bg-indigo-50",children:t?"下载查阅":"Download File"})]}),l&&e.jsxs("div",{className:"bg-emerald-50/50 border border-emerald-100 p-2.5 rounded-lg flex items-start gap-2 text-xs text-emerald-800",children:[e.jsx(te,{className:"text-emerald-500 shrink-0 mt-0.5",size:14}),e.jsxs("div",{className:"flex-1",children:[e.jsx("p",{className:"font-bold flex items-center gap-1",children:t?`我已评分:${l.score} 分`:`My Score: ${l.score} pts`}),l.comment&&e.jsxs("p",{className:"text-[11px] text-emerald-700/80 mt-0.5 italic",children:['"',l.comment,'"']})]})]}),e.jsxs("div",{className:"bg-slate-50/60 border border-slate-100 rounded-lg p-3 space-y-3",children:[e.jsxs("div",{className:"flex justify-between items-center",children:[e.jsx("span",{className:"text-[10px] font-bold text-slate-500 uppercase tracking-wider",children:t?"滑动或输入互评分数":"Peer Rating"}),e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx("input",{type:"number",min:"0",max:"100",value:x,onChange:N=>{const _=Math.min(100,Math.max(0,parseInt(N.target.value)||0));P(F=>({...F,[s.id]:_}))},className:"w-12 text-center text-xs font-bold font-mono border border-slate-200 rounded px-1 py-0.5 bg-white text-indigo-750"}),e.jsx("span",{className:"text-[10px] text-slate-400 font-bold",children:t?"分":"pts"})]})]}),e.jsx("input",{type:"range",min:"0",max:"100",value:x,onChange:N=>{const _=parseInt(N.target.value);P(F=>({...F,[s.id]:_}))},className:"w-full h-1.5 bg-gray-200 rounded-lg appearance-none cursor-pointer accent-indigo-650"}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx("textarea",{rows:1,value:T,onChange:N=>{$(_=>({..._,[s.id]:N.target.value}))},placeholder:t?"简要评语反馈...":"Brief feedback comment...",className:"flex-1 bg-white border border-slate-200 px-2 py-1 text-xs rounded-lg text-slate-700 focus:outline-none focus:border-indigo-400 resize-none transition-colors"}),e.jsxs("button",{onClick:()=>D(s.id,s.student_id),disabled:b,className:"bg-indigo-650 hover:bg-indigo-700 text-white font-bold text-xs px-3 rounded-lg transition-colors cursor-pointer disabled:opacity-50 flex items-center justify-center",children:[b?e.jsx(A,{className:"animate-spin",size:13}):e.jsx(se,{size:13}),e.jsx("span",{className:"ml-1 shrink-0",children:l?t?"修改评分":"Update":t?"确认提交":"Submit"})]})]})]})]},s.id)})})]})]})}function xe(u){const{studentLessonTab:i,setStudentLessonTab:p,isStudentLessonContentCollapsed:r,setIsStudentLessonContentCollapsed:S,lang:c,studentFullscreenPanel:o,setStudentFullscreenPanel:f,selectedLesson:d,elements:g,activeRole:C,activeSegmentId:j,setActiveSegmentId:v,fetchElements:k,currentVfsParent:z,setCurrentVfsParent:n,vfsNodes:m,studentSelectedCourseware:P,setStudentSelectedCourseware:L,activeStudentId:$,addToast:E}=u;return e.jsxs("div",{className:`${r||o==="right"?"w-full flex-grow":"flex-grow flex-1"} relative flex flex-col min-h-0 ${o==="left"?"hidden":""} transition-all duration-300`,children:[e.jsxs("div",{className:"flex items-center justify-between mb-2",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("button",{onClick:()=>S(!r),className:"flex items-center gap-1.5 px-3 py-1.5 text-xs font-bold bg-primary-theme/10 text-primary-theme rounded-lg hover:bg-primary-theme/20 transition-colors border border-primary-theme/20 cursor-pointer shadow-3xs",title:r?"展开课程内容":"折叠课程内容",children:[e.jsx(U,{size:13,className:"text-primary-theme"}),e.jsx("span",{children:r?c==="zh"?"展开课程内容":"Expand Content":c==="zh"?"折叠课程内容":"Collapse Content"})]}),e.jsx("button",{onClick:()=>p("whiteboard"),className:`px-3 py-1.5 text-xs font-medium rounded-md transition-colors cursor-pointer ${i==="whiteboard"?"bg-primary-theme/10 text-primary-theme shadow-sm font-bold":"text-muted hover:bg-surface-secondary"}`,children:"Interactive Whiteboard"}),e.jsx("button",{onClick:()=>p("courseware"),className:`px-3 py-1.5 text-xs font-medium rounded-md transition-colors cursor-pointer ${i==="courseware"?"bg-primary-theme/10 text-primary-theme shadow-sm font-bold":"text-muted hover:bg-surface-secondary"}`,children:"Interactive Courseware Viewer"}),e.jsx("button",{onClick:()=>p("assignment"),className:`px-3 py-1.5 text-xs font-medium rounded-md transition-colors cursor-pointer ${i==="assignment"?"bg-primary-theme/10 text-primary-theme shadow-sm font-bold":"text-muted hover:bg-surface-secondary"}`,children:c==="zh"?"作业提交与互评":"Assignments & Peer Reviews"})]}),e.jsx("button",{onClick:()=>f(a=>a==="right"?"none":"right"),className:"p-1 hover:bg-gray-100 text-gray-400 hover:text-gray-700 rounded transition-colors cursor-pointer flex items-center gap-1",title:o==="right"?"退出全屏":"全屏",children:o==="right"?e.jsxs(e.Fragment,{children:[e.jsx(q,{size:13}),e.jsx("span",{className:"text-[10px] font-medium",children:"退出全屏"})]}):e.jsxs(e.Fragment,{children:[e.jsx(G,{size:13}),e.jsx("span",{className:"text-[10px] font-medium",children:"全屏"})]})})]}),i==="whiteboard"&&e.jsx(ie,{lessonId:d,elements:g,userRole:C,activeSegmentId:j,onSegmentSync:a=>v(a),onElementUpdate:async()=>{},onElementDelete:async a=>{await fetch(`/api/lessons/${d}/whiteboard/${a}`,{method:"DELETE"}),k(d)},onClearBoard:async()=>{await fetch(`/api/lessons/${d}/whiteboard`,{method:"DELETE"}),k(d)},onElementAdd:async()=>{},onRefresh:()=>k(d)}),i==="courseware"&&e.jsxs("div",{className:"flex-1 flex gap-4 min-h-0",children:[e.jsxs("div",{className:"w-48 flex-shrink-0 bg-gray-50 border border-gray-200 rounded-lg p-3 flex flex-col min-h-0",children:[e.jsx("h4",{className:"text-xs font-semibold uppercase tracking-wider text-gray-500 mb-2 border-b border-gray-200 pb-2",children:"Cloud Apps"}),e.jsxs("div",{className:"flex-1 overflow-y-auto space-y-1",children:[z!==null&&e.jsxs("button",{onClick:()=>n(null),className:"flex items-center gap-2 p-1.5 text-xs text-indigo-600 w-full hover:bg-gray-200 rounded mb-1 font-medium",children:[e.jsx(O,{className:"rotate-180",size:14})," Back to Root"]}),m.filter(a=>a.type==="dir").map(a=>e.jsxs("button",{onClick:()=>n(a.id),className:"w-full text-left p-1.5 rounded text-xs text-gray-700 hover:bg-gray-200 flex items-center gap-2 group truncate",title:a.name,children:[e.jsx(ae,{size:14,className:"text-indigo-400 shrink-0 group-hover:text-indigo-600"}),e.jsx("span",{className:"truncate",children:a.name})]},a.id)),m.filter(a=>a.type==="file"&&(a.name.endsWith(".html")||a.name.endsWith(".htm")||a.content?.includes("<html"))).length===0?e.jsx("div",{className:"text-xs text-center text-gray-400 italic py-4",children:"No interactive HTML apps found."}):m.filter(a=>a.type==="file"&&(a.name.endsWith(".html")||a.name.endsWith(".htm")||a.content?.includes("<html"))).map(a=>e.jsxs("button",{onClick:()=>L(a.id),className:`w-full text-left p-2 rounded text-xs flex items-center gap-2 truncate transition-colors ${P===a.id?"bg-indigo-100 text-indigo-700 font-medium":"text-gray-600 hover:bg-gray-100"}`,title:a.name,children:[e.jsx(ne,{size:14,className:"shrink-0"}),e.jsx("span",{className:"truncate",children:a.name})]},a.id))]}),e.jsx("div",{className:"mt-2 text-[10px] text-gray-400 leading-tight",children:"Note: Showing HTML courseware from current OS drive directory. Ask agent to generate courseware."})]}),e.jsx("div",{className:"flex-1 relative bg-white min-h-0",children:e.jsx(le,{coursewareId:P,onClose:()=>L(null)})})]}),i==="assignment"&&e.jsx(ce,{lessonId:d,studentId:$,lang:c,addToast:E})]})}function Ne(u){const{students:i,activeStudentId:p,setStudentViewStatus:r,setSelectedLesson:S,lessons:c,selectedLesson:o,studentFullscreenPanel:f,setStudentFullscreenPanel:d,timelineSegments:g,lang:C,activeSegmentId:j,setActiveSegmentId:v,localProgressPercent:k,setLocalProgressPercent:z,updateStudentProgress:n,isStudentLessonContentCollapsed:m,setIsStudentLessonContentCollapsed:P,studentLessonTab:L,setStudentLessonTab:$,elements:E,activeRole:a,fetchElements:t,currentVfsParent:R,setCurrentVfsParent:M,vfsNodes:D,studentSelectedCourseware:w,setStudentSelectedCourseware:h,addToast:I}=u;return e.jsxs("div",{className:"flex flex-col h-full space-y-4",children:[e.jsx(oe,{students:i,activeStudentId:p,setStudentViewStatus:r,setSelectedLesson:S,lessons:c,selectedLesson:o}),e.jsxs("div",{className:"flex-1 flex gap-6 min-h-0 bg-surface border border-theme rounded-xl p-4 shadow-sm text-main",children:[e.jsx(de,{students:i,activeStudentId:p,studentFullscreenPanel:f,setStudentFullscreenPanel:d,timelineSegments:g,lang:C,activeSegmentId:j,setActiveSegmentId:v,localProgressPercent:k,setLocalProgressPercent:z,updateStudentProgress:n,selectedLesson:o,lessons:c,isStudentLessonContentCollapsed:m}),e.jsx(xe,{studentLessonTab:L,setStudentLessonTab:$,isStudentLessonContentCollapsed:m,setIsStudentLessonContentCollapsed:P,lang:C,studentFullscreenPanel:f,setStudentFullscreenPanel:d,selectedLesson:o,elements:E,activeRole:a,activeSegmentId:j,setActiveSegmentId:v,fetchElements:t,currentVfsParent:R,setCurrentVfsParent:M,vfsNodes:D,studentSelectedCourseware:w,setStudentSelectedCourseware:h,activeStudentId:p,addToast:I})]})]})}export{Ne as StudentLessonView};
@@ -1 +1 @@
1
- import{j as e}from"./vendor-react-0Lg0vA-4.js";import{L as k}from"./LazyWhiteboard-CtkzSFtN.js";import{L as C}from"./LazyCourseware-DXL9IxZO.js";import{m as z,M as L}from"./index-CYzNsYZB.js";import{E as P,X as $,B as E,$ as g,ah as f,a9 as S,ai as T,p as F}from"./vendor-icons-Dq6MhgH9.js";import"./vendor-pdf-Cp-cYteE.js";import"./vendor-utils-BEhuP0Zq.js";import"./vendor-motion-DjY2czvL.js";import"./vendor-pptx-B_NheIKl.js";import"./vendor-charts-CRXa4AlU.js";function J(p){const{isLessonPreviewVisible:b,setIsLessonPreviewVisible:u,lessons:o,selectedLesson:s,previewFullscreenPanel:r,setPreviewFullscreenPanel:d,previewLessonTab:a,setPreviewLessonTab:c,activeRole:y,elements:w,activeSegmentId:j,setActiveSegmentId:v,fetchElements:i,currentVfsParent:N,setCurrentVfsParent:x,vfsNodes:l,previewSelectedCourseware:m,setPreviewSelectedCourseware:h}=p;return e.jsx(e.Fragment,{children:b&&e.jsx("div",{className:"fixed inset-0 bg-gray-900/60 backdrop-blur-sm flex items-center justify-center p-4 md:p-6 z-[60] overflow-hidden text-gray-850",children:e.jsxs(z.div,{initial:{opacity:0,scale:.96},animate:{opacity:1,scale:1},exit:{opacity:0,scale:.96},className:"bg-white border text-gray-900 border-gray-200 rounded-2xl shadow-2xl w-full max-w-7xl h-[90vh] flex flex-col overflow-hidden",children:[e.jsxs("div",{className:"p-4 border-b border-gray-100 flex items-center justify-between bg-indigo-50/70 shrink-0 select-none",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"bg-indigo-600 text-white p-2 rounded-lg shadow-sm",children:e.jsx(P,{size:18})}),e.jsxs("div",{children:[e.jsx("h2",{className:"font-bold text-gray-900 text-base flex items-center gap-2",children:"学生视角预览 (Student Perspective Preview)"}),e.jsxs("p",{className:"text-xs text-gray-500 mt-0.5",children:["正在预览课程: ",e.jsx("span",{className:"font-semibold text-gray-700",children:o.find(t=>t.id===s)?.title})," • 演示同步与交互"]})]})]}),e.jsxs("button",{onClick:()=>u(!1),className:"px-3.5 py-1.5 bg-gray-100 hover:bg-gray-200 text-gray-600 hover:text-gray-800 text-xs font-semibold rounded-lg shadow-sm transition-all cursor-pointer flex items-center gap-1 border border-gray-200",children:[e.jsx($,{size:14})," 退出预览"]})]}),e.jsxs("div",{className:"flex-1 flex min-h-0 bg-slate-50/50 p-4 gap-4",children:[e.jsxs("div",{className:`${r==="left"?"w-full":"w-1/3"} bg-white border border-gray-200 rounded-xl p-4 flex flex-col min-h-0 shadow-sm ${r==="right"?"hidden":""} transition-all duration-300`,children:[e.jsxs("div",{className:"text-xs font-bold uppercase tracking-wider text-gray-400 mb-3 border-b border-gray-100 pb-2 flex items-center justify-between shrink-0 select-none",children:[e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(E,{size:14,className:"text-indigo-500"})," Lesson Content (课程内容)"]}),e.jsx("button",{onClick:()=>d(t=>t==="left"?"none":"left"),className:"p-1 hover:bg-gray-100 text-gray-400 hover:text-gray-700 rounded transition-colors cursor-pointer flex items-center gap-1",title:r==="left"?"退出全屏":"全屏",children:r==="left"?e.jsxs(e.Fragment,{children:[e.jsx(g,{size:13}),e.jsx("span",{className:"text-[10px] font-medium",children:"退出全屏"})]}):e.jsxs(e.Fragment,{children:[e.jsx(f,{size:13}),e.jsx("span",{className:"text-[10px] font-medium",children:"全屏"})]})})]}),e.jsx("div",{className:"flex-1 overflow-y-auto prose prose-sm prose-indigo max-w-none text-gray-700 pr-1",children:e.jsx(L,{children:o.find(t=>t.id===s)?.content||""})})]}),e.jsxs("div",{className:`${r==="right"?"w-full flex-grow":"flex-1"} bg-white border border-gray-200 rounded-xl p-4 flex flex-col min-h-0 shadow-sm ${r==="left"?"hidden":""} transition-all duration-300`,children:[e.jsxs("div",{className:"flex items-center justify-between border-b border-gray-100 pb-3 mb-3 shrink-0",children:[e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx("button",{onClick:()=>c("whiteboard"),className:`px-3 py-1.5 text-xs font-semibold rounded-lg transition-all cursor-pointer ${a==="whiteboard"?"bg-indigo-600 text-white shadow-sm":"text-gray-500 hover:bg-gray-100"}`,children:"Interactive Whiteboard"}),e.jsx("button",{onClick:()=>c("courseware"),className:`px-3 py-1.5 text-xs font-semibold rounded-lg transition-all cursor-pointer ${a==="courseware"?"bg-indigo-600 text-white shadow-sm":"text-gray-500 hover:bg-gray-100"}`,children:"Cloud Apps Viewer"})]}),e.jsx("button",{onClick:()=>d(t=>t==="right"?"none":"right"),className:"p-1 hover:bg-gray-100 text-gray-400 hover:text-gray-700 rounded transition-colors cursor-pointer flex items-center gap-1",title:r==="right"?"退出全屏":"全屏",children:r==="right"?e.jsxs(e.Fragment,{children:[e.jsx(g,{size:13}),e.jsx("span",{className:"text-[10px] font-medium",children:"退出全屏"})]}):e.jsxs(e.Fragment,{children:[e.jsx(f,{size:13}),e.jsx("span",{className:"text-[10px] font-medium",children:"全屏"})]})})]}),e.jsx("div",{className:"flex-grow flex-1 min-h-0 flex flex-col h-full relative",children:a==="whiteboard"?e.jsx("div",{className:"flex-grow flex-1 min-h-0 w-full h-full relative rounded-lg overflow-hidden border border-gray-100 flex flex-col",children:e.jsx(k,{lessonId:s,userRole:y,elements:w,activeSegmentId:j,onSegmentSync:t=>v(t),onElementAdd:async(t,n)=>{await fetch(`/api/lessons/${s}/whiteboard`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({type:t,data:n})}),i(s)},onElementUpdate:async(t,n)=>{await fetch(`/api/lessons/${s}/whiteboard/${t}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({data:n})}),i(s)},onElementDelete:async t=>{await fetch(`/api/lessons/${s}/whiteboard/${t}`,{method:"DELETE"}),i(s)},onClearBoard:async()=>{await fetch(`/api/lessons/${s}/whiteboard`,{method:"DELETE"}),i(s)},onRefresh:()=>i(s)})}):e.jsxs("div",{className:"flex-grow flex-1 flex gap-4 min-h-0 w-full h-full",children:[e.jsxs("div",{className:"w-52 flex-shrink-0 bg-gray-50 border border-gray-250/70 rounded-xl p-3 flex flex-col min-h-0 h-full animate-none",children:[e.jsx("h4",{className:"text-xs font-bold uppercase tracking-wider text-gray-550 mb-2 border-b border-gray-200 pb-2",children:"Cloud Apps"}),e.jsxs("div",{className:"flex-1 overflow-y-auto space-y-1",children:[N!==null&&e.jsxs("button",{onClick:()=>x(null),className:"flex items-center gap-1 p-1.5 text-xs text-indigo-600 w-full hover:bg-gray-255 hover:bg-gray-200 rounded-lg mb-1 font-semibold",children:[e.jsx(S,{className:"rotate-180",size:14})," Back to Root"]}),l.filter(t=>t.type==="dir").map(t=>e.jsxs("button",{onClick:()=>x(t.id),className:"w-full text-left p-1.5 rounded-lg text-xs text-gray-700 hover:bg-gray-250 hover:bg-gray-200 flex items-center gap-2 group truncate cursor-pointer font-medium",title:t.name,children:[e.jsx(T,{size:14,className:"text-indigo-400 shrink-0 group-hover:text-indigo-600"}),e.jsx("span",{className:"truncate",children:t.name})]},t.id)),l.filter(t=>t.type==="file"&&(t.name.endsWith(".html")||t.name.endsWith(".htm")||t.content?.includes("<html"))).length===0?e.jsx("div",{className:"text-xs text-center text-gray-400 italic py-4",children:"No interactive HTML apps found."}):l.filter(t=>t.type==="file"&&(t.name.endsWith(".html")||t.name.endsWith(".htm")||t.content?.includes("<html"))).map(t=>e.jsxs("button",{onClick:()=>h(t.id),className:`w-full text-left p-2 rounded-lg text-xs flex items-center gap-2 truncate transition-colors cursor-pointer font-medium ${m===t.id?"bg-indigo-100 text-indigo-700 font-semibold shadow-xs":"text-gray-600 hover:bg-gray-100"}`,title:t.name,children:[e.jsx(F,{size:14,className:"shrink-0 text-indigo-500"}),e.jsx("span",{className:"truncate",children:t.name})]},t.id))]}),e.jsx("div",{className:"mt-2 text-[10px] text-gray-400 leading-tight",children:"Note: Showing HTML courseware from current OS drive directory."})]}),e.jsx("div",{className:"flex-1 relative bg-white border border-gray-100 rounded-xl overflow-hidden min-h-0 h-full shadow-inner flex flex-col",children:e.jsx(C,{coursewareId:m,onClose:()=>h(null)})})]})})]})]})]})})})}export{J as StudentPreviewModal};
1
+ import{j as e}from"./vendor-react-0Lg0vA-4.js";import{L as k}from"./LazyWhiteboard-D_U3t5Ft.js";import{L as C}from"./LazyCourseware-BtliMSwD.js";import{m as z,M as L}from"./index-CerSuw-h.js";import{E as P,X as $,B as E,$ as g,ah as f,a9 as S,ai as T,p as F}from"./vendor-icons-Dq6MhgH9.js";import"./vendor-pdf-Cp-cYteE.js";import"./vendor-utils-BEhuP0Zq.js";import"./vendor-motion-DjY2czvL.js";import"./vendor-pptx-B_NheIKl.js";import"./vendor-charts-CRXa4AlU.js";function J(p){const{isLessonPreviewVisible:b,setIsLessonPreviewVisible:u,lessons:o,selectedLesson:s,previewFullscreenPanel:r,setPreviewFullscreenPanel:d,previewLessonTab:a,setPreviewLessonTab:c,activeRole:y,elements:w,activeSegmentId:j,setActiveSegmentId:v,fetchElements:i,currentVfsParent:N,setCurrentVfsParent:x,vfsNodes:l,previewSelectedCourseware:m,setPreviewSelectedCourseware:h}=p;return e.jsx(e.Fragment,{children:b&&e.jsx("div",{className:"fixed inset-0 bg-gray-900/60 backdrop-blur-sm flex items-center justify-center p-4 md:p-6 z-[60] overflow-hidden text-gray-850",children:e.jsxs(z.div,{initial:{opacity:0,scale:.96},animate:{opacity:1,scale:1},exit:{opacity:0,scale:.96},className:"bg-white border text-gray-900 border-gray-200 rounded-2xl shadow-2xl w-full max-w-7xl h-[90vh] flex flex-col overflow-hidden",children:[e.jsxs("div",{className:"p-4 border-b border-gray-100 flex items-center justify-between bg-indigo-50/70 shrink-0 select-none",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"bg-indigo-600 text-white p-2 rounded-lg shadow-sm",children:e.jsx(P,{size:18})}),e.jsxs("div",{children:[e.jsx("h2",{className:"font-bold text-gray-900 text-base flex items-center gap-2",children:"学生视角预览 (Student Perspective Preview)"}),e.jsxs("p",{className:"text-xs text-gray-500 mt-0.5",children:["正在预览课程: ",e.jsx("span",{className:"font-semibold text-gray-700",children:o.find(t=>t.id===s)?.title})," • 演示同步与交互"]})]})]}),e.jsxs("button",{onClick:()=>u(!1),className:"px-3.5 py-1.5 bg-gray-100 hover:bg-gray-200 text-gray-600 hover:text-gray-800 text-xs font-semibold rounded-lg shadow-sm transition-all cursor-pointer flex items-center gap-1 border border-gray-200",children:[e.jsx($,{size:14})," 退出预览"]})]}),e.jsxs("div",{className:"flex-1 flex min-h-0 bg-slate-50/50 p-4 gap-4",children:[e.jsxs("div",{className:`${r==="left"?"w-full":"w-1/3"} bg-white border border-gray-200 rounded-xl p-4 flex flex-col min-h-0 shadow-sm ${r==="right"?"hidden":""} transition-all duration-300`,children:[e.jsxs("div",{className:"text-xs font-bold uppercase tracking-wider text-gray-400 mb-3 border-b border-gray-100 pb-2 flex items-center justify-between shrink-0 select-none",children:[e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(E,{size:14,className:"text-indigo-500"})," Lesson Content (课程内容)"]}),e.jsx("button",{onClick:()=>d(t=>t==="left"?"none":"left"),className:"p-1 hover:bg-gray-100 text-gray-400 hover:text-gray-700 rounded transition-colors cursor-pointer flex items-center gap-1",title:r==="left"?"退出全屏":"全屏",children:r==="left"?e.jsxs(e.Fragment,{children:[e.jsx(g,{size:13}),e.jsx("span",{className:"text-[10px] font-medium",children:"退出全屏"})]}):e.jsxs(e.Fragment,{children:[e.jsx(f,{size:13}),e.jsx("span",{className:"text-[10px] font-medium",children:"全屏"})]})})]}),e.jsx("div",{className:"flex-1 overflow-y-auto prose prose-sm prose-indigo max-w-none text-gray-700 pr-1",children:e.jsx(L,{children:o.find(t=>t.id===s)?.content||""})})]}),e.jsxs("div",{className:`${r==="right"?"w-full flex-grow":"flex-1"} bg-white border border-gray-200 rounded-xl p-4 flex flex-col min-h-0 shadow-sm ${r==="left"?"hidden":""} transition-all duration-300`,children:[e.jsxs("div",{className:"flex items-center justify-between border-b border-gray-100 pb-3 mb-3 shrink-0",children:[e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx("button",{onClick:()=>c("whiteboard"),className:`px-3 py-1.5 text-xs font-semibold rounded-lg transition-all cursor-pointer ${a==="whiteboard"?"bg-indigo-600 text-white shadow-sm":"text-gray-500 hover:bg-gray-100"}`,children:"Interactive Whiteboard"}),e.jsx("button",{onClick:()=>c("courseware"),className:`px-3 py-1.5 text-xs font-semibold rounded-lg transition-all cursor-pointer ${a==="courseware"?"bg-indigo-600 text-white shadow-sm":"text-gray-500 hover:bg-gray-100"}`,children:"Cloud Apps Viewer"})]}),e.jsx("button",{onClick:()=>d(t=>t==="right"?"none":"right"),className:"p-1 hover:bg-gray-100 text-gray-400 hover:text-gray-700 rounded transition-colors cursor-pointer flex items-center gap-1",title:r==="right"?"退出全屏":"全屏",children:r==="right"?e.jsxs(e.Fragment,{children:[e.jsx(g,{size:13}),e.jsx("span",{className:"text-[10px] font-medium",children:"退出全屏"})]}):e.jsxs(e.Fragment,{children:[e.jsx(f,{size:13}),e.jsx("span",{className:"text-[10px] font-medium",children:"全屏"})]})})]}),e.jsx("div",{className:"flex-grow flex-1 min-h-0 flex flex-col h-full relative",children:a==="whiteboard"?e.jsx("div",{className:"flex-grow flex-1 min-h-0 w-full h-full relative rounded-lg overflow-hidden border border-gray-100 flex flex-col",children:e.jsx(k,{lessonId:s,userRole:y,elements:w,activeSegmentId:j,onSegmentSync:t=>v(t),onElementAdd:async(t,n)=>{await fetch(`/api/lessons/${s}/whiteboard`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({type:t,data:n})}),i(s)},onElementUpdate:async(t,n)=>{await fetch(`/api/lessons/${s}/whiteboard/${t}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({data:n})}),i(s)},onElementDelete:async t=>{await fetch(`/api/lessons/${s}/whiteboard/${t}`,{method:"DELETE"}),i(s)},onClearBoard:async()=>{await fetch(`/api/lessons/${s}/whiteboard`,{method:"DELETE"}),i(s)},onRefresh:()=>i(s)})}):e.jsxs("div",{className:"flex-grow flex-1 flex gap-4 min-h-0 w-full h-full",children:[e.jsxs("div",{className:"w-52 flex-shrink-0 bg-gray-50 border border-gray-250/70 rounded-xl p-3 flex flex-col min-h-0 h-full animate-none",children:[e.jsx("h4",{className:"text-xs font-bold uppercase tracking-wider text-gray-550 mb-2 border-b border-gray-200 pb-2",children:"Cloud Apps"}),e.jsxs("div",{className:"flex-1 overflow-y-auto space-y-1",children:[N!==null&&e.jsxs("button",{onClick:()=>x(null),className:"flex items-center gap-1 p-1.5 text-xs text-indigo-600 w-full hover:bg-gray-255 hover:bg-gray-200 rounded-lg mb-1 font-semibold",children:[e.jsx(S,{className:"rotate-180",size:14})," Back to Root"]}),l.filter(t=>t.type==="dir").map(t=>e.jsxs("button",{onClick:()=>x(t.id),className:"w-full text-left p-1.5 rounded-lg text-xs text-gray-700 hover:bg-gray-250 hover:bg-gray-200 flex items-center gap-2 group truncate cursor-pointer font-medium",title:t.name,children:[e.jsx(T,{size:14,className:"text-indigo-400 shrink-0 group-hover:text-indigo-600"}),e.jsx("span",{className:"truncate",children:t.name})]},t.id)),l.filter(t=>t.type==="file"&&(t.name.endsWith(".html")||t.name.endsWith(".htm")||t.content?.includes("<html"))).length===0?e.jsx("div",{className:"text-xs text-center text-gray-400 italic py-4",children:"No interactive HTML apps found."}):l.filter(t=>t.type==="file"&&(t.name.endsWith(".html")||t.name.endsWith(".htm")||t.content?.includes("<html"))).map(t=>e.jsxs("button",{onClick:()=>h(t.id),className:`w-full text-left p-2 rounded-lg text-xs flex items-center gap-2 truncate transition-colors cursor-pointer font-medium ${m===t.id?"bg-indigo-100 text-indigo-700 font-semibold shadow-xs":"text-gray-600 hover:bg-gray-100"}`,title:t.name,children:[e.jsx(F,{size:14,className:"shrink-0 text-indigo-500"}),e.jsx("span",{className:"truncate",children:t.name})]},t.id))]}),e.jsx("div",{className:"mt-2 text-[10px] text-gray-400 leading-tight",children:"Note: Showing HTML courseware from current OS drive directory."})]}),e.jsx("div",{className:"flex-1 relative bg-white border border-gray-100 rounded-xl overflow-hidden min-h-0 h-full shadow-inner flex flex-col",children:e.jsx(C,{coursewareId:m,onClose:()=>h(null)})})]})})]})]})]})})})}export{J as StudentPreviewModal};