From 25ed0c83801e90b6b76fb9ffab4be9be40ebeedc Mon Sep 17 00:00:00 2001 From: EmberKnight Date: Sat, 1 Aug 2026 16:09:16 +0800 Subject: [PATCH] feat: add DocForge documentation authoring tool --- .gitignore | 7 +- tools/docforge/.gitignore | 3 + tools/docforge/Cargo.lock | 5118 +++++++++++++++++++++++++++++ tools/docforge/Cargo.toml | 32 + tools/docforge/README.zh-CN.txt | 117 + tools/docforge/fonts/README.txt | 10 + tools/docforge/package.ps1 | 67 + tools/docforge/src/annotation.rs | 327 ++ tools/docforge/src/app.rs | 2418 ++++++++++++++ tools/docforge/src/atomic.rs | 154 + tools/docforge/src/main.rs | 133 + tools/docforge/src/markdown.rs | 437 +++ tools/docforge/src/pdf.rs | 422 +++ tools/docforge/src/site.rs | 293 ++ tools/docforge/src/translation.rs | 160 + tools/docforge/src/tutorial.rs | 111 + tools/docforge/src/video.rs | 274 ++ 17 files changed, 10082 insertions(+), 1 deletion(-) create mode 100644 tools/docforge/.gitignore create mode 100644 tools/docforge/Cargo.lock create mode 100644 tools/docforge/Cargo.toml create mode 100644 tools/docforge/README.zh-CN.txt create mode 100644 tools/docforge/fonts/README.txt create mode 100644 tools/docforge/package.ps1 create mode 100644 tools/docforge/src/annotation.rs create mode 100644 tools/docforge/src/app.rs create mode 100644 tools/docforge/src/atomic.rs create mode 100644 tools/docforge/src/main.rs create mode 100644 tools/docforge/src/markdown.rs create mode 100644 tools/docforge/src/pdf.rs create mode 100644 tools/docforge/src/site.rs create mode 100644 tools/docforge/src/translation.rs create mode 100644 tools/docforge/src/tutorial.rs create mode 100644 tools/docforge/src/video.rs diff --git a/.gitignore b/.gitignore index 46b8ff7..4edaad6 100644 --- a/.gitignore +++ b/.gitignore @@ -13,4 +13,9 @@ yarn-error.log* .idea .DS_Store .vitepress/cache -.vitepress/dist \ No newline at end of file +.vitepress/dist + +# DocForge keeps all Rust caches and generated portable packages local. +/tools/docforge/target/ +/tools/docforge/tmp/ +/tools/docforge/out/ diff --git a/tools/docforge/.gitignore b/tools/docforge/.gitignore new file mode 100644 index 0000000..2befbf1 --- /dev/null +++ b/tools/docforge/.gitignore @@ -0,0 +1,3 @@ +/target/ +/out/ +/tmp/ diff --git a/tools/docforge/Cargo.lock b/tools/docforge/Cargo.lock new file mode 100644 index 0000000..f3e55d4 --- /dev/null +++ b/tools/docforge/Cargo.lock @@ -0,0 +1,5118 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +version = 4 + +[[package]] +name = "ab_glyph" +version = "0.2.32" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "01c0457472c38ea5bd1c3b5ada5e368271cb550be7a4ca4a0b4634e9913f6cc2" +dependencies = [ + "ab_glyph_rasterizer", + "owned_ttf_parser 0.25.1", +] + +[[package]] +name = "ab_glyph_rasterizer" +version = "0.1.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "366ffbaa4442f4684d91e2cd7c5ea7c4ed8add41959a31447066e279e432b618" + +[[package]] +name = "adler2" +version = "2.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "320119579fcad9c21884f5c4861d16174d0e06250625266f50fe6898340abefa" + +[[package]] +name = "adobe-cmap-parser" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ae8abfa9a4688de8fc9f42b3f013b6fffec18ed8a554f5f113577e0b9b3212a3" +dependencies = [ + "pom 1.1.0", +] + +[[package]] +name = "ahash" +version = "0.8.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5a15f179cd60c4584b8a8c596927aadc462e27f2ca70c04e0071964a73ba7a75" +dependencies = [ + "cfg-if", + "once_cell", + "version_check", + "zerocopy", +] + +[[package]] +name = "aligned" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ee4508988c62edf04abd8d92897fca0c2995d907ce1dfeaf369dac3716a40685" +dependencies = [ + "as-slice", +] + +[[package]] +name = "aligned-vec" +version = "0.6.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dc890384c8602f339876ded803c97ad529f3842aba97f6392b3dba0dd171769b" +dependencies = [ + "equator", +] + +[[package]] +name = "android-activity" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0f2a1bb052857d5dd49572219344a7332b31b76405648eabac5bc68978251bcd" +dependencies = [ + "android-properties", + "bitflags 2.13.1", + "cc", + "jni", + "libc", + "log", + "ndk", + "ndk-context", + "ndk-sys", + "num_enum", + "thiserror 2.0.19", +] + +[[package]] +name = "android-properties" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fc7eb209b1518d6bb87b283c20095f5228ecda460da70b44f0802523dea6da04" + +[[package]] +name = "android_system_properties" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "819e7219dbd41043ac279b19830f2efc897156490d7fd6ea916720117ee66311" +dependencies = [ + "libc", +] + +[[package]] +name = "anstream" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "824a212faf96e9acacdbd09febd34438f8f711fb84e09a8916013cd7815ca28d" +dependencies = [ + "anstyle", + "anstyle-parse", + "anstyle-query", + "anstyle-wincon", + "colorchoice", + "is_terminal_polyfill", + "utf8parse", +] + +[[package]] +name = "anstyle" +version = "1.0.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "940b3a0ca603d1eade50a4846a2afffd5ef57a9feac2c0e2ec2e14f9ead76000" + +[[package]] +name = "anstyle-parse" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "52ce7f38b242319f7cabaa6813055467063ecdc9d355bbb4ce0c68908cd8130e" +dependencies = [ + "utf8parse", +] + +[[package]] +name = "anstyle-query" +version = "1.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "40c48f72fd53cd289104fc64099abca73db4166ad86ea0b4341abe65af83dadc" +dependencies = [ + "windows-sys 0.61.2", +] + +[[package]] +name = "anstyle-wincon" +version = "3.0.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "291e6a250ff86cd4a820112fb8898808a366d8f9f58ce16d1f538353ad55747d" +dependencies = [ + "anstyle", + "once_cell_polyfill", + "windows-sys 0.61.2", +] + +[[package]] +name = "anyhow" +version = "1.0.104" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "330a5ed07fa54e4702c9d6c4174f74427fc0ef6e214bbd677ae50a5099946470" + +[[package]] +name = "approx" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cab112f0a86d568ea0e627cc1d6be74a1e9cd55214684db5561995f6dad897c6" +dependencies = [ + "num-traits", +] + +[[package]] +name = "arbitrary" +version = "1.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c3d036a3c4ab069c7b410a2ce876bd74808d2d0888a82667669f8e783a898bf1" + +[[package]] +name = "arboard" +version = "3.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0348a1c054491f4bfe6ab86a7b6ab1e44e45d899005de92f58b3df180b36ddaf" +dependencies = [ + "clipboard-win", + "image", + "log", + "objc2 0.6.4", + "objc2-app-kit 0.3.2", + "objc2-core-foundation", + "objc2-core-graphics", + "objc2-foundation 0.3.2", + "parking_lot", + "percent-encoding", + "windows-sys 0.60.2", + "x11rb", +] + +[[package]] +name = "arg_enum_proc_macro" +version = "0.3.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0ae92a5119aa49cdbcf6b9f893fe4e1d98b04ccbf82ee0584ad948a44a734dea" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.119", +] + +[[package]] +name = "arrayvec" +version = "0.7.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3fb67a6e08acf24fdeccbac2cb6ac4305825bd1f117462e0e6f2f193345ad56" + +[[package]] +name = "as-slice" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "516b6b4f0e40d50dcda9365d53964ec74560ad4284da2e7fc97122cd83174516" +dependencies = [ + "stable_deref_trait", +] + +[[package]] +name = "ashpd" +version = "0.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d2f3f79755c74fd155000314eb349864caa787c6592eace6c6882dad873d9c39" +dependencies = [ + "async-fs", + "async-net", + "enumflags2", + "futures-channel", + "futures-util", + "rand 0.9.5", + "raw-window-handle", + "serde", + "serde_repr", + "url", + "wayland-backend", + "wayland-client", + "wayland-protocols", + "zbus", +] + +[[package]] +name = "async-broadcast" +version = "0.7.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "435a87a52755b8f27fcf321ac4f04b2802e337c8c4872923137471ec39c37532" +dependencies = [ + "event-listener", + "event-listener-strategy", + "futures-core", + "pin-project-lite", +] + +[[package]] +name = "async-channel" +version = "2.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "924ed96dd52d1b75e9c1a3e6275715fd320f5f9439fb5a4a11fa51f4221158d2" +dependencies = [ + "concurrent-queue", + "event-listener-strategy", + "futures-core", + "pin-project-lite", +] + +[[package]] +name = "async-executor" +version = "1.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c96bf972d85afc50bf5ab8fe2d54d1586b4e0b46c97c50a0c9e71e2f7bcd812a" +dependencies = [ + "async-task", + "concurrent-queue", + "fastrand", + "futures-lite", + "pin-project-lite", + "slab", +] + +[[package]] +name = "async-fs" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8034a681df4aed8b8edbd7fbe472401ecf009251c8b40556b304567052e294c5" +dependencies = [ + "async-lock", + "blocking", + "futures-lite", +] + +[[package]] +name = "async-io" +version = "2.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "456b8a8feb6f42d237746d4b3e9a178494627745c3c56c6ea55d92ba50d026fc" +dependencies = [ + "autocfg", + "cfg-if", + "concurrent-queue", + "futures-io", + "futures-lite", + "parking", + "polling", + "rustix 1.1.4", + "slab", + "windows-sys 0.61.2", +] + +[[package]] +name = "async-lock" +version = "3.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "290f7f2596bd5b78a9fec8088ccd89180d7f9f55b94b0576823bbbdc72ee8311" +dependencies = [ + "event-listener", + "event-listener-strategy", + "pin-project-lite", +] + +[[package]] +name = "async-net" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b948000fad4873c1c9339d60f2623323a0cfd3816e5181033c6a5cb68b2accf7" +dependencies = [ + "async-io", + "blocking", + "futures-lite", +] + +[[package]] +name = "async-process" +version = "2.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fc50921ec0055cdd8a16de48773bfeec5c972598674347252c0399676be7da75" +dependencies = [ + "async-channel", + "async-io", + "async-lock", + "async-signal", + "async-task", + "blocking", + "cfg-if", + "event-listener", + "futures-lite", + "rustix 1.1.4", +] + +[[package]] +name = "async-recursion" +version = "1.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3b43422f69d8ff38f95f1b2bb76517c91589a924d1559a0e935d7c8ce0274c11" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.119", +] + +[[package]] +name = "async-signal" +version = "0.2.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "52b5aaafa020cf5053a01f2a60e8ff5dccf550f0f77ec54a4e47285ac2bab485" +dependencies = [ + "async-io", + "async-lock", + "atomic-waker", + "cfg-if", + "futures-core", + "futures-io", + "rustix 1.1.4", + "signal-hook-registry", + "slab", + "windows-sys 0.61.2", +] + +[[package]] +name = "async-task" +version = "4.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8b75356056920673b02621b35afd0f7dda9306d03c79a30f5c56c44cf256e3de" + +[[package]] +name = "async-trait" +version = "0.1.91" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ae36dc4177970ef04fde5178d3e2429882def40e57a451f919c098f72baa6cec" +dependencies = [ + "proc-macro2", + "quote", + "syn 3.0.3", +] + +[[package]] +name = "atomic-waker" +version = "1.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1505bd5d3d116872e7271a6d4e16d81d0c8570876c8de68093a09ac269d8aac0" + +[[package]] +name = "autocfg" +version = "1.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f2032f911046de80f0a198e0901378627c33f59ea0ac00e363d481118bd70a53" + +[[package]] +name = "av-scenechange" +version = "0.14.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0f321d77c20e19b92c39e7471cf986812cbb46659d2af674adc4331ef3f18394" +dependencies = [ + "aligned", + "anyhow", + "arg_enum_proc_macro", + "arrayvec", + "log", + "num-rational", + "num-traits", + "pastey", + "rayon", + "thiserror 2.0.19", + "v_frame", + "y4m", +] + +[[package]] +name = "av1-grain" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8cfddb07216410377231960af4fcab838eaa12e013417781b78bd95ee22077f8" +dependencies = [ + "anyhow", + "arrayvec", + "log", + "nom 8.0.0", + "num-rational", + "v_frame", +] + +[[package]] +name = "avif-serialize" +version = "0.8.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e7178fe5f7d460b13895ebb9dcb28a3a6216d2df2574a0806cb51b555d297f38" +dependencies = [ + "arrayvec", +] + +[[package]] +name = "base64" +version = "0.22.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "72b3254f16251a8381aa12e40e3c4d2f0199f8c6508fbecb9d91f575e0fbb8c6" + +[[package]] +name = "bit_field" +version = "0.10.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e4b40c7323adcfc0a41c4b88143ed58346ff65a288fc144329c5c45e05d70c6" + +[[package]] +name = "bitflags" +version = "1.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" + +[[package]] +name = "bitflags" +version = "2.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b588b76d00fde79687d7646a9b5bdf3cc0f655e0bbd080335a95d7e96f3587da" + +[[package]] +name = "bitstream-io" +version = "4.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7eff00be299a18769011411c9def0d827e8f2d7bf0c3dbf53633147a8867fd1f" +dependencies = [ + "no_std_io2", +] + +[[package]] +name = "block-buffer" +version = "0.10.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3078c7629b62d3f0439517fa394996acacc5cbc91c5a20d8c658e77abd503a71" +dependencies = [ + "generic-array", +] + +[[package]] +name = "block2" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2c132eebf10f5cad5289222520a4a058514204aed6d791f1cf4fe8088b82d15f" +dependencies = [ + "objc2 0.5.2", +] + +[[package]] +name = "block2" +version = "0.6.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cdeb9d870516001442e364c5220d3574d2da8dc765554b4a617230d33fa58ef5" +dependencies = [ + "objc2 0.6.4", +] + +[[package]] +name = "blocking" +version = "1.6.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e83f8d02be6967315521be875afa792a316e28d57b5a2d401897e2a7921b7f21" +dependencies = [ + "async-channel", + "async-task", + "futures-io", + "futures-lite", + "piper", +] + +[[package]] +name = "bstr" +version = "1.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1f7dc094d718f2e1c1559ad110e27eeaae14a5465d3d56dd6dbd793079fbd530" +dependencies = [ + "memchr", + "regex-automata", + "serde_core", +] + +[[package]] +name = "built" +version = "0.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5c0e531d93d39c34eef561e929e8a7f86d77a5af08aac4f6d6e39976c51858e9" + +[[package]] +name = "bumpalo" +version = "3.20.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "72f5acc6cb2ba439de613abc23857ec3d78374d8ed5ac84e9d11336e87da8649" + +[[package]] +name = "bytemuck" +version = "1.25.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "95832e849adfb21180ccb6826a99da14e5d266ae5c2e668e1602cf234f153797" +dependencies = [ + "bytemuck_derive", +] + +[[package]] +name = "bytemuck_derive" +version = "1.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f65693059b6b9c588b9f62fed1cedbf0a8b805631457ea162d68f0de186f3de5" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.119", +] + +[[package]] +name = "byteorder-lite" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8f1fe948ff07f4bd06c30984e69f5b4899c516a3ef74f34df92a2df2ab535495" + +[[package]] +name = "bytes" +version = "1.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fc652a48c352aef3ea3aed32080501cf3ef6ed5da78602a020c991775b0aff04" + +[[package]] +name = "calloop" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b99da2f8558ca23c71f4fd15dc57c906239752dd27ff3c00a1d56b685b7cbfec" +dependencies = [ + "bitflags 2.13.1", + "log", + "polling", + "rustix 0.38.44", + "slab", + "thiserror 1.0.69", +] + +[[package]] +name = "calloop" +version = "0.14.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4dbf9978365bac10f54d1d4b04f7ce4427e51f71d61f2fe15e3fed5166474df7" +dependencies = [ + "bitflags 2.13.1", + "polling", + "rustix 1.1.4", + "slab", + "tracing", +] + +[[package]] +name = "calloop-wayland-source" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "138efcf0940a02ebf0cc8d1eff41a1682a46b431630f4c52450d6265876021fa" +dependencies = [ + "calloop 0.14.4", + "rustix 1.1.4", + "wayland-backend", + "wayland-client", +] + +[[package]] +name = "cc" +version = "1.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5add81bb678e6cb321aff7fa0dc7689ad82b112dbc032cea19f91d6b8e3582b9" +dependencies = [ + "find-msvc-tools", + "jobserver", + "libc", + "shlex", +] + +[[package]] +name = "cff-parser" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "31f5b6e9141c036f3ff4ce7b2f7e432b0f00dee416ddcd4f17741d189ddc2e9d" + +[[package]] +name = "cfg-if" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9330f8b2ff13f34540b44e946ef35111825727b38d33286ef986142615121801" + +[[package]] +name = "cfg_aliases" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f079e83a288787bcd14a6aea84cee5c87a67c5a3e660c30f557a3d24761b3527" + +[[package]] +name = "cgl" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0ced0551234e87afee12411d535648dd89d2e7f34c78b753395567aff3d447ff" +dependencies = [ + "libc", +] + +[[package]] +name = "chacha20" +version = "0.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d524456ba66e72eb8b115ff89e01e497f8e6d11d78b70b1aa13c0fbd97540a81" +dependencies = [ + "cfg-if", + "cpufeatures", + "rand_core 0.10.1", +] + +[[package]] +name = "chrono" +version = "0.4.45" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1aa79e62e7697b8e29b513a68abacf485adcd1fe8284a4316c5ae868e6633327" +dependencies = [ + "iana-time-zone", + "num-traits", + "windows-link", +] + +[[package]] +name = "clap" +version = "4.6.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d91e0c145792ef73a6ad36d27c75ac09f1832222a3c209689d90f534685ee5b7" +dependencies = [ + "clap_builder", + "clap_derive", +] + +[[package]] +name = "clap_builder" +version = "4.6.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f09628afdcc538b57f3c6341e9c8e9970f18e4a481690a64974d7023bd33548b" +dependencies = [ + "anstream", + "anstyle", + "clap_lex", + "strsim", +] + +[[package]] +name = "clap_derive" +version = "4.6.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d012d2b9d65aca7f18f4d9878a045bc17899bba951561ba5ec3c2ba1eed9a061" +dependencies = [ + "heck", + "proc-macro2", + "quote", + "syn 3.0.3", +] + +[[package]] +name = "clap_lex" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c8d4a3bb8b1e0c1050499d1815f5ab16d04f0959b233085fb31653fbfc9d98f9" + +[[package]] +name = "clipboard-win" +version = "5.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bde03770d3df201d4fb868f2c9c59e66a3e4e2bd06692a0fe701e7103c7e84d4" +dependencies = [ + "error-code", +] + +[[package]] +name = "color_quant" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3d7b894f5411737b7867f4827955924d7c254fc9f4d91a6aad6b097804b1018b" + +[[package]] +name = "colorchoice" +version = "1.0.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1d07550c9036bf2ae0c684c4297d503f838287c83c53686d05370d0e139ae570" + +[[package]] +name = "combine" +version = "4.6.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ba5a308b75df32fe02788e748662718f03fde005016435c444eea572398219fd" +dependencies = [ + "bytes", + "memchr", +] + +[[package]] +name = "concurrent-queue" +version = "2.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4ca0197aee26d1ae37445ee532fefce43251d24cc7c166799f4d46817f1d3973" +dependencies = [ + "crossbeam-utils", +] + +[[package]] +name = "core-foundation" +version = "0.9.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "91e195e091a93c46f7102ec7818a2aa394e1e1771c3ab4825963fa03e45afb8f" +dependencies = [ + "core-foundation-sys", + "libc", +] + +[[package]] +name = "core-foundation-sys" +version = "0.8.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "773648b94d0e5d620f64f280777445740e61fe701025087ec8b57f45c791888b" + +[[package]] +name = "core-graphics" +version = "0.23.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c07782be35f9e1140080c6b96f0d44b739e2278479f64e02fdab4e32dfd8b081" +dependencies = [ + "bitflags 1.3.2", + "core-foundation", + "core-graphics-types", + "foreign-types", + "libc", +] + +[[package]] +name = "core-graphics-types" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "45390e6114f68f718cc7a830514a96f903cccd70d02a8f6d9f643ac4ba45afaf" +dependencies = [ + "bitflags 1.3.2", + "core-foundation", + "libc", +] + +[[package]] +name = "cpufeatures" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8b2a41393f66f16b0823bb79094d54ac5fbd34ab292ddafb9a0456ac9f87d201" +dependencies = [ + "libc", +] + +[[package]] +name = "crc32fast" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9481c1c90cbf2ac953f07c8d4a58aa3945c425b7185c9154d67a65e4230da511" +dependencies = [ + "cfg-if", +] + +[[package]] +name = "crossbeam-deque" +version = "0.8.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5181e0de7b61eb03a81e347d6dd8797bae9da5146707b51077e2d71a54ec0ceb" +dependencies = [ + "crossbeam-epoch", + "crossbeam-utils", +] + +[[package]] +name = "crossbeam-epoch" +version = "0.9.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2d6914041f254d6e9176c01941b21115dcfb7089e55135a35411081bd106ef3f" +dependencies = [ + "crossbeam-utils", +] + +[[package]] +name = "crossbeam-utils" +version = "0.8.22" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "61803da095bee82a81bb1a452ecc25d3b2f1416d1897eb86430c6159ef717c17" + +[[package]] +name = "crunchy" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "460fbee9c2c2f33933d720630a6a0bac33ba7053db5344fac858d4b8952d77d5" + +[[package]] +name = "crypto-common" +version = "0.1.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "78c8292055d1c1df0cce5d180393dc8cce0abec0a7102adb6c7b1eef6016d60a" +dependencies = [ + "generic-array", + "typenum", +] + +[[package]] +name = "cursor-icon" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f27ae1dd37df86211c42e150270f82743308803d90a6f6e6651cd730d5e1732f" + +[[package]] +name = "deranged" +version = "0.5.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7cd812cc2bc1d69d4764bd80df88b4317eaef9e773c75226407d9bc0876b211c" + +[[package]] +name = "digest" +version = "0.10.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292" +dependencies = [ + "block-buffer", + "crypto-common", +] + +[[package]] +name = "dispatch" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bd0c93bb4b0c6d9b77f4435b0ae98c24d17f1c45b2ff844c6151a07256ca923b" + +[[package]] +name = "dispatch2" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e0e367e4e7da84520dedcac1901e4da967309406d1e51017ae1abfb97adbd38" +dependencies = [ + "bitflags 2.13.1", + "block2 0.6.2", + "libc", + "objc2 0.6.4", +] + +[[package]] +name = "displaydoc" +version = "0.2.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c6232dd377dcc64799954cbd3a9bb882e9cdc1308ccd87b1c098f1fb2eaf82a8" +dependencies = [ + "proc-macro2", + "quote", + "syn 3.0.3", +] + +[[package]] +name = "dlib" +version = "0.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ab8ecd87370524b461f8557c119c405552c396ed91fc0a8eec68679eab26f94a" +dependencies = [ + "libloading", +] + +[[package]] +name = "docforge" +version = "0.2.0" +dependencies = [ + "anyhow", + "clap", + "eframe", + "egui", + "image", + "imageproc", + "lopdf 0.34.0", + "pdf-extract", + "printpdf", + "pulldown-cmark", + "reqwest", + "rfd", + "serde", + "serde_json", + "tempfile", + "unicode-width", + "walkdir", + "windows-sys 0.59.0", +] + +[[package]] +name = "document-features" +version = "0.2.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d4b8a88685455ed29a21542a33abd9cb6510b6b129abadabdcef0f4c55bc8f61" +dependencies = [ + "litrs", +] + +[[package]] +name = "downcast-rs" +version = "1.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "75b325c5dbd37f80359721ad39aca5a29fb04c89279657cffdda8736d0c0b9d2" + +[[package]] +name = "dpi" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d8b14ccef22fc6f5a8f4d7d768562a182c04ce9a3b3157b91390b52ddfdf1a76" + +[[package]] +name = "ecolor" +version = "0.32.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "94bdf37f8d5bd9aa7f753573fdda9cf7343afa73dd28d7bfe9593bd9798fc07e" +dependencies = [ + "bytemuck", + "emath", +] + +[[package]] +name = "eframe" +version = "0.32.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "14d1c15e7bd136b309bd3487e6ffe5f668b354cd9768636a836dd738ac90eb0b" +dependencies = [ + "ahash", + "bytemuck", + "document-features", + "egui", + "egui-winit", + "egui_glow", + "glow", + "glutin", + "glutin-winit", + "image", + "js-sys", + "log", + "objc2 0.5.2", + "objc2-app-kit 0.2.2", + "objc2-foundation 0.2.2", + "parking_lot", + "percent-encoding", + "profiling", + "raw-window-handle", + "static_assertions", + "wasm-bindgen", + "wasm-bindgen-futures", + "web-sys", + "web-time", + "winapi", + "windows-sys 0.59.0", + "winit", +] + +[[package]] +name = "egui" +version = "0.32.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5d5d0306cd61ca75e29682926d71f2390160247f135965242e904a636f51c0dc" +dependencies = [ + "ahash", + "bitflags 2.13.1", + "emath", + "epaint", + "log", + "nohash-hasher", + "profiling", + "smallvec", + "unicode-segmentation", +] + +[[package]] +name = "egui-winit" +version = "0.32.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f95d0a91f9cb0dc2e732d49c2d521ac8948e1f0b758f306fb7b14d6f5db3927f" +dependencies = [ + "ahash", + "arboard", + "bytemuck", + "egui", + "log", + "profiling", + "raw-window-handle", + "smithay-clipboard", + "web-time", + "webbrowser", + "winit", +] + +[[package]] +name = "egui_glow" +version = "0.32.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cc7037813341727937f9e22f78d912f3e29bc3c46e2f40a9e82bb51cbf5e4cfb" +dependencies = [ + "ahash", + "bytemuck", + "egui", + "glow", + "log", + "memoffset", + "profiling", + "wasm-bindgen", + "web-sys", +] + +[[package]] +name = "either" +version = "1.17.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9e5e8f6c15a24b9a3ee5efec809ccd006d3b30e8b3bb63c39af737c7f87daa1d" + +[[package]] +name = "emath" +version = "0.32.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "45fd7bc25f769a3c198fe1cf183124bf4de3bd62ef7b4f1eaf6b08711a3af8db" +dependencies = [ + "bytemuck", +] + +[[package]] +name = "encoding_rs" +version = "0.8.35" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "75030f3c4f45dafd7586dd6780965a8c7e8e285a5ecb86713e63a79c5b2766f3" +dependencies = [ + "cfg-if", +] + +[[package]] +name = "endi" +version = "1.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "66b7e2430c6dff6a955451e2cfc438f09cea1965a9d6f87f7e3b90decc014099" + +[[package]] +name = "enumflags2" +version = "0.7.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1027f7680c853e056ebcec683615fb6fbbc07dbaa13b4d5d9442b146ded4ecef" +dependencies = [ + "enumflags2_derive", + "serde", +] + +[[package]] +name = "enumflags2_derive" +version = "0.7.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "67c78a4d8fdf9953a5c9d458f9efe940fd97a0cab0941c075a813ac594733827" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.119", +] + +[[package]] +name = "epaint" +version = "0.32.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "63adcea970b7a13094fe97a36ab9307c35a750f9e24bf00bb7ef3de573e0fddb" +dependencies = [ + "ab_glyph", + "ahash", + "bytemuck", + "ecolor", + "emath", + "epaint_default_fonts", + "log", + "nohash-hasher", + "parking_lot", + "profiling", +] + +[[package]] +name = "epaint_default_fonts" +version = "0.32.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1537accc50c9cab5a272c39300bdd0dd5dca210f6e5e8d70be048df9596e7ca2" + +[[package]] +name = "equator" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4711b213838dfee0117e3be6ac926007d7f433d7bbe33595975d4190cb07e6fc" +dependencies = [ + "equator-macro", +] + +[[package]] +name = "equator-macro" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "44f23cf4b44bfce11a86ace86f8a73ffdec849c9fd00a386a53d278bd9e81fb3" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.119", +] + +[[package]] +name = "equivalent" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "877a4ace8713b0bcf2a4e7eec82529c029f1d0619886d18145fea96c3ffe5c0f" + +[[package]] +name = "errno" +version = "0.3.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "39cab71617ae0d63f51a36d69f866391735b51691dbda63cf6f96d042b63efeb" +dependencies = [ + "libc", + "windows-sys 0.61.2", +] + +[[package]] +name = "error-code" +version = "3.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dea2df4cf52843e0452895c455a1a2cfbb842a1e7329671acf418fdc53ed4c59" + +[[package]] +name = "euclid" +version = "0.20.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2bb7ef65b3777a325d1eeefefab5b6d4959da54747e33bd6258e789640f307ad" +dependencies = [ + "num-traits", +] + +[[package]] +name = "event-listener" +version = "5.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5a23add41df1562121a9393cb065eab5146a1242410f23a644851e90cfd669d2" +dependencies = [ + "parking", + "pin-project-lite", +] + +[[package]] +name = "event-listener-strategy" +version = "0.5.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8be9f3dfaaffdae2972880079a491a1a8bb7cbed0b8dd7a347f668b4150a3b93" +dependencies = [ + "event-listener", + "pin-project-lite", +] + +[[package]] +name = "exr" +version = "1.74.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "711fe42c9964295e01ee3fba3f9fe0e1d24b98886950d68efe81b1c76e21adf3" +dependencies = [ + "bit_field", + "half", + "lebe", + "miniz_oxide", + "num-complex", + "pulp", + "rayon-core", + "smallvec", + "zune-inflate", +] + +[[package]] +name = "fastrand" +version = "2.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "da7c62ceae207dd37ea5b845da6a0696c799f85e97da1ab5b7910be3c1c80223" + +[[package]] +name = "fax" +version = "0.2.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "caf1079563223d5d59d83c85886a56e586cfd5c1a26292e971a0fa266531ac5a" + +[[package]] +name = "fdeflate" +version = "0.3.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e6853b52649d4ac5c0bd02320cddc5ba956bdb407c4b75a2c6b75bf51500f8c" +dependencies = [ + "simd-adler32", +] + +[[package]] +name = "find-msvc-tools" +version = "0.1.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5baebc0774151f905a1a2cc41989300b1e6fbb29aff0ceffa1064fdd3088d582" + +[[package]] +name = "flate2" +version = "1.1.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "843fba2746e448b37e26a819579957415c8cef339bf08564fe8b7ddbd959573c" +dependencies = [ + "crc32fast", + "miniz_oxide", +] + +[[package]] +name = "foreign-types" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d737d9aa519fb7b749cbc3b962edcf310a8dd1f4b67c91c4f83975dbdd17d965" +dependencies = [ + "foreign-types-macros", + "foreign-types-shared", +] + +[[package]] +name = "foreign-types-macros" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ea5190182e6915eb873ddbc16e23b711b6eb1f9c00a0d0a3a91b5f6228475225" +dependencies = [ + "proc-macro2", + "quote", + "syn 3.0.3", +] + +[[package]] +name = "foreign-types-shared" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "aa9a19cbb55df58761df49b23516a86d432839add4af60fc256da840f66ed35b" + +[[package]] +name = "form_urlencoded" +version = "1.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cb4cb245038516f5f85277875cdaa4f7d2c9a0fa0468de06ed190163b1581fcf" +dependencies = [ + "percent-encoding", +] + +[[package]] +name = "futures-channel" +version = "0.3.33" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "262590f4fe6afeb0bc83be1daa64e52657fe185690a958af7f3ad0e92085c5ae" +dependencies = [ + "futures-core", + "futures-sink", +] + +[[package]] +name = "futures-core" +version = "0.3.33" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2cd50c473c80f6d7c3670a752354b8e569b1a7cbfdc0419ec88e5edad85e0dc7" + +[[package]] +name = "futures-io" +version = "0.3.33" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4577ecaa3c4f96589d473f679a71b596316f6641bc350038b962a5daf0085d7a" + +[[package]] +name = "futures-lite" +version = "2.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f78e10609fe0e0b3f4157ffab1876319b5b0db102a2c60dc4626306dc46b44ad" +dependencies = [ + "fastrand", + "futures-core", + "futures-io", + "parking", + "pin-project-lite", +] + +[[package]] +name = "futures-macro" +version = "0.3.33" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2d6d3cde68c518367be28956066ddfef33813991b77a55005a69dae04bf3b10b" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.119", +] + +[[package]] +name = "futures-sink" +version = "0.3.33" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e34418ac499d6305c2fb5ad0ed2f6ac998c5f8ca209b4510f7f94242c647e307" + +[[package]] +name = "futures-task" +version = "0.3.33" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b231ed28831efb4a61a08580c4bc233ec56bc009f4cd8f52da2c3cb97df0c109" + +[[package]] +name = "futures-util" +version = "0.3.33" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a77a90a256fce34da66415271e30f94ee91c57b04b8a2c042d9cf3220179deaa" +dependencies = [ + "futures-core", + "futures-io", + "futures-macro", + "futures-sink", + "futures-task", + "memchr", + "pin-project-lite", + "slab", +] + +[[package]] +name = "generic-array" +version = "0.14.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "85649ca51fd72272d7821adaf274ad91c288277713d9c18820d8499a7ff69e9a" +dependencies = [ + "typenum", + "version_check", +] + +[[package]] +name = "gethostname" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1bd49230192a3797a9a4d6abe9b3eed6f7fa4c8a8a4947977c6f80025f92cbd8" +dependencies = [ + "rustix 1.1.4", + "windows-link", +] + +[[package]] +name = "getopts" +version = "0.2.24" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cfe4fbac503b8d1f88e6676011885f34b7174f46e59956bba534ba83abded4df" +dependencies = [ + "unicode-width", +] + +[[package]] +name = "getrandom" +version = "0.2.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ff2abc00be7fca6ebc474524697ae276ad847ad0a6b3faa4bcb027e9a4614ad0" +dependencies = [ + "cfg-if", + "js-sys", + "libc", + "wasi", + "wasm-bindgen", +] + +[[package]] +name = "getrandom" +version = "0.3.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "899def5c37c4fd7b2664648c28120ecec138e4d395b459e5ca34f9cce2dd77fd" +dependencies = [ + "cfg-if", + "libc", + "r-efi 5.3.0", + "wasip2", +] + +[[package]] +name = "getrandom" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "300e883d756b2e4ec94e02791f39b04b522276138852cfc41d9fb7e904106099" +dependencies = [ + "cfg-if", + "js-sys", + "libc", + "r-efi 6.0.0", + "rand_core 0.10.1", + "wasm-bindgen", +] + +[[package]] +name = "gif" +version = "0.14.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ee8cfcc411d9adbbaba82fb72661cc1bcca13e8bba98b364e62b2dba8f960159" +dependencies = [ + "color_quant", + "weezl", +] + +[[package]] +name = "gl_generator" +version = "0.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1a95dfc23a2b4a9a2f5ab41d194f8bfda3cabec42af4e39f08c339eb2a0c124d" +dependencies = [ + "khronos_api", + "log", + "xml-rs", +] + +[[package]] +name = "glow" +version = "0.16.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c5e5ea60d70410161c8bf5da3fdfeaa1c72ed2c15f8bbb9d19fe3a4fad085f08" +dependencies = [ + "js-sys", + "slotmap", + "wasm-bindgen", + "web-sys", +] + +[[package]] +name = "glutin" +version = "0.32.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "12124de845cacfebedff80e877bb37b5b75c34c5a4c89e47e1cdd67fb6041325" +dependencies = [ + "bitflags 2.13.1", + "cfg_aliases", + "cgl", + "dispatch2", + "glutin_egl_sys", + "glutin_wgl_sys", + "libloading", + "objc2 0.6.4", + "objc2-app-kit 0.3.2", + "objc2-core-foundation", + "objc2-foundation 0.3.2", + "once_cell", + "raw-window-handle", + "windows-sys 0.52.0", +] + +[[package]] +name = "glutin-winit" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "85edca7075f8fc728f28cb8fbb111a96c3b89e930574369e3e9c27eb75d3788f" +dependencies = [ + "cfg_aliases", + "glutin", + "raw-window-handle", + "winit", +] + +[[package]] +name = "glutin_egl_sys" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4c4680ba6195f424febdc3ba46e7a42a0e58743f2edb115297b86d7f8ecc02d2" +dependencies = [ + "gl_generator", + "windows-sys 0.52.0", +] + +[[package]] +name = "glutin_wgl_sys" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2c4ee00b289aba7a9e5306d57c2d05499b2e5dc427f84ac708bd2c090212cf3e" +dependencies = [ + "gl_generator", +] + +[[package]] +name = "half" +version = "2.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6ea2d84b969582b4b1864a92dc5d27cd2b77b622a8d79306834f1be5ba20d84b" +dependencies = [ + "cfg-if", + "crunchy", + "zerocopy", +] + +[[package]] +name = "hashbrown" +version = "0.17.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ed5909b6e89a2db4456e54cd5f673791d7eca6732202bbf2a9cc504fe2f9b84a" + +[[package]] +name = "heck" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea" + +[[package]] +name = "hermit-abi" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fc0fef456e4baa96da950455cd02c081ca953b141298e41db3fc7e36b1da849c" + +[[package]] +name = "hex" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70" + +[[package]] +name = "http" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "918d3568bebf352712bc2ef3d46a8bcf1a75b373be6539de198e9105cbbf9ce0" +dependencies = [ + "bytes", + "itoa", +] + +[[package]] +name = "http-body" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ca2a8f2913ee65f60facd6a5905613afaa448497a0230cc41ce022d93290bc2c" +dependencies = [ + "bytes", + "http", +] + +[[package]] +name = "http-body-util" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e9f41fd6a08e4d4ec69df65976da761afd5ad5e58a9d4acb46bd1c953a9e3ff2" +dependencies = [ + "bytes", + "futures-core", + "http", + "http-body", + "pin-project-lite", +] + +[[package]] +name = "httparse" +version = "1.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6dbf3de79e51f3d586ab4cb9d5c3e2c14aa28ed23d180cf89b4df0454a69cc87" + +[[package]] +name = "hyper" +version = "1.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d22053281f852e11534f5198498373cbb59295120a20771d90f7ed1897490a72" +dependencies = [ + "atomic-waker", + "bytes", + "futures-channel", + "futures-core", + "http", + "http-body", + "httparse", + "itoa", + "pin-project-lite", + "smallvec", + "tokio", + "want", +] + +[[package]] +name = "hyper-rustls" +version = "0.27.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "33ca68d021ef39cf6463ab54c1d0f5daf03377b70561305bb89a8f83aab66e0f" +dependencies = [ + "http", + "hyper", + "hyper-util", + "rustls", + "tokio", + "tokio-rustls", + "tower-service", + "webpki-roots", +] + +[[package]] +name = "hyper-util" +version = "0.1.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "96547c2556ec9d12fb1578c4eaf448b04993e7fb79cbaad930a656880a6bdfa0" +dependencies = [ + "base64", + "bytes", + "futures-channel", + "futures-util", + "http", + "http-body", + "hyper", + "ipnet", + "libc", + "percent-encoding", + "pin-project-lite", + "socket2", + "tokio", + "tower-service", + "tracing", +] + +[[package]] +name = "iana-time-zone" +version = "0.1.65" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e31bc9ad994ba00e440a8aa5c9ef0ec67d5cb5e5cb0cc7f8b744a35b389cc470" +dependencies = [ + "android_system_properties", + "core-foundation-sys", + "iana-time-zone-haiku", + "js-sys", + "log", + "wasm-bindgen", + "windows-core", +] + +[[package]] +name = "iana-time-zone-haiku" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f31827a206f56af32e590ba56d5d2d085f558508192593743f16b2306495269f" +dependencies = [ + "cc", +] + +[[package]] +name = "icu_collections" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2984d1cd16c883d7935b9e07e44071dca8d917fd52ecc02c04d5fa0b5a3f191c" +dependencies = [ + "displaydoc", + "potential_utf", + "utf8_iter", + "yoke", + "zerofrom", + "zerovec", +] + +[[package]] +name = "icu_locale_core" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "92219b62b3e2b4d88ac5119f8904c10f8f61bf7e95b640d25ba3075e6cac2c29" +dependencies = [ + "displaydoc", + "litemap", + "tinystr", + "writeable", + "zerovec", +] + +[[package]] +name = "icu_normalizer" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c56e5ee99d6e3d33bd91c5d85458b6005a22140021cc324cea84dd0e72cff3b4" +dependencies = [ + "icu_collections", + "icu_normalizer_data", + "icu_properties", + "icu_provider", + "smallvec", + "zerovec", +] + +[[package]] +name = "icu_normalizer_data" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "da3be0ae77ea334f4da67c12f149704f19f81d1adf7c51cf482943e84a2bad38" + +[[package]] +name = "icu_properties" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bee3b67d0ea5c2cca5003417989af8996f8604e34fb9ddf96208a033901e70de" +dependencies = [ + "icu_collections", + "icu_locale_core", + "icu_properties_data", + "icu_provider", + "zerotrie", + "zerovec", +] + +[[package]] +name = "icu_properties_data" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e2bbb201e0c04f7b4b3e14382af113e17ba4f63e2c9d2ee626b720cbce54a14" + +[[package]] +name = "icu_provider" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "139c4cf31c8b5f33d7e199446eff9c1e02decfc2f0eec2c8d71f65befa45b421" +dependencies = [ + "displaydoc", + "icu_locale_core", + "writeable", + "yoke", + "zerofrom", + "zerotrie", + "zerovec", +] + +[[package]] +name = "idna" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3b0875f23caa03898994f6ddc501886a45c7d3d62d04d2d90788d47be1b1e4de" +dependencies = [ + "idna_adapter", + "smallvec", + "utf8_iter", +] + +[[package]] +name = "idna_adapter" +version = "1.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cb68373c0d6620ef8105e855e7745e18b0d00d3bdb07fb532e434244cdb9a714" +dependencies = [ + "icu_normalizer", + "icu_properties", +] + +[[package]] +name = "image" +version = "0.25.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "85ab80394333c02fe689eaf900ab500fbd0c2213da414687ebf995a65d5a6104" +dependencies = [ + "bytemuck", + "byteorder-lite", + "color_quant", + "exr", + "gif", + "image-webp", + "moxcms", + "num-traits", + "png", + "qoi", + "ravif", + "rayon", + "rgb", + "tiff", + "zune-core", + "zune-jpeg", +] + +[[package]] +name = "image-webp" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "525e9ff3e1a4be2fbea1fdf0e98686a6d98b4d8f937e1bf7402245af1909e8c3" +dependencies = [ + "byteorder-lite", + "quick-error", +] + +[[package]] +name = "imageproc" +version = "0.25.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "602b4e8a4cc3e98372b766cd184ab532999bc0e839b7469e759511ccabc65d77" +dependencies = [ + "ab_glyph", + "approx", + "getrandom 0.2.17", + "image", + "itertools 0.12.1", + "nalgebra", + "num", + "rand 0.8.7", + "rand_distr", + "rayon", +] + +[[package]] +name = "imgref" +version = "1.12.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "89194689a993ab15268672e99e7b0e19da2da3268ac682e8f02d29d4d1434cd7" + +[[package]] +name = "indexmap" +version = "2.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d466e9454f08e4a911e14806c24e16fba1b4c121d1ea474396f396069cf949d9" +dependencies = [ + "equivalent", + "hashbrown", +] + +[[package]] +name = "interpolate_name" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c34819042dc3d3971c46c2190835914dfbe0c3c13f61449b2997f4e9722dfa60" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.119", +] + +[[package]] +name = "ipnet" +version = "2.12.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d98f6fed1fde3f8c21bc40a1abb88dd75e67924f9cffc3ef95607bad8017f8e2" + +[[package]] +name = "is_terminal_polyfill" +version = "1.70.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a6cb138bb79a146c1bd460005623e142ef0181e3d0219cb493e02f7d08a35695" + +[[package]] +name = "itertools" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ba291022dbbd398a455acf126c1e341954079855bc60dfdda641363bd6922569" +dependencies = [ + "either", +] + +[[package]] +name = "itertools" +version = "0.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2b192c782037fadd9cfa75548310488aabdbf3d2da73885b31bd0abd03351285" +dependencies = [ + "either", +] + +[[package]] +name = "itoa" +version = "1.0.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8f42a60cbdf9a97f5d2305f08a87dc4e09308d1276d28c869c684d7777685682" + +[[package]] +name = "jni" +version = "0.22.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5efd9a482cf3a427f00d6b35f14332adc7902ce91efb778580e180ff90fa3498" +dependencies = [ + "cfg-if", + "combine", + "jni-macros", + "jni-sys 0.4.1", + "log", + "simd_cesu8", + "thiserror 2.0.19", + "walkdir", + "windows-link", +] + +[[package]] +name = "jni-macros" +version = "0.22.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a00109accc170f0bdb141fed3e393c565b6f5e072365c3bd58f5b062591560a3" +dependencies = [ + "proc-macro2", + "quote", + "rustc_version", + "simd_cesu8", + "syn 2.0.119", +] + +[[package]] +name = "jni-sys" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "41a652e1f9b6e0275df1f15b32661cf0d4b78d4d87ddec5e0c3c20f097433258" +dependencies = [ + "jni-sys 0.4.1", +] + +[[package]] +name = "jni-sys" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c6377a88cb3910bee9b0fa88d4f42e1d2da8e79915598f65fb0c7ee14c878af2" +dependencies = [ + "jni-sys-macros", +] + +[[package]] +name = "jni-sys-macros" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "38c0b942f458fe50cdac086d2f946512305e5631e720728f2a61aabcd47a6264" +dependencies = [ + "quote", + "syn 2.0.119", +] + +[[package]] +name = "jobserver" +version = "0.1.35" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1c00acbd29eabad4a2392fa0e921c874934dbbf4194312ad20f04a0ed67a3cb3" +dependencies = [ + "getrandom 0.4.3", + "libc", +] + +[[package]] +name = "js-sys" +version = "0.3.103" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "53b44bfcdb3f8d5837a46dae1ca9660a837176eee74a28b229bc626816589102" +dependencies = [ + "cfg-if", + "futures-util", + "wasm-bindgen", +] + +[[package]] +name = "khronos_api" +version = "3.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e2db585e1d738fc771bf08a151420d3ed193d9d895a36df7f6f8a9456b911ddc" + +[[package]] +name = "lebe" +version = "0.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7a79a3332a6609480d7d0c9eab957bca6b455b91bb84e66d19f5ff66294b85b8" + +[[package]] +name = "libc" +version = "0.2.189" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3eaf3ede3fee6db1a4c2ee091bf8a8b4dccdc6d17f656fb07896ee72867612f2" + +[[package]] +name = "libfuzzer-sys" +version = "0.4.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a9fd2f41a1cba099f79a0b6b6c35656cf7c03351a7bae8ff0f28f25270f929d2" +dependencies = [ + "arbitrary", + "cc", +] + +[[package]] +name = "libloading" +version = "0.8.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d7c4b02199fee7c5d21a5ae7d8cfa79a6ef5bb2fc834d6e9058e89c825efdc55" +dependencies = [ + "cfg-if", + "windows-link", +] + +[[package]] +name = "libm" +version = "0.2.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6d2cec3eae94f9f509c767b45932f1ada8350c4bdb85af2fcab4a3c14807981" + +[[package]] +name = "libredox" +version = "0.1.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c943259e342f1e06ff2da7a83eabdfe7f92ce10262688dbf1895ff0b3e6e4652" +dependencies = [ + "bitflags 2.13.1", + "libc", + "plain", + "redox_syscall 0.9.1", +] + +[[package]] +name = "linked-hash-map" +version = "0.5.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0717cef1bc8b636c6e1c1bbdefc09e6322da8a9321966e8928ef80d20f7f770f" + +[[package]] +name = "linux-raw-sys" +version = "0.4.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d26c52dbd32dccf2d10cac7725f8eae5296885fb5703b261f7d0a0739ec807ab" + +[[package]] +name = "linux-raw-sys" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "32a66949e030da00e8c7d4434b251670a91556f4144941d37452769c25d58a53" + +[[package]] +name = "litemap" +version = "0.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "92daf443525c4cce67b150400bc2316076100ce0b3686209eb8cf3c31612e6f0" + +[[package]] +name = "litrs" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "11d3d7f243d5c5a8b9bb5d6dd2b1602c0cb0b9db1621bafc7ed66e35ff9fe092" + +[[package]] +name = "lock_api" +version = "0.4.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "224399e74b87b5f3557511d98dff8b14089b3dadafcab6bb93eab67d3aace965" +dependencies = [ + "scopeguard", +] + +[[package]] +name = "log" +version = "0.4.33" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0ceec5bc11778974d1bcb055b18002eba7f4b3518b6a0081b3af5f21666da9ad" + +[[package]] +name = "loop9" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0fae87c125b03c1d2c0150c90365d7d6bcc53fb73a9acaef207d2d065860f062" +dependencies = [ + "imgref", +] + +[[package]] +name = "lopdf" +version = "0.31.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "07c8e1b6184b1b32ea5f72f572ebdc40e5da1d2921fa469947ff7c480ad1f85a" +dependencies = [ + "encoding_rs", + "flate2", + "itoa", + "linked-hash-map", + "log", + "md5", + "pom 3.4.0", + "time", + "weezl", +] + +[[package]] +name = "lopdf" +version = "0.34.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c5c8ecfc6c72051981c0459f75ccc585e7ff67c70829560cda8e647882a9abff" +dependencies = [ + "chrono", + "encoding_rs", + "flate2", + "indexmap", + "itoa", + "log", + "md-5", + "nom 7.1.3", + "rangemap", + "rayon", + "time", + "weezl", +] + +[[package]] +name = "lru-slab" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "112b39cec0b298b6c1999fee3e31427f74f676e4cb9879ed1a121b43661a4154" + +[[package]] +name = "matrixmultiply" +version = "0.3.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3f607c237553f086e7043417a51df26b2eb899d3caff94e6a67592ff992fedc7" +dependencies = [ + "autocfg", + "rawpointer", +] + +[[package]] +name = "maybe-rayon" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8ea1f30cedd69f0a2954655f7188c6a834246d2bcf1e315e2ac40c4b24dc9519" +dependencies = [ + "cfg-if", + "rayon", +] + +[[package]] +name = "md-5" +version = "0.10.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d89e7ee0cfbedfc4da3340218492196241d89eefb6dab27de5df917a6d2e78cf" +dependencies = [ + "cfg-if", + "digest", +] + +[[package]] +name = "md5" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "490cc448043f947bae3cbee9c203358d62dbee0db12107a74be5c30ccfd09771" + +[[package]] +name = "memchr" +version = "2.8.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cf8baf1c55e62ffcace7a9f06f4bd9cd3f0c4beb022d3b367256b91b87513d98" + +[[package]] +name = "memmap2" +version = "0.9.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d1219ed1b7f229ee7104d281dd01d6802fe28bb6e95d292942c4daacdeb798c0" +dependencies = [ + "libc", +] + +[[package]] +name = "memoffset" +version = "0.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "488016bfae457b036d996092f6cb448677611ce4449e970ceaf42695203f218a" +dependencies = [ + "autocfg", +] + +[[package]] +name = "minimal-lexical" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a" + +[[package]] +name = "miniz_oxide" +version = "0.8.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1fa76a2c86f704bdb222d66965fb3d63269ce38518b83cb0575fca855ebb6316" +dependencies = [ + "adler2", + "simd-adler32", +] + +[[package]] +name = "mio" +version = "1.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "30d65c71f1ce40ab09135ce117d742b9f8a19ff91a41a8b57ed50bc2de59c427" +dependencies = [ + "libc", + "wasi", + "windows-sys 0.61.2", +] + +[[package]] +name = "moxcms" +version = "0.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bb85c154ba489f01b25c0d36ae69a87e4a1c73a72631fc6c0eb6dde34a73e44b" +dependencies = [ + "num-traits", + "pxfm", +] + +[[package]] +name = "nalgebra" +version = "0.32.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7b5c17de023a86f59ed79891b2e5d5a94c705dbe904a5b5c9c952ea6221b03e4" +dependencies = [ + "approx", + "matrixmultiply", + "num-complex", + "num-rational", + "num-traits", + "simba", + "typenum", +] + +[[package]] +name = "ndk" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c3f42e7bbe13d351b6bead8286a43aac9534b82bd3cc43e47037f012ebfd62d4" +dependencies = [ + "bitflags 2.13.1", + "jni-sys 0.3.1", + "log", + "ndk-sys", + "num_enum", + "raw-window-handle", + "thiserror 1.0.69", +] + +[[package]] +name = "ndk-context" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "27b02d87554356db9e9a873add8782d4ea6e3e58ea071a9adb9a2e8ddb884a8b" + +[[package]] +name = "ndk-sys" +version = "0.6.0+11769913" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ee6cda3051665f1fb8d9e08fc35c96d5a244fb1be711a03b71118828afc9a873" +dependencies = [ + "jni-sys 0.3.1", +] + +[[package]] +name = "new_debug_unreachable" +version = "1.0.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "650eef8c711430f1a879fdd01d4745a7deea475becfb90269c06775983bbf086" + +[[package]] +name = "no_std_io2" +version = "0.9.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "418abd1b6d34fbf6cae440dc874771b0525a604428704c76e48b29a5e67b8003" +dependencies = [ + "memchr", +] + +[[package]] +name = "nohash-hasher" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2bf50223579dc7cdcfb3bfcacf7069ff68243f8c363f62ffa99cf000a6b9c451" + +[[package]] +name = "nom" +version = "7.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d273983c5a657a70a3e8f2a01329822f3b8c8172b73826411a55751e404a0a4a" +dependencies = [ + "memchr", + "minimal-lexical", +] + +[[package]] +name = "nom" +version = "8.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "df9761775871bdef83bee530e60050f7e54b1105350d6884eb0fb4f46c2f9405" +dependencies = [ + "memchr", +] + +[[package]] +name = "noop_proc_macro" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0676bb32a98c1a483ce53e500a81ad9c3d5b3f7c920c28c24e9cb0980d0b5bc8" + +[[package]] +name = "num" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "35bd024e8b2ff75562e5f34e7f4905839deb4b22955ef5e73d2fea1b9813cb23" +dependencies = [ + "num-bigint", + "num-complex", + "num-integer", + "num-iter", + "num-rational", + "num-traits", +] + +[[package]] +name = "num-bigint" +version = "0.4.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c89e69e7e0f03bea5ef08013795c25018e101932225a656383bd384495ecc367" +dependencies = [ + "num-integer", + "num-traits", +] + +[[package]] +name = "num-complex" +version = "0.4.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "73f88a1307638156682bada9d7604135552957b7818057dcef22705b4d509495" +dependencies = [ + "bytemuck", + "num-traits", +] + +[[package]] +name = "num-conv" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "521739c6d2bac4aa25192232afe6841231376b2b26d4d9fae5ecf8ca5772e441" + +[[package]] +name = "num-derive" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ed3955f1a9c7c0c15e092f9c887db08b1fc683305fdf6eb6684f22555355e202" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.119", +] + +[[package]] +name = "num-integer" +version = "0.1.46" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7969661fd2958a5cb096e56c8e1ad0444ac2bbcd0061bd28660485a44879858f" +dependencies = [ + "num-traits", +] + +[[package]] +name = "num-iter" +version = "0.1.46" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c92800bd69a1eac91786bcfe9da64a897eb72911b8dc3095decbd07429e8048b" +dependencies = [ + "num-integer", + "num-traits", +] + +[[package]] +name = "num-rational" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f83d14da390562dca69fc84082e73e548e1ad308d24accdedd2720017cb37824" +dependencies = [ + "num-bigint", + "num-integer", + "num-traits", +] + +[[package]] +name = "num-traits" +version = "0.2.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "071dfc062690e90b734c0b2273ce72ad0ffa95f0c74596bc250dcfd960262841" +dependencies = [ + "autocfg", + "libm", +] + +[[package]] +name = "num_enum" +version = "0.7.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5d0bca838442ec211fa11de3a8b0e0e8f3a4522575b5c4c06ed722e005036f26" +dependencies = [ + "num_enum_derive", + "rustversion", +] + +[[package]] +name = "num_enum_derive" +version = "0.7.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "680998035259dcfcafe653688bf2aa6d3e2dc05e98be6ab46afb089dc84f1df8" +dependencies = [ + "proc-macro-crate", + "proc-macro2", + "quote", + "syn 2.0.119", +] + +[[package]] +name = "objc-sys" +version = "0.3.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cdb91bdd390c7ce1a8607f35f3ca7151b65afc0ff5ff3b34fa350f7d7c7e4310" + +[[package]] +name = "objc2" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "46a785d4eeff09c14c487497c162e92766fbb3e4059a71840cecc03d9a50b804" +dependencies = [ + "objc-sys", + "objc2-encode", +] + +[[package]] +name = "objc2" +version = "0.6.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3a12a8ed07aefc768292f076dc3ac8c48f3781c8f2d5851dd3d98950e8c5a89f" +dependencies = [ + "objc2-encode", +] + +[[package]] +name = "objc2-app-kit" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e4e89ad9e3d7d297152b17d39ed92cd50ca8063a89a9fa569046d41568891eff" +dependencies = [ + "bitflags 2.13.1", + "block2 0.5.1", + "libc", + "objc2 0.5.2", + "objc2-core-data", + "objc2-core-image", + "objc2-foundation 0.2.2", + "objc2-quartz-core", +] + +[[package]] +name = "objc2-app-kit" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d49e936b501e5c5bf01fda3a9452ff86dc3ea98ad5f283e1455153142d97518c" +dependencies = [ + "bitflags 2.13.1", + "block2 0.6.2", + "objc2 0.6.4", + "objc2-core-foundation", + "objc2-core-graphics", + "objc2-foundation 0.3.2", +] + +[[package]] +name = "objc2-cloud-kit" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "74dd3b56391c7a0596a295029734d3c1c5e7e510a4cb30245f8221ccea96b009" +dependencies = [ + "bitflags 2.13.1", + "block2 0.5.1", + "objc2 0.5.2", + "objc2-core-location", + "objc2-foundation 0.2.2", +] + +[[package]] +name = "objc2-contacts" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a5ff520e9c33812fd374d8deecef01d4a840e7b41862d849513de77e44aa4889" +dependencies = [ + "block2 0.5.1", + "objc2 0.5.2", + "objc2-foundation 0.2.2", +] + +[[package]] +name = "objc2-core-data" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "617fbf49e071c178c0b24c080767db52958f716d9eabdf0890523aeae54773ef" +dependencies = [ + "bitflags 2.13.1", + "block2 0.5.1", + "objc2 0.5.2", + "objc2-foundation 0.2.2", +] + +[[package]] +name = "objc2-core-foundation" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2a180dd8642fa45cdb7dd721cd4c11b1cadd4929ce112ebd8b9f5803cc79d536" +dependencies = [ + "bitflags 2.13.1", + "dispatch2", + "objc2 0.6.4", +] + +[[package]] +name = "objc2-core-graphics" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e022c9d066895efa1345f8e33e584b9f958da2fd4cd116792e15e07e4720a807" +dependencies = [ + "bitflags 2.13.1", + "dispatch2", + "objc2 0.6.4", + "objc2-core-foundation", + "objc2-io-surface", +] + +[[package]] +name = "objc2-core-image" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "55260963a527c99f1819c4f8e3b47fe04f9650694ef348ffd2227e8196d34c80" +dependencies = [ + "block2 0.5.1", + "objc2 0.5.2", + "objc2-foundation 0.2.2", + "objc2-metal", +] + +[[package]] +name = "objc2-core-location" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "000cfee34e683244f284252ee206a27953279d370e309649dc3ee317b37e5781" +dependencies = [ + "block2 0.5.1", + "objc2 0.5.2", + "objc2-contacts", + "objc2-foundation 0.2.2", +] + +[[package]] +name = "objc2-encode" +version = "4.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ef25abbcd74fb2609453eb695bd2f860d389e457f67dc17cafc8b8cbc89d0c33" + +[[package]] +name = "objc2-foundation" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0ee638a5da3799329310ad4cfa62fbf045d5f56e3ef5ba4149e7452dcf89d5a8" +dependencies = [ + "bitflags 2.13.1", + "block2 0.5.1", + "dispatch", + "libc", + "objc2 0.5.2", +] + +[[package]] +name = "objc2-foundation" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e3e0adef53c21f888deb4fa59fc59f7eb17404926ee8a6f59f5df0fd7f9f3272" +dependencies = [ + "bitflags 2.13.1", + "objc2 0.6.4", + "objc2-core-foundation", +] + +[[package]] +name = "objc2-io-surface" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "180788110936d59bab6bd83b6060ffdfffb3b922ba1396b312ae795e1de9d81d" +dependencies = [ + "bitflags 2.13.1", + "objc2 0.6.4", + "objc2-core-foundation", +] + +[[package]] +name = "objc2-link-presentation" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a1a1ae721c5e35be65f01a03b6d2ac13a54cb4fa70d8a5da293d7b0020261398" +dependencies = [ + "block2 0.5.1", + "objc2 0.5.2", + "objc2-app-kit 0.2.2", + "objc2-foundation 0.2.2", +] + +[[package]] +name = "objc2-metal" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dd0cba1276f6023976a406a14ffa85e1fdd19df6b0f737b063b95f6c8c7aadd6" +dependencies = [ + "bitflags 2.13.1", + "block2 0.5.1", + "objc2 0.5.2", + "objc2-foundation 0.2.2", +] + +[[package]] +name = "objc2-quartz-core" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e42bee7bff906b14b167da2bac5efe6b6a07e6f7c0a21a7308d40c960242dc7a" +dependencies = [ + "bitflags 2.13.1", + "block2 0.5.1", + "objc2 0.5.2", + "objc2-foundation 0.2.2", + "objc2-metal", +] + +[[package]] +name = "objc2-symbols" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0a684efe3dec1b305badae1a28f6555f6ddd3bb2c2267896782858d5a78404dc" +dependencies = [ + "objc2 0.5.2", + "objc2-foundation 0.2.2", +] + +[[package]] +name = "objc2-ui-kit" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b8bb46798b20cd6b91cbd113524c490f1686f4c4e8f49502431415f3512e2b6f" +dependencies = [ + "bitflags 2.13.1", + "block2 0.5.1", + "objc2 0.5.2", + "objc2-cloud-kit", + "objc2-core-data", + "objc2-core-image", + "objc2-core-location", + "objc2-foundation 0.2.2", + "objc2-link-presentation", + "objc2-quartz-core", + "objc2-symbols", + "objc2-uniform-type-identifiers", + "objc2-user-notifications", +] + +[[package]] +name = "objc2-uniform-type-identifiers" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "44fa5f9748dbfe1ca6c0b79ad20725a11eca7c2218bceb4b005cb1be26273bfe" +dependencies = [ + "block2 0.5.1", + "objc2 0.5.2", + "objc2-foundation 0.2.2", +] + +[[package]] +name = "objc2-user-notifications" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "76cfcbf642358e8689af64cee815d139339f3ed8ad05103ed5eaf73db8d84cb3" +dependencies = [ + "bitflags 2.13.1", + "block2 0.5.1", + "objc2 0.5.2", + "objc2-core-location", + "objc2-foundation 0.2.2", +] + +[[package]] +name = "once_cell" +version = "1.21.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9f7c3e4beb33f85d45ae3e3a1792185706c8e16d043238c593331cc7cd313b50" + +[[package]] +name = "once_cell_polyfill" +version = "1.70.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "384b8ab6d37215f3c5301a95a4accb5d64aa607f1fcb26a11b5303878451b4fe" + +[[package]] +name = "orbclient" +version = "0.3.55" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5df339f526ea9a60e371768d50efc2f2508c7203290731565d1f7a6f71d21747" +dependencies = [ + "libc", + "libredox", +] + +[[package]] +name = "ordered-stream" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9aa2b01e1d916879f73a53d01d1d6cee68adbb31d6d9177a8cfce093cced1d50" +dependencies = [ + "futures-core", + "pin-project-lite", +] + +[[package]] +name = "owned_ttf_parser" +version = "0.19.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "706de7e2214113d63a8238d1910463cfce781129a6f263d13fdb09ff64355ba4" +dependencies = [ + "ttf-parser 0.19.2", +] + +[[package]] +name = "owned_ttf_parser" +version = "0.25.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "36820e9051aca1014ddc75770aab4d68bc1e9e632f0f5627c4086bc216fb583b" +dependencies = [ + "ttf-parser 0.25.1", +] + +[[package]] +name = "parking" +version = "2.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f38d5652c16fde515bb1ecef450ab0f6a219d619a7274976324d5e377f7dceba" + +[[package]] +name = "parking_lot" +version = "0.12.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "93857453250e3077bd71ff98b6a65ea6621a19bb0f559a85248955ac12c45a1a" +dependencies = [ + "lock_api", + "parking_lot_core", +] + +[[package]] +name = "parking_lot_core" +version = "0.9.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2621685985a2ebf1c516881c026032ac7deafcda1a2c9b7850dc81e3dfcb64c1" +dependencies = [ + "cfg-if", + "libc", + "redox_syscall 0.5.18", + "smallvec", + "windows-link", +] + +[[package]] +name = "paste" +version = "1.0.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "57c0d7b74b563b49d38dae00a0c37d4d6de9b432382b2892f0574ddcae73fd0a" + +[[package]] +name = "pastey" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "35fb2e5f958ec131621fdd531e9fc186ed768cbe395337403ae56c17a74c68ec" + +[[package]] +name = "pdf-extract" +version = "0.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "87aa267a18864f2f75471f6d316ea430f13e78f0b5a882ce261ebbdfd389a76a" +dependencies = [ + "adobe-cmap-parser", + "cff-parser", + "encoding_rs", + "euclid", + "lopdf 0.34.0", + "postscript", + "type1-encoding-parser", + "unicode-normalization", +] + +[[package]] +name = "percent-encoding" +version = "2.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9b4f627cb1b25917193a259e49bdad08f671f8d9708acfd5fe0a8c1455d87220" + +[[package]] +name = "pin-project" +version = "1.1.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2466b2336ed02bcdca6b294417127b90ec92038d1d5c4fbeac971a922e0e0924" +dependencies = [ + "pin-project-internal", +] + +[[package]] +name = "pin-project-internal" +version = "1.1.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c96395f0a926bc13b1c17622aaddda1ecb55d49c8f1bf9777e4d877800a43f8b" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.119", +] + +[[package]] +name = "pin-project-lite" +version = "0.2.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a89322df9ebe1c1578d689c92318e070967d1042b512afbe49518723f4e6d5cd" + +[[package]] +name = "piper" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c835479a4443ded371d6c535cbfd8d31ad92c5d23ae9770a61bc155e4992a3c1" +dependencies = [ + "atomic-waker", + "fastrand", + "futures-io", +] + +[[package]] +name = "pkg-config" +version = "0.3.33" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "19f132c84eca552bf34cab8ec81f1c1dcc229b811638f9d283dceabe58c5569e" + +[[package]] +name = "plain" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b4596b6d070b27117e987119b4dac604f3c58cfb0b191112e24771b2faeac1a6" + +[[package]] +name = "png" +version = "0.18.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "60769b8b31b2a9f263dae2776c37b1b28ae246943cf719eb6946a1db05128a61" +dependencies = [ + "bitflags 2.13.1", + "crc32fast", + "fdeflate", + "flate2", + "miniz_oxide", +] + +[[package]] +name = "polling" +version = "3.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5d0e4f59085d47d8241c88ead0f274e8a0cb551f3625263c05eb8dd897c34218" +dependencies = [ + "cfg-if", + "concurrent-queue", + "hermit-abi", + "pin-project-lite", + "rustix 1.1.4", + "windows-sys 0.61.2", +] + +[[package]] +name = "pollster" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2f3a9f18d041e6d0e102a0a46750538147e5e8992d3b4873aaafee2520b00ce3" + +[[package]] +name = "pom" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "60f6ce597ecdcc9a098e7fddacb1065093a3d66446fa16c675e7e71d1b5c28e6" + +[[package]] +name = "pom" +version = "3.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6c972d8f86e943ad532d0b04e8965a749ad1d18bb981a9c7b3ae72fe7fd7744b" +dependencies = [ + "bstr", +] + +[[package]] +name = "postscript" +version = "0.14.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "78451badbdaebaf17f053fd9152b3ffb33b516104eacb45e7864aaa9c712f306" + +[[package]] +name = "potential_utf" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0103b1cef7ec0cf76490e969665504990193874ea05c85ff9bab8b911d0a0564" +dependencies = [ + "zerovec", +] + +[[package]] +name = "powerfmt" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "439ee305def115ba05938db6eb1644ff94165c5ab5e9420d1c1bcedbba909391" + +[[package]] +name = "ppv-lite86" +version = "0.2.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "85eae3c4ed2f50dcfe72643da4befc30deadb458a9b590d720cde2f2b1e97da9" +dependencies = [ + "zerocopy", +] + +[[package]] +name = "printpdf" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c30a4cc87c3ca9a98f4970db158a7153f8d1ec8076e005751173c57836380b1d" +dependencies = [ + "js-sys", + "lopdf 0.31.0", + "owned_ttf_parser 0.19.0", + "time", +] + +[[package]] +name = "proc-macro-crate" +version = "3.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e67ba7e9b2b56446f1d419b1d807906278ffa1a658a8a5d8a39dcb1f5a78614f" +dependencies = [ + "toml_edit", +] + +[[package]] +name = "proc-macro2" +version = "1.0.107" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "985e7ec9bb745e6ce6535b544d84d6cd6f7ad8bd711c398938ae983b91a766d9" +dependencies = [ + "unicode-ident", +] + +[[package]] +name = "profiling" +version = "1.0.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3d595e54a326bc53c1c197b32d295e14b169e3cfeaa8dc82b529f947fba6bcf5" +dependencies = [ + "profiling-procmacros", +] + +[[package]] +name = "profiling-procmacros" +version = "1.0.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4488a4a36b9a4ba6b9334a32a39971f77c1436ec82c38707bce707699cc3bbcb" +dependencies = [ + "quote", + "syn 2.0.119", +] + +[[package]] +name = "pulldown-cmark" +version = "0.12.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f86ba2052aebccc42cbbb3ed234b8b13ce76f75c3551a303cb2bcffcff12bb14" +dependencies = [ + "bitflags 2.13.1", + "getopts", + "memchr", + "pulldown-cmark-escape", + "unicase", +] + +[[package]] +name = "pulldown-cmark-escape" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "007d8adb5ddab6f8e3f491ac63566a7d5002cc7ed73901f72057943fa71ae1ae" + +[[package]] +name = "pulp" +version = "0.22.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "046aa45b989642ec2e4717c8e72d677b13edd831a4d3b6cf37d9a3e54912496a" +dependencies = [ + "bytemuck", + "cfg-if", + "libm", + "num-complex", + "paste", + "pulp-wasm-simd-flag", + "raw-cpuid", + "reborrow", + "version_check", +] + +[[package]] +name = "pulp-wasm-simd-flag" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1d8f70e07b9c3962945a74e59ca1c511bba65b6419468acc217c457d93f3c740" + +[[package]] +name = "pxfm" +version = "0.1.30" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d55d956fa96f5ec02be2e13af0e20391a5aa83d6a074e3ad368959d0fab299ea" + +[[package]] +name = "qoi" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7f6d64c71eb498fe9eae14ce4ec935c555749aef511cca85b5568910d6e48001" +dependencies = [ + "bytemuck", +] + +[[package]] +name = "quick-error" +version = "2.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a993555f31e5a609f617c12db6250dedcac1b0a85076912c436e6fc9b2c8e6a3" + +[[package]] +name = "quick-xml" +version = "0.41.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e660451e55124f798a69a5af3f49ccfbefbd41910eefd25caf2393e1f3473ec1" +dependencies = [ + "memchr", +] + +[[package]] +name = "quinn" +version = "0.11.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0c1a41e437b6bbd489372cd4971de128e85c855f56c57f283d20ff016cf7c0a8" +dependencies = [ + "bytes", + "cfg_aliases", + "pin-project-lite", + "quinn-proto", + "quinn-udp", + "rustc-hash", + "rustls", + "socket2", + "thiserror 2.0.19", + "tokio", + "tracing", + "web-time", +] + +[[package]] +name = "quinn-proto" +version = "0.11.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2f4bfc015262b9df63c8845072ce59068853ff5872180c2ce2f13038b970e560" +dependencies = [ + "bytes", + "getrandom 0.4.3", + "lru-slab", + "rand 0.10.2", + "rand_pcg", + "ring", + "rustc-hash", + "rustls", + "rustls-pki-types", + "slab", + "thiserror 2.0.19", + "tinyvec", + "tracing", + "web-time", +] + +[[package]] +name = "quinn-udp" +version = "0.5.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "35a133f956daabe89a61a685c2649f13d82d5aa4bd5d12d1277e1072a21c0694" +dependencies = [ + "cfg_aliases", + "libc", + "once_cell", + "socket2", + "tracing", + "windows-sys 0.61.2", +] + +[[package]] +name = "quote" +version = "1.0.47" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1fbf4db142a473a8d80c26bbf18454ed458bf8d26c8219c331daecfdbd079001" +dependencies = [ + "proc-macro2", +] + +[[package]] +name = "r-efi" +version = "5.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "69cdb34c158ceb288df11e18b4bd39de994f6657d83847bdffdbd7f346754b0f" + +[[package]] +name = "r-efi" +version = "6.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f8dcc9c7d52a811697d2151c701e0d08956f92b0e24136cf4cf27b57a6a0d9bf" + +[[package]] +name = "rand" +version = "0.8.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "22f6172bdec972074665ed81ed53b71da00bfc44b65a753cfde883ec4c702a1a" +dependencies = [ + "libc", + "rand_chacha 0.3.1", + "rand_core 0.6.4", +] + +[[package]] +name = "rand" +version = "0.9.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b9ef1d0d795eb7d84685bca4f72f3649f064e6641543d3a8c415898726a57b41" +dependencies = [ + "rand_chacha 0.9.0", + "rand_core 0.9.5", +] + +[[package]] +name = "rand" +version = "0.10.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c7f5fa3a058cd35567ef9bfa5e75732bee0f9e4c55fa90477bef2dfcdbc4be80" +dependencies = [ + "chacha20", + "getrandom 0.4.3", + "rand_core 0.10.1", +] + +[[package]] +name = "rand_chacha" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88" +dependencies = [ + "ppv-lite86", + "rand_core 0.6.4", +] + +[[package]] +name = "rand_chacha" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3022b5f1df60f26e1ffddd6c66e8aa15de382ae63b3a0c1bfc0e4d3e3f325cb" +dependencies = [ + "ppv-lite86", + "rand_core 0.9.5", +] + +[[package]] +name = "rand_core" +version = "0.6.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" +dependencies = [ + "getrandom 0.2.17", +] + +[[package]] +name = "rand_core" +version = "0.9.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "76afc826de14238e6e8c374ddcc1fa19e374fd8dd986b0d2af0d02377261d83c" +dependencies = [ + "getrandom 0.3.4", +] + +[[package]] +name = "rand_core" +version = "0.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "63b8176103e19a2643978565ca18b50549f6101881c443590420e4dc998a3c69" + +[[package]] +name = "rand_distr" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "32cb0b9bc82b0a0876c2dd994a7e7a2683d3e7390ca40e6886785ef0c7e3ee31" +dependencies = [ + "num-traits", + "rand 0.8.7", +] + +[[package]] +name = "rand_pcg" +version = "0.10.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "caa0f4137e1c0a72f4c651489402276c8e8e1cf081f3b0ba156d2cbeef09e86a" +dependencies = [ + "rand_core 0.10.1", +] + +[[package]] +name = "rangemap" +version = "1.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "973443cf09a9c8656b574a866ab68dfa19f0867d0340648c7d2f6a71b8a8ea68" + +[[package]] +name = "rav1e" +version = "0.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "43b6dd56e85d9483277cde964fd1bdb0428de4fec5ebba7540995639a21cb32b" +dependencies = [ + "aligned-vec", + "arbitrary", + "arg_enum_proc_macro", + "arrayvec", + "av-scenechange", + "av1-grain", + "bitstream-io", + "built", + "cfg-if", + "interpolate_name", + "itertools 0.14.0", + "libc", + "libfuzzer-sys", + "log", + "maybe-rayon", + "new_debug_unreachable", + "noop_proc_macro", + "num-derive", + "num-traits", + "paste", + "profiling", + "rand 0.9.5", + "rand_chacha 0.9.0", + "simd_helpers", + "thiserror 2.0.19", + "v_frame", + "wasm-bindgen", +] + +[[package]] +name = "ravif" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e52310197d971b0f5be7fe6b57530dcd27beb35c1b013f29d66c1ad73fbbcc45" +dependencies = [ + "avif-serialize", + "imgref", + "loop9", + "quick-error", + "rav1e", + "rayon", + "rgb", +] + +[[package]] +name = "raw-cpuid" +version = "11.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "498cd0dc59d73224351ee52a95fee0f1a617a2eae0e7d9d720cc622c73a54186" +dependencies = [ + "bitflags 2.13.1", +] + +[[package]] +name = "raw-window-handle" +version = "0.6.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "20675572f6f24e9e76ef639bc5552774ed45f1c30e2951e1e99c59888861c539" + +[[package]] +name = "rawpointer" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "60a357793950651c4ed0f3f52338f53b2f809f32d83a07f72909fa13e4c6c1e3" + +[[package]] +name = "rayon" +version = "1.12.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fb39b166781f92d482534ef4b4b1b2568f42613b53e5b6c160e24cfbfa30926d" +dependencies = [ + "either", + "rayon-core", +] + +[[package]] +name = "rayon-core" +version = "1.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "22e18b0f0062d30d4230b2e85ff77fdfe4326feb054b9783a3460d8435c8ab91" +dependencies = [ + "crossbeam-deque", + "crossbeam-utils", +] + +[[package]] +name = "reborrow" +version = "0.5.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "03251193000f4bd3b042892be858ee50e8b3719f2b08e5833ac4353724632430" + +[[package]] +name = "redox_syscall" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4722d768eff46b75989dd134e5c353f0d6296e5aaa3132e776cbdb56be7731aa" +dependencies = [ + "bitflags 1.3.2", +] + +[[package]] +name = "redox_syscall" +version = "0.5.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ed2bf2547551a7053d6fdfafda3f938979645c44812fbfcda098faae3f1a362d" +dependencies = [ + "bitflags 2.13.1", +] + +[[package]] +name = "redox_syscall" +version = "0.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "07507be7b4a5f9f26eeb41eeaebb1f5a7ff29dfb29739facc21d35bf8b11c21e" +dependencies = [ + "bitflags 2.13.1", +] + +[[package]] +name = "regex-automata" +version = "0.4.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8fcfdb36bda0c880c5931cdc7a2bcdc8ba4556847b9d912bca70bc94708711ad" + +[[package]] +name = "reqwest" +version = "0.12.28" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eddd3ca559203180a307f12d114c268abf583f59b03cb906fd0b3ff8646c1147" +dependencies = [ + "base64", + "bytes", + "futures-channel", + "futures-core", + "futures-util", + "http", + "http-body", + "http-body-util", + "hyper", + "hyper-rustls", + "hyper-util", + "js-sys", + "log", + "percent-encoding", + "pin-project-lite", + "quinn", + "rustls", + "rustls-pki-types", + "serde", + "serde_json", + "serde_urlencoded", + "sync_wrapper", + "tokio", + "tokio-rustls", + "tower", + "tower-http", + "tower-service", + "url", + "wasm-bindgen", + "wasm-bindgen-futures", + "web-sys", + "webpki-roots", +] + +[[package]] +name = "rfd" +version = "0.15.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ef2bee61e6cffa4635c72d7d81a84294e28f0930db0ddcb0f66d10244674ebed" +dependencies = [ + "ashpd", + "block2 0.6.2", + "dispatch2", + "js-sys", + "log", + "objc2 0.6.4", + "objc2-app-kit 0.3.2", + "objc2-core-foundation", + "objc2-foundation 0.3.2", + "pollster", + "raw-window-handle", + "urlencoding", + "wasm-bindgen", + "wasm-bindgen-futures", + "web-sys", + "windows-sys 0.59.0", +] + +[[package]] +name = "rgb" +version = "0.8.53" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "47b34b781b31e5d73e9fbc8689c70551fd1ade9a19e3e28cfec8580a79290cc4" + +[[package]] +name = "ring" +version = "0.17.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a4689e6c2294d81e88dc6261c768b63bc4fcdb852be6d1352498b114f61383b7" +dependencies = [ + "cc", + "cfg-if", + "getrandom 0.2.17", + "libc", + "untrusted", + "windows-sys 0.52.0", +] + +[[package]] +name = "rustc-hash" +version = "2.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6b1e7f9a428571be2dc5bc0505c13fb6bf936822b894ec87abf8a08a4e51742d" + +[[package]] +name = "rustc_version" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cfcb3a22ef46e85b45de6ee7e79d063319ebb6594faafcf1c225ea92ab6e9b92" +dependencies = [ + "semver", +] + +[[package]] +name = "rustix" +version = "0.38.44" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fdb5bc1ae2baa591800df16c9ca78619bf65c0488b41b96ccec5d11220d8c154" +dependencies = [ + "bitflags 2.13.1", + "errno", + "libc", + "linux-raw-sys 0.4.15", + "windows-sys 0.59.0", +] + +[[package]] +name = "rustix" +version = "1.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6fe4565b9518b83ef4f91bb47ce29620ca828bd32cb7e408f0062e9930ba190" +dependencies = [ + "bitflags 2.13.1", + "errno", + "libc", + "linux-raw-sys 0.12.1", + "windows-sys 0.61.2", +] + +[[package]] +name = "rustls" +version = "0.23.43" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0283386ce02abc0151e1761d08802dfe86c173b0b494af5cbc086574e453da06" +dependencies = [ + "once_cell", + "ring", + "rustls-pki-types", + "rustls-webpki", + "subtle", + "zeroize", +] + +[[package]] +name = "rustls-pki-types" +version = "1.15.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2f4925028c7eb5d1fcdaf196971378ed9d2c1c4efc7dc5d011256f76c99c0a96" +dependencies = [ + "web-time", + "zeroize", +] + +[[package]] +name = "rustls-webpki" +version = "0.103.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "61c429a8649f110dddef65e2a5ad240f747e85f7758a6bccc7e5777bd33f756e" +dependencies = [ + "ring", + "rustls-pki-types", + "untrusted", +] + +[[package]] +name = "rustversion" +version = "1.0.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cf54715a573b99ac80df0bc206da022bcd442c974952c7b9720069370852e21f" + +[[package]] +name = "ryu" +version = "1.0.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9774ba4a74de5f7b1c1451ed6cd5285a32eddb5cccb8cc655a4e50009e06477f" + +[[package]] +name = "safe_arch" +version = "0.7.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "96b02de82ddbe1b636e6170c21be622223aea188ef2e139be0a5b219ec215323" +dependencies = [ + "bytemuck", +] + +[[package]] +name = "same-file" +version = "1.0.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "93fc1dc3aaa9bfed95e02e6eadabb4baf7e3078b0bd1b4d7b6b0b68378900502" +dependencies = [ + "winapi-util", +] + +[[package]] +name = "scoped-tls" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e1cf6437eb19a8f4a6cc0f7dca544973b0b78843adbfeb3683d1a94a0024a294" + +[[package]] +name = "scopeguard" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" + +[[package]] +name = "semver" +version = "1.0.28" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8a7852d02fc848982e0c167ef163aaff9cd91dc640ba85e263cb1ce46fae51cd" + +[[package]] +name = "serde" +version = "1.0.229" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4148590afebada386688f18773da617792bf2ef03ffc1e4cbd2b1d45b023e0ba" +dependencies = [ + "serde_core", + "serde_derive", +] + +[[package]] +name = "serde_core" +version = "1.0.229" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "67dca2c9c51e58a4791a4b1ed58308b39c64224d349a935ab5039aa360942a48" +dependencies = [ + "serde_derive", +] + +[[package]] +name = "serde_derive" +version = "1.0.229" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e7a5d71263a5a7d47b41f6b3f06ba276f10cc18b0931f1799f710578e2309348" +dependencies = [ + "proc-macro2", + "quote", + "syn 3.0.3", +] + +[[package]] +name = "serde_json" +version = "1.0.151" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c841b55ecdae098c80dcae9cf767f6f8a0c2cdb3416bbef72181df4d0fe73f14" +dependencies = [ + "itoa", + "memchr", + "serde", + "serde_core", + "zmij", +] + +[[package]] +name = "serde_repr" +version = "0.1.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8d3b1629de253c70a0508c3899572da79ca359fdab27c7920ff00406df418906" +dependencies = [ + "proc-macro2", + "quote", + "syn 3.0.3", +] + +[[package]] +name = "serde_urlencoded" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3491c14715ca2294c4d6a88f15e84739788c1d030eed8c110436aafdaa2f3fd" +dependencies = [ + "form_urlencoded", + "itoa", + "ryu", + "serde", +] + +[[package]] +name = "shlex" +version = "2.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f8fadd59c855ef2080decdef8ff161eb6661b86933c9d82e5ba29dc602a55aba" + +[[package]] +name = "signal-hook-registry" +version = "1.4.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c4db69cba1110affc0e9f7bcd48bbf87b3f4fc7c61fc9155afd4c469eb3d6c1b" +dependencies = [ + "errno", + "libc", +] + +[[package]] +name = "simba" +version = "0.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "061507c94fc6ab4ba1c9a0305018408e312e17c041eb63bef8aa726fa33aceae" +dependencies = [ + "approx", + "num-complex", + "num-traits", + "paste", + "wide", +] + +[[package]] +name = "simd-adler32" +version = "0.3.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3a219298ac11a56ea9a6d2120044824d6f01aeb034955e7af7bc16858527deea" + +[[package]] +name = "simd_cesu8" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "11031e251abf8611c80f460e19dbdeb54a66db918e49c65a7065b46ac7aec520" +dependencies = [ + "rustc_version", + "simdutf8", +] + +[[package]] +name = "simd_helpers" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "95890f873bec569a0362c235787f3aca6e1e887302ba4840839bcc6459c42da6" +dependencies = [ + "quote", +] + +[[package]] +name = "simdutf8" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e3a9fe34e3e7a50316060351f37187a3f546bce95496156754b601a5fa71b76e" + +[[package]] +name = "slab" +version = "0.4.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0c790de23124f9ab44544d7ac05d60440adc586479ce501c1d6d7da3cd8c9cf5" + +[[package]] +name = "slotmap" +version = "1.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bdd58c3c93c3d278ca835519292445cb4b0d4dc59ccfdf7ceadaab3f8aeb4038" +dependencies = [ + "version_check", +] + +[[package]] +name = "smallvec" +version = "1.15.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8ed6a63f02c8539c91a8685a86f4099661ba3da017932f6ebbea6de3f0fa7c90" + +[[package]] +name = "smithay-client-toolkit" +version = "0.20.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0512da38f5e2b31201a93524adb8d3136276fa4fe4aafab4e1f727a82b534cc0" +dependencies = [ + "bitflags 2.13.1", + "calloop 0.14.4", + "calloop-wayland-source", + "cursor-icon", + "libc", + "log", + "memmap2", + "rustix 1.1.4", + "thiserror 2.0.19", + "wayland-backend", + "wayland-client", + "wayland-csd-frame", + "wayland-cursor", + "wayland-protocols", + "wayland-protocols-experimental", + "wayland-protocols-misc", + "wayland-protocols-wlr", + "wayland-scanner", + "xkeysym", +] + +[[package]] +name = "smithay-clipboard" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "71704c03f739f7745053bde45fa203a46c58d25bc5c4efba1d9a60e9dba81226" +dependencies = [ + "libc", + "smithay-client-toolkit", + "wayland-backend", +] + +[[package]] +name = "smol_str" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dd538fb6910ac1099850255cf94a94df6551fbdd602454387d0adb2d1ca6dead" +dependencies = [ + "serde", +] + +[[package]] +name = "socket2" +version = "0.6.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c3d1e2c7f27f8d4cb10542a02c49005dbd6e93095799d6f3be745fae9f8fedd4" +dependencies = [ + "libc", + "windows-sys 0.61.2", +] + +[[package]] +name = "stable_deref_trait" +version = "1.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6ce2be8dc25455e1f91df71bfa12ad37d7af1092ae736f3a6cd0e37bc7810596" + +[[package]] +name = "static_assertions" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f" + +[[package]] +name = "strsim" +version = "0.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f" + +[[package]] +name = "subtle" +version = "2.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "13c2bddecc57b384dee18652358fb23172facb8a2c51ccc10d74c157bdea3292" + +[[package]] +name = "syn" +version = "2.0.119" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "872831b642d1a07999a962a351ed35b955ea2cfc8f3862091e2a240a84f17297" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + +[[package]] +name = "syn" +version = "3.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "53e9bae58849f64dfa4f5d5ae372c8341f7305f82a3868709269343628b659a3" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + +[[package]] +name = "sync_wrapper" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0bf256ce5efdfa370213c1dabab5935a12e49f2c58d15e9eac2870d3b4f27263" +dependencies = [ + "futures-core", +] + +[[package]] +name = "synstructure" +version = "0.13.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "728a70f3dbaf5bab7f0c4b1ac8d7ae5ea60a4b5549c8a5914361c99147a709d2" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.119", +] + +[[package]] +name = "tempfile" +version = "3.27.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "32497e9a4c7b38532efcdebeef879707aa9f794296a4f0244f6f69e9bc8574bd" +dependencies = [ + "fastrand", + "getrandom 0.4.3", + "once_cell", + "rustix 1.1.4", + "windows-sys 0.61.2", +] + +[[package]] +name = "thiserror" +version = "1.0.69" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6aaf5339b578ea85b50e080feb250a3e8ae8cfcdff9a461c9ec2904bc923f52" +dependencies = [ + "thiserror-impl 1.0.69", +] + +[[package]] +name = "thiserror" +version = "2.0.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "09a43598840e33d5b0331f38c5e30d13bb11c11210a4b58f0d9b18a5a5eefcd9" +dependencies = [ + "thiserror-impl 2.0.19", +] + +[[package]] +name = "thiserror-impl" +version = "1.0.69" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4fee6c4efc90059e10f81e6d42c60a18f76588c3d74cb83a0b242a2b6c7504c1" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.119", +] + +[[package]] +name = "thiserror-impl" +version = "2.0.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "43cbfe0cf76104d42a574802844187e84a305e531ed54455f11fbde0f10541cd" +dependencies = [ + "proc-macro2", + "quote", + "syn 3.0.3", +] + +[[package]] +name = "tiff" +version = "0.11.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b63feaf3343d35b6ca4d50483f94843803b0f51634937cc2ec519fc32232bc52" +dependencies = [ + "fax", + "flate2", + "half", + "quick-error", + "weezl", + "zune-jpeg", +] + +[[package]] +name = "time" +version = "0.3.54" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3e1d5e639ff6bab73cb6885cc7e7b1de96c3f32c68ec55f3952614bec1092244" +dependencies = [ + "deranged", + "num-conv", + "powerfmt", + "serde_core", + "time-core", + "time-macros", +] + +[[package]] +name = "time-core" +version = "0.1.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9e1c906769ad99c88eaa54e728060edef082f8e358ff32030cb7c7d315e81109" + +[[package]] +name = "time-macros" +version = "0.2.32" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7e689342a48d2ea927c87ea50cabf8594854bf940e9310208848d680d668ed85" +dependencies = [ + "num-conv", + "time-core", +] + +[[package]] +name = "tinystr" +version = "0.8.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c8323304221c2a851516f22236c5722a72eaa19749016521d6dff0824447d96d" +dependencies = [ + "displaydoc", + "zerovec", +] + +[[package]] +name = "tinyvec" +version = "1.12.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bb4ebadaa0af04fab11ae01eb5f9fdb5f9c5b875506e210e71c07873528baa7f" +dependencies = [ + "tinyvec_macros", +] + +[[package]] +name = "tinyvec_macros" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" + +[[package]] +name = "tokio" +version = "1.53.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "202caea871b69668250d242070849eb495be178ed697a3e98aebce5bc81a0bed" +dependencies = [ + "bytes", + "libc", + "mio", + "pin-project-lite", + "socket2", + "windows-sys 0.61.2", +] + +[[package]] +name = "tokio-rustls" +version = "0.26.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1729aa945f29d91ba541258c8df89027d5792d85a8841fb65e8bf0f4ede4ef61" +dependencies = [ + "rustls", + "tokio", +] + +[[package]] +name = "toml_datetime" +version = "1.1.1+spec-1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3165f65f62e28e0115a00b2ebdd37eb6f3b641855f9d636d3cd4103767159ad7" +dependencies = [ + "serde_core", +] + +[[package]] +name = "toml_edit" +version = "0.25.13+spec-1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6975367e4d2ef766d86af01ffad14b622fecc8d4357a998fbc4deb6e9bacaf9b" +dependencies = [ + "indexmap", + "toml_datetime", + "toml_parser", + "winnow", +] + +[[package]] +name = "toml_parser" +version = "1.1.3+spec-1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1d38ac1cf9b95face32296c0a3ede1fdc270627c9d9c02a7274dd6d960dc4d56" +dependencies = [ + "winnow", +] + +[[package]] +name = "tower" +version = "0.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ebe5ef63511595f1344e2d5cfa636d973292adc0eec1f0ad45fae9f0851ab1d4" +dependencies = [ + "futures-core", + "futures-util", + "pin-project-lite", + "sync_wrapper", + "tokio", + "tower-layer", + "tower-service", +] + +[[package]] +name = "tower-http" +version = "0.6.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4cfcf7e2740e6fc6d4d688b4ef00650406bb94adf4731e43c096c3a19fe40840" +dependencies = [ + "bitflags 2.13.1", + "bytes", + "futures-util", + "http", + "http-body", + "pin-project-lite", + "tower", + "tower-layer", + "tower-service", + "url", +] + +[[package]] +name = "tower-layer" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "121c2a6cda46980bb0fcd1647ffaf6cd3fc79a013de288782836f6df9c48780e" + +[[package]] +name = "tower-service" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8df9b6e13f2d32c91b9bd719c00d1958837bc7dec474d94952798cc8e69eeec3" + +[[package]] +name = "tracing" +version = "0.1.44" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "63e71662fa4b2a2c3a26f570f037eb95bb1f85397f3cd8076caed2f026a6d100" +dependencies = [ + "log", + "pin-project-lite", + "tracing-attributes", + "tracing-core", +] + +[[package]] +name = "tracing-attributes" +version = "0.1.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7490cfa5ec963746568740651ac6781f701c9c5ea257c58e057f3ba8cf69e8da" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.119", +] + +[[package]] +name = "tracing-core" +version = "0.1.36" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "db97caf9d906fbde555dd62fa95ddba9eecfd14cb388e4f491a66d74cd5fb79a" +dependencies = [ + "once_cell", +] + +[[package]] +name = "try-lock" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e421abadd41a4225275504ea4d6566923418b7f05506fbc9c0fe86ba7396114b" + +[[package]] +name = "ttf-parser" +version = "0.19.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "49d64318d8311fc2668e48b63969f4343e0a85c4a109aa8460d6672e364b8bd1" + +[[package]] +name = "ttf-parser" +version = "0.25.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d2df906b07856748fa3f6e0ad0cbaa047052d4a7dd609e231c4f72cee8c36f31" + +[[package]] +name = "type1-encoding-parser" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fa10c302f5a53b7ad27fd42a3996e23d096ba39b5b8dd6d9e683a05b01bee749" +dependencies = [ + "pom 1.1.0", +] + +[[package]] +name = "typenum" +version = "1.20.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6f5e870be6c3b371b77fe0ee0bafb859fa4964b4404c27de1d380043c4dda20" + +[[package]] +name = "uds_windows" +version = "1.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f2f6fb2847f6742cd76af783a2a2c49e9375d0a111c7bef6f71cd9e738c72d6e" +dependencies = [ + "memoffset", + "tempfile", + "windows-sys 0.61.2", +] + +[[package]] +name = "unicase" +version = "2.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dbc4bc3a9f746d862c45cb89d705aa10f187bb96c76001afab07a0d35ce60142" + +[[package]] +name = "unicode-ident" +version = "1.0.24" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e6e4313cd5fcd3dad5cafa179702e2b244f760991f45397d14d4ebf38247da75" + +[[package]] +name = "unicode-normalization" +version = "0.1.25" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5fd4f6878c9cb28d874b009da9e8d183b5abc80117c40bbd187a1fde336be6e8" +dependencies = [ + "tinyvec", +] + +[[package]] +name = "unicode-segmentation" +version = "1.13.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c6f5d3c3b1bf09027a88a6bc961fc00497d651009560b5463668dc81b0fa87a8" + +[[package]] +name = "unicode-width" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b4ac048d71ede7ee76d585517add45da530660ef4390e49b098733c6e897f254" + +[[package]] +name = "untrusted" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8ecb6da28b8a351d773b68d5825ac39017e680750f980f3a1a85cd8dd28a47c1" + +[[package]] +name = "url" +version = "2.5.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ff67a8a4397373c3ef660812acab3268222035010ab8680ec4215f38ba3d0eed" +dependencies = [ + "form_urlencoded", + "idna", + "percent-encoding", + "serde", + "serde_derive", +] + +[[package]] +name = "urlencoding" +version = "2.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "daf8dba3b7eb870caf1ddeed7bc9d2a049f3cfdfae7cb521b087cc33ae4c49da" + +[[package]] +name = "utf8_iter" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6c140620e7ffbb22c2dee59cafe6084a59b5ffc27a8859a5f0d494b5d52b6be" + +[[package]] +name = "utf8parse" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "06abde3611657adf66d383f00b093d7faecc7fa57071cce2578660c9f1010821" + +[[package]] +name = "uuid" +version = "1.24.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bf3923a6f5c4c6382e0b653c4117f48d631ea17f38ed86e2a828e6f7412f5239" +dependencies = [ + "js-sys", + "serde_core", + "wasm-bindgen", +] + +[[package]] +name = "v_frame" +version = "0.3.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "666b7727c8875d6ab5db9533418d7c764233ac9c0cff1d469aec8fa127597be2" +dependencies = [ + "aligned-vec", + "num-traits", + "wasm-bindgen", +] + +[[package]] +name = "version_check" +version = "0.9.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b928f33d975fc6ad9f86c8f283853ad26bdd5b10b7f1542aa2fa15e2289105a" + +[[package]] +name = "walkdir" +version = "2.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "29790946404f91d9c5d06f9874efddea1dc06c5efe94541a7d6863108e3a5e4b" +dependencies = [ + "same-file", + "winapi-util", +] + +[[package]] +name = "want" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bfa7760aed19e106de2c7c0b581b509f2f25d3dacaf737cb82ac61bc6d760b0e" +dependencies = [ + "try-lock", +] + +[[package]] +name = "wasi" +version = "0.11.1+wasi-snapshot-preview1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ccf3ec651a847eb01de73ccad15eb7d99f80485de043efb2f370cd654f4ea44b" + +[[package]] +name = "wasip2" +version = "1.0.4+wasi-0.2.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b67efb37e106e55ce722a510d6b5f9c17f083e5fc79afc2badeb12cc313d9487" +dependencies = [ + "wit-bindgen", +] + +[[package]] +name = "wasm-bindgen" +version = "0.2.126" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4b067c0c11094aef6b7a801c1e34a26affafdf3d051dba08456b868789aaf9a4" +dependencies = [ + "cfg-if", + "once_cell", + "rustversion", + "wasm-bindgen-macro", + "wasm-bindgen-shared", +] + +[[package]] +name = "wasm-bindgen-futures" +version = "0.4.76" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c62df1340f32221cb9c54d6a27b030e3dba64361d4a95bed55f9aacb44da291d" +dependencies = [ + "js-sys", + "wasm-bindgen", +] + +[[package]] +name = "wasm-bindgen-macro" +version = "0.2.126" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "167ce5e579f6bcf889c4f7175a8a5a585de84e8ff93976ce393efa5f2837aab1" +dependencies = [ + "quote", + "wasm-bindgen-macro-support", +] + +[[package]] +name = "wasm-bindgen-macro-support" +version = "0.2.126" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f3997c7839262f4ef12cf90b818d6340c18e80f263f1a94bf157d0ec4420380e" +dependencies = [ + "bumpalo", + "proc-macro2", + "quote", + "syn 2.0.119", + "wasm-bindgen-shared", +] + +[[package]] +name = "wasm-bindgen-shared" +version = "0.2.126" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dc1b4cb0cc549fcf58d7dfc081778139b3d283a081644e833e84682ad71cea24" +dependencies = [ + "unicode-ident", +] + +[[package]] +name = "wayland-backend" +version = "0.3.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "016ccf01d1c58b6f8999612813e17c9b2390f7d70671428869913310f83f54b8" +dependencies = [ + "cc", + "downcast-rs", + "rustix 1.1.4", + "scoped-tls", + "smallvec", + "wayland-sys", +] + +[[package]] +name = "wayland-client" +version = "0.31.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e3c36a0f861ad76d0901f2800b46321410d9f73f2ea88aac0650d86c32688073" +dependencies = [ + "bitflags 2.13.1", + "rustix 1.1.4", + "wayland-backend", + "wayland-scanner", +] + +[[package]] +name = "wayland-csd-frame" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "625c5029dbd43d25e6aa9615e88b829a5cad13b2819c4ae129fdbb7c31ab4c7e" +dependencies = [ + "bitflags 2.13.1", + "cursor-icon", + "wayland-backend", +] + +[[package]] +name = "wayland-cursor" +version = "0.31.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4a52d18780be9b1314328a3de5f930b73d2200112e3849ca6cb11822793fb34d" +dependencies = [ + "rustix 1.1.4", + "wayland-client", + "xcursor", +] + +[[package]] +name = "wayland-protocols" +version = "0.32.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "23d0c813de3daa2ed6520af85a3bd49b0e722a3078506899aa9686fea58dc4b6" +dependencies = [ + "bitflags 2.13.1", + "wayland-backend", + "wayland-client", + "wayland-scanner", +] + +[[package]] +name = "wayland-protocols-experimental" +version = "20250721.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "40a1f863128dcaaec790d7b4b396cc9b9a7a079e878e18c47e6c2d2c5a8dcbb1" +dependencies = [ + "bitflags 2.13.1", + "wayland-backend", + "wayland-client", + "wayland-protocols", + "wayland-scanner", +] + +[[package]] +name = "wayland-protocols-misc" +version = "0.3.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6e9567599ef23e09b8dad6e429e5738d4509dfc46b3b21f32841a304d16b29c8" +dependencies = [ + "bitflags 2.13.1", + "wayland-backend", + "wayland-client", + "wayland-protocols", + "wayland-scanner", +] + +[[package]] +name = "wayland-protocols-wlr" +version = "0.3.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eb04e52f7836d7c7976c78ca0250d61e33873c34156a2a1fc9474828ec268234" +dependencies = [ + "bitflags 2.13.1", + "wayland-backend", + "wayland-client", + "wayland-protocols", + "wayland-scanner", +] + +[[package]] +name = "wayland-scanner" +version = "0.31.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "338e30461b3a2b67d70eb30a6d89f8e0c93a833e07d2ae89085cd070c4a00ac0" +dependencies = [ + "proc-macro2", + "quick-xml", + "quote", +] + +[[package]] +name = "wayland-sys" +version = "0.31.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d8eab23fefc9e41f8e841df4a9c707e8a8c4ed26e944ef69297184de2785e3be" +dependencies = [ + "dlib", + "log", + "once_cell", + "pkg-config", +] + +[[package]] +name = "web-sys" +version = "0.3.103" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8622dcb61c0bcc9fffa6938bed81210af2da9a7e4a1a834b2e37a59b6dfb6141" +dependencies = [ + "js-sys", + "wasm-bindgen", +] + +[[package]] +name = "web-time" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5a6580f308b1fad9207618087a65c04e7a10bc77e02c8e84e9b00dd4b12fa0bb" +dependencies = [ + "js-sys", + "wasm-bindgen", +] + +[[package]] +name = "webbrowser" +version = "1.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ef62a3d5f7b2411119a11b6f62570dbff91d7105e011a20fb83fbf8f5761c40f" +dependencies = [ + "jni", + "log", + "ndk-context", + "objc2 0.6.4", + "objc2-app-kit 0.3.2", + "objc2-foundation 0.3.2", + "url", + "web-sys", +] + +[[package]] +name = "webpki-roots" +version = "1.0.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7dcd9d09a39985f5344844e66b0c530a33843579125f23e21e9f0f220850f22a" +dependencies = [ + "rustls-pki-types", +] + +[[package]] +name = "weezl" +version = "0.1.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a28ac98ddc8b9274cb41bb4d9d4d5c425b6020c50c46f25559911905610b4a88" + +[[package]] +name = "wide" +version = "0.7.33" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0ce5da8ecb62bcd8ec8b7ea19f69a51275e91299be594ea5cc6ef7819e16cd03" +dependencies = [ + "bytemuck", + "safe_arch", +] + +[[package]] +name = "winapi" +version = "0.3.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419" +dependencies = [ + "winapi-i686-pc-windows-gnu", + "winapi-x86_64-pc-windows-gnu", +] + +[[package]] +name = "winapi-i686-pc-windows-gnu" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" + +[[package]] +name = "winapi-util" +version = "0.1.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c2a7b1c03c876122aa43f3020e6c3c3ee5c05081c9a00739faf7503aeba10d22" +dependencies = [ + "windows-sys 0.61.2", +] + +[[package]] +name = "winapi-x86_64-pc-windows-gnu" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" + +[[package]] +name = "windows-core" +version = "0.62.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b8e83a14d34d0623b51dce9581199302a221863196a1dde71a7663a4c2be9deb" +dependencies = [ + "windows-implement", + "windows-interface", + "windows-link", + "windows-result", + "windows-strings", +] + +[[package]] +name = "windows-implement" +version = "0.60.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "053e2e040ab57b9dc951b72c264860db7eb3b0200ba345b4e4c3b14f67855ddf" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.119", +] + +[[package]] +name = "windows-interface" +version = "0.59.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3f316c4a2570ba26bbec722032c4099d8c8bc095efccdc15688708623367e358" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.119", +] + +[[package]] +name = "windows-link" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f0805222e57f7521d6a62e36fa9163bc891acd422f971defe97d64e70d0a4fe5" + +[[package]] +name = "windows-result" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7781fa89eaf60850ac3d2da7af8e5242a5ea78d1a11c49bf2910bb5a73853eb5" +dependencies = [ + "windows-link", +] + +[[package]] +name = "windows-strings" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7837d08f69c77cf6b07689544538e017c1bfcf57e34b4c0ff58e6c2cd3b37091" +dependencies = [ + "windows-link", +] + +[[package]] +name = "windows-sys" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d" +dependencies = [ + "windows-targets 0.52.6", +] + +[[package]] +name = "windows-sys" +version = "0.59.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e38bc4d79ed67fd075bcc251a1c39b32a1776bbe92e5bef1f0bf1f8c531853b" +dependencies = [ + "windows-targets 0.52.6", +] + +[[package]] +name = "windows-sys" +version = "0.60.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f2f500e4d28234f72040990ec9d39e3a6b950f9f22d3dba18416c35882612bcb" +dependencies = [ + "windows-targets 0.53.5", +] + +[[package]] +name = "windows-sys" +version = "0.61.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ae137229bcbd6cdf0f7b80a31df61766145077ddf49416a728b02cb3921ff3fc" +dependencies = [ + "windows-link", +] + +[[package]] +name = "windows-targets" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9b724f72796e036ab90c1021d4780d4d3d648aca59e491e6b98e725b84e99973" +dependencies = [ + "windows_aarch64_gnullvm 0.52.6", + "windows_aarch64_msvc 0.52.6", + "windows_i686_gnu 0.52.6", + "windows_i686_gnullvm 0.52.6", + "windows_i686_msvc 0.52.6", + "windows_x86_64_gnu 0.52.6", + "windows_x86_64_gnullvm 0.52.6", + "windows_x86_64_msvc 0.52.6", +] + +[[package]] +name = "windows-targets" +version = "0.53.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4945f9f551b88e0d65f3db0bc25c33b8acea4d9e41163edf90dcd0b19f9069f3" +dependencies = [ + "windows-link", + "windows_aarch64_gnullvm 0.53.1", + "windows_aarch64_msvc 0.53.1", + "windows_i686_gnu 0.53.1", + "windows_i686_gnullvm 0.53.1", + "windows_i686_msvc 0.53.1", + "windows_x86_64_gnu 0.53.1", + "windows_x86_64_gnullvm 0.53.1", + "windows_x86_64_msvc 0.53.1", +] + +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3" + +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.53.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a9d8416fa8b42f5c947f8482c43e7d89e73a173cead56d044f6a56104a6d1b53" + +[[package]] +name = "windows_aarch64_msvc" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469" + +[[package]] +name = "windows_aarch64_msvc" +version = "0.53.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b9d782e804c2f632e395708e99a94275910eb9100b2114651e04744e9b125006" + +[[package]] +name = "windows_i686_gnu" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e9b5ad5ab802e97eb8e295ac6720e509ee4c243f69d781394014ebfe8bbfa0b" + +[[package]] +name = "windows_i686_gnu" +version = "0.53.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "960e6da069d81e09becb0ca57a65220ddff016ff2d6af6a223cf372a506593a3" + +[[package]] +name = "windows_i686_gnullvm" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66" + +[[package]] +name = "windows_i686_gnullvm" +version = "0.53.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fa7359d10048f68ab8b09fa71c3daccfb0e9b559aed648a8f95469c27057180c" + +[[package]] +name = "windows_i686_msvc" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66" + +[[package]] +name = "windows_i686_msvc" +version = "0.53.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e7ac75179f18232fe9c285163565a57ef8d3c89254a30685b57d83a38d326c2" + +[[package]] +name = "windows_x86_64_gnu" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78" + +[[package]] +name = "windows_x86_64_gnu" +version = "0.53.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9c3842cdd74a865a8066ab39c8a7a473c0778a3f29370b5fd6b4b9aa7df4a499" + +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d" + +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.53.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0ffa179e2d07eee8ad8f57493436566c7cc30ac536a3379fdf008f47f6bb7ae1" + +[[package]] +name = "windows_x86_64_msvc" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec" + +[[package]] +name = "windows_x86_64_msvc" +version = "0.53.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d6bbff5f0aada427a1e5a6da5f1f98158182f26556f345ac9e04d36d0ebed650" + +[[package]] +name = "winit" +version = "0.30.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a6755fa58a9f8350bd1e472d4c3fcc25f824ec358933bba33306d0b63df5978d" +dependencies = [ + "android-activity", + "atomic-waker", + "bitflags 2.13.1", + "block2 0.5.1", + "calloop 0.13.0", + "cfg_aliases", + "concurrent-queue", + "core-foundation", + "core-graphics", + "cursor-icon", + "dpi", + "js-sys", + "libc", + "ndk", + "objc2 0.5.2", + "objc2-app-kit 0.2.2", + "objc2-foundation 0.2.2", + "objc2-ui-kit", + "orbclient", + "pin-project", + "raw-window-handle", + "redox_syscall 0.4.1", + "rustix 0.38.44", + "smol_str", + "tracing", + "unicode-segmentation", + "wasm-bindgen", + "wasm-bindgen-futures", + "web-sys", + "web-time", + "windows-sys 0.52.0", + "xkbcommon-dl", +] + +[[package]] +name = "winnow" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "23b97319f7b8343df12cc98938e5c3eb436064524c8d2b4e30a1d3a36eecdf81" +dependencies = [ + "memchr", +] + +[[package]] +name = "wit-bindgen" +version = "0.57.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1ebf944e87a7c253233ad6766e082e3cd714b5d03812acc24c318f549614536e" + +[[package]] +name = "writeable" +version = "0.6.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1ffae5123b2d3fc086436f8834ae3ab053a283cfac8fe0a0b8eaae044768a4c4" + +[[package]] +name = "x11rb" +version = "0.13.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9993aa5be5a26815fe2c3eacfc1fde061fc1a1f094bf1ad2a18bf9c495dd7414" +dependencies = [ + "gethostname", + "rustix 1.1.4", + "x11rb-protocol", +] + +[[package]] +name = "x11rb-protocol" +version = "0.13.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ea6fc2961e4ef194dcbfe56bb845534d0dc8098940c7e5c012a258bfec6701bd" + +[[package]] +name = "xcursor" +version = "0.3.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bec9e4a500ca8864c5b47b8b482a73d62e4237670e5b5f1d6b9e3cae50f28f2b" + +[[package]] +name = "xkbcommon-dl" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d039de8032a9a8856a6be89cea3e5d12fdd82306ab7c94d74e6deab2460651c5" +dependencies = [ + "bitflags 2.13.1", + "dlib", + "log", + "once_cell", + "xkeysym", +] + +[[package]] +name = "xkeysym" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b9cc00251562a284751c9973bace760d86c0276c471b4be569fe6b068ee97a56" + +[[package]] +name = "xml-rs" +version = "0.8.28" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3ae8337f8a065cfc972643663ea4279e04e7256de865aa66fe25cec5fb912d3f" + +[[package]] +name = "y4m" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7a5a4b21e1a62b67a2970e6831bc091d7b87e119e7f9791aef9702e3bef04448" + +[[package]] +name = "yoke" +version = "0.8.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "709fe23a0424b6a435d82152b1bd3fdfb0833487d5fa90d05d42762a9891fef5" +dependencies = [ + "stable_deref_trait", + "yoke-derive", + "zerofrom", +] + +[[package]] +name = "yoke-derive" +version = "0.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "de844c262c8848816172cef550288e7dc6c7b7814b4ee56b3e1553f275f1858e" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.119", + "synstructure", +] + +[[package]] +name = "zbus" +version = "5.18.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fe18fb60dc696039e738717b76eaea21e7a4489bbb1885020b43c94236d7e98a" +dependencies = [ + "async-broadcast", + "async-executor", + "async-io", + "async-lock", + "async-process", + "async-recursion", + "async-task", + "async-trait", + "blocking", + "enumflags2", + "event-listener", + "futures-core", + "futures-lite", + "hex", + "libc", + "ordered-stream", + "rustix 1.1.4", + "serde", + "serde_repr", + "tracing", + "uds_windows", + "uuid", + "windows-sys 0.61.2", + "winnow", + "zbus_macros", + "zbus_names", + "zvariant", +] + +[[package]] +name = "zbus_macros" +version = "5.18.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fe96480bed92df2b442a1a30df364e12d08eed03aeb061f2b8dc6afb2be91119" +dependencies = [ + "proc-macro-crate", + "proc-macro2", + "quote", + "syn 2.0.119", + "zbus_names", + "zvariant", + "zvariant_utils", +] + +[[package]] +name = "zbus_names" +version = "4.3.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d8bf88b4a3ff53e883001e0e0115b297a9d53c31b9c1edd2bfdd853e3428624e" +dependencies = [ + "serde", + "winnow", + "zvariant", +] + +[[package]] +name = "zerocopy" +version = "0.8.55" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b5a105cd7b140f6eeec8acff2ea38135d3cab283ada58540f629fe51e46696eb" +dependencies = [ + "zerocopy-derive", +] + +[[package]] +name = "zerocopy-derive" +version = "0.8.55" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0fe976fb70c78cd64cccfe3a6fc142244e8a77b70959b30faf9d0ac37ee228eb" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.119", +] + +[[package]] +name = "zerofrom" +version = "0.1.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0ec05a11813ea801ff6d75110ad09cd0824ddba17dfe17128ea0d5f68e6c5272" +dependencies = [ + "zerofrom-derive", +] + +[[package]] +name = "zerofrom-derive" +version = "0.1.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "11532158c46691caf0f2593ea8358fed6bbf68a0315e80aae9bd41fbade684a1" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.119", + "synstructure", +] + +[[package]] +name = "zeroize" +version = "1.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e13c156562582aa81c60cb29407084cdb54c4164760106ab78e6c5b0858cf64e" + +[[package]] +name = "zerotrie" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0f9152d31db0792fa83f70fb2f83148effb5c1f5b8c7686c3459e361d9bc20bf" +dependencies = [ + "displaydoc", + "yoke", + "zerofrom", +] + +[[package]] +name = "zerovec" +version = "0.11.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "90f911cbc359ab6af17377d242225f4d75119aec87ea711a880987b18cd7b239" +dependencies = [ + "yoke", + "zerofrom", + "zerovec-derive", +] + +[[package]] +name = "zerovec-derive" +version = "0.11.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "625dc425cab0dca6dc3c3319506e6593dcb08a9f387ea3b284dbd52a92c40555" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.119", +] + +[[package]] +name = "zmij" +version = "1.0.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "29666d0abbfad1e3dc4dcf6144730dd3a3ab225bbbdac83319345b1b44ccfc1b" + +[[package]] +name = "zune-core" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cb8a0807f7c01457d0379ba880ba6322660448ddebc890ce29bb64da71fb40f9" + +[[package]] +name = "zune-inflate" +version = "0.2.54" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "73ab332fe2f6680068f3582b16a24f90ad7096d5d39b974d1c0aff0125116f02" +dependencies = [ + "simd-adler32", +] + +[[package]] +name = "zune-jpeg" +version = "0.5.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "27bc9d5b815bc103f142aa054f561d9187d191692ec7c2d1e2b4737f8dbd7296" +dependencies = [ + "zune-core", +] + +[[package]] +name = "zvariant" +version = "5.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bee2a0bcd2a907786a456fff45aaaaf54c9ba5f50b71ae9ec1a4edd200c94911" +dependencies = [ + "endi", + "enumflags2", + "serde", + "url", + "winnow", + "zvariant_derive", + "zvariant_utils", +] + +[[package]] +name = "zvariant_derive" +version = "5.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "38a708216a18780796770bfe3f4739c7c83a3e8f789b755534bbbc06e4e23e12" +dependencies = [ + "proc-macro-crate", + "proc-macro2", + "quote", + "syn 2.0.119", + "zvariant_utils", +] + +[[package]] +name = "zvariant_utils" +version = "3.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "90cb9383f9b45290407a1258b202d3f8f01db719eb60b4e4055c6375af4fc7c7" +dependencies = [ + "proc-macro2", + "quote", + "serde", + "syn 2.0.119", + "winnow", +] diff --git a/tools/docforge/Cargo.toml b/tools/docforge/Cargo.toml new file mode 100644 index 0000000..8469d38 --- /dev/null +++ b/tools/docforge/Cargo.toml @@ -0,0 +1,32 @@ +[package] +name = "docforge" +version = "0.2.0" +edition = "2021" +description = "Portable documentation authoring tool for AUTO-MAS Docs" +license = "MIT" +default-run = "docforge" + +[dependencies] +anyhow = "1.0" +clap = { version = "4.5", features = ["derive"] } +eframe = { version = "0.32", default-features = false, features = ["default_fonts", "glow"] } +egui = "0.32" +image = { version = "0.25", default-features = false, features = ["png", "jpeg"] } +imageproc = "0.25" +lopdf = "0.34" +pdf-extract = "0.8" +printpdf = "0.7" +pulldown-cmark = "0.12" +reqwest = { version = "0.12", default-features = false, features = ["blocking", "json", "rustls-tls"] } +rfd = "0.15" +serde = { version = "1.0", features = ["derive"] } +serde_json = "1.0" +tempfile = "3.15" +unicode-width = "0.2" +walkdir = "2.5" +windows-sys = { version = "0.59", features = ["Win32_Storage_FileSystem"] } + +[profile.release] +codegen-units = 1 +lto = "thin" +strip = true diff --git a/tools/docforge/README.zh-CN.txt b/tools/docforge/README.zh-CN.txt new file mode 100644 index 0000000..43f29cc --- /dev/null +++ b/tools/docforge/README.zh-CN.txt @@ -0,0 +1,117 @@ +# DocForge:AUTO-MAS 中文文档工坊 + +DocForge 是专门为本仓库制作的 Windows 绿色文档工具。它使用 Rust 构建,直接运行 +`docforge.exe`,不会安装服务,也不会修改注册表、系统 PATH、文档站的 Node 依赖或 +VitePress 配置。 + +## 第一次使用 + +1. 解压 `docforge-portable-windows-x64.zip`,不要只把 EXE 单独拖出来。 +2. 双击 `docforge.exe`。 +3. 点击左上角“打开文档站”,选择 `AUTO-MAS-docs` 仓库根目录。 +4. 工具会自动打开“开始使用”文档;也可以从左侧资源管理器选择其他中文或英文文档。 +5. 中间是带行号的 Markdown 编辑器,右侧是同步预览和检查结果。 +6. 确认无误后点击右上角“保存文档”或按 `Ctrl+S`。 + +如果状态栏提示未找到 FFmpeg,请把 `ffmpeg.exe` 和 `ffprobe.exe` 放进绿色包的 +`bin` 文件夹。PDF 首页图片预览需要 Poppler 的 `pdftoppm.exe`;没有它时仍可使用 +PDF 文字预览和转换。 + +## 已支持的功能 + +- 自动识别本站的中文根目录、`en/` 英文目录,以及 `docs`、`developer`、 + `plugin`、`download`、`disclosure` 五个栏目。 +- 编辑和预览 VitePress Markdown,检查一级标题、代码块、`::: / ::::` 容器以及本地图片。 +- 保存时先写入同目录临时文件并同步到磁盘,再原子替换目标文件;不会写出文档站根目录。 +- 使用 OpenAI-compatible `/chat/completions` 接口生成任意语言的翻译草稿。API Key + 只保存在本次运行的内存里,译文必须人工校对后才保存。 +- 把当前编辑器里的内容导出为 PDF,标题、正文和本地图片都会写入;也支持 PDF 可复制 + 文字导入 Markdown。安装 `pdftoppm.exe` 后会在导出页显示 PDF 首页。 +- 导入 MP4、MKV、MOV、WebM 或 AVI 视频,在指定时间自由截图、按时间均匀截图,或用 + FFmpeg 场景识别自动提取关键画面。 +- 自动把视频关键画面整理成“开始前准备、操作步骤、完成检查”教程;可以生成新的中英文 + 站点文档,也可以追加到当前文档。每个步骤的标题和说明都可以在生成前修改。 +- 对截图进行框选重点、箭头指向、自由涂画、马赛克遮挡和画面裁剪,支持撤销与清空。 +- 在右侧文档预览中点击任意本地图片,可以直接进入画面编辑器;保存时会生成图片副本并 + 自动替换当前 Markdown 引用,不会破坏原图。 + +## 翻译怎么用 + +1. 先打开一篇文档。 +2. 点击左侧活动栏的“翻译”。 +3. 填写接口地址、模型、源语言和目标语言;需要鉴权时再填写 API Key。 +4. 点击“生成翻译草稿”,在下方逐段检查。 +5. 可以把译文放入当前草稿,也可以原子保存到对应语言路径。 + +翻译会要求模型保留 frontmatter、代码、HTML/Vue 组件、VitePress 容器、URL、图片路径、 +命令和配置键,但机器翻译仍可能出错,所以工具不会跳过人工校对直接覆盖。 + +## 导出当前文档 PDF + +1. 从资源管理器选择文档,在编辑器中完成修改;不需要先保存 Markdown。 +2. 点击左侧“PDF 导出”,确认页面显示的当前文档名称。 +3. 点击“导出当前编辑内容为 PDF”,选择保存位置。 +4. 导出成功后,右侧会显示 PDF 首页、页数和实际保存位置。 + +## PDF 的限制 + +- PDF 导入只提取可复制文字,复杂表格、扫描件、图片和多栏排版需要手动整理。 +- PDF 导出保留标题、段落、列表、引用和本地 Markdown 图片;远程网络图片会保留文字提示。 +- 导出中文 PDF 时,工具优先使用绿色包 `fonts` 目录中的兼容字体,再尝试 Windows 中文字体。 + 如果仍提示缺字体,请点击“选择 PDF 字体”并选择有合法使用权限的 TTF 或 OTF 文件。 + +## 视频和画面编辑怎么用 + +1. 点击左侧“视频教程”,再点击“选择视频”。 +2. 选择“自动识别关键画面”“均匀截取”或拖动时间位置后自由截图。 +3. 为每张缩略图填写清晰的步骤标题和操作说明。 +4. 点击缩略图,在右侧使用框选、箭头、涂画、遮挡或裁剪编辑画面。 +5. 选择“生成新教程文件”或“追加到当前文档”。生成新文件时再选择语言、栏目和文件名。 +6. 点击“生成并打开教程文档”;也可以直接点击右上角“一键截图并生成教程”。 + +教程图片会原子复制到对应栏目的 `img/generated`,Markdown 文件最后原子写入。生成新文件时, +如果目标已经存在,工具会要求修改文件名,不会直接覆盖原教程。 + +## 编辑当前文档里的图片 + +1. 在“编辑”页右侧预览中找到图片。 +2. 点击图片卡片右上角“框选 / 箭头 / 涂抹”。 +3. 在画面编辑器中添加标注并点击“保存副本并替换文档引用”。 +4. 返回编辑页确认预览,最后点击“保存文档”。原图片会保留,可随时手动恢复引用。 + +## 给开发者 + +在仓库根目录检查和运行: + +~~~powershell +$env:CARGO_HOME = "$PWD\tools\docforge\tmp\cargo-home" +$env:CARGO_TARGET_DIR = "$PWD\tools\docforge\target" +cargo test --locked --manifest-path tools\docforge\Cargo.toml +cargo run --locked --manifest-path tools\docforge\Cargo.toml -- --site . +~~~ + +构建绿色包: + +~~~powershell +.\tools\docforge\package.ps1 +~~~ + +如果需要把本地 FFmpeg、ffprobe、pdftoppm 和相关 DLL 一起装进绿色包: + +~~~powershell +.\tools\docforge\package.ps1 -MediaToolsDirectory D:\media-tools\bin +~~~ + +只给本次 Cargo 进程使用代理,不写全局设置: + +~~~powershell +.\tools\docforge\package.ps1 -Proxy http://127.0.0.1:7890 +~~~ + +输出位于: + +- `tools/docforge/out/docforge-portable/` +- `tools/docforge/out/docforge-portable-windows-x64.zip` + +Cargo 缓存、编译目录和输出目录都限制在 `tools/docforge` 内,并由仓库的 +`.gitignore` 忽略。 diff --git a/tools/docforge/fonts/README.txt b/tools/docforge/fonts/README.txt new file mode 100644 index 0000000..6c37e32 --- /dev/null +++ b/tools/docforge/fonts/README.txt @@ -0,0 +1,10 @@ +Place an appropriately licensed TTF or OTF Unicode font in this folder before +running package.ps1 when the portable package must export Chinese PDFs without +prompting the user to select a font. + +Recommended names: +- NotoSansCJKsc-Regular.otf +- NotoSansSC-Regular.ttf + +DocForge checks the portable fonts folder first. The package script copies +files from this folder into docforge-portable/fonts. diff --git a/tools/docforge/package.ps1 b/tools/docforge/package.ps1 new file mode 100644 index 0000000..980e3b0 --- /dev/null +++ b/tools/docforge/package.ps1 @@ -0,0 +1,67 @@ +param( + [string]$Proxy = "", + [string]$MediaToolsDirectory = "" +) + +$ErrorActionPreference = "Stop" + +$toolRoot = Split-Path -Parent $MyInvocation.MyCommand.Path +$manifest = Join-Path $toolRoot "Cargo.toml" +$cargoHome = Join-Path $toolRoot "tmp\cargo-home" +$outRoot = Join-Path $toolRoot "out" +$outputRoot = Join-Path $outRoot "docforge-portable" +$archive = Join-Path $outRoot "docforge-portable-windows-x64.zip" +$targetRoot = Join-Path $toolRoot "target" +$binary = Join-Path $targetRoot "release\docforge.exe" + +# All Cargo state is scoped to this tool directory for this process only. +$env:CARGO_HOME = $cargoHome +$env:CARGO_TARGET_DIR = $targetRoot +if ($Proxy) { + $env:HTTP_PROXY = $Proxy + $env:HTTPS_PROXY = $Proxy +} + +& cargo build --release --locked --manifest-path $manifest +if ($LASTEXITCODE -ne 0) { + throw "DocForge release build failed." +} +if (-not (Test-Path -LiteralPath $binary)) { + throw "Release binary was not created: $binary" +} + +New-Item -ItemType Directory -Force -Path $outRoot | Out-Null +if (Test-Path -LiteralPath $outputRoot) { + $resolvedOutRoot = [System.IO.Path]::GetFullPath($outRoot).TrimEnd('\') + $resolvedOutputRoot = [System.IO.Path]::GetFullPath($outputRoot).TrimEnd('\') + if ((Split-Path -Parent $resolvedOutputRoot) -ne $resolvedOutRoot) { + throw "Refusing to clean an unexpected output path: $resolvedOutputRoot" + } + Remove-Item -LiteralPath $resolvedOutputRoot -Recurse -Force +} +New-Item -ItemType Directory -Force -Path $outputRoot | Out-Null +Copy-Item -LiteralPath $binary -Destination (Join-Path $outputRoot "docforge.exe") -Force +Copy-Item -LiteralPath (Join-Path $toolRoot "README.zh-CN.txt") -Destination (Join-Path $outputRoot "README.zh-CN.txt") -Force + +$fontSource = Join-Path $toolRoot "fonts" +if (Test-Path -LiteralPath $fontSource -PathType Container) { + $fontTarget = Join-Path $outputRoot "fonts" + New-Item -ItemType Directory -Force -Path $fontTarget | Out-Null + Get-ChildItem -LiteralPath $fontSource -File | + Copy-Item -Destination $fontTarget -Force +} + +if ($MediaToolsDirectory) { + if (-not (Test-Path -LiteralPath $MediaToolsDirectory -PathType Container)) { + throw "MediaToolsDirectory does not exist: $MediaToolsDirectory" + } + $mediaTarget = Join-Path $outputRoot "bin" + New-Item -ItemType Directory -Force -Path $mediaTarget | Out-Null + Get-ChildItem -LiteralPath $MediaToolsDirectory -File | + Copy-Item -Destination $mediaTarget -Force +} + +Compress-Archive -LiteralPath $outputRoot -DestinationPath $archive -CompressionLevel Optimal -Force + +Write-Host "Portable directory created: $outputRoot" +Write-Host "Portable archive created: $archive" diff --git a/tools/docforge/src/annotation.rs b/tools/docforge/src/annotation.rs new file mode 100644 index 0000000..e6d6f71 --- /dev/null +++ b/tools/docforge/src/annotation.rs @@ -0,0 +1,327 @@ +use anyhow::{Context, Result}; +use image::{imageops, DynamicImage, GenericImageView, Rgba, RgbaImage}; +use imageproc::drawing::{draw_hollow_rect_mut, draw_line_segment_mut}; +use imageproc::rect::Rect; +use std::path::Path; + +use crate::atomic; + +#[derive(Debug, Clone, Copy, PartialEq, Eq)] +pub enum AnnotationKind { + Rectangle, + Arrow, + Brush, + Mosaic, + Crop, +} + +impl AnnotationKind { + pub fn label(self) -> &'static str { + match self { + Self::Rectangle => "框选重点", + Self::Arrow => "箭头指向", + Self::Brush => "自由涂画", + Self::Mosaic => "涂抹遮挡", + Self::Crop => "裁剪画面", + } + } +} + +#[derive(Debug, Clone)] +pub struct Annotation { + pub kind: AnnotationKind, + pub points: Vec<[f32; 2]>, + pub color: [u8; 4], + pub width: f32, +} + +impl Annotation { + pub fn new(kind: AnnotationKind, first: [f32; 2]) -> Self { + Self { + kind, + points: vec![first], + color: [232, 72, 85, 255], + width: 4.0, + } + } +} + +pub fn save_annotated(input: &Path, output: &Path, annotations: &[Annotation]) -> Result<()> { + let mut session = AnnotationSession::load(input)?; + let (width, height) = session.dimensions(); + let point = |value: [f32; 2]| [value[0] * width as f32, value[1] * height as f32]; + for annotation in annotations { + if annotation.points.len() < 2 { + continue; + } + let points: Vec<[f32; 2]> = annotation.points.iter().copied().map(point).collect(); + match annotation.kind { + AnnotationKind::Rectangle => session.push(Mark::Box { + from: points[0], + to: *points.last().expect("two points"), + color: annotation.color, + width: annotation.width, + }), + AnnotationKind::Arrow => session.push(Mark::Arrow { + from: points[0], + to: *points.last().expect("two points"), + color: annotation.color, + width: annotation.width, + }), + AnnotationKind::Brush => session.push(Mark::Stroke { + points, + color: annotation.color, + width: annotation.width, + }), + AnnotationKind::Mosaic => session.push(Mark::Mosaic { + points, + radius: annotation.width.max(4.0) * 3.0, + }), + AnnotationKind::Crop => { + session.crop = Some((points[0], *points.last().expect("two points"))); + } + } + } + session.save_atomic(output) +} + +#[derive(Debug, Clone)] +pub enum Mark { + Stroke { + points: Vec<[f32; 2]>, + color: [u8; 4], + width: f32, + }, + Mosaic { + points: Vec<[f32; 2]>, + radius: f32, + }, + Box { + from: [f32; 2], + to: [f32; 2], + color: [u8; 4], + width: f32, + }, + Arrow { + from: [f32; 2], + to: [f32; 2], + color: [u8; 4], + width: f32, + }, +} + +#[derive(Clone)] +pub struct AnnotationSession { + original: DynamicImage, + pub marks: Vec, + pub crop: Option<([f32; 2], [f32; 2])>, +} + +impl AnnotationSession { + pub fn load(path: &Path) -> Result { + let original = + image::open(path).with_context(|| format!("无法打开图片 {}", path.display()))?; + Ok(Self { + original, + marks: Vec::new(), + crop: None, + }) + } + + pub fn dimensions(&self) -> (u32, u32) { + self.original.dimensions() + } + + pub fn push(&mut self, mark: Mark) { + self.marks.push(mark); + } + + pub fn render(&self) -> RgbaImage { + let mut image = self.original.to_rgba8(); + for mark in &self.marks { + match mark { + Mark::Stroke { + points, + color, + width, + } => draw_stroke(&mut image, points, Rgba(*color), *width), + Mark::Mosaic { points, radius } => { + for point in points { + pixelate_area(&mut image, *point, *radius); + } + } + Mark::Box { + from, + to, + color, + width, + } => draw_box(&mut image, *from, *to, Rgba(*color), *width), + Mark::Arrow { + from, + to, + color, + width, + } => draw_arrow(&mut image, *from, *to, Rgba(*color), *width), + } + } + if let Some((from, to)) = self.crop { + let (x, y, width, height) = normalized_rect(from, to, image.width(), image.height()); + if width > 1 && height > 1 { + return imageops::crop_imm(&image, x, y, width, height).to_image(); + } + } + image + } + + pub fn save_atomic(&self, path: &Path) -> Result<()> { + let rendered = self.render(); + let mut cursor = std::io::Cursor::new(Vec::new()); + DynamicImage::ImageRgba8(rendered).write_to(&mut cursor, image::ImageFormat::Png)?; + atomic::atomic_write(path, cursor.get_ref()) + } +} + +fn draw_stroke(image: &mut RgbaImage, points: &[[f32; 2]], color: Rgba, width: f32) { + if points.len() == 1 { + draw_thick_line(image, points[0], points[0], color, width); + } + for pair in points.windows(2) { + draw_thick_line(image, pair[0], pair[1], color, width); + } +} + +fn draw_box(image: &mut RgbaImage, from: [f32; 2], to: [f32; 2], color: Rgba, width: f32) { + let (x, y, rect_width, rect_height) = normalized_rect(from, to, image.width(), image.height()); + for offset in 0..width.max(1.0).round() as i32 { + let rect = Rect::at(x as i32 - offset, y as i32 - offset).of_size( + rect_width.saturating_add((offset * 2) as u32), + rect_height.saturating_add((offset * 2) as u32), + ); + draw_hollow_rect_mut(image, rect, color); + } +} + +fn draw_arrow(image: &mut RgbaImage, from: [f32; 2], to: [f32; 2], color: Rgba, width: f32) { + draw_thick_line(image, from, to, color, width); + let angle = (to[1] - from[1]).atan2(to[0] - from[0]); + let length = (width * 4.0).max(18.0); + let spread = 0.55; + for direction in [ + angle + std::f32::consts::PI - spread, + angle + std::f32::consts::PI + spread, + ] { + let head = [ + to[0] + length * direction.cos(), + to[1] + length * direction.sin(), + ]; + draw_thick_line(image, to, head, color, width); + } +} + +fn draw_thick_line( + image: &mut RgbaImage, + from: [f32; 2], + to: [f32; 2], + color: Rgba, + width: f32, +) { + let radius = (width.max(1.0) / 2.0).round() as i32; + for y in -radius..=radius { + for x in -radius..=radius { + if x * x + y * y <= radius * radius { + draw_line_segment_mut( + image, + (from[0] + x as f32, from[1] + y as f32), + (to[0] + x as f32, to[1] + y as f32), + color, + ); + } + } + } +} + +fn pixelate_area(image: &mut RgbaImage, center: [f32; 2], radius: f32) { + let block = 12u32; + let min_x = (center[0] - radius).max(0.0) as u32; + let min_y = (center[1] - radius).max(0.0) as u32; + let max_x = (center[0] + radius).min(image.width() as f32) as u32; + let max_y = (center[1] + radius).min(image.height() as f32) as u32; + for block_y in (min_y..max_y).step_by(block as usize) { + for block_x in (min_x..max_x).step_by(block as usize) { + let sample_x = (block_x + block / 2).min(image.width().saturating_sub(1)); + let sample_y = (block_y + block / 2).min(image.height().saturating_sub(1)); + let color = *image.get_pixel(sample_x, sample_y); + for y in block_y..(block_y + block).min(max_y) { + for x in block_x..(block_x + block).min(max_x) { + let dx = x as f32 - center[0]; + let dy = y as f32 - center[1]; + if dx * dx + dy * dy <= radius * radius { + image.put_pixel(x, y, color); + } + } + } + } + } +} + +fn normalized_rect( + from: [f32; 2], + to: [f32; 2], + max_width: u32, + max_height: u32, +) -> (u32, u32, u32, u32) { + let x1 = from[0].min(to[0]).clamp(0.0, max_width as f32) as u32; + let y1 = from[1].min(to[1]).clamp(0.0, max_height as f32) as u32; + let x2 = from[0].max(to[0]).clamp(0.0, max_width as f32) as u32; + let y2 = from[1].max(to[1]).clamp(0.0, max_height as f32) as u32; + (x1, y1, x2.saturating_sub(x1), y2.saturating_sub(y1)) +} + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn normalizes_reverse_selection() { + assert_eq!( + normalized_rect([10.0, 20.0], [2.0, 3.0], 100, 100), + (2, 3, 8, 17) + ); + } + + #[test] + fn saves_rectangle_arrow_brush_mosaic_and_crop() { + let directory = tempfile::tempdir().expect("创建测试目录"); + let input = directory.path().join("input.png"); + let output = directory.path().join("output.png"); + DynamicImage::new_rgba8(100, 80) + .save(&input) + .expect("保存输入图片"); + + let mark = |kind, points| Annotation { + kind, + points, + color: [255, 0, 0, 255], + width: 4.0, + }; + let annotations = vec![ + mark(AnnotationKind::Rectangle, vec![[0.1, 0.1], [0.9, 0.9]]), + mark(AnnotationKind::Arrow, vec![[0.1, 0.8], [0.8, 0.2]]), + mark( + AnnotationKind::Brush, + vec![[0.1, 0.5], [0.5, 0.5], [0.9, 0.5]], + ), + mark( + AnnotationKind::Mosaic, + vec![[0.2, 0.2], [0.5, 0.4], [0.8, 0.6]], + ), + mark(AnnotationKind::Crop, vec![[0.2, 0.25], [0.8, 0.75]]), + ]; + + save_annotated(&input, &output, &annotations).expect("保存编辑图片"); + assert_eq!( + image::open(output).expect("打开输出").dimensions(), + (60, 40) + ); + } +} diff --git a/tools/docforge/src/app.rs b/tools/docforge/src/app.rs new file mode 100644 index 0000000..7eba1cb --- /dev/null +++ b/tools/docforge/src/app.rs @@ -0,0 +1,2418 @@ +use anyhow::{Context, Result}; +use eframe::egui::{ + self, Color32, ColorImage, FontData, FontDefinitions, FontFamily, Pos2, Rect, RichText, Sense, + Stroke, TextureOptions, Vec2, +}; +use std::collections::HashMap; +use std::fs; +use std::path::{Path, PathBuf}; +use std::sync::mpsc::{self, Receiver}; +use std::sync::Arc; + +use crate::annotation::{self, Annotation, AnnotationKind}; +use crate::atomic; +use crate::markdown::{self, PreviewBlock}; +use crate::pdf; +use crate::site::{DocumentRef, Language, SiteProfile, SECTIONS}; +use crate::translation::{self, TranslationConfig}; +use crate::tutorial::{self, TutorialMedia, TutorialStep}; +use crate::video::VideoTool; + +#[derive(Debug, Clone, Copy, PartialEq, Eq)] +enum WorkspaceTab { + Edit, + Tutorial, + Translate, + Export, +} + +#[derive(Debug, Clone, Copy, PartialEq, Eq)] +enum LanguageFilter { + All, + Zh, + En, +} + +#[derive(Debug, Clone, Copy, PartialEq, Eq)] +enum TutorialTarget { + NewDocument, + CurrentDocument, +} + +#[derive(Debug, Clone)] +struct DocumentImageEdit { + reference: String, + path: PathBuf, +} + +pub struct DocforgeApp { + site: Option, + selected_document: Option, + search: String, + language_filter: LanguageFilter, + markdown: String, + saved_markdown: String, + editor_line: usize, + editor_column: usize, + confirm_close: bool, + workspace_tab: WorkspaceTab, + status: String, + translation: TranslationConfig, + translation_result: Option, + translation_receiver: Option>>, + pdf_preview: Option, + pdf_image: Option, + pdf_font: Option, + preview_textures: HashMap, + video_path: Option, + video_duration: Option, + capture_seconds: f64, + capture_count: usize, + tutorial_steps: Vec, + selected_frame: Option, + frame_path: Option, + frame_texture: Option, + frame_size: [usize; 2], + annotations: Vec, + active_annotation: Option, + annotation_tool: AnnotationKind, + annotation_color: Color32, + annotation_width: f32, + video_temp: Option, + document_image_edit: Option, + tutorial_target: TutorialTarget, + tutorial_title: String, + tutorial_summary: String, + tutorial_prerequisites: String, + tutorial_file_stem: String, + tutorial_section: usize, + tutorial_language: Language, +} + +impl DocforgeApp { + pub fn new( + creation_context: &eframe::CreationContext<'_>, + initial_site: Option, + ) -> Self { + install_chinese_font(&creation_context.egui_ctx); + install_mas_theme(&creation_context.egui_ctx); + let mut app = Self { + site: None, + selected_document: None, + search: String::new(), + language_filter: LanguageFilter::All, + markdown: String::new(), + saved_markdown: String::new(), + editor_line: 1, + editor_column: 1, + confirm_close: false, + workspace_tab: WorkspaceTab::Edit, + status: "第一步:点击左上角“打开文档站”,选择 AUTO-MAS-docs 仓库。".to_string(), + translation: TranslationConfig::default(), + translation_result: None, + translation_receiver: None, + pdf_preview: None, + pdf_image: None, + pdf_font: None, + preview_textures: HashMap::new(), + video_path: None, + video_duration: None, + capture_seconds: 0.0, + capture_count: 8, + tutorial_steps: Vec::new(), + selected_frame: None, + frame_path: None, + frame_texture: None, + frame_size: [0, 0], + annotations: Vec::new(), + active_annotation: None, + annotation_tool: AnnotationKind::Rectangle, + annotation_color: Color32::from_rgb(232, 72, 85), + annotation_width: 4.0, + video_temp: None, + document_image_edit: None, + tutorial_target: TutorialTarget::NewDocument, + tutorial_title: "视频操作教程".to_string(), + tutorial_summary: "跟随下面的关键画面完成操作。".to_string(), + tutorial_prerequisites: "准备好 AUTO-MAS,并确认相关功能可以正常打开。".to_string(), + tutorial_file_stem: "video-tutorial".to_string(), + tutorial_section: 0, + tutorial_language: Language::Zh, + }; + if let Some(root) = initial_site { + app.open_site(root); + } + app + } + + fn open_site(&mut self, root: PathBuf) { + if self.is_dirty() { + self.status = "当前文档还有未保存修改,请先保存或放弃修改。".to_string(); + return; + } + match SiteProfile::discover(&root) { + Ok(site) => { + let count = site.documents.len(); + let initial_document = site + .documents + .iter() + .position(|document| document.relative_path == "docs/user-guide.md") + .or_else(|| (!site.documents.is_empty()).then_some(0)); + self.status = format!( + "已打开 {},找到 {count} 篇 Markdown 文档。", + site.root.display() + ); + self.site = Some(site); + self.selected_document = None; + self.markdown.clear(); + self.saved_markdown.clear(); + self.translation_result = None; + self.preview_textures.clear(); + self.document_image_edit = None; + if let Some(index) = initial_document { + self.select_document(index); + } + } + Err(error) => self.status = format!("无法打开文档站:{error:#}"), + } + } + + fn select_document(&mut self, index: usize) { + if self.selected_document != Some(index) && self.is_dirty() { + self.status = + "当前文档还有未保存修改:请先保存,或点击“放弃修改”后再切换。".to_string(); + return; + } + let Some(site) = &self.site else { + return; + }; + let Some(document) = site.documents.get(index) else { + return; + }; + match site.document_path(document).and_then(|path| { + fs::read_to_string(&path).with_context(|| format!("无法读取 {}", path.display())) + }) { + Ok(markdown) => { + self.selected_document = Some(index); + self.saved_markdown = markdown.clone(); + self.markdown = markdown; + self.translation_result = None; + self.pdf_preview = None; + self.preview_textures.clear(); + self.document_image_edit = None; + self.editor_line = 1; + self.editor_column = 1; + self.tutorial_language = document.language; + if let Some(section) = SECTIONS + .iter() + .position(|section| *section == document.section) + { + self.tutorial_section = section; + } + self.status = format!("正在编辑:{}", document.relative_path); + } + Err(error) => self.status = format!("无法打开文档:{error:#}"), + } + } + + fn selected_document_ref(&self) -> Option<&DocumentRef> { + self.site.as_ref().and_then(|site| { + self.selected_document + .and_then(|index| site.documents.get(index)) + }) + } + + fn is_dirty(&self) -> bool { + self.selected_document.is_some() && self.markdown != self.saved_markdown + } + + fn discard_changes(&mut self) { + self.markdown = self.saved_markdown.clone(); + self.translation_result = None; + self.status = "已放弃尚未保存的修改。".to_string(); + } + + fn save_document(&mut self) { + let Some(site) = &self.site else { + self.status = "请先打开文档站。".to_string(); + return; + }; + let Some(document) = self.selected_document_ref() else { + self.status = "请先从左侧选择一篇 Markdown 文档。".to_string(); + return; + }; + let mut did_save = false; + match site + .document_path(document) + .and_then(|path| atomic::atomic_write(&path, self.markdown.as_bytes())) + { + Ok(()) => { + did_save = true; + self.status = format!("已原子保存:{}", document.relative_path); + } + Err(error) => self.status = format!("保存失败:{error:#}"), + } + if did_save { + self.saved_markdown = self.markdown.clone(); + } + } + + fn start_translation(&mut self) { + if self.translation_receiver.is_some() { + return; + } + let source = self.markdown.clone(); + let config = self.translation.clone(); + let (sender, receiver) = mpsc::channel(); + std::thread::spawn(move || { + let result = translation::translate_markdown(&source, &config) + .map_err(|error| format!("{error:#}")); + let _ = sender.send(result); + }); + self.translation_receiver = Some(receiver); + self.status = "正在翻译,并保护 VitePress 语法、代码、链接和图片路径……".to_string(); + } + + fn poll_translation(&mut self) { + let Some(receiver) = &self.translation_receiver else { + return; + }; + match receiver.try_recv() { + Ok(Ok(markdown)) => { + self.translation_result = Some(markdown); + self.translation_receiver = None; + self.status = "翻译完成:请先在校对区检查,当前尚未写入任何文件。".to_string(); + } + Ok(Err(error)) => { + self.translation_receiver = None; + self.status = format!("翻译失败:{error}"); + } + Err(mpsc::TryRecvError::Disconnected) => { + self.translation_receiver = None; + self.status = "翻译任务意外停止,请检查接口配置后重试。".to_string(); + } + Err(mpsc::TryRecvError::Empty) => {} + } + } + + fn save_translation_to_counterpart(&mut self) { + let Some(translated) = &self.translation_result else { + self.status = "请先翻译当前文档并检查译文。".to_string(); + return; + }; + let Some(site) = &self.site else { + return; + }; + let Some(document) = self.selected_document_ref() else { + return; + }; + let path = match site.translation_target_path(document) { + Ok(path) => path, + Err(error) => { + self.status = format!("无法确定翻译目标:{error:#}"); + return; + } + }; + let relative = path + .strip_prefix(&site.root) + .unwrap_or(&path) + .to_string_lossy() + .replace('\\', "/"); + match atomic::ensure_inside(&site.root, &path) + .and_then(|path| atomic::atomic_write(&path, translated.as_bytes())) + { + Ok(()) => self.status = format!("已原子保存对应语言文档:{relative}"), + Err(error) => self.status = format!("无法保存对应语言文档:{error:#}"), + } + } + + fn export_pdf(&mut self, ctx: &egui::Context) { + let suggested = self + .selected_document_ref() + .map(|document| safe_stem(&document.title)) + .unwrap_or_else(|| "auto-mas-document".to_string()); + let Some(path) = rfd::FileDialog::new() + .set_file_name(format!("{suggested}.pdf")) + .add_filter("PDF", &["pdf"]) + .save_file() + else { + return; + }; + let document_context = self.site.as_ref().and_then(|site| { + self.selected_document_ref() + .and_then(|document| site.document_path(document).ok()) + .map(|document_path| (document_path, site.root.clone())) + }); + let options = pdf::PdfExportOptions { + custom_font: self.pdf_font.as_deref(), + document_path: document_context.as_ref().map(|(path, _)| path.as_path()), + site_root: document_context.as_ref().map(|(_, root)| root.as_path()), + }; + match pdf::export_markdown_to_pdf(&self.markdown, &path, options).and_then(|info| { + let preview = pdf::preview_pdf(&path)?; + Ok((info, preview)) + }) { + Ok((info, preview)) => { + self.pdf_image = pdf::render_first_page(&info.path, None) + .ok() + .and_then(|bytes| load_texture_from_bytes(ctx, "pdf-preview", &bytes).ok()); + self.pdf_preview = Some(preview); + self.status = match info.warning { + Some(warning) => format!("已导出 {}。{warning}", info.path.display()), + None => format!("已导出 {}({} 页)。", info.path.display(), info.pages), + }; + } + Err(error) => self.status = format!("PDF 导出失败:{error:#}"), + } + } + + fn import_pdf(&mut self, ctx: &egui::Context) { + if self.selected_document.is_none() { + self.status = "请先选择要接收 PDF 内容的 Markdown 文档。".to_string(); + return; + } + if self.is_dirty() { + self.status = "当前文档有未保存修改,请先保存或放弃修改,再导入 PDF。".to_string(); + return; + } + let Some(path) = rfd::FileDialog::new() + .add_filter("PDF", &["pdf"]) + .pick_file() + else { + return; + }; + match pdf::preview_pdf(&path).and_then(|preview| { + let markdown = pdf::pdf_to_markdown(&path)?; + Ok((preview, markdown)) + }) { + Ok((preview, markdown)) => { + self.markdown = markdown; + self.pdf_preview = Some(preview); + self.pdf_image = match pdf::render_first_page(&path, None) { + Ok(bytes) => load_texture_from_bytes(ctx, "pdf-preview", &bytes).ok(), + Err(_) => None, + }; + self.status = format!( + "已把 {} 转为 Markdown 草稿。请检查排版后再原子保存。", + path.display() + ); + } + Err(error) => self.status = format!("PDF 导入失败:{error:#}"), + } + } + + fn choose_video(&mut self) { + let Some(path) = rfd::FileDialog::new() + .add_filter("视频", &["mp4", "mkv", "mov", "webm", "avi"]) + .pick_file() + else { + return; + }; + self.video_duration = + VideoTool::discover(None).and_then(|tool| tool.duration_seconds(&path).ok().flatten()); + self.capture_seconds = 0.0; + self.tutorial_steps.clear(); + self.selected_frame = None; + self.frame_path = None; + self.frame_texture = None; + self.annotations.clear(); + self.document_image_edit = None; + let video_name = path + .file_stem() + .and_then(|value| value.to_str()) + .unwrap_or("视频操作") + .replace(['-', '_'], " "); + self.tutorial_title = format!("{}教程", video_name.trim()); + self.tutorial_file_stem = safe_stem(&video_name); + self.video_path = Some(path.clone()); + self.status = format!("已选择视频:{}", path.display()); + } + + fn temp_video_dir(&mut self) -> Result { + if self.video_temp.is_none() { + self.video_temp = Some(tempfile::tempdir().context("无法创建视频截图临时目录")?); + } + Ok(self + .video_temp + .as_ref() + .expect("视频临时目录应当已经创建") + .path() + .to_path_buf()) + } + + fn capture_manual_frame(&mut self, ctx: &egui::Context) { + let Some(video) = self.video_path.clone() else { + self.status = "请先选择一个视频。".to_string(); + return; + }; + self.document_image_edit = None; + let Some(tool) = VideoTool::discover(None) else { + self.status = + "未找到 FFmpeg:请把 ffmpeg.exe 和 ffprobe.exe 放入绿色包的 bin 目录。".to_string(); + return; + }; + let output_dir = match self.temp_video_dir() { + Ok(path) => path, + Err(error) => { + self.status = format!("无法准备截图临时目录:{error:#}"); + return; + } + }; + let output = output_dir.join(format!("manual-{:03}.png", self.tutorial_steps.len() + 1)); + match tool.capture_at(&video, self.capture_seconds, &output) { + Ok(()) => { + let index = self.tutorial_steps.len(); + self.tutorial_steps.push(TutorialStep::new( + output.clone(), + index, + Some(self.capture_seconds), + )); + self.open_frame(ctx, output); + self.status = "截图完成:现在可以标注画面,或把它插入文档草稿。".to_string(); + } + Err(error) => self.status = format!("截图失败:{error:#}"), + } + } + + fn capture_key_frames(&mut self, ctx: &egui::Context) { + let Some(video) = self.video_path.clone() else { + self.status = "请先选择一个视频。".to_string(); + return; + }; + self.document_image_edit = None; + let Some(tool) = VideoTool::discover(None) else { + self.status = + "未找到 FFmpeg:请把 ffmpeg.exe 和 ffprobe.exe 放入绿色包的 bin 目录。".to_string(); + return; + }; + let output_dir = match self.temp_video_dir() { + Ok(path) => path.join("keyframes"), + Err(error) => { + self.status = format!("无法准备截图临时目录:{error:#}"); + return; + } + }; + match tool.capture_keyframes(&video, &output_dir, self.capture_count) { + Ok(frames) => { + self.tutorial_steps = frames + .into_iter() + .enumerate() + .map(|(index, frame)| TutorialStep::new(frame, index, None)) + .collect(); + if let Some(frame) = self.tutorial_steps.first().map(|step| step.frame.clone()) { + self.open_frame(ctx, frame); + } + self.status = format!( + "已自动截取 {} 张关键画面,可逐张编辑或一键生成文档段落。", + self.tutorial_steps.len() + ); + } + Err(error) => self.status = format!("关键画面识别失败:{error:#}"), + } + } + + fn capture_even_frames(&mut self, ctx: &egui::Context) { + let Some(video) = self.video_path.clone() else { + self.status = "请先选择视频。".to_string(); + return; + }; + self.document_image_edit = None; + let Some(tool) = VideoTool::discover(None) else { + self.status = + "未找到 FFmpeg:请把 ffmpeg.exe 和 ffprobe.exe 放在 DocForge.exe 同目录。" + .to_string(); + return; + }; + let output_dir = match self.temp_video_dir() { + Ok(path) => path.join("even-frames"), + Err(error) => { + self.status = format!("无法准备截图临时目录:{error:#}"); + return; + } + }; + match tool.capture_evenly(&video, &output_dir, self.capture_count) { + Ok(frames) => { + let duration = self.video_duration.unwrap_or_default(); + let frame_count = frames.len(); + self.tutorial_steps = frames + .into_iter() + .enumerate() + .map(|(index, frame)| { + let timestamp = (duration > 0.0) + .then(|| duration * (index + 1) as f64 / (frame_count + 1) as f64); + TutorialStep::new(frame, index, timestamp) + }) + .collect(); + if let Some(frame) = self.tutorial_steps.first().map(|step| step.frame.clone()) { + self.open_frame(ctx, frame); + } + self.status = format!("已按时间均匀截取 {} 张画面。", self.tutorial_steps.len()); + } + Err(error) => self.status = format!("均匀截图失败:{error:#}"), + } + } + fn one_click_generate_from_video(&mut self, ctx: &egui::Context) { + self.tutorial_steps.clear(); + self.capture_key_frames(ctx); + if self.tutorial_steps.is_empty() { + return; + } + self.generate_tutorial_document(); + } + + fn open_frame(&mut self, ctx: &egui::Context, path: PathBuf) { + match load_texture_from_path(ctx, &path) { + Ok((texture, size)) => { + self.frame_path = Some(path.clone()); + self.frame_texture = Some(texture); + self.frame_size = size; + self.annotations.clear(); + self.active_annotation = None; + self.selected_frame = self + .tutorial_steps + .iter() + .position(|step| step.frame == path); + } + Err(error) => self.status = format!("无法显示画面:{error:#}"), + } + } + + fn save_annotated_frame(&mut self, ctx: &egui::Context) { + if self.document_image_edit.is_some() { + self.save_document_image_edit(ctx); + return; + } + let Some(frame) = self.frame_path.clone() else { + self.status = "请先选择一张已经截取的画面。".to_string(); + return; + }; + if self.annotations.is_empty() { + self.status = "请先在画面上添加框选、箭头、涂画、遮挡或裁剪。".to_string(); + return; + } + let stem = frame + .file_stem() + .and_then(|value| value.to_str()) + .unwrap_or("frame"); + let output = frame.with_file_name(format!("{stem}-annotated.png")); + match annotation::save_annotated(&frame, &output, &self.annotations) { + Ok(()) => { + if let Some(index) = self.selected_frame { + if let Some(step) = self.tutorial_steps.get_mut(index) { + step.frame = output.clone(); + } + } else { + let index = self.tutorial_steps.len(); + self.tutorial_steps + .push(TutorialStep::new(output.clone(), index, None)); + } + self.open_frame(ctx, output); + self.status = "已在临时目录中保存编辑后的画面。".to_string(); + } + Err(error) => self.status = format!("无法保存编辑后的画面:{error:#}"), + } + } + + fn open_document_image(&mut self, ctx: &egui::Context, reference: String, path: PathBuf) { + if !path.is_file() { + self.status = format!("找不到文档图片:{}", path.display()); + return; + } + self.document_image_edit = Some(DocumentImageEdit { + reference, + path: path.clone(), + }); + self.open_frame(ctx, path); + self.workspace_tab = WorkspaceTab::Tutorial; + self.status = "已从当前文档打开图片。标注后点击“保存副本并替换文档引用”。".to_string(); + } + + fn save_document_image_edit(&mut self, ctx: &egui::Context) { + let Some(edit) = self.document_image_edit.clone() else { + return; + }; + if self.annotations.is_empty() { + self.status = "请先添加框选、箭头、涂画、遮挡或裁剪。".to_string(); + return; + } + let Some(parent) = edit.path.parent() else { + self.status = "无法确定图片保存目录。".to_string(); + return; + }; + let output = parent.join(unique_media_name(&edit.path)); + match annotation::save_annotated(&edit.path, &output, &self.annotations) { + Ok(()) => { + let file_name = output + .file_name() + .and_then(|value| value.to_str()) + .unwrap_or("edited-image.png"); + let replacement = replace_reference_file_name(&edit.reference, file_name); + self.markdown = markdown::replace_image_reference( + &self.markdown, + &edit.reference, + &replacement, + ); + self.preview_textures.clear(); + self.document_image_edit = Some(DocumentImageEdit { + reference: replacement, + path: output.clone(), + }); + self.open_frame(ctx, output); + self.status = + "图片副本已生成,当前 Markdown 引用已替换;点击顶部保存即可写入文档。" + .to_string(); + } + Err(error) => self.status = format!("无法保存编辑后的文档图片:{error:#}"), + } + } + + fn insert_current_frame(&mut self, save_after: bool) { + let Some(frame) = self.frame_path.clone() else { + self.status = "请先选择一张已经截取的画面。".to_string(); + return; + }; + let Some(site) = &self.site else { + self.status = "插入画面前,请先打开文档站。".to_string(); + return; + }; + let Some(document) = self.selected_document_ref() else { + self.status = "插入画面前,请先选择一篇 Markdown 文档。".to_string(); + return; + }; + let media_dir = match site.media_dir(document) { + Ok(path) => path, + Err(error) => { + self.status = format!("无法确定文档图片目录:{error:#}"); + return; + } + }; + let destination = media_dir.join(unique_media_name(&frame)); + match atomic::copy_atomic(&frame, &destination) { + Ok(()) => { + let relative = destination + .strip_prefix(&site.root) + .unwrap_or(&destination) + .to_string_lossy() + .replace('\\', "/"); + let public_path = format!("/{relative}"); + self.markdown = markdown::append_media( + &self.markdown, + "视频操作记录", + &[("视频关键画面".to_string(), public_path)], + ); + self.status = format!("已把画面插入当前草稿:{}", destination.display()); + if save_after { + self.save_document(); + } + } + Err(error) => self.status = format!("无法把画面复制到文档站:{error:#}"), + } + } + + fn insert_all_frames_and_save(&mut self) { + if self.tutorial_steps.is_empty() { + self.status = "请先从视频截取关键画面。".to_string(); + return; + } + let Some(site) = &self.site else { + self.status = "生成文档段落前,请先打开文档站。".to_string(); + return; + }; + let Some(document) = self.selected_document_ref() else { + self.status = "生成文档段落前,请先选择一篇 Markdown 文档。".to_string(); + return; + }; + let media_dir = match site.media_dir(document) { + Ok(path) => path, + Err(error) => { + self.status = format!("无法确定文档图片目录:{error:#}"); + return; + } + }; + let mut media = Vec::new(); + for step in &self.tutorial_steps { + let destination = media_dir.join(unique_media_name(&step.frame)); + if let Err(error) = atomic::copy_atomic(&step.frame, &destination) { + self.status = format!("无法复制画面 {}:{error:#}", step.frame.display()); + return; + } + let relative = destination + .strip_prefix(&site.root) + .unwrap_or(&destination) + .to_string_lossy() + .replace('\\', "/"); + media.push(TutorialMedia { + title: step.title.clone(), + description: step.description.clone(), + public_path: format!("/{relative}"), + timestamp: step.timestamp, + }); + } + self.markdown.push_str(&tutorial::render_section( + &self.tutorial_title, + &self.tutorial_summary, + &media, + )); + self.save_document(); + } + + fn generate_tutorial_document(&mut self) { + if self.tutorial_target == TutorialTarget::CurrentDocument { + self.insert_all_frames_and_save(); + return; + } + if self.is_dirty() { + self.status = "当前文档还有未保存修改,请先保存,再生成新的教程文件。".to_string(); + return; + } + if self.tutorial_steps.is_empty() { + self.status = "请先自动识别关键画面,或使用“一键生成教程”。".to_string(); + return; + } + let Some(site) = &self.site else { + self.status = "请先打开 AUTO-MAS 文档站。".to_string(); + return; + }; + let section = SECTIONS + .get(self.tutorial_section) + .copied() + .unwrap_or("docs"); + let target = match site.tutorial_document_path( + self.tutorial_language, + section, + &self.tutorial_file_stem, + ) { + Ok(path) => path, + Err(error) => { + self.status = format!("无法确定教程文件位置:{error:#}"); + return; + } + }; + if target.exists() { + self.status = format!( + "教程文件已经存在:{}。请修改文件名,或选择“追加到当前文档”。", + target.display() + ); + return; + } + let media_dir = match site.media_dir_for_section(section) { + Ok(path) => path, + Err(error) => { + self.status = format!("无法准备教程图片目录:{error:#}"); + return; + } + }; + let mut media = Vec::new(); + for step in &self.tutorial_steps { + let destination = media_dir.join(unique_media_name(&step.frame)); + if let Err(error) = atomic::copy_atomic(&step.frame, &destination) { + self.status = format!("无法复制教程画面 {}:{error:#}", step.frame.display()); + return; + } + let relative = destination + .strip_prefix(&site.root) + .unwrap_or(&destination) + .to_string_lossy() + .replace('\\', "/"); + media.push(TutorialMedia { + title: step.title.clone(), + description: step.description.clone(), + public_path: format!("/{relative}"), + timestamp: step.timestamp, + }); + } + let source = tutorial::render_document( + &self.tutorial_title, + &self.tutorial_summary, + &self.tutorial_prerequisites, + &media, + ); + if let Err(error) = atomic::atomic_write(&target, source.as_bytes()) { + self.status = format!("无法原子保存教程文档:{error:#}"); + return; + } + let root = site.root.clone(); + let relative = target + .strip_prefix(&root) + .unwrap_or(&target) + .to_string_lossy() + .replace('\\', "/"); + match SiteProfile::discover(&root) { + Ok(profile) => { + self.site = Some(profile); + self.selected_document = self.site.as_ref().and_then(|profile| { + profile + .documents + .iter() + .position(|document| document.relative_path == relative) + }); + self.saved_markdown = source.clone(); + self.markdown = source; + self.pdf_preview = None; + self.pdf_image = None; + self.preview_textures.clear(); + self.document_image_edit = None; + self.editor_line = 1; + self.editor_column = 1; + self.workspace_tab = WorkspaceTab::Edit; + self.status = format!("教程已生成并打开:{relative}"); + } + Err(error) => { + self.status = format!("教程已保存,但重新扫描文档站失败:{error:#}"); + } + } + } + + fn draw_annotation_canvas(&mut self, ui: &mut egui::Ui) { + let Some(texture) = &self.frame_texture else { + ui.label("请先从左侧选择一张画面,然后在这里进行编辑。"); + return; + }; + let source_size = texture.size(); + if source_size[0] == 0 || source_size[1] == 0 { + return; + } + let available = ui.available_size_before_wrap(); + let aspect = source_size[0] as f32 / source_size[1] as f32; + let mut width = available.x.clamp(220.0, 760.0); + let mut height = width / aspect; + if height > available.y.max(220.0) { + height = available.y.max(220.0); + width = height * aspect; + } + let (response, painter) = ui.allocate_painter(Vec2::new(width, height), Sense::drag()); + let image_rect = response.rect; + painter.image( + texture.id(), + image_rect, + Rect::from_min_max(Pos2::ZERO, Pos2::new(1.0, 1.0)), + Color32::WHITE, + ); + for annotation in self.annotations.iter().chain(self.active_annotation.iter()) { + draw_annotation_preview(&painter, image_rect, annotation); + } + + let pointer = response.interact_pointer_pos(); + if response.drag_started() { + if let Some(pointer) = pointer { + let mut annotation = + Annotation::new(self.annotation_tool, normalize_pointer(pointer, image_rect)); + annotation.color = self.annotation_color.to_array(); + annotation.width = self.annotation_width; + self.active_annotation = Some(annotation); + } + } + if response.dragged() { + if let (Some(pointer), Some(annotation)) = (pointer, self.active_annotation.as_mut()) { + let point = normalize_pointer(pointer, image_rect); + if matches!( + annotation.kind, + AnnotationKind::Brush | AnnotationKind::Mosaic + ) || annotation.points.len() == 1 + { + annotation.points.push(point); + } else { + annotation.points[1] = point; + } + } + } + if response.drag_stopped() { + if let Some(annotation) = self.active_annotation.take() { + if annotation.points.len() >= 2 { + self.annotations.push(annotation); + } + } + } + } + + fn ui_document_list(&mut self, ui: &mut egui::Ui) { + ui.add_space(8.0); + ui.horizontal(|ui| { + ui.label(RichText::new("资源管理器").size(16.0).strong()); + ui.with_layout(egui::Layout::right_to_left(egui::Align::Center), |ui| { + let count = self + .site + .as_ref() + .map(|site| site.documents.len()) + .unwrap_or_default(); + ui.label(RichText::new(format!("{count} 篇")).color(MUTED_TEXT)); + }); + }); + ui.add_space(8.0); + ui.add( + egui::TextEdit::singleline(&mut self.search) + .hint_text("搜索标题或路径…") + .desired_width(f32::INFINITY), + ); + ui.add_space(6.0); + ui.horizontal(|ui| { + ui.selectable_value(&mut self.language_filter, LanguageFilter::All, "全部"); + ui.selectable_value(&mut self.language_filter, LanguageFilter::Zh, "中文"); + ui.selectable_value(&mut self.language_filter, LanguageFilter::En, "EN"); + }); + ui.add_space(8.0); + + let documents = self + .site + .as_ref() + .map(|site| site.documents.clone()) + .unwrap_or_default(); + egui::ScrollArea::vertical() + .id_salt("document-explorer") + .auto_shrink([false, false]) + .show(ui, |ui| { + for section in [ + "index", + "docs", + "developer", + "plugin", + "download", + "disclosure", + ] { + let visible = documents + .iter() + .enumerate() + .filter(|(_, document)| { + document.section == section + && matches_language(document.language, self.language_filter) + && matches_search(document, &self.search) + }) + .collect::>(); + if visible.is_empty() { + continue; + } + ui.add_space(6.0); + ui.label( + RichText::new(section_label(section)) + .size(11.0) + .strong() + .color(MUTED_TEXT), + ); + ui.add_space(3.0); + for (index, document) in visible { + let selected = self.selected_document == Some(index); + let fill = if selected { + SELECTED_BG + } else { + Color32::TRANSPARENT + }; + let response = egui::Frame::new() + .fill(fill) + .corner_radius(6) + .inner_margin(egui::Margin::symmetric(8, 6)) + .show(ui, |ui| { + ui.horizontal(|ui| { + let language_color = if document.language == Language::Zh { + BRAND_CYAN + } else { + BRAND_PURPLE + }; + ui.colored_label( + language_color, + RichText::new(if document.language == Language::Zh { + "中" + } else { + "EN" + }) + .size(10.0) + .strong(), + ); + ui.vertical(|ui| { + ui.label(RichText::new(&document.title).strong()); + ui.label( + RichText::new(&document.relative_path) + .size(10.0) + .color(MUTED_TEXT), + ); + }); + }); + }) + .response + .interact(Sense::click()); + if response.clicked() { + self.select_document(index); + } + } + } + }); + } + + fn ui_workspace(&mut self, ctx: &egui::Context, ui: &mut egui::Ui) { + if self.site.is_none() { + self.ui_welcome(ui); + return; + } + match self.workspace_tab { + WorkspaceTab::Edit => self.ui_editor_workspace(ctx, ui), + WorkspaceTab::Tutorial => self.ui_tutorial_workspace(ctx, ui), + WorkspaceTab::Translate => self.ui_translation_workspace(ui), + WorkspaceTab::Export => self.ui_export_workspace(ctx, ui), + } + } + + fn ui_welcome(&mut self, ui: &mut egui::Ui) { + ui.centered_and_justified(|ui| { + egui::Frame::new() + .fill(PANEL_BG) + .stroke(Stroke::new(1.0, BORDER_COLOR)) + .corner_radius(14) + .inner_margin(egui::Margin::same(28)) + .show(ui, |ui| { + ui.set_max_width(620.0); + ui.label(RichText::new("AUTO-MAS DocForge").size(30.0).strong()); + ui.label( + RichText::new("把视频、截图和 Markdown 变成可直接发布的图文教程") + .size(16.0) + .color(MUTED_TEXT), + ); + ui.add_space(18.0); + for (number, title, description) in [ + ("1", "打开文档站", "选择 AUTO-MAS-docs 仓库根目录"), + ("2", "编辑或导入视频", "同屏预览,逐张整理关键步骤"), + ("3", "原子保存与导出", "生成 Markdown 教程和带图片的 PDF"), + ] { + ui.horizontal(|ui| { + ui.label(RichText::new(number).size(18.0).strong().color(BRAND_CYAN)); + ui.vertical(|ui| { + ui.label(RichText::new(title).strong()); + ui.label(RichText::new(description).color(MUTED_TEXT)); + }); + }); + ui.add_space(10.0); + } + if ui.add(primary_button("选择 AUTO-MAS-docs 目录")).clicked() { + if let Some(path) = rfd::FileDialog::new().pick_folder() { + self.open_site(path); + } + } + }); + }); + } + + fn ui_editor_workspace(&mut self, ctx: &egui::Context, ui: &mut egui::Ui) { + self.ui_document_header(ui, "Markdown 编辑器", "编辑与预览始终保持同步"); + ui.add_space(8.0); + ui.columns(2, |columns| { + panel_frame().show(&mut columns[0], |ui| { + self.ui_code_editor(ui); + }); + panel_frame().show(&mut columns[1], |ui| { + self.ui_markdown_preview(ctx, ui); + }); + }); + } + + fn ui_document_header(&mut self, ui: &mut egui::Ui, title: &str, subtitle: &str) { + let document = self.selected_document_ref().cloned(); + ui.horizontal(|ui| { + ui.vertical(|ui| { + ui.label(RichText::new(title).size(20.0).strong()); + if let Some(document) = &document { + ui.label( + RichText::new(format!("{} / {}", document.title, document.relative_path)) + .color(MUTED_TEXT), + ); + } else { + ui.label(RichText::new(subtitle).color(MUTED_TEXT)); + } + }); + ui.with_layout(egui::Layout::right_to_left(egui::Align::Center), |ui| { + if ui.add(primary_button("保存文档 Ctrl+S")).clicked() { + self.save_document(); + } + if ui + .add_enabled(self.is_dirty(), egui::Button::new("撤销未保存更改")) + .clicked() + { + self.discard_changes(); + } + if self.is_dirty() { + ui.label(RichText::new("● 未保存").color(WARNING_COLOR)); + } else if self.selected_document.is_some() { + ui.label(RichText::new("✓ 已保存").color(SUCCESS_COLOR)); + } + }); + }); + } + + fn ui_code_editor(&mut self, ui: &mut egui::Ui) { + ui.horizontal(|ui| { + ui.label(RichText::new("编辑").strong().color(BRAND_CYAN)); + ui.label(RichText::new("MARKDOWN").size(10.0).color(MUTED_TEXT)); + }); + ui.separator(); + + let line_count = self.markdown.lines().count().max(1); + let line_numbers = (1..=line_count) + .map(|line| format!("{line:>4}")) + .collect::>() + .join("\n"); + let editor_height = (ui.available_height() - 28.0).max(260.0); + egui::Frame::new() + .fill(EDITOR_BG) + .corner_radius(6) + .inner_margin(egui::Margin::same(8)) + .show(ui, |ui| { + egui::ScrollArea::vertical() + .id_salt("markdown-code-editor") + .max_height(editor_height) + .auto_shrink([false, false]) + .show(ui, |ui| { + ui.horizontal_top(|ui| { + ui.add( + egui::Label::new( + RichText::new(line_numbers) + .monospace() + .size(13.0) + .color(LINE_NUMBER_COLOR), + ) + .selectable(false), + ); + ui.separator(); + let output = egui::TextEdit::multiline(&mut self.markdown) + .code_editor() + .font(egui::TextStyle::Monospace) + .desired_rows(line_count.max(34)) + .desired_width((ui.available_width() - 8.0).max(260.0)) + .lock_focus(true) + .frame(false) + .show(ui); + if let Some(cursor) = output.cursor_range { + (self.editor_line, self.editor_column) = + cursor_position(&self.markdown, cursor.primary.index); + } + }); + }); + }); + ui.horizontal(|ui| { + ui.label( + RichText::new(format!( + "Ln {}, Col {} UTF-8 Markdown", + self.editor_line, self.editor_column + )) + .size(10.0) + .color(MUTED_TEXT), + ); + ui.with_layout(egui::Layout::right_to_left(egui::Align::Center), |ui| { + ui.label( + RichText::new(format!("{} 行", line_count)) + .size(10.0) + .color(MUTED_TEXT), + ); + }); + }); + } + + fn ui_markdown_preview(&mut self, ctx: &egui::Context, ui: &mut egui::Ui) { + ui.horizontal(|ui| { + ui.label(RichText::new("实时预览").strong().color(BRAND_PURPLE)); + ui.label(RichText::new("VITEPRESS").size(10.0).color(MUTED_TEXT)); + }); + ui.separator(); + + let preview_paths = self.site.as_ref().and_then(|site| { + self.selected_document + .and_then(|index| site.documents.get(index)) + .and_then(|document| site.document_path(document).ok()) + .map(|document_path| (site.root.clone(), document_path)) + }); + if let Some((site_root, document_path)) = &preview_paths { + ui.horizontal_wrapped(|ui| { + for check in markdown::check_document(&self.markdown, document_path, site_root) { + let (symbol, color) = match check.level { + markdown::CheckLevel::Info => ("✓", SUCCESS_COLOR), + markdown::CheckLevel::Warning => ("!", WARNING_COLOR), + markdown::CheckLevel::Error => ("×", ERROR_COLOR), + }; + ui.colored_label(color, format!("{symbol} {}", check.message)); + } + }); + ui.separator(); + } + + let blocks = markdown::preview_blocks(&self.markdown); + let mut edit_request: Option<(String, PathBuf)> = None; + egui::ScrollArea::vertical() + .id_salt("live-preview") + .auto_shrink([false, false]) + .show(ui, |ui| { + ui.set_max_width(820.0); + for block in blocks { + match block { + PreviewBlock::Heading { level, text } => { + let size = match level { + 1 => 28.0, + 2 => 22.0, + 3 => 18.0, + _ => 16.0, + }; + ui.add_space(if level <= 2 { 14.0 } else { 8.0 }); + ui.label( + RichText::new(markdown::inline_preview_text(&text)) + .size(size) + .strong(), + ); + } + PreviewBlock::Paragraph(text) => { + ui.add_space(5.0); + ui.label( + RichText::new(markdown::inline_preview_text(&text)).size(14.0), + ); + } + PreviewBlock::Code(text) => { + egui::Frame::new() + .fill(CODE_BLOCK_BG) + .stroke(Stroke::new(1.0, BORDER_COLOR)) + .corner_radius(6) + .inner_margin(egui::Margin::same(10)) + .show(ui, |ui| { + ui.label(RichText::new(text).monospace().color(CODE_TEXT)); + }); + } + PreviewBlock::Image { alt, source } => { + ui.add_space(8.0); + egui::Frame::new() + .fill(CARD_BG) + .stroke(Stroke::new(1.0, BORDER_COLOR)) + .corner_radius(8) + .inner_margin(egui::Margin::same(10)) + .show(ui, |ui| { + ui.horizontal(|ui| { + ui.label(RichText::new(&alt).strong()); + ui.with_layout( + egui::Layout::right_to_left(egui::Align::Center), + |ui| { + if let Some((site_root, document_path)) = + &preview_paths + { + let path = markdown::resolve_image_path( + &source, + document_path, + site_root, + ); + if path.is_file() + && ui + .add( + egui::Button::new( + "框选 / 箭头 / 涂抹", + ) + .fill(SELECTED_BG), + ) + .clicked() + { + edit_request = Some((source.clone(), path)); + } + } + }, + ); + }); + if let Some((site_root, document_path)) = &preview_paths { + let path = markdown::resolve_image_path( + &source, + document_path, + site_root, + ); + let key = path.to_string_lossy().to_string(); + if !self.preview_textures.contains_key(&key) { + if let Ok((texture, _)) = + load_texture_from_path(ctx, &path) + { + self.preview_textures.insert(key.clone(), texture); + } + } + if let Some(texture) = self.preview_textures.get(&key) { + let size = texture.size_vec2(); + let max_width = ui.available_width().min(760.0); + let scale = + (max_width / size.x).min(480.0 / size.y).min(1.0); + ui.image((texture.id(), size * scale)); + } else { + ui.colored_label( + ERROR_COLOR, + format!("无法显示:{}", path.display()), + ); + } + } + ui.label(RichText::new(&source).size(10.0).color(MUTED_TEXT)); + }); + } + PreviewBlock::Callout { kind, text } => { + egui::Frame::new() + .fill(CALLOUT_BG) + .stroke(Stroke::new(1.0, BRAND_PURPLE)) + .corner_radius(7) + .inner_margin(egui::Margin::same(10)) + .show(ui, |ui| { + ui.label(RichText::new(kind).strong().color(BRAND_CYAN)); + ui.label(markdown::inline_preview_text(&text)); + }); + } + PreviewBlock::Rule => { + ui.add_space(6.0); + ui.separator(); + } + } + } + }); + if let Some((reference, path)) = edit_request { + self.open_document_image(ctx, reference, path); + } + } + + fn ui_translation_workspace(&mut self, ui: &mut egui::Ui) { + self.ui_document_header(ui, "多语言翻译", "生成草稿、人工校对、再原子保存"); + ui.add_space(8.0); + ui.columns(2, |columns| { + panel_frame().show(&mut columns[0], |ui| { + ui.label(RichText::new("翻译设置").size(17.0).strong()); + ui.label( + RichText::new("兼容 OpenAI /chat/completions,密钥只保存在本次运行内存。") + .color(MUTED_TEXT), + ); + ui.add_space(10.0); + field_label(ui, "接口地址"); + ui.add( + egui::TextEdit::singleline(&mut self.translation.endpoint) + .hint_text("https://api.example.com/v1") + .desired_width(f32::INFINITY), + ); + field_label(ui, "模型"); + ui.add( + egui::TextEdit::singleline(&mut self.translation.model) + .hint_text("模型名称") + .desired_width(f32::INFINITY), + ); + field_label(ui, "API Key"); + ui.add( + egui::TextEdit::singleline(&mut self.translation.api_key) + .password(true) + .hint_text("不会写入磁盘") + .desired_width(f32::INFINITY), + ); + ui.horizontal(|ui| { + ui.vertical(|ui| { + field_label(ui, "源语言"); + ui.add( + egui::TextEdit::singleline(&mut self.translation.source_language) + .desired_width(120.0), + ); + }); + ui.vertical(|ui| { + field_label(ui, "目标语言"); + ui.add( + egui::TextEdit::singleline(&mut self.translation.target_language) + .desired_width(120.0), + ); + }); + }); + ui.add_space(14.0); + let translating = self.translation_receiver.is_some(); + if ui + .add_enabled( + !translating && self.selected_document.is_some(), + primary_button(if translating { + "正在翻译…" + } else { + "生成翻译草稿" + }), + ) + .clicked() + { + self.start_translation(); + } + }); + + panel_frame().show(&mut columns[1], |ui| { + ui.label(RichText::new("译文校对").size(17.0).strong()); + ui.label( + RichText::new("只有点击保存后,译文才会写入对应语言文件。").color(MUTED_TEXT), + ); + ui.add_space(10.0); + let mut use_result = false; + let mut save_counterpart = false; + if let Some(result) = &mut self.translation_result { + ui.add( + egui::TextEdit::multiline(result) + .code_editor() + .desired_rows(28) + .desired_width(f32::INFINITY), + ); + ui.horizontal(|ui| { + use_result = ui.button("替换当前编辑草稿").clicked(); + save_counterpart = ui.add(primary_button("保存到对应语言文件")).clicked(); + }); + } else { + ui.centered_and_justified(|ui| { + ui.label( + RichText::new("译文会显示在这里\n\n先在左侧完成接口配置") + .color(MUTED_TEXT), + ); + }); + } + if use_result { + if let Some(result) = &self.translation_result { + self.markdown = result.clone(); + self.status = "译文已复制到当前编辑草稿,尚未保存。".to_string(); + } + } + if save_counterpart { + self.save_translation_to_counterpart(); + } + }); + }); + } + + fn ui_export_workspace(&mut self, ctx: &egui::Context, ui: &mut egui::Ui) { + self.ui_document_header( + ui, + "导出当前文档", + "导出内容始终取自左侧正在编辑的 Markdown", + ); + ui.add_space(8.0); + ui.columns(2, |columns| { + panel_frame().show(&mut columns[0], |ui| { + ui.label(RichText::new("PDF 导出").size(20.0).strong()); + ui.label( + RichText::new("标题、正文和当前文档中的本地图片都会写入 PDF。") + .color(MUTED_TEXT), + ); + ui.add_space(14.0); + if let Some(document) = self.selected_document_ref() { + info_row(ui, "当前文档", &document.title); + info_row(ui, "文件位置", &document.relative_path); + info_row( + ui, + "内容状态", + if self.is_dirty() { + "包含尚未保存的编辑内容" + } else { + "与磁盘文件一致" + }, + ); + } else { + ui.colored_label(WARNING_COLOR, "请先从资源管理器选择一篇文档。"); + } + ui.add_space(12.0); + ui.horizontal(|ui| { + if ui.button("选择 PDF 字体").clicked() { + if let Some(path) = rfd::FileDialog::new() + .add_filter("字体", &["ttf", "otf"]) + .pick_file() + { + self.pdf_font = Some(path); + } + } + ui.label( + RichText::new( + self.pdf_font + .as_ref() + .and_then(|path| path.file_name()) + .and_then(|name| name.to_str()) + .unwrap_or("自动使用 Windows 中文字体"), + ) + .color(MUTED_TEXT), + ); + }); + ui.add_space(14.0); + if ui + .add_enabled( + self.selected_document.is_some(), + primary_button("导出当前编辑内容为 PDF"), + ) + .clicked() + { + self.export_pdf(ctx); + } + ui.add_space(8.0); + if ui.button("从 PDF 导入为当前 Markdown 草稿").clicked() { + self.import_pdf(ctx); + } + }); + panel_frame().show(&mut columns[1], |ui| { + self.ui_pdf_preview(ui); + }); + }); + } + + fn ui_pdf_preview(&mut self, ui: &mut egui::Ui) { + ui.label(RichText::new("PDF 页面预览").size(17.0).strong()); + let Some(preview) = &self.pdf_preview else { + ui.centered_and_justified(|ui| { + ui.label( + RichText::new("导出后会在这里显示 PDF 首页\n并标出页数与保存位置") + .color(MUTED_TEXT), + ); + }); + return; + }; + ui.label( + RichText::new(format!( + "{} 页 · {}", + preview.pages, + preview.path.display() + )) + .color(MUTED_TEXT), + ); + ui.separator(); + egui::ScrollArea::vertical() + .id_salt("pdf-preview") + .show(ui, |ui| { + if let Some(texture) = &self.pdf_image { + let size = texture.size_vec2(); + let scale = (ui.available_width() / size.x).min(680.0 / size.y).min(1.0); + egui::Frame::new() + .fill(Color32::WHITE) + .inner_margin(egui::Margin::same(8)) + .show(ui, |ui| { + ui.image((texture.id(), size * scale)); + }); + } + ui.add_space(8.0); + ui.collapsing("查看 PDF 提取文字", |ui| { + ui.label(&preview.text); + }); + }); + } + + fn ui_tutorial_workspace(&mut self, ctx: &egui::Context, ui: &mut egui::Ui) { + ui.horizontal(|ui| { + ui.vertical(|ui| { + ui.label(RichText::new("视频教程工坊").size(20.0).strong()); + ui.label( + RichText::new("导入视频 → 自动截取 → 编辑步骤 → 生成站点教程") + .color(MUTED_TEXT), + ); + }); + ui.with_layout(egui::Layout::right_to_left(egui::Align::Center), |ui| { + if ui + .add_enabled( + self.video_path.is_some(), + primary_button("一键截图并生成教程"), + ) + .clicked() + { + self.one_click_generate_from_video(ctx); + } + }); + }); + ui.add_space(8.0); + ui.horizontal_wrapped(|ui| { + step_chip(ui, "1", "导入视频", self.video_path.is_some()); + step_chip(ui, "2", "关键画面", !self.tutorial_steps.is_empty()); + step_chip( + ui, + "3", + "编辑与说明", + self.tutorial_steps + .iter() + .any(|step| !step.description.trim().is_empty()), + ); + step_chip(ui, "4", "生成文档", false); + }); + ui.add_space(8.0); + + ui.columns(2, |columns| { + egui::ScrollArea::vertical() + .id_salt("tutorial-workflow") + .auto_shrink([false, false]) + .show(&mut columns[0], |ui| { + panel_frame().show(ui, |ui| { + ui.horizontal(|ui| { + ui.label(RichText::new("① 视频来源").size(16.0).strong()); + ui.with_layout( + egui::Layout::right_to_left(egui::Align::Center), + |ui| { + if ui.button("选择视频…").clicked() { + self.choose_video(); + } + }, + ); + }); + ui.label( + RichText::new( + self.video_path + .as_ref() + .map(|path| path.display().to_string()) + .unwrap_or_else(|| "尚未选择视频".to_string()), + ) + .color(MUTED_TEXT), + ); + ui.horizontal_wrapped(|ui| { + ui.label( + self.video_duration + .map(|seconds| format!("时长 {seconds:.1} 秒")) + .unwrap_or_else(|| "等待读取时长".to_string()), + ); + ui.separator(); + ui.label("画面数量"); + ui.add(egui::DragValue::new(&mut self.capture_count).range(1..=50)); + }); + if let Some(duration) = self.video_duration { + ui.add( + egui::Slider::new( + &mut self.capture_seconds, + 0.0..=duration.max(0.1), + ) + .text("自由截图位置"), + ); + } + ui.horizontal_wrapped(|ui| { + if ui + .add_enabled( + self.video_path.is_some(), + egui::Button::new("自动识别关键画面"), + ) + .clicked() + { + self.capture_key_frames(ctx); + } + if ui + .add_enabled( + self.video_path.is_some(), + egui::Button::new("均匀截取"), + ) + .clicked() + { + self.capture_even_frames(ctx); + } + if ui + .add_enabled( + self.video_path.is_some(), + egui::Button::new("截取当前位置"), + ) + .clicked() + { + self.capture_manual_frame(ctx); + } + }); + }); + ui.add_space(8.0); + + panel_frame().show(ui, |ui| { + ui.label(RichText::new("② 教程信息与位置").size(16.0).strong()); + ui.horizontal(|ui| { + ui.selectable_value( + &mut self.tutorial_target, + TutorialTarget::NewDocument, + "生成新教程文件", + ); + ui.selectable_value( + &mut self.tutorial_target, + TutorialTarget::CurrentDocument, + "追加到当前文档", + ); + }); + field_label(ui, "教程标题"); + ui.add( + egui::TextEdit::singleline(&mut self.tutorial_title) + .desired_width(f32::INFINITY), + ); + field_label(ui, "教程简介"); + ui.add( + egui::TextEdit::multiline(&mut self.tutorial_summary) + .desired_rows(2) + .desired_width(f32::INFINITY), + ); + if self.tutorial_target == TutorialTarget::NewDocument { + field_label(ui, "开始前准备"); + ui.add( + egui::TextEdit::singleline(&mut self.tutorial_prerequisites) + .desired_width(f32::INFINITY), + ); + ui.horizontal(|ui| { + egui::ComboBox::from_label("语言") + .selected_text(self.tutorial_language.label()) + .show_ui(ui, |ui| { + ui.selectable_value( + &mut self.tutorial_language, + Language::Zh, + "中文", + ); + ui.selectable_value( + &mut self.tutorial_language, + Language::En, + "English", + ); + }); + egui::ComboBox::from_label("栏目") + .selected_text( + SECTIONS + .get(self.tutorial_section) + .copied() + .unwrap_or("docs"), + ) + .show_ui(ui, |ui| { + for (index, section) in SECTIONS.iter().enumerate() { + ui.selectable_value( + &mut self.tutorial_section, + index, + section_label(section), + ); + } + }); + }); + field_label(ui, "文件名"); + ui.horizontal(|ui| { + ui.add( + egui::TextEdit::singleline(&mut self.tutorial_file_stem) + .desired_width(240.0), + ); + ui.label(".md"); + }); + } + ui.add_space(10.0); + if ui + .add_enabled( + !self.tutorial_steps.is_empty(), + primary_button( + if self.tutorial_target == TutorialTarget::NewDocument { + "生成并打开教程文档" + } else { + "追加教程并原子保存" + }, + ), + ) + .clicked() + { + self.generate_tutorial_document(); + } + }); + ui.add_space(8.0); + + ui.label( + RichText::new(format!( + "③ 教程步骤({} 张画面)", + self.tutorial_steps.len() + )) + .size(16.0) + .strong(), + ); + let mut frame_to_open = None; + let mut remove_step = None; + for index in 0..self.tutorial_steps.len() { + let frame = self.tutorial_steps[index].frame.clone(); + let key = format!("tutorial-thumbnail-{}", frame.display()); + if !self.preview_textures.contains_key(&key) { + if let Ok((texture, _)) = load_texture_from_path(ctx, &frame) { + self.preview_textures.insert(key.clone(), texture); + } + } + let texture = self.preview_textures.get(&key).cloned(); + let selected = self.selected_frame == Some(index) + && self.document_image_edit.is_none(); + egui::Frame::new() + .fill(if selected { SELECTED_BG } else { CARD_BG }) + .stroke(Stroke::new(1.0, BORDER_COLOR)) + .corner_radius(8) + .inner_margin(egui::Margin::same(9)) + .show(ui, |ui| { + ui.horizontal_top(|ui| { + if let Some(texture) = texture { + let size = texture.size_vec2(); + let scale = (116.0 / size.x).min(78.0 / size.y).min(1.0); + if ui + .add(egui::Button::image((texture.id(), size * scale))) + .clicked() + { + frame_to_open = Some(frame.clone()); + } + } + let step = &mut self.tutorial_steps[index]; + ui.vertical(|ui| { + ui.horizontal(|ui| { + ui.label( + RichText::new(format!("步骤 {}", index + 1)) + .strong() + .color(BRAND_CYAN), + ); + if let Some(seconds) = step.timestamp { + ui.label( + RichText::new(format_time(seconds)) + .size(10.0) + .color(MUTED_TEXT), + ); + } + if ui.small_button("移除").clicked() { + remove_step = Some(index); + } + }); + ui.add( + egui::TextEdit::singleline(&mut step.title) + .hint_text("步骤标题") + .desired_width(f32::INFINITY), + ); + ui.add( + egui::TextEdit::multiline(&mut step.description) + .hint_text("说明用户在这一步要做什么") + .desired_rows(2) + .desired_width(f32::INFINITY), + ); + }); + }); + }); + ui.add_space(6.0); + } + if let Some(index) = remove_step { + self.tutorial_steps.remove(index); + self.selected_frame = None; + } + if let Some(frame) = frame_to_open { + self.document_image_edit = None; + self.open_frame(ctx, frame); + } + }); + + panel_frame().show(&mut columns[1], |ui| { + ui.horizontal(|ui| { + ui.vertical(|ui| { + ui.label(RichText::new("画面编辑器").size(17.0).strong()); + let source = self + .document_image_edit + .as_ref() + .map(|edit| format!("当前文档图片:{}", edit.reference)) + .unwrap_or_else(|| "视频关键画面".to_string()); + ui.label(RichText::new(source).color(MUTED_TEXT)); + }); + }); + ui.add_space(6.0); + ui.horizontal_wrapped(|ui| { + for tool in [ + AnnotationKind::Rectangle, + AnnotationKind::Arrow, + AnnotationKind::Brush, + AnnotationKind::Mosaic, + AnnotationKind::Crop, + ] { + ui.selectable_value(&mut self.annotation_tool, tool, tool.label()); + } + }); + ui.horizontal_wrapped(|ui| { + ui.label("颜色"); + ui.color_edit_button_srgba(&mut self.annotation_color); + ui.add( + egui::DragValue::new(&mut self.annotation_width) + .range(1.0..=16.0) + .prefix("粗细 "), + ); + if ui.button("撤销").clicked() { + self.annotations.pop(); + } + if ui.button("清空").clicked() { + self.annotations.clear(); + self.active_annotation = None; + } + }); + ui.separator(); + self.draw_annotation_canvas(ui); + ui.separator(); + ui.horizontal_wrapped(|ui| { + let save_label = if self.document_image_edit.is_some() { + "保存副本并替换文档引用" + } else { + "保存标注后的关键画面" + }; + if ui.add(primary_button(save_label)).clicked() { + self.save_annotated_frame(ctx); + } + if self.document_image_edit.is_none() { + if ui.button("插入当前文档草稿").clicked() { + self.insert_current_frame(false); + } + if ui.button("插入并原子保存").clicked() { + self.insert_current_frame(true); + } + } + }); + }); + }); + } + + fn ui_top_bar(&mut self, ui: &mut egui::Ui) { + ui.horizontal(|ui| { + egui::Frame::new() + .fill(BRAND_PURPLE) + .corner_radius(8) + .inner_margin(egui::Margin::symmetric(9, 5)) + .show(ui, |ui| { + ui.label(RichText::new("◆").size(18.0).strong().color(Color32::WHITE)); + }); + ui.vertical(|ui| { + ui.label(RichText::new("AUTO-MAS DocForge").size(16.0).strong()); + ui.label( + RichText::new("文档与视频教程工作台") + .size(10.0) + .color(MUTED_TEXT), + ); + }); + ui.separator(); + if let Some(site) = &self.site { + ui.label(RichText::new(display_path(&site.root)).color(MUTED_TEXT)); + } else { + ui.label(RichText::new("尚未打开文档站").color(MUTED_TEXT)); + } + ui.with_layout(egui::Layout::right_to_left(egui::Align::Center), |ui| { + if ui.add(primary_button("保存")).clicked() { + self.save_document(); + } + if ui.button("导出 PDF").clicked() { + self.workspace_tab = WorkspaceTab::Export; + } + if ui.button("打开文档站").clicked() { + if let Some(path) = rfd::FileDialog::new().pick_folder() { + self.open_site(path); + } + } + }); + }); + } + + fn ui_activity_bar(&mut self, ui: &mut egui::Ui) { + ui.add_space(10.0); + for (tab, icon, label) in [ + (WorkspaceTab::Edit, "", "编辑"), + (WorkspaceTab::Tutorial, "▶", "视频教程"), + (WorkspaceTab::Translate, "译", "翻译"), + (WorkspaceTab::Export, "PDF", "导出"), + ] { + if workspace_nav_button(ui, self.workspace_tab == tab, icon, label).clicked() { + self.workspace_tab = tab; + } + ui.add_space(6.0); + } + } +} + +impl eframe::App for DocforgeApp { + fn update(&mut self, ctx: &egui::Context, _frame: &mut eframe::Frame) { + self.poll_translation(); + if ctx.input_mut(|input| input.consume_key(egui::Modifiers::CTRL, egui::Key::S)) { + self.save_document(); + } + if ctx.input(|input| input.viewport().close_requested()) && self.is_dirty() { + ctx.send_viewport_cmd(egui::ViewportCommand::CancelClose); + self.confirm_close = true; + } + if self.confirm_close { + let mut continue_editing = false; + let mut exit_without_saving = false; + egui::Window::new("文档尚未保存") + .collapsible(false) + .resizable(false) + .anchor(egui::Align2::CENTER_CENTER, Vec2::ZERO) + .show(ctx, |ui| { + ui.label("当前文档还有修改。"); + ui.horizontal(|ui| { + continue_editing = ui.button("继续编辑").clicked(); + exit_without_saving = ui.button("不保存并退出").clicked(); + }); + }); + if continue_editing { + self.confirm_close = false; + } + if exit_without_saving { + self.saved_markdown = self.markdown.clone(); + self.confirm_close = false; + ctx.send_viewport_cmd(egui::ViewportCommand::Close); + } + } + egui::TopBottomPanel::top("toolbar") + .exact_height(56.0) + .frame( + egui::Frame::new() + .fill(TOP_BAR_BG) + .inner_margin(egui::Margin::symmetric(12, 8)), + ) + .show(ctx, |ui| self.ui_top_bar(ui)); + egui::SidePanel::left("activity") + .exact_width(86.0) + .resizable(false) + .frame( + egui::Frame::new() + .fill(ACTIVITY_BG) + .inner_margin(egui::Margin::symmetric(6, 4)), + ) + .show(ctx, |ui| self.ui_activity_bar(ui)); + egui::SidePanel::left("documents") + .resizable(true) + .default_width(286.0) + .width_range(230.0..=420.0) + .frame( + egui::Frame::new() + .fill(SIDEBAR_BG) + .inner_margin(egui::Margin::symmetric(10, 4)), + ) + .show(ctx, |ui| self.ui_document_list(ui)); + egui::TopBottomPanel::bottom("status") + .exact_height(28.0) + .frame( + egui::Frame::new() + .fill(STATUS_BG) + .inner_margin(egui::Margin::symmetric(10, 5)), + ) + .show(ctx, |ui| { + ui.horizontal(|ui| { + ui.label(RichText::new("●").color(BRAND_CYAN)); + ui.label(RichText::new(&self.status).size(11.0)); + }); + }); + egui::CentralPanel::default() + .frame( + egui::Frame::new() + .fill(APP_BG) + .inner_margin(egui::Margin::same(12)), + ) + .show(ctx, |ui| self.ui_workspace(ctx, ui)); + } +} + +const APP_BG: Color32 = Color32::from_rgb(13, 15, 23); +const TOP_BAR_BG: Color32 = Color32::from_rgb(20, 22, 33); +const ACTIVITY_BG: Color32 = Color32::from_rgb(17, 19, 29); +const SIDEBAR_BG: Color32 = Color32::from_rgb(23, 25, 37); +const PANEL_BG: Color32 = Color32::from_rgb(26, 29, 43); +const CARD_BG: Color32 = Color32::from_rgb(30, 33, 48); +const EDITOR_BG: Color32 = Color32::from_rgb(15, 17, 26); +const CODE_BLOCK_BG: Color32 = Color32::from_rgb(12, 14, 22); +const CALLOUT_BG: Color32 = Color32::from_rgb(34, 29, 58); +const STATUS_BG: Color32 = Color32::from_rgb(68, 58, 148); +const SELECTED_BG: Color32 = Color32::from_rgb(45, 43, 78); +const BORDER_COLOR: Color32 = Color32::from_rgb(50, 54, 75); +const LINE_NUMBER_COLOR: Color32 = Color32::from_rgb(92, 98, 122); +const MUTED_TEXT: Color32 = Color32::from_rgb(155, 161, 184); +const BRAND_PURPLE: Color32 = Color32::from_rgb(157, 100, 255); +const BRAND_CYAN: Color32 = Color32::from_rgb(65, 209, 255); +const SUCCESS_COLOR: Color32 = Color32::from_rgb(72, 199, 142); +const WARNING_COLOR: Color32 = Color32::from_rgb(245, 181, 71); +const ERROR_COLOR: Color32 = Color32::from_rgb(244, 100, 112); +const CODE_TEXT: Color32 = Color32::from_rgb(199, 214, 255); + +fn install_mas_theme(ctx: &egui::Context) { + ctx.set_theme(egui::Theme::Dark); + let mut style = (*ctx.style()).clone(); + style.visuals = egui::Visuals::dark(); + style.visuals.panel_fill = APP_BG; + style.visuals.window_fill = PANEL_BG; + style.visuals.extreme_bg_color = EDITOR_BG; + style.visuals.faint_bg_color = CARD_BG; + style.visuals.selection.bg_fill = Color32::from_rgb(76, 65, 148); + style.visuals.selection.stroke = Stroke::new(1.0, BRAND_CYAN); + style.visuals.widgets.inactive.bg_fill = CARD_BG; + style.visuals.widgets.inactive.weak_bg_fill = CARD_BG; + style.visuals.widgets.inactive.bg_stroke = Stroke::new(1.0, BORDER_COLOR); + style.visuals.widgets.hovered.bg_fill = SELECTED_BG; + style.visuals.widgets.hovered.bg_stroke = Stroke::new(1.0, BRAND_PURPLE); + style.visuals.widgets.active.bg_fill = Color32::from_rgb(78, 64, 150); + style.visuals.widgets.active.bg_stroke = Stroke::new(1.0, BRAND_CYAN); + style.spacing.item_spacing = Vec2::new(8.0, 7.0); + style.spacing.button_padding = Vec2::new(10.0, 6.0); + style.text_styles.insert( + egui::TextStyle::Body, + egui::FontId::new(14.0, FontFamily::Proportional), + ); + style.text_styles.insert( + egui::TextStyle::Monospace, + egui::FontId::new(13.5, FontFamily::Monospace), + ); + ctx.set_style(style); +} + +fn panel_frame() -> egui::Frame { + egui::Frame::new() + .fill(PANEL_BG) + .stroke(Stroke::new(1.0, BORDER_COLOR)) + .corner_radius(9) + .inner_margin(egui::Margin::same(12)) +} + +fn primary_button(text: &'static str) -> egui::Button<'static> { + egui::Button::new(RichText::new(text).strong().color(Color32::WHITE)) + .fill(Color32::from_rgb(87, 70, 176)) + .stroke(Stroke::new(1.0, BRAND_PURPLE)) +} + +fn workspace_nav_button( + ui: &mut egui::Ui, + selected: bool, + icon: &'static str, + label: &'static str, +) -> egui::Response { + let text = RichText::new(format!("{icon}\n{label}")) + .size(12.0) + .strong() + .color(if selected { Color32::WHITE } else { MUTED_TEXT }); + ui.add_sized( + [72.0, 54.0], + egui::Button::new(text) + .fill(if selected { + SELECTED_BG + } else { + Color32::TRANSPARENT + }) + .stroke(if selected { + Stroke::new(1.0, BRAND_PURPLE) + } else { + Stroke::NONE + }), + ) +} + +fn step_chip(ui: &mut egui::Ui, number: &str, label: &str, complete: bool) { + let color = if complete { SUCCESS_COLOR } else { MUTED_TEXT }; + egui::Frame::new() + .fill(if complete { + Color32::from_rgb(24, 55, 48) + } else { + CARD_BG + }) + .stroke(Stroke::new(1.0, color)) + .corner_radius(12) + .inner_margin(egui::Margin::symmetric(10, 5)) + .show(ui, |ui| { + ui.label( + RichText::new(format!("{number} {label}")) + .strong() + .color(color), + ); + }); +} + +fn field_label(ui: &mut egui::Ui, label: &str) { + ui.add_space(8.0); + ui.label(RichText::new(label).size(11.0).strong().color(MUTED_TEXT)); +} + +fn info_row(ui: &mut egui::Ui, label: &str, value: &str) { + ui.horizontal_wrapped(|ui| { + ui.label(RichText::new(label).color(MUTED_TEXT)); + ui.label(RichText::new(value).strong()); + }); +} + +fn section_label(section: &str) -> &'static str { + match section { + "index" => "站点首页", + "docs" => "使用文档", + "developer" => "开发者文档", + "plugin" => "插件文档", + "download" => "下载说明", + "disclosure" => "信息公开", + _ => "其他文档", + } +} + +fn cursor_position(source: &str, character_index: usize) -> (usize, usize) { + let before = source.chars().take(character_index).collect::(); + let line = before + .chars() + .filter(|character| *character == '\n') + .count() + + 1; + let column = before + .rsplit_once('\n') + .map(|(_, line)| line.chars().count() + 1) + .unwrap_or_else(|| before.chars().count() + 1); + (line, column) +} + +fn format_time(seconds: f64) -> String { + let total = seconds.max(0.0).round() as u64; + format!("{:02}:{:02}", total / 60, total % 60) +} + +fn replace_reference_file_name(reference: &str, file_name: &str) -> String { + let clean = reference.split(['?', '#']).next().unwrap_or(reference); + clean + .rsplit_once('/') + .map(|(directory, _)| format!("{directory}/{file_name}")) + .unwrap_or_else(|| file_name.to_string()) +} + +fn display_path(path: &Path) -> String { + path.to_string_lossy() + .trim_start_matches(r"\\?\") + .to_string() +} + +fn install_chinese_font(ctx: &egui::Context) { + let mut candidates = Vec::new(); + if let Ok(executable) = std::env::current_exe() { + if let Some(directory) = executable.parent() { + for name in [ + "NotoSansCJKsc-Regular.otf", + "SourceHanSansCN-Regular.otf", + "simhei.ttf", + "Deng.ttf", + ] { + candidates.push(directory.join("fonts").join(name)); + } + } + } + let windows = std::env::var_os("WINDIR") + .map(PathBuf::from) + .unwrap_or_else(|| PathBuf::from(r"C:\Windows")); + for name in ["simhei.ttf", "Deng.ttf", "msyh.ttc"] { + candidates.push(windows.join("Fonts").join(name)); + } + + for path in candidates { + let Ok(bytes) = fs::read(&path) else { + continue; + }; + let mut fonts = FontDefinitions::default(); + let name = "docforge-cjk".to_string(); + fonts + .font_data + .insert(name.clone(), Arc::new(FontData::from_owned(bytes))); + for family in [FontFamily::Proportional, FontFamily::Monospace] { + fonts.families.entry(family).or_default().push(name.clone()); + } + ctx.set_fonts(fonts); + return; + } +} +fn load_texture_from_path( + ctx: &egui::Context, + path: &Path, +) -> Result<(egui::TextureHandle, [usize; 2])> { + let bytes = fs::read(path).with_context(|| format!("cannot read {}", path.display()))?; + let texture = load_texture_from_bytes(ctx, &format!("frame-{}", path.display()), &bytes)?; + let size = texture.size(); + Ok((texture, size)) +} + +fn load_texture_from_bytes( + ctx: &egui::Context, + name: &str, + bytes: &[u8], +) -> Result { + let image = image::load_from_memory(bytes) + .context("cannot decode image")? + .to_rgba8(); + let size = [image.width() as usize, image.height() as usize]; + Ok(ctx.load_texture( + name, + ColorImage::from_rgba_unmultiplied(size, image.as_raw()), + TextureOptions::LINEAR, + )) +} + +fn draw_annotation_preview(painter: &egui::Painter, rect: Rect, annotation: &Annotation) { + let color = Color32::from_rgba_unmultiplied( + annotation.color[0], + annotation.color[1], + annotation.color[2], + annotation.color[3], + ); + let stroke = Stroke::new(annotation.width, color); + let points = annotation + .points + .iter() + .map(|point| { + Pos2::new( + rect.left() + rect.width() * point[0], + rect.top() + rect.height() * point[1], + ) + }) + .collect::>(); + match annotation.kind { + AnnotationKind::Rectangle if points.len() >= 2 => { + painter.rect_stroke( + Rect::from_two_pos(points[0], points[1]), + 0.0, + stroke, + egui::StrokeKind::Outside, + ); + } + AnnotationKind::Arrow if points.len() >= 2 => { + painter.line_segment([points[0], points[1]], stroke); + let angle = (points[1].y - points[0].y).atan2(points[1].x - points[0].x); + let head = (annotation.width * 4.0).max(14.0); + for delta in [2.6_f32, -2.6_f32] { + let point = Pos2::new( + points[1].x + head * (angle + delta).cos(), + points[1].y + head * (angle + delta).sin(), + ); + painter.line_segment([points[1], point], stroke); + } + } + AnnotationKind::Brush if points.len() >= 2 => { + for pair in points.windows(2) { + painter.line_segment([pair[0], pair[1]], stroke); + } + } + AnnotationKind::Mosaic if points.len() >= 2 => { + let mosaic_stroke = Stroke::new( + (annotation.width * 6.0).max(18.0), + Color32::from_rgba_unmultiplied(90, 90, 90, 150), + ); + for pair in points.windows(2) { + painter.line_segment([pair[0], pair[1]], mosaic_stroke); + } + } + AnnotationKind::Crop if points.len() >= 2 => { + painter.rect_stroke( + Rect::from_two_pos(points[0], points[1]), + 0.0, + Stroke::new(2.0, Color32::from_rgb(35, 180, 210)), + egui::StrokeKind::Outside, + ); + } + _ => {} + } +} + +fn normalize_pointer(pointer: Pos2, rect: Rect) -> [f32; 2] { + [ + ((pointer.x - rect.left()) / rect.width()).clamp(0.0, 1.0), + ((pointer.y - rect.top()) / rect.height()).clamp(0.0, 1.0), + ] +} + +fn matches_language(language: Language, filter: LanguageFilter) -> bool { + matches!( + (language, filter), + (_, LanguageFilter::All) + | (Language::Zh, LanguageFilter::Zh) + | (Language::En, LanguageFilter::En) + ) +} + +fn matches_search(document: &DocumentRef, query: &str) -> bool { + let query = query.trim().to_lowercase(); + query.is_empty() + || document.title.to_lowercase().contains(&query) + || document.relative_path.to_lowercase().contains(&query) +} + +fn safe_stem(value: &str) -> String { + let result = value + .chars() + .map(|character| { + if character.is_ascii_alphanumeric() { + character.to_ascii_lowercase() + } else { + '-' + } + }) + .collect::() + .trim_matches('-') + .to_string(); + if result.is_empty() { + "auto-mas-document".to_string() + } else { + result + } +} + +fn unique_media_name(source: &Path) -> String { + let stem = source + .file_stem() + .and_then(|value| value.to_str()) + .map(safe_stem) + .unwrap_or_else(|| "capture".to_string()); + let stamp = std::time::SystemTime::now() + .duration_since(std::time::UNIX_EPOCH) + .unwrap_or_default() + .as_millis(); + format!("{stem}-{stamp}.png") +} diff --git a/tools/docforge/src/atomic.rs b/tools/docforge/src/atomic.rs new file mode 100644 index 0000000..5718bf2 --- /dev/null +++ b/tools/docforge/src/atomic.rs @@ -0,0 +1,154 @@ +use anyhow::{bail, Context, Result}; +use std::fs::{self, OpenOptions}; +use std::io::Write; +use std::path::{Path, PathBuf}; +use std::time::{SystemTime, UNIX_EPOCH}; + +pub fn atomic_write(path: &Path, bytes: &[u8]) -> Result<()> { + let parent = path + .parent() + .filter(|candidate| !candidate.as_os_str().is_empty()) + .unwrap_or_else(|| Path::new(".")); + fs::create_dir_all(parent).with_context(|| format!("cannot create {}", parent.display()))?; + + let file_name = path + .file_name() + .and_then(|name| name.to_str()) + .context("target path must have a valid file name")?; + let stamp = SystemTime::now() + .duration_since(UNIX_EPOCH) + .unwrap_or_default() + .as_nanos(); + let temp_path = parent.join(format!(".{file_name}.{stamp}.{}.tmp", std::process::id())); + + let result = (|| -> Result<()> { + let mut file = OpenOptions::new() + .write(true) + .create_new(true) + .open(&temp_path) + .with_context(|| format!("cannot create temporary file {}", temp_path.display()))?; + file.write_all(bytes)?; + file.flush()?; + file.sync_all()?; + replace_file(&temp_path, path)?; + sync_directory(parent)?; + Ok(()) + })(); + + if result.is_err() { + let _ = fs::remove_file(&temp_path); + } + result +} + +pub fn copy_atomic(source: &Path, destination: &Path) -> Result<()> { + let bytes = fs::read(source).with_context(|| format!("cannot read {}", source.display()))?; + atomic_write(destination, &bytes) +} + +pub fn ensure_inside(root: &Path, candidate: &Path) -> Result { + let root = root + .canonicalize() + .with_context(|| format!("cannot resolve site root {}", root.display()))?; + let parent = candidate + .parent() + .filter(|path| !path.as_os_str().is_empty()) + .unwrap_or_else(|| Path::new(".")); + let parent = parent + .canonicalize() + .with_context(|| format!("cannot resolve parent {}", parent.display()))?; + let candidate = parent.join( + candidate + .file_name() + .context("candidate path must have a file name")?, + ); + if !candidate.starts_with(&root) { + bail!( + "refusing to write outside site root: {}", + candidate.display() + ); + } + Ok(candidate) +} + +fn replace_file(source: &Path, destination: &Path) -> Result<()> { + #[cfg(windows)] + { + use std::os::windows::ffi::OsStrExt; + use windows_sys::Win32::Storage::FileSystem::{ + MoveFileExW, MOVEFILE_REPLACE_EXISTING, MOVEFILE_WRITE_THROUGH, + }; + + let source_wide: Vec = source + .as_os_str() + .encode_wide() + .chain(std::iter::once(0)) + .collect(); + let destination_wide: Vec = destination + .as_os_str() + .encode_wide() + .chain(std::iter::once(0)) + .collect(); + let result = unsafe { + MoveFileExW( + source_wide.as_ptr(), + destination_wide.as_ptr(), + MOVEFILE_REPLACE_EXISTING | MOVEFILE_WRITE_THROUGH, + ) + }; + if result == 0 { + return Err(std::io::Error::last_os_error()).with_context(|| { + format!( + "cannot atomically replace {} with {}", + destination.display(), + source.display() + ) + }); + } + Ok(()) + } + + #[cfg(not(windows))] + { + fs::rename(source, destination).with_context(|| { + format!( + "cannot atomically replace {} with {}", + destination.display(), + source.display() + ) + }) + } +} + +fn sync_directory(path: &Path) -> Result<()> { + #[cfg(unix)] + { + std::fs::File::open(path) + .with_context(|| format!("cannot open directory {}", path.display()))? + .sync_all()?; + } + #[cfg(not(unix))] + let _ = path; + Ok(()) +} + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn replaces_existing_file_without_leaving_temporary_file() { + let directory = tempfile::tempdir().expect("创建测试目录"); + let target = directory.path().join("document.md"); + atomic_write(&target, b"first").expect("首次写入"); + atomic_write(&target, b"second").expect("原子覆盖"); + assert_eq!(fs::read(&target).expect("读取结果"), b"second"); + assert_eq!( + fs::read_dir(directory.path()) + .expect("读取目录") + .filter_map(std::result::Result::ok) + .count(), + 1 + ); + } +} diff --git a/tools/docforge/src/main.rs b/tools/docforge/src/main.rs new file mode 100644 index 0000000..8edce44 --- /dev/null +++ b/tools/docforge/src/main.rs @@ -0,0 +1,133 @@ +#![cfg_attr(not(debug_assertions), windows_subsystem = "windows")] + +mod annotation; +mod app; +mod atomic; +mod markdown; +mod pdf; +mod site; +mod translation; +mod tutorial; +mod video; + +use anyhow::{Context, Result}; +use clap::{Parser, Subcommand}; +use std::path::PathBuf; + +#[derive(Debug, Parser)] +#[command(name = "docforge", version, about = "AUTO-MAS 文档站绿色编辑工具")] +struct Cli { + #[arg(long, help = "启动界面时自动打开这个 VitePress 文档站")] + site: Option, + #[command(subcommand)] + command: Option, +} + +#[derive(Debug, Subcommand)] +enum Command { + #[command(about = "扫描并输出文档站结构")] + Scan { + #[arg(value_name = "SITE_ROOT")] + site: PathBuf, + }, + #[command(about = "把 Markdown 文档导出为 PDF")] + ExportPdf { + #[arg(value_name = "MARKDOWN")] + markdown: PathBuf, + #[arg(value_name = "PDF")] + pdf: PathBuf, + #[arg(long)] + font: Option, + }, + #[command(about = "把 PDF 可复制文字转换为 Markdown")] + ImportPdf { + #[arg(value_name = "PDF")] + pdf: PathBuf, + #[arg(value_name = "MARKDOWN")] + markdown: PathBuf, + }, + #[command(about = "从视频中截取画面")] + Capture { + #[arg(value_name = "VIDEO")] + video: PathBuf, + #[arg(value_name = "OUTPUT_DIR")] + output_dir: PathBuf, + #[arg(long, default_value_t = 5)] + count: usize, + #[arg(long, help = "使用 FFmpeg 场景识别,而不是按时间均匀截图")] + key_frames: bool, + }, +} + +fn main() -> Result<()> { + let cli = Cli::parse(); + match cli.command { + Some(Command::Scan { site }) => { + let profile = site::SiteProfile::discover(&site)?; + println!("{}", serde_json::to_string_pretty(&profile)?); + Ok(()) + } + Some(Command::ExportPdf { + markdown, + pdf, + font, + }) => { + let source = std::fs::read_to_string(&markdown) + .with_context(|| format!("cannot read {}", markdown.display()))?; + let info = pdf::export_markdown_to_pdf( + &source, + &pdf, + pdf::PdfExportOptions { + custom_font: font.as_deref(), + document_path: Some(&markdown), + site_root: markdown.parent(), + }, + )?; + println!("created {} ({} pages)", info.path.display(), info.pages); + if let Some(warning) = info.warning { + eprintln!("warning: {warning}"); + } + Ok(()) + } + Some(Command::ImportPdf { pdf, markdown }) => { + let source = pdf::pdf_to_markdown(&pdf)?; + atomic::atomic_write(&markdown, source.as_bytes())?; + println!("created {}", markdown.display()); + Ok(()) + } + Some(Command::Capture { + video, + output_dir, + count, + key_frames, + }) => { + let tool = video::VideoTool::discover(None) + .context("ffmpeg was not found; put ffmpeg.exe beside docforge.exe or on PATH")?; + let frames = if key_frames { + tool.capture_keyframes(&video, &output_dir, count)? + } else { + tool.capture_evenly(&video, &output_dir, count)? + }; + for frame in frames { + println!("{}", frame.display()); + } + Ok(()) + } + None => { + let initial_site = cli.site; + let native_options = eframe::NativeOptions { + viewport: egui::ViewportBuilder::default() + .with_title("DocForge - AUTO-MAS 文档工坊") + .with_inner_size([1600.0, 960.0]) + .with_min_inner_size([1280.0, 760.0]), + ..Default::default() + }; + eframe::run_native( + "DocForge - AUTO-MAS 文档工坊", + native_options, + Box::new(move |cc| Ok(Box::new(app::DocforgeApp::new(cc, initial_site)))), + ) + .map_err(|error| anyhow::anyhow!("GUI failed: {error}")) + } + } +} diff --git a/tools/docforge/src/markdown.rs b/tools/docforge/src/markdown.rs new file mode 100644 index 0000000..e6bf8c1 --- /dev/null +++ b/tools/docforge/src/markdown.rs @@ -0,0 +1,437 @@ +use pulldown_cmark::{Event, Options, Parser, Tag, TagEnd}; +use std::path::{Path, PathBuf}; + +#[derive(Debug, Clone)] +pub struct CheckItem { + pub level: CheckLevel, + pub message: String, +} + +#[derive(Debug, Clone, Copy, PartialEq, Eq)] +pub enum CheckLevel { + Info, + Warning, + Error, +} + +#[derive(Debug, Clone, PartialEq, Eq)] +pub enum PreviewBlock { + Heading { level: u8, text: String }, + Paragraph(String), + Code(String), + Image { alt: String, source: String }, + Callout { kind: String, text: String }, + Rule, +} + +pub fn check_document(source: &str, document_path: &Path, site_root: &Path) -> Vec { + let mut checks = Vec::new(); + if !source + .lines() + .any(|line| line.trim_start().starts_with("# ")) + { + checks.push(CheckItem { + level: CheckLevel::Warning, + message: "没有找到一级标题(# 标题),建议补充页面标题。".to_string(), + }); + } + + let mut fence_open = false; + for line in source.lines() { + if line.trim_start().starts_with("```") { + fence_open = !fence_open; + } + } + if fence_open { + checks.push(CheckItem { + level: CheckLevel::Error, + message: "代码块没有闭合,请补上末尾的 ```。".to_string(), + }); + } + + let unclosed_containers = unclosed_container_count(source); + if unclosed_containers > 0 { + checks.push(CheckItem { + level: CheckLevel::Error, + message: format!( + "有 {unclosed_containers} 个 VitePress 容器没有闭合,请补上对应的 ::: 或 ::::。" + ), + }); + } + + for (alt, reference) in image_references(source) { + if reference.starts_with("http://") + || reference.starts_with("https://") + || reference.starts_with("data:") + { + continue; + } + let clean_reference = clean_image_reference(&reference); + let path = if clean_reference.starts_with('/') { + site_root.join(clean_reference.trim_start_matches('/')) + } else { + document_path + .parent() + .unwrap_or(site_root) + .join(clean_reference) + }; + if !path.is_file() { + checks.push(CheckItem { + level: CheckLevel::Error, + message: format!("图片不存在:{}(替代文字:{})", reference, alt), + }); + } + } + + if checks.is_empty() { + checks.push(CheckItem { + level: CheckLevel::Info, + message: "基础检查通过:标题、代码块和本地图片引用均正常。".to_string(), + }); + } + checks +} + +pub fn image_references(source: &str) -> Vec<(String, String)> { + let mut images = Vec::new(); + let parser = Parser::new_ext(source, Options::all()); + let mut current: Option<(String, String)> = None; + for event in parser { + match event { + Event::Start(Tag::Image { dest_url, .. }) => { + current = Some((String::new(), dest_url.to_string())); + } + Event::Text(text) if current.is_some() => { + if let Some((alt, _)) = current.as_mut() { + alt.push_str(&text); + } + } + Event::End(TagEnd::Image) => { + if let Some(image) = current.take() { + images.push(image); + } + } + _ => {} + } + } + images +} + +pub fn resolve_image_path(reference: &str, document_path: &Path, site_root: &Path) -> PathBuf { + let clean = clean_image_reference(reference); + if clean.starts_with('/') { + site_root.join(clean.trim_start_matches('/')) + } else { + document_path.parent().unwrap_or(site_root).join(clean) + } +} + +pub fn replace_image_reference(source: &str, current: &str, replacement: &str) -> String { + source.replace( + &format!("]({})", current.trim()), + &format!("]({})", replacement.trim()), + ) +} + +pub fn inline_preview_text(source: &str) -> String { + let source = source.replace("**", "").replace("__", "").replace('`', ""); + let mut output = String::new(); + let mut remaining = source.as_str(); + while let Some(open) = remaining.find('[') { + output.push_str(&remaining[..open]); + let after_open = &remaining[open + 1..]; + let Some(close_label) = after_open.find("](") else { + output.push_str(&remaining[open..]); + return output; + }; + let after_target = &after_open[close_label + 2..]; + let Some(close_target) = after_target.find(')') else { + output.push_str(&remaining[open..]); + return output; + }; + output.push_str(&after_open[..close_label]); + remaining = &after_target[close_target + 1..]; + } + output.push_str(remaining); + output +} + +#[cfg(test)] +pub fn append_image(source: &mut String, alt: &str, public_path: &str) { + if !source.ends_with('\n') { + source.push('\n'); + } + source.push('\n'); + source.push_str(&format!("![{}]({})\n", alt.trim(), public_path)); +} + +pub fn append_media(source: &str, heading: &str, media: &[(String, String)]) -> String { + let mut output = source.to_string(); + if !output.ends_with('\n') { + output.push('\n'); + } + output.push_str(&format!("\n## {}\n\n", heading.trim())); + for (alt, public_path) in media { + output.push_str(&format!("![{}]({})\n\n", alt.trim(), public_path.trim())); + } + output +} + +pub fn preview_blocks(source: &str) -> Vec { + let mut blocks = Vec::new(); + let mut paragraph = Vec::new(); + let mut code = Vec::new(); + let mut in_code = false; + let mut container: Option<(String, Vec, usize)> = None; + + let flush = |blocks: &mut Vec, paragraph: &mut Vec| { + if !paragraph.is_empty() { + blocks.push(PreviewBlock::Paragraph(paragraph.join("\n"))); + paragraph.clear(); + } + }; + + for raw_line in source.lines() { + let line = raw_line.trim_end(); + if in_code { + if line.trim_start().starts_with("```") { + blocks.push(PreviewBlock::Code(code.join("\n"))); + code.clear(); + in_code = false; + } else { + code.push(line.to_string()); + } + continue; + } + if line.trim_start().starts_with("```") { + flush(&mut blocks, &mut paragraph); + in_code = true; + continue; + } + + if container.is_some() { + let closes_container = container_marker(line).is_some_and(|(marker, declaration)| { + declaration.is_empty() + && container + .as_ref() + .is_some_and(|(_, _, opened)| *opened == marker) + }); + if closes_container { + let (kind, content, _) = container.take().expect("容器应当存在"); + blocks.push(PreviewBlock::Callout { + kind, + text: content.join("\n"), + }); + } else if let Some((_, content, _)) = container.as_mut() { + content.push(line.to_string()); + } + continue; + } + if let Some((marker, declaration)) = container_marker(line) { + if !declaration.is_empty() { + flush(&mut blocks, &mut paragraph); + container = Some((callout_label(declaration), Vec::new(), marker)); + continue; + } + } + + if line.trim() == "---" { + flush(&mut blocks, &mut paragraph); + blocks.push(PreviewBlock::Rule); + continue; + } + if let Some((level, text)) = preview_heading(line) { + flush(&mut blocks, &mut paragraph); + blocks.push(PreviewBlock::Heading { + level, + text: text.to_string(), + }); + continue; + } + let images = image_references(line); + if images.len() == 1 && line.trim_start().starts_with("![") { + flush(&mut blocks, &mut paragraph); + let (alt, source) = images.into_iter().next().expect("应当只有一张图片"); + blocks.push(PreviewBlock::Image { alt, source }); + continue; + } + if line.trim().is_empty() { + flush(&mut blocks, &mut paragraph); + } else { + paragraph.push(line.to_string()); + } + } + flush(&mut blocks, &mut paragraph); + if !code.is_empty() { + blocks.push(PreviewBlock::Code(code.join("\n"))); + } + if let Some((kind, content, _)) = container { + blocks.push(PreviewBlock::Callout { + kind, + text: content.join("\n"), + }); + } + blocks +} + +fn container_marker(line: &str) -> Option<(usize, &str)> { + let trimmed = line.trim(); + let marker = trimmed + .chars() + .take_while(|character| *character == ':') + .count(); + (marker >= 3).then(|| (marker, trimmed[marker..].trim())) +} + +fn callout_label(declaration: &str) -> String { + let mut parts = declaration.splitn(2, char::is_whitespace); + let kind = parts.next().unwrap_or_default().to_ascii_lowercase(); + let label = match kind.as_str() { + "tip" => "提示", + "warning" => "警告", + "danger" => "危险", + "info" => "信息", + "details" => "详情", + "code-group" => "代码组", + _ => "VitePress 容器", + }; + let title = parts.next().unwrap_or_default().trim(); + if title.is_empty() { + label.to_string() + } else { + format!("{label} · {title}") + } +} + +fn unclosed_container_count(source: &str) -> usize { + let mut stack = Vec::new(); + let mut in_code = false; + for line in source.lines() { + if line.trim_start().starts_with("```") { + in_code = !in_code; + continue; + } + if in_code { + continue; + } + let Some((marker, declaration)) = container_marker(line) else { + continue; + }; + if declaration.is_empty() { + if stack.last() == Some(&marker) { + stack.pop(); + } + } else { + stack.push(marker); + } + } + stack.len() +} + +fn clean_image_reference(reference: &str) -> &str { + reference.split(['?', '#']).next().unwrap_or(reference) +} +fn preview_heading(line: &str) -> Option<(u8, &str)> { + let trimmed = line.trim_start(); + let level = trimmed + .chars() + .take_while(|character| *character == '#') + .count(); + if !(1..=6).contains(&level) || !trimmed[level..].starts_with(' ') { + return None; + } + Some((level as u8, trimmed[level + 1..].trim())) +} + +pub fn title(source: &str) -> String { + let mut in_frontmatter = false; + for (index, line) in source.lines().enumerate() { + let trimmed = line.trim(); + if index == 0 && trimmed == "---" { + in_frontmatter = true; + continue; + } + if in_frontmatter { + if trimmed == "---" { + in_frontmatter = false; + } + continue; + } + if let Some(title) = line.trim_start().strip_prefix("# ") { + let title = title.trim(); + if !title.is_empty() { + return title.to_string(); + } + } + } + "AUTO-MAS 文档".to_string() +} + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn extracts_markdown_images() { + let images = image_references("![步骤一](img/one.png)\n![two](/docs/img/two.png)"); + assert_eq!(images.len(), 2); + assert_eq!(images[0].1, "img/one.png"); + } + + #[test] + fn appends_image_on_its_own_line() { + let mut source = "# 标题".to_string(); + append_image(&mut source, "关键步骤", "/docs/img/step.png"); + assert!(source.ends_with("![关键步骤](/docs/img/step.png)\n")); + } + + #[test] + fn previews_vitepress_container() { + let blocks = preview_blocks(":::: warning 注意\n请先备份。\n::::"); + assert!(blocks.iter().any(|block| { + matches!( + block, + PreviewBlock::Callout { kind, text } + if kind == "警告 · 注意" && text == "请先备份。" + ) + })); + } + + #[test] + fn reports_unclosed_vitepress_container() { + assert_eq!(unclosed_container_count("::: tip\n内容"), 1); + assert_eq!(unclosed_container_count("::: tip\n内容\n:::"), 0); + } + + #[test] + fn removes_query_and_anchor_from_image_path() { + assert_eq!( + clean_image_reference("img/step.png?v=2#focus"), + "img/step.png" + ); + } + + #[test] + fn title_ignores_frontmatter_comments() { + assert_eq!( + title("---\n# source comment\n---\n# 页面标题\n"), + "页面标题" + ); + } + + #[test] + fn replaces_only_matching_image_destination() { + let source = "![步骤](img/step.png)\n![保留](img/other.png)"; + let replaced = replace_image_reference(source, "img/step.png", "img/step-edited.png"); + assert!(replaced.contains("![步骤](img/step-edited.png)")); + assert!(replaced.contains("![保留](img/other.png)")); + } + + #[test] + fn cleans_common_inline_markdown_for_preview() { + assert_eq!( + inline_preview_text("**下载** [绿色包](/download/) 并运行 `AUTO-MAS.exe`"), + "下载 绿色包 并运行 AUTO-MAS.exe" + ); + } +} diff --git a/tools/docforge/src/pdf.rs b/tools/docforge/src/pdf.rs new file mode 100644 index 0000000..04844b4 --- /dev/null +++ b/tools/docforge/src/pdf.rs @@ -0,0 +1,422 @@ +use anyhow::{bail, Context, Result}; +use lopdf::Document; +use printpdf::{ + BuiltinFont, ColorBits, ColorSpace, Image, ImageFilter, ImageTransform, ImageXObject, + IndirectFontRef, Mm, PdfDocument, PdfDocumentReference, Px, +}; +use std::fs::File; +use std::io::{BufWriter, Read}; +use std::path::{Path, PathBuf}; +use std::process::{Command, Stdio}; +use tempfile::NamedTempFile; +use unicode_width::UnicodeWidthChar; + +use crate::{atomic, markdown}; + +#[derive(Debug, Clone)] +pub struct PdfInfo { + pub path: PathBuf, + pub pages: usize, + pub warning: Option, +} + +#[derive(Debug, Clone)] +pub struct PdfPreview { + pub path: PathBuf, + pub pages: usize, + pub text: String, +} + +#[derive(Debug, Clone, Copy, Default)] +pub struct PdfExportOptions<'a> { + pub custom_font: Option<&'a Path>, + pub document_path: Option<&'a Path>, + pub site_root: Option<&'a Path>, +} + +pub fn preview_pdf(input: &Path) -> Result { + let info = inspect_pdf(input)?; + Ok(PdfPreview { + path: input.to_path_buf(), + pages: info.pages, + text: preview_text(input)?, + }) +} + +pub fn render_first_page(input: &Path, pdftoppm: Option<&Path>) -> Result> { + let executable = pdftoppm + .map(Path::to_path_buf) + .or_else(find_pdftoppm) + .context( + "未找到 pdftoppm.exe,仍可使用文字预览;如需页面预览,请把 Poppler 放到绿色包 bin 目录", + )?; + let temporary = tempfile::tempdir().context("无法创建 PDF 页面预览临时目录")?; + let prefix = temporary.path().join("page"); + let output = Command::new(&executable) + .arg("-f") + .arg("1") + .arg("-singlefile") + .arg("-png") + .arg(input) + .arg(&prefix) + .stdin(Stdio::null()) + .output() + .with_context(|| format!("无法启动 {}", executable.display()))?; + if !output.status.success() { + bail!( + "PDF 页面预览失败:{}", + String::from_utf8_lossy(&output.stderr).trim() + ); + } + std::fs::read(prefix.with_extension("png")).context("无法读取渲染后的 PDF 首页") +} + +fn find_pdftoppm() -> Option { + let executable_dir = std::env::current_exe() + .ok() + .and_then(|path| path.parent().map(Path::to_path_buf)); + if let Some(directory) = executable_dir { + for candidate in [ + directory.join("pdftoppm.exe"), + directory.join("bin").join("pdftoppm.exe"), + ] { + if candidate.is_file() { + return Some(candidate); + } + } + } + let candidate = PathBuf::from("pdftoppm"); + Command::new(&candidate) + .arg("-v") + .stdin(Stdio::null()) + .stdout(Stdio::null()) + .stderr(Stdio::null()) + .status() + .ok() + .filter(|status| status.success()) + .map(|_| candidate) +} + +pub fn export_markdown_to_pdf( + source: &str, + output: &Path, + options: PdfExportOptions<'_>, +) -> Result { + if source.trim().is_empty() { + bail!("当前文档没有内容,无法导出 PDF"); + } + let title = markdown::title(source); + let (document, first_page, first_layer) = + PdfDocument::new(&title, Mm(210.0), Mm(297.0), "正文"); + let (font, font_warning) = load_font(&document, options.custom_font, source)?; + let mut warnings = font_warning.into_iter().collect::>(); + let mut page = first_page; + let mut layer = first_layer; + let mut y = 278.0f32; + let mut pages = 1usize; + + for raw_line in source.lines() { + let trimmed = raw_line.trim_end(); + if trimmed == "---" || trimmed.starts_with(":::") { + continue; + } + + let image_references = markdown::image_references(trimmed); + if trimmed.trim_start().starts_with("![") && image_references.len() == 1 { + let (_, reference) = &image_references[0]; + let local_image = options + .document_path + .zip(options.site_root) + .filter(|_| !reference.starts_with("http://") && !reference.starts_with("https://")) + .map(|(document_path, site_root)| { + markdown::resolve_image_path(reference, document_path, site_root) + }); + if let Some(image_path) = local_image { + match image::open(&image_path) { + Ok(dynamic_image) => { + let rgb_image = dynamic_image.to_rgb8(); + let pixel_width = rgb_image.width(); + let pixel_height = rgb_image.height(); + let mut jpeg_data = Vec::new(); + image::codecs::jpeg::JpegEncoder::new_with_quality(&mut jpeg_data, 92) + .encode( + rgb_image.as_raw(), + pixel_width, + pixel_height, + image::ExtendedColorType::Rgb8, + ) + .with_context(|| { + format!("无法压缩 PDF 图片 {}", image_path.display()) + })?; + let width_at_96_dpi = pixel_width as f32 * 25.4 / 96.0; + let height_at_96_dpi = pixel_height as f32 * 25.4 / 96.0; + let scale = (178.0 / width_at_96_dpi) + .min(118.0 / height_at_96_dpi) + .min(1.0); + let display_height = height_at_96_dpi * scale; + if y - display_height < 18.0 { + let (next_page, next_layer) = + document.add_page(Mm(210.0), Mm(297.0), "正文"); + page = next_page; + layer = next_layer; + y = 278.0; + pages += 1; + } + Image::from(ImageXObject { + width: Px(pixel_width as usize), + height: Px(pixel_height as usize), + color_space: ColorSpace::Rgb, + bits_per_component: ColorBits::Bit8, + interpolate: true, + image_data: jpeg_data, + image_filter: Some(ImageFilter::DCT), + smask: None, + clipping_bbox: None, + }) + .add_to_layer( + document.get_page(page).get_layer(layer), + ImageTransform { + translate_x: Some(Mm(16.0)), + translate_y: Some(Mm(y - display_height)), + scale_x: Some(scale), + scale_y: Some(scale), + dpi: Some(96.0), + ..Default::default() + }, + ); + y -= display_height + 8.0; + continue; + } + Err(error) => warnings.push(format!( + "图片未写入 PDF:{}({})", + image_path.display(), + error + )), + } + } + } + + let (text, size, spacing, indent) = pdf_line_style(trimmed); + if text.is_empty() { + y -= 3.0; + continue; + } + + let max_units = ((178.0 - indent) / (size * 0.37)).max(12.0) as usize; + let wrapped = wrap_text(&text, max_units); + for line in wrapped { + if y < 18.0 { + let (next_page, next_layer) = document.add_page(Mm(210.0), Mm(297.0), "正文"); + page = next_page; + layer = next_layer; + y = 278.0; + pages += 1; + } + let current_layer = document.get_page(page).get_layer(layer); + current_layer.use_text(line, size, Mm(16.0 + indent), Mm(y), &font); + y -= spacing; + } + } + + let parent = output.parent().unwrap_or_else(|| Path::new(".")); + std::fs::create_dir_all(parent)?; + let mut temporary = NamedTempFile::new_in(parent)?; + document + .save(&mut BufWriter::new(temporary.as_file_mut())) + .context("生成 PDF 失败")?; + temporary.as_file_mut().sync_all()?; + atomic::copy_atomic(temporary.path(), output)?; + + let actual_pages = inspect_pdf(output)?.pages; + Ok(PdfInfo { + path: output.to_path_buf(), + pages: actual_pages.max(pages), + warning: (!warnings.is_empty()).then(|| warnings.join(";")), + }) +} + +pub fn pdf_to_markdown(input: &Path) -> Result { + if !input.is_file() { + bail!("找不到 PDF:{}", input.display()); + } + let text = pdf_extract::extract_text(input) + .with_context(|| format!("无法读取 PDF {}", input.display()))?; + let mut output = String::from("# 从 PDF 导入的文档\n\n"); + for block in text.split("\n\n") { + let compact = block + .lines() + .map(str::trim) + .filter(|line| !line.is_empty()) + .collect::>() + .join(" "); + if !compact.is_empty() { + output.push_str(&compact); + output.push_str("\n\n"); + } + } + output.push_str("> 提示:PDF 导入会提取可复制文字。复杂排版、表格和图片请在预览后手动整理。\n"); + Ok(output) +} + +pub fn inspect_pdf(input: &Path) -> Result { + let document = + Document::load(input).with_context(|| format!("无法检查 PDF {}", input.display()))?; + Ok(PdfInfo { + path: input.to_path_buf(), + pages: document.get_pages().len(), + warning: None, + }) +} + +pub fn preview_text(input: &Path) -> Result { + let mut bytes = Vec::new(); + File::open(input)?.read_to_end(&mut bytes)?; + let text = pdf_extract::extract_text_from_mem(&bytes).context("无法生成 PDF 文字预览")?; + Ok(text) +} + +fn load_font( + document: &PdfDocumentReference, + custom_font: Option<&Path>, + source: &str, +) -> Result<(IndirectFontRef, Option)> { + let candidate = custom_font + .filter(|path| path.is_file()) + .map(Path::to_path_buf) + .or_else(find_windows_cjk_font); + if let Some(path) = candidate { + let file = + File::open(&path).with_context(|| format!("无法打开 PDF 字体 {}", path.display()))?; + let font = document + .add_external_font(file) + .with_context(|| format!("无法加载 PDF 字体 {}", path.display()))?; + return Ok((font, None)); + } + if !source.is_ascii() { + bail!("未找到中文 TrueType 字体。请在“PDF 字体”中选择 .ttf 文件后重试。"); + } + Ok(( + document.add_builtin_font(BuiltinFont::Helvetica)?, + Some("未找到外部字体,已使用 Helvetica;仅适合英文内容。".to_string()), + )) +} + +pub fn find_windows_cjk_font() -> Option { + let windows = std::env::var_os("WINDIR") + .map(PathBuf::from) + .unwrap_or_else(|| PathBuf::from(r"C:\Windows")); + ["simhei.ttf", "Deng.ttf", "msyh.ttf"] + .into_iter() + .map(|name| windows.join("Fonts").join(name)) + .find(|path| path.is_file()) +} + +fn pdf_line_style(line: &str) -> (String, f32, f32, f32) { + if let Some(text) = line.strip_prefix("# ") { + return (text.trim().to_string(), 22.0, 11.0, 0.0); + } + if let Some(text) = line.strip_prefix("## ") { + return (text.trim().to_string(), 16.0, 8.5, 0.0); + } + if let Some(text) = line.strip_prefix("### ") { + return (text.trim().to_string(), 13.0, 7.0, 0.0); + } + if line.starts_with("![") { + return (format!("[图片] {}", strip_markdown(line)), 9.0, 5.5, 5.0); + } + if let Some(text) = line.strip_prefix("> ") { + return (strip_markdown(text), 9.5, 5.5, 6.0); + } + if let Some(text) = line.strip_prefix("- ") { + return (format!("- {}", strip_markdown(text)), 10.5, 6.0, 5.0); + } + let numbered = line + .split_once(". ") + .filter(|(prefix, _)| prefix.chars().all(|character| character.is_ascii_digit())); + if let Some((prefix, text)) = numbered { + return ( + format!("{}. {}", prefix, strip_markdown(text)), + 10.5, + 6.0, + 5.0, + ); + } + (strip_markdown(line), 10.5, 6.0, 0.0) +} + +fn strip_markdown(value: &str) -> String { + value + .replace("**", "") + .replace("__", "") + .replace('`', "") + .replace("
", " ") +} + +fn wrap_text(value: &str, max_units: usize) -> Vec { + let mut lines = Vec::new(); + let mut current = String::new(); + let mut units = 0usize; + for character in value.chars() { + let width = UnicodeWidthChar::width(character).unwrap_or(1).max(1); + if units + width > max_units && !current.is_empty() { + lines.push(current.trim_end().to_string()); + current.clear(); + units = 0; + } + current.push(character); + units += width; + } + if !current.is_empty() { + lines.push(current); + } + if lines.is_empty() { + lines.push(String::new()); + } + lines +} + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn wraps_cjk_by_display_width() { + let lines = wrap_text("一二三四五", 4); + assert_eq!(lines, vec!["一二", "三四", "五"]); + } + + #[test] + fn exports_local_markdown_image_into_pdf() { + let directory = tempfile::tempdir().expect("创建测试目录"); + let markdown_path = directory.path().join("guide.md"); + let image_path = directory.path().join("step.png"); + let pdf_path = directory.path().join("guide.pdf"); + std::fs::write(&markdown_path, "# Guide\n\n![Step](step.png)\n").expect("写入 Markdown"); + image::DynamicImage::new_rgb8(320, 180) + .save(&image_path) + .expect("保存图片"); + + let info = export_markdown_to_pdf( + "# Guide\n\n![Step](step.png)\n", + &pdf_path, + PdfExportOptions { + document_path: Some(&markdown_path), + site_root: Some(directory.path()), + ..Default::default() + }, + ) + .expect("导出 PDF"); + assert!(info.path.is_file()); + assert_eq!(info.pages, 1); + let pdf = Document::load(&pdf_path).expect("读取 PDF"); + let contains_image = pdf.objects.values().any(|object| { + object.as_stream().ok().is_some_and(|stream| { + matches!( + stream.dict.get(b"Subtype"), + Ok(lopdf::Object::Name(name)) if name == b"Image" + ) + }) + }); + assert!(contains_image, "PDF 应包含 Markdown 引用的本地图片"); + } +} diff --git a/tools/docforge/src/site.rs b/tools/docforge/src/site.rs new file mode 100644 index 0000000..c2b6255 --- /dev/null +++ b/tools/docforge/src/site.rs @@ -0,0 +1,293 @@ +use anyhow::{bail, Context, Result}; +use serde::Serialize; +use std::fs; +use std::path::{Path, PathBuf}; +use walkdir::WalkDir; + +use crate::atomic; + +pub const SECTIONS: [&str; 5] = ["docs", "developer", "plugin", "download", "disclosure"]; + +#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize)] +pub enum Language { + Zh, + En, +} + +impl Language { + pub fn label(self) -> &'static str { + match self { + Self::Zh => "中文", + Self::En => "English", + } + } + + pub fn prefix(self) -> &'static str { + match self { + Self::Zh => "", + Self::En => "en", + } + } +} + +#[derive(Debug, Clone, Serialize)] +pub struct DocumentRef { + pub language: Language, + pub relative_path: String, + pub public_path: String, + pub title: String, + pub section: String, + pub counterpart: Option, +} + +#[derive(Debug, Clone, Serialize)] +pub struct SiteProfile { + pub root: PathBuf, + pub languages: Vec, + pub sections: Vec, + pub documents: Vec, +} + +impl SiteProfile { + pub fn discover(root: &Path) -> Result { + let root = root + .canonicalize() + .with_context(|| format!("cannot resolve {}", root.display()))?; + if !root.join(".vitepress").join("config.mts").is_file() { + bail!( + "{} is not a VitePress site with .vitepress/config.mts", + root.display() + ); + } + if !root.join("index.md").is_file() { + bail!("{} does not contain index.md", root.display()); + } + + let mut documents = Vec::new(); + for language in [Language::Zh, Language::En] { + let language_root = if language == Language::Zh { + root.clone() + } else { + root.join(language.prefix()) + }; + if !language_root.is_dir() { + continue; + } + + let root_index = language_root.join("index.md"); + if root_index.is_file() { + documents.push(document_ref(&root, &root_index, language, "index")); + } + for section in SECTIONS { + let section_root = language_root.join(section); + if !section_root.is_dir() { + continue; + } + for entry in WalkDir::new(§ion_root) + .follow_links(false) + .into_iter() + .filter_map(std::result::Result::ok) + { + let path = entry.path(); + if !entry.file_type().is_file() + || path.extension().and_then(|ext| ext.to_str()) != Some("md") + { + continue; + } + documents.push(document_ref(&root, path, language, section)); + } + } + } + + documents.sort_by(|left, right| { + left.language + .prefix() + .cmp(right.language.prefix()) + .then_with(|| left.relative_path.cmp(&right.relative_path)) + }); + let relative_paths: std::collections::HashSet = documents + .iter() + .map(|document| document.relative_path.clone()) + .collect(); + for document in &mut documents { + let key = pair_key(&document.relative_path); + let counterpart_language = if document.language == Language::Zh { + Language::En + } else { + Language::Zh + }; + let counterpart_relative = if counterpart_language == Language::En { + format!("en/{key}") + } else { + key.clone() + }; + let counterpart = relative_paths + .contains(&counterpart_relative) + .then_some(counterpart_relative); + document.counterpart = counterpart; + } + + Ok(Self { + root, + languages: vec!["zh-CN".to_string(), "en-US".to_string()], + sections: SECTIONS.iter().map(|value| (*value).to_string()).collect(), + documents, + }) + } + + pub fn document_path(&self, document: &DocumentRef) -> Result { + let path = self.root.join(&document.relative_path); + atomic::ensure_inside(&self.root, &path) + } + + pub fn translation_target_path(&self, document: &DocumentRef) -> Result { + let key = pair_key(&document.relative_path); + let relative = if document.language == Language::Zh { + format!("en/{key}") + } else { + key + }; + let candidate = self.root.join(relative); + let parent = candidate.parent().context("翻译目标文件没有父目录")?; + if !parent.starts_with(&self.root) { + bail!("拒绝在文档站目录之外创建翻译文件:{}", candidate.display()); + } + fs::create_dir_all(parent) + .with_context(|| format!("无法创建翻译目标目录 {}", parent.display()))?; + atomic::ensure_inside(&self.root, &candidate) + } + + pub fn media_dir(&self, document: &DocumentRef) -> Result { + let section = if document.section == "index" { + "docs" + } else { + document.section.as_str() + }; + self.media_dir_for_section(section) + } + + pub fn media_dir_for_section(&self, section: &str) -> Result { + if !SECTIONS.contains(§ion) { + bail!("文档栏目不受支持:{section}"); + } + let candidate = self.root.join(section).join("img").join("generated"); + fs::create_dir_all(&candidate)?; + atomic::ensure_inside(&self.root, &candidate) + } + + pub fn tutorial_document_path( + &self, + language: Language, + section: &str, + file_stem: &str, + ) -> Result { + if !SECTIONS.contains(§ion) { + bail!("文档栏目不受支持:{section}"); + } + let file_stem = file_stem.trim().trim_end_matches(".md"); + if file_stem.is_empty() + || file_stem == "." + || file_stem == ".." + || file_stem + .chars() + .any(|character| r#"<>:"/\|?*"#.contains(character)) + { + bail!("教程文件名无效,请只填写文件名,不要填写文件夹路径"); + } + let language_root = if language == Language::Zh { + self.root.clone() + } else { + self.root.join(language.prefix()) + }; + let candidate = language_root.join(section).join(format!("{file_stem}.md")); + let parent = candidate.parent().context("教程文件没有父目录")?; + fs::create_dir_all(parent) + .with_context(|| format!("无法创建教程目录 {}", parent.display()))?; + atomic::ensure_inside(&self.root, &candidate) + } +} + +fn document_ref(root: &Path, path: &Path, language: Language, section: &str) -> DocumentRef { + let relative = path + .strip_prefix(root) + .unwrap_or(path) + .to_string_lossy() + .replace('\\', "/"); + let title = fs::read_to_string(path) + .ok() + .and_then(|content| first_markdown_heading(&content)) + .filter(|value| !value.is_empty()) + .unwrap_or_else(|| { + path.file_stem() + .and_then(|value| value.to_str()) + .unwrap_or("Untitled") + .to_string() + }); + let public_path = relative + .strip_suffix(".md") + .unwrap_or(&relative) + .to_string(); + DocumentRef { + language, + relative_path: relative, + public_path, + title, + section: section.to_string(), + counterpart: None, + } +} + +fn pair_key(relative: &str) -> String { + relative.strip_prefix("en/").unwrap_or(relative).to_string() +} + +fn first_markdown_heading(content: &str) -> Option { + let mut in_frontmatter = false; + for (index, line) in content.lines().enumerate() { + let trimmed = line.trim(); + if index == 0 && trimmed == "---" { + in_frontmatter = true; + continue; + } + if in_frontmatter { + if trimmed == "---" { + in_frontmatter = false; + } + continue; + } + if let Some(title) = line.trim_start().strip_prefix("# ") { + let title = title.trim(); + if !title.is_empty() { + return Some(title.to_string()); + } + } + } + None +} + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn ignores_frontmatter_comments_when_reading_title() { + let source = "---\n# https://example.test\nlayout: home\n---\n# 真正标题\n"; + assert_eq!(first_markdown_heading(source).as_deref(), Some("真正标题")); + } + + #[test] + fn rejects_tutorial_file_name_with_path_separator() { + let root = tempfile::tempdir().expect("创建测试目录"); + std::fs::create_dir_all(root.path().join(".vitepress")).expect("创建配置目录"); + std::fs::write( + root.path().join(".vitepress/config.mts"), + "export default {}", + ) + .expect("写入配置"); + std::fs::write(root.path().join("index.md"), "# 首页").expect("写入首页"); + let site = SiteProfile::discover(root.path()).expect("识别站点"); + assert!(site + .tutorial_document_path(Language::Zh, "docs", "folder/tutorial") + .is_err()); + } +} diff --git a/tools/docforge/src/translation.rs b/tools/docforge/src/translation.rs new file mode 100644 index 0000000..414ca66 --- /dev/null +++ b/tools/docforge/src/translation.rs @@ -0,0 +1,160 @@ +use anyhow::{bail, Context, Result}; +use reqwest::blocking::Client; +use serde::{Deserialize, Serialize}; +use std::time::Duration; + +#[derive(Debug, Clone)] +pub struct TranslationConfig { + pub endpoint: String, + pub model: String, + pub api_key: String, + pub source_language: String, + pub target_language: String, +} + +impl Default for TranslationConfig { + fn default() -> Self { + Self { + endpoint: "https://api.openai.com/v1".to_string(), + model: "gpt-4.1-mini".to_string(), + api_key: String::new(), + source_language: "简体中文".to_string(), + target_language: "English".to_string(), + } + } +} + +#[derive(Debug, Serialize)] +struct ChatRequest<'a> { + model: &'a str, + temperature: f32, + messages: Vec>, +} + +#[derive(Debug, Serialize)] +struct Message<'a> { + role: &'a str, + content: &'a str, +} + +#[derive(Debug, Deserialize)] +struct ChatResponse { + choices: Vec, +} + +#[derive(Debug, Deserialize)] +struct Choice { + message: ResponseMessage, +} + +#[derive(Debug, Deserialize)] +struct ResponseMessage { + content: String, +} + +pub fn translate_markdown(source: &str, config: &TranslationConfig) -> Result { + if source.trim().is_empty() { + bail!("当前文档没有可翻译内容"); + } + if config.endpoint.trim().is_empty() || config.model.trim().is_empty() { + bail!("请填写翻译接口地址和模型名称"); + } + + let endpoint = normalize_endpoint(&config.endpoint); + let instruction = format!( + "你是 AUTO-MAS VitePress 文档翻译助手。请把以下 Markdown 从{}翻译为{}。\n\ + 必须完整保留 Markdown 结构、标题级别、frontmatter、代码块、行内代码、HTML/Vue 组件、\ + ::: 容器、URL、文件路径、锚点、命令、配置键和产品名。图片 URL 不得改变,只翻译图片替代文字。\n\ + 不要增加说明,不要用代码围栏包住全文,只返回翻译后的 Markdown。", + config.source_language, config.target_language + ); + let request = ChatRequest { + model: config.model.trim(), + temperature: 0.1, + messages: vec![ + Message { + role: "system", + content: &instruction, + }, + Message { + role: "user", + content: source, + }, + ], + }; + + let client = Client::builder() + .timeout(Duration::from_secs(180)) + .build()?; + let mut http = client.post(endpoint).json(&request); + if !config.api_key.trim().is_empty() { + http = http.bearer_auth(config.api_key.trim()); + } + let response = http.send().context("无法连接翻译接口")?; + let status = response.status(); + let body = response.text().context("无法读取翻译接口响应")?; + if !status.is_success() { + bail!("翻译接口返回 {}:{}", status, shorten(&body, 600)); + } + let parsed: ChatResponse = serde_json::from_str(&body) + .with_context(|| format!("翻译接口响应格式不兼容:{}", shorten(&body, 300)))?; + let translated = parsed + .choices + .into_iter() + .next() + .map(|choice| choice.message.content) + .filter(|content| !content.trim().is_empty()) + .context("翻译接口没有返回文本")?; + Ok(strip_outer_fence(translated)) +} + +fn normalize_endpoint(value: &str) -> String { + let value = value.trim().trim_end_matches('/'); + if value.ends_with("/chat/completions") { + value.to_string() + } else { + format!("{value}/chat/completions") + } +} + +fn strip_outer_fence(value: String) -> String { + let trimmed = value.trim(); + if (trimmed.starts_with("```markdown") || trimmed.starts_with("```md")) + && trimmed.ends_with("```") + { + let first_newline = trimmed.find('\n').unwrap_or(0); + return trimmed[first_newline + 1..trimmed.len() - 3] + .trim() + .to_string(); + } + value +} + +fn shorten(value: &str, limit: usize) -> String { + let mut output: String = value.chars().take(limit).collect(); + if value.chars().count() > limit { + output.push_str("..."); + } + output +} + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn adds_openai_compatible_path() { + assert_eq!( + normalize_endpoint("https://example.test/v1"), + "https://example.test/v1/chat/completions" + ); + } + + #[test] + fn removes_markdown_wrapper() { + assert_eq!( + strip_outer_fence("```markdown\n# Title\n```".into()), + "# Title" + ); + } +} diff --git a/tools/docforge/src/tutorial.rs b/tools/docforge/src/tutorial.rs new file mode 100644 index 0000000..0358118 --- /dev/null +++ b/tools/docforge/src/tutorial.rs @@ -0,0 +1,111 @@ +use std::path::PathBuf; + +#[derive(Debug, Clone)] +pub struct TutorialStep { + pub frame: PathBuf, + pub title: String, + pub description: String, + pub timestamp: Option, +} + +impl TutorialStep { + pub fn new(frame: PathBuf, index: usize, timestamp: Option) -> Self { + Self { + frame, + title: format!("步骤 {}", index + 1), + description: "请根据画面完成这一操作,然后继续下一步。".to_string(), + timestamp, + } + } +} + +#[derive(Debug, Clone)] +pub struct TutorialMedia { + pub title: String, + pub description: String, + pub public_path: String, + pub timestamp: Option, +} + +pub fn render_document( + title: &str, + summary: &str, + prerequisites: &str, + steps: &[TutorialMedia], +) -> String { + let title = non_empty(title, "视频操作教程"); + let summary = non_empty(summary, "本教程根据操作视频的关键画面生成。"); + let prerequisites = non_empty(prerequisites, "准备好需要使用的 AUTO-MAS 环境。"); + let mut output = + format!("# {title}\n\n{summary}\n\n## 开始前准备\n\n- {prerequisites}\n\n## 操作步骤\n\n"); + output.push_str(&render_steps(steps)); + output.push_str( + "::: tip 完成检查\n完成全部步骤后,请返回 AUTO-MAS 检查配置是否已经生效。\n:::\n", + ); + output +} + +pub fn render_section(title: &str, summary: &str, steps: &[TutorialMedia]) -> String { + let title = non_empty(title, "视频操作教程"); + let summary = non_empty(summary, "以下步骤根据操作视频的关键画面生成。"); + format!("\n## {title}\n\n{summary}\n\n{}", render_steps(steps)) +} + +fn render_steps(steps: &[TutorialMedia]) -> String { + let mut output = String::new(); + for (index, step) in steps.iter().enumerate() { + let fallback_title = format!("步骤 {}", index + 1); + let title = non_empty(&step.title, &fallback_title); + let description = non_empty( + &step.description, + "请根据画面完成这一操作,然后继续下一步。", + ); + output.push_str(&format!("### {}. {title}\n\n", index + 1)); + if let Some(seconds) = step.timestamp { + output.push_str(&format!("> 视频位置:{}\n\n", format_timestamp(seconds))); + } + output.push_str(&format!( + "{description}\n\n![{title}]({})\n\n", + step.public_path + )); + } + output +} + +fn non_empty<'a>(value: &'a str, fallback: &'a str) -> &'a str { + let value = value.trim(); + if value.is_empty() { + fallback + } else { + value + } +} + +fn format_timestamp(seconds: f64) -> String { + let total = seconds.max(0.0).round() as u64; + format!("{:02}:{:02}", total / 60, total % 60) +} + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn renders_complete_vitepress_tutorial() { + let output = render_document( + "安装教程", + "跟随画面完成安装。", + "下载绿色包。", + &[TutorialMedia { + title: "打开设置".to_string(), + description: "点击左侧设置入口。".to_string(), + public_path: "/docs/img/generated/step.png".to_string(), + timestamp: Some(65.0), + }], + ); + assert!(output.contains("# 安装教程")); + assert!(output.contains("> 视频位置:01:05")); + assert!(output.contains("![打开设置](/docs/img/generated/step.png)")); + assert!(output.contains("::: tip 完成检查")); + } +} diff --git a/tools/docforge/src/video.rs b/tools/docforge/src/video.rs new file mode 100644 index 0000000..87f1179 --- /dev/null +++ b/tools/docforge/src/video.rs @@ -0,0 +1,274 @@ +use anyhow::{bail, Context, Result}; +use std::ffi::OsString; +use std::fs; +use std::path::{Path, PathBuf}; +use std::process::{Command, Stdio}; +use tempfile::TempDir; + +use crate::atomic; + +#[derive(Debug, Clone)] +pub struct VideoTool { + ffmpeg: PathBuf, + ffprobe: PathBuf, +} + +impl VideoTool { + pub fn discover(beside: Option<&Path>) -> Option { + let executable_dir = beside.map(Path::to_path_buf).or_else(|| { + std::env::current_exe() + .ok()? + .parent() + .map(Path::to_path_buf) + }); + if let Some(directory) = executable_dir { + for tools_dir in [directory.clone(), directory.join("bin")] { + let ffmpeg = tools_dir.join("ffmpeg.exe"); + let ffprobe = tools_dir.join("ffprobe.exe"); + if command_works(&ffmpeg, "-version") && command_works(&ffprobe, "-version") { + return Some(Self { ffmpeg, ffprobe }); + } + } + } + + let ffmpeg = PathBuf::from("ffmpeg"); + let ffprobe = PathBuf::from("ffprobe"); + if command_works(&ffmpeg, "-version") && command_works(&ffprobe, "-version") { + Some(Self { ffmpeg, ffprobe }) + } else { + None + } + } + + pub fn capture_evenly( + &self, + video: &Path, + output_dir: &Path, + count: usize, + ) -> Result> { + if count == 0 || count > 50 { + bail!("截图数量必须在 1 到 50 之间"); + } + let duration = self.duration(video)?; + let mut timestamps = Vec::with_capacity(count); + for index in 0..count { + let fraction = (index + 1) as f64 / (count + 1) as f64; + timestamps.push(duration * fraction); + } + self.capture_many(video, output_dir, ×tamps) + } + + pub fn capture_at(&self, video: &Path, seconds: f64, output: &Path) -> Result<()> { + self.capture_one(video, output, seconds).map(|_| ()) + } + + pub fn duration_seconds(&self, video: &Path) -> Result> { + self.duration(video).map(Some) + } + + pub fn capture_keyframes( + &self, + video: &Path, + output_dir: &Path, + max_frames: usize, + ) -> Result> { + if max_frames == 0 || max_frames > 50 { + bail!("关键画面数量必须在 1 到 50 之间"); + } + ensure_video(video)?; + fs::create_dir_all(output_dir)?; + let temporary = TempDir::new_in(output_dir) + .with_context(|| format!("无法在 {} 创建临时目录", output_dir.display()))?; + let pattern = temporary.path().join("scene-%03d.png"); + let filter = "select=gt(scene\\,0.32),scale='min(1920,iw)':-2".to_string(); + let args = vec![ + OsString::from("-hide_banner"), + OsString::from("-loglevel"), + OsString::from("error"), + OsString::from("-i"), + video.as_os_str().to_os_string(), + OsString::from("-vf"), + OsString::from(filter), + OsString::from("-vsync"), + OsString::from("vfr"), + OsString::from("-frames:v"), + OsString::from(max_frames.to_string()), + pattern.as_os_str().to_os_string(), + ]; + run(&self.ffmpeg, &args, "自动识别关键画面失败")?; + + let mut captured: Vec = fs::read_dir(temporary.path())? + .filter_map(std::result::Result::ok) + .map(|entry| entry.path()) + .filter(|path| path.extension().and_then(|value| value.to_str()) == Some("png")) + .collect(); + captured.sort(); + if captured.is_empty() { + return self.capture_evenly(video, output_dir, max_frames.min(5)); + } + move_frames(captured, output_dir, "key") + } + + pub fn capture_one(&self, video: &Path, output: &Path, seconds: f64) -> Result { + if seconds < 0.0 { + bail!("截图时间不能小于 0 秒"); + } + ensure_video(video)?; + let parent = output.parent().unwrap_or_else(|| Path::new(".")); + fs::create_dir_all(parent)?; + let temporary = TempDir::new_in(parent)?; + let frame = temporary.path().join("frame.png"); + let args = vec![ + OsString::from("-hide_banner"), + OsString::from("-loglevel"), + OsString::from("error"), + OsString::from("-ss"), + OsString::from(format!("{seconds:.3}")), + OsString::from("-i"), + video.as_os_str().to_os_string(), + OsString::from("-frames:v"), + OsString::from("1"), + OsString::from("-vf"), + OsString::from("scale='min(1920,iw)':-2"), + frame.as_os_str().to_os_string(), + ]; + run(&self.ffmpeg, &args, "指定时间截图失败")?; + atomic::copy_atomic(&frame, output)?; + Ok(output.to_path_buf()) + } + + pub fn duration(&self, video: &Path) -> Result { + ensure_video(video)?; + let args = [ + "-v", + "error", + "-show_entries", + "format=duration", + "-of", + "default=noprint_wrappers=1:nokey=1", + ]; + let output = Command::new(&self.ffprobe) + .args(args) + .arg(video) + .creation_flags_if_windows() + .output() + .context("无法启动 ffprobe")?; + if !output.status.success() { + bail!( + "无法读取视频时长:{}", + String::from_utf8_lossy(&output.stderr).trim() + ); + } + String::from_utf8_lossy(&output.stdout) + .trim() + .parse::() + .context("ffprobe 返回了无效的视频时长") + } + + fn capture_many( + &self, + video: &Path, + output_dir: &Path, + timestamps: &[f64], + ) -> Result> { + ensure_video(video)?; + fs::create_dir_all(output_dir)?; + let temporary = TempDir::new_in(output_dir)?; + let mut frames = Vec::with_capacity(timestamps.len()); + for (index, timestamp) in timestamps.iter().enumerate() { + let frame = temporary.path().join(format!("frame-{:03}.png", index + 1)); + let args = vec![ + OsString::from("-hide_banner"), + OsString::from("-loglevel"), + OsString::from("error"), + OsString::from("-ss"), + OsString::from(format!("{timestamp:.3}")), + OsString::from("-i"), + video.as_os_str().to_os_string(), + OsString::from("-frames:v"), + OsString::from("1"), + OsString::from("-vf"), + OsString::from("scale='min(1920,iw)':-2"), + frame.as_os_str().to_os_string(), + ]; + run(&self.ffmpeg, &args, "视频截图失败")?; + frames.push(frame); + } + move_frames(frames, output_dir, "frame") + } +} + +fn move_frames(frames: Vec, output_dir: &Path, prefix: &str) -> Result> { + let mut outputs = Vec::with_capacity(frames.len()); + for (index, frame) in frames.into_iter().enumerate() { + let output = unique_path(output_dir, &format!("{prefix}-{:03}", index + 1), "png"); + atomic::copy_atomic(&frame, &output)?; + outputs.push(output); + } + Ok(outputs) +} + +fn unique_path(directory: &Path, stem: &str, extension: &str) -> PathBuf { + let first = directory.join(format!("{stem}.{extension}")); + if !first.exists() { + return first; + } + for suffix in 2..10_000 { + let candidate = directory.join(format!("{stem}-{suffix}.{extension}")); + if !candidate.exists() { + return candidate; + } + } + directory.join(format!("{stem}-{}.{}", std::process::id(), extension)) +} + +fn ensure_video(video: &Path) -> Result<()> { + if !video.is_file() { + bail!("找不到视频文件:{}", video.display()); + } + Ok(()) +} + +fn run(executable: &Path, args: &[OsString], message: &str) -> Result<()> { + let output = Command::new(executable) + .args(args) + .stdin(Stdio::null()) + .creation_flags_if_windows() + .output() + .with_context(|| format!("无法启动 {}", executable.display()))?; + if !output.status.success() { + bail!( + "{}:{}", + message, + String::from_utf8_lossy(&output.stderr).trim() + ); + } + Ok(()) +} + +fn command_works(executable: &Path, argument: &str) -> bool { + Command::new(executable) + .arg(argument) + .stdin(Stdio::null()) + .stdout(Stdio::null()) + .stderr(Stdio::null()) + .creation_flags_if_windows() + .status() + .map(|status| status.success()) + .unwrap_or(false) +} + +trait WindowsCommandExt { + fn creation_flags_if_windows(&mut self) -> &mut Self; +} + +impl WindowsCommandExt for Command { + fn creation_flags_if_windows(&mut self) -> &mut Self { + #[cfg(windows)] + { + use std::os::windows::process::CommandExt; + self.creation_flags(0x08000000); + } + self + } +}