openlearn-next 0.2.5 → 0.2.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (23) hide show
  1. package/README.md +34 -136
  2. package/dist/assets/{CloudDriveModal-DgDurUBT.js → CloudDriveModal-TFWlPh8x.js} +1 -1
  3. package/dist/assets/{Dashboard-BnF7YAQi.js → Dashboard-vSYAYoji.js} +2 -2
  4. package/dist/assets/{HelpView-BP581QYZ.js → HelpView-D3WIxMoB.js} +2 -2
  5. package/dist/assets/{InteractiveCoursewareViewer-EIRNulEo.js → InteractiveCoursewareViewer-01PS40_x.js} +1 -1
  6. package/dist/assets/{InteractiveWhiteboard-D360IHbP.js → InteractiveWhiteboard-bmT1LKD6.js} +8 -8
  7. package/dist/assets/{LazyCourseware-qE4CY67E.js → LazyCourseware-Bcxn_20f.js} +1 -1
  8. package/dist/assets/{LazyWhiteboard-B5JmqHZ5.js → LazyWhiteboard-CJA7aRIM.js} +1 -1
  9. package/dist/assets/{LessonEditorView-C0czhtmf.js → LessonEditorView-hdJblhmb.js} +1 -1
  10. package/dist/assets/{LiveClassroomView-CrTY3jhP.js → LiveClassroomView-ByyIOLJC.js} +1 -1
  11. package/dist/assets/{PluginView-QS2b6nSF.js → PluginView-B3ZolNGQ.js} +2 -2
  12. package/dist/assets/{StudentAssignmentView-YxVJ5wkl.js → StudentAssignmentView-DDY7C092.js} +1 -1
  13. package/dist/assets/{StudentLessonView-D1gYdLM1.js → StudentLessonView-BcQ7q4QF.js} +1 -1
  14. package/dist/assets/{StudentPreviewModal-CG8bgUeI.js → StudentPreviewModal-ETJBF1Vc.js} +1 -1
  15. package/dist/assets/{StudentView-CmSL3cDw.js → StudentView-BOqPntx-.js} +1 -1
  16. package/dist/assets/{SystemResourceLibraryModal-Dnh7F5Vm.js → SystemResourceLibraryModal-tg8xnblT.js} +1 -1
  17. package/dist/assets/{TeacherView-BqXb0izg.js → TeacherView-CrbllHIm.js} +1 -1
  18. package/dist/assets/{index-Cq_aKTfc.js → index-CDTw8wSY.js} +1 -1
  19. package/dist/assets/index-eXp-qZdm.js +129 -0
  20. package/dist/index.html +1 -1
  21. package/dist/server.cjs +100 -37
  22. package/package.json +1 -1
  23. package/dist/assets/index-BxA9vp--.js +0 -129
package/README.md CHANGED
@@ -1,58 +1,43 @@
1
1
  # OpenLearnV2 — Educational OS
2
2
 
3
- 插件驱动的在线教学平台(LMS),基于命令-事件总线架构设计,支持 AI Agent 辅助教学。
3
+ 插件驱动的在线教学平台(LMS),支持 AI Agent 辅助教学。
4
4
 
5
- ## 技术栈
5
+ > 📚 **完整文档**:[openlearn-next-v2.readthedocs.io](https://openlearn-next-v2.readthedocs.io/zh-cn/latest/) · [快速开始](https://openlearn-next-v2.readthedocs.io/zh-cn/latest/getting-started/quickstart.html) · [安装指南](https://openlearn-next-v2.readthedocs.io/zh-cn/latest/getting-started/installation-guide.html) · [插件开发教程](https://openlearn-next-v2.readthedocs.io/zh-cn/latest/tutorials/plugin-development-tutorial.html) · [版本迁移](https://openlearn-next-v2.readthedocs.io/zh-cn/latest/migration/version-migration.html)
6
6
 
7
- **前端:** React 19 · Vite 6 · TailwindCSS 4 · TypeScript 5.8 · Zustand · Konva
8
- **后端:** Express 4 · better-sqlite3 · Socket.IO · Node.js Worker Threads
9
- **AI:** Gemini / OpenAI 兼容 API
10
- **部署:** PM2 + Nginx + Docker
7
+ ---
11
8
 
12
9
  ## 快速开始
13
10
 
14
- ### 通过 npm 安装运行
11
+ ### 一键运行(无需 clone 项目)
15
12
 
16
13
  ```bash
17
- # 全局安装
18
- npm install -g openlearn-next
14
+ # 通过 npx 直接启动(首次自动下载)
15
+ npx openlearn-next
19
16
 
20
- # 启动
21
- openlearn-next
22
-
23
- # 更新到最新版
24
- npm update -g openlearn-next
17
+ # 自定义端口 / 数据库路径
18
+ npx openlearn-next -p 3000
19
+ OPENLEARN_DB_PATH=./my.db npx openlearn-next
25
20
  ```
26
21
 
27
- #### 或通过 npx 一键启动
28
- ```bash
29
- # 首次会自动下载安装,无需 clone 项目
22
+ ### 全局安装
30
23
 
31
- npx openlearn-next -p 3000 # 自定义端口(默认 9000)
32
- OPENLEARN_DB_PATH=./my.db npx openlearn-next # 自定义数据库路径(默认 ~/openlearn-next/data.db)
24
+ ```bash
25
+ npm install -g openlearn-next # 安装
26
+ openlearn-next # 启动
27
+ npm update -g openlearn-next # 更新
33
28
  ```
34
29
 
35
- 默认账号:`admin` / `admin`(管理员),`teacher` / `teacher`(教师)。
30
+ 默认账号:`admin` / `admin`(管理员)、`teacher` / `teacher`(教师)。
36
31
 
37
32
  ### 本地开发
38
33
 
39
34
  ```bash
40
- # 安装依赖
41
35
  npm install
42
-
43
- # 配置环境变量(可选:AI 功能通过管理后台「AI 提供商」配置,或设置 GEMINI_API_KEY 作为回退)
44
- # echo "GEMINI_API_KEY=你的密钥" > .env
45
-
46
- # 启动开发服务
36
+ # AI 功能可在管理后台「AI Provider 管理」配置;或设置 GEMINI_API_KEY 作为回退
47
37
  ./dev.sh
48
- # 或:npm run dev
49
-
50
- # 访问
51
38
  open http://localhost:9000
52
39
  ```
53
40
 
54
- 默认账号:`admin` / `admin`(管理员),`teacher` / `teacher`(教师)
55
-
56
41
  ## 生产部署
57
42
 
58
43
  ```bash
@@ -60,112 +45,15 @@ chmod +x deploy.sh
60
45
  ./deploy.sh
61
46
  ```
62
47
 
63
- 脚本自动完成:构建 → 生成 Nginx 配置 → 配置 PM2 → 生成加密密钥。
64
- 访问 `http://服务器IP` 或通过 Nginx 反向代理。
65
-
66
- ## 项目结构
67
-
68
- ```
69
- ├── server.ts # Express + Socket.IO + API 路由
70
- ├── packages/
71
- │ ├── core/ # OS 内核
72
- │ │ ├── kernel/ # 内核容器,组装子系统
73
- │ │ ├── command-bus/ # 命令总线(注册 handler,执行命令)
74
- │ │ ├── event-bus/ # 事件总线(发布/订阅,审计日志)
75
- │ │ ├── registry/ # AI Agent 工具注册表
76
- │ │ ├── capability-system/ # 权限守卫(RBAC)
77
- │ │ ├── plugin-host/ # 插件生命周期 + 上下文构建
78
- │ │ ├── worker-runtime/ # Worker Thread 隔离执行
79
- │ │ ├── esm-loader/ # ESM 动态加载(data: URL)
80
- │ │ ├── di/ # Token 依赖注入容器
81
- │ │ ├── db/ # SQLite 数据库(30+ 表)
82
- │ │ └── process-manager/ # 后台进程/定时任务
83
- │ └── plugins/ # 内置插件
84
- │ ├── builtin.ts # 课程·白板·课件·插件管理
85
- │ ├── management.ts # 班级·学生·作业·排课·考勤
86
- │ ├── vfs.ts # 虚拟文件系统
87
- │ ├── process.ts # 进程管理
88
- │ ├── ai-planner.ts # AI 自动规划
89
- │ ├── ai-submit-injector.ts # LMS SDK 注入课件
90
- │ └── assignment-eval.ts # 作业提交·互评·评分
91
- ├── src/
92
- │ ├── App.tsx # 主应用组件
93
- │ ├── components/ # UI 组件(24 个)
94
- │ ├── features/ # 业务模块(白板·课件)
95
- │ ├── services/ # 前端服务(EventBus·Socket·API)
96
- │ ├── store/ # Zustand 状态管理
97
- │ └── hooks/ # 自定义 Hooks
98
- ├── server/ # 服务端模块(自 v5.0)
99
- │ ├── middleware/auth.ts # 认证中间件
100
- │ ├── routes/auth.ts # 认证路由
101
- │ └── utils/ # 工具(加密·迁移·日志·上传)
102
- │ └── bridge-sdk.ts # 交互式课件沙箱 Bridge SDK Proxy 实现
103
- ├── nginx.conf # Nginx 配置模板
104
- ├── deploy.sh # 一键部署脚本
105
- ├── ecosystem.config.cjs # PM2 配置
106
- ├── Dockerfile
107
- └── docker-compose.yml
108
- ```
109
-
110
- ## 核心架构
111
-
112
- ### OS 内核
113
-
114
- `Kernel` 是全局单例,组装 10 个子系统:
115
-
116
- | 层 | 子系统 | 职责 |
117
- |----|--------|------|
118
- | L0 | EventBus | 发布/订阅,通配符匹配,自动审计日志 |
119
- | L0 | CapabilityGuard | 字符串 RBAC(`lesson:write`、`*:*:*`) |
120
- | L0 | ServiceRegistry | Token DI 容器(拓扑排序,循环检测) |
121
- | L1 | CommandBus | 命令执行管线 + 拦截器链(权限 + 高危审批) |
122
- | L1 | ActionRegistry | AI Agent 工具注册表 |
123
- | L2 | ProcessManager | 后台进程/定时任务 |
124
- | L2 | EsmLoader | ESM 动态加载(Node.js data: URL) |
125
- | L2 | PluginHost | 插件生命周期管理 + 热重载 |
126
- | L3 | WorkerManager | Worker Thread 隔离 + RPC 代理 |
127
- | — | DB | SQLite WAL 模式,30+ 张表 |
128
-
129
- ### 插件系统
130
-
131
- 插件以 ZIP 包分发,通过 PluginCenter 上传安装:
132
-
133
- ```
134
- ext-exam.zip
135
- ├── manifest.json # id, name, version, capabilitiesProposed, classroomTools
136
- ├── server/index.js # activate(ctx) → 注册 CommandHandler + Action
137
- └── frontend/ # React 组件(挂载到 Extension Slot)
138
- ```
139
-
140
- **插件能力(v5.1):**
141
- - 命令注册 + AI Agent 工具注册
142
- - 事件发布/订阅 + 审计日志
143
- - 自建数据库表(`ctx.db.ensureTable()`)
144
- - 共享依赖引用(`ctx.require('recharts')`)
145
- - 前端 Extension Slot(`teacher.panel` 等 8 个)
146
- - Worker Thread 隔离执行
147
- - **交互式 Web 课件支持**(含高度隔离的沙箱环境与 Bridge SDK Proxy 代理)
148
-
149
- **已安装的课堂工具:** 选择题测验 · 专业测验 · 随机点名 · 思维导图 · 计时器 · 代码沙箱 · 数学图形
150
-
151
- ### 事件通信
152
-
153
- ```
154
- 教师操作白板
155
- ├─ 实时绘制(高频)→ Socket.IO 直连(< 500ms)
156
- └─ 结构操作 → frontendEventBus → SocketBridge → server EventBus
157
- ├─ SQLite events 表(审计)
158
- └─ io.to(room).emit()(其他客户端)
159
- ```
48
+ 脚本自动完成:构建 → 生成 Nginx 配置 → 配置 PM2 → 生成加密密钥。
49
+ 访问 `http://服务器IP` 或经 Nginx 反向代理。
50
+ 详见 [部署指南](https://openlearn-next-v2.readthedocs.io/zh-cn/latest/deployment/production-guide.html)。
160
51
 
161
52
  ## npm 脚本
162
53
 
163
54
  | 命令 | 说明 |
164
55
  |------|------|
165
- | `npm install -g openlearn-next` | 全局安装 |
166
- | `npx openlearn-next` | 一键运行(免安装) |
167
- | `npm update -g openlearn-next` | 更新到最新版 |
168
- | `npm run dev` | 启动开发服务 |
56
+ | `npm run dev` | 启动开发服务(端口 9000) |
169
57
  | `npm run build` | 生产构建(Vite + esbuild) |
170
58
  | `npm start` | 运行生产构建 |
171
59
  | `npm test` | 运行测试 |
@@ -175,9 +63,19 @@ ext-exam.zip
175
63
 
176
64
  | 变量 | 必需 | 说明 |
177
65
  |------|:--:|------|
178
- | `GEMINI_API_KEY` | — | 可选。AI 服务回退密钥;推荐在管理面板「AI 提供商管理」配置第三方 AI(OpenAI 兼容) |
179
- | `PORT` | — | 服务端口,默认 9000 |
180
- | `OPENLEARN_DB_PATH` | — | SQLite 数据库路径(npx 默认 ~/openlearn-next/data.db,本地开发默认项目目录) |
181
66
  | `ENCRYPTION_KEY` | ✅ | 64 位 hex,AI Provider API Key 加密密钥(`deploy.sh` 自动生成) |
182
- | `LOG_LEVEL` | — | 日志级别(debug / info / warn / error),默认 info |
67
+ | `PORT` | — | 服务端口,默认 9000 |
68
+ | `OPENLEARN_DB_PATH` | — | SQLite 数据库路径(npx 默认 `~/openlearn-next/data.db`,本地开发默认项目目录) |
69
+ | `GEMINI_API_KEY` | — | 可选。AI 服务回退密钥;推荐在管理面板「AI Provider 管理」配置 |
183
70
  | `ALLOWED_ORIGINS` | — | CORS 白名单,逗号分隔 |
71
+ | `LOG_LEVEL` | — | 日志级别(debug / info / warn / error),默认 info |
72
+
73
+ ## 文档链接
74
+
75
+ | 主题 | 链接 |
76
+ |------|------|
77
+ | 📖 文档中心 | <https://openlearn-next-v2.readthedocs.io/zh-cn/latest/> |
78
+ | 🚀 快速开始 | <https://openlearn-next-v2.readthedocs.io/zh-cn/latest/getting-started/quickstart.html> |
79
+ | 🎓 插件开发 | <https://openlearn-next-v2.readthedocs.io/zh-cn/latest/tutorials/plugin-development-tutorial.html> |
80
+ | 🛠 插件开发参考 | <https://openlearn-next-v2.readthedocs.io/zh-cn/latest/reference/plugin-database-api.html> |
81
+ | 🔄 版本迁移 | <https://openlearn-next-v2.readthedocs.io/zh-cn/latest/migration/version-migration.html> |
@@ -1 +1 @@
1
- import{j as e}from"./vendor-react-0Lg0vA-4.js";import{L as o}from"./LazyCourseware-qE4CY67E.js";import{a9 as i,Z as x,X as c,a5 as d}from"./vendor-icons-BvCtGbt1.js";import{M as m}from"./index-BrEBeWAQ.js";import"./vendor-pdf-CVyNPGVr.js";function g({vfsNodes:r,currentVfsParent:n,setCurrentVfsParent:t,cloudDrivePreviewNode:l,setCloudDrivePreviewNode:a}){return e.jsxs("div",{className:"flex-1 flex overflow-hidden min-h-0",children:[e.jsxs("div",{className:"w-64 border-r border-gray-100 flex flex-col bg-gray-50 shrink-0",children:[e.jsx("div",{className:"p-3 border-b border-gray-200 flex items-center gap-2",children:e.jsxs("button",{onClick:()=>{t(null),a(null)},className:`text-sm font-medium w-full text-left flex items-center gap-2 p-2 rounded cursor-pointer ${n===null?"bg-indigo-100 text-indigo-800 font-bold":"text-gray-600 hover:bg-gray-200"}`,children:[e.jsx(i,{size:16})," Data Root"]})}),e.jsxs("div",{className:"flex-1 overflow-y-auto p-2",children:[n&&e.jsxs("button",{onClick:()=>t(null),className:"flex items-center gap-2 p-2 text-xs text-indigo-600 w-full hover:bg-gray-200 rounded mb-2 font-medium cursor-pointer",children:[e.jsx(x,{className:"rotate-180",size:14})," Back to Root"]}),e.jsx("div",{className:"text-xs uppercase font-semibold text-gray-400 px-2 py-1 mb-1",children:"Current Path Nodes"}),r.filter(s=>s.type==="dir").map(s=>e.jsxs("button",{onClick:()=>{t(s.id),a(null)},className:"w-full text-left p-2 rounded text-sm text-gray-700 hover:bg-gray-200 flex items-center gap-2 group mb-1 cursor-pointer",children:[e.jsx(i,{size:14,className:"text-indigo-400 group-hover:text-indigo-600"}),e.jsx("span",{className:"truncate",children:s.name})]},s.id))]})]}),e.jsx("div",{className:"flex-1 flex flex-col bg-white overflow-hidden min-w-0",children:l?e.jsxs("div",{className:"flex-1 flex flex-col h-full min-h-0",children:[e.jsxs("div",{className:"p-3 border-b border-gray-100 bg-gray-50 flex items-center gap-2 shrink-0",children:[e.jsx("button",{onClick:()=>a(null),className:"text-gray-500 hover:text-gray-700 cursor-pointer",children:e.jsx(c,{size:16})}),e.jsxs("span",{className:"text-sm font-medium text-gray-700",children:["Previewing: ",l.name]})]}),l.name.endsWith(".html")||l.name.endsWith(".htm")||l.content?.includes("<html")?e.jsx("div",{className:"flex-1 relative bg-gray-50",children:e.jsx(o,{coursewareId:l.id})}):e.jsx("div",{className:"flex-1 overflow-y-auto p-6 bg-white prose prose-sm max-w-none",children:e.jsx(m,{children:l.content})})]}):e.jsx("div",{className:"flex-1 p-6 overflow-y-auto",children:e.jsxs("div",{className:"grid grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-4",children:[r.length===0&&e.jsx("div",{className:"col-span-full h-32 flex items-center justify-center text-sm text-gray-400 italic",children:"This directory is empty."}),r.map(s=>e.jsxs("div",{onClick:()=>{s.type==="dir"?t(s.id):a({id:s.id,name:s.name,content:s.content||"*(Empty file)*"})},className:"border border-gray-200 hover:border-indigo-300 hover:shadow-md cursor-pointer rounded-xl p-4 flex flex-col gap-3 transition-all bg-white",children:[e.jsx("div",{className:"p-3 rounded-xl w-12 h-12 flex items-center justify-center shrink-0 shadow-sm bg-gray-50 border border-gray-100",children:s.type==="dir"?e.jsx(i,{size:24,className:"text-indigo-500"}):e.jsx(d,{size:24,className:"text-gray-500"})}),e.jsx("div",{className:"text-sm font-medium text-gray-800 break-words",children:s.name})]},s.id))]})})})]})}function y(r){return r.isOpen?e.jsx("div",{className:"fixed inset-0 bg-gray-900/40 backdrop-blur-sm flex items-center justify-center p-6 z-50",children:e.jsxs("div",{className:"bg-white border text-gray-900 border-gray-200 rounded-2xl shadow-2xl w-full max-w-5xl h-[85vh] 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 shrink-0",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(i,{size:20,className:"text-indigo-600"}),e.jsx("h2",{className:"font-semibold text-gray-800 text-lg",children:"Cloud Course Resource Browser"})]}),e.jsx("button",{onClick:r.onClose,className:"text-gray-400 hover:text-gray-600 font-bold p-1 hover:bg-gray-200 rounded transition-colors cursor-pointer",children:"×"})]}),e.jsx(g,{...r})]})}):null}export{y as CloudDriveModal,g as CloudDrivePanel};
1
+ import{j as e}from"./vendor-react-0Lg0vA-4.js";import{L as o}from"./LazyCourseware-Bcxn_20f.js";import{a9 as i,Z as x,X as c,a5 as d}from"./vendor-icons-BvCtGbt1.js";import{M as m}from"./index-BrEBeWAQ.js";import"./vendor-pdf-CVyNPGVr.js";function g({vfsNodes:r,currentVfsParent:n,setCurrentVfsParent:t,cloudDrivePreviewNode:l,setCloudDrivePreviewNode:a}){return e.jsxs("div",{className:"flex-1 flex overflow-hidden min-h-0",children:[e.jsxs("div",{className:"w-64 border-r border-gray-100 flex flex-col bg-gray-50 shrink-0",children:[e.jsx("div",{className:"p-3 border-b border-gray-200 flex items-center gap-2",children:e.jsxs("button",{onClick:()=>{t(null),a(null)},className:`text-sm font-medium w-full text-left flex items-center gap-2 p-2 rounded cursor-pointer ${n===null?"bg-indigo-100 text-indigo-800 font-bold":"text-gray-600 hover:bg-gray-200"}`,children:[e.jsx(i,{size:16})," Data Root"]})}),e.jsxs("div",{className:"flex-1 overflow-y-auto p-2",children:[n&&e.jsxs("button",{onClick:()=>t(null),className:"flex items-center gap-2 p-2 text-xs text-indigo-600 w-full hover:bg-gray-200 rounded mb-2 font-medium cursor-pointer",children:[e.jsx(x,{className:"rotate-180",size:14})," Back to Root"]}),e.jsx("div",{className:"text-xs uppercase font-semibold text-gray-400 px-2 py-1 mb-1",children:"Current Path Nodes"}),r.filter(s=>s.type==="dir").map(s=>e.jsxs("button",{onClick:()=>{t(s.id),a(null)},className:"w-full text-left p-2 rounded text-sm text-gray-700 hover:bg-gray-200 flex items-center gap-2 group mb-1 cursor-pointer",children:[e.jsx(i,{size:14,className:"text-indigo-400 group-hover:text-indigo-600"}),e.jsx("span",{className:"truncate",children:s.name})]},s.id))]})]}),e.jsx("div",{className:"flex-1 flex flex-col bg-white overflow-hidden min-w-0",children:l?e.jsxs("div",{className:"flex-1 flex flex-col h-full min-h-0",children:[e.jsxs("div",{className:"p-3 border-b border-gray-100 bg-gray-50 flex items-center gap-2 shrink-0",children:[e.jsx("button",{onClick:()=>a(null),className:"text-gray-500 hover:text-gray-700 cursor-pointer",children:e.jsx(c,{size:16})}),e.jsxs("span",{className:"text-sm font-medium text-gray-700",children:["Previewing: ",l.name]})]}),l.name.endsWith(".html")||l.name.endsWith(".htm")||l.content?.includes("<html")?e.jsx("div",{className:"flex-1 relative bg-gray-50",children:e.jsx(o,{coursewareId:l.id})}):e.jsx("div",{className:"flex-1 overflow-y-auto p-6 bg-white prose prose-sm max-w-none",children:e.jsx(m,{children:l.content})})]}):e.jsx("div",{className:"flex-1 p-6 overflow-y-auto",children:e.jsxs("div",{className:"grid grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-4",children:[r.length===0&&e.jsx("div",{className:"col-span-full h-32 flex items-center justify-center text-sm text-gray-400 italic",children:"This directory is empty."}),r.map(s=>e.jsxs("div",{onClick:()=>{s.type==="dir"?t(s.id):a({id:s.id,name:s.name,content:s.content||"*(Empty file)*"})},className:"border border-gray-200 hover:border-indigo-300 hover:shadow-md cursor-pointer rounded-xl p-4 flex flex-col gap-3 transition-all bg-white",children:[e.jsx("div",{className:"p-3 rounded-xl w-12 h-12 flex items-center justify-center shrink-0 shadow-sm bg-gray-50 border border-gray-100",children:s.type==="dir"?e.jsx(i,{size:24,className:"text-indigo-500"}):e.jsx(d,{size:24,className:"text-gray-500"})}),e.jsx("div",{className:"text-sm font-medium text-gray-800 break-words",children:s.name})]},s.id))]})})})]})}function y(r){return r.isOpen?e.jsx("div",{className:"fixed inset-0 bg-gray-900/40 backdrop-blur-sm flex items-center justify-center p-6 z-50",children:e.jsxs("div",{className:"bg-white border text-gray-900 border-gray-200 rounded-2xl shadow-2xl w-full max-w-5xl h-[85vh] 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 shrink-0",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(i,{size:20,className:"text-indigo-600"}),e.jsx("h2",{className:"font-semibold text-gray-800 text-lg",children:"Cloud Course Resource Browser"})]}),e.jsx("button",{onClick:r.onClose,className:"text-gray-400 hover:text-gray-600 font-bold p-1 hover:bg-gray-200 rounded transition-colors cursor-pointer",children:"×"})]}),e.jsx(g,{...r})]})}):null}export{y as CloudDriveModal,g as CloudDrivePanel};
@@ -1,8 +1,8 @@
1
- import{r as d,j as e}from"./vendor-react-0Lg0vA-4.js";import{A as V,m as $}from"./vendor-motion-Dz5URUo4.js";import{am as X,X as H,O as B,W as J,p as q,an as K,g as Y,U as Q,f as Z,F as ee,l as se,ao as te,a6 as le,a9 as ae,ag as ne,b as U,ap as G,x as re,i as ie}from"./vendor-icons-BvCtGbt1.js";import{E as oe}from"./index-BxA9vp--.js";import"./vendor-utils-4FcTwKPj.js";import"./vendor-pdf-CVyNPGVr.js";import"./vendor-charts-B7ViBL9w.js";function de({classes:c,lessons:n,lang:g,onScheduleClass:z,onGenerateAssignment:A,onCreateLesson:E}){const[x,v]=d.useState(!1),[r,h]=d.useState("menu"),[y,N]=d.useState(""),[w,p]=d.useState(""),[C,T]=d.useState(""),[k,L]=d.useState(""),[D,F]=d.useState(""),[P,M]=d.useState(""),[S,I]=d.useState(""),[_,f]=d.useState(!1),[O,l]=d.useState(!1),[u,i]=d.useState(null),s={zh:{quickActions:"快捷操作指令",quickDesc:"无需切换页面,在此直接向教育总线或班级下发运行调度命令。",scheduleClass:"排课计划调度",scheduleDesc:"为班级分配课程段并指定授课时间",generateAssignment:"生成 AI 测验任务",generateDesc:"利用代理模型为班级定制专属能力题目",createLesson:"注册教学课件",createDesc:"发布新的富文本 Markdown 教材大纲",back:"返回上级",confirm:"确认并下发指令",classSelect:"选择目标班级",lessonSelect:"选择关联课件",dateSelect:"授课日期选择",assignmentTopic:"测验主题方向 / 核心知识点",assignmentTopicPlaceholder:"例: 一元二次方程,光合作用,牛顿运动定律等...",lessonTitle:"课件名称(大纲标题)",lessonTitlePlaceholder:"例: 量子力学初步 / 物理实验基础",lessonContent:"详细授课内容 (Markdown 支持)",successScheduled:"排课成功!总线已捕获日程数据。",successAssignment:"AI 测验任务成功生成,稍后同步。",successLesson:"新课件发布成功!画板白板可直接拖拽加载。",emptyClasses:"未检测到活跃班级",emptyLessons:"未检测到可用课件",loadingBus:"内核微服务运行中...",genericError:"网络或核指令总线调用失败,请重试"},en:{quickActions:"Quick Actions",quickDesc:"Deploy scheduler and class orchestration bus commands instantly from here.",scheduleClass:"Schedule Lesson Period",scheduleDesc:"Assign a lesson package and scheduled date to an active class",generateAssignment:"Generate AI Assignment",generateDesc:"Deploy agent workflows to design tailored student test cases",createLesson:"Register Lesson Curriculum",createDesc:"Publish new rich Markdown-based whiteboard syllabus",back:"Back",confirm:"Execute Command",classSelect:"Select Class",lessonSelect:"Select Lesson Template",dateSelect:"Choose Scheduled Date",assignmentTopic:"Assignment Topic / Target Knowledge",assignmentTopicPlaceholder:"e.g., Quadratic equations, Photosynthesis, Newtonian gravity...",lessonTitle:"Lesson Curriculum Title",lessonTitlePlaceholder:"e.g., Intro to Quantum Mechanics",lessonContent:"Whiteboard Curriculum Content (Markdown)",successScheduled:"Success! Dynamic class schedule updated.",successAssignment:"Success! AI is compiling custom quiz structures.",successLesson:"Success! Ready to orchestrate inside classroom sandbox.",emptyClasses:"No classes discovered",emptyLessons:"No lessons discovered",loadingBus:"Interfacing core services...",genericError:"System bus execute command failure, please retry"}}[g],a=()=>{N(""),p(""),T(""),L(""),F(""),M(""),I(""),i(null),l(!1),f(!1)},o=()=>{switch(r){case"schedule":return s.successScheduled;case"assignment":return s.successAssignment;case"lesson":return s.successLesson;default:return""}},b=t=>{a(),h(t),c.length>0&&(N(c[0].id),L(c[0].id)),n.length>0&&p(n[0].id),t==="lesson"&&I(`# 新课件名称
1
+ import{r as c,j as e}from"./vendor-react-0Lg0vA-4.js";import{A as V,m as $}from"./vendor-motion-Dz5URUo4.js";import{am as X,X as H,O as B,W as J,p as q,an as K,g as Y,U as Q,f as Z,F as ee,l as se,ao as te,a6 as le,a9 as ae,ag as ne,b as U,ap as G,x as re,i as ie}from"./vendor-icons-BvCtGbt1.js";import{E as oe}from"./index-eXp-qZdm.js";import"./vendor-utils-4FcTwKPj.js";import"./vendor-pdf-CVyNPGVr.js";import"./vendor-charts-B7ViBL9w.js";function de({classes:x,lessons:n,lang:g,onScheduleClass:z,onGenerateAssignment:A,onCreateLesson:E}){const[m,v]=c.useState(!1),[r,h]=c.useState("menu"),[y,N]=c.useState(""),[w,p]=c.useState(""),[C,T]=c.useState(""),[k,L]=c.useState(""),[D,F]=c.useState(""),[P,M]=c.useState(""),[S,I]=c.useState(""),[_,f]=c.useState(!1),[O,l]=c.useState(!1),[o,i]=c.useState(null),s={zh:{quickActions:"快捷操作指令",quickDesc:"无需切换页面,在此直接向教育总线或班级下发运行调度命令。",scheduleClass:"排课计划调度",scheduleDesc:"为班级分配课程段并指定授课时间",generateAssignment:"生成 AI 测验任务",generateDesc:"利用代理模型为班级定制专属能力题目",createLesson:"注册教学课件",createDesc:"发布新的富文本 Markdown 教材大纲",back:"返回上级",confirm:"确认并下发指令",classSelect:"选择目标班级",lessonSelect:"选择关联课件",dateSelect:"授课日期选择",assignmentTopic:"测验主题方向 / 核心知识点",assignmentTopicPlaceholder:"例: 一元二次方程,光合作用,牛顿运动定律等...",lessonTitle:"课件名称(大纲标题)",lessonTitlePlaceholder:"例: 量子力学初步 / 物理实验基础",lessonContent:"详细授课内容 (Markdown 支持)",successScheduled:"排课成功!总线已捕获日程数据。",successAssignment:"AI 测验任务成功生成,稍后同步。",successLesson:"新课件发布成功!画板白板可直接拖拽加载。",emptyClasses:"未检测到活跃班级",emptyLessons:"未检测到可用课件",loadingBus:"内核微服务运行中...",genericError:"网络或核指令总线调用失败,请重试"},en:{quickActions:"Quick Actions",quickDesc:"Deploy scheduler and class orchestration bus commands instantly from here.",scheduleClass:"Schedule Lesson Period",scheduleDesc:"Assign a lesson package and scheduled date to an active class",generateAssignment:"Generate AI Assignment",generateDesc:"Deploy agent workflows to design tailored student test cases",createLesson:"Register Lesson Curriculum",createDesc:"Publish new rich Markdown-based whiteboard syllabus",back:"Back",confirm:"Execute Command",classSelect:"Select Class",lessonSelect:"Select Lesson Template",dateSelect:"Choose Scheduled Date",assignmentTopic:"Assignment Topic / Target Knowledge",assignmentTopicPlaceholder:"e.g., Quadratic equations, Photosynthesis, Newtonian gravity...",lessonTitle:"Lesson Curriculum Title",lessonTitlePlaceholder:"e.g., Intro to Quantum Mechanics",lessonContent:"Whiteboard Curriculum Content (Markdown)",successScheduled:"Success! Dynamic class schedule updated.",successAssignment:"Success! AI is compiling custom quiz structures.",successLesson:"Success! Ready to orchestrate inside classroom sandbox.",emptyClasses:"No classes discovered",emptyLessons:"No lessons discovered",loadingBus:"Interfacing core services...",genericError:"System bus execute command failure, please retry"}}[g],a=()=>{N(""),p(""),T(""),L(""),F(""),M(""),I(""),i(null),l(!1),f(!1)},d=()=>{switch(r){case"schedule":return s.successScheduled;case"assignment":return s.successAssignment;case"lesson":return s.successLesson;default:return""}},b=t=>{a(),h(t),x.length>0&&(N(x[0].id),L(x[0].id)),n.length>0&&p(n[0].id),t==="lesson"&&I(`# 新课件名称
2
2
 
3
3
  ## 教学目标
4
4
  - 掌握核心考点
5
5
  - 熟练完成基础物理实验
6
6
 
7
7
  ## 课堂探究
8
- 这里写课本的主要讲授要点。`)},j=async t=>{t.preventDefault(),f(!0),i(null);try{let m=!1;if(r==="schedule"){if(!y||!w||!C){i("Please complete all form fields."),f(!1);return}m=await z(y,w,C)}else if(r==="assignment"){if(!k||!D.trim()){i("Please specify target class and a valid topic."),f(!1);return}m=await A(k,D.trim())}else if(r==="lesson"){if(!P.trim()||!S.trim()){i("Title and Content can not be empty."),f(!1);return}m=await E(P.trim(),S.trim())}m?(l(!0),setTimeout(()=>{l(!1),h("menu")},2200)):i(s.genericError)}catch(m){i(m.message||s.genericError)}finally{f(!1)}};return e.jsxs("div",{id:"quick-actions-fab-container",className:"absolute bottom-8 right-8 z-40 flex flex-col items-end",children:[e.jsx(V,{children:x&&e.jsxs($.div,{initial:{opacity:0,y:15,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:15,scale:.95},transition:{duration:.18},className:"mb-4 w-[360px] sm:w-[420px] bg-white border border-gray-200 rounded-2xl shadow-xl overflow-hidden flex flex-col focus:outline-none",id:"quick-actions-popup-card",children:[e.jsxs("div",{className:"bg-indigo-600 px-5 py-4 text-white flex items-center justify-between shadow-inner",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(X,{size:18,className:"animate-pulse"}),e.jsx("h3",{className:"font-bold text-sm tracking-wide",children:s.quickActions})]}),e.jsx("button",{onClick:()=>{v(!1),h("menu")},className:"text-white/80 hover:text-white hover:bg-white/15 p-1 rounded-full transition-all focus:outline-none",title:"Close Portal",children:e.jsx(H,{size:16})})]}),e.jsxs("div",{className:"p-5 max-h-[480px] overflow-y-auto bg-gray-50/50",children:[r==="menu"&&e.jsxs("div",{className:"space-y-4",children:[e.jsx("p",{className:"text-[11px] text-gray-500 leading-relaxed font-medium bg-indigo-50/50 border border-indigo-100 p-2.5 rounded-lg mb-4",children:s.quickDesc}),e.jsxs("div",{onClick:()=>b("schedule"),className:"flex items-start gap-3.5 p-3.5 bg-white border border-gray-200 hover:border-indigo-400 hover:shadow-md rounded-xl cursor-pointer transition-all hover:scale-101 group",id:"action-schedule-class",children:[e.jsx("div",{className:"p-2.5 bg-indigo-50 text-indigo-600 rounded-lg group-hover:bg-indigo-600 group-hover:text-white transition-colors duration-200",children:e.jsx(B,{size:18})}),e.jsxs("div",{className:"flex-1",children:[e.jsx("h4",{className:"text-xs font-bold text-gray-800 flex items-center gap-1 group-hover:text-indigo-600 transition-colors uppercase tracking-wider",children:s.scheduleClass}),e.jsx("p",{className:"text-[11px] text-gray-500 mt-1 leading-relaxed",children:s.scheduleDesc})]})]}),e.jsxs("div",{onClick:()=>b("assignment"),className:"flex items-start gap-3.5 p-3.5 bg-white border border-gray-200 hover:border-purple-400 hover:shadow-md rounded-xl cursor-pointer transition-all hover:scale-101 group",id:"action-generate-assignment",children:[e.jsx("div",{className:"p-2.5 bg-purple-50 text-purple-600 rounded-lg group-hover:bg-purple-600 group-hover:text-white transition-colors duration-200",children:e.jsx(J,{size:18})}),e.jsxs("div",{className:"flex-1",children:[e.jsx("h4",{className:"text-xs font-bold text-gray-800 flex items-center gap-1 group-hover:text-purple-600 transition-colors uppercase tracking-wider",children:s.generateAssignment}),e.jsx("p",{className:"text-[11px] text-gray-500 mt-1 leading-relaxed",children:s.generateDesc})]})]}),e.jsxs("div",{onClick:()=>b("lesson"),className:"flex items-start gap-3.5 p-3.5 bg-white border border-gray-200 hover:border-emerald-400 hover:shadow-md rounded-xl cursor-pointer transition-all hover:scale-101 group",id:"action-create-lesson",children:[e.jsx("div",{className:"p-2.5 bg-emerald-50 text-emerald-600 rounded-lg group-hover:bg-emerald-600 group-hover:text-white transition-colors duration-200",children:e.jsx(q,{size:18})}),e.jsxs("div",{className:"flex-1",children:[e.jsx("h4",{className:"text-xs font-bold text-gray-800 flex items-center gap-1 group-hover:text-emerald-600 transition-colors uppercase tracking-wider",children:s.createLesson}),e.jsx("p",{className:"text-[11px] text-gray-500 mt-1 leading-relaxed",children:s.createDesc})]})]})]}),r!=="menu"&&e.jsxs("div",{className:"relative",children:[e.jsxs("button",{onClick:()=>h("menu"),className:"flex items-center gap-1.5 text-xs text-gray-500 hover:text-indigo-600 font-semibold mb-4 cursor-pointer focus:outline-none",id:"action-back-button",children:[e.jsx(K,{size:14}),e.jsx("span",{children:s.back})]}),O?e.jsxs($.div,{initial:{scale:.95},animate:{scale:1},className:"flex flex-col items-center justify-center py-10 text-center",children:[e.jsx(Y,{size:48,className:"text-green-500 animate-bounce mb-3"}),e.jsx("h4",{className:"font-bold text-green-800 text-sm",children:o()}),e.jsx("p",{className:"text-[11px] text-gray-400 mt-1",children:"Returning to action console..."})]}):e.jsxs("form",{onSubmit:j,className:"space-y-4",children:[u&&e.jsxs("div",{className:"p-3 bg-red-50 border border-red-200 rounded-lg text-red-600 text-xs font-semibold",children:["⚠️ ",u]}),r==="schedule"&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsxs("label",{className:"text-xs font-bold text-gray-600 flex items-center gap-1",children:[e.jsx(Q,{size:12})," ",s.classSelect]}),c.length===0?e.jsx("p",{className:"text-xs italic text-red-500",children:s.emptyClasses}):e.jsx("select",{value:y,onChange:t=>N(t.target.value),className:"w-full bg-white border border-gray-200 rounded-lg p-2.5 text-xs focus:ring-2 focus:ring-indigo-500 text-gray-700 font-medium",children:c.map(t=>e.jsx("option",{value:t.id,children:t.name},t.id))})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsxs("label",{className:"text-xs font-bold text-gray-600 flex items-center gap-1",children:[e.jsx(q,{size:12})," ",s.lessonSelect]}),n.length===0?e.jsx("p",{className:"text-xs italic text-red-500",children:s.emptyLessons}):e.jsx("select",{value:w,onChange:t=>p(t.target.value),className:"w-full bg-white border border-gray-200 rounded-lg p-2.5 text-xs focus:ring-2 focus:ring-indigo-500 text-gray-700 font-medium",children:n.map(t=>e.jsx("option",{value:t.id,children:t.title},t.id))})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsxs("label",{className:"text-xs font-bold text-gray-600 flex items-center gap-1",children:[e.jsx(B,{size:12})," ",s.dateSelect]}),e.jsx("input",{type:"date",value:C,onChange:t=>T(t.target.value),className:"w-full bg-white border border-gray-200 rounded-lg p-2.5 text-xs focus:ring-2 focus:ring-indigo-500 text-gray-700 font-medium",required:!0})]})]}),r==="assignment"&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsxs("label",{className:"text-xs font-bold text-gray-600 flex items-center gap-1",children:[e.jsx(Q,{size:12})," ",s.classSelect]}),c.length===0?e.jsx("p",{className:"text-xs italic text-red-500",children:s.emptyClasses}):e.jsx("select",{value:k,onChange:t=>L(t.target.value),className:"w-full bg-white border border-gray-200 rounded-lg p-2.5 text-xs focus:ring-2 focus:ring-indigo-500 text-gray-700 font-medium",children:c.map(t=>e.jsx("option",{value:t.id,children:t.name},t.id))})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsxs("label",{className:"text-xs font-bold text-gray-600 flex items-center gap-1",children:[e.jsx(Z,{size:12})," ",s.assignmentTopic]}),e.jsx("input",{type:"text",value:D,onChange:t=>F(t.target.value),placeholder:s.assignmentTopicPlaceholder,className:"w-full bg-white border border-gray-200 rounded-lg p-2.5 text-xs focus:ring-2 focus:ring-indigo-500 text-gray-700 font-medium",required:!0})]})]}),r==="lesson"&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsxs("label",{className:"text-xs font-bold text-gray-600 flex items-center gap-1",children:[e.jsx(ee,{size:12})," ",s.lessonTitle]}),e.jsx("input",{type:"text",value:P,onChange:t=>M(t.target.value),placeholder:s.lessonTitlePlaceholder,className:"w-full bg-white border border-gray-200 rounded-lg p-2.5 text-xs focus:ring-2 focus:ring-indigo-500 text-gray-700 font-medium",required:!0})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsxs("label",{className:"text-xs font-bold text-gray-600 flex items-center gap-1",children:[e.jsx(q,{size:12})," ",s.lessonContent]}),e.jsx("textarea",{value:S,onChange:t=>I(t.target.value),rows:5,className:"w-full bg-white border border-gray-200 rounded-lg p-2.5 text-xs focus:ring-2 focus:ring-indigo-500 font-mono text-gray-700",required:!0})]})]}),e.jsx("button",{type:"submit",disabled:_||r==="schedule"&&(c.length===0||n.length===0)||r==="assignment"&&c.length===0,className:"w-full bg-indigo-600 hover:bg-indigo-700 text-white font-bold text-xs py-2.5 px-4 rounded-xl flex items-center justify-center gap-2 cursor-pointer transition-all shadow-md active:scale-98 disabled:opacity-50",children:_?e.jsxs(e.Fragment,{children:[e.jsx(se,{size:14,className:"animate-spin"}),e.jsx("span",{children:s.loadingBus})]}):e.jsxs(e.Fragment,{children:[e.jsx(te,{size:13}),e.jsx("span",{children:s.confirm})]})})]})]})]})]})}),e.jsxs("button",{onClick:()=>{v(!x),h("menu")},className:"w-14 h-14 bg-indigo-600 hover:bg-indigo-700 text-white rounded-full flex items-center justify-center shadow-lg hover:shadow-indigo-200 hover:shadow-2xl transition-all duration-250 cursor-pointer active:scale-95 focus:outline-none relative group",title:"Trigger Education OS Quick Scheduler Command Panel",id:"quick-actions-fab-button",children:[e.jsx("span",{className:"absolute inline-flex h-full w-full rounded-full bg-purple-400 opacity-20 group-hover:animate-ping"}),e.jsx($.div,{animate:{rotate:x?135:0},transition:{duration:.2},className:"flex items-center justify-center text-white",children:e.jsx(le,{size:24,strokeWidth:2.8})})]})]})}function fe(c){const{lang:n,t:g,lessons:z,classes:A,students:E,todaySchedules:x,approvals:v,processes:r,isApprovalsCollapsed:h,setIsApprovalsCollapsed:y,isProcessesCollapsed:N,setIsProcessesCollapsed:w,scoreOverrides:p,setScoreOverrides:C,handleApprove:T,handleReject:k,showLogs:L,setShowLogs:D,processLogsContent:F,showProcessLogs:P,fetchProcessLogs:M,setShowProcessLogs:S,addToast:I,handleQuickScheduleClass:_,handleQuickGenerateAssignment:f,handleQuickCreateLesson:O}=c;return e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex-1 flex flex-col gap-6 h-full overflow-y-auto pr-2",children:[(()=>{const l=a=>{if(a.status==="cancelled"||a.status==="holiday")return!1;if(!a.time_slot)return!0;try{const o=a.time_slot.split("-");if(o.length<2)return!0;const b=o[1].trim(),[j,t]=b.split(":").map(Number),m=new Date,R=m.getHours(),W=m.getMinutes();return!(R>j||R===j&&W>=t)}catch{return!0}},u=x.filter(l),i=x.length-u.length;x.filter(a=>a.status==="cancelled"||a.status==="holiday");const s=u[0];return e.jsxs("div",{className:"bg-white border border-slate-200/80 rounded-2xl p-5 text-slate-800 shadow-sm flex flex-col md:flex-row justify-between items-stretch gap-6 transition-all duration-300",children:[e.jsx("div",{className:"flex-1 flex flex-col justify-between bg-slate-50/50 rounded-xl p-4.5 border border-slate-200/60 min-h-[160px]",children:s?e.jsxs("div",{className:"flex-1 flex flex-col justify-between",children:[e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"bg-amber-400 text-slate-950 text-[10px] font-extrabold px-2.5 py-0.5 rounded-full uppercase tracking-wider animate-pulse shadow-xs",children:n==="zh"?"下一堂面授课":"NEXT CLASS"}),e.jsx("span",{className:"font-mono text-xs text-indigo-700 font-bold bg-indigo-50 px-2 py-0.5 rounded-md border border-indigo-100/30",children:s.time_slot})]}),e.jsx("h3",{className:"text-lg md:text-xl font-extrabold tracking-tight mt-3 text-slate-800 line-clamp-2",title:s.lesson_title,children:s.lesson_title}),e.jsxs("p",{className:"text-xs text-slate-500 mt-2 font-medium",children:["📍 ",s.class_name," ",s.classroom&&` | 教室: ${s.classroom}`," ",s.teacher_name&&` | 教师: ${s.teacher_name}`]})]}),s.notes&&e.jsxs("div",{className:"mt-3 text-xs italic text-indigo-700 bg-indigo-50/60 p-2 rounded-lg border border-indigo-100/40 truncate",title:s.notes,children:["* ",s.notes]})]}):e.jsxs("div",{className:"flex-1 flex flex-col justify-center items-center text-center py-6 select-none",children:[e.jsx("span",{className:"text-3xl animate-bounce",children:"☕"}),e.jsx("h3",{className:"text-base font-extrabold text-slate-850 mt-2",children:n==="zh"?"今日课程已全部结束":"All Classes Finished"}),e.jsx("p",{className:"text-xs text-slate-455 mt-1 max-w-[280px]",children:n==="zh"?"接下来暂无排定课次,您可以休息调整。":"No remaining schedules today. Take a rest!"})]})}),e.jsxs("div",{className:"w-full md:w-[300px] lg:w-[350px] flex flex-col gap-3",children:[e.jsxs("div",{className:"flex justify-between items-center border-b border-slate-200/80 pb-2",children:[e.jsxs("span",{className:"text-[11px] uppercase font-extrabold tracking-wider text-indigo-600 flex items-center gap-1.5",children:["📅 ",n==="zh"?"今日面授排课流":"TODAY'S SCHEDULES"]}),e.jsx("span",{className:"text-[10px] text-slate-500 font-medium",children:n==="zh"?`共 ${x.length} 节 | 已下课 ${i} 节`:`Total ${x.length} | Done ${i}`})]}),x.length===0?e.jsxs("div",{className:"flex-1 flex items-center justify-center text-xs font-bold text-slate-450 py-6",children:["☕ ",n==="zh"?"今日暂无排定课次":"No schedules configured."]}):e.jsx("div",{className:"space-y-2 max-h-[150px] overflow-y-auto pr-1",children:x.map(a=>{const o=s&&a.id===s.id,b=u.some(m=>m.id===a.id)&&!o,j=a.status==="cancelled"||a.status==="holiday",t=!o&&!b&&!j;return e.jsxs("div",{className:`flex items-center justify-between text-xs py-1 border-b border-slate-100 last:border-b-0 ${t?"opacity-50":j?"opacity-35 line-through":""}`,children:[e.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[e.jsx("span",{className:"font-mono text-[10px] text-slate-500 shrink-0",children:a.time_slot}),e.jsx("span",{className:`font-bold truncate max-w-[120px] lg:max-w-[150px] ${o?"text-indigo-650":"text-slate-700"}`,title:a.lesson_title,children:a.lesson_title}),e.jsxs("span",{className:"text-[9px] text-slate-455 truncate max-w-[60px] lg:max-w-[80px]",children:["(",a.class_name,")"]})]}),e.jsxs("div",{className:"shrink-0 ml-2",children:[o&&e.jsx("span",{className:"bg-amber-400 text-slate-950 font-extrabold text-[8px] px-1.5 py-0.5 rounded uppercase scale-90 inline-block animate-pulse shadow-xs",children:"进行"}),t&&e.jsx("span",{className:"bg-slate-100 text-slate-500 text-[8px] px-1.5 py-0.5 rounded font-bold",children:"已完"}),b&&e.jsx("span",{className:"bg-indigo-50 text-indigo-700 text-[8px] px-1.5 py-0.5 rounded font-medium border border-indigo-100/50",children:"待上"}),j&&e.jsx("span",{className:"bg-rose-50 text-rose-600 text-[8px] px-1.5 py-0.5 rounded font-bold border border-rose-100/50",children:"停课"})]})]},a.id)})})]})]})})(),e.jsx(oe,{slot:"teacher.dashboard.widget"}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-5",children:[e.jsxs("div",{className:"bg-gradient-to-br from-indigo-50/60 to-indigo-100/10 border border-indigo-100/60 rounded-2xl p-5 shadow-xs flex items-center justify-between hover:shadow-sm hover:-translate-y-0.5 transition-all duration-300",children:[e.jsxs("div",{className:"flex flex-col gap-1",children:[e.jsx("span",{className:"text-xs font-bold text-indigo-655 uppercase tracking-wider",children:n==="zh"?"课程数量":"Total Courses"}),e.jsx("span",{className:"text-3xl font-extrabold text-slate-800 tracking-tight leading-none mt-1",children:z.length})]}),e.jsx("div",{className:"p-3 bg-indigo-500/10 text-indigo-600 rounded-xl",children:e.jsx(q,{size:24})})]}),e.jsxs("div",{className:"bg-gradient-to-br from-pink-50/60 to-pink-100/10 border border-pink-100/60 rounded-2xl p-5 shadow-xs flex items-center justify-between hover:shadow-sm hover:-translate-y-0.5 transition-all duration-300",children:[e.jsxs("div",{className:"flex flex-col gap-1",children:[e.jsx("span",{className:"text-xs font-bold text-pink-600 uppercase tracking-wider",children:n==="zh"?"班级数量":"Total Classes"}),e.jsx("span",{className:"text-3xl font-extrabold text-slate-800 tracking-tight leading-none mt-1",children:A.length})]}),e.jsx("div",{className:"p-3 bg-pink-500/10 text-pink-600 rounded-xl",children:e.jsx(ae,{size:24})})]}),e.jsxs("div",{className:"bg-gradient-to-br from-emerald-50/60 to-emerald-100/10 border border-emerald-100/60 rounded-2xl p-5 shadow-xs flex items-center justify-between hover:shadow-sm hover:-translate-y-0.5 transition-all duration-300",children:[e.jsxs("div",{className:"flex flex-col gap-1",children:[e.jsx("span",{className:"text-xs font-bold text-emerald-650 uppercase tracking-wider",children:n==="zh"?"学生数量":"Total Students"}),e.jsx("span",{className:"text-3xl font-extrabold text-slate-800 tracking-tight leading-none mt-1",children:E.length})]}),e.jsx("div",{className:"p-3 bg-emerald-500/10 text-emerald-600 rounded-xl",children:e.jsx(Q,{size:24})})]})]}),e.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-6 items-start",children:[e.jsxs("div",{className:"bg-white border border-rose-100 rounded-2xl shadow-sm flex flex-col transition-all duration-300",children:[e.jsxs("div",{onClick:()=>y(!h),className:"p-4 border-b border-rose-50 flex items-center justify-between cursor-pointer select-none hover:bg-rose-50/20 rounded-t-2xl transition-colors",children:[e.jsxs("h3",{className:"font-extrabold text-sm md:text-base text-rose-700 flex items-center gap-2",children:[e.jsx(ne,{size:18}),g.approvals,v.length>0&&e.jsx("span",{className:"bg-rose-100 text-rose-700 text-xs px-2 py-0.5 rounded-full font-bold ml-1",children:v.length})]}),e.jsx("div",{className:"text-rose-400 hover:text-rose-600 transition-colors",children:h?e.jsx(U,{size:18}):e.jsx(G,{size:18})})]}),!h&&e.jsx("div",{className:"flex-1 overflow-y-auto p-3 max-h-[350px]",children:v.length===0?e.jsx("div",{className:"text-center p-8 text-xs md:text-sm text-slate-400 font-medium",children:g.noApprovals}):v.map(l=>{let u={};try{u=JSON.parse(l.payload||"{}")}catch{}const i=l.command_type==="ai.apply_grade",s=p[l.id]!==void 0?p[l.id]:u.score||0;return e.jsxs("div",{className:"w-full p-4 rounded-xl text-sm bg-slate-55 border border-slate-100 mb-3 shadow-3xs flex flex-col gap-3 hover:border-rose-150 transition-colors",children:[e.jsxs("div",{children:[e.jsx("div",{className:"font-extrabold text-slate-800 mb-1",children:l.command_type==="ai.apply_grade"?"🎓 Evaluate Submission":l.command_type}),e.jsx("div",{className:"text-xs text-slate-500 font-mono mb-2 line-clamp-2 bg-white border border-slate-100 p-2 rounded-lg",title:l.payload,children:i?`Feedback: ${u.feedback}`:l.payload})]}),i&&e.jsxs("div",{className:"bg-white border border-slate-150 p-2 rounded-xl flex items-center justify-between gap-3",children:[e.jsx("label",{className:"text-xs font-bold text-slate-700",children:"Modify Score:"}),e.jsx("input",{type:"number",className:"w-20 border border-slate-200 rounded-lg px-2 py-1 text-xs focus:ring-2 focus:ring-indigo-500 outline-none transition-all",value:s,onChange:a=>C(o=>({...o,[l.id]:parseInt(a.target.value)||0}))})]}),e.jsxs("div",{className:"flex gap-2 justify-end mt-1",children:[e.jsxs("button",{onClick:()=>T(l.id,i&&p[l.id]!==void 0?{score:p[l.id]}:void 0),className:"p-1.5 px-3.5 bg-rose-600 hover:bg-rose-700 text-white rounded-lg font-bold text-xs flex items-center gap-1.5 shadow-sm transition-all animate-none",children:[e.jsx(re,{size:14})," ",g.approve]}),e.jsxs("button",{onClick:()=>k(l.id),className:"p-1.5 px-3.5 bg-slate-100 hover:bg-slate-200 text-slate-750 rounded-lg font-bold text-xs flex items-center gap-1.5 shadow-3xs transition-all",children:[e.jsx(H,{size:14})," ",g.reject]})]})]},l.id)})})]}),e.jsxs("div",{className:"bg-white border border-slate-200/60 rounded-2xl shadow-sm flex flex-col transition-all duration-300",children:[e.jsxs("div",{onClick:()=>w(!N),className:"p-4 border-b border-slate-100 flex items-center justify-between cursor-pointer select-none hover:bg-slate-50/20 rounded-t-2xl transition-colors",children:[e.jsxs("h3",{className:"font-extrabold text-sm md:text-base text-slate-700 flex items-center gap-2",children:[e.jsx(ie,{size:18,className:"text-indigo-500"}),g.processes,r.length>0&&e.jsx("span",{className:"bg-indigo-50 text-indigo-700 text-xs px-2 py-0.5 rounded-full font-bold ml-1",children:r.length})]}),e.jsx("div",{className:"text-slate-400 hover:text-slate-650 transition-colors",children:N?e.jsx(U,{size:18}):e.jsx(G,{size:18})})]}),!N&&e.jsx("div",{className:"flex-1 overflow-y-auto p-3 max-h-[350px]",children:r.length===0?e.jsx("div",{className:"text-center p-8 text-xs md:text-sm text-slate-400 font-medium",children:g.noProcesses}):r.map(l=>e.jsxs("div",{className:"w-full p-4 rounded-xl text-sm bg-slate-50 border border-slate-100 mb-3 shadow-3xs flex flex-col gap-2.5 hover:border-indigo-150 transition-colors",children:[e.jsxs("div",{className:"flex items-center justify-between mb-1",children:[e.jsx("span",{className:"font-extrabold text-slate-800 truncate",title:l.name,children:l.name}),e.jsx("span",{className:`text-[10px] uppercase px-2 py-0.5 rounded-full font-bold ${l.status==="running"?"bg-blue-100 text-blue-700":l.status==="completed"?"bg-emerald-100 text-emerald-700":l.status==="failed"?"bg-rose-100 text-rose-700":"bg-slate-200 text-slate-700"}`,children:l.status})]}),e.jsxs("div",{className:"flex justify-between items-center mt-1",children:[e.jsxs("span",{className:"text-[10px] text-slate-400 font-mono",children:["PID: ",l.id]}),e.jsx("button",{onClick:()=>S(l.id),className:"text-xs font-bold text-indigo-650 hover:text-indigo-850 transition-colors",children:g.processLogs})]})]},l.id))})]})]})]}),e.jsx(de,{classes:A,lessons:z,lang:n,onScheduleClass:_,onGenerateAssignment:f,onCreateLesson:O})]})}export{fe as Dashboard};
8
+ 这里写课本的主要讲授要点。`)},j=async t=>{t.preventDefault(),f(!0),i(null);try{let u=!1;if(r==="schedule"){if(!y||!w||!C){i("Please complete all form fields."),f(!1);return}u=await z(y,w,C)}else if(r==="assignment"){if(!k||!D.trim()){i("Please specify target class and a valid topic."),f(!1);return}u=await A(k,D.trim())}else if(r==="lesson"){if(!P.trim()||!S.trim()){i("Title and Content can not be empty."),f(!1);return}u=await E(P.trim(),S.trim())}u?(l(!0),setTimeout(()=>{l(!1),h("menu")},2200)):i(s.genericError)}catch(u){i(u.message||s.genericError)}finally{f(!1)}};return e.jsxs("div",{id:"quick-actions-fab-container",className:"absolute bottom-8 right-8 z-40 flex flex-col items-end",children:[e.jsx(V,{children:m&&e.jsxs($.div,{initial:{opacity:0,y:15,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:15,scale:.95},transition:{duration:.18},className:"mb-4 w-[360px] sm:w-[420px] bg-white border border-gray-200 rounded-2xl shadow-xl overflow-hidden flex flex-col focus:outline-none",id:"quick-actions-popup-card",children:[e.jsxs("div",{className:"bg-indigo-600 px-5 py-4 text-white flex items-center justify-between shadow-inner",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(X,{size:18,className:"animate-pulse"}),e.jsx("h3",{className:"font-bold text-sm tracking-wide",children:s.quickActions})]}),e.jsx("button",{onClick:()=>{v(!1),h("menu")},className:"text-white/80 hover:text-white hover:bg-white/15 p-1 rounded-full transition-all focus:outline-none",title:"Close Portal",children:e.jsx(H,{size:16})})]}),e.jsxs("div",{className:"p-5 max-h-[480px] overflow-y-auto bg-gray-50/50",children:[r==="menu"&&e.jsxs("div",{className:"space-y-4",children:[e.jsx("p",{className:"text-[11px] text-gray-500 leading-relaxed font-medium bg-indigo-50/50 border border-indigo-100 p-2.5 rounded-lg mb-4",children:s.quickDesc}),e.jsxs("div",{onClick:()=>b("schedule"),className:"flex items-start gap-3.5 p-3.5 bg-white border border-gray-200 hover:border-indigo-400 hover:shadow-md rounded-xl cursor-pointer transition-all hover:scale-101 group",id:"action-schedule-class",children:[e.jsx("div",{className:"p-2.5 bg-indigo-50 text-indigo-600 rounded-lg group-hover:bg-indigo-600 group-hover:text-white transition-colors duration-200",children:e.jsx(B,{size:18})}),e.jsxs("div",{className:"flex-1",children:[e.jsx("h4",{className:"text-xs font-bold text-gray-800 flex items-center gap-1 group-hover:text-indigo-600 transition-colors uppercase tracking-wider",children:s.scheduleClass}),e.jsx("p",{className:"text-[11px] text-gray-500 mt-1 leading-relaxed",children:s.scheduleDesc})]})]}),e.jsxs("div",{onClick:()=>b("assignment"),className:"flex items-start gap-3.5 p-3.5 bg-white border border-gray-200 hover:border-purple-400 hover:shadow-md rounded-xl cursor-pointer transition-all hover:scale-101 group",id:"action-generate-assignment",children:[e.jsx("div",{className:"p-2.5 bg-purple-50 text-purple-600 rounded-lg group-hover:bg-purple-600 group-hover:text-white transition-colors duration-200",children:e.jsx(J,{size:18})}),e.jsxs("div",{className:"flex-1",children:[e.jsx("h4",{className:"text-xs font-bold text-gray-800 flex items-center gap-1 group-hover:text-purple-600 transition-colors uppercase tracking-wider",children:s.generateAssignment}),e.jsx("p",{className:"text-[11px] text-gray-500 mt-1 leading-relaxed",children:s.generateDesc})]})]}),e.jsxs("div",{onClick:()=>b("lesson"),className:"flex items-start gap-3.5 p-3.5 bg-white border border-gray-200 hover:border-emerald-400 hover:shadow-md rounded-xl cursor-pointer transition-all hover:scale-101 group",id:"action-create-lesson",children:[e.jsx("div",{className:"p-2.5 bg-emerald-50 text-emerald-600 rounded-lg group-hover:bg-emerald-600 group-hover:text-white transition-colors duration-200",children:e.jsx(q,{size:18})}),e.jsxs("div",{className:"flex-1",children:[e.jsx("h4",{className:"text-xs font-bold text-gray-800 flex items-center gap-1 group-hover:text-emerald-600 transition-colors uppercase tracking-wider",children:s.createLesson}),e.jsx("p",{className:"text-[11px] text-gray-500 mt-1 leading-relaxed",children:s.createDesc})]})]})]}),r!=="menu"&&e.jsxs("div",{className:"relative",children:[e.jsxs("button",{onClick:()=>h("menu"),className:"flex items-center gap-1.5 text-xs text-gray-500 hover:text-indigo-600 font-semibold mb-4 cursor-pointer focus:outline-none",id:"action-back-button",children:[e.jsx(K,{size:14}),e.jsx("span",{children:s.back})]}),O?e.jsxs($.div,{initial:{scale:.95},animate:{scale:1},className:"flex flex-col items-center justify-center py-10 text-center",children:[e.jsx(Y,{size:48,className:"text-green-500 animate-bounce mb-3"}),e.jsx("h4",{className:"font-bold text-green-800 text-sm",children:d()}),e.jsx("p",{className:"text-[11px] text-gray-400 mt-1",children:"Returning to action console..."})]}):e.jsxs("form",{onSubmit:j,className:"space-y-4",children:[o&&e.jsxs("div",{className:"p-3 bg-red-50 border border-red-200 rounded-lg text-red-600 text-xs font-semibold",children:["⚠️ ",o]}),r==="schedule"&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsxs("label",{className:"text-xs font-bold text-gray-600 flex items-center gap-1",children:[e.jsx(Q,{size:12})," ",s.classSelect]}),x.length===0?e.jsx("p",{className:"text-xs italic text-red-500",children:s.emptyClasses}):e.jsx("select",{value:y,onChange:t=>N(t.target.value),className:"w-full bg-white border border-gray-200 rounded-lg p-2.5 text-xs focus:ring-2 focus:ring-indigo-500 text-gray-700 font-medium",children:x.map(t=>e.jsx("option",{value:t.id,children:t.name},t.id))})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsxs("label",{className:"text-xs font-bold text-gray-600 flex items-center gap-1",children:[e.jsx(q,{size:12})," ",s.lessonSelect]}),n.length===0?e.jsx("p",{className:"text-xs italic text-red-500",children:s.emptyLessons}):e.jsx("select",{value:w,onChange:t=>p(t.target.value),className:"w-full bg-white border border-gray-200 rounded-lg p-2.5 text-xs focus:ring-2 focus:ring-indigo-500 text-gray-700 font-medium",children:n.map(t=>e.jsx("option",{value:t.id,children:t.title},t.id))})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsxs("label",{className:"text-xs font-bold text-gray-600 flex items-center gap-1",children:[e.jsx(B,{size:12})," ",s.dateSelect]}),e.jsx("input",{type:"date",value:C,onChange:t=>T(t.target.value),className:"w-full bg-white border border-gray-200 rounded-lg p-2.5 text-xs focus:ring-2 focus:ring-indigo-500 text-gray-700 font-medium",required:!0})]})]}),r==="assignment"&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsxs("label",{className:"text-xs font-bold text-gray-600 flex items-center gap-1",children:[e.jsx(Q,{size:12})," ",s.classSelect]}),x.length===0?e.jsx("p",{className:"text-xs italic text-red-500",children:s.emptyClasses}):e.jsx("select",{value:k,onChange:t=>L(t.target.value),className:"w-full bg-white border border-gray-200 rounded-lg p-2.5 text-xs focus:ring-2 focus:ring-indigo-500 text-gray-700 font-medium",children:x.map(t=>e.jsx("option",{value:t.id,children:t.name},t.id))})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsxs("label",{className:"text-xs font-bold text-gray-600 flex items-center gap-1",children:[e.jsx(Z,{size:12})," ",s.assignmentTopic]}),e.jsx("input",{type:"text",value:D,onChange:t=>F(t.target.value),placeholder:s.assignmentTopicPlaceholder,className:"w-full bg-white border border-gray-200 rounded-lg p-2.5 text-xs focus:ring-2 focus:ring-indigo-500 text-gray-700 font-medium",required:!0})]})]}),r==="lesson"&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsxs("label",{className:"text-xs font-bold text-gray-600 flex items-center gap-1",children:[e.jsx(ee,{size:12})," ",s.lessonTitle]}),e.jsx("input",{type:"text",value:P,onChange:t=>M(t.target.value),placeholder:s.lessonTitlePlaceholder,className:"w-full bg-white border border-gray-200 rounded-lg p-2.5 text-xs focus:ring-2 focus:ring-indigo-500 text-gray-700 font-medium",required:!0})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsxs("label",{className:"text-xs font-bold text-gray-600 flex items-center gap-1",children:[e.jsx(q,{size:12})," ",s.lessonContent]}),e.jsx("textarea",{value:S,onChange:t=>I(t.target.value),rows:5,className:"w-full bg-white border border-gray-200 rounded-lg p-2.5 text-xs focus:ring-2 focus:ring-indigo-500 font-mono text-gray-700",required:!0})]})]}),e.jsx("button",{type:"submit",disabled:_||r==="schedule"&&(x.length===0||n.length===0)||r==="assignment"&&x.length===0,className:"w-full bg-indigo-600 hover:bg-indigo-700 text-white font-bold text-xs py-2.5 px-4 rounded-xl flex items-center justify-center gap-2 cursor-pointer transition-all shadow-md active:scale-98 disabled:opacity-50",children:_?e.jsxs(e.Fragment,{children:[e.jsx(se,{size:14,className:"animate-spin"}),e.jsx("span",{children:s.loadingBus})]}):e.jsxs(e.Fragment,{children:[e.jsx(te,{size:13}),e.jsx("span",{children:s.confirm})]})})]})]})]})]})}),e.jsxs("button",{onClick:()=>{v(!m),h("menu")},className:"w-14 h-14 bg-indigo-600 hover:bg-indigo-700 text-white rounded-full flex items-center justify-center shadow-lg hover:shadow-indigo-200 hover:shadow-2xl transition-all duration-250 cursor-pointer active:scale-95 focus:outline-none relative group",title:"Trigger Education OS Quick Scheduler Command Panel",id:"quick-actions-fab-button",children:[e.jsx("span",{className:"absolute inline-flex h-full w-full rounded-full bg-purple-400 opacity-20 group-hover:animate-ping"}),e.jsx($.div,{animate:{rotate:m?135:0},transition:{duration:.2},className:"flex items-center justify-center text-white",children:e.jsx(le,{size:24,strokeWidth:2.8})})]})]})}function fe(x){const{lang:n,t:g,lessons:z,classes:A,students:E,todaySchedules:m,approvals:v,processes:r,isApprovalsCollapsed:h,setIsApprovalsCollapsed:y,isProcessesCollapsed:N,setIsProcessesCollapsed:w,scoreOverrides:p,setScoreOverrides:C,handleApprove:T,handleReject:k,showLogs:L,setShowLogs:D,processLogsContent:F,showProcessLogs:P,fetchProcessLogs:M,setShowProcessLogs:S,addToast:I,handleQuickScheduleClass:_,handleQuickGenerateAssignment:f,handleQuickCreateLesson:O}=x;return e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex-1 flex flex-col gap-6 h-full overflow-y-auto pr-2",children:[(()=>{const l=a=>{if(a.status==="cancelled"||a.status==="holiday")return!1;if(!a.time_slot)return!0;try{const d=a.time_slot.split("-");if(d.length<2)return!0;const b=d[1].trim(),[j,t]=b.split(":").map(Number),u=new Date,R=u.getHours(),W=u.getMinutes();return!(R>j||R===j&&W>=t)}catch{return!0}},o=m.filter(l),i=m.length-o.length;m.filter(a=>a.status==="cancelled"||a.status==="holiday");const s=o[0];return e.jsxs("div",{className:"bg-white border border-slate-200/80 rounded-2xl p-5 text-slate-800 shadow-sm flex flex-col md:flex-row justify-between items-stretch gap-6 transition-all duration-300",children:[e.jsx("div",{className:"flex-1 flex flex-col justify-between bg-slate-50/50 rounded-xl p-4.5 border border-slate-200/60 min-h-[160px]",children:s?e.jsxs("div",{className:"flex-1 flex flex-col justify-between",children:[e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"bg-amber-400 text-slate-950 text-[10px] font-extrabold px-2.5 py-0.5 rounded-full uppercase tracking-wider animate-pulse shadow-xs",children:n==="zh"?"下一堂面授课":"NEXT CLASS"}),e.jsx("span",{className:"font-mono text-xs text-indigo-700 font-bold bg-indigo-50 px-2 py-0.5 rounded-md border border-indigo-100/30",children:s.time_slot})]}),e.jsx("h3",{className:"text-lg md:text-xl font-extrabold tracking-tight mt-3 text-slate-800 line-clamp-2",title:s.lesson_title,children:s.lesson_title}),e.jsxs("p",{className:"text-xs text-slate-500 mt-2 font-medium",children:["📍 ",s.class_name," ",s.classroom&&` | 教室: ${s.classroom}`," ",s.teacher_name&&` | 教师: ${s.teacher_name}`]})]}),s.notes&&e.jsxs("div",{className:"mt-3 text-xs italic text-indigo-700 bg-indigo-50/60 p-2 rounded-lg border border-indigo-100/40 truncate",title:s.notes,children:["* ",s.notes]})]}):e.jsxs("div",{className:"flex-1 flex flex-col justify-center items-center text-center py-6 select-none",children:[e.jsx("span",{className:"text-3xl animate-bounce",children:"☕"}),e.jsx("h3",{className:"text-base font-extrabold text-slate-850 mt-2",children:n==="zh"?"今日课程已全部结束":"All Classes Finished"}),e.jsx("p",{className:"text-xs text-slate-455 mt-1 max-w-[280px]",children:n==="zh"?"接下来暂无排定课次,您可以休息调整。":"No remaining schedules today. Take a rest!"})]})}),e.jsxs("div",{className:"w-full md:w-[300px] lg:w-[350px] flex flex-col gap-3",children:[e.jsxs("div",{className:"flex justify-between items-center border-b border-slate-200/80 pb-2",children:[e.jsxs("span",{className:"text-[11px] uppercase font-extrabold tracking-wider text-indigo-600 flex items-center gap-1.5",children:["📅 ",n==="zh"?"今日面授排课流":"TODAY'S SCHEDULES"]}),e.jsx("span",{className:"text-[10px] text-slate-500 font-medium",children:n==="zh"?`共 ${m.length} 节 | 已下课 ${i} 节`:`Total ${m.length} | Done ${i}`})]}),m.length===0?e.jsxs("div",{className:"flex-1 flex items-center justify-center text-xs font-bold text-slate-450 py-6",children:["☕ ",n==="zh"?"今日暂无排定课次":"No schedules configured."]}):e.jsx("div",{className:"space-y-2 max-h-[150px] overflow-y-auto pr-1",children:m.map(a=>{const d=s&&a.id===s.id,b=o.some(u=>u.id===a.id)&&!d,j=a.status==="cancelled"||a.status==="holiday",t=!d&&!b&&!j;return e.jsxs("div",{className:`flex items-center justify-between text-xs py-1 border-b border-slate-100 last:border-b-0 ${t?"opacity-50":j?"opacity-35 line-through":""}`,children:[e.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[e.jsx("span",{className:"font-mono text-[10px] text-slate-500 shrink-0",children:a.time_slot}),e.jsx("span",{className:`font-bold truncate max-w-[120px] lg:max-w-[150px] ${d?"text-indigo-650":"text-slate-700"}`,title:a.lesson_title,children:a.lesson_title}),e.jsxs("span",{className:"text-[9px] text-slate-455 truncate max-w-[60px] lg:max-w-[80px]",children:["(",a.class_name,")"]})]}),e.jsxs("div",{className:"shrink-0 ml-2",children:[d&&e.jsx("span",{className:"bg-amber-400 text-slate-950 font-extrabold text-[8px] px-1.5 py-0.5 rounded uppercase scale-90 inline-block animate-pulse shadow-xs",children:"进行"}),t&&e.jsx("span",{className:"bg-slate-100 text-slate-500 text-[8px] px-1.5 py-0.5 rounded font-bold",children:"已完"}),b&&e.jsx("span",{className:"bg-indigo-50 text-indigo-700 text-[8px] px-1.5 py-0.5 rounded font-medium border border-indigo-100/50",children:"待上"}),j&&e.jsx("span",{className:"bg-rose-50 text-rose-600 text-[8px] px-1.5 py-0.5 rounded font-bold border border-rose-100/50",children:"停课"})]})]},a.id)})})]})]})})(),e.jsx(oe,{slot:"teacher.dashboard.widget"}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-5",children:[e.jsxs("div",{className:"bg-gradient-to-br from-indigo-50/60 to-indigo-100/10 border border-indigo-100/60 rounded-2xl p-5 shadow-xs flex items-center justify-between hover:shadow-sm hover:-translate-y-0.5 transition-all duration-300",children:[e.jsxs("div",{className:"flex flex-col gap-1",children:[e.jsx("span",{className:"text-xs font-bold text-indigo-655 uppercase tracking-wider",children:n==="zh"?"课程数量":"Total Courses"}),e.jsx("span",{className:"text-3xl font-extrabold text-slate-800 tracking-tight leading-none mt-1",children:z.length})]}),e.jsx("div",{className:"p-3 bg-indigo-500/10 text-indigo-600 rounded-xl",children:e.jsx(q,{size:24})})]}),e.jsxs("div",{className:"bg-gradient-to-br from-pink-50/60 to-pink-100/10 border border-pink-100/60 rounded-2xl p-5 shadow-xs flex items-center justify-between hover:shadow-sm hover:-translate-y-0.5 transition-all duration-300",children:[e.jsxs("div",{className:"flex flex-col gap-1",children:[e.jsx("span",{className:"text-xs font-bold text-pink-600 uppercase tracking-wider",children:n==="zh"?"班级数量":"Total Classes"}),e.jsx("span",{className:"text-3xl font-extrabold text-slate-800 tracking-tight leading-none mt-1",children:A.length})]}),e.jsx("div",{className:"p-3 bg-pink-500/10 text-pink-600 rounded-xl",children:e.jsx(ae,{size:24})})]}),e.jsxs("div",{className:"bg-gradient-to-br from-emerald-50/60 to-emerald-100/10 border border-emerald-100/60 rounded-2xl p-5 shadow-xs flex items-center justify-between hover:shadow-sm hover:-translate-y-0.5 transition-all duration-300",children:[e.jsxs("div",{className:"flex flex-col gap-1",children:[e.jsx("span",{className:"text-xs font-bold text-emerald-650 uppercase tracking-wider",children:n==="zh"?"学生数量":"Total Students"}),e.jsx("span",{className:"text-3xl font-extrabold text-slate-800 tracking-tight leading-none mt-1",children:E.length})]}),e.jsx("div",{className:"p-3 bg-emerald-500/10 text-emerald-600 rounded-xl",children:e.jsx(Q,{size:24})})]})]}),e.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-6 items-start",children:[e.jsxs("div",{className:"bg-white border border-rose-100 rounded-2xl shadow-sm flex flex-col transition-all duration-300",children:[e.jsxs("div",{onClick:()=>y(!h),className:"p-4 border-b border-rose-50 flex items-center justify-between cursor-pointer select-none hover:bg-rose-50/20 rounded-t-2xl transition-colors",children:[e.jsxs("h3",{className:"font-extrabold text-sm md:text-base text-rose-700 flex items-center gap-2",children:[e.jsx(ne,{size:18}),g.approvals,v.length>0&&e.jsx("span",{className:"bg-rose-100 text-rose-700 text-xs px-2 py-0.5 rounded-full font-bold ml-1",children:v.length})]}),e.jsx("div",{className:"text-rose-400 hover:text-rose-600 transition-colors",children:h?e.jsx(U,{size:18}):e.jsx(G,{size:18})})]}),!h&&e.jsx("div",{className:"flex-1 overflow-y-auto p-3 max-h-[350px]",children:v.length===0?e.jsx("div",{className:"text-center p-8 text-xs md:text-sm text-slate-400 font-medium",children:g.noApprovals}):v.map(l=>{let o={};try{o=JSON.parse(l.payload||"{}")}catch{}const i=l.command_type==="ai.apply_grade",s=p[l.id]!==void 0?p[l.id]:o.score||0;return e.jsxs("div",{className:"w-full p-4 rounded-xl text-sm bg-slate-55 border border-slate-100 mb-3 shadow-3xs flex flex-col gap-3 hover:border-rose-150 transition-colors",children:[e.jsxs("div",{children:[e.jsx("div",{className:"font-extrabold text-slate-800 mb-1",children:l.command_type==="ai.apply_grade"?"🎓 Evaluate Submission":l.command_type}),e.jsx("div",{className:"text-xs text-slate-500 font-mono mb-2 line-clamp-2 bg-white border border-slate-100 p-2 rounded-lg",title:l.payload,children:i?`Feedback: ${o.feedback}`:l.payload})]}),i&&e.jsxs("div",{className:"bg-white border border-slate-150 p-2 rounded-xl flex items-center justify-between gap-3",children:[e.jsx("label",{className:"text-xs font-bold text-slate-700",children:"Modify Score:"}),e.jsx("input",{type:"number",className:"w-20 border border-slate-200 rounded-lg px-2 py-1 text-xs focus:ring-2 focus:ring-indigo-500 outline-none transition-all",value:s,onChange:a=>C(d=>({...d,[l.id]:parseInt(a.target.value)||0}))})]}),e.jsxs("div",{className:"flex gap-2 justify-end mt-1",children:[e.jsxs("button",{onClick:()=>T(l.id,i&&p[l.id]!==void 0?{score:p[l.id]}:void 0),className:"p-1.5 px-3.5 bg-rose-600 hover:bg-rose-700 text-white rounded-lg font-bold text-xs flex items-center gap-1.5 shadow-sm transition-all animate-none",children:[e.jsx(re,{size:14})," ",g.approve]}),e.jsxs("button",{onClick:()=>k(l.id),className:"p-1.5 px-3.5 bg-slate-100 hover:bg-slate-200 text-slate-750 rounded-lg font-bold text-xs flex items-center gap-1.5 shadow-3xs transition-all",children:[e.jsx(H,{size:14})," ",g.reject]})]})]},l.id)})})]}),e.jsxs("div",{className:"bg-white border border-slate-200/60 rounded-2xl shadow-sm flex flex-col transition-all duration-300",children:[e.jsxs("div",{onClick:()=>w(!N),className:"p-4 border-b border-slate-100 flex items-center justify-between cursor-pointer select-none hover:bg-slate-50/20 rounded-t-2xl transition-colors",children:[e.jsxs("h3",{className:"font-extrabold text-sm md:text-base text-slate-700 flex items-center gap-2",children:[e.jsx(ie,{size:18,className:"text-indigo-500"}),g.processes,r.length>0&&e.jsx("span",{className:"bg-indigo-50 text-indigo-700 text-xs px-2 py-0.5 rounded-full font-bold ml-1",children:r.length})]}),e.jsx("div",{className:"text-slate-400 hover:text-slate-650 transition-colors",children:N?e.jsx(U,{size:18}):e.jsx(G,{size:18})})]}),!N&&e.jsx("div",{className:"flex-1 overflow-y-auto p-3 max-h-[350px]",children:r.length===0?e.jsx("div",{className:"text-center p-8 text-xs md:text-sm text-slate-400 font-medium",children:g.noProcesses}):r.map(l=>e.jsxs("div",{className:"w-full p-4 rounded-xl text-sm bg-slate-50 border border-slate-100 mb-3 shadow-3xs flex flex-col gap-2.5 hover:border-indigo-150 transition-colors",children:[e.jsxs("div",{className:"flex items-center justify-between mb-1",children:[e.jsx("span",{className:"font-extrabold text-slate-800 truncate",title:l.name,children:l.name}),e.jsx("span",{className:`text-[10px] uppercase px-2 py-0.5 rounded-full font-bold ${l.status==="running"?"bg-blue-100 text-blue-700":l.status==="completed"?"bg-emerald-100 text-emerald-700":l.status==="failed"?"bg-rose-100 text-rose-700":"bg-slate-200 text-slate-700"}`,children:l.status})]}),e.jsxs("div",{className:"flex justify-between items-center mt-1",children:[e.jsxs("span",{className:"text-[10px] text-slate-400 font-mono",children:["PID: ",l.id]}),e.jsx("button",{onClick:()=>S(l.id),className:"text-xs font-bold text-indigo-650 hover:text-indigo-850 transition-colors",children:g.processLogs})]})]},l.id))})]})]})]}),e.jsx(de,{classes:A,lessons:z,lang:n,onScheduleClass:_,onGenerateAssignment:async(l,o)=>!!await f(l,o,o),onCreateLesson:async(l,o)=>!!await O(l,o)})]})}export{fe as Dashboard};
@@ -1,4 +1,4 @@
1
- import{r as m,j as e}from"./vendor-react-0Lg0vA-4.js";import{E as D,a as M}from"./index-BxA9vp--.js";import{g as ge}from"./index-BxA9vp--.js";import{T as v,aq as W,p as S,U as z,a9 as _,W as R,j as C,ag as $,Z as U,i as H,l as B,y as O,g as J,X as q,aA as I,x as T,F as w,d as G,f as F,a0 as V,h as Q,s as K}from"./vendor-icons-BvCtGbt1.js";import{M as X}from"./index-BrEBeWAQ.js";import"./vendor-utils-4FcTwKPj.js";import"./vendor-pdf-CVyNPGVr.js";import"./vendor-motion-Dz5URUo4.js";import"./vendor-charts-B7ViBL9w.js";const L=r=>r.startsWith("vfs.")?"vfs":r.startsWith("lesson.")||r.startsWith("whiteboard.")?"edu":r.startsWith("class.")||r.startsWith("student.")||r.startsWith("assignment.")||r.startsWith("attendance.")||r.startsWith("schedule.")?"mgmt":r.startsWith("process.")?"proc":r.startsWith("ai.")?"ai":"plugin",P=r=>{if(!r||r.type!=="OBJECT")return"{}";const a={};return r.properties&&Object.keys(r.properties).forEach(t=>{const n=r.properties[t];n.type==="ARRAY"?a[t]=n.items?.type==="STRING"?["选项 A","选项 B","选项 C"]:[]:n.type==="INTEGER"||n.type==="NUMBER"?a[t]=100:n.type==="BOOLEAN"?a[t]=!0:t.toLowerCase().includes("id")?a[t]="auto-id-or-current":t.toLowerCase().includes("name")?a[t]="测试名称":t.toLowerCase().includes("content")?a[t]=`# 初始内容
1
+ import{r as m,j as e}from"./vendor-react-0Lg0vA-4.js";import{E as D,a as M}from"./index-eXp-qZdm.js";import{g as ge}from"./index-eXp-qZdm.js";import{T as v,aq as W,p as S,U as z,a9 as _,W as R,j as C,ag as $,Z as U,i as H,l as B,y as O,g as J,X as q,aA as I,x as T,F as w,d as G,f as F,a0 as V,h as Q,s as K}from"./vendor-icons-BvCtGbt1.js";import{M as X}from"./index-BrEBeWAQ.js";import"./vendor-utils-4FcTwKPj.js";import"./vendor-pdf-CVyNPGVr.js";import"./vendor-motion-Dz5URUo4.js";import"./vendor-charts-B7ViBL9w.js";const L=r=>r.startsWith("vfs.")?"vfs":r.startsWith("lesson.")||r.startsWith("whiteboard.")?"edu":r.startsWith("class.")||r.startsWith("student.")||r.startsWith("assignment.")||r.startsWith("attendance.")||r.startsWith("schedule.")?"mgmt":r.startsWith("process.")?"proc":r.startsWith("ai.")?"ai":"plugin",P=r=>{if(!r||r.type!=="OBJECT")return"{}";const a={};return r.properties&&Object.keys(r.properties).forEach(t=>{const n=r.properties[t];n.type==="ARRAY"?a[t]=n.items?.type==="STRING"?["选项 A","选项 B","选项 C"]:[]:n.type==="INTEGER"||n.type==="NUMBER"?a[t]=100:n.type==="BOOLEAN"?a[t]=!0:t.toLowerCase().includes("id")?a[t]="auto-id-or-current":t.toLowerCase().includes("name")?a[t]="测试名称":t.toLowerCase().includes("content")?a[t]=`# 初始内容
2
2
  这是一个通过命令创建的组件或段落。`:a[t]=n.description||"示例参数"}),JSON.stringify(a,null,2)},Y=({registeredCommands:r,onRefresh:a})=>{const[t,n]=m.useState(""),[g,h]=m.useState("all"),[b,j]=m.useState(null),[u,y]=m.useState({}),[k,f]=m.useState({}),E=[{id:"all",name:"全部命令",icon:W},{id:"edu",name:"教学与画板",icon:S},{id:"mgmt",name:"班级与学生",icon:z},{id:"vfs",name:"虚拟文件系统",icon:_},{id:"proc",name:"进程控制",icon:v},{id:"ai",name:"AI 规划生成",icon:R},{id:"plugin",name:"第三方插件",icon:C}],A=r.filter(s=>{const l=g==="all"||L(s.commandType)===g,d=t===""||s.commandType.toLowerCase().includes(t.toLowerCase())||s.description&&s.description.toLowerCase().includes(t.toLowerCase())||s.id.toLowerCase().includes(t.toLowerCase());return l&&d}),o=async(s,l)=>{f(d=>({...d,[l]:{success:!1,loading:!0}}));try{const d=u[l]||"{}";let p={};try{p=JSON.parse(d)}catch(c){f(N=>({...N,[l]:{success:!1,error:`JSON 语法解析错误: ${c.message}`,loading:!1}}));return}const i=await fetch("/api/commands/execute",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({commandType:s,payload:p})}),x=await i.json();i.ok&&x.success?(f(c=>({...c,[l]:{success:!0,data:x.result,loading:!1}})),a()):f(c=>({...c,[l]:{success:!1,error:x.error||"执行命令失败",loading:!1}}))}catch(d){f(p=>({...p,[l]:{success:!1,error:d.message,loading:!1}}))}};return e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"p-4 border-b border-gray-100 bg-gray-50/50 flex flex-col gap-4 shrink-0 col-span-1",children:[e.jsxs("div",{className:"relative",children:[e.jsx(v,{className:"absolute left-3.5 top-1/2 -translate-y-1/2 text-gray-400",size:16}),e.jsx("input",{type:"text",placeholder:"通过命令类型、描述或 Action ID 搜索活跃指令...",value:t,onChange:s=>n(s.target.value),className:"w-full pl-10 pr-4 py-2.5 bg-white border border-gray-200 rounded-xl text-sm focus:outline-none focus:ring-2 focus:ring-indigo-500 focus:border-transparent transition-all shadow-sm"})]}),e.jsx("div",{className:"flex flex-wrap gap-2",children:E.map(s=>{const l=s.icon,d=g===s.id;return e.jsxs("button",{onClick:()=>h(s.id),className:`flex items-center gap-1.5 px-3.5 py-1.5 rounded-full text-xs font-semibold transition-all ${d?"bg-indigo-600 text-white shadow shadow-indigo-200 scale-102 font-bold":"bg-white text-gray-600 hover:text-gray-900 border border-gray-200 hover:border-gray-300"}`,children:[e.jsx(l,{size:13}),e.jsx("span",{children:s.name}),s.id==="all"?e.jsx("span",{className:`ml-1 text-[10px] px-1.5 py-0.2 rounded-full ${d?"bg-indigo-700/80 text-white":"bg-gray-100 text-gray-500"}`,children:r.length}):null]},s.id)})})]}),e.jsx("div",{className:"flex-1 overflow-y-auto p-6 bg-gray-50/30",children:A.length===0?e.jsxs("div",{className:"flex flex-col items-center justify-center p-12 text-gray-400",children:[e.jsx($,{size:48,className:"text-gray-300 mb-4 animate-pulse"}),e.jsx("h3",{className:"font-semibold text-gray-700",children:"没有找到匹配的指令"}),e.jsx("p",{className:"text-xs text-gray-500 mt-1",children:"请尝试清空查询条件或检查当前的插件状态"})]}):e.jsx("div",{className:"space-y-4 max-w-5xl mx-auto",children:A.map(s=>{const l=b===s.id,d=L(s.commandType),p=s.isHighRisk;u[s.id]===void 0&&(u[s.id]=P(s.inputSchema));const i=k[s.id];return e.jsxs("div",{className:`bg-white rounded-xl border transition-all duration-200 overflow-hidden shadow-sm hover:shadow ${l?"border-indigo-400 ring-1 ring-indigo-100":p?"border-orange-200 hover:border-orange-300":"border-gray-200 hover:border-indigo-200"}`,children:[e.jsxs("div",{onClick:()=>{j(l?null:s.id)},className:"p-4 flex flex-col sm:flex-row sm:items-center justify-between gap-4 cursor-pointer hover:bg-gray-50/30 transition-colors select-none",children:[e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx("div",{className:`p-2 rounded-lg shrink-0 ${p?"bg-orange-50 text-orange-600":"bg-indigo-50 text-indigo-600"}`,children:d==="vfs"?e.jsx(_,{size:18}):d==="edu"?e.jsx(S,{size:18}):d==="mgmt"?e.jsx(z,{size:18}):d==="proc"?e.jsx(v,{size:18}):d==="ai"?e.jsx(R,{size:18}):e.jsx(C,{size:18})}),e.jsxs("div",{children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.jsx("span",{className:"font-mono font-bold text-sm bg-gray-100 text-gray-800 px-2 py-0.5 rounded border border-gray-200",children:s.commandType}),p&&e.jsx("span",{className:"text-[10px] bg-red-100 text-red-700 border border-red-200 rounded font-extrabold px-1.5 py-0.5 uppercase tracking-wide flex items-center gap-0.5",children:"⚠️ 高风险操作"}),e.jsxs("span",{className:"text-xs bg-indigo-50 text-indigo-700 border border-indigo-100 rounded-full px-2 py-0.5",children:["🔒 ",s.capabilityRequired||"无公开权限"]})]}),e.jsx("p",{className:"text-gray-600 text-xs mt-1.5 font-medium line-clamp-1",children:s.description})]})]}),e.jsxs("div",{className:"flex items-center gap-3 self-end sm:self-auto",children:[e.jsxs("span",{className:"text-[10px] text-gray-400 font-mono hidden md:inline",children:["ID: ",s.id]}),e.jsxs("button",{className:`text-xs px-3 py-1 bg-gray-100 text-gray-700 rounded-lg font-semibold border hover:bg-gray-200 transition-all flex items-center gap-1 ${l?"bg-indigo-50 border-indigo-200 text-indigo-700":""}`,children:[l?"折叠面板":"交互调试 Shell",e.jsx(U,{size:12,className:`transform transition-transform ${l?"rotate-90":""}`})]})]})]}),l&&e.jsxs("div",{className:"border-t border-gray-100 bg-gray-50/50 p-5 space-y-4",children:[e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[e.jsxs("div",{className:"bg-white rounded-lg border border-gray-200 p-4",children:[e.jsxs("h4",{className:"text-xs font-bold text-gray-700 uppercase tracking-widest mb-3 flex items-center gap-1.5 border-b border-gray-100 pb-2",children:[e.jsx(H,{size:12,className:"text-gray-400"}),"入参规范 (JSON Schema Definition)"]}),s.inputSchema?.properties?e.jsx("div",{className:"space-y-3 font-mono text-[11px]",children:Object.keys(s.inputSchema.properties).map(x=>{const c=s.inputSchema.properties[x],N=s.inputSchema.required?.includes(x);return e.jsxs("div",{className:"flex flex-col gap-1 border-b border-gray-50 last:border-b-0 pb-1.5",children:[e.jsxs("div",{className:"flex items-baseline gap-1.5",children:[e.jsx("span",{className:"text-indigo-600 font-semibold",children:x}),e.jsxs("span",{className:"text-gray-400 text-[10px]",children:["(",c.type,")"]}),N&&e.jsx("span",{className:"text-red-500 text-[9px] font-bold bg-red-50 border border-red-100 rounded px-1",children:"REQUIRED"})]}),c.description&&e.jsx("span",{className:"text-gray-500 font-sans leading-relaxed text-xs",children:c.description})]},x)})}):e.jsx("p",{className:"text-xs text-gray-400 italic",children:"该命令不需要接收任何入参负载 (Payload)。"})]}),e.jsxs("div",{className:"bg-white rounded-lg border border-gray-200 p-4 flex flex-col",children:[e.jsxs("h4",{className:"text-xs font-bold text-gray-700 uppercase tracking-widest mb-3 flex items-center gap-1.5 border-b border-gray-100 pb-2 justify-between",children:[e.jsxs("span",{className:"flex items-center gap-1.5",children:[e.jsx(v,{size:12,className:"text-gray-400"}),"Payload 调试区"]}),e.jsx("button",{onClick:()=>{y(x=>({...x,[s.id]:P(s.inputSchema)}))},className:"text-[9px] text-indigo-600 hover:underline hover:text-indigo-800 uppercase tracking-wider",children:"恢复默认模版"})]}),e.jsx("label",{className:"text-[10px] font-semibold text-gray-400 block mb-1",children:"Payload JSON:"}),e.jsx("textarea",{value:u[s.id]||"",onChange:x=>{const c=x.target.value;y(N=>({...N,[s.id]:c}))},rows:6,className:"w-full font-mono text-[11px] p-2.5 bg-gray-900 text-indigo-300 border border-gray-800 rounded-lg focus:ring-2 focus:ring-indigo-500 focus:outline-none resize-none leading-relaxed flex-1 shadow-inner"}),e.jsx("div",{className:"mt-3 flex justify-end",children:e.jsx("button",{onClick:()=>o(s.commandType,s.id),disabled:i?.loading,className:`px-4 py-2 text-xs font-bold font-sans text-white hover:shadow-md active:scale-95 transition-all flex items-center gap-1.5 rounded-lg ${p?"bg-red-600 hover:bg-red-700":"bg-indigo-600 hover:bg-indigo-700 focus:ring-2 focus:ring-indigo-500"} disabled:opacity-50`,children:i?.loading?e.jsxs(e.Fragment,{children:[e.jsx(B,{size:13,className:"animate-spin"}),e.jsx("span",{children:"内核正在调度总线..."})]}):e.jsxs(e.Fragment,{children:[e.jsx(O,{size:13}),e.jsx("span",{children:"提交执行指令 (Deploy Command)"})]})})})]})]}),i&&e.jsxs("div",{className:`p-4 rounded-xl border flex flex-col font-mono text-[11px] leading-relaxed relative ${i.loading?"bg-gray-50 border-gray-200":i.success?"bg-green-50/50 border-green-200 text-green-900":"bg-red-50/50 border-red-200 text-red-900"}`,children:[e.jsx("div",{className:"absolute top-2 right-3 uppercase text-[10px] font-bold text-gray-400",children:"Console Output log"}),e.jsx("div",{className:"font-bold flex items-center gap-1.5 mb-1 bg-transparent border-0 p-0 text-xs text-neutral-800",children:i.loading?e.jsx("span",{className:"text-gray-500",children:"⏳ COMMAND QUEUED..."}):i.success?e.jsxs("span",{className:"text-green-700 flex items-center gap-1",children:[e.jsx(J,{size:14})," STATUS: 200 SUCCESS (Action Completed)"]}):e.jsxs("span",{className:"text-red-700 flex items-center gap-1",children:[e.jsx(q,{size:14})," STATUS: 500 INTERNAL_BUS_ERROR"]})}),!i.loading&&e.jsx("pre",{className:"mt-2 p-3 bg-gray-900/95 text-gray-200 rounded-lg overflow-x-auto border border-gray-800 shadow-inner max-h-56 select-all font-mono",children:i.success?JSON.stringify(i.data,null,2):i.error})]})]})]},s.id)})})})]})},Z=({pluginGuideMd:r,loadingMd:a,copiedId:t,handleCopy:n,pluginBoilerplateCode:g,pluginInteractiveCode:h,pluginExamCode:b})=>e.jsx("div",{className:"flex-1 overflow-y-auto p-6 bg-slate-50/50",children:e.jsxs("div",{className:"max-w-5xl mx-auto space-y-6",children:[a?e.jsxs("div",{className:"flex flex-col items-center justify-center p-12 bg-white rounded-2xl border border-gray-200",children:[e.jsx(B,{size:32,className:"animate-spin text-indigo-600 mb-2"}),e.jsx("span",{className:"text-xs text-gray-500 font-semibold",children:"正在从服务器拉取 SDK 文档..."})]}):r?e.jsx("div",{className:"bg-white rounded-2xl border border-gray-200 p-8 shadow-sm prose prose-slate max-w-none text-xs leading-relaxed",children:e.jsx(X,{children:r})}):null,e.jsxs("div",{className:"bg-white rounded-2xl border border-indigo-100 p-6 shadow-sm flex flex-col md:flex-row gap-5 items-start",children:[e.jsx("div",{className:"p-4 bg-indigo-50 text-indigo-600 rounded-2xl shrink-0",children:e.jsx(C,{size:28})}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("h3",{className:"text-base font-bold text-gray-900",children:"Edu-OS 插件开发指南 & API 参考"}),e.jsxs("p",{className:"text-xs text-gray-600 leading-relaxed",children:["Edu-OS 基于 ",e.jsx("span",{className:"font-semibold text-indigo-600",children:"CommandBus(命令总线)"})," + ",e.jsx("span",{className:"font-semibold text-indigo-600",children:"EventBus(事件总线)"})," 微内核架构。 插件通过标准 ESM 模块导出 ",e.jsx("code",{className:"bg-gray-100 text-rose-600 px-1 rounded text-[10px]",children:"activate(ctx)"})," 函数接收 ",e.jsx("span",{className:"font-semibold",children:"PluginContext"}),", 进而访问 7 大内核服务。本页提供完整的 API 参考、参数说明和可运行示例。"]}),e.jsxs("div",{className:"flex flex-wrap gap-2 pt-1",children:[e.jsx("span",{className:"text-[10px] bg-indigo-50 text-indigo-700 border border-indigo-100 px-2 py-0.5 rounded-full font-medium",children:"🔄 DI 依赖注入"}),e.jsx("span",{className:"text-[10px] bg-emerald-50 text-emerald-700 border border-emerald-100 px-2 py-0.5 rounded-full font-medium",children:"🔒 能力安全模型"}),e.jsx("span",{className:"text-[10px] bg-amber-50 text-amber-700 border border-amber-100 px-2 py-0.5 rounded-full font-medium",children:"⚡ 热重载 + Worker 隔离"}),e.jsx("span",{className:"text-[10px] bg-rose-50 text-rose-700 border border-rose-100 px-2 py-0.5 rounded-full font-medium",children:"📦 ESM + CommonJS 双格式"}),e.jsx("span",{className:"text-[10px] bg-sky-50 text-sky-700 border border-sky-100 px-2 py-0.5 rounded-full font-medium",children:"🆔 别名生命周期 (Alias Lifecycle)"}),e.jsx("span",{className:"text-[10px] bg-teal-50 text-teal-700 border border-teal-100 px-2 py-0.5 rounded-full font-medium",children:"🛡️ Worker Storage 安全隔离"})]})]})]}),e.jsxs("div",{className:"bg-white rounded-2xl border border-gray-200 overflow-hidden shadow-sm",children:[e.jsxs("div",{className:"px-5 py-4 bg-gray-50 border-b border-gray-100 flex flex-col sm:flex-row sm:items-center justify-between gap-2",children:[e.jsxs("div",{className:"flex items-start gap-2",children:[e.jsx("div",{className:"p-1.5 bg-indigo-50 text-indigo-600 rounded",children:e.jsx(I,{size:16})}),e.jsxs("div",{children:[e.jsx("h4",{className:"text-xs font-bold text-gray-900",children:"示例 1:思维导图插件 — 注册 Action + 处理器 + 发布事件"}),e.jsx("p",{className:"text-[10px] text-gray-500 mt-0.5",children:"演示 ctx.services 解构、Action 注册、createCommand 创建信封、eventBus.publish 发布事件"})]})]}),e.jsxs("button",{onClick:()=>n("tpl1",g),className:`px-3 py-1.5 rounded-lg text-xs font-semibold flex items-center gap-1.5 transition-all shadow-sm shrink-0 ${t==="tpl1"?"bg-emerald-50 text-emerald-700 border border-emerald-250":"bg-white text-indigo-600 border border-indigo-150 hover:bg-indigo-50"}`,children:[t==="tpl1"?e.jsx(T,{size:12}):e.jsx(w,{size:12}),e.jsx("span",{children:t==="tpl1"?"已复制!":"复制代码"})]})]}),e.jsx("pre",{className:"text-xs font-mono p-5 bg-gray-950 text-gray-200 overflow-x-auto leading-relaxed max-h-[360px] shadow-inner select-all",children:g})]}),e.jsxs("div",{className:"bg-white rounded-2xl border border-gray-200 overflow-hidden shadow-sm",children:[e.jsxs("div",{className:"px-5 py-4 bg-gray-50 border-b border-gray-100 flex flex-col sm:flex-row sm:items-center justify-between gap-2",children:[e.jsxs("div",{className:"flex items-start gap-2",children:[e.jsx("div",{className:"p-1.5 bg-emerald-50 text-emerald-600 rounded",children:e.jsx(I,{size:16})}),e.jsxs("div",{children:[e.jsx("h4",{className:"text-xs font-bold text-gray-900",children:"示例 2:AI 作业批改插件 — 演示 AI + 事件订阅 + 存储 + DI"}),e.jsx("p",{className:"text-[10px] text-gray-500 mt-0.5",children:"演示 ctx.resolve 获取数据库、services.ai 生成文本、services.storage 持久化、eventBus 订阅"})]})]}),e.jsxs("button",{onClick:()=>n("tpl2",h),className:`px-3 py-1.5 rounded-lg text-xs font-semibold flex items-center gap-1.5 transition-all shadow-sm shrink-0 ${t==="tpl2"?"bg-emerald-50 text-emerald-700 border border-emerald-250":"bg-white text-emerald-600 border border-emerald-150 hover:bg-emerald-50"}`,children:[t==="tpl2"?e.jsx(T,{size:12}):e.jsx(w,{size:12}),e.jsx("span",{children:t==="tpl2"?"已复制!":"复制代码"})]})]}),e.jsx("pre",{className:"text-xs font-mono p-5 bg-gray-950 text-gray-200 overflow-x-auto leading-relaxed max-h-[360px] shadow-inner select-all",children:h})]}),e.jsxs("div",{className:"bg-white rounded-2xl border border-gray-200 overflow-hidden shadow-sm",children:[e.jsxs("div",{className:"px-5 py-4 bg-gray-50 border-b border-gray-100 flex flex-col sm:flex-row sm:items-center justify-between gap-2",children:[e.jsxs("div",{className:"flex items-start gap-2",children:[e.jsx("div",{className:"p-1.5 bg-amber-50 text-amber-600 rounded",children:e.jsx(I,{size:16})}),e.jsxs("div",{children:[e.jsx("h4",{className:"text-xs font-bold text-gray-900",children:"示例 3:考试系统插件 — 演示 ctx.db 自建表 + deactivate 清理"}),e.jsx("p",{className:"text-[10px] text-gray-500 mt-0.5",children:"演示 ctx.db.ensureTable 建表、ctx.db.table 获取带前缀表名、deactivate 生命周期"})]})]}),e.jsxs("button",{onClick:()=>n("tpl3",b),className:`px-3 py-1.5 rounded-lg text-xs font-semibold flex items-center gap-1.5 transition-all shadow-sm shrink-0 ${t==="tpl3"?"bg-emerald-50 text-emerald-700 border border-emerald-250":"bg-white text-amber-600 border border-amber-150 hover:bg-amber-50"}`,children:[t==="tpl3"?e.jsx(T,{size:12}):e.jsx(w,{size:12}),e.jsx("span",{children:t==="tpl3"?"已复制!":"复制代码"})]})]}),e.jsx("pre",{className:"text-xs font-mono p-5 bg-gray-950 text-gray-200 overflow-x-auto leading-relaxed max-h-[360px] shadow-inner select-all",children:b})]})]})}),ee=({copiedId:r,handleCopy:a})=>e.jsx("div",{className:"flex-1 overflow-y-auto p-6 bg-slate-50/50",children:e.jsxs("div",{className:"max-w-5xl mx-auto space-y-8",children:[e.jsxs("div",{className:"bg-gradient-to-r from-indigo-900 to-indigo-950 rounded-2xl p-6 text-white shadow-md flex flex-col md:flex-row gap-5 items-start",children:[e.jsx("div",{className:"p-4 bg-indigo-500/20 text-indigo-300 border border-indigo-500/30 rounded-2xl shrink-0",children:e.jsx(S,{size:32})}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs("h3",{className:"text-lg font-bold text-white flex items-center gap-2",children:["Edu-OS 核心系统主要特性使用教程",e.jsx("span",{className:"text-[10px] bg-indigo-500/30 text-indigo-200 border border-indigo-500/50 px-2 py-0.5 rounded-full font-normal",children:"v2.1.0 LTS"})]}),e.jsx("p",{className:"text-xs text-indigo-200 leading-relaxed",children:"本指南为教育实验操作系统 (Edu-OS) 的深度使用手册。详细阐述如何使用内核指令管理班级与学生、基于大纲结构化推进课件时间轴、在互动白板中动态注入脑图和测验元素、启动全屏锁定与签到的教学控制流,以及编写并集成支持 AI 成绩回传的 HTML Applet 实验组件。"}),e.jsxs("div",{className:"flex flex-wrap gap-2 pt-1",children:[e.jsx("span",{className:"text-[10px] bg-indigo-800/40 text-indigo-150 border border-indigo-700/50 px-2 py-0.5 rounded-full font-medium",children:"🏫 班级与学生指令集"}),e.jsx("span",{className:"text-[10px] bg-emerald-800/40 text-emerald-150 border border-emerald-700/50 px-2 py-0.5 rounded-full font-medium",children:"📋 课程大纲时间轴同步"}),e.jsx("span",{className:"text-[10px] bg-amber-800/40 text-amber-150 border border-amber-700/50 px-2 py-0.5 rounded-full font-medium",children:"🎨 协作白板指令渲染"}),e.jsx("span",{className:"text-[10px] bg-sky-800/40 text-sky-150 border border-sky-700/50 px-2 py-0.5 rounded-full font-medium",children:"🚀 postMessage 成绩监听"})]})]})]}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[e.jsxs("div",{className:"bg-white rounded-2xl border border-gray-200 shadow-sm p-6 space-y-4 hover:shadow-md transition-all flex flex-col justify-between",children:[e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-3 border-b border-gray-100 pb-3 text-indigo-600 font-bold",children:[e.jsx("div",{className:"p-2 bg-indigo-50 rounded-xl",children:e.jsx(z,{size:20})}),e.jsxs("div",{children:[e.jsx("h4",{className:"text-sm text-gray-900",children:"1. 使用核心指令管理班级与学生"}),e.jsx("p",{className:"text-[11px] text-gray-400 font-normal mt-0.5",children:"Administrative CLI & Capability Model"})]})]}),e.jsxs("p",{className:"text-xs text-gray-600 leading-relaxed mt-3",children:["Edu-OS 采用权限隔离的",e.jsx("strong",{children:"能力安全模型 (Capability Model)"}),"。任何行政、学籍以及课表排期修改,底层最终都会被封装为非对称的内核指令,经由分布式指令总线进行安全校验与事务落库。"]}),e.jsxs("div",{className:"p-3 bg-indigo-50/50 rounded-xl border border-indigo-100 text-[11px] text-indigo-900 space-y-1.5 mt-3",children:[e.jsx("span",{className:"font-bold block",children:"🔒 核心访问权限声明 (RBAC Capabilities):"}),e.jsxs("ul",{className:"list-disc list-inside space-y-1 text-gray-600 text-[10.5px]",children:[e.jsxs("li",{children:[e.jsx("code",{className:"bg-white/80 px-1 rounded border border-indigo-150",children:"class:write"}),":允许创建/删除行政班级。"]}),e.jsxs("li",{children:[e.jsx("code",{className:"bg-white/80 px-1 rounded border border-indigo-150",children:"student:write"}),":允许注册学生、修改学籍或修改设备锁定状态。"]}),e.jsxs("li",{children:[e.jsx("code",{className:"bg-white/80 px-1 rounded border border-indigo-150",children:"schedule:write"}),":允许编排课程,或临时将某一日期的课程替换为星期几的常规课表。"]})]})]})]}),e.jsxs("div",{className:"space-y-3 font-mono text-[11px] mt-4",children:[e.jsxs("div",{className:"bg-gray-50 rounded-xl p-3 border border-gray-150 relative",children:[e.jsxs("div",{className:"flex justify-between items-center mb-1",children:[e.jsx("span",{className:"text-indigo-600 font-bold",children:"A. 创建班级 (class.create)"}),e.jsx("button",{onClick:()=>a("guide_cmd_class",`{
3
3
  "name": "高三一班",
4
4
  "description": "物理实验班"
@@ -93,7 +93,7 @@ export default {
93
93
  '@openlearn/core:IDatabase@^1.0.0',
94
94
  ],
95
95
  capabilitiesProposed: ['lesson:read'],
96
- engines: { openlearn: '>=5.0.0' },
96
+ engines: { openlearn: '^0.2.5' },
97
97
  },
98
98
 
99
99
  async activate(ctx: PluginContext) {
@@ -1 +1 @@
1
- import{r as t,j as e}from"./vendor-react-0Lg0vA-4.js";import{h as c,a7 as u,a8 as d,X as m}from"./vendor-icons-BvCtGbt1.js";function g({coursewareId:l,onClose:n}){const[i,a]=t.useState(!1),r=t.useRef(null);t.useEffect(()=>{const s=()=>{a(!!document.fullscreenElement&&document.fullscreenElement===r.current)};return document.addEventListener("fullscreenchange",s),()=>{document.removeEventListener("fullscreenchange",s)}},[]);const o=()=>{const s=r.current;s&&(document.fullscreenElement?document.exitFullscreen?document.exitFullscreen():document.webkitExitFullscreen&&document.webkitExitFullscreen():s.requestFullscreen?s.requestFullscreen():s.webkitRequestFullscreen&&s.webkitRequestFullscreen())};return l?e.jsxs("div",{ref:r,className:"flex flex-col h-full bg-white rounded-xl shadow-sm border border-gray-200 overflow-hidden relative",children:[e.jsxs("div",{className:"flex items-center justify-between px-4 py-2 bg-gray-100 border-b border-gray-200 shrink-0",children:[e.jsxs("div",{className:"flex items-center gap-2 select-none",children:[e.jsx(c,{size:16,className:"text-indigo-500"}),e.jsx("span",{className:"font-semibold text-sm text-gray-700",children:"Interactive Courseware"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("button",{onClick:o,className:"p-1 hover:bg-gray-200 rounded-lg text-gray-500 transition-colors cursor-pointer",title:i?"退出全屏":"全屏播放",children:i?e.jsx(u,{size:16}):e.jsx(d,{size:16})}),n&&e.jsx("button",{onClick:n,className:"p-1 hover:bg-gray-200 rounded-lg text-gray-500 transition-colors cursor-pointer",children:e.jsx(m,{size:16})})]})]}),e.jsx("div",{className:"flex-1 relative bg-white",children:e.jsx("iframe",{src:`/api/courseware/${l}`,sandbox:"allow-scripts allow-same-origin allow-downloads allow-forms",allowFullScreen:!0,className:"w-full h-full border-none",title:"Interactive Courseware"})})]}):e.jsxs("div",{className:"flex flex-col items-center justify-center h-full text-gray-400 bg-gray-50 rounded-xl border border-dashed border-gray-300",children:[e.jsx(c,{size:48,className:"mb-4 text-gray-300 opacity-50"}),e.jsx("h3",{className:"text-lg font-medium text-gray-700",children:"No Courseware Selected"}),e.jsx("p",{className:"mt-2 text-sm text-center",children:"Please select a courseware from the list to view it interactively."})]})}export{g as InteractiveCoursewareViewer};
1
+ import{r as t,j as e}from"./vendor-react-0Lg0vA-4.js";import{h as i,a7 as u,a8 as d,X as m}from"./vendor-icons-BvCtGbt1.js";function g({coursewareId:l,onClose:n}){const[c,a]=t.useState(!1),r=t.useRef(null);t.useEffect(()=>{const s=()=>{a(!!document.fullscreenElement&&document.fullscreenElement===r.current)};return document.addEventListener("fullscreenchange",s),()=>{document.removeEventListener("fullscreenchange",s)}},[]);const o=()=>{const s=r.current;s&&(document.fullscreenElement?document.exitFullscreen?document.exitFullscreen():document.webkitExitFullscreen&&document.webkitExitFullscreen():s.requestFullscreen?s.requestFullscreen():s.webkitRequestFullscreen&&s.webkitRequestFullscreen())};return l?e.jsxs("div",{ref:r,className:"flex flex-col h-full bg-white rounded-xl shadow-sm border border-gray-200 overflow-hidden relative",children:[e.jsxs("div",{className:"flex items-center justify-between px-4 py-2 bg-gray-100 border-b border-gray-200 shrink-0",children:[e.jsxs("div",{className:"flex items-center gap-2 select-none",children:[e.jsx(i,{size:16,className:"text-indigo-500"}),e.jsx("span",{className:"font-semibold text-sm text-gray-700",children:"Interactive Courseware"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("button",{onClick:o,className:"p-1 hover:bg-gray-200 rounded-lg text-gray-500 transition-colors cursor-pointer",title:c?"退出全屏":"全屏播放",children:c?e.jsx(u,{size:16}):e.jsx(d,{size:16})}),n&&e.jsx("button",{onClick:n,className:"p-1 hover:bg-gray-200 rounded-lg text-gray-500 transition-colors cursor-pointer",children:e.jsx(m,{size:16})})]})]}),e.jsx("div",{className:"flex-1 relative bg-white",children:e.jsx("iframe",{src:`/api/courseware/${l}`,sandbox:"allow-scripts allow-forms allow-downloads",allowFullScreen:!0,className:"w-full h-full border-none",title:"Interactive Courseware"})})]}):e.jsxs("div",{className:"flex flex-col items-center justify-center h-full text-gray-400 bg-gray-50 rounded-xl border border-dashed border-gray-300",children:[e.jsx(i,{size:48,className:"mb-4 text-gray-300 opacity-50"}),e.jsx("h3",{className:"text-lg font-medium text-gray-700",children:"No Courseware Selected"}),e.jsx("p",{className:"mt-2 text-sm text-center",children:"Please select a courseware from the list to view it interactively."})]})}export{g as InteractiveCoursewareViewer};