diff --git a/Docs/audit/README.md b/Docs/audit/README.md new file mode 100644 index 000000000..d18c0947c --- /dev/null +++ b/Docs/audit/README.md @@ -0,0 +1,9 @@ +# Docs/audit 目录说明 + +这里存放按日期命名的审计、诊断与对拍报告快照。**每份报告只反映它的写作时点,完成后即自动存档,不会回头更新。** + +阅读规则: + +- 想知道"现在的状态",以代码和最新日期的报告为准,不要引用旧报告的结论。 +- 报告里描述的失败/阻塞可能早已被后续提交修复;引用前先核对 `git log` 对应文件的后续改动。 +- 与权威决策文档冲突时,以 `Docs/plans/` 下带"现行"标记的计划和 `Docs/` 下的决策文档为准。 diff --git a/Docs/pane-toggle-icons.md b/Docs/pane-toggle-icons.md index 908758adf..86612f308 100644 --- a/Docs/pane-toggle-icons.md +++ b/Docs/pane-toggle-icons.md @@ -1,5 +1,7 @@ # 顶栏三板块开关图标 · 实现计划 +> **历史文档(2026-07 方案记录)。** 本计划描述的分栏实现(`EmptyWorkspaceView`、`ResizableTwoPane`/`ResizableThreePane`、`NativeSplitCoordinator`)已于 2026-08 被 `StableDocumentWorkspace` 体系取代,文中引用的组件与行号已从代码库删除。三板块开关与拖拽排序的产品规则仍有效;现行实现入口见 `Sources/WeiBei/Views/StableDocumentWorkspace.swift`。阅读本文时请以现行实现为准,不要按文中代码位置检索。 + > 给 Codex 执行用。本文自包含,带全部上下文和 file:line 引用,不用重新摸索。 ## 一句话规则(整个设计的地基) diff --git a/Docs/plans/2026-08-22-file-model-convergence-and-library-relocation.md b/Docs/plans/2026-08-22-file-model-convergence-and-library-relocation.md index d12f9a206..31d0ad52a 100644 --- a/Docs/plans/2026-08-22-file-model-convergence-and-library-relocation.md +++ b/Docs/plans/2026-08-22-file-model-convergence-and-library-relocation.md @@ -1,5 +1,7 @@ # 魏碑文件模型收敛与资料库迁移入口 总体实施计划 +> **状态更新(2026-08-22):本计划主体已回退。** 阶段 0–2 曾合并(#277)后被整体 revert(Revert #280/#281/#286);仅资料库迁移部分经 #293 重新落地。文中阶段 3 提到的 `.presentUnmaterialized` 等符号在现行代码中不存在。本文仅作历史方案存档,不代表进行中的路线图;当前文件模型以最新 `main` 代码为准。 + **版本:** 2.0(细化执行步骤) **日期:** 2026-08-22 **文档性质:** 任务一(资料库迁移入口)与任务二(文件模型收敛)的产品与工程执行计划 diff --git a/Sources/WeiBei/Resources/Brand/weibei-mark-reversed.png b/Sources/WeiBei/Resources/Brand/weibei-mark-reversed.png deleted file mode 100644 index f6890c92d..000000000 Binary files a/Sources/WeiBei/Resources/Brand/weibei-mark-reversed.png and /dev/null differ diff --git a/Sources/WeiBei/Resources/Brand/weibei-mark.png b/Sources/WeiBei/Resources/Brand/weibei-mark.png deleted file mode 100644 index ab91fbc5f..000000000 Binary files a/Sources/WeiBei/Resources/Brand/weibei-mark.png and /dev/null differ diff --git a/Sources/WeiBei/Resources/Editor/fonts/KaTeX_AMS-Regular.ttf b/Sources/WeiBei/Resources/Editor/KaTeX_AMS-Regular.ttf similarity index 100% rename from Sources/WeiBei/Resources/Editor/fonts/KaTeX_AMS-Regular.ttf rename to Sources/WeiBei/Resources/Editor/KaTeX_AMS-Regular.ttf diff --git a/Sources/WeiBei/Resources/Editor/fonts/KaTeX_AMS-Regular.woff b/Sources/WeiBei/Resources/Editor/KaTeX_AMS-Regular.woff similarity index 100% rename from Sources/WeiBei/Resources/Editor/fonts/KaTeX_AMS-Regular.woff rename to Sources/WeiBei/Resources/Editor/KaTeX_AMS-Regular.woff diff --git a/Sources/WeiBei/Resources/Editor/fonts/KaTeX_AMS-Regular.woff2 b/Sources/WeiBei/Resources/Editor/KaTeX_AMS-Regular.woff2 similarity index 100% rename from Sources/WeiBei/Resources/Editor/fonts/KaTeX_AMS-Regular.woff2 rename to Sources/WeiBei/Resources/Editor/KaTeX_AMS-Regular.woff2 diff --git a/Sources/WeiBei/Resources/Editor/fonts/KaTeX_Caligraphic-Bold.ttf b/Sources/WeiBei/Resources/Editor/KaTeX_Caligraphic-Bold.ttf similarity index 100% rename from Sources/WeiBei/Resources/Editor/fonts/KaTeX_Caligraphic-Bold.ttf rename to Sources/WeiBei/Resources/Editor/KaTeX_Caligraphic-Bold.ttf diff --git a/Sources/WeiBei/Resources/Editor/fonts/KaTeX_Caligraphic-Bold.woff b/Sources/WeiBei/Resources/Editor/KaTeX_Caligraphic-Bold.woff similarity index 100% rename from Sources/WeiBei/Resources/Editor/fonts/KaTeX_Caligraphic-Bold.woff rename to Sources/WeiBei/Resources/Editor/KaTeX_Caligraphic-Bold.woff diff --git a/Sources/WeiBei/Resources/Editor/fonts/KaTeX_Caligraphic-Bold.woff2 b/Sources/WeiBei/Resources/Editor/KaTeX_Caligraphic-Bold.woff2 similarity index 100% rename from Sources/WeiBei/Resources/Editor/fonts/KaTeX_Caligraphic-Bold.woff2 rename to Sources/WeiBei/Resources/Editor/KaTeX_Caligraphic-Bold.woff2 diff --git a/Sources/WeiBei/Resources/Editor/fonts/KaTeX_Caligraphic-Regular.ttf b/Sources/WeiBei/Resources/Editor/KaTeX_Caligraphic-Regular.ttf similarity index 100% rename from Sources/WeiBei/Resources/Editor/fonts/KaTeX_Caligraphic-Regular.ttf rename to Sources/WeiBei/Resources/Editor/KaTeX_Caligraphic-Regular.ttf diff --git a/Sources/WeiBei/Resources/Editor/fonts/KaTeX_Caligraphic-Regular.woff b/Sources/WeiBei/Resources/Editor/KaTeX_Caligraphic-Regular.woff similarity index 100% rename from Sources/WeiBei/Resources/Editor/fonts/KaTeX_Caligraphic-Regular.woff rename to Sources/WeiBei/Resources/Editor/KaTeX_Caligraphic-Regular.woff diff --git a/Sources/WeiBei/Resources/Editor/fonts/KaTeX_Caligraphic-Regular.woff2 b/Sources/WeiBei/Resources/Editor/KaTeX_Caligraphic-Regular.woff2 similarity index 100% rename from Sources/WeiBei/Resources/Editor/fonts/KaTeX_Caligraphic-Regular.woff2 rename to Sources/WeiBei/Resources/Editor/KaTeX_Caligraphic-Regular.woff2 diff --git a/Sources/WeiBei/Resources/Editor/fonts/KaTeX_Fraktur-Bold.ttf b/Sources/WeiBei/Resources/Editor/KaTeX_Fraktur-Bold.ttf similarity index 100% rename from Sources/WeiBei/Resources/Editor/fonts/KaTeX_Fraktur-Bold.ttf rename to Sources/WeiBei/Resources/Editor/KaTeX_Fraktur-Bold.ttf diff --git a/Sources/WeiBei/Resources/Editor/fonts/KaTeX_Fraktur-Bold.woff b/Sources/WeiBei/Resources/Editor/KaTeX_Fraktur-Bold.woff similarity index 100% rename from Sources/WeiBei/Resources/Editor/fonts/KaTeX_Fraktur-Bold.woff rename to Sources/WeiBei/Resources/Editor/KaTeX_Fraktur-Bold.woff diff --git a/Sources/WeiBei/Resources/Editor/fonts/KaTeX_Fraktur-Bold.woff2 b/Sources/WeiBei/Resources/Editor/KaTeX_Fraktur-Bold.woff2 similarity index 100% rename from Sources/WeiBei/Resources/Editor/fonts/KaTeX_Fraktur-Bold.woff2 rename to Sources/WeiBei/Resources/Editor/KaTeX_Fraktur-Bold.woff2 diff --git a/Sources/WeiBei/Resources/Editor/fonts/KaTeX_Fraktur-Regular.ttf b/Sources/WeiBei/Resources/Editor/KaTeX_Fraktur-Regular.ttf similarity index 100% rename from Sources/WeiBei/Resources/Editor/fonts/KaTeX_Fraktur-Regular.ttf rename to Sources/WeiBei/Resources/Editor/KaTeX_Fraktur-Regular.ttf diff --git a/Sources/WeiBei/Resources/Editor/fonts/KaTeX_Fraktur-Regular.woff b/Sources/WeiBei/Resources/Editor/KaTeX_Fraktur-Regular.woff similarity index 100% rename from Sources/WeiBei/Resources/Editor/fonts/KaTeX_Fraktur-Regular.woff rename to Sources/WeiBei/Resources/Editor/KaTeX_Fraktur-Regular.woff diff --git a/Sources/WeiBei/Resources/Editor/fonts/KaTeX_Fraktur-Regular.woff2 b/Sources/WeiBei/Resources/Editor/KaTeX_Fraktur-Regular.woff2 similarity index 100% rename from Sources/WeiBei/Resources/Editor/fonts/KaTeX_Fraktur-Regular.woff2 rename to Sources/WeiBei/Resources/Editor/KaTeX_Fraktur-Regular.woff2 diff --git a/Sources/WeiBei/Resources/Editor/fonts/KaTeX_Main-Bold.ttf b/Sources/WeiBei/Resources/Editor/KaTeX_Main-Bold.ttf similarity index 100% rename from Sources/WeiBei/Resources/Editor/fonts/KaTeX_Main-Bold.ttf rename to Sources/WeiBei/Resources/Editor/KaTeX_Main-Bold.ttf diff --git a/Sources/WeiBei/Resources/Editor/fonts/KaTeX_Main-Bold.woff b/Sources/WeiBei/Resources/Editor/KaTeX_Main-Bold.woff similarity index 100% rename from Sources/WeiBei/Resources/Editor/fonts/KaTeX_Main-Bold.woff rename to Sources/WeiBei/Resources/Editor/KaTeX_Main-Bold.woff diff --git a/Sources/WeiBei/Resources/Editor/fonts/KaTeX_Main-Bold.woff2 b/Sources/WeiBei/Resources/Editor/KaTeX_Main-Bold.woff2 similarity index 100% rename from Sources/WeiBei/Resources/Editor/fonts/KaTeX_Main-Bold.woff2 rename to Sources/WeiBei/Resources/Editor/KaTeX_Main-Bold.woff2 diff --git a/Sources/WeiBei/Resources/Editor/fonts/KaTeX_Main-BoldItalic.ttf b/Sources/WeiBei/Resources/Editor/KaTeX_Main-BoldItalic.ttf similarity index 100% rename from Sources/WeiBei/Resources/Editor/fonts/KaTeX_Main-BoldItalic.ttf rename to Sources/WeiBei/Resources/Editor/KaTeX_Main-BoldItalic.ttf diff --git a/Sources/WeiBei/Resources/Editor/fonts/KaTeX_Main-BoldItalic.woff b/Sources/WeiBei/Resources/Editor/KaTeX_Main-BoldItalic.woff similarity index 100% rename from Sources/WeiBei/Resources/Editor/fonts/KaTeX_Main-BoldItalic.woff rename to Sources/WeiBei/Resources/Editor/KaTeX_Main-BoldItalic.woff diff --git a/Sources/WeiBei/Resources/Editor/fonts/KaTeX_Main-BoldItalic.woff2 b/Sources/WeiBei/Resources/Editor/KaTeX_Main-BoldItalic.woff2 similarity index 100% rename from Sources/WeiBei/Resources/Editor/fonts/KaTeX_Main-BoldItalic.woff2 rename to Sources/WeiBei/Resources/Editor/KaTeX_Main-BoldItalic.woff2 diff --git a/Sources/WeiBei/Resources/Editor/fonts/KaTeX_Main-Italic.ttf b/Sources/WeiBei/Resources/Editor/KaTeX_Main-Italic.ttf similarity index 100% rename from Sources/WeiBei/Resources/Editor/fonts/KaTeX_Main-Italic.ttf rename to Sources/WeiBei/Resources/Editor/KaTeX_Main-Italic.ttf diff --git a/Sources/WeiBei/Resources/Editor/fonts/KaTeX_Main-Italic.woff b/Sources/WeiBei/Resources/Editor/KaTeX_Main-Italic.woff similarity index 100% rename from Sources/WeiBei/Resources/Editor/fonts/KaTeX_Main-Italic.woff rename to Sources/WeiBei/Resources/Editor/KaTeX_Main-Italic.woff diff --git a/Sources/WeiBei/Resources/Editor/fonts/KaTeX_Main-Italic.woff2 b/Sources/WeiBei/Resources/Editor/KaTeX_Main-Italic.woff2 similarity index 100% rename from Sources/WeiBei/Resources/Editor/fonts/KaTeX_Main-Italic.woff2 rename to Sources/WeiBei/Resources/Editor/KaTeX_Main-Italic.woff2 diff --git a/Sources/WeiBei/Resources/Editor/fonts/KaTeX_Main-Regular.ttf b/Sources/WeiBei/Resources/Editor/KaTeX_Main-Regular.ttf similarity index 100% rename from Sources/WeiBei/Resources/Editor/fonts/KaTeX_Main-Regular.ttf rename to Sources/WeiBei/Resources/Editor/KaTeX_Main-Regular.ttf diff --git a/Sources/WeiBei/Resources/Editor/fonts/KaTeX_Main-Regular.woff b/Sources/WeiBei/Resources/Editor/KaTeX_Main-Regular.woff similarity index 100% rename from Sources/WeiBei/Resources/Editor/fonts/KaTeX_Main-Regular.woff rename to Sources/WeiBei/Resources/Editor/KaTeX_Main-Regular.woff diff --git a/Sources/WeiBei/Resources/Editor/fonts/KaTeX_Main-Regular.woff2 b/Sources/WeiBei/Resources/Editor/KaTeX_Main-Regular.woff2 similarity index 100% rename from Sources/WeiBei/Resources/Editor/fonts/KaTeX_Main-Regular.woff2 rename to Sources/WeiBei/Resources/Editor/KaTeX_Main-Regular.woff2 diff --git a/Sources/WeiBei/Resources/Editor/fonts/KaTeX_Math-BoldItalic.ttf b/Sources/WeiBei/Resources/Editor/KaTeX_Math-BoldItalic.ttf similarity index 100% rename from Sources/WeiBei/Resources/Editor/fonts/KaTeX_Math-BoldItalic.ttf rename to Sources/WeiBei/Resources/Editor/KaTeX_Math-BoldItalic.ttf diff --git a/Sources/WeiBei/Resources/Editor/fonts/KaTeX_Math-BoldItalic.woff b/Sources/WeiBei/Resources/Editor/KaTeX_Math-BoldItalic.woff similarity index 100% rename from Sources/WeiBei/Resources/Editor/fonts/KaTeX_Math-BoldItalic.woff rename to Sources/WeiBei/Resources/Editor/KaTeX_Math-BoldItalic.woff diff --git a/Sources/WeiBei/Resources/Editor/fonts/KaTeX_Math-BoldItalic.woff2 b/Sources/WeiBei/Resources/Editor/KaTeX_Math-BoldItalic.woff2 similarity index 100% rename from Sources/WeiBei/Resources/Editor/fonts/KaTeX_Math-BoldItalic.woff2 rename to Sources/WeiBei/Resources/Editor/KaTeX_Math-BoldItalic.woff2 diff --git a/Sources/WeiBei/Resources/Editor/fonts/KaTeX_Math-Italic.ttf b/Sources/WeiBei/Resources/Editor/KaTeX_Math-Italic.ttf similarity index 100% rename from Sources/WeiBei/Resources/Editor/fonts/KaTeX_Math-Italic.ttf rename to Sources/WeiBei/Resources/Editor/KaTeX_Math-Italic.ttf diff --git a/Sources/WeiBei/Resources/Editor/fonts/KaTeX_Math-Italic.woff b/Sources/WeiBei/Resources/Editor/KaTeX_Math-Italic.woff similarity index 100% rename from Sources/WeiBei/Resources/Editor/fonts/KaTeX_Math-Italic.woff rename to Sources/WeiBei/Resources/Editor/KaTeX_Math-Italic.woff diff --git a/Sources/WeiBei/Resources/Editor/fonts/KaTeX_Math-Italic.woff2 b/Sources/WeiBei/Resources/Editor/KaTeX_Math-Italic.woff2 similarity index 100% rename from Sources/WeiBei/Resources/Editor/fonts/KaTeX_Math-Italic.woff2 rename to Sources/WeiBei/Resources/Editor/KaTeX_Math-Italic.woff2 diff --git a/Sources/WeiBei/Resources/Editor/fonts/KaTeX_SansSerif-Bold.ttf b/Sources/WeiBei/Resources/Editor/KaTeX_SansSerif-Bold.ttf similarity index 100% rename from Sources/WeiBei/Resources/Editor/fonts/KaTeX_SansSerif-Bold.ttf rename to Sources/WeiBei/Resources/Editor/KaTeX_SansSerif-Bold.ttf diff --git a/Sources/WeiBei/Resources/Editor/fonts/KaTeX_SansSerif-Bold.woff b/Sources/WeiBei/Resources/Editor/KaTeX_SansSerif-Bold.woff similarity index 100% rename from Sources/WeiBei/Resources/Editor/fonts/KaTeX_SansSerif-Bold.woff rename to Sources/WeiBei/Resources/Editor/KaTeX_SansSerif-Bold.woff diff --git a/Sources/WeiBei/Resources/Editor/fonts/KaTeX_SansSerif-Bold.woff2 b/Sources/WeiBei/Resources/Editor/KaTeX_SansSerif-Bold.woff2 similarity index 100% rename from Sources/WeiBei/Resources/Editor/fonts/KaTeX_SansSerif-Bold.woff2 rename to Sources/WeiBei/Resources/Editor/KaTeX_SansSerif-Bold.woff2 diff --git a/Sources/WeiBei/Resources/Editor/fonts/KaTeX_SansSerif-Italic.ttf b/Sources/WeiBei/Resources/Editor/KaTeX_SansSerif-Italic.ttf similarity index 100% rename from Sources/WeiBei/Resources/Editor/fonts/KaTeX_SansSerif-Italic.ttf rename to Sources/WeiBei/Resources/Editor/KaTeX_SansSerif-Italic.ttf diff --git a/Sources/WeiBei/Resources/Editor/fonts/KaTeX_SansSerif-Italic.woff b/Sources/WeiBei/Resources/Editor/KaTeX_SansSerif-Italic.woff similarity index 100% rename from Sources/WeiBei/Resources/Editor/fonts/KaTeX_SansSerif-Italic.woff rename to Sources/WeiBei/Resources/Editor/KaTeX_SansSerif-Italic.woff diff --git a/Sources/WeiBei/Resources/Editor/fonts/KaTeX_SansSerif-Italic.woff2 b/Sources/WeiBei/Resources/Editor/KaTeX_SansSerif-Italic.woff2 similarity index 100% rename from Sources/WeiBei/Resources/Editor/fonts/KaTeX_SansSerif-Italic.woff2 rename to Sources/WeiBei/Resources/Editor/KaTeX_SansSerif-Italic.woff2 diff --git a/Sources/WeiBei/Resources/Editor/fonts/KaTeX_SansSerif-Regular.ttf b/Sources/WeiBei/Resources/Editor/KaTeX_SansSerif-Regular.ttf similarity index 100% rename from Sources/WeiBei/Resources/Editor/fonts/KaTeX_SansSerif-Regular.ttf rename to Sources/WeiBei/Resources/Editor/KaTeX_SansSerif-Regular.ttf diff --git a/Sources/WeiBei/Resources/Editor/fonts/KaTeX_SansSerif-Regular.woff b/Sources/WeiBei/Resources/Editor/KaTeX_SansSerif-Regular.woff similarity index 100% rename from Sources/WeiBei/Resources/Editor/fonts/KaTeX_SansSerif-Regular.woff rename to Sources/WeiBei/Resources/Editor/KaTeX_SansSerif-Regular.woff diff --git a/Sources/WeiBei/Resources/Editor/fonts/KaTeX_SansSerif-Regular.woff2 b/Sources/WeiBei/Resources/Editor/KaTeX_SansSerif-Regular.woff2 similarity index 100% rename from Sources/WeiBei/Resources/Editor/fonts/KaTeX_SansSerif-Regular.woff2 rename to Sources/WeiBei/Resources/Editor/KaTeX_SansSerif-Regular.woff2 diff --git a/Sources/WeiBei/Resources/Editor/fonts/KaTeX_Script-Regular.ttf b/Sources/WeiBei/Resources/Editor/KaTeX_Script-Regular.ttf similarity index 100% rename from Sources/WeiBei/Resources/Editor/fonts/KaTeX_Script-Regular.ttf rename to Sources/WeiBei/Resources/Editor/KaTeX_Script-Regular.ttf diff --git a/Sources/WeiBei/Resources/Editor/fonts/KaTeX_Script-Regular.woff b/Sources/WeiBei/Resources/Editor/KaTeX_Script-Regular.woff similarity index 100% rename from Sources/WeiBei/Resources/Editor/fonts/KaTeX_Script-Regular.woff rename to Sources/WeiBei/Resources/Editor/KaTeX_Script-Regular.woff diff --git a/Sources/WeiBei/Resources/Editor/fonts/KaTeX_Script-Regular.woff2 b/Sources/WeiBei/Resources/Editor/KaTeX_Script-Regular.woff2 similarity index 100% rename from Sources/WeiBei/Resources/Editor/fonts/KaTeX_Script-Regular.woff2 rename to Sources/WeiBei/Resources/Editor/KaTeX_Script-Regular.woff2 diff --git a/Sources/WeiBei/Resources/Editor/fonts/KaTeX_Size1-Regular.ttf b/Sources/WeiBei/Resources/Editor/KaTeX_Size1-Regular.ttf similarity index 100% rename from Sources/WeiBei/Resources/Editor/fonts/KaTeX_Size1-Regular.ttf rename to Sources/WeiBei/Resources/Editor/KaTeX_Size1-Regular.ttf diff --git a/Sources/WeiBei/Resources/Editor/fonts/KaTeX_Size1-Regular.woff b/Sources/WeiBei/Resources/Editor/KaTeX_Size1-Regular.woff similarity index 100% rename from Sources/WeiBei/Resources/Editor/fonts/KaTeX_Size1-Regular.woff rename to Sources/WeiBei/Resources/Editor/KaTeX_Size1-Regular.woff diff --git a/Sources/WeiBei/Resources/Editor/fonts/KaTeX_Size1-Regular.woff2 b/Sources/WeiBei/Resources/Editor/KaTeX_Size1-Regular.woff2 similarity index 100% rename from Sources/WeiBei/Resources/Editor/fonts/KaTeX_Size1-Regular.woff2 rename to Sources/WeiBei/Resources/Editor/KaTeX_Size1-Regular.woff2 diff --git a/Sources/WeiBei/Resources/Editor/fonts/KaTeX_Size2-Regular.ttf b/Sources/WeiBei/Resources/Editor/KaTeX_Size2-Regular.ttf similarity index 100% rename from Sources/WeiBei/Resources/Editor/fonts/KaTeX_Size2-Regular.ttf rename to Sources/WeiBei/Resources/Editor/KaTeX_Size2-Regular.ttf diff --git a/Sources/WeiBei/Resources/Editor/fonts/KaTeX_Size2-Regular.woff b/Sources/WeiBei/Resources/Editor/KaTeX_Size2-Regular.woff similarity index 100% rename from Sources/WeiBei/Resources/Editor/fonts/KaTeX_Size2-Regular.woff rename to Sources/WeiBei/Resources/Editor/KaTeX_Size2-Regular.woff diff --git a/Sources/WeiBei/Resources/Editor/fonts/KaTeX_Size2-Regular.woff2 b/Sources/WeiBei/Resources/Editor/KaTeX_Size2-Regular.woff2 similarity index 100% rename from Sources/WeiBei/Resources/Editor/fonts/KaTeX_Size2-Regular.woff2 rename to Sources/WeiBei/Resources/Editor/KaTeX_Size2-Regular.woff2 diff --git a/Sources/WeiBei/Resources/Editor/fonts/KaTeX_Size3-Regular.ttf b/Sources/WeiBei/Resources/Editor/KaTeX_Size3-Regular.ttf similarity index 100% rename from Sources/WeiBei/Resources/Editor/fonts/KaTeX_Size3-Regular.ttf rename to Sources/WeiBei/Resources/Editor/KaTeX_Size3-Regular.ttf diff --git a/Sources/WeiBei/Resources/Editor/fonts/KaTeX_Size3-Regular.woff b/Sources/WeiBei/Resources/Editor/KaTeX_Size3-Regular.woff similarity index 100% rename from Sources/WeiBei/Resources/Editor/fonts/KaTeX_Size3-Regular.woff rename to Sources/WeiBei/Resources/Editor/KaTeX_Size3-Regular.woff diff --git a/Sources/WeiBei/Resources/Editor/fonts/KaTeX_Size3-Regular.woff2 b/Sources/WeiBei/Resources/Editor/KaTeX_Size3-Regular.woff2 similarity index 100% rename from Sources/WeiBei/Resources/Editor/fonts/KaTeX_Size3-Regular.woff2 rename to Sources/WeiBei/Resources/Editor/KaTeX_Size3-Regular.woff2 diff --git a/Sources/WeiBei/Resources/Editor/fonts/KaTeX_Size4-Regular.ttf b/Sources/WeiBei/Resources/Editor/KaTeX_Size4-Regular.ttf similarity index 100% rename from Sources/WeiBei/Resources/Editor/fonts/KaTeX_Size4-Regular.ttf rename to Sources/WeiBei/Resources/Editor/KaTeX_Size4-Regular.ttf diff --git a/Sources/WeiBei/Resources/Editor/fonts/KaTeX_Size4-Regular.woff b/Sources/WeiBei/Resources/Editor/KaTeX_Size4-Regular.woff similarity index 100% rename from Sources/WeiBei/Resources/Editor/fonts/KaTeX_Size4-Regular.woff rename to Sources/WeiBei/Resources/Editor/KaTeX_Size4-Regular.woff diff --git a/Sources/WeiBei/Resources/Editor/fonts/KaTeX_Size4-Regular.woff2 b/Sources/WeiBei/Resources/Editor/KaTeX_Size4-Regular.woff2 similarity index 100% rename from Sources/WeiBei/Resources/Editor/fonts/KaTeX_Size4-Regular.woff2 rename to Sources/WeiBei/Resources/Editor/KaTeX_Size4-Regular.woff2 diff --git a/Sources/WeiBei/Resources/Editor/fonts/KaTeX_Typewriter-Regular.ttf b/Sources/WeiBei/Resources/Editor/KaTeX_Typewriter-Regular.ttf similarity index 100% rename from Sources/WeiBei/Resources/Editor/fonts/KaTeX_Typewriter-Regular.ttf rename to Sources/WeiBei/Resources/Editor/KaTeX_Typewriter-Regular.ttf diff --git a/Sources/WeiBei/Resources/Editor/fonts/KaTeX_Typewriter-Regular.woff b/Sources/WeiBei/Resources/Editor/KaTeX_Typewriter-Regular.woff similarity index 100% rename from Sources/WeiBei/Resources/Editor/fonts/KaTeX_Typewriter-Regular.woff rename to Sources/WeiBei/Resources/Editor/KaTeX_Typewriter-Regular.woff diff --git a/Sources/WeiBei/Resources/Editor/fonts/KaTeX_Typewriter-Regular.woff2 b/Sources/WeiBei/Resources/Editor/KaTeX_Typewriter-Regular.woff2 similarity index 100% rename from Sources/WeiBei/Resources/Editor/fonts/KaTeX_Typewriter-Regular.woff2 rename to Sources/WeiBei/Resources/Editor/KaTeX_Typewriter-Regular.woff2 diff --git a/Sources/WeiBei/Resources/Editor/editor-resources.json b/Sources/WeiBei/Resources/Editor/editor-resources.json index 93ad2de1f..da5788cd9 100644 --- a/Sources/WeiBei/Resources/Editor/editor-resources.json +++ b/Sources/WeiBei/Resources/Editor/editor-resources.json @@ -8,314 +8,314 @@ }, { "name": "editor.css", - "bytes": 24099, - "sha256": "54dcfb2eaeb7e32135582f35fe7a2f081970ce67fb44dbdf4c62be16bb90fcec" + "bytes": 23739, + "sha256": "cbedfb998012fc3635264e00c872cdcb15f45dca9ad6d3e1c6ac120c6b5cbae8" }, { - "name": "fonts/KaTeX_AMS-Regular.ttf", + "name": "index.html", + "bytes": 49020, + "sha256": "28437821549e01b3261c3bfb4322ef47d518484f6c97f1b0a0d97f92d9b54edb" + }, + { + "name": "KaTeX_AMS-Regular.ttf", "bytes": 63632, "sha256": "68534840bcfdd2bffb6f0e8deb48684dd01e7f04ea2813267577afb906de1d13" }, { - "name": "fonts/KaTeX_AMS-Regular.woff", + "name": "KaTeX_AMS-Regular.woff", "bytes": 33516, "sha256": "30da91e84c893f875e252689faebdc590b2871145e8adc7f9a9d4dbd8ce0b251" }, { - "name": "fonts/KaTeX_AMS-Regular.woff2", + "name": "KaTeX_AMS-Regular.woff2", "bytes": 28076, "sha256": "0cdd387c9590a1a9f9794560022dbb59654a7d86f187aa0c81495ad42d3a7308" }, { - "name": "fonts/KaTeX_Caligraphic-Bold.ttf", + "name": "KaTeX_Caligraphic-Bold.ttf", "bytes": 12368, "sha256": "07d8e303ce4fc12b4bb54f1004170dd190a1f3db45d400fe68060df3e0897268" }, { - "name": "fonts/KaTeX_Caligraphic-Bold.woff", + "name": "KaTeX_Caligraphic-Bold.woff", "bytes": 7716, "sha256": "1ae6bd7475590e97e7f145a89e09ccde322f7a6bc0b91607b1c8b8ee28290fed" }, { - "name": "fonts/KaTeX_Caligraphic-Bold.woff2", + "name": "KaTeX_Caligraphic-Bold.woff2", "bytes": 6912, "sha256": "de7701e42cf1f4cf0b766c03fb27977207eee2f4fd5d76fa82188406da43ea4c" }, { - "name": "fonts/KaTeX_Caligraphic-Regular.ttf", + "name": "KaTeX_Caligraphic-Regular.ttf", "bytes": 12344, "sha256": "ed0b74372feefcbb9c0666b2e210da37b7e49fa7fbbf3eeb11db5f693dacfbb7" }, { - "name": "fonts/KaTeX_Caligraphic-Regular.woff", + "name": "KaTeX_Caligraphic-Regular.woff", "bytes": 7656, "sha256": "3398dd02302557a793f2863f88e02d96ce10df2abffa07c8e9fa90775116e65c" }, { - "name": "fonts/KaTeX_Caligraphic-Regular.woff2", + "name": "KaTeX_Caligraphic-Regular.woff2", "bytes": 6908, "sha256": "5d53e70ad607c2352162dec9e0923fb54ecdafaccbf604cd8dcf7d00facb989b" }, { - "name": "fonts/KaTeX_Fraktur-Bold.ttf", + "name": "KaTeX_Fraktur-Bold.ttf", "bytes": 19584, "sha256": "9163df9c7122432e6495b4229fa9071cf9ae86a758ae5efc4924ec2e1a6dbce1" }, { - "name": "fonts/KaTeX_Fraktur-Bold.woff", + "name": "KaTeX_Fraktur-Bold.woff", "bytes": 13296, "sha256": "9be7ceb88004ab8ad124082246fbfcca4091e36385d4ec6ed1df67375dad50fb" }, { - "name": "fonts/KaTeX_Fraktur-Bold.woff2", + "name": "KaTeX_Fraktur-Bold.woff2", "bytes": 11348, "sha256": "74444efd593c005e3f4573b44524704c0af0a937fe911cca9e94068d0d140d3f" }, { - "name": "fonts/KaTeX_Fraktur-Regular.ttf", + "name": "KaTeX_Fraktur-Regular.ttf", "bytes": 19572, "sha256": "1e6f9579e90e2cac37f8f60a597c436e075c114385652b7cbeb0dec0421291b3" }, { - "name": "fonts/KaTeX_Fraktur-Regular.woff", + "name": "KaTeX_Fraktur-Regular.woff", "bytes": 13208, "sha256": "5e28753be717dac97f559f49bc10be9cf3c124ddcabda6659d11cb68febc6463" }, { - "name": "fonts/KaTeX_Fraktur-Regular.woff2", + "name": "KaTeX_Fraktur-Regular.woff2", "bytes": 11316, "sha256": "51814d270d06ff0255dba0799994fa4d8c84d11f09951d47595f4abb1f3602dc" }, { - "name": "fonts/KaTeX_Main-Bold.ttf", + "name": "KaTeX_Main-Bold.ttf", "bytes": 51336, "sha256": "138ac28d1663b3037e9c5f52371fa5c63d8324f4a38d22cd573e6ea3a3fd0cf8" }, { - "name": "fonts/KaTeX_Main-Bold.woff", + "name": "KaTeX_Main-Bold.woff", "bytes": 29912, "sha256": "c76c5d696297d51b9cb1639c7da4334f0e7dec81b42b11213b5e25ef671bb822" }, { - "name": "fonts/KaTeX_Main-Bold.woff2", + "name": "KaTeX_Main-Bold.woff2", "bytes": 25324, "sha256": "0f60d1b897938ec918c8ce073092411baf9438f6739465693ff18b0f9d20b021" }, { - "name": "fonts/KaTeX_Main-BoldItalic.ttf", + "name": "KaTeX_Main-BoldItalic.ttf", "bytes": 32968, "sha256": "70ee1f64a20f2048c21940ef46d0144fd215baa953ca69afd1e31e98544f708f" }, { - "name": "fonts/KaTeX_Main-BoldItalic.woff", + "name": "KaTeX_Main-BoldItalic.woff", "bytes": 19412, "sha256": "a6f7ec0d846ac7ad975adb8959c37ed49b94acbc4ae436db9ce9e20287e4a64c" }, { - "name": "fonts/KaTeX_Main-BoldItalic.woff2", + "name": "KaTeX_Main-BoldItalic.woff2", "bytes": 16780, "sha256": "99cd42a3c072d918f2f44984a807cf7aa16e13545fd0875fc07c6c65f99e715b" }, { - "name": "fonts/KaTeX_Main-Italic.ttf", + "name": "KaTeX_Main-Italic.ttf", "bytes": 33580, "sha256": "0d85ae7cc30f23790a7f1a58c4a112fdca8aae769b6ba11429af1d98b1b6cb3a" }, { - "name": "fonts/KaTeX_Main-Italic.woff", + "name": "KaTeX_Main-Italic.woff", "bytes": 19676, "sha256": "f1d6ef86f3b11a528bd5185199bd2443ecb2b0dead96d88674b5a2c12be24bdf" }, { - "name": "fonts/KaTeX_Main-Italic.woff2", + "name": "KaTeX_Main-Italic.woff2", "bytes": 16988, "sha256": "97479ca6cce906abc961ecac96faa5f9ca2e61b8e7670d475826bcdee9a7c267" }, { - "name": "fonts/KaTeX_Main-Regular.ttf", + "name": "KaTeX_Main-Regular.ttf", "bytes": 53580, "sha256": "d0332f52868370fd83ae7fa46470f90c8f2eab2fcf12bc4f88080b340c95a830" }, { - "name": "fonts/KaTeX_Main-Regular.woff", + "name": "KaTeX_Main-Regular.woff", "bytes": 30772, "sha256": "c6368d87e8a1a3a5d337623d83d8dc4b868f242a9ad476237d6f8d1e0f168cdc" }, { - "name": "fonts/KaTeX_Main-Regular.woff2", + "name": "KaTeX_Main-Regular.woff2", "bytes": 26272, "sha256": "c2342cd8b869e01752a9321dc17213fc40d4d04c79688c1d43f2cf316abd7866" }, { - "name": "fonts/KaTeX_Math-BoldItalic.ttf", + "name": "KaTeX_Math-BoldItalic.ttf", "bytes": 31196, "sha256": "f9377ab0271cda59af24bcffbd46a4d0c8a3572ffafdbb38de2ad5ea7b0d5ee5" }, { - "name": "fonts/KaTeX_Math-BoldItalic.woff", + "name": "KaTeX_Math-BoldItalic.woff", "bytes": 18668, "sha256": "850c0af5c2238497febaf5e461d880bf458c341f42f4f330f1b1ab5698b1998e" }, { - "name": "fonts/KaTeX_Math-BoldItalic.woff2", + "name": "KaTeX_Math-BoldItalic.woff2", "bytes": 16400, "sha256": "dc47344dbb6cb5b655c8460d561f4df5f501b90c804ad3c6cec65fe322351ab1" }, { - "name": "fonts/KaTeX_Math-Italic.ttf", + "name": "KaTeX_Math-Italic.ttf", "bytes": 31308, "sha256": "08ce98e51b04d58945a301e639e02b6998af29fdfd61a7b8afdd07bbfc479d4a" }, { - "name": "fonts/KaTeX_Math-Italic.woff", + "name": "KaTeX_Math-Italic.woff", "bytes": 18748, "sha256": "8a8d244581371912b8f3f5a23e2437cb2a59cd9bcaebb0346e722c05737a2571" }, { - "name": "fonts/KaTeX_Math-Italic.woff2", + "name": "KaTeX_Math-Italic.woff2", "bytes": 16440, "sha256": "7af58c5ec8f132a2ddde9027c6d7814decce4d3b822a11192a42a20e2e973264" }, { - "name": "fonts/KaTeX_SansSerif-Bold.ttf", + "name": "KaTeX_SansSerif-Bold.ttf", "bytes": 24504, "sha256": "1ece03f79f95277d57dc7f6b435a74e1379b0d46104a8530286b60ff49369ea0" }, { - "name": "fonts/KaTeX_SansSerif-Bold.woff", + "name": "KaTeX_SansSerif-Bold.woff", "bytes": 14408, "sha256": "ece03cfd83e22c212cdef66feb8442d25a083beb988db3f1883f3f9738d750ba" }, { - "name": "fonts/KaTeX_SansSerif-Bold.woff2", + "name": "KaTeX_SansSerif-Bold.woff2", "bytes": 12216, "sha256": "e99ae51144bf1232efcc1bfe5add36262c6866b0faab24fa75740e1b98577a62" }, { - "name": "fonts/KaTeX_SansSerif-Italic.ttf", + "name": "KaTeX_SansSerif-Italic.ttf", "bytes": 22364, "sha256": "3931dd81faed86ba021bb2bbdc36f5bed9a38d6b4f4077aca59b265aa1b02083" }, { - "name": "fonts/KaTeX_SansSerif-Italic.woff", + "name": "KaTeX_SansSerif-Italic.woff", "bytes": 14112, "sha256": "91ee67500cc0129aa0ace3ac5c61ff1692102f0f31d02b69347fba35dcb75bf2" }, { - "name": "fonts/KaTeX_SansSerif-Italic.woff2", + "name": "KaTeX_SansSerif-Italic.woff2", "bytes": 12028, "sha256": "00b26ac825e2095056396e0553b8ac26d3f8ad158c3826e28b4c45b385c4714a" }, { - "name": "fonts/KaTeX_SansSerif-Regular.ttf", + "name": "KaTeX_SansSerif-Regular.ttf", "bytes": 19436, "sha256": "f36ea897e19f4a2e571d1e900e4e3710e438deb05a842486045ba0a3e616a4ad" }, { - "name": "fonts/KaTeX_SansSerif-Regular.woff", + "name": "KaTeX_SansSerif-Regular.woff", "bytes": 12316, "sha256": "11e4dc8a6471ff6d6ee561d53d10fde8f7489e798257ff449c5d37c197435605" }, { - "name": "fonts/KaTeX_SansSerif-Regular.woff2", + "name": "KaTeX_SansSerif-Regular.woff2", "bytes": 10344, "sha256": "68e8c73ef42afd3ccec58bf0fba302cce448938e7fc020a5e31f8a952eee1342" }, { - "name": "fonts/KaTeX_Script-Regular.ttf", + "name": "KaTeX_Script-Regular.ttf", "bytes": 16648, "sha256": "1c67f068fea8bb09bf099c088b1cf64bd27516a6e07f4684344873564bb66a67" }, { - "name": "fonts/KaTeX_Script-Regular.woff", + "name": "KaTeX_Script-Regular.woff", "bytes": 10588, "sha256": "d96cdf2b3bdd4d64a8fd5f74a4c467f123a8a73931cd435889f08ffaf9bf947a" }, { - "name": "fonts/KaTeX_Script-Regular.woff2", + "name": "KaTeX_Script-Regular.woff2", "bytes": 9644, "sha256": "036d4e95149b69ff9bcc0cd55771efeb25ffa3947293e69acd78d5ac328c684b" }, { - "name": "fonts/KaTeX_Size1-Regular.ttf", + "name": "KaTeX_Size1-Regular.ttf", "bytes": 12228, "sha256": "95b6d2f1a50173bfedb8c63e1d1c99b10427d0a4df4201cb44513b226951a22b" }, { - "name": "fonts/KaTeX_Size1-Regular.woff", + "name": "KaTeX_Size1-Regular.woff", "bytes": 6496, "sha256": "c943cc986384f59e86bea5fd7dc50a9c4dfe567a7c05eb40d6790720dead97c9" }, { - "name": "fonts/KaTeX_Size1-Regular.woff2", + "name": "KaTeX_Size1-Regular.woff2", "bytes": 5468, "sha256": "6b47c40166b6dbe21a5dfca7718413f2147fd2399be1ba605d8ad39cedf25dfe" }, { - "name": "fonts/KaTeX_Size2-Regular.ttf", + "name": "KaTeX_Size2-Regular.ttf", "bytes": 11508, "sha256": "a6b2099fb555c60e3a0db3a08842ebf1d732c6eb4e4bf44913613bed4fc4e39b" }, { - "name": "fonts/KaTeX_Size2-Regular.woff", + "name": "KaTeX_Size2-Regular.woff", "bytes": 6188, "sha256": "2014c523c3210bcc166648c4d4cc57f05b747df07a24277bf71c51e67dc79e3d" }, { - "name": "fonts/KaTeX_Size2-Regular.woff2", + "name": "KaTeX_Size2-Regular.woff2", "bytes": 5208, "sha256": "d04c54219f9eaec6d4d4fd42dfb28785975a4794d6b2fc71e566b9cd6db842dd" }, { - "name": "fonts/KaTeX_Size3-Regular.ttf", + "name": "KaTeX_Size3-Regular.ttf", "bytes": 7588, "sha256": "500e04d54f0d51666332c9d2089aa803be22aa878eca539e59fa53c6e522b082" }, { - "name": "fonts/KaTeX_Size3-Regular.woff", + "name": "KaTeX_Size3-Regular.woff", "bytes": 4420, "sha256": "6ab6b62e9b62dae2c00dd90f791bd10950be0ecc3490d7d6045f51c2e8fe0949" }, { - "name": "fonts/KaTeX_Size3-Regular.woff2", + "name": "KaTeX_Size3-Regular.woff2", "bytes": 3624, "sha256": "73d591271b1604960cb10bb90fee021670af7297017e0e98480b332d11f51995" }, { - "name": "fonts/KaTeX_Size4-Regular.ttf", + "name": "KaTeX_Size4-Regular.ttf", "bytes": 10364, "sha256": "c647367d1dd4e162468717d020e1fc0f1dc5c26ebfdffbe55261713bf88c5877" }, { - "name": "fonts/KaTeX_Size4-Regular.woff", + "name": "KaTeX_Size4-Regular.woff", "bytes": 5980, "sha256": "99f9c6750b489c9462bf04900bd3f939df9b829339daaaaa99ef5495cdddea58" }, { - "name": "fonts/KaTeX_Size4-Regular.woff2", + "name": "KaTeX_Size4-Regular.woff2", "bytes": 4928, "sha256": "a4af7d414440a1c1790825cfb700cf9cf43b0f2c4b04f0ebc523011ad9853ec0" }, { - "name": "fonts/KaTeX_Typewriter-Regular.ttf", + "name": "KaTeX_Typewriter-Regular.ttf", "bytes": 27556, "sha256": "f01f3e87d9c6a61c0c081ceb577abd864eb00a612f7ac1620dd6915fad2ef5aa" }, { - "name": "fonts/KaTeX_Typewriter-Regular.woff", + "name": "KaTeX_Typewriter-Regular.woff", "bytes": 16028, "sha256": "e14fed02b1aba7ce9f5afd5844b5d0321b22351febc720e0de8b8723527609f7" }, { - "name": "fonts/KaTeX_Typewriter-Regular.woff2", + "name": "KaTeX_Typewriter-Regular.woff2", "bytes": 13568, "sha256": "71d517d67827787cfabdf186914cc3358eda539e37931941f2b2fd4a21f68c0b" }, - { - "name": "index.html", - "bytes": 49020, - "sha256": "28437821549e01b3261c3bfb4322ef47d518484f6c97f1b0a0d97f92d9b54edb" - }, { "name": "katex-runtime.js", "bytes": 266135, diff --git a/Sources/WeiBei/Resources/Editor/editor.css b/Sources/WeiBei/Resources/Editor/editor.css index aabc9e71f..c23de964f 100644 --- a/Sources/WeiBei/Resources/Editor/editor.css +++ b/Sources/WeiBei/Resources/Editor/editor.css @@ -1 +1 @@ -@font-face{font-family:KaTeX_AMS;src:url("./fonts/KaTeX_AMS-Regular.woff2") format("woff2"),url("./fonts/KaTeX_AMS-Regular.woff") format("woff"),url("./fonts/KaTeX_AMS-Regular.ttf") format("truetype");font-weight:400;font-style:normal;font-display:block}@font-face{font-family:KaTeX_Caligraphic;src:url("./fonts/KaTeX_Caligraphic-Bold.woff2") format("woff2"),url("./fonts/KaTeX_Caligraphic-Bold.woff") format("woff"),url("./fonts/KaTeX_Caligraphic-Bold.ttf") format("truetype");font-weight:700;font-style:normal;font-display:block}@font-face{font-family:KaTeX_Caligraphic;src:url("./fonts/KaTeX_Caligraphic-Regular.woff2") format("woff2"),url("./fonts/KaTeX_Caligraphic-Regular.woff") format("woff"),url("./fonts/KaTeX_Caligraphic-Regular.ttf") format("truetype");font-weight:400;font-style:normal;font-display:block}@font-face{font-family:KaTeX_Fraktur;src:url("./fonts/KaTeX_Fraktur-Bold.woff2") format("woff2"),url("./fonts/KaTeX_Fraktur-Bold.woff") format("woff"),url("./fonts/KaTeX_Fraktur-Bold.ttf") format("truetype");font-weight:700;font-style:normal;font-display:block}@font-face{font-family:KaTeX_Fraktur;src:url("./fonts/KaTeX_Fraktur-Regular.woff2") format("woff2"),url("./fonts/KaTeX_Fraktur-Regular.woff") format("woff"),url("./fonts/KaTeX_Fraktur-Regular.ttf") format("truetype");font-weight:400;font-style:normal;font-display:block}@font-face{font-family:KaTeX_Main;src:url("./fonts/KaTeX_Main-Bold.woff2") format("woff2"),url("./fonts/KaTeX_Main-Bold.woff") format("woff"),url("./fonts/KaTeX_Main-Bold.ttf") format("truetype");font-weight:700;font-style:normal;font-display:block}@font-face{font-family:KaTeX_Main;src:url("./fonts/KaTeX_Main-BoldItalic.woff2") format("woff2"),url("./fonts/KaTeX_Main-BoldItalic.woff") format("woff"),url("./fonts/KaTeX_Main-BoldItalic.ttf") format("truetype");font-weight:700;font-style:italic;font-display:block}@font-face{font-family:KaTeX_Main;src:url("./fonts/KaTeX_Main-Italic.woff2") format("woff2"),url("./fonts/KaTeX_Main-Italic.woff") format("woff"),url("./fonts/KaTeX_Main-Italic.ttf") format("truetype");font-weight:400;font-style:italic;font-display:block}@font-face{font-family:KaTeX_Main;src:url("./fonts/KaTeX_Main-Regular.woff2") format("woff2"),url("./fonts/KaTeX_Main-Regular.woff") format("woff"),url("./fonts/KaTeX_Main-Regular.ttf") format("truetype");font-weight:400;font-style:normal;font-display:block}@font-face{font-family:KaTeX_Math;src:url("./fonts/KaTeX_Math-BoldItalic.woff2") format("woff2"),url("./fonts/KaTeX_Math-BoldItalic.woff") format("woff"),url("./fonts/KaTeX_Math-BoldItalic.ttf") format("truetype");font-weight:700;font-style:italic;font-display:block}@font-face{font-family:KaTeX_Math;src:url("./fonts/KaTeX_Math-Italic.woff2") format("woff2"),url("./fonts/KaTeX_Math-Italic.woff") format("woff"),url("./fonts/KaTeX_Math-Italic.ttf") format("truetype");font-weight:400;font-style:italic;font-display:block}@font-face{font-family:KaTeX_SansSerif;src:url("./fonts/KaTeX_SansSerif-Bold.woff2") format("woff2"),url("./fonts/KaTeX_SansSerif-Bold.woff") format("woff"),url("./fonts/KaTeX_SansSerif-Bold.ttf") format("truetype");font-weight:700;font-style:normal;font-display:block}@font-face{font-family:KaTeX_SansSerif;src:url("./fonts/KaTeX_SansSerif-Italic.woff2") format("woff2"),url("./fonts/KaTeX_SansSerif-Italic.woff") format("woff"),url("./fonts/KaTeX_SansSerif-Italic.ttf") format("truetype");font-weight:400;font-style:italic;font-display:block}@font-face{font-family:KaTeX_SansSerif;src:url("./fonts/KaTeX_SansSerif-Regular.woff2") format("woff2"),url("./fonts/KaTeX_SansSerif-Regular.woff") format("woff"),url("./fonts/KaTeX_SansSerif-Regular.ttf") format("truetype");font-weight:400;font-style:normal;font-display:block}@font-face{font-family:KaTeX_Script;src:url("./fonts/KaTeX_Script-Regular.woff2") format("woff2"),url("./fonts/KaTeX_Script-Regular.woff") format("woff"),url("./fonts/KaTeX_Script-Regular.ttf") format("truetype");font-weight:400;font-style:normal;font-display:block}@font-face{font-family:KaTeX_Size1;src:url("./fonts/KaTeX_Size1-Regular.woff2") format("woff2"),url("./fonts/KaTeX_Size1-Regular.woff") format("woff"),url("./fonts/KaTeX_Size1-Regular.ttf") format("truetype");font-weight:400;font-style:normal;font-display:block}@font-face{font-family:KaTeX_Size2;src:url("./fonts/KaTeX_Size2-Regular.woff2") format("woff2"),url("./fonts/KaTeX_Size2-Regular.woff") format("woff"),url("./fonts/KaTeX_Size2-Regular.ttf") format("truetype");font-weight:400;font-style:normal;font-display:block}@font-face{font-family:KaTeX_Size3;src:url("./fonts/KaTeX_Size3-Regular.woff2") format("woff2"),url("./fonts/KaTeX_Size3-Regular.woff") format("woff"),url("./fonts/KaTeX_Size3-Regular.ttf") format("truetype");font-weight:400;font-style:normal;font-display:block}@font-face{font-family:KaTeX_Size4;src:url("./fonts/KaTeX_Size4-Regular.woff2") format("woff2"),url("./fonts/KaTeX_Size4-Regular.woff") format("woff"),url("./fonts/KaTeX_Size4-Regular.ttf") format("truetype");font-weight:400;font-style:normal;font-display:block}@font-face{font-family:KaTeX_Typewriter;src:url("./fonts/KaTeX_Typewriter-Regular.woff2") format("woff2"),url("./fonts/KaTeX_Typewriter-Regular.woff") format("woff"),url("./fonts/KaTeX_Typewriter-Regular.ttf") format("truetype");font-weight:400;font-style:normal;font-display:block}.katex{font: 1.21em KaTeX_Main,Times New Roman,serif;line-height:1.2;position:relative;text-indent:0;text-rendering:auto}.katex *{-ms-high-contrast-adjust:none!important}.katex *{border-color:currentColor}.katex .katex-version:after{content:"0.17.0"}.katex .katex-mathml{position:absolute;-webkit-clip-path:inset(50%);clip-path:inset(50%);padding:0;border:0;height:1px;width:1px;overflow:hidden}.katex .katex-html>.newline{display:block}.katex .base{position:relative;display:inline-block;white-space:nowrap;width:-webkit-min-content;width:-moz-min-content;width:min-content}.katex .strut{display:inline-block}.katex .textbf{font-weight:700}.katex .textit{font-style:italic}.katex .textrm{font-family:KaTeX_Main}.katex .textsf{font-family:KaTeX_SansSerif}.katex .texttt{font-family:KaTeX_Typewriter}.katex .mathnormal{font-family:KaTeX_Math;font-style:italic}.katex .mathit{font-family:KaTeX_Main;font-style:italic}.katex .mathrm{font-style:normal}.katex .mathbf{font-family:KaTeX_Main;font-weight:700}.katex .boldsymbol{font-family:KaTeX_Math;font-weight:700;font-style:italic}.katex .amsrm,.katex .mathbb,.katex .textbb{font-family:KaTeX_AMS}.katex .mathcal{font-family:KaTeX_Caligraphic}.katex .mathfrak,.katex .textfrak{font-family:KaTeX_Fraktur}.katex .mathboldfrak,.katex .textboldfrak{font-family:KaTeX_Fraktur;font-weight:700}.katex .mathtt{font-family:KaTeX_Typewriter}.katex .mathscr,.katex .textscr{font-family:KaTeX_Script}.katex .mathsf,.katex .textsf{font-family:KaTeX_SansSerif}.katex .mathboldsf,.katex .textboldsf{font-family:KaTeX_SansSerif;font-weight:700}.katex .mathsfit,.katex .mathitsf,.katex .textitsf{font-family:KaTeX_SansSerif;font-style:italic}.katex .mainrm{font-family:KaTeX_Main;font-style:normal}.katex .vlist-t{display:inline-table;table-layout:fixed;border-collapse:collapse}.katex .vlist-r{display:table-row}.katex .vlist{display:table-cell;vertical-align:bottom;position:relative}.katex .vlist>span{display:block;height:0;position:relative}.katex .vlist>span>span{display:inline-block}.katex .vlist>span>.pstrut{overflow:hidden;width:0}.katex .vlist-t2{margin-right:-2px}.katex .vlist-s{display:table-cell;vertical-align:bottom;font-size:1px;width:2px;min-width:2px}.katex .vbox{display:inline-flex;flex-direction:column;align-items:baseline}.katex .hbox{display:inline-flex;flex-direction:row;width:100%}.katex .thinbox{display:inline-flex;flex-direction:row;width:0;max-width:0}.katex .msupsub{text-align:left}.katex .mfrac>span>span{text-align:center}.katex .mfrac .frac-line{display:inline-block;width:100%;border-bottom-style:solid}.katex .mfrac .frac-line,.katex .overline .overline-line,.katex .underline .underline-line,.katex .hline,.katex .hdashline,.katex .rule{min-height:1px}.katex .mspace{display:inline-block}.katex .smash{display:inline;line-height:0}.katex .llap,.katex .rlap,.katex .clap{width:0;position:relative}.katex .llap>.inner,.katex .rlap>.inner,.katex .clap>.inner{position:absolute}.katex .llap>.fix,.katex .rlap>.fix,.katex .clap>.fix{display:inline-block}.katex .llap>.inner{right:0}.katex .rlap>.inner,.katex .clap>.inner{left:0}.katex .clap>.inner>span{margin-left:-50%;margin-right:50%}.katex .rule{display:inline-block;border:solid 0;position:relative}.katex .overline .overline-line,.katex .underline .underline-line,.katex .hline{display:inline-block;width:100%;border-bottom-style:solid}.katex .hdashline{display:inline-block;width:100%;border-bottom-style:dashed}.katex .sqrt>.root{margin-left:.2777777778em;margin-right:-.5555555556em}.katex .sizing.reset-size1.size1,.katex .fontsize-ensurer.reset-size1.size1{font-size:1em}.katex .sizing.reset-size1.size2,.katex .fontsize-ensurer.reset-size1.size2{font-size:1.2em}.katex .sizing.reset-size1.size3,.katex .fontsize-ensurer.reset-size1.size3{font-size:1.4em}.katex .sizing.reset-size1.size4,.katex .fontsize-ensurer.reset-size1.size4{font-size:1.6em}.katex .sizing.reset-size1.size5,.katex .fontsize-ensurer.reset-size1.size5{font-size:1.8em}.katex .sizing.reset-size1.size6,.katex .fontsize-ensurer.reset-size1.size6{font-size:2em}.katex .sizing.reset-size1.size7,.katex .fontsize-ensurer.reset-size1.size7{font-size:2.4em}.katex .sizing.reset-size1.size8,.katex .fontsize-ensurer.reset-size1.size8{font-size:2.88em}.katex .sizing.reset-size1.size9,.katex .fontsize-ensurer.reset-size1.size9{font-size:3.456em}.katex .sizing.reset-size1.size10,.katex .fontsize-ensurer.reset-size1.size10{font-size:4.148em}.katex .sizing.reset-size1.size11,.katex .fontsize-ensurer.reset-size1.size11{font-size:4.976em}.katex .sizing.reset-size2.size1,.katex .fontsize-ensurer.reset-size2.size1{font-size:.8333333333em}.katex .sizing.reset-size2.size2,.katex .fontsize-ensurer.reset-size2.size2{font-size:1em}.katex .sizing.reset-size2.size3,.katex .fontsize-ensurer.reset-size2.size3{font-size:1.1666666667em}.katex .sizing.reset-size2.size4,.katex .fontsize-ensurer.reset-size2.size4{font-size:1.3333333333em}.katex .sizing.reset-size2.size5,.katex .fontsize-ensurer.reset-size2.size5{font-size:1.5em}.katex .sizing.reset-size2.size6,.katex .fontsize-ensurer.reset-size2.size6{font-size:1.6666666667em}.katex .sizing.reset-size2.size7,.katex .fontsize-ensurer.reset-size2.size7{font-size:2em}.katex .sizing.reset-size2.size8,.katex .fontsize-ensurer.reset-size2.size8{font-size:2.4em}.katex .sizing.reset-size2.size9,.katex .fontsize-ensurer.reset-size2.size9{font-size:2.88em}.katex .sizing.reset-size2.size10,.katex .fontsize-ensurer.reset-size2.size10{font-size:3.4566666667em}.katex .sizing.reset-size2.size11,.katex .fontsize-ensurer.reset-size2.size11{font-size:4.1466666667em}.katex .sizing.reset-size3.size1,.katex .fontsize-ensurer.reset-size3.size1{font-size:.7142857143em}.katex .sizing.reset-size3.size2,.katex .fontsize-ensurer.reset-size3.size2{font-size:.8571428571em}.katex .sizing.reset-size3.size3,.katex .fontsize-ensurer.reset-size3.size3{font-size:1em}.katex .sizing.reset-size3.size4,.katex .fontsize-ensurer.reset-size3.size4{font-size:1.1428571429em}.katex .sizing.reset-size3.size5,.katex .fontsize-ensurer.reset-size3.size5{font-size:1.2857142857em}.katex .sizing.reset-size3.size6,.katex .fontsize-ensurer.reset-size3.size6{font-size:1.4285714286em}.katex .sizing.reset-size3.size7,.katex .fontsize-ensurer.reset-size3.size7{font-size:1.7142857143em}.katex .sizing.reset-size3.size8,.katex .fontsize-ensurer.reset-size3.size8{font-size:2.0571428571em}.katex .sizing.reset-size3.size9,.katex .fontsize-ensurer.reset-size3.size9{font-size:2.4685714286em}.katex .sizing.reset-size3.size10,.katex .fontsize-ensurer.reset-size3.size10{font-size:2.9628571429em}.katex .sizing.reset-size3.size11,.katex .fontsize-ensurer.reset-size3.size11{font-size:3.5542857143em}.katex .sizing.reset-size4.size1,.katex .fontsize-ensurer.reset-size4.size1{font-size:.625em}.katex .sizing.reset-size4.size2,.katex .fontsize-ensurer.reset-size4.size2{font-size:.75em}.katex .sizing.reset-size4.size3,.katex .fontsize-ensurer.reset-size4.size3{font-size:.875em}.katex .sizing.reset-size4.size4,.katex .fontsize-ensurer.reset-size4.size4{font-size:1em}.katex .sizing.reset-size4.size5,.katex .fontsize-ensurer.reset-size4.size5{font-size:1.125em}.katex .sizing.reset-size4.size6,.katex .fontsize-ensurer.reset-size4.size6{font-size:1.25em}.katex .sizing.reset-size4.size7,.katex .fontsize-ensurer.reset-size4.size7{font-size:1.5em}.katex .sizing.reset-size4.size8,.katex .fontsize-ensurer.reset-size4.size8{font-size:1.8em}.katex .sizing.reset-size4.size9,.katex .fontsize-ensurer.reset-size4.size9{font-size:2.16em}.katex .sizing.reset-size4.size10,.katex .fontsize-ensurer.reset-size4.size10{font-size:2.5925em}.katex .sizing.reset-size4.size11,.katex .fontsize-ensurer.reset-size4.size11{font-size:3.11em}.katex .sizing.reset-size5.size1,.katex .fontsize-ensurer.reset-size5.size1{font-size:.5555555556em}.katex .sizing.reset-size5.size2,.katex .fontsize-ensurer.reset-size5.size2{font-size:.6666666667em}.katex .sizing.reset-size5.size3,.katex .fontsize-ensurer.reset-size5.size3{font-size:.7777777778em}.katex .sizing.reset-size5.size4,.katex .fontsize-ensurer.reset-size5.size4{font-size:.8888888889em}.katex .sizing.reset-size5.size5,.katex .fontsize-ensurer.reset-size5.size5{font-size:1em}.katex .sizing.reset-size5.size6,.katex .fontsize-ensurer.reset-size5.size6{font-size:1.1111111111em}.katex .sizing.reset-size5.size7,.katex .fontsize-ensurer.reset-size5.size7{font-size:1.3333333333em}.katex .sizing.reset-size5.size8,.katex .fontsize-ensurer.reset-size5.size8{font-size:1.6em}.katex .sizing.reset-size5.size9,.katex .fontsize-ensurer.reset-size5.size9{font-size:1.92em}.katex .sizing.reset-size5.size10,.katex .fontsize-ensurer.reset-size5.size10{font-size:2.3044444444em}.katex .sizing.reset-size5.size11,.katex .fontsize-ensurer.reset-size5.size11{font-size:2.7644444444em}.katex .sizing.reset-size6.size1,.katex .fontsize-ensurer.reset-size6.size1{font-size:.5em}.katex .sizing.reset-size6.size2,.katex .fontsize-ensurer.reset-size6.size2{font-size:.6em}.katex .sizing.reset-size6.size3,.katex .fontsize-ensurer.reset-size6.size3{font-size:.7em}.katex .sizing.reset-size6.size4,.katex .fontsize-ensurer.reset-size6.size4{font-size:.8em}.katex .sizing.reset-size6.size5,.katex .fontsize-ensurer.reset-size6.size5{font-size:.9em}.katex .sizing.reset-size6.size6,.katex .fontsize-ensurer.reset-size6.size6{font-size:1em}.katex .sizing.reset-size6.size7,.katex .fontsize-ensurer.reset-size6.size7{font-size:1.2em}.katex .sizing.reset-size6.size8,.katex .fontsize-ensurer.reset-size6.size8{font-size:1.44em}.katex .sizing.reset-size6.size9,.katex .fontsize-ensurer.reset-size6.size9{font-size:1.728em}.katex .sizing.reset-size6.size10,.katex .fontsize-ensurer.reset-size6.size10{font-size:2.074em}.katex .sizing.reset-size6.size11,.katex .fontsize-ensurer.reset-size6.size11{font-size:2.488em}.katex .sizing.reset-size7.size1,.katex .fontsize-ensurer.reset-size7.size1{font-size:.4166666667em}.katex .sizing.reset-size7.size2,.katex .fontsize-ensurer.reset-size7.size2{font-size:.5em}.katex .sizing.reset-size7.size3,.katex .fontsize-ensurer.reset-size7.size3{font-size:.5833333333em}.katex .sizing.reset-size7.size4,.katex .fontsize-ensurer.reset-size7.size4{font-size:.6666666667em}.katex .sizing.reset-size7.size5,.katex .fontsize-ensurer.reset-size7.size5{font-size:.75em}.katex .sizing.reset-size7.size6,.katex .fontsize-ensurer.reset-size7.size6{font-size:.8333333333em}.katex .sizing.reset-size7.size7,.katex .fontsize-ensurer.reset-size7.size7{font-size:1em}.katex .sizing.reset-size7.size8,.katex .fontsize-ensurer.reset-size7.size8{font-size:1.2em}.katex .sizing.reset-size7.size9,.katex .fontsize-ensurer.reset-size7.size9{font-size:1.44em}.katex .sizing.reset-size7.size10,.katex .fontsize-ensurer.reset-size7.size10{font-size:1.7283333333em}.katex .sizing.reset-size7.size11,.katex .fontsize-ensurer.reset-size7.size11{font-size:2.0733333333em}.katex .sizing.reset-size8.size1,.katex .fontsize-ensurer.reset-size8.size1{font-size:.3472222222em}.katex .sizing.reset-size8.size2,.katex .fontsize-ensurer.reset-size8.size2{font-size:.4166666667em}.katex .sizing.reset-size8.size3,.katex .fontsize-ensurer.reset-size8.size3{font-size:.4861111111em}.katex .sizing.reset-size8.size4,.katex .fontsize-ensurer.reset-size8.size4{font-size:.5555555556em}.katex .sizing.reset-size8.size5,.katex .fontsize-ensurer.reset-size8.size5{font-size:.625em}.katex .sizing.reset-size8.size6,.katex .fontsize-ensurer.reset-size8.size6{font-size:.6944444444em}.katex .sizing.reset-size8.size7,.katex .fontsize-ensurer.reset-size8.size7{font-size:.8333333333em}.katex .sizing.reset-size8.size8,.katex .fontsize-ensurer.reset-size8.size8{font-size:1em}.katex .sizing.reset-size8.size9,.katex .fontsize-ensurer.reset-size8.size9{font-size:1.2em}.katex .sizing.reset-size8.size10,.katex .fontsize-ensurer.reset-size8.size10{font-size:1.4402777778em}.katex .sizing.reset-size8.size11,.katex .fontsize-ensurer.reset-size8.size11{font-size:1.7277777778em}.katex .sizing.reset-size9.size1,.katex .fontsize-ensurer.reset-size9.size1{font-size:.2893518519em}.katex .sizing.reset-size9.size2,.katex .fontsize-ensurer.reset-size9.size2{font-size:.3472222222em}.katex .sizing.reset-size9.size3,.katex .fontsize-ensurer.reset-size9.size3{font-size:.4050925926em}.katex .sizing.reset-size9.size4,.katex .fontsize-ensurer.reset-size9.size4{font-size:.462962963em}.katex .sizing.reset-size9.size5,.katex .fontsize-ensurer.reset-size9.size5{font-size:.5208333333em}.katex .sizing.reset-size9.size6,.katex .fontsize-ensurer.reset-size9.size6{font-size:.5787037037em}.katex .sizing.reset-size9.size7,.katex .fontsize-ensurer.reset-size9.size7{font-size:.6944444444em}.katex .sizing.reset-size9.size8,.katex .fontsize-ensurer.reset-size9.size8{font-size:.8333333333em}.katex .sizing.reset-size9.size9,.katex .fontsize-ensurer.reset-size9.size9{font-size:1em}.katex .sizing.reset-size9.size10,.katex .fontsize-ensurer.reset-size9.size10{font-size:1.2002314815em}.katex .sizing.reset-size9.size11,.katex .fontsize-ensurer.reset-size9.size11{font-size:1.4398148148em}.katex .sizing.reset-size10.size1,.katex .fontsize-ensurer.reset-size10.size1{font-size:.2410800386em}.katex .sizing.reset-size10.size2,.katex .fontsize-ensurer.reset-size10.size2{font-size:.2892960463em}.katex .sizing.reset-size10.size3,.katex .fontsize-ensurer.reset-size10.size3{font-size:.337512054em}.katex .sizing.reset-size10.size4,.katex .fontsize-ensurer.reset-size10.size4{font-size:.3857280617em}.katex .sizing.reset-size10.size5,.katex .fontsize-ensurer.reset-size10.size5{font-size:.4339440694em}.katex .sizing.reset-size10.size6,.katex .fontsize-ensurer.reset-size10.size6{font-size:.4821600771em}.katex .sizing.reset-size10.size7,.katex .fontsize-ensurer.reset-size10.size7{font-size:.5785920926em}.katex .sizing.reset-size10.size8,.katex .fontsize-ensurer.reset-size10.size8{font-size:.6943105111em}.katex .sizing.reset-size10.size9,.katex .fontsize-ensurer.reset-size10.size9{font-size:.8331726133em}.katex .sizing.reset-size10.size10,.katex .fontsize-ensurer.reset-size10.size10{font-size:1em}.katex .sizing.reset-size10.size11,.katex .fontsize-ensurer.reset-size10.size11{font-size:1.1996142719em}.katex .sizing.reset-size11.size1,.katex .fontsize-ensurer.reset-size11.size1{font-size:.2009646302em}.katex .sizing.reset-size11.size2,.katex .fontsize-ensurer.reset-size11.size2{font-size:.2411575563em}.katex .sizing.reset-size11.size3,.katex .fontsize-ensurer.reset-size11.size3{font-size:.2813504823em}.katex .sizing.reset-size11.size4,.katex .fontsize-ensurer.reset-size11.size4{font-size:.3215434084em}.katex .sizing.reset-size11.size5,.katex .fontsize-ensurer.reset-size11.size5{font-size:.3617363344em}.katex .sizing.reset-size11.size6,.katex .fontsize-ensurer.reset-size11.size6{font-size:.4019292605em}.katex .sizing.reset-size11.size7,.katex .fontsize-ensurer.reset-size11.size7{font-size:.4823151125em}.katex .sizing.reset-size11.size8,.katex .fontsize-ensurer.reset-size11.size8{font-size:.578778135em}.katex .sizing.reset-size11.size9,.katex .fontsize-ensurer.reset-size11.size9{font-size:.6945337621em}.katex .sizing.reset-size11.size10,.katex .fontsize-ensurer.reset-size11.size10{font-size:.8336012862em}.katex .sizing.reset-size11.size11,.katex .fontsize-ensurer.reset-size11.size11{font-size:1em}.katex .delimsizing.size1{font-family:KaTeX_Size1}.katex .delimsizing.size2{font-family:KaTeX_Size2}.katex .delimsizing.size3{font-family:KaTeX_Size3}.katex .delimsizing.size4{font-family:KaTeX_Size4}.katex .delimsizing.mult .delim-size1>span{font-family:KaTeX_Size1}.katex .delimsizing.mult .delim-size4>span{font-family:KaTeX_Size4}.katex .nulldelimiter{display:inline-block;width:.12em}.katex .delimcenter,.katex .op-symbol{position:relative}.katex .op-symbol.small-op{font-family:KaTeX_Size1}.katex .op-symbol.large-op{font-family:KaTeX_Size2}.katex .op-limits>.vlist-t{text-align:center}.katex .accent>.vlist-t{text-align:center}.katex .accent .accent-body{position:relative}.katex .accent .accent-body:not(.accent-full){width:0}.katex .overlay{display:block}.katex .mtable .vertical-separator{display:inline-block;min-width:1px}.katex .mtable .arraycolsep{display:inline-block}.katex .mtable .col-align-c>.vlist-t{text-align:center}.katex .mtable .col-align-l>.vlist-t{text-align:left}.katex .mtable .col-align-r>.vlist-t{text-align:right}.katex .svg-align{text-align:left}.katex svg{display:block;position:absolute;width:100%;height:inherit;fill:currentColor;stroke:currentColor}.katex svg path{stroke:none}.katex svg{fill-rule:nonzero;fill-opacity:1;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1}.katex img{border-style:none;min-width:0;min-height:0;max-width:none;max-height:none}.katex .stretchy{width:100%;display:block;position:relative;overflow:hidden}.katex .stretchy:before,.katex .stretchy:after{content:""}.katex .hide-tail{width:100%;position:relative;overflow:hidden}.katex .halfarrow-left{position:absolute;left:0;width:50.2%;overflow:hidden}.katex .halfarrow-right{position:absolute;right:0;width:50.2%;overflow:hidden}.katex .brace-left{position:absolute;left:0;width:25.1%;overflow:hidden}.katex .brace-center{position:absolute;left:25%;width:50%;overflow:hidden}.katex .brace-right{position:absolute;right:0;width:25.1%;overflow:hidden}.katex .x-arrow-pad{padding:0 .5em}.katex .cd-arrow-pad{padding:0 .55556em 0 .27778em}.katex .x-arrow,.katex .mover,.katex .munder{text-align:center}.katex .boxpad{padding:0 .3em}.katex .fbox,.katex .fcolorbox{box-sizing:border-box;border:.04em solid}.katex .cancel-pad{padding:0 .2em}.katex .cancel-lap{margin-left:-.2em;margin-right:-.2em}.katex .sout{border-bottom-style:solid;border-bottom-width:.08em}.katex .angl{box-sizing:border-box;border-top:.049em solid;border-right:.049em solid;margin-right:.03889em}.katex .anglpad{padding:0 .03889em}.katex .eqn-num:before{counter-increment:katexEqnNo;content:"(" counter(katexEqnNo) ")"}.katex .mml-eqn-num:before{counter-increment:mmlEqnNo;content:"(" counter(mmlEqnNo) ")"}.katex .mtr-glue{width:50%}.katex .cd-vert-arrow{display:inline-block;position:relative}.katex .cd-label-left{display:inline-block;position:absolute;right:calc(50% + .3em);text-align:left}.katex .cd-label-right{display:inline-block;position:absolute;left:calc(50% + .3em);text-align:right}.katex-display{display:block;margin:1em 0;text-align:center}.katex-display>.katex{display:block;text-align:center;white-space:nowrap}.katex-display>.katex>.katex-html{display:block;position:relative}.katex-display>.katex>.katex-html>.tag{position:absolute;right:0}.katex-display.leqno>.katex>.katex-html>.tag{left:0;right:auto}.katex-display.fleqn>.katex{text-align:left;padding-left:2em}body{counter-reset:katexEqnNo mmlEqnNo} +@font-face{font-family:KaTeX_AMS;src:url("./KaTeX_AMS-Regular.woff2") format("woff2"),url("./KaTeX_AMS-Regular.woff") format("woff"),url("./KaTeX_AMS-Regular.ttf") format("truetype");font-weight:400;font-style:normal;font-display:block}@font-face{font-family:KaTeX_Caligraphic;src:url("./KaTeX_Caligraphic-Bold.woff2") format("woff2"),url("./KaTeX_Caligraphic-Bold.woff") format("woff"),url("./KaTeX_Caligraphic-Bold.ttf") format("truetype");font-weight:700;font-style:normal;font-display:block}@font-face{font-family:KaTeX_Caligraphic;src:url("./KaTeX_Caligraphic-Regular.woff2") format("woff2"),url("./KaTeX_Caligraphic-Regular.woff") format("woff"),url("./KaTeX_Caligraphic-Regular.ttf") format("truetype");font-weight:400;font-style:normal;font-display:block}@font-face{font-family:KaTeX_Fraktur;src:url("./KaTeX_Fraktur-Bold.woff2") format("woff2"),url("./KaTeX_Fraktur-Bold.woff") format("woff"),url("./KaTeX_Fraktur-Bold.ttf") format("truetype");font-weight:700;font-style:normal;font-display:block}@font-face{font-family:KaTeX_Fraktur;src:url("./KaTeX_Fraktur-Regular.woff2") format("woff2"),url("./KaTeX_Fraktur-Regular.woff") format("woff"),url("./KaTeX_Fraktur-Regular.ttf") format("truetype");font-weight:400;font-style:normal;font-display:block}@font-face{font-family:KaTeX_Main;src:url("./KaTeX_Main-Bold.woff2") format("woff2"),url("./KaTeX_Main-Bold.woff") format("woff"),url("./KaTeX_Main-Bold.ttf") format("truetype");font-weight:700;font-style:normal;font-display:block}@font-face{font-family:KaTeX_Main;src:url("./KaTeX_Main-BoldItalic.woff2") format("woff2"),url("./KaTeX_Main-BoldItalic.woff") format("woff"),url("./KaTeX_Main-BoldItalic.ttf") format("truetype");font-weight:700;font-style:italic;font-display:block}@font-face{font-family:KaTeX_Main;src:url("./KaTeX_Main-Italic.woff2") format("woff2"),url("./KaTeX_Main-Italic.woff") format("woff"),url("./KaTeX_Main-Italic.ttf") format("truetype");font-weight:400;font-style:italic;font-display:block}@font-face{font-family:KaTeX_Main;src:url("./KaTeX_Main-Regular.woff2") format("woff2"),url("./KaTeX_Main-Regular.woff") format("woff"),url("./KaTeX_Main-Regular.ttf") format("truetype");font-weight:400;font-style:normal;font-display:block}@font-face{font-family:KaTeX_Math;src:url("./KaTeX_Math-BoldItalic.woff2") format("woff2"),url("./KaTeX_Math-BoldItalic.woff") format("woff"),url("./KaTeX_Math-BoldItalic.ttf") format("truetype");font-weight:700;font-style:italic;font-display:block}@font-face{font-family:KaTeX_Math;src:url("./KaTeX_Math-Italic.woff2") format("woff2"),url("./KaTeX_Math-Italic.woff") format("woff"),url("./KaTeX_Math-Italic.ttf") format("truetype");font-weight:400;font-style:italic;font-display:block}@font-face{font-family:KaTeX_SansSerif;src:url("./KaTeX_SansSerif-Bold.woff2") format("woff2"),url("./KaTeX_SansSerif-Bold.woff") format("woff"),url("./KaTeX_SansSerif-Bold.ttf") format("truetype");font-weight:700;font-style:normal;font-display:block}@font-face{font-family:KaTeX_SansSerif;src:url("./KaTeX_SansSerif-Italic.woff2") format("woff2"),url("./KaTeX_SansSerif-Italic.woff") format("woff"),url("./KaTeX_SansSerif-Italic.ttf") format("truetype");font-weight:400;font-style:italic;font-display:block}@font-face{font-family:KaTeX_SansSerif;src:url("./KaTeX_SansSerif-Regular.woff2") format("woff2"),url("./KaTeX_SansSerif-Regular.woff") format("woff"),url("./KaTeX_SansSerif-Regular.ttf") format("truetype");font-weight:400;font-style:normal;font-display:block}@font-face{font-family:KaTeX_Script;src:url("./KaTeX_Script-Regular.woff2") format("woff2"),url("./KaTeX_Script-Regular.woff") format("woff"),url("./KaTeX_Script-Regular.ttf") format("truetype");font-weight:400;font-style:normal;font-display:block}@font-face{font-family:KaTeX_Size1;src:url("./KaTeX_Size1-Regular.woff2") format("woff2"),url("./KaTeX_Size1-Regular.woff") format("woff"),url("./KaTeX_Size1-Regular.ttf") format("truetype");font-weight:400;font-style:normal;font-display:block}@font-face{font-family:KaTeX_Size2;src:url("./KaTeX_Size2-Regular.woff2") format("woff2"),url("./KaTeX_Size2-Regular.woff") format("woff"),url("./KaTeX_Size2-Regular.ttf") format("truetype");font-weight:400;font-style:normal;font-display:block}@font-face{font-family:KaTeX_Size3;src:url("./KaTeX_Size3-Regular.woff2") format("woff2"),url("./KaTeX_Size3-Regular.woff") format("woff"),url("./KaTeX_Size3-Regular.ttf") format("truetype");font-weight:400;font-style:normal;font-display:block}@font-face{font-family:KaTeX_Size4;src:url("./KaTeX_Size4-Regular.woff2") format("woff2"),url("./KaTeX_Size4-Regular.woff") format("woff"),url("./KaTeX_Size4-Regular.ttf") format("truetype");font-weight:400;font-style:normal;font-display:block}@font-face{font-family:KaTeX_Typewriter;src:url("./KaTeX_Typewriter-Regular.woff2") format("woff2"),url("./KaTeX_Typewriter-Regular.woff") format("woff"),url("./KaTeX_Typewriter-Regular.ttf") format("truetype");font-weight:400;font-style:normal;font-display:block}.katex{font: 1.21em KaTeX_Main,Times New Roman,serif;line-height:1.2;position:relative;text-indent:0;text-rendering:auto}.katex *{-ms-high-contrast-adjust:none!important}.katex *{border-color:currentColor}.katex .katex-version:after{content:"0.17.0"}.katex .katex-mathml{position:absolute;-webkit-clip-path:inset(50%);clip-path:inset(50%);padding:0;border:0;height:1px;width:1px;overflow:hidden}.katex .katex-html>.newline{display:block}.katex .base{position:relative;display:inline-block;white-space:nowrap;width:-webkit-min-content;width:-moz-min-content;width:min-content}.katex .strut{display:inline-block}.katex .textbf{font-weight:700}.katex .textit{font-style:italic}.katex .textrm{font-family:KaTeX_Main}.katex .textsf{font-family:KaTeX_SansSerif}.katex .texttt{font-family:KaTeX_Typewriter}.katex .mathnormal{font-family:KaTeX_Math;font-style:italic}.katex .mathit{font-family:KaTeX_Main;font-style:italic}.katex .mathrm{font-style:normal}.katex .mathbf{font-family:KaTeX_Main;font-weight:700}.katex .boldsymbol{font-family:KaTeX_Math;font-weight:700;font-style:italic}.katex .amsrm,.katex .mathbb,.katex .textbb{font-family:KaTeX_AMS}.katex .mathcal{font-family:KaTeX_Caligraphic}.katex .mathfrak,.katex .textfrak{font-family:KaTeX_Fraktur}.katex .mathboldfrak,.katex .textboldfrak{font-family:KaTeX_Fraktur;font-weight:700}.katex .mathtt{font-family:KaTeX_Typewriter}.katex .mathscr,.katex .textscr{font-family:KaTeX_Script}.katex .mathsf,.katex .textsf{font-family:KaTeX_SansSerif}.katex .mathboldsf,.katex .textboldsf{font-family:KaTeX_SansSerif;font-weight:700}.katex .mathsfit,.katex .mathitsf,.katex .textitsf{font-family:KaTeX_SansSerif;font-style:italic}.katex .mainrm{font-family:KaTeX_Main;font-style:normal}.katex .vlist-t{display:inline-table;table-layout:fixed;border-collapse:collapse}.katex .vlist-r{display:table-row}.katex .vlist{display:table-cell;vertical-align:bottom;position:relative}.katex .vlist>span{display:block;height:0;position:relative}.katex .vlist>span>span{display:inline-block}.katex .vlist>span>.pstrut{overflow:hidden;width:0}.katex .vlist-t2{margin-right:-2px}.katex .vlist-s{display:table-cell;vertical-align:bottom;font-size:1px;width:2px;min-width:2px}.katex .vbox{display:inline-flex;flex-direction:column;align-items:baseline}.katex .hbox{display:inline-flex;flex-direction:row;width:100%}.katex .thinbox{display:inline-flex;flex-direction:row;width:0;max-width:0}.katex .msupsub{text-align:left}.katex .mfrac>span>span{text-align:center}.katex .mfrac .frac-line{display:inline-block;width:100%;border-bottom-style:solid}.katex .mfrac .frac-line,.katex .overline .overline-line,.katex .underline .underline-line,.katex .hline,.katex .hdashline,.katex .rule{min-height:1px}.katex .mspace{display:inline-block}.katex .smash{display:inline;line-height:0}.katex .llap,.katex .rlap,.katex .clap{width:0;position:relative}.katex .llap>.inner,.katex .rlap>.inner,.katex .clap>.inner{position:absolute}.katex .llap>.fix,.katex .rlap>.fix,.katex .clap>.fix{display:inline-block}.katex .llap>.inner{right:0}.katex .rlap>.inner,.katex .clap>.inner{left:0}.katex .clap>.inner>span{margin-left:-50%;margin-right:50%}.katex .rule{display:inline-block;border:solid 0;position:relative}.katex .overline .overline-line,.katex .underline .underline-line,.katex .hline{display:inline-block;width:100%;border-bottom-style:solid}.katex .hdashline{display:inline-block;width:100%;border-bottom-style:dashed}.katex .sqrt>.root{margin-left:.2777777778em;margin-right:-.5555555556em}.katex .sizing.reset-size1.size1,.katex .fontsize-ensurer.reset-size1.size1{font-size:1em}.katex .sizing.reset-size1.size2,.katex .fontsize-ensurer.reset-size1.size2{font-size:1.2em}.katex .sizing.reset-size1.size3,.katex .fontsize-ensurer.reset-size1.size3{font-size:1.4em}.katex .sizing.reset-size1.size4,.katex .fontsize-ensurer.reset-size1.size4{font-size:1.6em}.katex .sizing.reset-size1.size5,.katex .fontsize-ensurer.reset-size1.size5{font-size:1.8em}.katex .sizing.reset-size1.size6,.katex .fontsize-ensurer.reset-size1.size6{font-size:2em}.katex .sizing.reset-size1.size7,.katex .fontsize-ensurer.reset-size1.size7{font-size:2.4em}.katex .sizing.reset-size1.size8,.katex .fontsize-ensurer.reset-size1.size8{font-size:2.88em}.katex .sizing.reset-size1.size9,.katex .fontsize-ensurer.reset-size1.size9{font-size:3.456em}.katex .sizing.reset-size1.size10,.katex .fontsize-ensurer.reset-size1.size10{font-size:4.148em}.katex .sizing.reset-size1.size11,.katex .fontsize-ensurer.reset-size1.size11{font-size:4.976em}.katex .sizing.reset-size2.size1,.katex .fontsize-ensurer.reset-size2.size1{font-size:.8333333333em}.katex .sizing.reset-size2.size2,.katex .fontsize-ensurer.reset-size2.size2{font-size:1em}.katex .sizing.reset-size2.size3,.katex .fontsize-ensurer.reset-size2.size3{font-size:1.1666666667em}.katex .sizing.reset-size2.size4,.katex .fontsize-ensurer.reset-size2.size4{font-size:1.3333333333em}.katex .sizing.reset-size2.size5,.katex .fontsize-ensurer.reset-size2.size5{font-size:1.5em}.katex .sizing.reset-size2.size6,.katex .fontsize-ensurer.reset-size2.size6{font-size:1.6666666667em}.katex .sizing.reset-size2.size7,.katex .fontsize-ensurer.reset-size2.size7{font-size:2em}.katex .sizing.reset-size2.size8,.katex .fontsize-ensurer.reset-size2.size8{font-size:2.4em}.katex .sizing.reset-size2.size9,.katex .fontsize-ensurer.reset-size2.size9{font-size:2.88em}.katex .sizing.reset-size2.size10,.katex .fontsize-ensurer.reset-size2.size10{font-size:3.4566666667em}.katex .sizing.reset-size2.size11,.katex .fontsize-ensurer.reset-size2.size11{font-size:4.1466666667em}.katex .sizing.reset-size3.size1,.katex .fontsize-ensurer.reset-size3.size1{font-size:.7142857143em}.katex .sizing.reset-size3.size2,.katex .fontsize-ensurer.reset-size3.size2{font-size:.8571428571em}.katex .sizing.reset-size3.size3,.katex .fontsize-ensurer.reset-size3.size3{font-size:1em}.katex .sizing.reset-size3.size4,.katex .fontsize-ensurer.reset-size3.size4{font-size:1.1428571429em}.katex .sizing.reset-size3.size5,.katex .fontsize-ensurer.reset-size3.size5{font-size:1.2857142857em}.katex .sizing.reset-size3.size6,.katex .fontsize-ensurer.reset-size3.size6{font-size:1.4285714286em}.katex .sizing.reset-size3.size7,.katex .fontsize-ensurer.reset-size3.size7{font-size:1.7142857143em}.katex .sizing.reset-size3.size8,.katex .fontsize-ensurer.reset-size3.size8{font-size:2.0571428571em}.katex .sizing.reset-size3.size9,.katex .fontsize-ensurer.reset-size3.size9{font-size:2.4685714286em}.katex .sizing.reset-size3.size10,.katex .fontsize-ensurer.reset-size3.size10{font-size:2.9628571429em}.katex .sizing.reset-size3.size11,.katex .fontsize-ensurer.reset-size3.size11{font-size:3.5542857143em}.katex .sizing.reset-size4.size1,.katex .fontsize-ensurer.reset-size4.size1{font-size:.625em}.katex .sizing.reset-size4.size2,.katex .fontsize-ensurer.reset-size4.size2{font-size:.75em}.katex .sizing.reset-size4.size3,.katex .fontsize-ensurer.reset-size4.size3{font-size:.875em}.katex .sizing.reset-size4.size4,.katex .fontsize-ensurer.reset-size4.size4{font-size:1em}.katex .sizing.reset-size4.size5,.katex .fontsize-ensurer.reset-size4.size5{font-size:1.125em}.katex .sizing.reset-size4.size6,.katex .fontsize-ensurer.reset-size4.size6{font-size:1.25em}.katex .sizing.reset-size4.size7,.katex .fontsize-ensurer.reset-size4.size7{font-size:1.5em}.katex .sizing.reset-size4.size8,.katex .fontsize-ensurer.reset-size4.size8{font-size:1.8em}.katex .sizing.reset-size4.size9,.katex .fontsize-ensurer.reset-size4.size9{font-size:2.16em}.katex .sizing.reset-size4.size10,.katex .fontsize-ensurer.reset-size4.size10{font-size:2.5925em}.katex .sizing.reset-size4.size11,.katex .fontsize-ensurer.reset-size4.size11{font-size:3.11em}.katex .sizing.reset-size5.size1,.katex .fontsize-ensurer.reset-size5.size1{font-size:.5555555556em}.katex .sizing.reset-size5.size2,.katex .fontsize-ensurer.reset-size5.size2{font-size:.6666666667em}.katex .sizing.reset-size5.size3,.katex .fontsize-ensurer.reset-size5.size3{font-size:.7777777778em}.katex .sizing.reset-size5.size4,.katex .fontsize-ensurer.reset-size5.size4{font-size:.8888888889em}.katex .sizing.reset-size5.size5,.katex .fontsize-ensurer.reset-size5.size5{font-size:1em}.katex .sizing.reset-size5.size6,.katex .fontsize-ensurer.reset-size5.size6{font-size:1.1111111111em}.katex .sizing.reset-size5.size7,.katex .fontsize-ensurer.reset-size5.size7{font-size:1.3333333333em}.katex .sizing.reset-size5.size8,.katex .fontsize-ensurer.reset-size5.size8{font-size:1.6em}.katex .sizing.reset-size5.size9,.katex .fontsize-ensurer.reset-size5.size9{font-size:1.92em}.katex .sizing.reset-size5.size10,.katex .fontsize-ensurer.reset-size5.size10{font-size:2.3044444444em}.katex .sizing.reset-size5.size11,.katex .fontsize-ensurer.reset-size5.size11{font-size:2.7644444444em}.katex .sizing.reset-size6.size1,.katex .fontsize-ensurer.reset-size6.size1{font-size:.5em}.katex .sizing.reset-size6.size2,.katex .fontsize-ensurer.reset-size6.size2{font-size:.6em}.katex .sizing.reset-size6.size3,.katex .fontsize-ensurer.reset-size6.size3{font-size:.7em}.katex .sizing.reset-size6.size4,.katex .fontsize-ensurer.reset-size6.size4{font-size:.8em}.katex .sizing.reset-size6.size5,.katex .fontsize-ensurer.reset-size6.size5{font-size:.9em}.katex .sizing.reset-size6.size6,.katex .fontsize-ensurer.reset-size6.size6{font-size:1em}.katex .sizing.reset-size6.size7,.katex .fontsize-ensurer.reset-size6.size7{font-size:1.2em}.katex .sizing.reset-size6.size8,.katex .fontsize-ensurer.reset-size6.size8{font-size:1.44em}.katex .sizing.reset-size6.size9,.katex .fontsize-ensurer.reset-size6.size9{font-size:1.728em}.katex .sizing.reset-size6.size10,.katex .fontsize-ensurer.reset-size6.size10{font-size:2.074em}.katex .sizing.reset-size6.size11,.katex .fontsize-ensurer.reset-size6.size11{font-size:2.488em}.katex .sizing.reset-size7.size1,.katex .fontsize-ensurer.reset-size7.size1{font-size:.4166666667em}.katex .sizing.reset-size7.size2,.katex .fontsize-ensurer.reset-size7.size2{font-size:.5em}.katex .sizing.reset-size7.size3,.katex .fontsize-ensurer.reset-size7.size3{font-size:.5833333333em}.katex .sizing.reset-size7.size4,.katex .fontsize-ensurer.reset-size7.size4{font-size:.6666666667em}.katex .sizing.reset-size7.size5,.katex .fontsize-ensurer.reset-size7.size5{font-size:.75em}.katex .sizing.reset-size7.size6,.katex .fontsize-ensurer.reset-size7.size6{font-size:.8333333333em}.katex .sizing.reset-size7.size7,.katex .fontsize-ensurer.reset-size7.size7{font-size:1em}.katex .sizing.reset-size7.size8,.katex .fontsize-ensurer.reset-size7.size8{font-size:1.2em}.katex .sizing.reset-size7.size9,.katex .fontsize-ensurer.reset-size7.size9{font-size:1.44em}.katex .sizing.reset-size7.size10,.katex .fontsize-ensurer.reset-size7.size10{font-size:1.7283333333em}.katex .sizing.reset-size7.size11,.katex .fontsize-ensurer.reset-size7.size11{font-size:2.0733333333em}.katex .sizing.reset-size8.size1,.katex .fontsize-ensurer.reset-size8.size1{font-size:.3472222222em}.katex .sizing.reset-size8.size2,.katex .fontsize-ensurer.reset-size8.size2{font-size:.4166666667em}.katex .sizing.reset-size8.size3,.katex .fontsize-ensurer.reset-size8.size3{font-size:.4861111111em}.katex .sizing.reset-size8.size4,.katex .fontsize-ensurer.reset-size8.size4{font-size:.5555555556em}.katex .sizing.reset-size8.size5,.katex .fontsize-ensurer.reset-size8.size5{font-size:.625em}.katex .sizing.reset-size8.size6,.katex .fontsize-ensurer.reset-size8.size6{font-size:.6944444444em}.katex .sizing.reset-size8.size7,.katex .fontsize-ensurer.reset-size8.size7{font-size:.8333333333em}.katex .sizing.reset-size8.size8,.katex .fontsize-ensurer.reset-size8.size8{font-size:1em}.katex .sizing.reset-size8.size9,.katex .fontsize-ensurer.reset-size8.size9{font-size:1.2em}.katex .sizing.reset-size8.size10,.katex .fontsize-ensurer.reset-size8.size10{font-size:1.4402777778em}.katex .sizing.reset-size8.size11,.katex .fontsize-ensurer.reset-size8.size11{font-size:1.7277777778em}.katex .sizing.reset-size9.size1,.katex .fontsize-ensurer.reset-size9.size1{font-size:.2893518519em}.katex .sizing.reset-size9.size2,.katex .fontsize-ensurer.reset-size9.size2{font-size:.3472222222em}.katex .sizing.reset-size9.size3,.katex .fontsize-ensurer.reset-size9.size3{font-size:.4050925926em}.katex .sizing.reset-size9.size4,.katex .fontsize-ensurer.reset-size9.size4{font-size:.462962963em}.katex .sizing.reset-size9.size5,.katex .fontsize-ensurer.reset-size9.size5{font-size:.5208333333em}.katex .sizing.reset-size9.size6,.katex .fontsize-ensurer.reset-size9.size6{font-size:.5787037037em}.katex .sizing.reset-size9.size7,.katex .fontsize-ensurer.reset-size9.size7{font-size:.6944444444em}.katex .sizing.reset-size9.size8,.katex .fontsize-ensurer.reset-size9.size8{font-size:.8333333333em}.katex .sizing.reset-size9.size9,.katex .fontsize-ensurer.reset-size9.size9{font-size:1em}.katex .sizing.reset-size9.size10,.katex .fontsize-ensurer.reset-size9.size10{font-size:1.2002314815em}.katex .sizing.reset-size9.size11,.katex .fontsize-ensurer.reset-size9.size11{font-size:1.4398148148em}.katex .sizing.reset-size10.size1,.katex .fontsize-ensurer.reset-size10.size1{font-size:.2410800386em}.katex .sizing.reset-size10.size2,.katex .fontsize-ensurer.reset-size10.size2{font-size:.2892960463em}.katex .sizing.reset-size10.size3,.katex .fontsize-ensurer.reset-size10.size3{font-size:.337512054em}.katex .sizing.reset-size10.size4,.katex .fontsize-ensurer.reset-size10.size4{font-size:.3857280617em}.katex .sizing.reset-size10.size5,.katex .fontsize-ensurer.reset-size10.size5{font-size:.4339440694em}.katex .sizing.reset-size10.size6,.katex .fontsize-ensurer.reset-size10.size6{font-size:.4821600771em}.katex .sizing.reset-size10.size7,.katex .fontsize-ensurer.reset-size10.size7{font-size:.5785920926em}.katex .sizing.reset-size10.size8,.katex .fontsize-ensurer.reset-size10.size8{font-size:.6943105111em}.katex .sizing.reset-size10.size9,.katex .fontsize-ensurer.reset-size10.size9{font-size:.8331726133em}.katex .sizing.reset-size10.size10,.katex .fontsize-ensurer.reset-size10.size10{font-size:1em}.katex .sizing.reset-size10.size11,.katex .fontsize-ensurer.reset-size10.size11{font-size:1.1996142719em}.katex .sizing.reset-size11.size1,.katex .fontsize-ensurer.reset-size11.size1{font-size:.2009646302em}.katex .sizing.reset-size11.size2,.katex .fontsize-ensurer.reset-size11.size2{font-size:.2411575563em}.katex .sizing.reset-size11.size3,.katex .fontsize-ensurer.reset-size11.size3{font-size:.2813504823em}.katex .sizing.reset-size11.size4,.katex .fontsize-ensurer.reset-size11.size4{font-size:.3215434084em}.katex .sizing.reset-size11.size5,.katex .fontsize-ensurer.reset-size11.size5{font-size:.3617363344em}.katex .sizing.reset-size11.size6,.katex .fontsize-ensurer.reset-size11.size6{font-size:.4019292605em}.katex .sizing.reset-size11.size7,.katex .fontsize-ensurer.reset-size11.size7{font-size:.4823151125em}.katex .sizing.reset-size11.size8,.katex .fontsize-ensurer.reset-size11.size8{font-size:.578778135em}.katex .sizing.reset-size11.size9,.katex .fontsize-ensurer.reset-size11.size9{font-size:.6945337621em}.katex .sizing.reset-size11.size10,.katex .fontsize-ensurer.reset-size11.size10{font-size:.8336012862em}.katex .sizing.reset-size11.size11,.katex .fontsize-ensurer.reset-size11.size11{font-size:1em}.katex .delimsizing.size1{font-family:KaTeX_Size1}.katex .delimsizing.size2{font-family:KaTeX_Size2}.katex .delimsizing.size3{font-family:KaTeX_Size3}.katex .delimsizing.size4{font-family:KaTeX_Size4}.katex .delimsizing.mult .delim-size1>span{font-family:KaTeX_Size1}.katex .delimsizing.mult .delim-size4>span{font-family:KaTeX_Size4}.katex .nulldelimiter{display:inline-block;width:.12em}.katex .delimcenter,.katex .op-symbol{position:relative}.katex .op-symbol.small-op{font-family:KaTeX_Size1}.katex .op-symbol.large-op{font-family:KaTeX_Size2}.katex .op-limits>.vlist-t{text-align:center}.katex .accent>.vlist-t{text-align:center}.katex .accent .accent-body{position:relative}.katex .accent .accent-body:not(.accent-full){width:0}.katex .overlay{display:block}.katex .mtable .vertical-separator{display:inline-block;min-width:1px}.katex .mtable .arraycolsep{display:inline-block}.katex .mtable .col-align-c>.vlist-t{text-align:center}.katex .mtable .col-align-l>.vlist-t{text-align:left}.katex .mtable .col-align-r>.vlist-t{text-align:right}.katex .svg-align{text-align:left}.katex svg{display:block;position:absolute;width:100%;height:inherit;fill:currentColor;stroke:currentColor}.katex svg path{stroke:none}.katex svg{fill-rule:nonzero;fill-opacity:1;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1}.katex img{border-style:none;min-width:0;min-height:0;max-width:none;max-height:none}.katex .stretchy{width:100%;display:block;position:relative;overflow:hidden}.katex .stretchy:before,.katex .stretchy:after{content:""}.katex .hide-tail{width:100%;position:relative;overflow:hidden}.katex .halfarrow-left{position:absolute;left:0;width:50.2%;overflow:hidden}.katex .halfarrow-right{position:absolute;right:0;width:50.2%;overflow:hidden}.katex .brace-left{position:absolute;left:0;width:25.1%;overflow:hidden}.katex .brace-center{position:absolute;left:25%;width:50%;overflow:hidden}.katex .brace-right{position:absolute;right:0;width:25.1%;overflow:hidden}.katex .x-arrow-pad{padding:0 .5em}.katex .cd-arrow-pad{padding:0 .55556em 0 .27778em}.katex .x-arrow,.katex .mover,.katex .munder{text-align:center}.katex .boxpad{padding:0 .3em}.katex .fbox,.katex .fcolorbox{box-sizing:border-box;border:.04em solid}.katex .cancel-pad{padding:0 .2em}.katex .cancel-lap{margin-left:-.2em;margin-right:-.2em}.katex .sout{border-bottom-style:solid;border-bottom-width:.08em}.katex .angl{box-sizing:border-box;border-top:.049em solid;border-right:.049em solid;margin-right:.03889em}.katex .anglpad{padding:0 .03889em}.katex .eqn-num:before{counter-increment:katexEqnNo;content:"(" counter(katexEqnNo) ")"}.katex .mml-eqn-num:before{counter-increment:mmlEqnNo;content:"(" counter(mmlEqnNo) ")"}.katex .mtr-glue{width:50%}.katex .cd-vert-arrow{display:inline-block;position:relative}.katex .cd-label-left{display:inline-block;position:absolute;right:calc(50% + .3em);text-align:left}.katex .cd-label-right{display:inline-block;position:absolute;left:calc(50% + .3em);text-align:right}.katex-display{display:block;margin:1em 0;text-align:center}.katex-display>.katex{display:block;text-align:center;white-space:nowrap}.katex-display>.katex>.katex-html{display:block;position:relative}.katex-display>.katex>.katex-html>.tag{position:absolute;right:0}.katex-display.leqno>.katex>.katex-html>.tag{left:0;right:auto}.katex-display.fleqn>.katex{text-align:left;padding-left:2em}body{counter-reset:katexEqnNo mmlEqnNo} diff --git a/Sources/WeiBei/Services/DocumentTextExtractor.swift b/Sources/WeiBei/Services/DocumentTextExtractor.swift deleted file mode 100644 index acbfec729..000000000 --- a/Sources/WeiBei/Services/DocumentTextExtractor.swift +++ /dev/null @@ -1,253 +0,0 @@ -import AppKit -import Foundation -import PDFKit -import WeiBeiCore - -enum DocumentTextExtractor { - private enum TextCache { - case pdf - case file - } - - private static let cacheLock = NSLock() - private static let maximumPDFCacheEntryBytes = 4 * 1_024 * 1_024 - private static let maximumPDFCacheBytes = 12 * 1_024 * 1_024 - private static let maximumFileCacheEntryBytes = 2 * 1_024 * 1_024 - private static let maximumFileCacheBytes = 8 * 1_024 * 1_024 - private static let maximumActiveFileBytes = 4 * 1_024 * 1_024 - private static let maximumActivePDFPages = 12 - private static let maximumActivePDFCharacters = 64_000 - private static let maximumActivePDFTextSeconds: TimeInterval = 2 - private static var pdfTextCache: [String: String] = [:] - private static var fileTextCache: [String: String] = [:] - private static var pdfTextCacheOrder: [String] = [] - private static var fileTextCacheOrder: [String] = [] - - static func text(for item: StudyItem) -> String? { - guard let url = item.url else { return nil } - switch item.kind { - case .pdf: - return pdfText(url: url) - case .html: - return cachedFileText(url: url, load: htmlText) - case .markdown, .text: - return cachedFileText(url: url) { fileURL in - prefixData(from: fileURL).map { String(decoding: $0, as: UTF8.self) } - } - } - } - - static func cachedText(for item: StudyItem) -> String? { - guard let url = item.url else { return nil } - let cache: TextCache = item.kind == .pdf ? .pdf : .file - return cachedValue(for: fileCacheKey(for: url), cache: cache) - } - - static func indexText( - for item: StudyItem, - maximumCharacters: Int = 24_000, - query: String = "" - ) -> String? { - guard let text = text(for: item), !text.isEmpty else { return nil } - return relevantText( - text, - query: query, - maximumCharacters: max(maximumCharacters, 1) - ) - } - - private static func pdfText(url: URL) -> String? { - let cacheKey = fileCacheKey(for: url) - if let cached = cachedValue(for: cacheKey, cache: .pdf) { - return cached - } - guard let document = PDFDocument(url: url) else { return nil } - var nativePages: [String] = [] - var nativeCharacterCount = 0 - let pageLimit = min(max(document.pageCount, 0), maximumActivePDFPages) - let nativeTextByPage = BoundedPDFTextExtractor.pages( - from: url, - pageIndexes: Array(0..= maximumActivePDFCharacters { break } - } - let nativeText = String(nativePages.joined(separator: "\n\n").prefix(maximumActivePDFCharacters)) - let text = nativeText.isEmpty - ? PDFOCRTextExtractor.text(from: document, maxPages: 12) - : nativeText - if let text, !text.isEmpty { - store(text, for: cacheKey, cache: .pdf) - return text - } - return nil - } - - private static func htmlText(url: URL) -> String? { - guard let data = prefixData(from: url) else { return nil } - if let attributed = try? NSAttributedString( - data: data, - options: [ - .documentType: NSAttributedString.DocumentType.html, - .characterEncoding: String.Encoding.utf8.rawValue, - ], - documentAttributes: nil - ) { - return attributed.string - } - return String(decoding: data, as: UTF8.self) - } - - private static func prefixData(from url: URL) -> Data? { - guard let handle = try? FileHandle(forReadingFrom: url) else { return nil } - defer { try? handle.close() } - return try? handle.read(upToCount: maximumActiveFileBytes) - } - - private static func relevantText( - _ text: String, - query: String, - maximumCharacters: Int - ) -> String { - let terms = Array(searchTerms(in: query).prefix(24)) - guard !terms.isEmpty else { return String(text.prefix(maximumCharacters)) } - let chunks = chunked(text, maximumCharacters: 2_000) - var ranked: [(index: Int, chunk: String, score: Int)] = [] - for (index, chunk) in chunks.enumerated() { - let lower = chunk.lowercased() - var score = 0 - for term in terms { - score += min(lower.components(separatedBy: term).count - 1, 12) - } - if score > 0 { - ranked.append((index: index, chunk: chunk, score: score)) - } - } - ranked.sort { lhs, rhs in - if lhs.score != rhs.score { return lhs.score > rhs.score } - return lhs.index < rhs.index - } - guard !ranked.isEmpty else { return String(text.prefix(maximumCharacters)) } - let selected = ranked.prefix(12).sorted { lhs, rhs in - lhs.index < rhs.index - } - let joined = selected.map { $0.chunk }.joined(separator: "\n\n") - return String(joined.prefix(maximumCharacters)) - } - - private static func chunked(_ text: String, maximumCharacters: Int) -> [String] { - guard text.count > maximumCharacters else { return [text] } - var chunks: [String] = [] - var start = text.startIndex - while start < text.endIndex { - let end = text.index(start, offsetBy: maximumCharacters, limitedBy: text.endIndex) ?? text.endIndex - chunks.append(String(text[start.. [String] { - let lower = query.lowercased() - var terms = lower - .components(separatedBy: CharacterSet.alphanumerics.union(CharacterSet(charactersIn: "_")).inverted) - .filter { $0.count >= 2 } - let characters = Array(lower) - if characters.count >= 2 { - for index in 0..<(characters.count - 1) { - let pair = String(characters[index...index + 1]) - if pair.unicodeScalars.allSatisfy({ (0x4E00...0x9FFF).contains(Int($0.value)) }) { - terms.append(pair) - } - } - } - var seen: Set = [] - return terms.filter { seen.insert($0).inserted } - } - - private static func fileCacheKey(for url: URL) -> String { - let modified = (try? FileManager.default.attributesOfItem(atPath: url.path)[.modificationDate] as? Date)? - .timeIntervalSince1970 ?? 0 - return "\(url.path)#\(modified)" - } - - private static func cachedFileText(url: URL, load: (URL) -> String?) -> String? { - let cacheKey = fileCacheKey(for: url) - if let cached = cachedValue(for: cacheKey, cache: .file) { - return cached - } - guard let text = load(url), !text.isEmpty else { return nil } - store(text, for: cacheKey, cache: .file) - return text - } - - private static func cachedValue(for key: String, cache: TextCache) -> String? { - cacheLock.lock() - defer { cacheLock.unlock() } - switch cache { - case .pdf: - guard let value = pdfTextCache[key] else { return nil } - touch(key, in: &pdfTextCacheOrder) - return value - case .file: - guard let value = fileTextCache[key] else { return nil } - touch(key, in: &fileTextCacheOrder) - return value - } - } - - private static func store(_ value: String, for key: String, cache: TextCache) { - cacheLock.lock() - defer { cacheLock.unlock() } - let valueBytes = value.utf8.count - switch cache { - case .pdf: - guard valueBytes <= maximumPDFCacheEntryBytes else { return } - pdfTextCache[key] = value - touch(key, in: &pdfTextCacheOrder) - trim( - &pdfTextCache, - order: &pdfTextCacheOrder, - countLimit: 4, - byteLimit: maximumPDFCacheBytes - ) - case .file: - guard valueBytes <= maximumFileCacheEntryBytes else { return } - fileTextCache[key] = value - touch(key, in: &fileTextCacheOrder) - trim( - &fileTextCache, - order: &fileTextCacheOrder, - countLimit: 8, - byteLimit: maximumFileCacheBytes - ) - } - } - - private static func touch(_ key: String, in order: inout [String]) { - order.removeAll { $0 == key } - order.append(key) - } - - private static func trim( - _ values: inout [String: String], - order: inout [String], - countLimit: Int, - byteLimit: Int - ) { - var totalBytes = values.values.reduce(0) { $0 + $1.utf8.count } - while order.count > countLimit || totalBytes > byteLimit { - guard !order.isEmpty else { break } - let key = order.removeFirst() - totalBytes -= values.removeValue(forKey: key)?.utf8.count ?? 0 - } - } -} diff --git a/Sources/WeiBei/Stores/WorkspaceStore.swift b/Sources/WeiBei/Stores/WorkspaceStore.swift index e1a1a61a8..d11a50873 100644 --- a/Sources/WeiBei/Stores/WorkspaceStore.swift +++ b/Sources/WeiBei/Stores/WorkspaceStore.swift @@ -9621,14 +9621,6 @@ final class WorkspaceStore: ObservableObject { return appOwnedFilesDirectory().appendingPathComponent("Attachments", isDirectory: true) } - var selectedContextText: String { - guard let item = selectedMaterialItem else { return "" } - if let text = DocumentTextExtractor.cachedText(for: item), !text.isEmpty { - return text - } - return "" - } - var selectedMaterialTitle: String { selectedMaterialItem.map(displayTitle) ?? ui("未选择材料", "No material selected") } @@ -12318,10 +12310,6 @@ final class WorkspaceStore: ObservableObject { ) } - func importAndLinkSourcesFromPanel() { - presentImportPanel(linkToActiveNote: true) - } - private func presentImportPanel( linkToActiveNote: Bool, selectsFirstImportedItem: Bool = true, diff --git a/Sources/WeiBei/Support/Theme.swift b/Sources/WeiBei/Support/Theme.swift index 09a59bb9f..91288286c 100644 --- a/Sources/WeiBei/Support/Theme.swift +++ b/Sources/WeiBei/Support/Theme.swift @@ -346,31 +346,6 @@ extension View { } } -private struct WeiBeiTone { - var red: CGFloat - var green: CGFloat - var blue: CGFloat - var alpha: CGFloat - - init(red: CGFloat, green: CGFloat, blue: CGFloat, alpha: CGFloat = 1) { - self.red = red - self.green = green - self.blue = blue - self.alpha = alpha - } - - init(hex: Int, alpha: CGFloat = 1) { - self.red = CGFloat((hex >> 16) & 0xFF) / 255 - self.green = CGFloat((hex >> 8) & 0xFF) / 255 - self.blue = CGFloat(hex & 0xFF) / 255 - self.alpha = alpha - } - - var nsColor: NSColor { - NSColor(calibratedRed: red, green: green, blue: blue, alpha: alpha) - } -} - enum WeiBeiTheme { // Computed colors — resolved from the current mode on every access. // Static `Color(nsColor:)` only re-queries on system appearance change, so @@ -1000,21 +975,6 @@ enum WeiBeiMetric { static let topBarHeight: CGFloat = 36 } -/// Top-bar brand mark (DesignSystem logo exports bundled under Resources/Brand). -enum WeiBeiBrandMark { - static func image(for mode: WeiBeiAppearanceMode) -> NSImage { - let name = mode.isDark ? "weibei-mark-reversed" : "weibei-mark" - if let url = WeiBeiResources.bundle.url(forResource: name, withExtension: "png", subdirectory: "Brand") - ?? WeiBeiResources.bundle.url(forResource: name, withExtension: "png"), - let image = NSImage(contentsOf: url) { - image.isTemplate = false - return image - } - // Fallback: empty 1×1 so layout never crashes if resources are missing. - return NSImage(size: NSSize(width: 1, height: 1)) - } -} - enum WeiBeiMotion { static let press = Animation.interactiveSpring(response: 0.18, dampingFraction: 0.82) static let micro = Animation.easeOut(duration: 0.14) @@ -1097,33 +1057,6 @@ extension View { } /// Top-bar / settings theme control: compact surface swatches instead of a menu. -struct AppearanceThemePaletteButton: View { - @EnvironmentObject private var store: WorkspaceStore - @State private var isPresented = false - - var body: some View { - Button { - isPresented.toggle() - } label: { - RoundedRectangle(cornerRadius: 4, style: .continuous) - .fill(Color(nsColor: WeiBeiNativePalette.paper(for: store.appearanceMode))) - .overlay { - RoundedRectangle(cornerRadius: 4, style: .continuous) - .stroke(WeiBeiTheme.hairline.opacity(0.85), lineWidth: 1) - } - .frame(width: 18, height: 18) - .contentShape(Rectangle()) - } - .buttonStyle(WeiBeiIconButtonStyle(size: 24)) - .accessibilityLabel(Text(store.appearanceMode.actionLabel(language: store.interfaceLanguage))) - .help(store.appearanceMode.actionLabel(language: store.interfaceLanguage)) - .popover(isPresented: $isPresented, arrowEdge: .bottom) { - AppearanceThemePalettePopover(isPresented: $isPresented) - .environmentObject(store) - } - } -} - private struct AppearanceThemePalettePopover: View { @EnvironmentObject private var store: WorkspaceStore @Binding var isPresented: Bool diff --git a/Sources/WeiBei/Views/ContentView.swift b/Sources/WeiBei/Views/ContentView.swift index 06bc35a2f..b41d9798d 100644 --- a/Sources/WeiBei/Views/ContentView.swift +++ b/Sources/WeiBei/Views/ContentView.swift @@ -945,6 +945,9 @@ private struct LayoutContentView: View { } } + // 与 StableDocumentSplitCoordinator.dividerWidth 保持一致,真实布局由那边决定 + private static let estimatedDividerWidth: CGFloat = 10 + private func estimatedDocumentPaneFrames(order: [WorkspacePaneRole], size: CGSize) -> [CGRect] { switch order.count { case 0: @@ -963,7 +966,7 @@ private struct LayoutContentView: View { } private func threePaneFrames(order: [WorkspacePaneRole], size: CGSize) -> [CGRect] { - let divider = WeiBeiSplitView.thickness + let divider = Self.estimatedDividerWidth let usable = max(size.width - 2 * divider, 1) let firstMinimum = minimumWidth(for: order[0]) let secondMinimum = minimumWidth(for: order[1]) @@ -980,7 +983,7 @@ private struct LayoutContentView: View { } private func twoPaneFrames(order: [WorkspacePaneRole], size: CGSize) -> [CGRect] { - let divider = WeiBeiSplitView.thickness + let divider = Self.estimatedDividerWidth let usable = max(size.width - divider, 1) let firstMinimum = minimumWidth(for: order[0]) let secondMinimum = minimumWidth(for: order[1]) @@ -1216,25 +1219,6 @@ private struct PaneReorderPreviewView: View { } } -struct EmptyWorkspaceView: View { - @EnvironmentObject private var store: WorkspaceStore - - var body: some View { - ZStack { - WeiBeiTheme.paper - VStack(spacing: 14) { - Image(systemName: "seal") - .weiBeiText(34, weight: .regular) - .foregroundStyle(WeiBeiTheme.cinnabar.opacity(store.appearanceMode.isDark ? 0.12 : 0.08)) - Text(store.ui("在顶栏点亮一个板块开始", "Light up a pane above to begin")) - .weiBeiText(13, weight: .medium) - .foregroundStyle(WeiBeiTheme.secondaryInk) - } - .padding(.bottom, 18) - } - } -} - private struct PaneDropTargetView: View { @EnvironmentObject private var store: WorkspaceStore var role: WorkspacePaneRole @@ -1268,506 +1252,3 @@ private struct PaneDropTargetView: View { .allowsHitTesting(false) } } - -private struct ResizableTwoPane: NSViewRepresentable { - @EnvironmentObject private var store: WorkspaceStore - @Binding var split: CGFloat - var minFirst: CGFloat = 320 - var minSecond: CGFloat = 320 - var roles: [WorkspacePaneRole] = [] - var allowRailSnapping = false - private let first: First - private let second: Second - - init( - split: Binding, - minFirst: CGFloat = 320, - minSecond: CGFloat = 320, - roles: [WorkspacePaneRole] = [], - allowRailSnapping: Bool = false, - @ViewBuilder first: () -> First, - @ViewBuilder second: () -> Second - ) { - _split = split - self.minFirst = minFirst - self.minSecond = minSecond - self.roles = roles - self.allowRailSnapping = allowRailSnapping - self.first = first() - self.second = second() - } - - func makeCoordinator() -> NativeSplitCoordinator { - NativeSplitCoordinator( - kind: .two(split: $split), - minimums: [minFirst, minSecond], - roles: roles, - allowRailSnapping: allowRailSnapping - ) - } - - func makeNSView(context: Context) -> WeiBeiSplitView { - let splitView = WeiBeiSplitView() - context.coordinator.install(splitView) - splitView.addArrangedSubview(nativeHost(first)) - splitView.addArrangedSubview(nativeHost(second)) - context.coordinator.applyStoredPositions(in: splitView) - return splitView - } - - func updateNSView(_ splitView: WeiBeiSplitView, context: Context) { - context.coordinator.captureReadableWidths(in: splitView) - context.coordinator.kind = .two(split: $split) - context.coordinator.minimums = [minFirst, minSecond] - context.coordinator.roles = roles - context.coordinator.allowRailSnapping = allowRailSnapping - context.coordinator.onExpansionRequestHandled = { requestID in - store.completePaneExpansionRequest(requestID) - } - updateHost(at: 0, in: splitView, with: first) - updateHost(at: 1, in: splitView, with: second) - context.coordinator.applyStoredPositionsWhenNeeded(in: splitView) - context.coordinator.handleExpansionRequest(store.paneExpansionRequest, in: splitView) - } - - private func nativeHost(_ view: V) -> NSHostingView { - let host = NSHostingView(rootView: AnyView(view.weiBeiMotionScoped().environmentObject(store))) - host.translatesAutoresizingMaskIntoConstraints = false - host.setContentHuggingPriority(.defaultLow, for: .horizontal) - host.setContentCompressionResistancePriority(.defaultLow, for: .horizontal) - return host - } - - private func updateHost(at index: Int, in splitView: NSSplitView, with view: V) { - guard splitView.arrangedSubviews.indices.contains(index), - let host = splitView.arrangedSubviews[index] as? NSHostingView else { return } - host.rootView = AnyView(view.weiBeiMotionScoped().environmentObject(store)) - } -} - -private struct ResizableThreePane: NSViewRepresentable { - @EnvironmentObject private var store: WorkspaceStore - @Binding var firstSplit: CGFloat - @Binding var secondSplit: CGFloat - var minFirst: CGFloat = 320 - var minSecond: CGFloat = 260 - var minThird: CGFloat = 260 - var roles: [WorkspacePaneRole] = [] - var allowRailSnapping = false - var onFramesChange: (([CGRect]) -> Void)? = nil - private let first: First - private let second: Second - private let third: Third - - init( - firstSplit: Binding, - secondSplit: Binding, - minFirst: CGFloat = 320, - minSecond: CGFloat = 260, - minThird: CGFloat = 260, - roles: [WorkspacePaneRole] = [], - allowRailSnapping: Bool = false, - @ViewBuilder first: () -> First, - @ViewBuilder second: () -> Second, - @ViewBuilder third: () -> Third, - onFramesChange: (([CGRect]) -> Void)? = nil - ) { - _firstSplit = firstSplit - _secondSplit = secondSplit - self.minFirst = minFirst - self.minSecond = minSecond - self.minThird = minThird - self.roles = roles - self.allowRailSnapping = allowRailSnapping - self.onFramesChange = onFramesChange - self.first = first() - self.second = second() - self.third = third() - } - - func makeCoordinator() -> NativeSplitCoordinator { - NativeSplitCoordinator( - kind: .three(first: $firstSplit, second: $secondSplit), - minimums: [minFirst, minSecond, minThird], - roles: roles, - allowRailSnapping: allowRailSnapping, - onFramesChange: onFramesChange - ) - } - - func makeNSView(context: Context) -> WeiBeiSplitView { - let splitView = WeiBeiSplitView() - context.coordinator.install(splitView) - splitView.addArrangedSubview(nativeHost(first)) - splitView.addArrangedSubview(nativeHost(second)) - splitView.addArrangedSubview(nativeHost(third)) - context.coordinator.applyStoredPositions(in: splitView) - return splitView - } - - func updateNSView(_ splitView: WeiBeiSplitView, context: Context) { - context.coordinator.captureReadableWidths(in: splitView) - context.coordinator.kind = .three(first: $firstSplit, second: $secondSplit) - context.coordinator.minimums = [minFirst, minSecond, minThird] - context.coordinator.roles = roles - context.coordinator.allowRailSnapping = allowRailSnapping - context.coordinator.onFramesChange = onFramesChange - context.coordinator.onExpansionRequestHandled = { requestID in - store.completePaneExpansionRequest(requestID) - } - updateHost(at: 0, in: splitView, with: first) - updateHost(at: 1, in: splitView, with: second) - updateHost(at: 2, in: splitView, with: third) - context.coordinator.applyStoredPositionsWhenNeeded(in: splitView) - context.coordinator.handleExpansionRequest(store.paneExpansionRequest, in: splitView) - } - - private func nativeHost(_ view: V) -> NSHostingView { - let host = NSHostingView(rootView: AnyView(view.weiBeiMotionScoped().environmentObject(store))) - host.translatesAutoresizingMaskIntoConstraints = false - host.setContentHuggingPriority(.defaultLow, for: .horizontal) - host.setContentCompressionResistancePriority(.defaultLow, for: .horizontal) - return host - } - - private func updateHost(at index: Int, in splitView: NSSplitView, with view: V) { - guard splitView.arrangedSubviews.indices.contains(index), - let host = splitView.arrangedSubviews[index] as? NSHostingView else { return } - host.rootView = AnyView(view.weiBeiMotionScoped().environmentObject(store)) - } -} - -private final class WeiBeiSplitView: NSSplitView { - static let thickness: CGFloat = 10 - var onDragStart: (() -> Void)? - var onDragEnd: (() -> Void)? - var onLayout: ((WeiBeiSplitView) -> Void)? - - override var dividerThickness: CGFloat { Self.thickness } - - override func mouseDown(with event: NSEvent) { - onDragStart?() - super.mouseDown(with: event) - onDragEnd?() - } - - override func layout() { - super.layout() - // Divider geometry changed — refresh bidirectional resize cursors. - window?.invalidateCursorRects(for: self) - onLayout?(self) - } - - override func resetCursorRects() { - // Custom thickness + drawDivider can drop NSSplitView's default cursor rects. - let count = arrangedSubviews.count - guard count >= 2 else { return } - var x: CGFloat = 0 - for index in 0..<(count - 1) { - x += arrangedSubviews[index].frame.width - let rect = NSRect(x: x, y: 0, width: dividerThickness, height: bounds.height) - addCursorRect(rect, cursor: .resizeLeftRight) - x += dividerThickness - } - } - - override func drawDivider(in rect: NSRect) { - dividerFill.setFill() - rect.fill() - let line = NSRect(x: rect.midX - 0.5, y: rect.minY + 14, width: 1, height: max(0, rect.height - 28)) - dividerLine.setFill() - line.fill() - } - - private var dividerFill: NSColor { - // Follow the product theme (纸面/宣纸/墨石/石碑), not system aqua/darkAqua alone. - WeiBeiNativePalette.dividerFill() - } - - private var dividerLine: NSColor { - WeiBeiNativePalette.dividerLine() - } -} - -private final class NativeSplitCoordinator: NSObject, NSSplitViewDelegate { - enum Kind { - case two(split: Binding) - case three(first: Binding, second: Binding) - } - - var kind: Kind - var minimums: [CGFloat] - var roles: [WorkspacePaneRole] - var allowRailSnapping: Bool - var onFramesChange: (([CGRect]) -> Void)? - var onExpansionRequestHandled: ((UUID) -> Void)? - private var isDragging = false - private var isApplyingStoredPositions = false - private var lastAppliedWidth: CGFloat = 0 - private var saveWork: DispatchWorkItem? - private var recentReadableWidths: [WorkspacePaneRole: CGFloat] = [:] - private var handledExpansionRequestID: UUID? - - private let railWidth = ContentRailMetrics.railOnlyWidth - private let railSnapThreshold = ContentRailMetrics.snapThreshold - private let readableWidthThreshold = ContentRailMetrics.readableWidth - private let defaultReadableWidth = ContentRailMetrics.defaultReadableWidth - - init( - kind: Kind, - minimums: [CGFloat], - roles: [WorkspacePaneRole] = [], - allowRailSnapping: Bool = false, - onFramesChange: (([CGRect]) -> Void)? = nil - ) { - self.kind = kind - self.minimums = minimums - self.roles = roles - self.allowRailSnapping = allowRailSnapping - self.onFramesChange = onFramesChange - } - - func install(_ splitView: WeiBeiSplitView) { - splitView.isVertical = true - splitView.dividerStyle = .thin - splitView.delegate = self - splitView.onDragStart = { [weak self, weak splitView] in - guard let self else { return } - if let splitView { - self.captureReadableWidths(in: splitView) - } - self.isDragging = true - self.saveWork?.cancel() - } - splitView.onDragEnd = { [weak self, weak splitView] in - guard let self, let splitView else { return } - self.isDragging = false - if self.allowRailSnapping { - self.snapRailWidthsIfNeeded(in: splitView) - } - self.saveRatios(from: splitView) - self.reportFrames(from: splitView) - } - splitView.onLayout = { [weak self] splitView in - guard let self else { return } - self.applyStoredPositionsWhenNeeded(in: splitView) - if !self.isDragging { - self.reportFrames(from: splitView) - } - } - } - - func applyStoredPositionsWhenNeeded(in splitView: NSSplitView) { - DispatchQueue.main.async { [weak self, weak splitView] in - guard let self, let splitView else { return } - guard !self.isDragging, abs(splitView.bounds.width - self.lastAppliedWidth) > 0.5 else { return } - self.applyStoredPositions(in: splitView) - } - } - - func applyStoredPositions(in splitView: NSSplitView) { - let count = splitView.arrangedSubviews.count - guard count >= 2, splitView.bounds.width > 0 else { return } - let usable = max(splitView.bounds.width - CGFloat(count - 1) * splitView.dividerThickness, 1) - - isApplyingStoredPositions = true - defer { isApplyingStoredPositions = false } - - switch kind { - case .two(let split): - let firstWidth = clamped(split.wrappedValue * usable, min: minimums[safe: 0] ?? 0, max: usable - (minimums[safe: 1] ?? 0)) - splitView.setPosition(firstWidth, ofDividerAt: 0) - case .three(let first, let second): - let firstMinimum = minimums[safe: 0] ?? 0 - let secondMinimum = minimums[safe: 1] ?? 0 - let thirdMinimum = minimums[safe: 2] ?? 0 - let firstWidth = clamped(first.wrappedValue * usable, min: firstMinimum, max: usable - secondMinimum - thirdMinimum) - splitView.setPosition(firstWidth, ofDividerAt: 0) - let actualFirstWidth = splitView.arrangedSubviews[safe: 0]?.frame.width ?? firstWidth - let secondWidth = clamped((second.wrappedValue - first.wrappedValue) * usable, min: secondMinimum, max: usable - actualFirstWidth - thirdMinimum) - splitView.setPosition(actualFirstWidth + splitView.dividerThickness + secondWidth, ofDividerAt: 1) - } - - if allowRailSnapping { - snapRailWidthsIfNeeded(in: splitView) - } - - saveRatios(from: splitView) - } - - func captureReadableWidths(in splitView: NSSplitView) { - guard allowRailSnapping, roles.count == splitView.arrangedSubviews.count else { return } - for (role, view) in zip(roles, splitView.arrangedSubviews) where view.frame.width >= readableWidthThreshold { - recentReadableWidths[role] = view.frame.width - } - } - - func handleExpansionRequest(_ request: PaneExpansionRequest?, in splitView: NSSplitView) { - guard allowRailSnapping, - let request, - request.id != handledExpansionRequestID, - roles.count == splitView.arrangedSubviews.count, - let requestedIndex = roles.firstIndex(of: request.role) else { return } - - handledExpansionRequestID = request.id - expandPane(at: requestedIndex, role: request.role, in: splitView) - snapRailWidthsIfNeeded(in: splitView) - saveRatios(from: splitView) - splitView.needsLayout = true - splitView.layoutSubtreeIfNeeded() - - DispatchQueue.main.async { [weak self] in - self?.onExpansionRequestHandled?(request.id) - } - } - - func splitViewDidResizeSubviews(_ notification: Notification) { - guard let splitView = notification.object as? NSSplitView else { return } - guard !isDragging, !isApplyingStoredPositions else { return } - saveWork?.cancel() - let work = DispatchWorkItem { [weak self, weak splitView] in - guard let self, let splitView else { return } - self.saveRatios(from: splitView) - } - saveWork = work - DispatchQueue.main.asyncAfter(deadline: .now() + 0.12, execute: work) - } - - func splitView(_ splitView: NSSplitView, constrainMinCoordinate proposedMinimumPosition: CGFloat, ofSubviewAt dividerIndex: Int) -> CGFloat { - guard dividerIndex > 0 else { return minimums[safe: 0] ?? proposedMinimumPosition } - let previous = splitView.arrangedSubviews.prefix(dividerIndex).reduce(CGFloat(0)) { $0 + $1.frame.width } - return previous + CGFloat(dividerIndex) * splitView.dividerThickness + (minimums[safe: dividerIndex] ?? 0) - } - - func splitView(_ splitView: NSSplitView, constrainMaxCoordinate proposedMaximumPosition: CGFloat, ofSubviewAt dividerIndex: Int) -> CGFloat { - let trailingMinimum = minimums.dropFirst(dividerIndex + 1).reduce(CGFloat(0), +) - let trailingDividers = CGFloat(max(0, splitView.arrangedSubviews.count - dividerIndex - 2)) * splitView.dividerThickness - return splitView.bounds.width - splitView.dividerThickness - trailingMinimum - trailingDividers - } - - private func saveRatios(from splitView: NSSplitView) { - let count = splitView.arrangedSubviews.count - guard count >= 2 else { return } - let usable = max(splitView.bounds.width - CGFloat(count - 1) * splitView.dividerThickness, 1) - let widths = splitView.arrangedSubviews.map(\.frame.width) - - switch kind { - case .two(let split): - split.wrappedValue = clamped(widths[0] / usable, min: 0, max: 1) - case .three(let first, let second): - first.wrappedValue = clamped(widths[0] / usable, min: 0, max: 1) - second.wrappedValue = clamped((widths[0] + widths[1]) / usable, min: 0, max: 1) - } - captureReadableWidths(in: splitView) - lastAppliedWidth = splitView.bounds.width - reportFrames(from: splitView) - } - - private func snapRailWidthsIfNeeded(in splitView: NSSplitView) { - let widths = splitView.arrangedSubviews.map(\.frame.width) - guard widths.count >= 2 else { return } - - let snapIndices = widths.indices.filter { widths[$0] <= railSnapThreshold } - guard snapIndices.contains(where: { abs(widths[$0] - railWidth) > 0.5 }) else { return } - - var targetWidths = widths - for index in snapIndices { - targetWidths[index] = railWidth - } - - let readableIndices = widths.indices.filter { !snapIndices.contains($0) } - let fallbackRecipient = widths.indices.max { widths[$0] < widths[$1] } - for index in snapIndices { - let releasedWidth = widths[index] - railWidth - guard releasedWidth > 0.5 else { continue } - let recipient = readableIndices.min { lhs, rhs in - let lhsDistance = abs(lhs - index) - let rhsDistance = abs(rhs - index) - if lhsDistance == rhsDistance { - return widths[lhs] > widths[rhs] - } - return lhsDistance < rhsDistance - } ?? fallbackRecipient - if let recipient { - targetWidths[recipient] += releasedWidth - } - } - - applyPaneWidths(targetWidths, in: splitView) - } - - private func expandPane(at requestedIndex: Int, role: WorkspacePaneRole, in splitView: NSSplitView) { - let widths = splitView.arrangedSubviews.map(\.frame.width) - guard widths.indices.contains(requestedIndex) else { return } - let usable = max( - splitView.bounds.width - CGFloat(widths.count - 1) * splitView.dividerThickness, - 1 - ) - let otherIndices = widths.indices.filter { $0 != requestedIndex } - let otherMinimumTotal = otherIndices.reduce(CGFloat(0)) { partial, index in - partial + (minimums[safe: index] ?? railWidth) - } - let requestedMinimum = minimums[safe: requestedIndex] ?? railWidth - let desiredWidth = ContentRailPolicy.expansionWidth(recentWidth: recentReadableWidths[role]) - let requestedWidth = clamped( - desiredWidth, - min: requestedMinimum, - max: max(requestedMinimum, usable - otherMinimumTotal) - ) - - var targetWidths = Array(repeating: CGFloat(0), count: widths.count) - targetWidths[requestedIndex] = requestedWidth - let remainingWidth = max(0, usable - requestedWidth) - let extraAvailable = max(0, remainingWidth - otherMinimumTotal) - let currentExtras = otherIndices.map { index in - max(0, widths[index] - (minimums[safe: index] ?? railWidth)) - } - let currentExtraTotal = currentExtras.reduce(0, +) - - for (offset, index) in otherIndices.enumerated() { - let minimum = minimums[safe: index] ?? railWidth - let share: CGFloat - if currentExtraTotal > 0.5 { - share = extraAvailable * currentExtras[offset] / currentExtraTotal - } else { - share = extraAvailable / CGFloat(max(otherIndices.count, 1)) - } - targetWidths[index] = minimum + share - } - - if let correctionIndex = otherIndices.last { - targetWidths[correctionIndex] += usable - targetWidths.reduce(0, +) - } - applyPaneWidths(targetWidths, in: splitView) - } - - private func applyPaneWidths(_ widths: [CGFloat], in splitView: NSSplitView) { - guard widths.count == splitView.arrangedSubviews.count, widths.count >= 2 else { return } - var leadingWidth: CGFloat = 0 - for dividerIndex in 0..<(widths.count - 1) { - leadingWidth += widths[dividerIndex] - splitView.setPosition( - leadingWidth + CGFloat(dividerIndex) * splitView.dividerThickness, - ofDividerAt: dividerIndex - ) - } - } - - private func reportFrames(from splitView: NSSplitView) { - guard onFramesChange != nil, splitView.arrangedSubviews.count > 0 else { return } - let frames = splitView.arrangedSubviews.map(\.frame) - DispatchQueue.main.async { [weak self] in - self?.onFramesChange?(frames) - } - } - - private func clamped(_ value: CGFloat, min: CGFloat, max: CGFloat) -> CGFloat { - Swift.min(Swift.max(value, min), Swift.max(min, max)) - } -} - -private extension Array { - subscript(safe index: Index) -> Element? { - indices.contains(index) ? self[index] : nil - } -} diff --git a/Sources/WeiBei/Views/CourseDocNoteWorkspaceView.swift b/Sources/WeiBei/Views/CourseDocNoteWorkspaceView.swift index 806cdda39..d16cf474d 100644 --- a/Sources/WeiBei/Views/CourseDocNoteWorkspaceView.swift +++ b/Sources/WeiBei/Views/CourseDocNoteWorkspaceView.swift @@ -1,22 +1,6 @@ import SwiftUI import WeiBeiCore -enum CourseDocNotePresentation: String, CaseIterable, Identifiable { - case list - case map - - var id: String { rawValue } - - func label(language: WeiBeiInterfaceLanguage) -> String { - switch self { - case .list: - language.text("列表", "List") - case .map: - language.text("关系图", "Map") - } - } -} - /// Course-local management for the two durable knowledge objects in WeiBei: /// source documents and user notes. The list is the default management view; /// the graph remains a secondary visualization of explicit NoteSourceLink data. diff --git a/Sources/WeiBei/Views/CourseRecordsView.swift b/Sources/WeiBei/Views/CourseRecordsView.swift index 0a2232b4c..7198a55c8 100644 --- a/Sources/WeiBei/Views/CourseRecordsView.swift +++ b/Sources/WeiBei/Views/CourseRecordsView.swift @@ -2,22 +2,6 @@ import Foundation import SwiftUI import WeiBeiCore -enum CourseConversationSection: String, CaseIterable, Identifiable { - case chats - case memory - - var id: String { rawValue } - - func label(language: WeiBeiInterfaceLanguage, count: Int) -> String { - switch self { - case .chats: - return language.text("对话 \(count)", "Chats \(count)") - case .memory: - return language.text("课程记忆 \(count)", "Course Memory \(count)") - } - } -} - /// Course-associated Chats and course-scoped Memory are intentionally shown as /// two different sections. A Chat is global history that can touch more than /// one course; Memory is editable state scoped to this course. diff --git a/Sources/WeiBei/Views/CourseWorkspaceComponents.swift b/Sources/WeiBei/Views/CourseWorkspaceComponents.swift index e3f6e23f4..87e7d22ae 100644 --- a/Sources/WeiBei/Views/CourseWorkspaceComponents.swift +++ b/Sources/WeiBei/Views/CourseWorkspaceComponents.swift @@ -801,102 +801,6 @@ struct CourseProjectEntrySheet: View { } } -struct CourseRelationDetailHeader: View { - @EnvironmentObject private var store: WorkspaceStore - let mark: String - let title: String - let detail: String - let manageTitle: String? - let manage: (() -> Void)? - let openTitle: String - let open: () -> Void - - init( - mark: String, - title: String, - detail: String, - manageTitle: String? = nil, - manage: (() -> Void)? = nil, - openTitle: String, - open: @escaping () -> Void - ) { - self.mark = mark - self.title = title - self.detail = detail - self.manageTitle = manageTitle - self.manage = manage - self.openTitle = openTitle - self.open = open - } - - var body: some View { - HStack(alignment: .center, spacing: 18) { - VStack(alignment: .leading, spacing: 4) { - Text(mark.uppercased()) - .font(WeiBeiTypography.englishBrandFont(size: 9, weight: .semibold)) - .tracking(0.8) - .foregroundStyle(WeiBeiTheme.cinnabar.opacity(0.76)) - Text(title) - .weiBeiBrandFont(language: store.interfaceLanguage, size: 22, weight: .semibold) - .lineLimit(2) - Text(detail) - .weiBeiText(12) - .foregroundStyle(WeiBeiTheme.secondaryInk) - } - - Spacer() - - HStack(spacing: 8) { - if let manageTitle, let manage { - Button(manageTitle, action: manage) - .buttonStyle(WeiBeiTextActionButtonStyle()) - } - Button(openTitle, action: open) - .buttonStyle(WeiBeiTextActionButtonStyle(active: true)) - } - } - .padding(.horizontal, 24) - .frame(minHeight: 88) - .weibeiEtchedBackground( - fill: WeiBeiTheme.paperRaised.opacity(0.28), - stroke: WeiBeiTheme.hairline.opacity(0.26), - cornerRadius: 8 - ) - } -} - -struct CourseLinkedItemRow: View { - @EnvironmentObject private var store: WorkspaceStore - let item: StudyItem - let detail: String - - var body: some View { - HStack(spacing: 11) { - Image(systemName: item.kind.systemImage) - .weiBeiText(13, weight: .medium) - .foregroundStyle(WeiBeiTheme.secondaryInk) - .frame(width: 20) - VStack(alignment: .leading, spacing: 3) { - Text(store.displayTitle(for: item)) - .weiBeiText(13, weight: .medium) - .foregroundStyle(WeiBeiTheme.ink) - .lineLimit(1) - Text(detail) - .weiBeiText(10.5) - .foregroundStyle(WeiBeiTheme.secondaryInk) - .lineLimit(1) - } - Spacer() - Text(store.ui("已关联", "Linked")) - .weiBeiText(10.5, weight: .medium) - .foregroundStyle(WeiBeiTheme.cinnabar) - } - .padding(.horizontal, 10) - .frame(minHeight: 48) - .accessibilityElement(children: .combine) - } -} - enum CourseHubRowProminence { case normal case linked @@ -1024,129 +928,6 @@ struct RelationSelectionRow: View { } } -struct CourseDetailSection: View { - let title: String - @ViewBuilder let content: Content - - init(title: String, @ViewBuilder content: () -> Content) { - self.title = title - self.content = content() - } - - var body: some View { - VStack(alignment: .leading, spacing: 12) { - Text(title) - .weiBeiText(12, weight: .semibold) - .foregroundStyle(WeiBeiTheme.secondaryInk) - content - } - } -} - -struct CourseContextLine: View { - let icon: String - let label: String - let value: String - - var body: some View { - HStack(spacing: 11) { - Image(systemName: icon) - .foregroundStyle(WeiBeiTheme.secondaryInk) - .frame(width: 18) - Text(label) - .weiBeiText(12, weight: .medium) - .foregroundStyle(WeiBeiTheme.secondaryInk) - .frame(width: 76, alignment: .leading) - Text(value) - .weiBeiText(13, weight: .medium) - .foregroundStyle(WeiBeiTheme.ink) - .lineLimit(1) - Spacer() - } - .padding(.horizontal, 12) - .frame(minHeight: 44) - .weibeiEtchedBackground( - fill: WeiBeiTheme.paperRaised.opacity(0.30), - stroke: WeiBeiTheme.hairline.opacity(0.28), - cornerRadius: 8 - ) - } -} - -struct CourseActionRow: View { - let icon: String - let title: String - let detail: String - let actionTitle: String - let action: () -> Void - - var body: some View { - HStack(spacing: 11) { - Image(systemName: icon) - .foregroundStyle(WeiBeiTheme.secondaryInk) - .frame(width: 18) - VStack(alignment: .leading, spacing: 3) { - Text(title) - .weiBeiText(13, weight: .medium) - .foregroundStyle(WeiBeiTheme.ink) - .lineLimit(1) - Text(detail) - .weiBeiText(10.5) - .foregroundStyle(WeiBeiTheme.secondaryInk) - .lineLimit(2) - } - Spacer() - Button(actionTitle, action: action) - .buttonStyle(WeiBeiTextActionButtonStyle()) - } - .padding(.horizontal, 12) - .frame(minHeight: 50) - .weibeiEtchedBackground( - fill: WeiBeiTheme.paperRaised.opacity(0.24), - stroke: WeiBeiTheme.hairline.opacity(0.24), - cornerRadius: 8 - ) - } -} - -struct CourseAttentionRow: View { - let title: String - let count: Int - let detail: String - let action: () -> Void - @State private var hovering = false - - var body: some View { - Button(action: action) { - HStack(spacing: 12) { - Text("\(count)") - .weiBeiText(15, weight: .semibold, design: .monospaced) - .foregroundStyle(count == 0 ? WeiBeiTheme.tertiaryInk : WeiBeiTheme.cinnabar) - .frame(width: 34, alignment: .leading) - VStack(alignment: .leading, spacing: 2) { - Text(title) - .weiBeiText(13, weight: .medium) - .foregroundStyle(WeiBeiTheme.ink) - Text(detail) - .weiBeiText(10.5) - .foregroundStyle(WeiBeiTheme.secondaryInk) - .lineLimit(2) - } - Spacer() - Image(systemName: "chevron.right") - .weiBeiText(10.5, weight: .semibold) - .foregroundStyle(WeiBeiTheme.tertiaryInk) - } - .padding(.horizontal, 12) - .frame(minHeight: 52) - .contentShape(Rectangle()) - .background(hovering ? WeiBeiTheme.paperInset.opacity(0.18) : WeiBeiTheme.paperRaised.opacity(0.22)) - } - .buttonStyle(.plain) - .onHover { hovering = $0 } - } -} - struct CourseEmptyState: View { let title: String let detail: String @@ -1180,35 +961,6 @@ struct CourseEmptyState: View { } /// Hub column empty slot: top-aligned icon/title/detail so three columns share one baseline. -struct CourseHubColumnEmptyState: View { - let title: String - let detail: String - let systemImage: String - - var body: some View { - VStack(alignment: .leading, spacing: 10) { - Image(systemName: systemImage) - .weiBeiText(22, weight: .regular) - .foregroundStyle(WeiBeiTheme.cinnabar.opacity(0.72)) - .frame(width: 28, height: 28, alignment: .center) - Text(title) - .weiBeiText(13, weight: .semibold) - .foregroundStyle(WeiBeiTheme.ink) - .lineLimit(1) - Text(detail) - .weiBeiText(12) - .foregroundStyle(WeiBeiTheme.secondaryInk) - .lineLimit(2) - .frame(height: 34, alignment: .topLeading) - .frame(maxWidth: .infinity, alignment: .leading) - Spacer(minLength: 0) - } - .padding(.horizontal, 24) - .padding(.top, 28) - .frame(maxWidth: .infinity, maxHeight: .infinity, alignment: .topLeading) - } -} - func courseTitleDisplayFont(_ title: String, size: CGFloat, weight: Font.Weight = .semibold) -> Font { if courseTitlePrefersEnglishBrandFont(title) { return WeiBeiTypography.englishBrandFont(size: size, weight: weight) diff --git a/Sources/WeiBei/Views/LinkedSourcesView.swift b/Sources/WeiBei/Views/LinkedSourcesView.swift deleted file mode 100644 index 46df8832c..000000000 --- a/Sources/WeiBei/Views/LinkedSourcesView.swift +++ /dev/null @@ -1,168 +0,0 @@ -import SwiftUI -import WeiBeiCore - -struct LinkedSourcesPopover: View { - @EnvironmentObject private var store: WorkspaceStore - @State private var query = "" - @State private var draftIDs = Set() - @State private var noteItemID: String? - let dismiss: () -> Void - - private var materials: [StudyItem] { - store.allItems.filter { item in - guard item.isCourseMaterial else { return false } - let cleaned = query.trimmingCharacters(in: .whitespacesAndNewlines) - return cleaned.isEmpty - || store.displayTitle(for: item).localizedCaseInsensitiveContains(cleaned) - || store.displaySubtitle(for: item).localizedCaseInsensitiveContains(cleaned) - } - } - - private var groupedMaterials: [(String, [StudyItem])] { - let groups = Dictionary(grouping: materials.filter { $0.id != store.selectedMaterialItem?.id }) { item in - item.url?.deletingLastPathComponent().path.replacingOccurrences(of: NSHomeDirectory(), with: "~") - ?? store.ui("内置资料", "Built-in") - } - return groups.keys.sorted().map { ($0, groups[$0] ?? []) } - } - - var body: some View { - VStack(alignment: .leading, spacing: 0) { - VStack(alignment: .leading, spacing: 12) { - HStack(alignment: .firstTextBaseline) { - VStack(alignment: .leading, spacing: 3) { - Text(store.ui("这份笔记的资料", "Sources for this note")) - .weiBeiBrandFont(language: store.interfaceLanguage, size: 15, weight: .semibold) - Text(store.ui("选中的资料会一直跟随这份笔记", "Selected sources stay with this note")) - .weiBeiText(10.5) - .foregroundStyle(WeiBeiTheme.secondaryInk) - } - Spacer() - Text("\(draftIDs.count)") - .weiBeiText(18, weight: .medium, design: .serif) - .foregroundStyle(WeiBeiTheme.cinnabar) - } - - HStack(spacing: 7) { - Image(systemName: "magnifyingglass") - .foregroundStyle(WeiBeiTheme.tertiaryInk) - TextField(store.ui("搜索标题、文件名", "Search title or file name"), text: $query) - .textFieldStyle(.plain) - } - .weiBeiText(13) - .weibeiInputSurface(height: 32) - - if let current = store.selectedMaterialItem { - sourceButton(current, showsCurrentLabel: true) - } - } - .padding(16) - - Divider().overlay(WeiBeiTheme.hairline) - - ScrollView { - LazyVStack(alignment: .leading, spacing: 12) { - ForEach(groupedMaterials, id: \.0) { group in - VStack(alignment: .leading, spacing: 4) { - Text(group.0) - .weiBeiText(10.5, weight: .semibold) - .foregroundStyle(WeiBeiTheme.tertiaryInk) - .padding(.horizontal, 7) - ForEach(group.1) { item in - sourceButton(item) - } - } - } - if materials.isEmpty { - Text(store.ui("没有匹配的资料", "No matching sources")) - .weiBeiText(10.5) - .foregroundStyle(WeiBeiTheme.secondaryInk) - .frame(maxWidth: .infinity) - .padding(.vertical, 36) - } - } - .padding(12) - } - .frame(height: 290) - - Divider().overlay(WeiBeiTheme.hairline) - - HStack { - Button { - store.importAndLinkSourcesFromPanel() - dismiss() - } label: { - Label(store.ui("导入资料", "Import sources"), systemImage: "plus") - } - .buttonStyle(WeiBeiTextActionButtonStyle()) - - Button { - store.presentCourseWorkspace(.notes, selecting: noteItemID) - dismiss() - } label: { - Label(store.ui("资料关系台", "Course Relations"), systemImage: "books.vertical") - } - .buttonStyle(WeiBeiTextActionButtonStyle()) - - Spacer() - - Button(store.ui("取消", "Cancel"), action: dismiss) - .buttonStyle(WeiBeiTextActionButtonStyle()) - Button(store.ui("保存关联", "Save links")) { - if let noteItemID { - store.setLinkedSourceIDs(draftIDs, for: noteItemID) - } - dismiss() - } - .buttonStyle(WeiBeiTextActionButtonStyle(active: true)) - } - .padding(12) - } - .frame(width: 440) - .background(WeiBeiTheme.paperRaised) - .onAppear { - noteItemID = store.activeNotebookItemID - if let noteItemID { - draftIDs = Set(store.linkedSourceIDs(for: noteItemID)) - } - } - } - - private func sourceButton(_ item: StudyItem, showsCurrentLabel: Bool = false) -> some View { - Button { toggle(item.id) } label: { - HStack(spacing: 9) { - Image(systemName: draftIDs.contains(item.id) ? "checkmark.square.fill" : "square") - .foregroundStyle(draftIDs.contains(item.id) ? WeiBeiTheme.cinnabar : WeiBeiTheme.tertiaryInk) - Image(systemName: item.kind.systemImage) - .foregroundStyle(WeiBeiTheme.secondaryInk) - .frame(width: 17) - VStack(alignment: .leading, spacing: 2) { - Text(store.displayTitle(for: item)).lineLimit(1) - if !showsCurrentLabel { - Text(item.url?.deletingLastPathComponent().path.replacingOccurrences(of: NSHomeDirectory(), with: "~") ?? store.displaySubtitle(for: item)) - .weiBeiText(9.5) - .foregroundStyle(WeiBeiTheme.secondaryInk) - .lineLimit(1) - } - } - Spacer() - Text(showsCurrentLabel ? store.ui("当前", "Open") : item.kind.label(language: store.interfaceLanguage)) - .weiBeiText(9.5) - .foregroundStyle(WeiBeiTheme.tertiaryInk) - } - .contentShape(Rectangle()) - .padding(.horizontal, 8) - .frame(height: showsCurrentLabel ? 36 : 42) - } - .buttonStyle(.plain) - .accessibilityValue(Text(draftIDs.contains(item.id) ? store.ui("已关联", "Linked") : store.ui("未关联", "Not linked"))) - } - - private func toggle(_ sourceID: String) { - if draftIDs.contains(sourceID) { - draftIDs.remove(sourceID) - } else { - draftIDs.insert(sourceID) - } - } -} diff --git a/Sources/WeiBei/Views/NotesAgentView.swift b/Sources/WeiBei/Views/NotesAgentView.swift index 627a41135..5b0f5766c 100644 --- a/Sources/WeiBei/Views/NotesAgentView.swift +++ b/Sources/WeiBei/Views/NotesAgentView.swift @@ -44,42 +44,6 @@ private extension View { } - func weibeiFloatingHeaderChrome(appearanceMode: WeiBeiAppearanceMode) -> some View { - self - .padding(.horizontal, 10) - .frame(height: 32) - .background(WeiBeiGlassHeaderBackground(paperOpacity: 0.60, materialOpacity: 0.08)) - .clipShape(RoundedRectangle(cornerRadius: 8)) - .overlay(alignment: .bottom) { - WeiBeiHeaderHandoffFade(height: 10, opacity: 0.22) - .offset(y: 10) - } - - } - - func weibeiHeaderAccessoryGroup() -> some View { - self - .padding(3) - .background { - ZStack { - RoundedRectangle(cornerRadius: 8) - .fill(.ultraThinMaterial) - .opacity(0.05) - RoundedRectangle(cornerRadius: 8) - .fill(WeiBeiTheme.paperInset.opacity(0.22)) - } - } - .clipShape(RoundedRectangle(cornerRadius: 8)) - .overlay(alignment: .top) { - RoundedRectangle(cornerRadius: 8) - .stroke(WeiBeiTheme.glassHighlight.opacity(0.18), lineWidth: 1) - .padding(0.5) - } - .overlay { - RoundedRectangle(cornerRadius: 8) - .stroke(WeiBeiTheme.hairline.opacity(0.62), lineWidth: 1) - } - } } struct WeiBeiPaneHeader: View { diff --git a/Sources/WeiBei/Views/Settings/SettingsView.swift b/Sources/WeiBei/Views/Settings/SettingsView.swift index e892bafef..cd011dc83 100644 --- a/Sources/WeiBei/Views/Settings/SettingsView.swift +++ b/Sources/WeiBei/Views/Settings/SettingsView.swift @@ -1143,22 +1143,6 @@ struct SettingsView: View { } } - private func segmented( - _ items: [Item], - active: Item, - label: @escaping (Item) -> String, - action: @escaping (Item) -> Void - ) -> some View { - HStack(spacing: 5) { - ForEach(items) { item in - Button(label(item)) { - action(item) - } - .buttonStyle(WeiBeiTextActionButtonStyle(active: item == active)) - } - } - } - /// Shared compact dropdown — hugs label width, no forced wide track. func compactMenu(_ title: String, @ViewBuilder content: () -> Content) -> some View { Menu { diff --git a/Sources/WeiBeiCore/AgentResources/python/rich_answer_worker.py b/Sources/WeiBeiCore/AgentResources/python/rich_answer_worker.py deleted file mode 100644 index 3bb340847..000000000 --- a/Sources/WeiBeiCore/AgentResources/python/rich_answer_worker.py +++ /dev/null @@ -1,588 +0,0 @@ -#!/usr/bin/env python3 -"""WeiBei controlled rich-answer Python worker. - -Reads one JSON request from stdin and writes one JSON response to stdout. -Only four fixed operations are supported. User code, network access, and -arbitrary file access are intentionally absent. -""" - -from __future__ import annotations - -import ast -import hashlib -import json -import math -import sys -from dataclasses import dataclass -from typing import Any - - -WORKER_VERSION = "1.0.0" -SCHEMA_VERSION = 1 -HARD_MAX_INPUT_BYTES = 256_000 -HARD_MAX_OUTPUT_BYTES = 512_000 -HARD_MAX_ROWS = 2_000 -HARD_MAX_COLUMNS = 80 -HARD_MAX_POINTS = 2_000 -HARD_MAX_EXPRESSION_NODES = 96 -HARD_MAX_EXPRESSION_DEPTH = 24 -HARD_MAX_MAGNITUDE = 1.0e12 -SAFE_ID_CHARS = set("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789._-") -SAFE_SOURCE_PREFIXES = ("[材料:", "[笔记:", "[选区:") - -ALLOWED_OPERATIONS = { - "compute_statistics", - "fit_regression", - "bin_distribution", - "sample_function", -} -ALLOWED_OUTPUT_KINDS = {"json_spec", "numeric_series", "table"} -ALLOWED_REGRESSION_KINDS = {"linear"} - - -class WorkerError(Exception): - def __init__(self, code: str, message: str, field: str | None = None) -> None: - super().__init__(message) - self.code = code - self.message = message - self.field = field - - -@dataclass(frozen=True) -class Limits: - max_input_bytes: int = HARD_MAX_INPUT_BYTES - max_output_bytes: int = HARD_MAX_OUTPUT_BYTES - max_rows: int = HARD_MAX_ROWS - max_columns: int = HARD_MAX_COLUMNS - max_runtime_ms: int = 3_000 - - -def canonical_json(value: Any) -> str: - return json.dumps(value, ensure_ascii=False, sort_keys=True, separators=(",", ":"), allow_nan=False) - - -def json_size(value: Any) -> int: - return len(canonical_json(value).encode("utf-8")) - - -def sha256_payload(value: Any) -> str: - return hashlib.sha256(canonical_json(value).encode("utf-8")).hexdigest() - - -def is_safe_id(value: str) -> bool: - return 1 <= len(value) <= 128 and all(char in SAFE_ID_CHARS for char in value) - - -def is_safe_source_evidence(value: str) -> bool: - return ( - 4 <= len(value) <= 300 - and value.startswith(SAFE_SOURCE_PREFIXES) - and value.endswith("]") - and all(ord(char) >= 32 and char not in {"\x7f", "\x00"} for char in value) - ) - - -def as_object(value: Any, field: str) -> dict[str, Any]: - if not isinstance(value, dict): - raise WorkerError("invalid_object", f"{field} must be an object", field) - return value - - -def as_string(value: Any, field: str) -> str: - if not isinstance(value, str): - raise WorkerError("invalid_string", f"{field} must be a string", field) - return value - - -def as_optional_string(value: Any, field: str, default: str) -> str: - if value is None: - return default - return as_string(value, field) - - -def as_number(value: Any, field: str) -> float: - if not isinstance(value, (int, float)) or isinstance(value, bool): - raise WorkerError("invalid_number", f"{field} must be a finite number", field) - number = float(value) - if not math.isfinite(number) or abs(number) > HARD_MAX_MAGNITUDE: - raise WorkerError("invalid_number", f"{field} must be finite and within magnitude guard", field) - return number - - -def as_optional_number(value: Any, field: str, default: float) -> float: - if value is None: - return default - return as_number(value, field) - - -def as_int(value: Any, field: str, default: int, minimum: int, maximum: int) -> int: - if value is None: - return default - if not isinstance(value, int) or isinstance(value, bool): - raise WorkerError("invalid_integer", f"{field} must be an integer", field) - if value < minimum or value > maximum: - raise WorkerError("limit_exceeded", f"{field} must be between {minimum} and {maximum}", field) - return value - - -def safe_number(value: float | None) -> float | None: - if value is None or not math.isfinite(value) or abs(value) > HARD_MAX_MAGNITUDE: - return None - rounded = round(value, 12) - return 0.0 if rounded == -0.0 else rounded - - -def percentile(sorted_values: list[float], ratio: float) -> float: - position = (len(sorted_values) - 1) * ratio - lower = math.floor(position) - upper = math.ceil(position) - if lower == upper: - return sorted_values[lower] - weight = position - lower - return sorted_values[lower] * (1 - weight) + sorted_values[upper] * weight - - -def mean_value(values: list[float]) -> float: - return sum(values) / len(values) - - -def median_value(sorted_values: list[float]) -> float: - midpoint = len(sorted_values) // 2 - if len(sorted_values) % 2 == 1: - return sorted_values[midpoint] - return (sorted_values[midpoint - 1] + sorted_values[midpoint]) / 2 - - -def parse_limits(request: dict[str, Any]) -> Limits: - raw_limits = as_object(request.get("limits", {}), "limits") - return Limits( - max_input_bytes=min( - as_int(raw_limits.get("maxInputBytes"), "limits.maxInputBytes", HARD_MAX_INPUT_BYTES, 1, HARD_MAX_INPUT_BYTES), - HARD_MAX_INPUT_BYTES, - ), - max_output_bytes=min( - as_int(raw_limits.get("maxOutputBytes"), "limits.maxOutputBytes", HARD_MAX_OUTPUT_BYTES, 1_024, HARD_MAX_OUTPUT_BYTES), - HARD_MAX_OUTPUT_BYTES, - ), - max_rows=min(as_int(raw_limits.get("maxRows"), "limits.maxRows", HARD_MAX_ROWS, 1, HARD_MAX_ROWS), HARD_MAX_ROWS), - max_columns=min(as_int(raw_limits.get("maxColumns"), "limits.maxColumns", HARD_MAX_COLUMNS, 1, HARD_MAX_COLUMNS), HARD_MAX_COLUMNS), - max_runtime_ms=min(as_int(raw_limits.get("maxRuntimeMS"), "limits.maxRuntimeMS", 3_000, 1, 3_000), 3_000), - ) - - -def number_array(value: Any, field: str, limit: int) -> list[float]: - if not isinstance(value, list): - raise WorkerError("invalid_number_array", f"{field} must be a number array", field) - if len(value) > limit: - raise WorkerError("limit_exceeded", f"{field} exceeds row/point limit", field) - result = [as_number(item, f"{field}[{index}]") for index, item in enumerate(value)] - if not result: - raise WorkerError("empty_array", f"{field} must not be empty", field) - return result - - -def parse_request(raw: Any, input_size: int) -> tuple[dict[str, Any], Limits]: - request = as_object(raw, "request") - if request.get("schemaVersion") != SCHEMA_VERSION: - raise WorkerError("unsupported_schema", "schemaVersion must be 1", "schemaVersion") - request_id = as_string(request.get("requestID"), "requestID") - if not is_safe_id(request_id): - raise WorkerError("invalid_identifier", "requestID must be a safe identifier", "requestID") - operation = as_string(request.get("operation"), "operation") - if operation not in ALLOWED_OPERATIONS: - raise WorkerError("unsupported_operation", f"unsupported operation: {operation}", "operation") - as_object(request.get("data"), "data") - as_object(request.get("parameters", {}), "parameters") - requested_output = as_object(request.get("requestedOutput"), "requestedOutput") - output_id = as_string(requested_output.get("id"), "requestedOutput.id") - if not is_safe_id(output_id): - raise WorkerError("invalid_identifier", "requestedOutput.id must be a safe identifier", "requestedOutput.id") - output_kind = as_string(requested_output.get("kind"), "requestedOutput.kind") - if output_kind not in ALLOWED_OUTPUT_KINDS: - raise WorkerError("unsupported_output_kind", f"unsupported output kind: {output_kind}", "requestedOutput.kind") - if requested_output.get("mimeType") != "application/json": - raise WorkerError("unsupported_mime_type", "requestedOutput.mimeType must be application/json", "requestedOutput.mimeType") - as_string(requested_output.get("role"), "requestedOutput.role") - source_evidence_ids = request.get("sourceEvidenceIDs") - if ( - not isinstance(source_evidence_ids, list) - or len(source_evidence_ids) > 12 - or len(set(source_evidence_ids)) != len(source_evidence_ids) - or not all(isinstance(item, str) and is_safe_source_evidence(item) for item in source_evidence_ids) - ): - raise WorkerError( - "invalid_source_evidence", - "sourceEvidenceIDs must be unique safe WeiBei source labels when provided", - "sourceEvidenceIDs", - ) - limits = parse_limits(request) - if input_size > limits.max_input_bytes: - raise WorkerError("limit_exceeded", "stdin exceeds maxInputBytes", "limits.maxInputBytes") - return request, limits - - -def make_artifact(request: dict[str, Any], payload: dict[str, Any], metadata: dict[str, Any] | None = None) -> dict[str, Any]: - requested_output = as_object(request["requestedOutput"], "requestedOutput") - payload_json = canonical_json(payload) - size_bytes = len(payload_json.encode("utf-8")) - return { - "id": requested_output["id"], - "kind": requested_output["kind"], - "mimeType": requested_output["mimeType"], - "role": requested_output["role"], - "payload": payload, - "payloadCanonicalJSON": payload_json, - "sizeBytes": size_bytes, - "sha256": hashlib.sha256(payload_json.encode("utf-8")).hexdigest(), - "sourceEvidenceIDs": request["sourceEvidenceIDs"], - "metadata": metadata or {}, - } - - -def compute_statistics(request: dict[str, Any], limits: Limits) -> list[dict[str, Any]]: - data = as_object(request["data"], "data") - parameters = as_object(request.get("parameters", {}), "parameters") - values = number_array(data.get("values"), "data.values", limits.max_rows) - ddof = as_int(parameters.get("ddof"), "parameters.ddof", 0, 0, 1) - sorted_values = sorted(values) - count = len(values) - average = mean_value(values) - median = median_value(sorted_values) - variance = sum((value - average) ** 2 for value in values) / (count - ddof) if count > ddof else 0.0 - stdev = math.sqrt(variance) - payload = { - "type": "statisticsSummary", - "count": count, - "ddof": ddof, - "min": safe_number(min(values)), - "q1": safe_number(percentile(sorted_values, 0.25)), - "median": safe_number(median), - "q3": safe_number(percentile(sorted_values, 0.75)), - "max": safe_number(max(values)), - "sum": safe_number(sum(values)), - "mean": safe_number(average), - "variance": safe_number(variance), - "stdev": safe_number(stdev), - "chartData": [ - {"metric": "min", "value": safe_number(min(values))}, - {"metric": "q1", "value": safe_number(percentile(sorted_values, 0.25))}, - {"metric": "median", "value": safe_number(median)}, - {"metric": "q3", "value": safe_number(percentile(sorted_values, 0.75))}, - {"metric": "max", "value": safe_number(max(values))}, - ], - } - return [make_artifact(request, payload, {"operation": "compute_statistics"})] - - -def fit_regression(request: dict[str, Any], limits: Limits) -> list[dict[str, Any]]: - data = as_object(request["data"], "data") - parameters = as_object(request.get("parameters", {}), "parameters") - regression_kind = as_optional_string(parameters.get("regressionKind"), "parameters.regressionKind", "linear") - if regression_kind not in ALLOWED_REGRESSION_KINDS: - raise WorkerError("unsupported_regression_kind", "only linear regression is supported", "parameters.regressionKind") - x_values = number_array(data.get("xValues"), "data.xValues", limits.max_rows) - y_values = number_array(data.get("yValues"), "data.yValues", limits.max_rows) - if len(x_values) != len(y_values): - raise WorkerError("shape_mismatch", "xValues and yValues must have the same length", "data.yValues") - if len(x_values) < 2: - raise WorkerError("insufficient_data", "linear regression needs at least two points", "data.xValues") - mean_x = mean_value(x_values) - mean_y = mean_value(y_values) - x_sum_squares = sum((value - mean_x) ** 2 for value in x_values) - if x_sum_squares == 0: - raise WorkerError("singular_regression", "xValues must not all be equal", "data.xValues") - slope = sum((x - mean_x) * (y - mean_y) for x, y in zip(x_values, y_values)) / x_sum_squares - intercept = mean_y - slope * mean_x - fitted = [intercept + slope * x for x in x_values] - residuals = [y - fit for y, fit in zip(y_values, fitted)] - total_sum_squares = sum((y - mean_y) ** 2 for y in y_values) - residual_sum_squares = sum(residual ** 2 for residual in residuals) - r_squared = 1.0 if total_sum_squares == 0 else 1.0 - residual_sum_squares / total_sum_squares - payload = { - "type": "linearRegression", - "model": "y = slope * x + intercept", - "slope": safe_number(slope), - "intercept": safe_number(intercept), - "rSquared": safe_number(r_squared), - "count": len(x_values), - "points": [ - { - "x": safe_number(x), - "y": safe_number(y), - "fit": safe_number(fit), - "residual": safe_number(residual), - } - for x, y, fit, residual in zip(x_values, y_values, fitted, residuals) - ], - "chart": {"type": "scatterWithRegression", "xField": "x", "yField": "y", "fitField": "fit"}, - } - return [make_artifact(request, payload, {"operation": "fit_regression", "regressionKind": regression_kind})] - - -def bin_distribution(request: dict[str, Any], limits: Limits) -> list[dict[str, Any]]: - data = as_object(request["data"], "data") - parameters = as_object(request.get("parameters", {}), "parameters") - values = number_array(data.get("values"), "data.values", limits.max_rows) - default_bins = min(12, max(1, int(math.sqrt(len(values))))) - bin_count = as_int(parameters.get("binCount"), "parameters.binCount", default_bins, 1, min(100, limits.max_rows)) - lower = min(values) - upper = max(values) - if lower == upper: - upper = lower + 1.0 - width = (upper - lower) / bin_count - counts = [0 for _ in range(bin_count)] - for value in values: - index = min(bin_count - 1, int((value - lower) / width)) - counts[index] += 1 - bins = [] - for index, count in enumerate(counts): - start = lower + index * width - end = start + width - bins.append( - { - "bin": index + 1, - "start": safe_number(start), - "end": safe_number(end), - "midpoint": safe_number((start + end) / 2), - "count": count, - "density": safe_number(count / (len(values) * width)), - } - ) - payload = { - "type": "distributionBins", - "count": len(values), - "binCount": bin_count, - "bins": bins, - "chart": {"type": "histogram", "xField": "midpoint", "yField": "count"}, - } - return [make_artifact(request, payload, {"operation": "bin_distribution"})] - - -ALLOWED_FUNCTIONS = { - "abs": abs, - "acos": math.acos, - "asin": math.asin, - "atan": math.atan, - "ceil": math.ceil, - "cos": math.cos, - "exp": math.exp, - "floor": math.floor, - "ln": math.log, - "log": math.log, - "log10": math.log10, - "max": max, - "min": min, - "pow": pow, - "sin": math.sin, - "sqrt": math.sqrt, - "tan": math.tan, -} - -ALLOWED_AST_NODES = ( - ast.Expression, - ast.BinOp, - ast.UnaryOp, - ast.Constant, - ast.Name, - ast.Call, - ast.Load, - ast.Add, - ast.Sub, - ast.Mult, - ast.Div, - ast.Pow, - ast.USub, - ast.UAdd, -) - - -class SafeExpression: - def __init__(self, expression: str) -> None: - self.node_count = 0 - try: - self.root = ast.parse(expression, mode="eval") - except SyntaxError as error: - raise WorkerError("invalid_expression", "expression is not valid arithmetic syntax", "data.expression") from error - self._validate(self.root, 0) - - def _validate(self, node: ast.AST, depth: int) -> None: - self.node_count += 1 - if self.node_count > HARD_MAX_EXPRESSION_NODES: - raise WorkerError("expression_too_large", "expression has too many nodes", "data.expression") - if depth > HARD_MAX_EXPRESSION_DEPTH: - raise WorkerError("expression_too_deep", "expression is too deeply nested", "data.expression") - if not isinstance(node, ALLOWED_AST_NODES): - raise WorkerError("unsafe_expression", f"unsupported expression node: {type(node).__name__}", "data.expression") - if isinstance(node, ast.Constant): - as_number(node.value, "data.expression.constant") - if isinstance(node, ast.Name): - if node.id not in {"x", "pi", "e"}: - raise WorkerError("unsafe_expression", f"unknown identifier: {node.id}", "data.expression") - if isinstance(node, ast.Call): - if not isinstance(node.func, ast.Name) or node.func.id not in ALLOWED_FUNCTIONS: - raise WorkerError("unsafe_expression", "only allowlisted math calls are supported", "data.expression") - if node.keywords: - raise WorkerError("unsafe_expression", "keyword arguments are not supported", "data.expression") - for argument in node.args: - self._validate(argument, depth + 1) - return - for child in ast.iter_child_nodes(node): - self._validate(child, depth + 1) - - def evaluate(self, x_value: float) -> float: - return as_number(self._compute_node(self.root, x_value), "data.expression.result") - - def _compute_node(self, node: ast.AST, x_value: float) -> float: - if isinstance(node, ast.Expression): - return self._compute_node(node.body, x_value) - if isinstance(node, ast.Constant): - return float(node.value) - if isinstance(node, ast.Name): - if node.id == "x": - return x_value - if node.id == "pi": - return math.pi - if node.id == "e": - return math.e - raise WorkerError("unsafe_expression", f"unexpected identifier: {node.id}", "data.expression") - if isinstance(node, ast.UnaryOp): - operand = self._compute_node(node.operand, x_value) - if isinstance(node.op, ast.USub): - return -operand - if isinstance(node.op, ast.UAdd): - return operand - if isinstance(node, ast.BinOp): - left = self._compute_node(node.left, x_value) - right = self._compute_node(node.right, x_value) - if isinstance(node.op, ast.Add): - return left + right - if isinstance(node.op, ast.Sub): - return left - right - if isinstance(node.op, ast.Mult): - return left * right - if isinstance(node.op, ast.Div): - if right == 0: - raise WorkerError("domain_error", "division by zero", "data.expression") - return left / right - if isinstance(node.op, ast.Pow): - return math.pow(left, right) - if isinstance(node, ast.Call) and isinstance(node.func, ast.Name): - return float( - ALLOWED_FUNCTIONS[node.func.id]( - *[self._compute_node(argument, x_value) for argument in node.args] - ) - ) - raise WorkerError("unsafe_expression", "unsupported arithmetic form", "data.expression") - - -def sample_function(request: dict[str, Any], limits: Limits) -> list[dict[str, Any]]: - data = as_object(request["data"], "data") - expression = as_string(data.get("expression"), "data.expression") - domain = as_object(data.get("domain"), "data.domain") - lower = as_number(domain.get("min"), "data.domain.min") - upper = as_number(domain.get("max"), "data.domain.max") - if upper <= lower: - raise WorkerError("invalid_domain", "domain.max must be greater than domain.min", "data.domain.max") - samples = as_int(domain.get("samples"), "data.domain.samples", 121, 2, min(HARD_MAX_POINTS, limits.max_rows)) - safe_expression = SafeExpression(expression) - step = (upper - lower) / (samples - 1) - points = [] - for index in range(samples): - x_value = lower + step * index - try: - y_value = safe_expression.evaluate(x_value) - points.append({"x": safe_number(x_value), "y": safe_number(y_value), "defined": True}) - except (ValueError, OverflowError, WorkerError): - points.append({"x": safe_number(x_value), "y": None, "defined": False}) - segments: list[dict[str, Any]] = [] - current_segment: list[dict[str, Any]] = [] - for point in points: - if point["defined"]: - current_segment.append(point) - elif current_segment: - segments.append({"points": current_segment}) - current_segment = [] - if current_segment: - segments.append({"points": current_segment}) - payload = { - "type": "functionSamples", - "expression": expression, - "domain": {"min": safe_number(lower), "max": safe_number(upper), "samples": samples}, - "points": points, - "segments": segments, - "chart": {"type": "line", "xField": "x", "yField": "y"}, - } - return [make_artifact(request, payload, {"operation": "sample_function", "variable": "x"})] - - -OPERATIONS = { - "compute_statistics": compute_statistics, - "fit_regression": fit_regression, - "bin_distribution": bin_distribution, - "sample_function": sample_function, -} - - -def success_response(request: dict[str, Any], artifacts: list[dict[str, Any]], limits: Limits) -> dict[str, Any]: - response = { - "schemaVersion": SCHEMA_VERSION, - "ok": True, - "workerVersion": WORKER_VERSION, - "requestID": request["requestID"], - "operation": request["operation"], - "artifacts": artifacts, - "diagnostics": [ - "network=disabled", - "filesystem=disabled", - "userCode=disabled", - f"maxRows={limits.max_rows}", - f"maxOutputBytes={limits.max_output_bytes}", - ], - } - if json_size(response) > limits.max_output_bytes: - raise WorkerError("limit_exceeded", "response exceeds maxOutputBytes", "limits.maxOutputBytes") - return response - - -def error_response(error: WorkerError) -> dict[str, Any]: - payload: dict[str, Any] = { - "schemaVersion": SCHEMA_VERSION, - "ok": False, - "workerVersion": WORKER_VERSION, - "error": {"code": error.code, "message": error.message}, - } - if error.field is not None: - payload["error"]["field"] = error.field - return payload - - -def run(raw_request: Any, input_size: int) -> dict[str, Any]: - request, limits = parse_request(raw_request, input_size) - artifacts = OPERATIONS[request["operation"]](request, limits) - return success_response(request, artifacts, limits) - - -def main() -> int: - try: - raw_bytes = sys.stdin.buffer.read(HARD_MAX_INPUT_BYTES + 1) - if len(raw_bytes) > HARD_MAX_INPUT_BYTES: - raise WorkerError("limit_exceeded", "stdin exceeds hard maxInputBytes", "stdin") - try: - raw_request = json.loads(raw_bytes.decode("utf-8")) - except UnicodeDecodeError as error: - raise WorkerError("invalid_json", "stdin must be UTF-8 JSON", "stdin") from error - except json.JSONDecodeError as error: - raise WorkerError("invalid_json", f"stdin is not valid JSON: {error.msg}", "stdin") from error - response = run(raw_request, len(raw_bytes)) - sys.stdout.write(canonical_json(response) + "\n") - return 0 - except WorkerError as error: - sys.stdout.write(canonical_json(error_response(error)) + "\n") - return 1 - except Exception: - sys.stdout.write(canonical_json(error_response(WorkerError("internal_error", "worker failed internally"))) + "\n") - return 1 - - -if __name__ == "__main__": - raise SystemExit(main()) diff --git a/Sources/WeiBeiCore/AgentResources/skills/visualize/assets/visualize.css b/Sources/WeiBeiCore/AgentResources/skills/visualize/assets/visualize.css deleted file mode 100644 index 81626e4d7..000000000 --- a/Sources/WeiBeiCore/AgentResources/skills/visualize/assets/visualize.css +++ /dev/null @@ -1,867 +0,0 @@ -:root { - color-scheme: light dark; - background-color: var( - --background, - var(--color-background-primary, light-dark(rgb(255 255 255), rgb(24 24 24))) - ) !important; - - /* Agent-facing contract; keep in sync with SKILL.md. */ - --background: var( - --color-background-primary, - light-dark(rgb(255 255 255), rgb(24 24 24)) - ); - --foreground: var( - --color-text-primary, - light-dark(rgb(26 28 31), rgb(255 255 255)) - ); - --card: color-mix(in oklab, var(--foreground) 5%, var(--background)); - --card-foreground: var( - --color-text-primary, - light-dark(rgb(26 28 31), rgb(255 255 255)) - ); - --popover: var( - --color-background-secondary, - light-dark(rgb(255 255 255), rgb(45 45 45)) - ); - --popover-foreground: var( - --color-text-primary, - light-dark(rgb(26 28 31), rgb(255 255 255)) - ); - --primary: var( - --color-text-info, - light-dark(rgb(51 156 255), rgb(131 195 255)) - ); - --primary-foreground: var( - --color-text-inverse, - light-dark(rgb(255 255 255), rgb(13 13 13)) - ); - --secondary: var( - --color-background-secondary, - light-dark(rgb(255 255 255 / 96%), rgb(54 54 54 / 96%)) - ); - --secondary-foreground: var( - --color-text-primary, - light-dark(rgb(26 28 31), rgb(255 255 255)) - ); - --muted: color-mix(in srgb, var(--foreground) 10%, transparent); - --muted-foreground: var( - --color-text-secondary, - light-dark(rgb(26 28 31 / 49.4%), rgb(255 255 255 / 49.8%)) - ); - --accent: var( - --color-background-info, - light-dark(rgb(229 242 255), rgb(13 39 63)) - ); - --accent-foreground: var( - --color-text-info, - light-dark(rgb(51 156 255), rgb(131 195 255)) - ); - --destructive: var( - --color-text-warning, - light-dark(rgb(226 85 7), rgb(255 133 73)) - ); - --border: var( - --color-border-secondary, - light-dark(rgb(26 28 31 / 8%), rgb(255 255 255 / 8.2%)) - ); - --input: var( - --color-border-primary, - light-dark( - rgb(26 28 31 / 11.8%), - color-mix(in oklab, rgb(0 0 0) 10%, transparent) - ) - ); - --ring: var( - --color-ring-primary, - light-dark(rgb(51 156 255), rgb(131 195 255 / 76%)) - ); - --font-size-base: var(--font-text-md-size, 14px); - --blue: light-dark(rgb(51 156 255), rgb(51 156 255)); - --orange: light-dark(rgb(226 85 7), rgb(251 106 34)); - --green: light-dark(rgb(0 162 64), rgb(64 201 119)); - --red: light-dark(rgb(224 46 42), rgb(255 103 100)); - --purple: light-dark(rgb(146 79 247), rgb(173 123 249)); - --yellow: light-dark(rgb(255 195 0), rgb(255 210 64)); - --viz-series-1: var(--primary); - --viz-series-2: light-dark(rgb(243 136 59), rgb(245 154 86)); - --viz-series-3: light-dark(rgb(93 201 119), rgb(116 213 139)); - --viz-series-4: light-dark(rgb(235 119 177), rgb(240 143 192)); - --viz-series-5: light-dark(rgb(155 121 236), rgb(170 145 239)); - --viz-series-6: light-dark(rgb(58 185 177), rgb(90 203 194)); - - /* Internal implementation variables; not part of the agent contract. */ - --font-sans: -apple-system, system-ui, "Segoe UI", sans-serif; - --font-mono: - ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", - monospace; - --font-size-normal: max(11px, var(--font-size-base)); - --font-size-tooltip: calc(var(--font-size-base) - 1px); - --font-size-small: max(11px, calc(var(--font-size-base) - 2px)); - --font-size-h1: calc(var(--font-size-normal) * 1.7142857143); - --font-size-h2: calc(var(--font-size-normal) * 1.4285714286); - --font-size-h3: calc(var(--font-size-normal) * 1.2857142857); - --font-weight-normal: 430; - --font-weight-medium: 500; - --line-height-normal: calc(var(--font-size-normal) * 1.5); - --line-height-tooltip: calc(var(--font-size-tooltip) * 1.4285714286); - --line-height-small: calc(var(--font-size-small) + 4px); - --radius: var(--border-radius-lg, 12.5px); - --radius-sm: calc(var(--radius) * 0.6); - --radius-md: calc(var(--radius) * 0.8); - --radius-lg: var(--radius); - --radius-2xl: calc(var(--radius) * 1.6); - --radius-full: 9999px; - --shadow-sm: 0 1px 2px -1px rgb(0 0 0 / 8%); - --checkmark-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 17 17'%3E%3Cpath d='M12.8961 3.64101C13.1297 3.41418 13.4984 3.37523 13.7779 3.56581C14.0571 3.75635 14.1554 4.11331 14.0299 4.41347L13.9615 4.53847L7.71151 13.7045C7.59411 13.8767 7.4063 13.9877 7.19881 14.0072C6.99136 14.0267 6.78564 13.9533 6.63826 13.806L2.88826 10.056L2.79842 9.9457C2.6192 9.67407 2.64927 9.30496 2.88826 9.06581C3.12738 8.82669 3.49647 8.79676 3.76815 8.97597L3.8785 9.06581L7.03084 12.2182L12.8053 3.74941L12.8961 3.64101Z'/%3E%3C/svg%3E"); - - /* Legacy aliases; not part of the current agent contract. */ - --viz-bg: transparent; - --viz-panel: var(--card); - --viz-border: var(--border); - --viz-text: var(--foreground); - --viz-muted: var(--muted-foreground); - --viz-accent: var(--primary); - --viz-accent-text: var(--primary-foreground); - --viz-accent-bg: var(--accent); - --viz-font-size: var(--font-size-base); - --viz-warning: var(--destructive); -} - -:root[data-theme="light"] { - color-scheme: light; -} - -:root[data-theme="dark"] { - color-scheme: dark; -} - -* { - box-sizing: border-box; -} - -html > body { - /* Preserve MCP aliases for older inline renderers without creating :root cycles. */ - --color-background-primary: var( - --background, - light-dark(rgb(255 255 255), rgb(24 24 24)) - ); - --color-text-primary: var( - --foreground, - light-dark(rgb(26 28 31), rgb(255 255 255)) - ); - --color-border-secondary: var( - --border, - light-dark(rgb(26 28 31 / 8%), rgb(255 255 255 / 8.2%)) - ); - - margin: 0; - padding: 5px; - color: var(--foreground); - background: transparent !important; - font-family: var(--font-sans); - font-size: var(--font-size-normal); - font-weight: var(--font-weight-normal); - line-height: var(--line-height-normal); -} - -a { - color: color-mix(in srgb, var(--viz-accent) 80%, var(--viz-text) 20%); - cursor: pointer; - font-weight: var(--font-weight-medium, 500); - text-decoration: none; - text-underline-offset: 2px; -} - -a:is(:hover, :focus-visible) { - text-decoration-line: underline; - text-decoration-style: dashed; - text-decoration-thickness: 0.5px; -} - -h1, -h2, -h3, -h4, -h5, -h6, -p { - margin-block: 0; -} - -h1 { - font-size: var(--font-size-h1); - font-weight: var(--font-weight-medium); - line-height: 1.25; -} - -h2 { - font-size: var(--font-size-h2); - font-weight: var(--font-weight-medium); - line-height: 1.25; -} - -h3, -h4, -h5, -h6 { - font-size: var(--font-size-h3); - font-weight: var(--font-weight-medium); - line-height: 1.3; -} - -b, -strong, -th { - font-weight: var(--font-weight-medium); -} - -code:not(pre code) { - display: inline; - padding: 1px 6px; - border-radius: var(--radius-sm); - corner-shape: superellipse(1.5); - background: var(--muted); - font-family: var(--font-mono); - font-size: 0.92em; - overflow-wrap: anywhere; - -webkit-box-decoration-break: clone; - box-decoration-break: clone; - word-break: break-word; -} - -.table-responsive { - width: 100%; - overflow-x: auto; - scrollbar-width: thin; -} - -.table { - width: 100%; - border-collapse: collapse; - color: var(--foreground); - font: inherit; - text-align: start; -} - -.table :is(th, td) { - padding-block: 10px; - padding-inline: 0 24px; - overflow-wrap: anywhere; - border-bottom: 1px solid var(--border); - text-align: start; - vertical-align: top; -} - -.table-responsive > .table :is(th, td) { - overflow-wrap: break-word; -} - -.table :is(th, td):last-child { - padding-inline-end: 0; -} - -.table :is(caption, thead th) { - font-weight: 600; -} - -.table thead th { - padding-block: 8px; - border-bottom-color: color-mix(in srgb, var(--foreground) 16%, transparent); -} - -.table tbody tr:last-child :is(th, td) { - border-bottom: 0; -} - -.table.table-sm :is(th, td) { - padding-block: 6px; -} - -.table.table-sm :is(th, td):not(:last-child) { - padding-inline-end: 16px; -} - -.table :is(.text-end, [align="right"]) { - text-align: end; - font-variant-numeric: tabular-nums; -} - -.table :is(.text-center, [align="center"]) { - text-align: center; -} - -.table .text-nowrap { - white-space: nowrap; -} - -#widget { - display: flex; - flex-direction: column; - gap: 12px; - width: 100%; - padding: 0; - background: transparent !important; -} - -.card { - min-width: 0; - padding: 12px; - overflow: hidden; - overflow-wrap: break-word; - border-radius: var(--radius-2xl); - corner-shape: superellipse(1.5); - color: var(--card-foreground); - background: var(--card); -} - -#widget > :not(.card) { - width: 100% !important; - max-width: none !important; - margin: 0 !important; - padding: 0 !important; - border: 0 !important; - border-radius: 0 !important; - background: transparent !important; - box-shadow: none !important; -} - -.tooltip { - position: fixed; - z-index: 50; - top: 0; - left: 0; - width: max-content; - max-width: min( - 20rem, - var(--tooltip-available-width, calc(100vw - 10px)), - calc(100vw - 10px) - ); - max-height: min( - var(--tooltip-available-height, calc(100vh - 10px)), - calc(100vh - 10px) - ); - padding: 4px 8px; - border: 1px solid var(--border); - border-radius: var(--radius-lg); - corner-shape: superellipse(1.5); - color: var(--popover-foreground); - background: var(--popover); - box-shadow: none; - font-size: var(--font-size-tooltip); - line-height: var(--line-height-tooltip); - overflow-wrap: break-word; - white-space: normal; - pointer-events: none; - user-select: none; -} - -.viz-grid { - display: grid; - grid-template-columns: repeat(auto-fit, minmax(max(180px, 24%), 1fr)); - gap: 10px; -} - -.viz-stat { - display: flex; - flex-direction: column; - gap: 2px; -} - -.viz-stat-value { - font-size: var(--font-size-h2); - font-weight: var(--font-weight-medium); - line-height: 1.25; -} - -.viz-row { - display: flex; - flex-wrap: wrap; - align-items: center; - gap: 10px; -} - -.viz-badge { - padding: 3px 8px; - border-radius: var(--radius-full); - color: var(--accent-foreground); - background: var(--accent); - font-weight: var(--font-weight-medium); -} - -small, -.text-small, -.viz-badge { - font-size: var(--font-size-small); - line-height: var(--line-height-small); -} - -.text-muted { - color: var(--muted-foreground); -} - -.sr-only { - position: absolute; - width: 1px; - height: 1px; - padding: 0; - overflow: hidden; - clip: rect(0, 0, 0, 0); - white-space: nowrap; - border: 0; -} - -.viz-controls { - display: flex; - flex-wrap: wrap; - align-items: center; - gap: 8px; -} - -.viz-controls > .form-label { - display: grid; - min-width: min(100%, 260px); - flex: 1 1 280px; - grid-template-columns: minmax(0, 1fr) auto; - align-items: baseline; - gap: 2px 12px; - margin-bottom: 0; -} - -.viz-controls > .form-label > :is(.form-control, .form-range, .form-select) { - grid-column: 1 / -1; -} - -.btn, -.form-check-input, -.form-control, -.form-range, -.form-select { - font: inherit; -} - -.btn { - appearance: button; - display: inline-flex; - inline-size: fit-content; - max-inline-size: 100%; - min-height: 28px; - align-items: center; - justify-content: center; - gap: 4px; - margin: 0; - padding: 0 8px; - -webkit-app-region: no-drag; - border: 1px solid var(--input); - border-radius: var(--radius-lg); - corner-shape: superellipse(1.5); - color: var(--secondary-foreground); - background: var(--secondary); - cursor: var(--cursor-interaction, pointer); - text-align: center; - text-decoration: none; - white-space: nowrap; - user-select: none; - -webkit-font-smoothing: antialiased; -} - -.btn:is(.btn-block, .viz-tile) { - inline-size: 100%; -} - -.btn.viz-tile { - min-width: 0; - overflow-wrap: anywhere; - white-space: normal; -} - -a.btn { - cursor: pointer; - text-decoration: none; -} - -.btn:not(:disabled):hover { - background: color-mix(in srgb, var(--foreground) 6%, var(--secondary)); -} - -.btn-primary { - border-color: transparent; - color: var(--primary-foreground); - background: var(--foreground); - background-clip: padding-box; -} - -.btn-primary .text-muted { - color: color-mix(in srgb, var(--primary-foreground) 50%, transparent); -} - -.btn-primary:not(:disabled):hover { - background: color-mix(in srgb, var(--foreground) 80%, transparent); - background-clip: padding-box; -} - -.btn-ghost { - border-color: transparent; - color: var(--muted-foreground); - background: transparent; -} - -.btn-ghost:not(:disabled):hover { - color: var(--foreground); - background: color-mix(in srgb, var(--foreground) 6%, var(--secondary)); -} - -.btn:disabled { - cursor: not-allowed; - opacity: 0.4; -} - -[data-lucide] { - stroke-width: 1.6; -} - -.form-label { - display: block; - margin-bottom: 6px; - color: var(--foreground); -} - -.form-control { - display: block; - width: 100%; - min-height: 28px; - padding: 0 8px; - outline: none; - border: 1px solid var(--input); - border-radius: var(--radius-lg); - corner-shape: superellipse(1.5); - color: var(--foreground); - background: var(--secondary); -} - -.form-control::placeholder { - color: var(--muted-foreground); -} - -.form-control[type="file"] { - padding: 0; - overflow: hidden; - cursor: var(--cursor-interaction, pointer); -} - -.form-control[type="file"]::file-selector-button { - min-height: 26px; - margin-right: 8px; - padding: 0 8px; - border: 0; - border-right: 1px solid var(--input); - color: var(--secondary-foreground); - background: var(--secondary); - cursor: inherit; - font: inherit; -} - -.form-control[type="file"]:not(:disabled):hover::file-selector-button { - background: color-mix(in srgb, var(--foreground) 6%, var(--secondary)); -} - -.form-control-color[type="color"] { - width: 40px; - height: 28px; - padding: 3px; - cursor: var(--cursor-interaction, pointer); -} - -.form-control-color[type="color"]::-webkit-color-swatch-wrapper { - padding: 0; -} - -.form-control-color[type="color"]::-webkit-color-swatch { - border: 0; - border-radius: calc(var(--radius-lg) - 4px); - corner-shape: superellipse(1.5); -} - -textarea.form-control { - height: auto; - min-height: 72px; - padding: 8px 10px; - resize: vertical; -} - -.form-control:focus-visible { - border-color: var(--ring); - box-shadow: inset 0 0 0 1px var(--ring); -} - -.form-control:disabled, -.form-select:disabled { - cursor: not-allowed; - opacity: 0.4; -} - -.form-select { - appearance: none; - display: block; - width: 100%; - min-height: 28px; - margin: 0; - padding: 0 32px 0 8px; - outline: none; - border: 1px solid var(--input); - border-radius: var(--radius-lg); - corner-shape: superellipse(1.5); - color: var(--foreground); - background-color: var(--secondary); - background-image: - linear-gradient(45deg, transparent 50%, var(--muted-foreground) 50%), - linear-gradient(135deg, var(--muted-foreground) 50%, transparent 50%); - background-position: - calc(100% - 14px) 50%, - calc(100% - 10px) 50%; - background-repeat: no-repeat; - background-size: 4px 4px; - cursor: var(--cursor-interaction, default); -} - -.form-select:not(:disabled):hover { - background-color: color-mix(in srgb, var(--foreground) 6%, var(--secondary)); -} - -.form-select:focus-visible { - border-color: var(--ring); - box-shadow: inset 0 0 0 1px var(--ring); -} - -.form-check { - display: flex; - min-height: 20px; - align-items: center; - gap: 6px; -} - -.form-check-input { - appearance: none; - width: 14px; - height: 14px; - flex: 0 0 auto; - margin: 0; - border: 1px solid var(--input); - color: var(--primary-foreground); - background-color: transparent; - cursor: var(--cursor-interaction, default); - transition: - background-color 150ms, - border-color 150ms, - box-shadow 150ms; -} - -.form-check:not(.form-switch) .form-check-input[type="checkbox"] { - border-color: var(--input); - border-radius: var(--radius-sm); - corner-shape: superellipse(1.5); - background-color: var(--secondary); - box-shadow: var(--shadow-sm); -} - -.form-check:not(.form-switch) - .form-check-input:not(:disabled):not(:checked):hover { - background-color: var(--card); -} - -.form-check:not(.form-switch) .form-check-input[type="checkbox"]:checked { - border-color: var(--primary); - background-color: var(--primary); -} - -.form-check:not(.form-switch) - .form-check-input[type="checkbox"]:checked::before { - display: block; - width: 100%; - height: 100%; - background: var(--primary-foreground); - content: ""; - mask: var(--checkmark-image) center / 12px 12px no-repeat; -} - -.form-check-input[type="radio"] { - width: 14px; - height: 14px; - border-radius: var(--radius-full); -} - -.form-check-input[type="radio"]:checked { - border: 2px solid var(--primary); - background: - radial-gradient(circle, var(--primary-foreground) 0 2.5px, transparent 3px), - var(--primary); -} - -.form-check:not(.form-switch) .form-check-input:focus-visible { - outline: 2px solid var(--ring); - outline-offset: 2px; -} - -.form-check:not(.form-switch) .form-check-input:disabled { - cursor: not-allowed; - pointer-events: none; -} - -.form-check:not(.form-switch) .form-check-input:disabled + .form-check-label { - cursor: not-allowed; -} - -.form-switch .form-check-input:disabled, -.form-switch .form-check-input:disabled + .form-check-label { - cursor: not-allowed; - opacity: 0.6; -} - -.form-check-label { - color: var(--foreground); - cursor: var(--cursor-interaction, default); -} - -.form-switch .form-check-input { - position: relative; - width: 32px; - height: 20px; - border: 0; - border-radius: var(--radius-full); - background: var(--muted); - box-shadow: none; - transition: background-color 200ms cubic-bezier(0, 0, 0.2, 1); -} - -.form-switch .form-check-input::before { - position: absolute; - top: 50%; - left: 0; - width: 16px; - height: 16px; - box-sizing: border-box; - border: 1px solid light-dark(var(--primary-foreground), var(--foreground)); - border-radius: var(--radius-full); - background: light-dark(var(--primary-foreground), var(--foreground)); - box-shadow: var(--shadow-sm); - content: ""; - transform: translate(2px, -50%); - transition: transform 200ms cubic-bezier(0, 0, 0.2, 1); -} - -.form-switch .form-check-input:checked { - background: var(--primary); -} - -.form-switch .form-check-input:checked::before { - transform: translate(14px, -50%); -} - -.form-switch .form-check-input:focus-visible { - box-shadow: 0 0 0 2px var(--ring); -} - -.form-range { - appearance: none; - display: block; - width: 100%; - height: 28px; - flex: 1; - margin: 0; - padding: 0; - outline: none; - border: 0; - accent-color: var(--primary); - background: linear-gradient( - color-mix(in srgb, var(--foreground) 7%, transparent), - color-mix(in srgb, var(--foreground) 7%, transparent) - ) - center / 100% 2px no-repeat; -} - -.form-range::-webkit-slider-runnable-track { - height: 28px; - background: transparent; -} - -.form-range::-webkit-slider-thumb { - appearance: none; - width: 20px; - height: 20px; - margin-top: 4px; - border: 1px solid var(--border); - border-radius: var(--radius-full); - background: light-dark(var(--primary-foreground), var(--foreground)); -} - -.form-range:focus-visible::-webkit-slider-thumb { - border-color: var(--ring); - box-shadow: inset 0 0 0 1px var(--ring); -} - -.form-range::-moz-range-track { - height: 28px; - background: transparent; -} - -.form-range::-moz-range-thumb { - width: 20px; - height: 20px; - border: 1px solid var(--border); - border-radius: var(--radius-full); - background: light-dark(var(--primary-foreground), var(--foreground)); -} - -.form-range:focus-visible::-moz-range-thumb { - border-color: var(--ring); - box-shadow: inset 0 0 0 1px var(--ring); -} - -.form-range:disabled { - cursor: not-allowed; - opacity: 0.4; -} - -.btn:not(.btn-primary, .viz-tile):is( - [aria-pressed="true"], - [aria-selected="true"], - .is-selected - ) { - border-color: var(--primary); - color: var(--primary-foreground); - background: var(--primary); -} - -.btn.viz-tile:is([aria-pressed="true"], [aria-selected="true"], .is-selected) { - border-color: var(--primary); - box-shadow: inset 0 0 0 1px var(--primary); -} - -.btn:focus-visible { - outline: 2px solid var(--ring); - outline-offset: 2px; -} - -svg { - display: block; - max-width: 100%; - height: auto; -} - -#widget > svg { - width: 100%; -} - -/* Model-authored chart rules can otherwise stretch icons after these styles load. */ -svg.lucide { - display: block; - width: 16px !important; - height: 16px !important; - flex: none; - margin: 0 !important; - stroke-width: 1.6; -} - -.text-warning, -.text-destructive { - color: var(--destructive); -} diff --git a/Sources/WeiBeiCore/AgentResources/skills/visualize/assets/visualize.html b/Sources/WeiBeiCore/AgentResources/skills/visualize/assets/visualize.html deleted file mode 100644 index 01ef40532..000000000 --- a/Sources/WeiBeiCore/AgentResources/skills/visualize/assets/visualize.html +++ /dev/null @@ -1,239 +0,0 @@ - - - - - - diff --git a/Sources/WeiBeiSelfCheck/main.swift b/Sources/WeiBeiSelfCheck/main.swift index 238162037..26868da38 100644 --- a/Sources/WeiBeiSelfCheck/main.swift +++ b/Sources/WeiBeiSelfCheck/main.swift @@ -263,6 +263,37 @@ expect(clearBreezeStats.width == 856 && clearBreezeStats.height == 132 && clearBreezeStats.opaqueWhite == 0 && universeStats.opaqueWhite == 0 && clearBreezeStats.outerInk == 0 && universeStats.outerInk == 0, "bundled Lanting calligraphy masks are transparent, uncropped, and free of hard white backgrounds") +// SPM `.process` flattens Resources into the bundle root, so any subdirectory under +// Editor/ silently breaks url("./...") references in editor.css (the 2026-08 KaTeX +// font 404: fonts were emitted under fonts/ while the css resolved ./fonts/...). +let editorResourcesURL = URL(fileURLWithPath: FileManager.default.currentDirectoryPath) + .appendingPathComponent("Sources/WeiBei/Resources/Editor", isDirectory: true) +let editorEntries = try FileManager.default.contentsOfDirectory( + at: editorResourcesURL, + includingPropertiesForKeys: [.isDirectoryKey] +) +let editorSubdirectories = editorEntries.filter { + (try? $0.resourceValues(forKeys: [.isDirectoryKey]).isDirectory) == true +} +expect(editorSubdirectories.isEmpty, "editor assets stay flat: no subdirectories under Resources/Editor") +let editorCSS = try String(contentsOf: editorResourcesURL.appendingPathComponent("editor.css"), encoding: .utf8) +if let cssURLRegex = try? NSRegularExpression(pattern: #"url\(\"?\.\/([^)"]+)"?\)"#) { + let matches = cssURLRegex.matches( + in: editorCSS, + range: NSRange(editorCSS.startIndex..., in: editorCSS) + ) + let referencedNames = matches.compactMap { match -> String? in + guard let range = Range(match.range(at: 1), in: editorCSS) else { return nil } + return String(editorCSS[range]) + } + let missing = referencedNames.filter { + !FileManager.default.fileExists(atPath: editorResourcesURL.appendingPathComponent($0).path) + } + expect(!referencedNames.isEmpty && missing.isEmpty, "every relative url() in editor.css resolves next to the css file") +} else { + expect(false, "editor css url regex compiles") +} + expect(StudyItemKind.detect(from: URL(fileURLWithPath: "/tmp/a.pdf")) == .pdf, "pdf detection") expect(StudyItemKind.detect(from: URL(fileURLWithPath: "/tmp/a.html")) == .html, "html detection") diff --git a/design-qa.md b/design-qa.md deleted file mode 100644 index 3e1fe3ca3..000000000 --- a/design-qa.md +++ /dev/null @@ -1,82 +0,0 @@ -# Content Rail Design QA - -- Source visual truth: `/var/folders/yp/wx87z0l97wj89_yj8nw7_ptm0000gn/T/codex-clipboard-f9bffc1d-eecd-440f-9c92-ed91b8df9cc3.png` -- Light implementation screenshot: `/private/tmp/weibei-wave-qa-351.png` -- Dark implementation screenshot: `/private/tmp/weibei-wave-dark-qa-352.png` -- Focused comparison: `/private/tmp/weibei-content-rail-comparison-final.png` -- Viewport: 2560 x 1640 app capture; focused comparison normalized to 536 x 310 per side -- State: second rail item hovered, preview visible, dark appearance - -## Full-view comparison evidence - -The rail remains a floating overlay and does not reserve document width. The preview opens to the right of the wave, stays inside the pane, and leaves the reading surface usable. Light and dark captures show no overflow or clipping. - -## Focused comparison evidence - -The reference rail measures 13, 22, 31, 44, 57, 44, 31, 22, 13 pixels around its peak. The implemented four-item sample measures 44, 56, 43, 30 pixels for the available distances, within one pixel of the corresponding reference values. Both use a fixed left edge and rightward growth. - -## Required fidelity surfaces - -- Fonts and typography: existing WeiBei typography is preserved; the change does not alter type. -- Spacing and layout rhythm: peak reduced from 34 to 28 points; neighbors follow 0.70, 0.41, and 0.20 distance weights; preview begins eight points after the peak and gains up to 24 points of width. -- Colors and visual tokens: hovered tick uses semantic cinnabar in both appearances; unselected ticks retain the existing mode-aware gray. -- Image quality and asset fidelity: no image assets were added or modified. -- Copy and content: preview continues to use real document title, excerpt, metadata, and page or section count. - -## Comparison history - -1. P1: the previous peak measured 69 pixels and every neighbor stayed at 15 pixels. Fixed by reducing the peak and adding four-step distance weights. -2. P1: the first dark capture used the pale on-cinnabar foreground for the hovered tick. Fixed by using cinnabar itself in both appearances. The final dark capture shows the selected rail in red. -3. P1: the full-width transparent rail overlay exposed background window dragging at pane borders in non-fullscreen windows. Fixed by restoring the rail's 40-point hit surface while passing pane width as layout data only. `/private/tmp/weibei-divider-qa-401.png` confirms the overflow preview still renders with the narrow hit surface. -4. P1: the pane previously snapped to an 88-point rail-only shell even though the dormant rail itself is 40 points, and widths between the rail threshold and the old 220-point preview minimum could suppress the preview entirely. The rail-only state now equals the 40-point dormant surface, widths below 190 points resolve to that state, compact text previews fit from 190 points, and hover opens immediately instead of racing a delayed work item. - -## Findings - -No actionable P0, P1, or P2 differences remain. The preview-to-peak gap is six pixels tighter than the reference, an intentional P3 trade-off that gives the preview more usable width. - -## Implementation checklist - -- Run Swift build and both project checks. -- Confirm one-click navigation remains unchanged. -- Package and open a non-activating isolated preview. - -final result: passed - ---- - -# Empty Workspace Design QA: Inspiration Disabled - -- Reference: `/var/folders/yp/wx87z0l97wj89_yj8nw7_ptm0000gn/T/codex-clipboard-a2fc8532-c763-4611-aeef-eb42bcab300d.png` -- Implementation capture: `/var/folders/yp/wx87z0l97wj89_yj8nw7_ptm0000gn/T/weibei-visual-verify-empty-workspace-inspiration-off.png` -- Side-by-side comparison: `/private/tmp/weibei-empty-off-reference-comparison.png` -- Comparison viewport: 1180 x 760 points, 2360 x 1520 pixels -- State: light appearance, all work panes closed, daily inspiration disabled - -## Comparison - -- The greeting and `DOC | CHAT | NOTES` form one centered cluster. -- The cluster's horizontal center, greeting baseline, entry baseline, and vertical gap match the reference at the same viewport. -- Disabling inspiration removes the entire lower inspiration surface instead of reserving an invisible slot. -- Existing WeiBei hairlines and hover affordances remain; no new visual language or asset was introduced. -- The three work entries remain interactive and continue to use the existing pane toggles. - -## Findings - -- P0: none -- P1: none -- P2: none -- P3: the runtime greeting differs from the reference because it follows the actual time of day; this is expected behavior. - -final result: passed -### 2026-07-11:收起轨道缩至真实休眠尺寸 - -- 休眠轨道从 40pt 缩至 28pt,磁吸区同步收窄为最后 10pt,减少对阅读面积的占用。 -- 点击轨道节点时,恢复宽度限制在 300–380pt;没有可用历史宽度时使用 340pt,避免恢复成过宽或过窄面板。 -- 历史宽度只在舒适区内原样恢复,超出区间时取最近边界;内容、选区与滚动位置仍沿用原有状态。 - -### 2026-07-11:收起轨道改为末端吸附并保留简介 - -- 分栏不再在 190pt 自动收起;用户拖到 53pt 以上时保留其实际宽度。 -- 仅最后 12pt(40–52pt)作为可感知的磁吸区,松手后收成 40pt 轨道。 -- 40pt 收起态悬浮仍显示 280pt 简介浮层;浮层越过分栏边界但不改宽、不抢焦点,点击沿用原有“恢复并跳转”行为。 -- 新增 `content-rail-dormant-preview` 隔离验收场景,真实截图确认轨道、简介与相邻分栏无裁切或挤压。 diff --git a/script/build_editor.mjs b/script/build_editor.mjs index 806db07e5..8bf3105c3 100644 --- a/script/build_editor.mjs +++ b/script/build_editor.mjs @@ -38,7 +38,8 @@ const [editorMeta, viewerMeta] = await Promise.all([ build({ entryPoints: [resolve(root, 'node_modules/katex/dist/katex.css')], bundle: true, minify: true, outfile: resolve(output, 'editor.css'), loader: { '.woff': 'file', '.woff2': 'file', '.ttf': 'file' }, - assetNames: 'fonts/[name]', logLevel: 'warning', + // SPM .process 会把 bundle 内目录拍平;字体平铺输出 + css 同级相对路径才能在拍平后仍可解析。 + assetNames: '[name]', logLevel: 'warning', }), ]);