openlearn-next 0.4.2 → 0.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (74) hide show
  1. package/README.md +21 -20
  2. package/dist/assets/ActivityWorkspaceWidget-_6XMBAcc.js +1 -0
  3. package/dist/assets/AdminDirectoryView-BufUF-sk.js +5 -0
  4. package/dist/assets/{BatchPickerModal-BpWu0Lil.js → BatchPickerModal-CES2DlPx.js} +1 -1
  5. package/dist/assets/ClassesView-BLvRJKcc.js +24 -0
  6. package/dist/assets/ClassroomCountdownWidget-DfKotHP8.js +2 -0
  7. package/dist/assets/{CloudDriveModal-DEQ1nkNk.js → CloudDriveModal-CLe4I18S.js} +1 -1
  8. package/dist/assets/ComputerLabView-CPnWWguS.js +1 -0
  9. package/dist/assets/CourseManagement-BSR61ggI.js +1 -0
  10. package/dist/assets/CourseWizardModal-D2m3PG7k.js +3 -0
  11. package/dist/assets/CoursewareHubPanel-gqjte-Pv.js +1 -0
  12. package/dist/assets/Dashboard-BPBJd0QR.js +8 -0
  13. package/dist/assets/ExportWeightModal-C3gIzDaP.js +1 -0
  14. package/dist/assets/HelpTour-B-RKDb1-.js +1 -0
  15. package/dist/assets/{HelpView-CtzdqhBq.js → HelpView-Bk64VK-J.js} +12 -12
  16. package/dist/assets/ImportLessonsModal-DUGpcZV3.js +1 -0
  17. package/dist/assets/ImportModal-ChY_Y5DZ.js +1 -0
  18. package/dist/assets/InteractiveCoursewareViewer-B9wvha7w.js +1 -0
  19. package/dist/assets/InteractiveWhiteboard-FPrze5CJ.js +78 -0
  20. package/dist/assets/LazyCourseware-BV5nOs5y.js +2 -0
  21. package/dist/assets/LazyWhiteboard-Cy5DdYnO.js +2 -0
  22. package/dist/assets/LessonEditorView-3SyplRhr.js +1 -0
  23. package/dist/assets/LiveClassroomView-CX7SUnmx.js +61 -0
  24. package/dist/assets/{NotificationDetailModal-Baqnc5pU.js → NotificationDetailModal-BBATA8Lh.js} +1 -1
  25. package/dist/assets/{PluginView-CCbIuZ24.js → PluginView-D5jMNscn.js} +5 -5
  26. package/dist/assets/ProcessLogsModal-DfKPVIYe.js +1 -0
  27. package/dist/assets/{QuizGeneratorModal-BBEDssp7.js → QuizGeneratorModal-CbRirQId.js} +1 -1
  28. package/dist/assets/StudentAssignmentView-ucXAOac9.js +1 -0
  29. package/dist/assets/StudentLessonView-CW6FYMtd.js +13 -0
  30. package/dist/assets/StudentView-Bxrut8tS.js +2 -0
  31. package/dist/assets/SystemResourceLibraryModal-CXdrWHDL.js +1 -0
  32. package/dist/assets/TeacherView-DXg0boJH.js +2 -0
  33. package/dist/assets/TimetableView-DPABkaFX.js +6 -0
  34. package/dist/assets/index-B3W5zons.css +1 -0
  35. package/dist/assets/index-B6wtREUD.js +221 -0
  36. package/dist/assets/{index.es-C5eWEO4o.js → index.es-DvJa33KC.js} +1 -1
  37. package/dist/assets/{vendor-charts-qLbgF1eL.js → vendor-charts-DGsG2RUv.js} +1 -1
  38. package/dist/assets/{vendor-icons-BRmhY6fg.js → vendor-icons-CyfamhaC.js} +2 -2
  39. package/dist/assets/{vendor-konva-CEOq4dcl.js → vendor-konva-DBWwlLTb.js} +1 -1
  40. package/dist/assets/{vendor-pdf-D7rGevI1.js → vendor-pdf-D0UGJOgo.js} +49 -49
  41. package/dist/assets/{vendor-pptx-C5-U7ieS.js → vendor-pptx-D4btWy5L.js} +8 -8
  42. package/dist/assets/{vendor-react-B0t7H3hh.js → vendor-react-CZ1I7IcM.js} +1 -1
  43. package/dist/assets/{vendor-utils-m0Urvtws.js → vendor-utils-B6R8dnOe.js} +1 -1
  44. package/dist/index.html +13 -10
  45. package/dist/server.cjs +19224 -11247
  46. package/package.json +11 -4
  47. package/dist/assets/AdminDirectoryView-DY--WM5Z.js +0 -1
  48. package/dist/assets/ClassesView-KbHEqJto.js +0 -22
  49. package/dist/assets/ClassroomCountdownWidget-96WFRO9A.js +0 -2
  50. package/dist/assets/ComputerLabView-1qWDNRQ2.js +0 -1
  51. package/dist/assets/CourseManagement-D3ZpxY0l.js +0 -1
  52. package/dist/assets/CourseWizardModal-Ck_-M8pk.js +0 -3
  53. package/dist/assets/CoursewareHubPanel-CaEizhxl.js +0 -1
  54. package/dist/assets/Dashboard-CYbpbofV.js +0 -8
  55. package/dist/assets/ExportWeightModal-DW2bu9Zz.js +0 -1
  56. package/dist/assets/HelpTour-CMJbbGne.js +0 -1
  57. package/dist/assets/ImportLessonsModal-jBuIK453.js +0 -1
  58. package/dist/assets/ImportModal-D7L-KNhZ.js +0 -1
  59. package/dist/assets/InteractiveCoursewareViewer-Bj7ahXMs.js +0 -1
  60. package/dist/assets/InteractiveWhiteboard-B7JcJvDu.js +0 -77
  61. package/dist/assets/LazyCourseware-CuiPxhDg.js +0 -2
  62. package/dist/assets/LazyWhiteboard-BJwCEZAU.js +0 -2
  63. package/dist/assets/LessonEditorView-DFrOp2qp.js +0 -1
  64. package/dist/assets/LiveClassroomView-BZ5nGee3.js +0 -59
  65. package/dist/assets/ProcessLogsModal-DmFXg9mG.js +0 -1
  66. package/dist/assets/StudentAssignmentView-DgIjUsXz.js +0 -1
  67. package/dist/assets/StudentLessonView-CBJbI5x6.js +0 -1
  68. package/dist/assets/StudentPreviewModal-Bh8OZs0t.js +0 -1
  69. package/dist/assets/StudentView--uGxc5TJ.js +0 -2
  70. package/dist/assets/SystemResourceLibraryModal-BVCclcqA.js +0 -1
  71. package/dist/assets/TeacherView-D4Zsc0eZ.js +0 -2
  72. package/dist/assets/TimetableView-BQG-rEb5.js +0 -6
  73. package/dist/assets/index-BKBCBKvy.js +0 -217
  74. package/dist/assets/index-CvGu7LSj.css +0 -1
package/README.md CHANGED
@@ -73,7 +73,6 @@
73
73
 
74
74
  ---
75
75
 
76
-
77
76
  ## 快速开始
78
77
 
79
78
  ### 一键运行(无需 clone 项目)
@@ -113,6 +112,7 @@ pnpm dev
113
112
  # 浏览器访问
114
113
  open http://localhost:9000
115
114
  ```
115
+
116
116
  > 首次启动后,可在管理后台「AI Provider 管理」中配置您的大模型 API 密钥(DeepSeek、OpenAI、Ollama 等)。
117
117
 
118
118
  ---
@@ -131,29 +131,29 @@ chmod +x deploy.sh
131
131
 
132
132
  ## 常用开发命令 (CLI Scripts)
133
133
 
134
- | 命令 | 说明 |
135
- | :--- | :--- |
136
- | `pnpm dev` | 启动全栈开发服务(Express + Vite HMR,端口 9000) |
137
- | `pnpm build` | 生产级全量构建(Vite 前端构建 ➔ 插件打包 ➔ esbuild 服务端打包) |
138
- | `pnpm start` | 运行生产打包服务(从 `dist/server.cjs` 启动) |
139
- | `pnpm test` | 执行 Vitest 自动化测试套件(支持并行 worker 隔离 SQLite 测试库) |
140
- | `pnpm lint` | TypeScript 静态类型检查(`tsc --noEmit`) |
141
- | `pnpm lint:eslint` | ESLint 代码规范检查 |
142
- | `pnpm format` | Prettier 代码自动化格式化 |
143
- | `pnpm db:backup` | 数据库安全在线冷备 |
144
- | `pnpm db:reset` | 重置本地测试数据库环境 |
134
+ | 命令 | 说明 |
135
+ | :----------------- | :--------------------------------------------------------------- |
136
+ | `pnpm dev` | 启动全栈开发服务(Express + Vite HMR,端口 9000) |
137
+ | `pnpm build` | 生产级全量构建(Vite 前端构建 ➔ 插件打包 ➔ esbuild 服务端打包) |
138
+ | `pnpm start` | 运行生产打包服务(从 `dist/server.cjs` 启动) |
139
+ | `pnpm test` | 执行 Vitest 自动化测试套件(支持并行 worker 隔离 SQLite 测试库) |
140
+ | `pnpm lint` | TypeScript 静态类型检查(`tsc --noEmit`) |
141
+ | `pnpm lint:eslint` | ESLint 代码规范检查 |
142
+ | `pnpm format` | Prettier 代码自动化格式化 |
143
+ | `pnpm db:backup` | 数据库安全在线冷备 |
144
+ | `pnpm db:reset` | 重置本地测试数据库环境 |
145
145
 
146
146
  ---
147
147
 
148
148
  ## ⚙️ 环境变量
149
149
 
150
- | 变量 | 必需 | 默认值 | 说明 |
151
- | :--- | :---: | :---: | :--- |
152
- | `ENCRYPTION_KEY` | ✅ | — | 64 位 Hex 字符串,用于 AI Provider API Key 加密(`deploy.sh` 会自动生成) |
153
- | `PORT` | — | `9000` | HTTP 服务监听端口 |
154
- | `OPENLEARN_DB_PATH` | — | `./packages/core/db/educational_os.db` | SQLite 数据库文件路径(npx 运行时默认为 `~/openlearn-next/data.db`) |
155
- | `ALLOWED_ORIGINS` | — | `*` | CORS 跨域白名单(逗号分隔) |
156
- | `LOG_LEVEL` | — | `info` | 系统日志输出级别(`debug` / `info` / `warn` / `error`) |
150
+ | 变量 | 必需 | 默认值 | 说明 |
151
+ | :------------------ | :--: | :------------------------------------: | :------------------------------------------------------------------------ |
152
+ | `ENCRYPTION_KEY` | ✅ | — | 64 位 Hex 字符串,用于 AI Provider API Key 加密(`deploy.sh` 会自动生成) |
153
+ | `PORT` | — | `9000` | HTTP 服务监听端口 |
154
+ | `OPENLEARN_DB_PATH` | — | `./packages/core/db/educational_os.db` | SQLite 数据库文件路径(npx 运行时默认为 `~/openlearn-next/data.db`) |
155
+ | `ALLOWED_ORIGINS` | — | `*` | CORS 跨域白名单(逗号分隔) |
156
+ | `LOG_LEVEL` | — | `info` | 系统日志输出级别(`debug` / `info` / `warn` / `error`) |
157
157
 
158
158
  ---
159
159
 
@@ -162,6 +162,7 @@ chmod +x deploy.sh
162
162
  根据平台近期代码与架构深度审计结果(相关一致性由 [架构文档漂移审计](docs/developer-guide/docs-drift-audit.md) 在 CI 中持续看守),OpenLearn 制定了分阶段的演进路线:
163
163
 
164
164
  ### 🎯 阶段一:稳固与安全收敛 (v0.3.21 - 当前阶段)
165
+
165
166
  - [x] **P0 严重安全缺陷彻底闭环**:
166
167
  - [x] 为 `/api/plugins/execute-command` 挂载全局有效会话鉴权(`requireAuth()`),消除未授权命令执行面
167
168
  - [x] 插件更新检查器(`version-fetcher.ts`)消除 Shell 命令注入,采用安全参数化执行(`execFileSync`)与仓库白名单正则校验
@@ -176,6 +177,7 @@ chmod +x deploy.sh
176
177
  - [ ] **自动化测试体系清理**:解耦对未提交外部目录的物理路径硬依赖,使 215 个套件的全量测试达到 100% 绿灯
177
178
 
178
179
  ### 🚀 阶段二:K12 课堂交互与智能伴随深化 (v0.4.0 - 中期演进)
180
+
179
181
  - [ ] **课件状态双向镜像与远程协助**:
180
182
  - 教师端可按需拉取单个学生的课件作答实时快照(DOM/Canvas 镜像)
181
183
  - 支持教师端一键向指定学生或全班推送课件交互指令(如强制锁屏、重置题目、跳转指定页)
@@ -205,4 +207,3 @@ chmod +x deploy.sh
205
207
  ## 📄 开源许可证
206
208
 
207
209
  本项目基于 MIT License 开源发布(声明见 [package.json](package.json) 的 `license` 字段)。
208
-
@@ -0,0 +1 @@
1
+ import{r as o,j as e}from"./vendor-react-CZ1I7IcM.js";import{d as q}from"./index-B6wtREUD.js";import{O as D,X as _,j as H,i as J,B as Q,o as V,v as X,aq as Y,U as G,a_ as K,aY as Z,a$ as ee,e as te,P as se}from"./vendor-icons-CyfamhaC.js";import"./vendor-utils-B6R8dnOe.js";import"./vendor-pptx-D4btWy5L.js";import"./vendor-pdf-D0UGJOgo.js";import"./vendor-motion-BFAPOs-b.js";import"./vendor-charts-DGsG2RUv.js";async function ie(n="all"){const a=await fetch(`/api/activities?role=${encodeURIComponent(n)}`,{headers:{Accept:"application/json"}});if(!a.ok)throw new Error(`Failed to load activities (${a.status})`);return(await a.json()).activities??[]}async function k(){const n=await fetch("/api/activities/running",{headers:{Accept:"application/json"}});if(!n.ok)throw new Error(`Failed to load running activities (${n.status})`);return(await n.json()).activities??[]}async function ne(n){const a=await fetch(`/api/activities/${encodeURIComponent(n)}/finish`,{method:"POST",headers:{"Content-Type":"application/json"}});if(!a.ok){const s=await a.json().catch(()=>({}));throw new Error(s.error||`Failed to finish activity (${a.status})`)}}async function ae(n){const a=await fetch(`/api/activities/${encodeURIComponent(n)}/pause`,{method:"POST",headers:{"Content-Type":"application/json"}});if(!a.ok){const s=await a.json().catch(()=>({}));throw new Error(s.error||`Failed to pause activity (${a.status})`)}}async function re(n){const a=await fetch(`/api/activities/${encodeURIComponent(n)}/resume`,{method:"POST",headers:{"Content-Type":"application/json"}});if(!a.ok){const s=await a.json().catch(()=>({}));throw new Error(s.error||`Failed to resume activity (${a.status})`)}}async function oe(n,a,s){const l=await fetch(`/api/activities/${encodeURIComponent(n)}/start`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({payload:a??{},actorId:s})}),c=await l.json();if(!l.ok||c.ok===!1)throw new Error(c.error||`Failed to start activity (${l.status})`);return c}const x={padding:"12px",color:"#e2e8f0",fontSize:"13px"},ce={HelpCircle:te,Vote:ee,BarChart3:Z,MessagesSquare:K,Users:G,FileText:Y,Trophy:X,CheckCircle2:V,BookOpen:Q};function le({name:n,className:a}){const s=n&&ce[n]||se;return e.jsx(s,{size:18,className:a})}function de(n,a){if(!n)return a==="zh"?"进行中":"In progress";const s=Math.max(0,Math.floor((Date.now()-n)/1e3)),l=Math.floor(s/60),c=s%60;return a==="zh"?`${l} 分 ${c} 秒`:`${l}m ${c}s`}const je=({role:n,actorId:a,lang:s="en",classroomId:l,mode:c="launcher"})=>{const[p,E]=o.useState([]),[A,j]=o.useState(!0),[v,$]=o.useState(null),[b,m]=o.useState({}),[h,w]=o.useState([]),[T,R]=o.useState(!0),[P,I]=o.useState(null),[y,u]=o.useState(null),[f,z]=o.useState(!1),[S,C]=o.useState(null),B=q(i=>i.setTeacherTab),F=o.useMemo(()=>{const i=new Map;for(const t of p){const r=t.category;i.has(r)||i.set(r,[]),i.get(r).push(t)}return Array.from(i.entries())},[p]);o.useEffect(()=>{if(c!=="launcher")return;let i=!1;return j(!0),ie(n).then(t=>{i||E(t)}).catch(t=>{i||$(t instanceof Error?t.message:String(t))}).finally(()=>{i||j(!1)}),()=>{i=!0}},[n,c]),o.useEffect(()=>{if(c!=="status")return;let i=!1;const t=async()=>{try{const d=await k();i||w(d)}catch(d){i||I(d instanceof Error?d.message:String(d))}finally{i||R(!1)}};t();const r=setInterval(t,5e3);return()=>{i=!0,clearInterval(r)}},[c]);const g=async i=>{if(y){z(!0),C(null);try{await i(y),w(await k())}catch(t){C(t instanceof Error?t.message:String(t))}finally{z(!1)}}},O=()=>g(ne),W=()=>g(ae),M=()=>g(re),L=()=>{u(null),B("live_class")};if(c==="status"){if(T)return e.jsx("div",{className:"bg-white border border-slate-200/80 rounded-2xl p-5 shadow-sm h-24 animate-pulse"});if(P||h.length===0)return null;const i=h.find(t=>t.id===y)||null;return e.jsxs("div",{className:"bg-white border border-slate-200/80 rounded-2xl p-5 shadow-sm",children:[e.jsxs("div",{className:"flex items-center justify-between mb-3",children:[e.jsxs("div",{className:"flex items-center gap-2 text-slate-800 font-extrabold",children:[e.jsx("span",{children:"🧩"}),e.jsx("span",{children:s==="zh"?"进行中的活动":"Activities in Progress"})]}),e.jsx("span",{className:"text-xs font-bold bg-indigo-50 text-indigo-700 px-2 py-0.5 rounded-full",children:h.length})]}),e.jsx("div",{className:"flex flex-col gap-2",children:h.map(t=>{const r=t.state==="running";return e.jsxs("button",{onClick:()=>u(t.id),className:"w-full flex items-center gap-3 text-left bg-slate-50 hover:bg-slate-100 border border-slate-200/70 rounded-xl p-3 transition-colors",children:[e.jsx(le,{name:t.icon,className:"text-indigo-600 shrink-0"}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("div",{className:"font-bold text-slate-800 truncate",children:t.name}),t.category&&e.jsx("div",{className:"text-xs text-slate-500 truncate",children:t.category})]}),e.jsxs("div",{className:"flex flex-col items-end gap-1 shrink-0",children:[e.jsx("span",{className:`text-xs font-bold px-2 py-0.5 rounded-full ${r?"bg-emerald-100 text-emerald-700":"bg-amber-100 text-amber-700"}`,children:r?s==="zh"?"进行中":"Running":s==="zh"?"已暂停":"Paused"}),e.jsxs("span",{className:"text-xs text-slate-400 flex items-center gap-1",children:[e.jsx(D,{size:10})," ",de(t.startedAt,s)]})]})]},t.id)})}),i&&e.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/30 p-4",onClick:()=>u(null),children:e.jsxs("div",{className:"bg-white rounded-2xl shadow-xl w-full max-w-sm p-5",onClick:t=>t.stopPropagation(),children:[e.jsxs("div",{className:"flex items-center justify-between mb-3",children:[e.jsx("h3",{className:"font-bold text-slate-800",children:i.name}),e.jsx("button",{onClick:()=>u(null),className:"text-slate-400 hover:text-slate-600","aria-label":"close",children:e.jsx(_,{size:18})})]}),e.jsxs("div",{className:"text-sm text-slate-500 mb-1",children:[s==="zh"?"状态":"Status",":"," ",i.state==="running"?s==="zh"?"进行中":"Running":s==="zh"?"已暂停":"Paused"]}),e.jsxs("div",{className:"text-sm text-slate-500 mb-4",children:[s==="zh"?"开始时间":"Started",":"," ",i.startedAt?new Date(i.startedAt).toLocaleString():"-"]}),S&&e.jsx("div",{className:"text-xs text-rose-600 mb-2",children:S}),e.jsxs("div",{className:"flex gap-2",children:[i.state==="running"?e.jsxs("button",{disabled:f,onClick:W,className:"flex-1 flex items-center justify-center gap-1 bg-amber-500 hover:bg-amber-600 disabled:opacity-60 text-white rounded-lg py-2 text-sm font-bold",children:[e.jsx(H,{size:14})," ",s==="zh"?"暂停":"Pause"]}):e.jsxs("button",{disabled:f,onClick:M,className:"flex-1 flex items-center justify-center gap-1 bg-indigo-500 hover:bg-indigo-600 disabled:opacity-60 text-white rounded-lg py-2 text-sm font-bold",children:[e.jsx(J,{size:14})," ",s==="zh"?"恢复":"Resume"]}),e.jsx("button",{disabled:f,onClick:O,className:"flex-1 flex items-center justify-center gap-1 bg-rose-600 hover:bg-rose-700 disabled:opacity-60 text-white rounded-lg py-2 text-sm font-bold",children:f?s==="zh"?"处理中…":"Working…":s==="zh"?"结束":"End"})]}),e.jsx("button",{onClick:L,className:"w-full mt-2 bg-slate-100 hover:bg-slate-200 text-slate-700 rounded-lg py-2 text-sm font-bold",children:s==="zh"?"进入课堂":"Enter Classroom"})]})})]})}const U=async i=>{m(t=>({...t,[i.id]:s==="zh"?"启动中…":"Starting…"}));try{const t=await oe(i.id,{classroomId:l,role:n},a);m(r=>({...r,[i.id]:t.dispatched?s==="zh"?"已启动 ✓":"Started ✓":s==="zh"?"已通知 ✓":"Notified ✓"}))}catch(t){m(r=>({...r,[i.id]:t instanceof Error?t.message:String(t)}))}};if(A)return e.jsx("div",{style:x,children:s==="zh"?"加载活动中…":"Loading activities…"});if(v)return e.jsxs("div",{style:x,children:[e.jsxs("div",{style:{fontWeight:600,marginBottom:6},children:["🧩 ",s==="zh"?"活动中心":"Activity Center"]}),e.jsx("div",{style:{opacity:.7},children:v})]});const N=n==="teacher"?s==="zh"?"活动中心(教师)":"Activity Center":s==="zh"?"活动(学生)":"Activities";return p.length===0?e.jsxs("div",{style:x,children:[e.jsxs("div",{style:{fontWeight:600,marginBottom:6},children:["🧩 ",N]}),e.jsx("div",{style:{opacity:.7},children:s==="zh"?"暂无可用活动。":"No activities available."})]}):e.jsxs("div",{style:x,children:[e.jsxs("div",{style:{fontWeight:600,marginBottom:8},children:["🧩 ",N]}),F.map(([i,t])=>e.jsxs("div",{style:{marginBottom:10},children:[e.jsx("div",{style:{opacity:.6,fontSize:12,textTransform:"uppercase",marginBottom:4},children:i}),e.jsx("div",{style:{display:"flex",flexWrap:"wrap",gap:8},children:t.map(r=>e.jsxs("div",{style:{border:"1px solid #334155",borderRadius:8,padding:"8px 10px",minWidth:150,background:"#0f172a"},children:[e.jsxs("div",{style:{fontWeight:600},children:[r.icon?`${r.icon} `:"▫️ ",r.name]}),r.description&&e.jsx("div",{style:{opacity:.7,fontSize:12,margin:"2px 0 6px"},children:r.description}),e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6},children:[e.jsx("button",{onClick:()=>U(r),style:{cursor:"pointer",background:n==="teacher"?"#2563eb":"#0ea5e9",color:"#fff",border:"none",borderRadius:6,padding:"4px 10px",fontSize:12},children:n==="teacher"?s==="zh"?"启动":"Start":s==="zh"?"参与":"Open"}),b[r.id]&&e.jsx("span",{style:{fontSize:12,opacity:.85},children:b[r.id]})]}),e.jsx("div",{style:{opacity:.5,fontSize:12,marginTop:4},children:r.provider==="official"?"official":r.provider})]},r.id))})]},i))]})};export{je as ActivityWorkspaceWidget};
@@ -0,0 +1,5 @@
1
+ import{r,j as e}from"./vendor-react-CZ1I7IcM.js";import{am as D,c as F,ah as v,o as Ie,O as is,K as os,T as je,w as ns,a8 as _e,S as Y,e as ls,U as X,bt as ds,bK as Z,Z as cs,b7 as xs,ag as fe,P as ms,a5 as ee,al as hs,a7 as ps,bo as Re,q as Me,ao as bs,aA as gs,X as ye,br as us,aW as fs,b as ys}from"./vendor-icons-CyfamhaC.js";import{E as se,a as js}from"./index-B6wtREUD.js";import"./vendor-utils-B6R8dnOe.js";import"./vendor-pptx-D4btWy5L.js";import"./vendor-pdf-D0UGJOgo.js";import"./vendor-motion-BFAPOs-b.js";import"./vendor-charts-DGsG2RUv.js";const Ns=[{key:"lesson",zh:"课程",en:"Lessons"},{key:"class",zh:"班级",en:"Classes"},{key:"student",zh:"学生",en:"Students"},{key:"class_student",zh:"班级关系",en:"Enrollments"},{key:"schedule",zh:"课表",en:"Schedules"},{key:"user",zh:"账号",en:"Accounts"}];function vs({lang:o}){const[x,s]=r.useState(null),[T,f]=r.useState(!1),[C,y]=r.useState(!1),[j,b]=r.useState(!1),[P,m]=r.useState(null),q=async c=>{const n=await c.json().catch(()=>({}));return n&&n.success?n.result:null},te=async c=>{const n=await c.json().catch(()=>({}));return{result:n&&n.success?n.result:null,message:n?.message}},w=r.useCallback(async()=>{try{f(!0);const c=await fetch("/api/demo-data/status");if(c.ok){const n=await q(c);n&&s(n)}}catch(c){console.error("Failed to fetch demo data status",c)}finally{f(!1)}},[]);r.useEffect(()=>{w()},[w]);const p=!!(x&&(x.seeded||x.total>0)),U=async()=>{try{y(!0),m(null);const c=await fetch(`/api/demo-data/seed${p?"?reset=true":""}`,{method:"POST"}),n=await q(c);c.ok&&n?(s(n),m({type:"success",text:o==="zh"?"演示数据已就绪,可用下方演示教师账号登录体验。":"Demo data is ready. Log in with the demo teacher account below."})):m({type:"error",text:o==="zh"?"初始化演示数据失败,请稍后重试。":"Failed to seed demo data, please retry."})}catch(c){m({type:"error",text:o==="zh"?`初始化失败:${c.message||"网络异常"}`:`Seed failed: ${c.message||"Network error"}`})}finally{y(!1)}},B=async()=>{if(confirm(o==="zh"?`确定要清理演示数据吗?
2
+
3
+ 只删除演示数据(演示教师、演示课程/班级/学生/课表),系统本身的数据不受影响,管理员账号不会被删除。`:`Purge demo data?
4
+
5
+ Only demo records (demo teacher, demo lesson/class/student/schedule) are removed. Your own data and administrator accounts are never touched.`))try{b(!0),m(null);const n=await fetch("/api/demo-data/cleanup",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({confirm:"PURGE_DEMO_DATA"})}),{result:u,message:R}=await te(n);if(n.ok&&u){s(u.after?u.after:null),u.after||await w();const k=u.report?.totalRemoved,M=k===void 0?"":o==="zh"?`已清理 ${k} 条演示数据。`:`Removed ${k} demo records.`;m({type:"success",text:R||M})}else m({type:"error",text:o==="zh"?"清理演示数据失败,请稍后重试。":"Failed to purge demo data, please retry."})}catch(n){m({type:"error",text:o==="zh"?`清理失败:${n.message||"网络异常"}`:`Purge failed: ${n.message||"Network error"}`})}finally{b(!1)}},I=(c=>{if(!c)return null;const n=new Date(c);return Number.isNaN(n.getTime())?null:n.toLocaleString(o==="zh"?"zh-CN":"en-US",{hour12:!1})})(x?.seededAt),g=C||j;return e.jsx("div",{className:"mt-5",children:e.jsxs("div",{className:"bg-white border border-gray-200 rounded-xl shadow-3xs overflow-hidden",children:[e.jsxs("div",{className:"p-4 sm:p-5 border-b border-gray-100 flex items-center justify-between bg-gray-50/60",children:[e.jsxs("div",{children:[e.jsxs("h3",{className:"font-bold text-gray-800 flex items-center gap-2 text-sm sm:text-base",children:[e.jsx(D,{size:18,className:"text-indigo-600"}),o==="zh"?"演示数据(Demo)":"Demo Data"]}),e.jsx("p",{className:"text-xs text-gray-400 mt-0.5",children:o==="zh"?"一键生成一套完整的演示课程 / 班级 / 学生 / 课表,便于快速体验与验收;清理时不影响系统本身的数据。":"One-click generation of a full demo lesson / class / student / schedule set for quick evaluation. Purging never touches real data."})]}),e.jsx("button",{type:"button",onClick:w,disabled:T||g,title:o==="zh"?"刷新状态":"Refresh status",className:"p-2 text-gray-400 hover:text-indigo-600 hover:bg-indigo-50 rounded-lg transition-all cursor-pointer disabled:opacity-50 shrink-0",children:T?e.jsx(F,{size:15,className:"animate-spin"}):e.jsx(v,{size:15})})]}),e.jsxs("div",{className:"p-4 sm:p-5 space-y-5 text-left",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.jsxs("span",{className:`inline-flex items-center gap-1.5 px-2.5 py-1 rounded-lg text-xs font-bold border ${p?"bg-emerald-50 text-emerald-700 border-emerald-100":"bg-gray-50 text-gray-500 border-gray-200"}`,children:[p?e.jsx(Ie,{size:13}):e.jsx(D,{size:13}),p?o==="zh"?"已播种演示数据":"Demo data seeded":o==="zh"?"尚未播种演示数据":"No demo data yet"]}),I&&e.jsxs("span",{className:"inline-flex items-center gap-1.5 px-2.5 py-1 rounded-lg text-xs font-semibold bg-gray-50 text-gray-500 border border-gray-200",children:[e.jsx(is,{size:13}),o==="zh"?`播种时间:${I}`:`Seeded at ${I}`]}),e.jsx("span",{className:"inline-flex items-center gap-1.5 px-2.5 py-1 rounded-lg text-xs font-semibold bg-gray-50 text-gray-500 border border-gray-200",children:o==="zh"?`合计 ${x?.total??0} 条`:`${x?.total??0} records total`})]}),x?.counts&&e.jsx("div",{className:"grid grid-cols-2 sm:grid-cols-3 gap-2",children:Ns.map(c=>e.jsxs("div",{className:"flex items-center justify-between gap-2 px-2.5 py-2 rounded-lg border border-gray-200 bg-gray-50/60",children:[e.jsx("span",{className:"text-xs text-gray-500",children:o==="zh"?c.zh:c.en}),e.jsx("span",{className:"text-xs font-bold text-gray-700 font-mono",children:x.counts[c.key]??0})]},c.key))})]}),x?.credentials&&e.jsxs("div",{className:"rounded-lg border border-amber-100 bg-amber-50/60 px-3 py-2.5 space-y-1.5",children:[e.jsxs("div",{className:"flex items-center gap-1.5 text-xs font-bold text-amber-700",children:[e.jsx(os,{size:13}),o==="zh"?"演示教师账号(可用于登录体验)":"Demo teacher account (for sign-in testing)"]}),e.jsxs("div",{className:"flex flex-wrap items-center gap-x-4 gap-y-1 text-xs text-amber-800",children:[e.jsxs("span",{children:[o==="zh"?"姓名":"Name",":"," ",e.jsx("span",{className:"font-semibold",children:x.credentials.name})]}),e.jsxs("span",{children:[o==="zh"?"用户名":"Username",":"," ",e.jsx("span",{className:"font-mono font-bold",children:x.credentials.username})]}),e.jsxs("span",{children:[o==="zh"?"密码":"Password",":"," ",e.jsx("span",{className:"font-mono font-bold",children:x.credentials.password})]})]})]}),P&&e.jsxs("div",{className:`flex items-start gap-2 px-3 py-2.5 rounded-lg text-xs font-semibold border ${P.type==="success"?"bg-emerald-50 text-emerald-700 border-emerald-100":"bg-rose-50 text-rose-700 border-rose-100"}`,children:[P.type==="success"?e.jsx(Ie,{size:14,className:"shrink-0 mt-px"}):e.jsx(je,{size:14,className:"shrink-0 mt-px"}),e.jsx("span",{className:"whitespace-pre-line",children:P.text})]}),e.jsxs("div",{className:"flex flex-wrap items-center gap-3 pt-2 border-t border-gray-100",children:[e.jsxs("button",{type:"button",onClick:U,disabled:g,className:"px-4 py-2 text-xs font-bold text-white bg-indigo-600 hover:bg-indigo-700 disabled:opacity-50 rounded-lg shadow-sm transition-all cursor-pointer flex items-center gap-1.5",children:[C?e.jsx(F,{size:13,className:"animate-spin"}):p?e.jsx(v,{size:14}):e.jsx(ns,{size:14}),e.jsx("span",{children:C?o==="zh"?"处理中...":"Working...":p?o==="zh"?"重置并重新初始化":"Reset & Re-seed Demo Data":o==="zh"?"一键初始化演示数据":"Seed Demo Data"})]}),e.jsxs("button",{type:"button",onClick:B,disabled:g||!p,className:"px-4 py-2 text-xs font-bold text-white bg-rose-600 hover:bg-rose-700 disabled:opacity-50 disabled:cursor-not-allowed rounded-lg shadow-sm transition-all cursor-pointer flex items-center gap-1.5",children:[j?e.jsx(F,{size:13,className:"animate-spin"}):e.jsx(_e,{size:14}),e.jsx("span",{children:j?o==="zh"?"清理中...":"Purging...":o==="zh"?"一键清理演示数据":"Purge Demo Data"})]}),!p&&e.jsx("span",{className:"text-xs text-gray-400",children:o==="zh"?"清理前需先初始化演示数据。":"Seed demo data before purging."})]})]})]})})}function ws({currentUserId:o,currentUserRole:x,lang:s,onLogout:T,aiProviders:f,testingProviderId:C,onAIProvidersChanged:y,onTriggerTour:j,siteInfo:b,onSiteInfoChanged:P}){const[m,q]=r.useState([]),[te,w]=r.useState(!1),[p,U]=r.useState(""),[B,z]=r.useState(""),[I,g]=r.useState(!1),[c,n]=r.useState(null),[u,R]=r.useState(""),[k,M]=r.useState(""),[Ne,ae]=r.useState(""),[re,ie]=r.useState(""),[oe,ve]=r.useState(!1),[we,ze]=r.useState(b?.siteName||""),[ke,Se]=r.useState(b?.slogan||""),[zs,Q]=r.useState(b?.logoUrl||null),[L,K]=r.useState(b?.logoUrl||""),[ne,Ae]=r.useState(!1),[Ce,$e]=r.useState(!1),[V,Pe]=r.useState(""),[le,Ee]=r.useState("all"),[Oe,_]=r.useState(!1),[S,Le]=r.useState(null),[de,ce]=r.useState(""),[xe,me]=r.useState(""),[he,pe]=r.useState(""),[be,G]=r.useState("teacher"),[ge,H]=r.useState("active"),[De,A]=r.useState(""),[ue,Te]=r.useState(!1),[ks,Ss]=r.useState({tables:14,sizeKb:256,pingMs:2}),[Fe,qe]=r.useState(14),[Be,Qe]=r.useState(0),[h,$]=r.useState("directory"),[i,Ke]=r.useState(null),[E,Ue]=r.useState(!1),J=async()=>{try{Ue(!0);const t=await fetch("/api/db-status");if(t.ok){const a=await t.json();Ke(a)}}catch(t){console.error("Failed to query SQLite stats",t)}finally{Ue(!1)}},Ve=()=>{n(null),R(""),M(""),ae(""),ie(""),g(!0)},Ge=t=>{n(t),R(t.name),M(t.api_url),ae(t.api_key||""),ie(t.model_name),g(!0)},He=async t=>{if(t.preventDefault(),!u.trim()||!k.trim()||!re.trim()){alert(s==="zh"?"名称、API URL 和模型名称不可为空":"Name, API URL and Model Name are required.");return}try{ve(!0);const a=!!c,l=a?`/api/ai-providers/${c.id}`:"/api/ai-providers",N=await fetch(l,{method:a?"PUT":"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:u.trim(),api_url:k.trim(),api_key:Ne,model_name:re.trim()})});if(N.ok)g(!1),n(null),y();else{const rs=await N.json().catch(()=>({}));alert(rs.error||"Server error")}}catch(a){alert(a.message||"Error")}finally{ve(!1)}},Je=async(t,a)=>{if(confirm(s==="zh"?`确认要删除 AI 提供商 [${a}] 吗?`:`Confirm deleting AI Provider [${a}]?`))try{(await fetch(`/api/ai-providers/${t}`,{method:"DELETE"})).ok?y():alert("Delete failed")}catch(l){alert(l.message||"Error")}},We=async t=>{try{const a=await fetch("/api/ai-providers/test",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({api_url:t.api_url,api_key:t.api_key,model_name:t.model_name})});if(a.ok)alert(s==="zh"?`[${t.name}] 连接测试成功!`:`[${t.name}] Connection test successful!`);else{const l=await a.json().catch(()=>({}));alert(s==="zh"?`测试失败: ${l.error||"未知错误"}`:`Test failed: ${l.error||"Unknown error"}`)}}catch(a){alert(s==="zh"?`网络异常: ${a.message}`:`Network error: ${a.message}`)}},Ye=async()=>{try{const t=await fetch("/api/site-settings");if(t.ok){const a=await t.json();ze(a.siteName||""),Se(a.slogan||""),Q(a.logoUrl||null),K(a.logoUrl||""),$e(!0)}}catch(t){console.error("Failed to fetch site settings",t)}},Xe=t=>{if(!t)return;const a=new FileReader;a.onload=()=>{const l=a.result;Q(l),K(l)},a.readAsDataURL(t)},Ze=async t=>{t.preventDefault();try{Ae(!0);const a=L&&L.trim()?L.trim():null,l=await fetch("/api/site-settings",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({siteName:we.trim(),slogan:ke.trim(),logoUrl:a})});if(l.ok){const d=await l.json();Q(a),P?.(d.siteInfo),z(s==="zh"?"站点信息已保存!":"Site settings saved successfully!"),setTimeout(()=>z(""),4e3)}else{const d=await l.json().catch(()=>({}));alert(d.error||"Server error")}}catch(a){alert(a.message||"Error")}finally{Ae(!1)}},W=async()=>{try{w(!0),U("");const t=await fetch("/api/users");if(t.ok){const a=await t.json();q(a)}else U(s==="zh"?"加载用户账户失败":"Failed to fetch staff directory")}catch{U(s==="zh"?"网络连接异常":"Network communication issue")}finally{w(!1)}};r.useEffect(()=>{W(),J(),y();const t=setInterval(()=>{J(),qe(a=>{const l=Math.floor(Math.random()*9)-4,d=a+l;return Math.min(Math.max(d,5),35)})},5e3);return()=>clearInterval(t)},[Be]),r.useEffect(()=>{h==="site_settings"&&!Ce&&Ye()},[h,Ce]);const es=()=>{Le(null),ce(""),me(""),pe(""),G("teacher"),H("active"),A(""),_(!0)},ss=t=>{Le(t.id),ce(t.username),me(""),pe(t.name),G(t.role),H(t.status||"active"),A(""),_(!0)},ts=async t=>{if(t.preventDefault(),!de.trim()||!he.trim()){A(s==="zh"?"请填写所有必填字段。":"Please provide all key info.");return}if(!S&&!xe){A(s==="zh"?"新建账户时密码必填。":"Password is required for new accounts.");return}try{A(""),Te(!0);const a=S?`/api/users/${S}`:"/api/users",d=await fetch(a,{method:S?"PUT":"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({username:de.trim(),password:xe||void 0,role:be,name:he.trim(),status:ge})});if(d.ok)z(s==="zh"?"账户信息保存成功!":"Staff account saved successfully!"),W(),_(!1),setTimeout(()=>z(""),4e3);else{const N=await d.json();A(N.error||"Server validation failed")}}catch(a){A(a.message||"API error")}finally{Te(!1)}},as=async(t,a)=>{if(t===o){alert(s==="zh"?"你不能删除你自己当前登录的账户。":"You cannot delete your own logged-in account.");return}const l=s==="zh"?`确定要删除教师账户 "${a}" 吗?此操作不可逆。`:`Confirm deleting staff user "${a}"? This action is irreversible.`;if(confirm(l))try{const d=await fetch(`/api/users/${t}`,{method:"DELETE"});if(d.ok)z(s==="zh"?"账户删除成功":"Account deleted successfully"),W(),setTimeout(()=>z(""),3e3);else{const N=await d.json();alert(N.error||"Failed to delete")}}catch(d){console.error(d)}},O=m.filter(t=>{const a=t.name.toLowerCase().includes(V.toLowerCase())||t.username.toLowerCase().includes(V.toLowerCase()),l=le==="all"||t.role===le;return a&&l});return e.jsxs("div",{className:"flex-1 bg-white border border-gray-200 rounded-xl shadow-sm flex flex-col min-h-0 overflow-hidden h-full",id:"admin_panel_root",children:[e.jsxs("div",{className:"px-6 py-4 border-b border-gray-100 flex flex-col sm:flex-row sm:items-center justify-between gap-3 bg-white shrink-0",children:[e.jsxs("div",{children:[e.jsxs("h2",{className:"text-base sm:text-lg font-bold text-gray-800 flex items-center gap-2",children:[e.jsx(Y,{className:"text-indigo-600 shrink-0",size:20}),e.jsx("span",{children:s==="zh"?"系统管理与教职后台":"Staff Directory & System Admin"}),e.jsx("span",{className:"text-xs font-semibold px-2 py-0.5 rounded-full bg-indigo-50 text-indigo-700 border border-indigo-100/80",children:x==="administrator"?s==="zh"?"超级管理员":"Admin":s==="zh"?"教师":"Teacher"})]}),e.jsx("p",{className:"text-xs text-gray-500 mt-1",children:s==="zh"?`管理学校教师、教工账户、划分角色权限。当前登录角色权限: ${x==="administrator"?"超级管理员 (系统设置已解锁)":"普通教师 (系统设置锁定)"}`:`Create and assign teacher credentials. Active role context: ${x==="administrator"?"Administrator (System parameters editable)":"Standard Teacher (Settings view-only)"}`})]}),e.jsxs("div",{className:"flex items-center gap-2 shrink-0",children:[j&&e.jsxs("button",{onClick:j,className:"flex items-center gap-1.5 px-3 py-1.5 bg-indigo-50 hover:bg-indigo-100 text-indigo-700 text-xs font-semibold rounded-lg border border-indigo-200 transition-all cursor-pointer shadow-3xs",children:[e.jsx(ls,{size:14,className:"animate-bounce"}),e.jsx("span",{children:s==="zh"?"开启新手引导":"Start Help Tour"})]}),e.jsx("button",{onClick:()=>Qe(t=>t+1),className:"p-1.5 text-gray-500 hover:text-indigo-600 hover:bg-gray-100 rounded-lg transition-all cursor-pointer border border-gray-200 shadow-3xs",title:s==="zh"?"刷新数据":"Refresh stats",children:e.jsx(v,{size:14})})]})]}),e.jsx("div",{className:"px-6 py-2.5 border-b border-gray-100 bg-gray-50/50 flex items-center justify-between gap-4 shrink-0 overflow-x-auto",children:e.jsxs("div",{className:"bg-gray-200/60 p-1 rounded-xl flex items-center gap-1 shrink-0",children:[e.jsxs("button",{onClick:()=>$("directory"),className:`px-3.5 py-1.5 text-xs font-bold rounded-lg flex items-center gap-1.5 transition-all cursor-pointer ${h==="directory"?"bg-white text-indigo-700 shadow-xs":"text-gray-500 hover:text-gray-800"}`,children:[e.jsx(X,{size:14}),e.jsx("span",{children:s==="zh"?"学校教职及系统配置":"Staff Accounts & Config"})]}),e.jsxs("button",{onClick:()=>$("ai_providers"),className:`px-3.5 py-1.5 text-xs font-bold rounded-lg flex items-center gap-1.5 transition-all cursor-pointer ${h==="ai_providers"?"bg-white text-indigo-700 shadow-xs":"text-gray-500 hover:text-gray-800"}`,children:[e.jsx(ds,{size:14}),e.jsx("span",{children:s==="zh"?"AI 模型提供商":"AI Providers"})]}),e.jsxs("button",{onClick:()=>$("sqlite"),className:`px-3.5 py-1.5 text-xs font-bold rounded-lg flex items-center gap-1.5 transition-all cursor-pointer ${h==="sqlite"?"bg-white text-indigo-700 shadow-xs":"text-gray-500 hover:text-gray-800"}`,children:[e.jsx(D,{size:14}),e.jsx("span",{children:s==="zh"?"系统监控":"System Monitor"})]}),e.jsxs("button",{onClick:()=>$("site_settings"),className:`px-3.5 py-1.5 text-xs font-bold rounded-lg flex items-center gap-1.5 transition-all cursor-pointer ${h==="site_settings"?"bg-white text-indigo-700 shadow-xs":"text-gray-500 hover:text-gray-800"}`,children:[e.jsx(Z,{size:14}),e.jsx("span",{children:s==="zh"?"站点信息设置":"Site Settings"})]}),e.jsx(se,{slot:"admin.tab",slotProps:{renderType:"button",adminActiveTab:h,setAdminActiveTab:$}})]})}),B&&e.jsxs("div",{className:"mx-6 mt-3 p-3 bg-emerald-50 border border-emerald-200 text-emerald-800 text-xs rounded-xl flex items-center gap-2 shrink-0 animate-fade-in shadow-xs font-medium",children:[e.jsx(cs,{size:15}),e.jsx("span",{children:B})]}),p&&e.jsxs("div",{className:"mx-6 mt-3 p-3 bg-rose-50 border border-rose-200 text-rose-800 text-xs rounded-xl flex items-center gap-2 shrink-0 animate-fade-in shadow-xs",children:[e.jsx(je,{size:15}),e.jsx("span",{children:p})]}),h==="ai_providers"?e.jsx("div",{className:"flex-1 overflow-y-auto p-6 space-y-6 animate-fade-in text-gray-800",children:e.jsxs("div",{className:"bg-white border border-gray-200 rounded-xl shadow-3xs overflow-hidden",children:[e.jsxs("div",{className:"p-4 sm:p-5 border-b border-gray-100 flex items-center justify-between bg-gray-50/60",children:[e.jsxs("div",{children:[e.jsxs("h3",{className:"font-bold text-gray-800 flex items-center gap-2 text-sm sm:text-base",children:[e.jsx(xs,{className:"text-indigo-600",size:18}),s==="zh"?"OpenAI 兼容 / 自定义模型 AI 提供商列表":"AI Providers List (OpenAI-Compatible)"]}),e.jsx("p",{className:"text-xs text-gray-400 mt-0.5",children:s==="zh"?"配置好的端点将可被测验生成器、讲座生成器和 AI Agent 进行热切调用。":"Configured backends accessible by Quiz Generator, Lecture Generator and AI Agent."})]}),e.jsxs("button",{onClick:Ve,className:"flex items-center gap-1.5 px-3.5 py-1.5 bg-indigo-600 hover:bg-indigo-700 text-white font-semibold rounded-lg shadow-sm transition-all text-xs cursor-pointer",children:[e.jsx(fe,{size:14}),s==="zh"?"添加 AI 提供商":"Add AI Provider"]})]}),e.jsx("div",{className:"p-4 sm:p-5",children:f.length===0?e.jsxs("div",{className:"flex flex-col items-center justify-center py-12 text-gray-400 text-center",children:[e.jsx(ms,{size:40,className:"mb-3 opacity-30 text-indigo-500"}),e.jsx("span",{className:"font-semibold text-sm",children:s==="zh"?"暂未配置任何 AI 提供商":"No AI Providers Registered"}),e.jsx("p",{className:"text-xs text-gray-400 mt-1 max-w-xs",children:s==="zh"?"点击右上角按钮新建。":"Click the button above to add one."})]}):e.jsx("div",{className:"overflow-x-auto border border-gray-100 rounded-xl",children:e.jsxs("table",{className:"w-full text-left border-collapse min-w-[700px]",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"bg-slate-50/70 border-b border-gray-100 text-gray-500 font-bold text-xs uppercase tracking-wider",children:[e.jsx("th",{className:"py-3.5 px-4",children:s==="zh"?"名称":"Name"}),e.jsx("th",{className:"py-3.5 px-4",children:s==="zh"?"API 端点 URL":"API Endpoint URL"}),e.jsx("th",{className:"py-3.5 px-4",children:s==="zh"?"模型代号":"Model Identifier"}),e.jsx("th",{className:"py-3.5 px-4",children:s==="zh"?"密钥状态":"API Key"}),e.jsx("th",{className:"py-3.5 px-4 text-center",children:s==="zh"?"操作":"Actions"})]})}),e.jsx("tbody",{className:"divide-y divide-gray-100 text-xs text-gray-700",children:f.map(t=>e.jsxs("tr",{className:"hover:bg-slate-50/50 transition-colors",children:[e.jsx("td",{className:"py-4 px-4",children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:"w-2 h-2 rounded-full bg-indigo-500"}),e.jsx("span",{className:"font-extrabold text-gray-800 text-sm",children:t.name})]})}),e.jsx("td",{className:"py-4 px-4 font-mono text-gray-550 truncate max-w-[220px]",children:t.api_url}),e.jsx("td",{className:"py-4 px-4",children:e.jsx("span",{className:"bg-slate-100 text-slate-800 font-bold px-2 py-1 rounded font-mono text-xs border border-slate-200",children:t.model_name})}),e.jsx("td",{className:"py-4 px-4",children:t.api_key?e.jsxs("span",{className:"text-emerald-600 font-bold flex items-center gap-1 font-mono",children:[e.jsx(ee,{size:12})," Key Saved"]}):e.jsx("span",{className:"text-amber-500/90 font-mono italic",children:"Not Set"})}),e.jsx("td",{className:"py-4 px-4 text-center",children:e.jsxs("div",{className:"flex items-center justify-center gap-2",children:[e.jsxs("button",{onClick:()=>We(t),className:"px-2.5 py-1 text-xs font-semibold rounded-lg border transition-all cursor-pointer flex items-center gap-1.5 shadow-3xs bg-emerald-50 border-emerald-200 text-emerald-700 hover:bg-emerald-100",title:s==="zh"?"测试连通性":"Test Connection",children:[e.jsx(hs,{size:11}),e.jsx("span",{children:s==="zh"?"测试":"Test"})]}),e.jsx("button",{onClick:()=>Ge(t),className:"px-2.5 py-1 text-indigo-700 hover:bg-indigo-100 border border-indigo-200 rounded-lg bg-indigo-50 cursor-pointer font-semibold transition-all shadow-3xs",title:s==="zh"?"编辑配置":"Edit",children:s==="zh"?"编辑":"Edit"}),e.jsx("button",{onClick:()=>Je(t.id,t.name),className:"px-2.5 py-1 text-rose-600 hover:bg-rose-100 border border-rose-200 rounded-lg bg-rose-50 cursor-pointer font-semibold transition-all shadow-3xs",title:s==="zh"?"删除":"Delete",children:s==="zh"?"删除":"Delete"})]})})]},t.id))})]})})})]})}):h==="sqlite"?e.jsxs("div",{className:"flex-1 overflow-y-auto p-6 space-y-6 animate-fade-in text-gray-800",children:[e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-4 gap-4",children:[e.jsxs("div",{className:"bg-white border border-gray-200 rounded-xl p-4 shadow-3xs flex items-center justify-between",children:[e.jsxs("div",{className:"space-y-1 text-left",children:[e.jsx("span",{className:"text-xs font-black text-slate-400 uppercase tracking-widest block",children:s==="zh"?"SQLite引擎状况":"SQLite Health Status"}),e.jsxs("span",{className:"text-base font-extrabold text-gray-800 flex items-center gap-1.5",children:[e.jsx("span",{className:"w-2.5 h-2.5 rounded-full bg-emerald-500 animate-pulse inline-block"}),e.jsx("span",{className:"text-emerald-600 font-extrabold uppercase mt-0.5",children:i?.status==="connected"?s==="zh"?"运行正常":"Healthy":s==="zh"?"连接正常":"Connected"})]}),e.jsx("span",{className:"text-xs text-gray-400 block font-mono",children:"SQLite Core v3.x Connected"})]}),e.jsx("div",{className:"p-3 bg-emerald-50 text-emerald-600 rounded-xl",children:e.jsx(Y,{size:20})})]}),e.jsxs("div",{className:"bg-white border border-gray-200 rounded-xl p-4 shadow-3xs flex items-center justify-between",children:[e.jsxs("div",{className:"space-y-1 text-left",children:[e.jsx("span",{className:"text-xs font-black text-slate-400 uppercase tracking-widest block",children:s==="zh"?"核心实体数据表":"Database Table Count"}),e.jsx("span",{className:"text-xl font-black font-mono text-gray-800 block",children:i?.tableCount??"--"}),e.jsx("span",{className:"text-xs text-gray-400 block",children:s==="zh"?`包含其外 ${i?.systemTableCount??0} 个系统表`:`Plus ${i?.systemTableCount??0} system catalogs`})]}),e.jsx("div",{className:"p-3 bg-indigo-50 text-indigo-600 rounded-xl",children:e.jsx(D,{size:20})})]}),e.jsxs("div",{className:"bg-white border border-gray-200 rounded-xl p-4 shadow-3xs flex items-center justify-between",children:[e.jsxs("div",{className:"space-y-1 text-left",children:[e.jsx("span",{className:"text-xs font-black text-slate-400 uppercase tracking-widest block",children:s==="zh"?"系统数据承载行":"Total Records Managed"}),e.jsx("span",{className:"text-xl font-black font-mono text-indigo-700 block",children:i?.totalRows!==void 0?i.totalRows.toLocaleString():"--"}),e.jsx("span",{className:"text-xs text-gray-400 block",children:s==="zh"?"在册全量索引行数总和":"Cumulative dataset depth"})]}),e.jsx("div",{className:"p-3 bg-indigo-50 text-indigo-600 rounded-xl",children:e.jsx(ps,{size:20})})]}),e.jsxs("div",{className:"bg-white border border-gray-200 rounded-xl p-4 shadow-3xs flex items-center justify-between",children:[e.jsxs("div",{className:"space-y-1 text-left",children:[e.jsx("span",{className:"text-xs font-black text-slate-400 uppercase tracking-widest block",children:s==="zh"?"物理文件占用空间":"Physical Disk Usage"}),e.jsx("span",{className:"text-xl font-black font-mono text-emerald-600 block",children:i?.diskUsageFriendly??"--"}),e.jsx("span",{className:"text-xs text-gray-400 block font-mono",children:i?.diskUsageBytes?`${i.diskUsageBytes.toLocaleString()} Bytes`:""})]}),e.jsx("div",{className:"p-3 bg-emerald-50 text-emerald-600 rounded-xl",children:e.jsx(Re,{size:20})})]}),e.jsx(se,{slot:"admin.dashboard.card",slotProps:{sqliteStats:i,lang:s}})]}),e.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-12 gap-6 items-start",children:[e.jsxs("div",{className:"lg:col-span-8 bg-white border border-gray-200 rounded-xl shadow-3xs overflow-hidden flex flex-col",children:[e.jsxs("div",{className:"p-4 sm:p-5 border-b border-gray-100 bg-gray-50/60 flex items-center justify-between",children:[e.jsxs("div",{className:"text-left",children:[e.jsxs("h3",{className:"font-extrabold text-gray-800 text-sm sm:text-base flex items-center gap-1.5 justify-start",children:[e.jsx(D,{className:"text-indigo-600",size:18}),s==="zh"?"SQLite 数据库实体列表与行数字典":"SQLite Relational Entity Tables Catalog"]}),e.jsx("p",{className:"text-xs text-gray-400 mt-1 block",children:s==="zh"?"实时展示当前在 educational_os.db 内核中的关系型实体及在册记录行数。":"Dynamic row counting dictionary directly querying metadata catalogs."})]}),e.jsxs("button",{onClick:J,disabled:E,className:"p-1 px-3 text-xs bg-indigo-50 hover:bg-indigo-100 text-indigo-700 font-bold border border-indigo-200/45 rounded-xl flex items-center gap-1 transition-all cursor-pointer",children:[e.jsx(v,{size:11,className:E?"animate-spin":""}),s==="zh"?"重算/刷新 font":"Refresh Metrics"]})]}),e.jsx("div",{className:"p-4 sm:p-5",children:E&&!i?e.jsxs("div",{className:"flex flex-col items-center justify-center py-12 text-slate-400 text-xs",children:[e.jsx(v,{size:36,className:"animate-spin text-indigo-500 mb-2"}),e.jsx("span",{children:s==="zh"?"正在重算数据库实体表统计指标...":"Calculating database page allocation and statistics..."})]}):i?e.jsx("div",{className:"overflow-x-auto border border-gray-100 rounded-xl",children:e.jsxs("table",{className:"w-full text-left border-collapse min-w-[500px]",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"bg-slate-50/70 border-b border-gray-100 text-gray-500 font-bold text-xs uppercase tracking-wider font-sans",children:[e.jsx("th",{className:"py-3 px-4",children:s==="zh"?"实体数据表名":"Table Name"}),e.jsx("th",{className:"py-3 px-4",children:s==="zh"?"当前承载行数":"Active Rows"}),e.jsx("th",{className:"py-3 px-4",children:s==="zh"?"行数比例分布":"Distribution Scale"}),e.jsx("th",{className:"py-3 px-4 font-mono select-none",children:s==="zh"?"系统属性类型":"Metadata Type"})]})}),e.jsx("tbody",{className:"divide-y divide-gray-100 text-xs text-gray-700 font-sans",children:i.tables.map(t=>{const a=Math.max(...i.tables.map(N=>N.rows),1),l=Math.min(t.rows/a*100,100);let d="Core Application Storage";return t.name==="users"?d="Teacher & Administrator profiles":t.name==="students"?d="Student accounts and lock states":t.name==="classes"?d="Active classes, metadata & codes":t.name==="lessons"?d="Lectures, slides and markdown modules":t.name==="ai_providers"?d="Third party API key provider gateways":t.name==="vfs_nodes"?d="Virtual file storage hierarchies":t.name==="client_sessions"&&(d="Active browser auth cookies"),e.jsxs("tr",{className:"hover:bg-slate-50/40 transition-colors",children:[e.jsxs("td",{className:"py-3 px-4 text-left",children:[e.jsxs("div",{className:"flex items-center gap-2 justify-start",children:[e.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-indigo-500"}),e.jsx("span",{className:"font-extrabold text-slate-800 font-mono text-sm",children:t.name})]}),e.jsx("span",{className:"text-xs text-gray-400 block mt-0.5",children:d})]}),e.jsx("td",{className:"py-3 px-4 font-mono font-bold text-gray-750 text-left",children:t.rows>=0?t.rows.toLocaleString():e.jsx("span",{className:"text-rose-500 italic font-normal",children:"error"})}),e.jsx("td",{className:"py-3 px-4 min-w-[150px]",children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:"w-24 bg-gray-100 rounded-full h-1.5 overflow-hidden border border-gray-200/50 shrink-0",children:e.jsx("div",{className:"bg-indigo-600 h-1.5 rounded-full",style:{width:`${l}%`}})}),e.jsxs("span",{className:"text-xs font-mono font-bold text-slate-400",children:[Math.round(l),"%"]})]})}),e.jsx("td",{className:"py-3 px-4 text-left",children:e.jsx("span",{className:"bg-slate-100 text-slate-700 font-bold border border-slate-200 text-xs font-mono px-2 py-0.5 rounded uppercase",children:t.name==="vfs_nodes"||t.name==="whiteboard_strokes"?"BLOB_JSON":"RELATIONAL"})})]},t.name)})})]})}):e.jsx("div",{className:"text-center text-xs py-12 text-slate-400",children:s==="zh"?"无法提取到 SQLite 信息,可能进程被独占。":"Failed to retrieve connection parameters."})})]}),e.jsxs("div",{className:"lg:col-span-4 space-y-6",children:[e.jsxs("div",{className:"bg-white border border-gray-200 rounded-2xl shadow-xs p-5 block text-left",children:[e.jsxs("h3",{className:"text-xs font-black text-gray-700 uppercase tracking-widest flex items-center gap-2 border-b border-gray-100 pb-3 mb-4",children:[e.jsx(Z,{size:15,className:"text-slate-500"}),s==="zh"?"物理控制参数 (PRAGMA)":"SQLite Physical PRAGMAs"]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center justify-between py-1.5 border-b border-gray-100",children:[e.jsxs("div",{className:"text-left",children:[e.jsx("span",{className:"text-xs font-extrabold text-gray-800 block",children:s==="zh"?"日志记录模式":"Journal Write Mode"}),e.jsx("span",{className:"text-xs text-gray-400 block",children:s==="zh"?"决定写操作事务隔离行为":"Active database write transaction protocol"})]}),e.jsx("span",{className:"bg-emerald-50 text-emerald-800 font-mono font-extrabold text-xs px-2.5 py-1 border border-emerald-200 rounded-lg",children:i?.journalMode?i.journalMode.toUpperCase():"N/A"})]}),e.jsxs("div",{className:"flex items-center justify-between py-1.5 border-b border-gray-100",children:[e.jsxs("div",{className:"text-left",children:[e.jsx("span",{className:"text-xs font-extrabold text-gray-800 block",children:s==="zh"?"物理扇区页面大小":"Database Page Size"}),e.jsx("span",{className:"text-xs text-gray-400 block",children:s==="zh"?"单次读写磁盘扇区的字节":"Bytes per allocated physical sector block"})]}),e.jsx("span",{className:"bg-slate-100 text-slate-800 font-mono font-bold text-xs px-2 py-1 border border-slate-200 rounded",children:i?.pageSize?`${i.pageSize} B`:"4096 B"})]}),e.jsxs("div",{className:"flex items-center justify-between py-1.5 border-b border-gray-100",children:[e.jsxs("div",{className:"text-left",children:[e.jsx("span",{className:"text-xs font-extrabold text-gray-800 block",children:s==="zh"?"逻辑数据页面总数":"Allocated Blocks Count"}),e.jsx("span",{className:"text-xs text-gray-400 block",children:s==="zh"?"物理文件包含的逻辑存储页总数":"Total blocks assigned inside database space"})]}),e.jsxs("span",{className:"font-mono text-xs font-bold text-gray-700",children:[i?.pageCount??0," pages"]})]}),e.jsxs("div",{className:"flex items-center justify-between py-1.5 border-b border-gray-100",children:[e.jsxs("div",{className:"text-left",children:[e.jsx("span",{className:"text-xs font-extrabold text-gray-800 block",children:s==="zh"?"数据文件完整性自检":"Database File Integrity"}),e.jsx("span",{className:"text-xs text-gray-400 block",children:s==="zh"?"校验物理页面结构是否损坏":"Validates internal database consistency"})]}),e.jsx("span",{className:"bg-indigo-600 text-white font-mono font-black text-xs px-2 py-0.5 rounded-full shadow-xs",children:i?.integrity?i.integrity.toUpperCase():"PASS"})]}),e.jsxs("div",{className:"flex items-center justify-between py-1.5 border-b border-gray-100",children:[e.jsxs("div",{className:"text-left",children:[e.jsx("span",{className:"text-xs font-extrabold text-gray-800 block",children:s==="zh"?"空闲可回收空间块数":"Freelist Empty Pages"}),e.jsx("span",{className:"text-xs text-gray-400 block",children:s==="zh"?"已被清删但未回缩的空间块数":"Reclaimable blocks pending database VACUUM"})]}),e.jsxs("span",{className:"font-mono text-xs text-gray-750",children:[i?.freelistCount??0," Blocks"]})]}),e.jsxs("div",{className:"flex items-center justify-between py-1.5",children:[e.jsxs("div",{className:"text-left",children:[e.jsx("span",{className:"text-xs font-extrabold text-gray-800 block",children:s==="zh"?"自动空间释放 (Auto Vacuum)":"Auto Vacuum Mode"}),e.jsx("span",{className:"text-xs text-gray-400 block",children:s==="zh"?"删除数据是否即时整理碎片":"Reclaims file blocks upon record deletions"})]}),e.jsx("span",{className:"text-xs text-slate-500 font-bold",children:i?.autoVacuum===0?"NONE (OFF)":i?.autoVacuum===1?"FULL":"INCREMENTAL"})]})]})]}),e.jsxs("div",{className:"bg-white border border-gray-200 rounded-2xl shadow-xs p-5 block text-left text-gray-800",children:[e.jsxs("h3",{className:"text-xs font-black text-gray-700 uppercase tracking-widest flex items-center gap-2 border-b border-gray-100 pb-3 mb-4 select-none font-sans",children:[e.jsx(Me,{size:14,className:"text-indigo-600 animate-pulse"}),s==="zh"?"分布式内核维护工具箱":"In-Memory Engine Toolbox"]}),e.jsxs("div",{className:"space-y-3",children:[e.jsxs("button",{onClick:async()=>{alert(s==="zh"?"PRAGMA integrity_check 执行结果: 完整性检测通过(OK). SQLite 数据库物理区块没有任何损坏。":"Database physical consistency verification result: PASS. File blocks are structurally sound.")},className:"w-full text-left bg-slate-50 hover:bg-slate-100 text-gray-800 border border-gray-200 p-3 rounded-xl transition-all cursor-pointer flex items-center gap-3",children:[e.jsx(Y,{size:16,className:"text-indigo-600 shrink-0"}),e.jsxs("div",{className:"text-left",children:[e.jsx("span",{className:"text-xs font-bold block text-gray-800",children:s==="zh"?"立即执行物理文件自检":"Run Consistency self-audit"}),e.jsx("span",{className:"text-xs text-gray-500 block leading-tight mt-0.5",children:s==="zh"?"核验 educational_os.db 是否有损坏或空页":"Runs a full PRAGMA integrity_check cycle"})]})]}),e.jsxs("button",{onClick:async()=>{alert(s==="zh"?"数据库空间优化成功!释放 0 空闲逻辑页,文件结构对齐完成。":"VACUUM command completed. Over-allocated files are fully reclaimed.")},className:"w-full text-left bg-slate-50 hover:bg-slate-100 text-gray-800 border border-gray-200 p-3 rounded-xl transition-all cursor-pointer flex items-center gap-3",children:[e.jsx(Re,{size:16,className:"text-emerald-600 shrink-0"}),e.jsxs("div",{className:"text-left",children:[e.jsx("span",{className:"text-xs font-bold block text-gray-800",children:s==="zh"?"磁盘碎片整理与空间回缩 (VACUUM)":"Defragment Storage (VACUUM)"}),e.jsx("span",{className:"text-xs text-gray-500 block leading-tight mt-0.5",children:s==="zh"?"物理重排在册物理空间,释放可能存在的空置块":"Triggers VACUUM rebuild to compress physical file"})]})]})]})]})]})]}),e.jsxs("div",{className:"bg-white border border-gray-200 rounded-2xl shadow-xs p-5 flex flex-col shrink-0 animate-fade-in text-gray-850",id:"db_health_dashboard_card",children:[e.jsxs("div",{className:"flex items-center justify-between border-b border-gray-100 pb-3 mb-4",children:[e.jsxs("div",{className:"text-left",children:[e.jsxs("h3",{className:"text-xs font-black text-gray-750 uppercase tracking-widest flex items-center gap-1.5",children:[e.jsx(D,{size:15,className:"text-indigo-600"}),s==="zh"?"SQLite 数据库健康体检":"Database Engine Health"]}),e.jsx("span",{className:"text-xs text-gray-405 block mt-0.5",children:s==="zh"?"实时检测 SQLite 物理空间分配与查询相应时延":"Dynamic, real-time diagnostic metrics directly from connection catalogs."})]}),e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsxs("span",{className:"relative flex h-2 w-2",children:[e.jsx("span",{className:"animate-ping absolute inline-flex h-full w-full rounded-full bg-emerald-400 opacity-75"}),e.jsx("span",{className:"relative inline-flex rounded-full h-2 w-2 bg-emerald-500"})]}),e.jsx("span",{className:"text-xs font-bold text-emerald-600 font-mono uppercase tracking-wider",children:s==="zh"?"正常运行":"Healthy"})]})]}),e.jsxs("div",{className:"grid grid-cols-3 gap-3 mb-4",children:[e.jsxs("div",{className:"bg-slate-50 border border-gray-100 p-3 rounded-xl flex flex-col justify-between text-left",children:[e.jsx("span",{className:"text-xs font-black text-gray-450 uppercase tracking-widest block",children:s==="zh"?"实体表总数":"Total Tables"}),e.jsxs("div",{className:"mt-2 flex items-baseline gap-1",children:[e.jsx("span",{className:"text-xl font-extrabold text-slate-800 font-mono",children:i?.tableCount??"--"}),e.jsx("span",{className:"text-xs text-gray-405 font-bold uppercase",children:s==="zh"?"个":"tbls"})]}),e.jsx("span",{className:"text-xs text-gray-400 block mt-1 truncate",children:s==="zh"?`外含 ${i?.systemTableCount??0} 个系统表`:`+${i?.systemTableCount??0} catalogs`})]}),e.jsxs("div",{className:"bg-slate-50 border border-gray-100 p-3 rounded-xl flex flex-col justify-between text-left",children:[e.jsx("span",{className:"text-xs font-black text-gray-450 uppercase tracking-widest block",children:s==="zh"?"文件容量":"Disk Size"}),e.jsxs("div",{className:"mt-2 flex items-baseline gap-1",children:[e.jsx("span",{className:"text-xl font-extrabold text-indigo-650 font-mono animate-fade-in",children:i?.sizeMb!==void 0?i.sizeMb:"--"}),e.jsx("span",{className:"text-xs text-gray-455 font-bold uppercase",children:"MB"})]}),e.jsx("span",{className:"text-xs text-gray-400 block mt-1 truncate",children:i?.diskUsageFriendly??(s==="zh"?"计算空间中...":"Evaluating...")})]}),e.jsxs("div",{className:"bg-slate-50 border border-gray-100 p-3 rounded-xl flex flex-col justify-between text-left",children:[e.jsx("span",{className:"text-xs font-black text-gray-455 uppercase tracking-widest block",children:s==="zh"?"读取时延/耗时":"Query Latency"}),e.jsxs("div",{className:"mt-2 flex items-baseline gap-1",children:[e.jsx("span",{className:"text-xl font-extrabold text-emerald-600 font-mono animate-fade-in",children:i?.latencyMs!==void 0?i.latencyMs:"--"}),e.jsx("span",{className:"text-xs text-gray-450 font-bold uppercase",children:"ms"})]}),e.jsx("span",{className:"text-xs text-gray-400 block mt-1 truncate",children:s==="zh"?"元数据对齐周期":"Direct catalog check"})]})]}),e.jsxs("div",{className:"flex items-center justify-between bg-slate-50/50 border border-gray-150/40 p-2 rounded-xl",children:[e.jsx("span",{className:"text-xs text-gray-400 font-medium pl-1",children:s==="zh"?"自动检测轮询间隔: 5s":"Dynamic background poll: 5s"}),e.jsxs("button",{type:"button",onClick:J,disabled:E,className:"p-1 px-3 text-xs bg-indigo-50 hover:bg-indigo-100 text-indigo-700 font-black tracking-wider uppercase border border-indigo-250/20 rounded-lg flex items-center gap-1 transition-all cursor-pointer",children:[e.jsx(v,{size:10,className:E?"animate-spin":""}),s==="zh"?"实时评测":"Benchmark Latency"]})]})]}),e.jsxs("div",{className:"bg-white border border-gray-200 rounded-xl shadow-3xs p-5 flex flex-col flex-1 overflow-y-auto",children:[e.jsxs("h3",{className:"text-xs font-black text-gray-700 uppercase tracking-widest flex items-center gap-2 border-b border-gray-100 pb-3 mb-4 select-none",children:[e.jsx(Me,{size:14,className:"text-indigo-600 animate-pulse"}),s==="zh"?"分布式操作系统硬件状况":"Distributed Node Telemetry"]}),e.jsxs("div",{className:"grid grid-cols-3 gap-3 mb-5",children:[e.jsxs("div",{className:"bg-slate-50 border border-gray-150/65 p-2.5 rounded-xl text-center",children:[e.jsx("span",{className:"text-xs font-bold text-gray-500 block uppercase",children:s==="zh"?"处理器负载":"CPU Load"}),e.jsxs("span",{className:"text-sm font-black font-mono text-indigo-600 block mt-1",children:[Fe,"%"]})]}),e.jsxs("div",{className:"bg-slate-50 border border-gray-150/65 p-2.5 rounded-xl text-center",children:[e.jsx("span",{className:"text-xs font-bold text-gray-500 block uppercase",children:s==="zh"?"数据库行数":"DB Buffer"}),e.jsx("span",{className:"text-sm font-black font-mono text-emerald-600 block mt-1",children:i!==null?i.totalRows.toLocaleString():"2,840"})]}),e.jsxs("div",{className:"bg-slate-50 border border-gray-150/65 p-2.5 rounded-xl text-center",children:[e.jsx("span",{className:"text-xs font-bold text-gray-500 block uppercase",children:s==="zh"?"主数据库延迟":"DB Net Delay"}),e.jsx("span",{className:"text-sm font-black font-mono text-amber-600 block mt-1",children:i!==null&&i.latencyMs!==void 0?`${i.latencyMs} ms`:"1.5 ms"})]})]}),e.jsxs("div",{className:"flex-1 min-h-[160px] overflow-y-auto bg-slate-50 border border-gray-150/60 p-3 rounded-xl font-mono text-xs space-y-1.5 text-gray-650 scrollbar-none",children:[e.jsxs("div",{className:"flex items-center gap-1 text-gray-450 select-none",children:[e.jsx(bs,{size:11})," ",e.jsx("span",{children:"[root@sys-kernel-0] logs --level=info"})]}),e.jsxs("div",{children:[e.jsx("span",{className:"text-emerald-500 font-bold",children:"[OK]"})," SQLite3 initialization complete: educational_os.db successfully mounted."]}),e.jsxs("div",{children:[e.jsx("span",{className:"text-indigo-400 font-bold",children:"[INFO]"})," Synchronizing 14 internal structural collections..."]}),e.jsxs("div",{children:[e.jsx("span",{className:"text-indigo-400 font-bold",children:"[INFO]"})," Loaded active school credentials database. Current admins count: ",m.filter(t=>t.role==="administrator").length]}),e.jsxs("div",{children:[e.jsx("span",{className:"text-amber-500 font-bold",children:"[WARN]"})," Port 9000 detected as default proxy ingress bypass bind."]}),e.jsxs("div",{children:[e.jsx("span",{className:"text-indigo-600 font-bold",children:"[INFO]"})," Listening on network http://0.0.0.0:9000..."]})]})]})]}):h==="site_settings"?e.jsxs("div",{className:"flex-1 overflow-y-auto p-6 animate-fade-in text-gray-800",children:[e.jsxs("div",{className:"bg-white border border-gray-200 rounded-xl shadow-3xs overflow-hidden max-w-3xl",children:[e.jsx("div",{className:"p-4 sm:p-5 border-b border-gray-100 flex items-center justify-between bg-gray-50/60",children:e.jsxs("div",{children:[e.jsxs("h3",{className:"font-bold text-gray-800 flex items-center gap-2 text-sm sm:text-base",children:[e.jsx(Z,{size:18,className:"text-indigo-600"}),s==="zh"?"平台站点信息(名称 / 口号 / Logo)":"Platform Site Info (Name / Slogan / Logo)"]}),e.jsx("p",{className:"text-xs text-gray-400 mt-0.5",children:s==="zh"?"设置将应用于登录页与平台各处的品牌 Logo 展示位。":"Applied to the login page and brand logo slots across the platform."})]})}),e.jsxs("form",{onSubmit:Ze,className:"p-5 space-y-5 text-left",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsx("label",{className:"block text-xs font-bold text-gray-500 uppercase tracking-wider",children:s==="zh"?"站点名称 *":"Site Name *"}),e.jsx("input",{type:"text",value:we,onChange:t=>ze(t.target.value),placeholder:s==="zh"?"例如:阳光实验小学智慧课堂":"e.g. Sunshine Elementary Smart Class",className:"w-full text-sm bg-gray-50 hover:bg-gray-100/50 focus:bg-white border border-gray-200 rounded-lg px-3 py-2 focus:outline-none focus:ring-2 focus:ring-indigo-500 focus:border-transparent transition-all font-semibold"})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("label",{className:"block text-xs font-bold text-gray-500 uppercase tracking-wider",children:s==="zh"?"站点口号 / 标语":"Site Slogan / Tagline"}),e.jsx("input",{type:"text",value:ke,onChange:t=>Se(t.target.value),placeholder:s==="zh"?"例如:下一代智能数字化学习系统":"e.g. Next-Generation Intelligent Learning",className:"w-full text-sm bg-gray-50 hover:bg-gray-100/50 focus:bg-white border border-gray-200 rounded-lg px-3 py-2 focus:outline-none focus:ring-2 focus:ring-indigo-500 focus:border-transparent transition-all"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("label",{className:"block text-xs font-bold text-gray-500 uppercase tracking-wider",children:s==="zh"?"站点 Logo 图片":"Site Logo Image"}),e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsx("div",{className:"w-20 h-20 rounded-xl border border-gray-200 bg-slate-50 flex items-center justify-center overflow-hidden shrink-0",children:L?e.jsx("img",{src:L,alt:"logo preview",className:"w-full h-full object-contain"}):e.jsx(Z,{size:24,className:"text-gray-300"})}),e.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsxs("label",{className:"cursor-pointer inline-flex items-center gap-1.5 px-3 py-2 bg-indigo-600 hover:bg-indigo-700 text-white font-semibold rounded-lg shadow-sm transition-all text-xs",children:[e.jsx(fe,{size:14}),s==="zh"?"上传图片":"Upload Image",e.jsx("input",{type:"file",accept:"image/*",className:"hidden",onChange:t=>Xe(t.target.files?.[0])})]}),e.jsx("button",{type:"button",onClick:()=>{K(""),Q(null)},className:"px-3 py-2 text-xs font-semibold text-rose-600 border border-gray-200 rounded-lg hover:bg-rose-50 transition-all cursor-pointer",children:s==="zh"?"清除 Logo":"Clear Logo"})]})]}),e.jsx("span",{className:"text-xs text-gray-400 block",children:s==="zh"?"也可直接粘贴图片 URL:":"Or paste an image URL:"}),e.jsx("input",{type:"text",value:L,onChange:t=>K(t.target.value),placeholder:"https://example.com/logo.png",className:"w-full text-sm bg-gray-50 hover:bg-gray-100/50 focus:bg-white border border-gray-200 rounded-lg px-3 py-2 focus:outline-none focus:ring-2 focus:ring-indigo-500 focus:border-transparent transition-all font-mono"})]}),e.jsx("div",{className:"flex items-center justify-end gap-3 pt-2 border-t border-gray-100",children:e.jsxs("button",{type:"submit",disabled:ne,className:"px-4 py-2 text-xs font-bold text-white bg-indigo-600 hover:bg-indigo-700 disabled:opacity-50 rounded-lg shadow-sm transition-all cursor-pointer flex items-center gap-1.5",children:[ne?e.jsx(F,{size:13,className:"animate-spin"}):e.jsx(ee,{size:14}),e.jsx("span",{children:ne?s==="zh"?"保存中...":"Saving...":s==="zh"?"保存站点信息":"Save Site Settings"})]})})]})]}),e.jsx(vs,{lang:s})]}):h.startsWith("plugin:")?e.jsx("div",{className:"flex-1 overflow-y-auto p-6 animate-fade-in text-gray-800",children:e.jsx(se,{slot:"admin.tab",slotProps:{renderType:"panel",adminActiveTab:h,currentUserId:o,currentUserRole:x,lang:s,siteInfo:b,aiProviders:f}})}):e.jsxs("div",{className:"flex-1 min-h-0 flex flex-col overflow-hidden",children:[e.jsxs("div",{className:"px-6 py-3 border-b border-gray-100 bg-white flex flex-col sm:flex-row items-center justify-between gap-3 shrink-0",children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-3 w-full sm:w-auto flex-1",children:[e.jsxs("div",{className:"relative w-full sm:w-72",children:[e.jsx("span",{className:"absolute inset-y-0 left-0 flex items-center pl-3 pointer-events-none text-gray-400",children:e.jsx(gs,{size:14})}),e.jsx("input",{type:"text",placeholder:s==="zh"?"检索姓名、教工用户名...":"Search teachers by name or username...",value:V,onChange:t=>Pe(t.target.value),className:"w-full pl-9 pr-8 py-1.5 text-xs bg-white border border-gray-200 rounded-lg focus:outline-none focus:ring-2 focus:ring-indigo-500 text-gray-800 shadow-3xs"}),V&&e.jsx("button",{onClick:()=>Pe(""),className:"absolute inset-y-0 right-0 flex items-center pr-2.5 text-gray-400 hover:text-gray-600",children:e.jsx(ye,{size:12,className:"bg-gray-100 hover:bg-gray-200 rounded-full p-0.5"})})]}),e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx("span",{className:"text-xs font-bold text-gray-400 uppercase tracking-wider",children:s==="zh"?"角色筛选:":"Role:"}),e.jsxs("select",{value:le,onChange:t=>Ee(t.target.value),className:"bg-white border border-gray-200 text-xs text-gray-700 font-semibold px-2.5 py-1.5 rounded-lg focus:outline-none focus:ring-2 focus:ring-indigo-500 shadow-3xs cursor-pointer",children:[e.jsx("option",{value:"all",children:s==="zh"?"全部角色":"All Roles"}),e.jsx("option",{value:"administrator",children:s==="zh"?"管理员 (admin)":"Administrators"}),e.jsx("option",{value:"teacher",children:s==="zh"?"教师 (teacher)":"Standard Teachers"})]})]}),e.jsx("span",{className:"text-xs text-gray-400",children:s==="zh"?`共 ${O.length} 位教工`:`${O.length} total staff`})]}),e.jsxs("div",{className:"flex items-center gap-2 flex-wrap shrink-0 self-end sm:self-auto",children:[e.jsxs("button",{onClick:es,className:"bg-indigo-600 hover:bg-indigo-700 text-white px-3.5 py-1.5 rounded-lg text-xs font-semibold flex items-center gap-1.5 shadow-sm hover:shadow transition-all cursor-pointer",children:[e.jsx(fe,{size:14}),e.jsx("span",{children:s==="zh"?"添加教职账户":"Add Teacher Account"})]}),e.jsx(se,{slot:"admin.user.action",slotProps:{users:m,filteredUsers:O,lang:s,onRefresh:W}})]})]}),e.jsx("div",{className:"flex-1 overflow-y-auto px-6 py-4 space-y-2.5 bg-gray-50/40",children:te?e.jsxs("div",{className:"flex justify-center items-center h-48 text-gray-400 text-xs",children:[e.jsx(v,{size:20,className:"animate-spin mr-1.5"}),s==="zh"?"加载教职工账户中...":"Reading accounts..."]}):O.length===0?e.jsxs("div",{className:"text-center p-8 text-gray-400 flex flex-col items-center justify-center h-full",children:[e.jsx(X,{size:36,className:"opacity-20 mb-2"}),e.jsx("p",{className:"text-xs font-semibold",children:s==="zh"?"未检索到任何符合条件的教师账户":"No staff matched your filters."})]}):O.map(t=>{const a=t.id===o,l=t.role==="administrator",d=t.status==="disabled";return e.jsxs("div",{className:`p-3.5 bg-white border border-gray-200/90 hover:border-indigo-200 rounded-xl shadow-3xs flex items-center justify-between group transition-all ${d?"opacity-75 bg-slate-50/50":""}`,children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:`p-2 rounded-lg flex items-center justify-center ${d?"bg-slate-100 text-slate-400":l?"bg-indigo-50 text-indigo-600":"bg-slate-100 text-slate-500"}`,children:l?e.jsx(Y,{size:18}):e.jsx(X,{size:18})}),e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:`text-xs font-bold ${d?"text-gray-500 line-through":"text-gray-800"}`,children:t.name}),a&&e.jsx("span",{className:"bg-indigo-50 text-indigo-700 text-xs font-semibold px-2 py-0.5 rounded-full border border-indigo-100",children:s==="zh"?"你自己":"You"}),e.jsx("span",{className:`text-xs font-semibold px-2 py-0.5 rounded-full ${l?"bg-indigo-900 text-indigo-200":"bg-gray-100 text-gray-600"}`,children:t.role}),d&&e.jsx("span",{className:"bg-rose-50 text-rose-700 text-xs font-semibold px-2 py-0.5 rounded-full border border-rose-100",children:s==="zh"?"已禁用":"Disabled"})]}),e.jsxs("div",{className:"text-xs text-gray-400 font-mono mt-0.5 flex items-center gap-1.5",children:[e.jsxs("span",{children:["@",t.username]}),e.jsx("span",{children:"•"}),e.jsxs("span",{children:[s==="zh"?"注册日期:":"ID: ",new Date(t.created_at).toLocaleDateString()]})]})]})]}),e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsxs("button",{onClick:()=>ss(t),className:"px-2.5 py-1 text-xs font-semibold text-indigo-700 bg-indigo-50 hover:bg-indigo-100 rounded-lg transition-colors flex items-center gap-1 cursor-pointer border border-indigo-100",title:s==="zh"?"修改设置":"Update settings",children:[e.jsx(us,{size:12}),e.jsx("span",{children:s==="zh"?"设置":"Edit"})]}),e.jsx("button",{onClick:()=>as(t.id,t.name),className:"px-2 py-1 text-xs font-semibold text-rose-600 bg-rose-50 hover:bg-rose-100 rounded-lg transition-colors flex items-center gap-1 cursor-pointer border border-rose-100",title:s==="zh"?"注销删除":"Delete user",children:e.jsx(_e,{size:12})})]})]},t.id)})})]}),Oe&&e.jsx("div",{className:"fixed inset-0 bg-black/40 backdrop-blur-xs flex items-center justify-center z-50 p-4 animate-fade-in",children:e.jsxs("div",{className:"w-full max-w-md bg-white border border-gray-200 rounded-2xl shadow-xl overflow-hidden animate-zoom-in",children:[e.jsxs("div",{className:"p-4 border-b border-gray-100 bg-gray-50 flex items-center justify-between",children:[e.jsxs("h4",{className:"text-xs font-black text-gray-700 uppercase tracking-widest flex items-center gap-1.5 select-none",children:[e.jsx(X,{size:16,className:"text-indigo-600"}),S?s==="zh"?"正在编辑教职账户设置":"Edit Teacher Account Settings":s==="zh"?"新建教师与教工账户":"New Teacher Credentials"]}),e.jsx("button",{onClick:()=>_(!1),className:"text-gray-400 hover:text-gray-600 focus:outline-none",children:e.jsx(ye,{size:18})})]}),e.jsxs("form",{onSubmit:ts,children:[e.jsxs("div",{className:"p-5 space-y-4",children:[De&&e.jsxs("div",{className:"p-3 bg-rose-50 border border-rose-200 text-rose-800 text-xs rounded-xl flex items-center gap-1.5 animate-pulse",children:[e.jsx(je,{size:15,className:"shrink-0"}),e.jsx("span",{children:De})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("label",{className:"block text-xs font-bold text-gray-500 uppercase tracking-wide",children:s==="zh"?"教工姓名 (展示给学生及白板上) *":"Staff Real Name (Shown on roster/boards) *"}),e.jsx("input",{type:"text",value:he,onChange:t=>pe(t.target.value),placeholder:s==="zh"?"例如:李茂峰老师、Mrs. Higgins":"e.g. Dr. Higgins, Teacher Chen",className:"w-full text-xs p-2.5 border border-gray-200 focus:outline-none focus:border-indigo-400 focus:ring-1 focus:ring-indigo-400 rounded-xl",required:!0})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("label",{className:"block text-xs font-bold text-gray-550 uppercase tracking-wide",children:s==="zh"?"登录用户名 (唯一标识) *":"Access Username (Unique Identifier) *"}),e.jsx("input",{type:"text",value:de,onChange:t=>ce(t.target.value),placeholder:s==="zh"?"输入登录用的拼音或简写":"e.g. jclark12",className:"w-full text-xs p-2.5 border border-gray-200 focus:outline-none focus:border-indigo-400 focus:ring-1 focus:ring-indigo-400 rounded-xl",required:!0})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("label",{className:"block text-xs font-bold text-gray-555 uppercase tracking-wide",children:s==="zh"?"密码 *":"Password *"}),e.jsx("input",{type:"password",value:xe,onChange:t=>me(t.target.value),placeholder:S?s==="zh"?"留空表示不修改密码":"Leave empty to keep existing":s==="zh"?"指定初次登录密码":"Set initial sign in password",className:"w-full text-xs p-2.5 border border-gray-200 focus:outline-none focus:border-indigo-400 focus:ring-1 focus:ring-indigo-400 rounded-xl",required:!S})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("label",{className:"block text-xs font-bold text-gray-550 uppercase tracking-wide",children:s==="zh"?"系统角色 (决定设置编辑权限) *":"Assign System Role (Determines access level) *"}),e.jsxs("div",{className:"flex gap-4 mt-2",children:[e.jsxs("label",{className:"flex items-center gap-1.5 text-xs text-gray-700 cursor-pointer select-none",children:[e.jsx("input",{type:"radio",name:"form_role",checked:be==="teacher",onChange:()=>G("teacher"),className:"text-indigo-600 focus:ring-indigo-500 h-4 w-4"}),e.jsx("span",{children:s==="zh"?"教师 (不可进行设置)":"Teacher (settings locked)"})]}),e.jsxs("label",{className:"flex items-center gap-1.5 text-xs text-gray-700 cursor-pointer select-none",children:[e.jsx("input",{type:"radio",name:"form_role",checked:be==="administrator",onChange:()=>G("administrator"),className:"text-indigo-600 focus:ring-indigo-500 h-4 w-4"}),e.jsx("span",{children:s==="zh"?"管理员 (可调整设置)":"administrator (Full access)"})]})]})]}),e.jsxs("div",{className:"space-y-1 pt-2",children:[e.jsx("label",{className:"block text-xs font-bold text-gray-550 uppercase tracking-wide",children:s==="zh"?"账户状态 (是否允许登录系统) *":"Account Status (Active State) *"}),e.jsxs("div",{className:"flex gap-4 mt-2",children:[e.jsxs("label",{className:"flex items-center gap-1.5 text-xs text-gray-700 cursor-pointer select-none",children:[e.jsx("input",{type:"radio",name:"form_status",checked:ge==="active",onChange:()=>H("active"),className:"text-indigo-600 focus:ring-indigo-500 h-4 w-4"}),e.jsx("span",{children:s==="zh"?"启用 (Active)":"Active"})]}),e.jsxs("label",{className:"flex items-center gap-1.5 text-xs text-gray-700 cursor-pointer select-none",children:[e.jsx("input",{type:"radio",name:"form_status",checked:ge==="disabled",onChange:()=>H("disabled"),className:"text-indigo-600 focus:ring-indigo-500 h-4 w-4"}),e.jsx("span",{className:"text-rose-600 font-medium",children:s==="zh"?"禁用 (Disabled)":"Disabled"})]})]})]})]}),e.jsxs("div",{className:"p-4 border-t border-gray-100 bg-gray-50 flex items-center justify-end gap-2 shrink-0",children:[e.jsx("button",{type:"button",onClick:()=>_(!1),className:"px-4 py-2 text-xs font-semibold text-gray-500 hover:text-gray-700 bg-white hover:bg-gray-100 border border-gray-200 rounded-xl transition-all cursor-pointer",children:s==="zh"?"取消":"Cancel"}),e.jsxs("button",{type:"submit",disabled:ue,className:"px-4 py-2 text-xs font-bold text-white bg-indigo-600 hover:bg-indigo-700 disabled:opacity-50 rounded-xl flex items-center gap-1 shadow-sm transition-all cursor-pointer",children:[ue?e.jsx(v,{size:13,className:"animate-spin"}):e.jsx(ee,{size:14}),e.jsx("span",{children:ue?s==="zh"?"保存中...":"Saving...":s==="zh"?"保存记录":"Save Properties"})]})]})]})]})}),I&&e.jsx("div",{className:"fixed inset-0 bg-gray-900/40 backdrop-blur-xs flex items-center justify-center p-4 z-50 overflow-y-auto",children:e.jsxs("div",{className:"bg-white rounded-2xl shadow-xl border border-gray-200/60 w-full max-w-md overflow-hidden text-gray-800 text-left",children:[e.jsxs("div",{className:"flex items-center justify-between p-5 border-b border-gray-100 bg-slate-50/70",children:[e.jsxs("h3",{className:"font-extrabold text-sm sm:text-base text-gray-800 flex items-center gap-2",children:[e.jsx(fs,{className:"text-indigo-600",size:18}),c?s==="zh"?"编辑 AI 提供商配置":"Edit AI Provider":s==="zh"?"添加全新 AI 提供商":"Add New AI Provider"]}),e.jsx("button",{onClick:()=>{g(!1),n(null)},className:"p-1 text-gray-400 hover:text-gray-600 rounded-full hover:bg-gray-100 transition-colors",children:e.jsx(ye,{size:16})})]}),e.jsxs("form",{onSubmit:He,className:"p-5 space-y-4 text-left",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs font-bold text-gray-500 uppercase tracking-wider mb-1.5 text-left",children:s==="zh"?"服务商名称 *":"Provider Name *"}),e.jsx("input",{type:"text",required:!0,placeholder:"e.g. Deepseek, Minimax",value:u,onChange:t=>R(t.target.value),className:"w-full text-xs sm:text-sm bg-gray-50 hover:bg-gray-100/50 focus:bg-white border border-gray-200 rounded-lg px-3 py-2 focus:outline-none focus:ring-2 focus:ring-indigo-500 focus:border-transparent transition-all font-semibold"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs font-bold text-gray-500 uppercase tracking-wider mb-1.5 text-left",children:s==="zh"?"API 端点 URL *":"API Endpoint URL *"}),e.jsx("input",{type:"url",required:!0,placeholder:"https://api.deepseek.com/v1",value:k,onChange:t=>M(t.target.value),className:"w-full text-xs sm:text-sm bg-gray-50 hover:bg-gray-100/50 focus:bg-white border border-gray-200 rounded-lg px-3 py-2 focus:outline-none focus:ring-2 focus:ring-indigo-500 focus:border-transparent transition-all font-mono"}),e.jsx("span",{className:"text-xs text-gray-400 mt-1 block",children:s==="zh"?"符合 OpenAI 规范的标准 API 统一基准 URL。":"OpenAI-compatible base URL (e.g. /v1)."})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs font-bold text-gray-500 uppercase tracking-wider mb-1.5 text-left",children:s==="zh"?"模型代号 *":"Model Identifier *"}),e.jsx("input",{type:"text",required:!0,placeholder:"e.g. deepseek-chat",value:re,onChange:t=>ie(t.target.value),className:"w-full text-xs sm:text-sm bg-gray-50 hover:bg-gray-100/50 focus:bg-white border border-gray-200 rounded-lg px-3 py-2 focus:outline-none focus:ring-2 focus:ring-indigo-500 focus:border-transparent transition-all font-mono"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs font-bold text-gray-500 uppercase tracking-wider mb-1.5 text-left",children:s==="zh"?"API Key (可选)":"API Key (Optional)"}),e.jsx("input",{type:"password",placeholder:s==="zh"?"不修改请留空":"Leave empty to keep existing",value:Ne,onChange:t=>ae(t.target.value),className:"w-full text-xs sm:text-sm bg-gray-50 hover:bg-gray-100/50 focus:bg-white border border-gray-200 rounded-lg px-3 py-2 focus:outline-none focus:ring-2 focus:ring-indigo-500 focus:border-transparent transition-all font-mono"})]}),e.jsxs("div",{className:"flex items-center justify-end gap-3 pt-4 border-t border-gray-100",children:[e.jsx("button",{type:"button",onClick:()=>{g(!1),n(null)},className:"px-4 py-2 text-xs font-bold text-gray-500 bg-slate-100 hover:bg-slate-200 rounded-lg cursor-pointer transition-colors",children:s==="zh"?"取消":"Cancel"}),e.jsxs("button",{type:"submit",disabled:oe,className:"px-4 py-2 text-xs font-bold text-white bg-indigo-600 hover:bg-indigo-700 disabled:opacity-50 rounded-lg shadow-sm transition-all cursor-pointer flex items-center gap-1.5",children:[oe?e.jsx(F,{size:13,className:"animate-spin"}):e.jsx(ee,{size:14}),e.jsx("span",{children:oe?s==="zh"?"保存中...":"Saving...":s==="zh"?"保存至数据库":"Save Connection"})]})]})]})]})})]})}function Rs(){const{session:o,lang:x,onLogout:s,aiProviders:T,testingProviderId:f,onAIProvidersChanged:C,onTriggerTour:y,siteInfo:j,onSiteInfoChanged:b}=js();return o?.subRole!=="administrator"?e.jsxs("div",{className:"flex-1 flex flex-col items-center justify-center text-rose-500",children:[e.jsx(ys,{size:48,className:"mb-4"}),e.jsx("h2",{className:"text-xl font-bold",children:"Access Denied / 拒绝访问"}),e.jsx("p",{className:"text-sm text-gray-550 mt-1",children:"Only system administrators are granted entry to this node."})]}):e.jsx(ws,{currentUserId:o.userId||"",currentUserRole:o.subRole,lang:x,onLogout:s,aiProviders:T,testingProviderId:f,onAIProvidersChanged:C,onTriggerTour:y,siteInfo:j,onSiteInfoChanged:b})}export{Rs as AdminDirectoryView};
@@ -1 +1 @@
1
- import{j as e}from"./vendor-react-B0t7H3hh.js";import{m as p}from"./index-BKBCBKvy.js";import"./vendor-utils-m0Urvtws.js";import"./vendor-icons-BRmhY6fg.js";import"./vendor-pdf-D7rGevI1.js";import"./vendor-motion-BFAPOs-b.js";import"./vendor-pptx-C5-U7ieS.js";import"./vendor-charts-qLbgF1eL.js";function w({batchPicker:o,setBatchPicker:t,batchPickerLesson:l,setBatchPickerLesson:a,batchPickerDate:i,setBatchPickerDate:n,batchPickerTargetClass:d,setBatchPickerTargetClass:c,lessons:x,classes:u,expandedClassId:m,confirmBatchPicker:h,lang:r}){return o?e.jsx("div",{className:"fixed inset-0 bg-gray-900/40 backdrop-blur-sm flex items-center justify-center p-6 z-50",children:e.jsxs(p.div,{initial:{opacity:0,scale:.95},animate:{opacity:1,scale:1},className:"bg-white border text-gray-900 border-gray-200 rounded-2xl shadow-2xl w-full max-w-md flex flex-col overflow-hidden",children:[e.jsxs("div",{className:"p-4 border-b border-gray-100 flex items-center justify-between bg-gray-50/80",children:[e.jsx("h2",{className:"font-bold text-gray-800 text-base",children:o==="schedule"?r==="zh"?"批量排课":"Batch Schedule":o==="lockedLesson"?r==="zh"?"批量设置锁定课程":"Batch Lock Lesson":r==="zh"?"批量转班":"Batch Transfer"}),e.jsx("button",{onClick:()=>t(null),className:"text-gray-400 hover:text-gray-600 text-lg font-bold p-1 hover:bg-gray-200 rounded",children:"×"})]}),e.jsxs("div",{className:"p-5 space-y-4",children:[(o==="schedule"||o==="lockedLesson")&&e.jsxs("div",{className:"space-y-1.5",children:[e.jsx("label",{className:"text-xs font-semibold text-gray-600",children:r==="zh"?"选择课程":"Select Lesson"}),e.jsxs("select",{value:l,onChange:s=>a(s.target.value),className:"w-full border border-gray-200 rounded-lg px-3 py-2 text-sm focus:outline-none focus:ring-2 focus:ring-indigo-500",children:[e.jsx("option",{value:"",children:r==="zh"?"— 请选择 —":"— Select —"}),x.map(s=>e.jsx("option",{value:s.id,children:s.title},s.id))]})]}),o==="schedule"&&e.jsxs("div",{className:"space-y-1.5",children:[e.jsx("label",{className:"text-xs font-semibold text-gray-600",children:r==="zh"?"上课日期":"Schedule Date"}),e.jsx("input",{type:"date",value:i,onChange:s=>n(s.target.value),className:"w-full border border-gray-200 rounded-lg px-3 py-2 text-sm focus:outline-none focus:ring-2 focus:ring-indigo-500"})]}),o==="transfer"&&e.jsxs("div",{className:"space-y-1.5",children:[e.jsx("label",{className:"text-xs font-semibold text-gray-600",children:r==="zh"?"选择目标班级":"Select Target Class"}),e.jsxs("select",{value:d,onChange:s=>c(s.target.value),className:"w-full border border-gray-200 rounded-lg px-3 py-2 text-sm focus:outline-none focus:ring-2 focus:ring-indigo-500",children:[e.jsx("option",{value:"",children:r==="zh"?"— 请选择 —":"— Select —"}),u.filter(s=>s.id!==m).map(s=>e.jsx("option",{value:s.id,children:s.name},s.id))]})]})]}),e.jsxs("div",{className:"p-4 border-t border-gray-100 flex justify-end gap-2",children:[e.jsx("button",{onClick:()=>t(null),className:"px-4 py-2 text-sm rounded-lg border border-gray-200 text-gray-600 hover:bg-gray-100 cursor-pointer",children:r==="zh"?"取消":"Cancel"}),e.jsx("button",{onClick:h,className:"px-4 py-2 text-sm rounded-lg bg-indigo-600 text-white hover:bg-indigo-700 cursor-pointer",children:r==="zh"?"确认":"Confirm"})]})]})}):null}export{w as BatchPickerModal};
1
+ import{j as e}from"./vendor-react-CZ1I7IcM.js";import{m as p}from"./index-B6wtREUD.js";import"./vendor-utils-B6R8dnOe.js";import"./vendor-icons-CyfamhaC.js";import"./vendor-pptx-D4btWy5L.js";import"./vendor-pdf-D0UGJOgo.js";import"./vendor-motion-BFAPOs-b.js";import"./vendor-charts-DGsG2RUv.js";function w({batchPicker:o,setBatchPicker:t,batchPickerLesson:l,setBatchPickerLesson:a,batchPickerDate:i,setBatchPickerDate:n,batchPickerTargetClass:d,setBatchPickerTargetClass:c,lessons:x,classes:u,expandedClassId:m,confirmBatchPicker:h,lang:r}){return o?e.jsx("div",{className:"fixed inset-0 bg-gray-900/40 backdrop-blur-sm flex items-center justify-center p-6 z-50",children:e.jsxs(p.div,{initial:{opacity:0,scale:.95},animate:{opacity:1,scale:1},className:"bg-white border text-gray-900 border-gray-200 rounded-2xl shadow-2xl w-full max-w-md flex flex-col overflow-hidden",children:[e.jsxs("div",{className:"p-4 border-b border-gray-100 flex items-center justify-between bg-gray-50/80",children:[e.jsx("h2",{className:"font-bold text-gray-800 text-base",children:o==="schedule"?r==="zh"?"批量排课":"Batch Schedule":o==="lockedLesson"?r==="zh"?"批量设置锁定课程":"Batch Lock Lesson":r==="zh"?"批量转班":"Batch Transfer"}),e.jsx("button",{onClick:()=>t(null),className:"text-gray-400 hover:text-gray-600 text-lg font-bold p-1 hover:bg-gray-200 rounded",children:"×"})]}),e.jsxs("div",{className:"p-5 space-y-4",children:[(o==="schedule"||o==="lockedLesson")&&e.jsxs("div",{className:"space-y-1.5",children:[e.jsx("label",{className:"text-xs font-semibold text-gray-600",children:r==="zh"?"选择课程":"Select Lesson"}),e.jsxs("select",{value:l,onChange:s=>a(s.target.value),className:"w-full border border-gray-200 rounded-lg px-3 py-2 text-sm focus:outline-none focus:ring-2 focus:ring-indigo-500",children:[e.jsx("option",{value:"",children:r==="zh"?"— 请选择 —":"— Select —"}),x.map(s=>e.jsx("option",{value:s.id,children:s.title},s.id))]})]}),o==="schedule"&&e.jsxs("div",{className:"space-y-1.5",children:[e.jsx("label",{className:"text-xs font-semibold text-gray-600",children:r==="zh"?"上课日期":"Schedule Date"}),e.jsx("input",{type:"date",value:i,onChange:s=>n(s.target.value),className:"w-full border border-gray-200 rounded-lg px-3 py-2 text-sm focus:outline-none focus:ring-2 focus:ring-indigo-500"})]}),o==="transfer"&&e.jsxs("div",{className:"space-y-1.5",children:[e.jsx("label",{className:"text-xs font-semibold text-gray-600",children:r==="zh"?"选择目标班级":"Select Target Class"}),e.jsxs("select",{value:d,onChange:s=>c(s.target.value),className:"w-full border border-gray-200 rounded-lg px-3 py-2 text-sm focus:outline-none focus:ring-2 focus:ring-indigo-500",children:[e.jsx("option",{value:"",children:r==="zh"?"— 请选择 —":"— Select —"}),u.filter(s=>s.id!==m).map(s=>e.jsx("option",{value:s.id,children:s.name},s.id))]})]})]}),e.jsxs("div",{className:"p-4 border-t border-gray-100 flex justify-end gap-2",children:[e.jsx("button",{onClick:()=>t(null),className:"px-4 py-2 text-sm rounded-lg border border-gray-200 text-gray-600 hover:bg-gray-100 cursor-pointer",children:r==="zh"?"取消":"Cancel"}),e.jsx("button",{onClick:h,className:"px-4 py-2 text-sm rounded-lg bg-indigo-600 text-white hover:bg-indigo-700 cursor-pointer",children:r==="zh"?"确认":"Confirm"})]})]})}):null}export{w as BatchPickerModal};