From 8a9240bb95eafc9287f864c5ba84f3a9e692b2d7 Mon Sep 17 00:00:00 2001 From: Yumeno Yuuka Date: Fri, 3 Apr 2026 09:24:41 +0900 Subject: [PATCH 1/8] feat(rust): add kopdeltav models crate with constants, structs, and hermite interpolation Port Python kopdeltav/models.py to Rust as a separate workspace crate (crates/kopdeltav) to isolate core physics from Tauri dependencies. Includes: CurveKey, Atmosphere, OrbitalElements, CelestialBody structs, G0/R_GAS constants, compute_mu(), and KSP AnimationCurve-compatible hermite_interp(). All 11 tests pass, clippy clean. --- src-tauri/Cargo.lock | 5166 ++++++++++++++++++++++ src-tauri/Cargo.toml | 4 + src-tauri/crates/kopdeltav/Cargo.toml | 7 + src-tauri/crates/kopdeltav/src/lib.rs | 1 + src-tauri/crates/kopdeltav/src/models.rs | 404 ++ 5 files changed, 5582 insertions(+) create mode 100644 src-tauri/Cargo.lock create mode 100644 src-tauri/crates/kopdeltav/Cargo.toml create mode 100644 src-tauri/crates/kopdeltav/src/lib.rs create mode 100644 src-tauri/crates/kopdeltav/src/models.rs diff --git a/src-tauri/Cargo.lock b/src-tauri/Cargo.lock new file mode 100644 index 0000000..5226587 --- /dev/null +++ b/src-tauri/Cargo.lock @@ -0,0 +1,5166 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +version = 4 + +[[package]] +name = "adler2" +version = "2.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "320119579fcad9c21884f5c4861d16174d0e06250625266f50fe6898340abefa" + +[[package]] +name = "aho-corasick" +version = "1.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ddd31a130427c27518df266943a5308ed92d4b226cc639f5a8f1002816174301" +dependencies = [ + "memchr", +] + +[[package]] +name = "alloc-no-stdlib" +version = "2.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cc7bb162ec39d46ab1ca8c77bf72e890535becd1751bb45f64c597edb4c8c6b3" + +[[package]] +name = "alloc-stdlib" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "94fb8275041c72129eb51b7d0322c29b8387a0386127718b096429201a5d6ece" +dependencies = [ + "alloc-no-stdlib", +] + +[[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 = "anyhow" +version = "1.0.102" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7f202df86484c868dbad7eaa557ef785d5c66295e41b460ef922eca0723b842c" + +[[package]] +name = "atk" +version = "0.18.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "241b621213072e993be4f6f3a9e4b45f65b7e6faad43001be957184b7bb1824b" +dependencies = [ + "atk-sys", + "glib", + "libc", +] + +[[package]] +name = "atk-sys" +version = "0.18.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c5e48b684b0ca77d2bbadeef17424c2ea3c897d44d566a1617e7e8f30614d086" +dependencies = [ + "glib-sys", + "gobject-sys", + "libc", + "system-deps", +] + +[[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.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c08606f8c3cbf4ce6ec8e28fb0014a2c086708fe954eaa885384a6165172e7e8" + +[[package]] +name = "base64" +version = "0.21.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9d297deb1925b89f2ccc13d7635fa0714f12c87adce1c75356b39ca9b7178567" + +[[package]] +name = "base64" +version = "0.22.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "72b3254f16251a8381aa12e40e3c4d2f0199f8c6508fbecb9d91f575e0fbb8c6" + +[[package]] +name = "bit-set" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "08807e080ed7f9d5433fa9b275196cfc35414f66a0c79d864dc51a0d825231a3" +dependencies = [ + "bit-vec", +] + +[[package]] +name = "bit-vec" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5e764a1d40d510daf35e07be9eb06e75770908c27d411ee6c92109c9840eaaf7" + +[[package]] +name = "bitflags" +version = "1.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" + +[[package]] +name = "bitflags" +version = "2.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "843867be96c8daad0d758b57df9392b6d8d271134fce549de6ce169ff98a92af" +dependencies = [ + "serde_core", +] + +[[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.6.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cdeb9d870516001442e364c5220d3574d2da8dc765554b4a617230d33fa58ef5" +dependencies = [ + "objc2", +] + +[[package]] +name = "brotli" +version = "8.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4bd8b9603c7aa97359dbd97ecf258968c95f3adddd6db2f7e7a5bef101c84560" +dependencies = [ + "alloc-no-stdlib", + "alloc-stdlib", + "brotli-decompressor", +] + +[[package]] +name = "brotli-decompressor" +version = "5.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "874bb8112abecc98cbd6d81ea4fa7e94fb9449648c93cc89aa40c81c24d7de03" +dependencies = [ + "alloc-no-stdlib", + "alloc-stdlib", +] + +[[package]] +name = "bumpalo" +version = "3.20.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5d20789868f4b01b2f2caec9f5c4e0213b41e3e5702a50157d699ae31ced2fcb" + +[[package]] +name = "bytemuck" +version = "1.25.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c8efb64bd706a16a1bdde310ae86b351e4d21550d98d056f22f8a7f7a2183fec" + +[[package]] +name = "byteorder" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b" + +[[package]] +name = "bytes" +version = "1.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e748733b7cbc798e1434b6ac524f0c1ff2ab456fe201501e6497c8417a4fc33" +dependencies = [ + "serde", +] + +[[package]] +name = "cairo-rs" +version = "0.18.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8ca26ef0159422fb77631dc9d17b102f253b876fe1586b03b803e63a309b4ee2" +dependencies = [ + "bitflags 2.11.0", + "cairo-sys-rs", + "glib", + "libc", + "once_cell", + "thiserror 1.0.69", +] + +[[package]] +name = "cairo-sys-rs" +version = "0.18.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "685c9fa8e590b8b3d678873528d83411db17242a73fccaed827770ea0fedda51" +dependencies = [ + "glib-sys", + "libc", + "system-deps", +] + +[[package]] +name = "camino" +version = "1.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e629a66d692cb9ff1a1c664e41771b3dcaf961985a9774c0eb0bd1b51cf60a48" +dependencies = [ + "serde_core", +] + +[[package]] +name = "cargo-platform" +version = "0.1.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e35af189006b9c0f00a064685c727031e3ed2d8020f7ba284d78cc2671bd36ea" +dependencies = [ + "serde", +] + +[[package]] +name = "cargo_metadata" +version = "0.19.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dd5eb614ed4c27c5d706420e4320fbe3216ab31fa1c33cd8246ac36dae4479ba" +dependencies = [ + "camino", + "cargo-platform", + "semver", + "serde", + "serde_json", + "thiserror 2.0.18", +] + +[[package]] +name = "cargo_toml" +version = "0.22.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "374b7c592d9c00c1f4972ea58390ac6b18cbb6ab79011f3bdc90a0b82ca06b77" +dependencies = [ + "serde", + "toml 0.9.12+spec-1.1.0", +] + +[[package]] +name = "cc" +version = "1.2.58" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e1e928d4b69e3077709075a938a05ffbedfa53a84c8f766efbf8220bb1ff60e1" +dependencies = [ + "find-msvc-tools", + "shlex", +] + +[[package]] +name = "cesu8" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6d43a04d8753f35258c91f8ec639f792891f748a1edbd759cf1dcea3382ad83c" + +[[package]] +name = "cfb" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d38f2da7a0a2c4ccf0065be06397cc26a81f4e528be095826eee9d4adbb8c60f" +dependencies = [ + "byteorder", + "fnv", + "uuid", +] + +[[package]] +name = "cfg-expr" +version = "0.15.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d067ad48b8650848b989a59a86c6c36a995d02d2bf778d45c3c5d57bc2718f02" +dependencies = [ + "smallvec", + "target-lexicon", +] + +[[package]] +name = "cfg-if" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9330f8b2ff13f34540b44e946ef35111825727b38d33286ef986142615121801" + +[[package]] +name = "chrono" +version = "0.4.44" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c673075a2e0e5f4a1dde27ce9dee1ea4558c7ffe648f576438a20ca1d2acc4b0" +dependencies = [ + "iana-time-zone", + "num-traits", + "serde", + "windows-link 0.2.1", +] + +[[package]] +name = "combine" +version = "4.6.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ba5a308b75df32fe02788e748662718f03fde005016435c444eea572398219fd" +dependencies = [ + "bytes", + "memchr", +] + +[[package]] +name = "convert_case" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6245d59a3e82a7fc217c5828a6692dbc6dfb63a0c8c90495621f7b9d79704a0e" + +[[package]] +name = "cookie" +version = "0.18.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4ddef33a339a91ea89fb53151bd0a4689cfce27055c291dfa69945475d22c747" +dependencies = [ + "time", + "version_check", +] + +[[package]] +name = "core-foundation" +version = "0.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b2a6cd9ae233e7f62ba4e9353e81a88df7fc8a5987b8d445b4d90c879bd156f6" +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.25.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "064badf302c3194842cf2c5d61f56cc88e54a759313879cdf03abdd27d0c3b97" +dependencies = [ + "bitflags 2.11.0", + "core-foundation", + "core-graphics-types", + "foreign-types", + "libc", +] + +[[package]] +name = "core-graphics-types" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3d44a101f213f6c4cdc1853d4b78aef6db6bdfa3468798cc1d9912f4735013eb" +dependencies = [ + "bitflags 2.11.0", + "core-foundation", + "libc", +] + +[[package]] +name = "cpufeatures" +version = "0.2.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "59ed5838eebb26a2bb2e58f6d5b5316989ae9d08bab10e0e6d103e656d1b0280" +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-channel" +version = "0.5.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "82b8f8f868b36967f9606790d1903570de9ceaf870a7bf9fbbd3016d636a2cb2" +dependencies = [ + "crossbeam-utils", +] + +[[package]] +name = "crossbeam-utils" +version = "0.8.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d0a5c400df2834b80a4c3327b3aad3a4c4cd4de0629063962b03235697506a28" + +[[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 = "cssparser" +version = "0.29.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f93d03419cb5950ccfd3daf3ff1c7a36ace64609a1a8746d493df1ca0afde0fa" +dependencies = [ + "cssparser-macros", + "dtoa-short", + "itoa", + "matches", + "phf 0.10.1", + "proc-macro2", + "quote", + "smallvec", + "syn 1.0.109", +] + +[[package]] +name = "cssparser" +version = "0.36.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dae61cf9c0abb83bd659dab65b7e4e38d8236824c85f0f804f173567bda257d2" +dependencies = [ + "cssparser-macros", + "dtoa-short", + "itoa", + "phf 0.13.1", + "smallvec", +] + +[[package]] +name = "cssparser-macros" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "13b588ba4ac1a99f7f2964d24b3d896ddc6bf847ee3855dbd4366f058cfcd331" +dependencies = [ + "quote", + "syn 2.0.117", +] + +[[package]] +name = "ctor" +version = "0.2.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "32a2785755761f3ddc1492979ce1e48d2c00d09311c39e4466429188f3dd6501" +dependencies = [ + "quote", + "syn 2.0.117", +] + +[[package]] +name = "darling" +version = "0.23.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "25ae13da2f202d56bd7f91c25fba009e7717a1e4a1cc98a76d844b65ae912e9d" +dependencies = [ + "darling_core", + "darling_macro", +] + +[[package]] +name = "darling_core" +version = "0.23.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9865a50f7c335f53564bb694ef660825eb8610e0a53d3e11bf1b0d3df31e03b0" +dependencies = [ + "ident_case", + "proc-macro2", + "quote", + "strsim", + "syn 2.0.117", +] + +[[package]] +name = "darling_macro" +version = "0.23.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ac3984ec7bd6cfa798e62b4a642426a5be0e68f9401cfc2a01e3fa9ea2fcdb8d" +dependencies = [ + "darling_core", + "quote", + "syn 2.0.117", +] + +[[package]] +name = "deranged" +version = "0.5.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7cd812cc2bc1d69d4764bd80df88b4317eaef9e773c75226407d9bc0876b211c" +dependencies = [ + "powerfmt", + "serde_core", +] + +[[package]] +name = "derive_more" +version = "0.99.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6edb4b64a43d977b8e99788fe3a04d483834fba1215a7e02caa415b626497f7f" +dependencies = [ + "convert_case", + "proc-macro2", + "quote", + "rustc_version", + "syn 2.0.117", +] + +[[package]] +name = "derive_more" +version = "2.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d751e9e49156b02b44f9c1815bcb94b984cdcc4396ecc32521c739452808b134" +dependencies = [ + "derive_more-impl", +] + +[[package]] +name = "derive_more-impl" +version = "2.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "799a97264921d8623a957f6c3b9011f3b5492f557bbb7a5a19b7fa6d06ba8dcb" +dependencies = [ + "proc-macro2", + "quote", + "rustc_version", + "syn 2.0.117", +] + +[[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 = "dirs" +version = "6.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c3e8aa94d75141228480295a7d0e7feb620b1a5ad9f12bc40be62411e38cce4e" +dependencies = [ + "dirs-sys", +] + +[[package]] +name = "dirs-sys" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e01a3366d27ee9890022452ee61b2b63a67e6f13f58900b651ff5665f0bb1fab" +dependencies = [ + "libc", + "option-ext", + "redox_users", + "windows-sys 0.61.2", +] + +[[package]] +name = "dispatch2" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e0e367e4e7da84520dedcac1901e4da967309406d1e51017ae1abfb97adbd38" +dependencies = [ + "bitflags 2.11.0", + "block2", + "libc", + "objc2", +] + +[[package]] +name = "displaydoc" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "97369cbbc041bc366949bc74d34658d6cda5621039731c6310521892a3a20ae0" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.117", +] + +[[package]] +name = "dlopen2" +version = "0.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5e2c5bd4158e66d1e215c49b837e11d62f3267b30c92f1d171c4d3105e3dc4d4" +dependencies = [ + "dlopen2_derive", + "libc", + "once_cell", + "winapi", +] + +[[package]] +name = "dlopen2_derive" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0fbbb781877580993a8707ec48672673ec7b81eeba04cfd2310bd28c08e47c8f" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.117", +] + +[[package]] +name = "dom_query" +version = "0.27.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "521e380c0c8afb8d9a1e83a1822ee03556fc3e3e7dbc1fd30be14e37f9cb3f89" +dependencies = [ + "bit-set", + "cssparser 0.36.0", + "foldhash 0.2.0", + "html5ever 0.38.0", + "precomputed-hash", + "selectors 0.36.1", + "tendril 0.5.0", +] + +[[package]] +name = "dpi" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d8b14ccef22fc6f5a8f4d7d768562a182c04ce9a3b3157b91390b52ddfdf1a76" +dependencies = [ + "serde", +] + +[[package]] +name = "dtoa" +version = "1.0.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4c3cf4824e2d5f025c7b531afcb2325364084a16806f6d47fbc1f5fbd9960590" + +[[package]] +name = "dtoa-short" +version = "0.3.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cd1511a7b6a56299bd043a9c167a6d2bfb37bf84a6dfceaba651168adfb43c87" +dependencies = [ + "dtoa", +] + +[[package]] +name = "dunce" +version = "1.0.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "92773504d58c093f6de2459af4af33faa518c13451eb8f2b5698ed3d36e7c813" + +[[package]] +name = "dyn-clone" +version = "1.0.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d0881ea181b1df73ff77ffaaf9c7544ecc11e82fba9b5f27b262a3c73a332555" + +[[package]] +name = "embed-resource" +version = "3.0.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "63a1d0de4f2249aa0ff5884d7080814f446bb241a559af6c170a41e878ed2d45" +dependencies = [ + "cc", + "memchr", + "rustc_version", + "toml 0.9.12+spec-1.1.0", + "vswhom", + "winreg", +] + +[[package]] +name = "embed_plist" +version = "1.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4ef6b89e5b37196644d8796de5268852ff179b44e96276cf4290264843743bb7" + +[[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 = "equivalent" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "877a4ace8713b0bcf2a4e7eec82529c029f1d0619886d18145fea96c3ffe5c0f" + +[[package]] +name = "erased-serde" +version = "0.4.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d2add8a07dd6a8d93ff627029c51de145e12686fbc36ecb298ac22e74cf02dec" +dependencies = [ + "serde", + "serde_core", + "typeid", +] + +[[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 = "fastrand" +version = "2.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "37909eebbb50d72f9059c3b6d82c0463f2ff062c9e95845c43a6c9c0355411be" + +[[package]] +name = "fdeflate" +version = "0.3.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e6853b52649d4ac5c0bd02320cddc5ba956bdb407c4b75a2c6b75bf51500f8c" +dependencies = [ + "simd-adler32", +] + +[[package]] +name = "field-offset" +version = "0.3.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "38e2275cc4e4fc009b0669731a1e5ab7ebf11f469eaede2bab9309a5b4d6057f" +dependencies = [ + "memoffset", + "rustc_version", +] + +[[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 = "fnv" +version = "1.0.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" + +[[package]] +name = "foldhash" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d9c4f5dac5e15c24eb999c26181a6ca40b39fe946cbe4c263c7209467bc83af2" + +[[package]] +name = "foldhash" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "77ce24cb58228fbb8aa041425bb1050850ac19177686ea6e0f41a70416f56fdb" + +[[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.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1a5c6c585bc94aaf2c7b51dd4c2ba22680844aba4c687be581871a6f518c5742" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.117", +] + +[[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 = "futf" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "df420e2e84819663797d1ec6544b13c5be84629e7bb00dc960d6917db2987843" +dependencies = [ + "mac", + "new_debug_unreachable", +] + +[[package]] +name = "futures-channel" +version = "0.3.32" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "07bbe89c50d7a535e539b8c17bc0b49bdb77747034daa8087407d655f3f7cc1d" +dependencies = [ + "futures-core", +] + +[[package]] +name = "futures-core" +version = "0.3.32" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7e3450815272ef58cec6d564423f6e755e25379b217b0bc688e295ba24df6b1d" + +[[package]] +name = "futures-executor" +version = "0.3.32" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "baf29c38818342a3b26b5b923639e7b1f4a61fc5e76102d4b1981c6dc7a7579d" +dependencies = [ + "futures-core", + "futures-task", + "futures-util", +] + +[[package]] +name = "futures-io" +version = "0.3.32" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cecba35d7ad927e23624b22ad55235f2239cfa44fd10428eecbeba6d6a717718" + +[[package]] +name = "futures-macro" +version = "0.3.32" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e835b70203e41293343137df5c0664546da5745f82ec9b84d40be8336958447b" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.117", +] + +[[package]] +name = "futures-sink" +version = "0.3.32" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c39754e157331b013978ec91992bde1ac089843443c49cbc7f46150b0fad0893" + +[[package]] +name = "futures-task" +version = "0.3.32" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "037711b3d59c33004d3856fbdc83b99d4ff37a24768fa1be9ce3538a1cde4393" + +[[package]] +name = "futures-util" +version = "0.3.32" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "389ca41296e6190b48053de0321d02a77f32f8a5d2461dd38762c0593805c6d6" +dependencies = [ + "futures-core", + "futures-io", + "futures-macro", + "futures-sink", + "futures-task", + "memchr", + "pin-project-lite", + "slab", +] + +[[package]] +name = "fxhash" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c31b6d751ae2c7f11320402d34e41349dd1016f8d5d45e48c4312bc8625af50c" +dependencies = [ + "byteorder", +] + +[[package]] +name = "gdk" +version = "0.18.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d9f245958c627ac99d8e529166f9823fb3b838d1d41fd2b297af3075093c2691" +dependencies = [ + "cairo-rs", + "gdk-pixbuf", + "gdk-sys", + "gio", + "glib", + "libc", + "pango", +] + +[[package]] +name = "gdk-pixbuf" +version = "0.18.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "50e1f5f1b0bfb830d6ccc8066d18db35c487b1b2b1e8589b5dfe9f07e8defaec" +dependencies = [ + "gdk-pixbuf-sys", + "gio", + "glib", + "libc", + "once_cell", +] + +[[package]] +name = "gdk-pixbuf-sys" +version = "0.18.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3f9839ea644ed9c97a34d129ad56d38a25e6756f99f3a88e15cd39c20629caf7" +dependencies = [ + "gio-sys", + "glib-sys", + "gobject-sys", + "libc", + "system-deps", +] + +[[package]] +name = "gdk-sys" +version = "0.18.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5c2d13f38594ac1e66619e188c6d5a1adb98d11b2fcf7894fc416ad76aa2f3f7" +dependencies = [ + "cairo-sys-rs", + "gdk-pixbuf-sys", + "gio-sys", + "glib-sys", + "gobject-sys", + "libc", + "pango-sys", + "pkg-config", + "system-deps", +] + +[[package]] +name = "gdkwayland-sys" +version = "0.18.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "140071d506d223f7572b9f09b5e155afbd77428cd5cc7af8f2694c41d98dfe69" +dependencies = [ + "gdk-sys", + "glib-sys", + "gobject-sys", + "libc", + "pkg-config", + "system-deps", +] + +[[package]] +name = "gdkx11" +version = "0.18.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3caa00e14351bebbc8183b3c36690327eb77c49abc2268dd4bd36b856db3fbfe" +dependencies = [ + "gdk", + "gdkx11-sys", + "gio", + "glib", + "libc", + "x11", +] + +[[package]] +name = "gdkx11-sys" +version = "0.18.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6e2e7445fe01ac26f11601db260dd8608fe172514eb63b3b5e261ea6b0f4428d" +dependencies = [ + "gdk-sys", + "glib-sys", + "libc", + "system-deps", + "x11", +] + +[[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 = "getrandom" +version = "0.1.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8fc3cb4d91f53b50155bdcfd23f6a4c39ae1969c2ae85982b135750cccaf5fce" +dependencies = [ + "cfg-if", + "libc", + "wasi 0.9.0+wasi-snapshot-preview1", +] + +[[package]] +name = "getrandom" +version = "0.2.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ff2abc00be7fca6ebc474524697ae276ad847ad0a6b3faa4bcb027e9a4614ad0" +dependencies = [ + "cfg-if", + "libc", + "wasi 0.11.1+wasi-snapshot-preview1", +] + +[[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.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0de51e6874e94e7bf76d726fc5d13ba782deca734ff60d5bb2fb2607c7406555" +dependencies = [ + "cfg-if", + "libc", + "r-efi 6.0.0", + "wasip2", + "wasip3", +] + +[[package]] +name = "gio" +version = "0.18.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d4fc8f532f87b79cbc51a79748f16a6828fb784be93145a322fa14d06d354c73" +dependencies = [ + "futures-channel", + "futures-core", + "futures-io", + "futures-util", + "gio-sys", + "glib", + "libc", + "once_cell", + "pin-project-lite", + "smallvec", + "thiserror 1.0.69", +] + +[[package]] +name = "gio-sys" +version = "0.18.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "37566df850baf5e4cb0dfb78af2e4b9898d817ed9263d1090a2df958c64737d2" +dependencies = [ + "glib-sys", + "gobject-sys", + "libc", + "system-deps", + "winapi", +] + +[[package]] +name = "glib" +version = "0.18.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "233daaf6e83ae6a12a52055f568f9d7cf4671dabb78ff9560ab6da230ce00ee5" +dependencies = [ + "bitflags 2.11.0", + "futures-channel", + "futures-core", + "futures-executor", + "futures-task", + "futures-util", + "gio-sys", + "glib-macros", + "glib-sys", + "gobject-sys", + "libc", + "memchr", + "once_cell", + "smallvec", + "thiserror 1.0.69", +] + +[[package]] +name = "glib-macros" +version = "0.18.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0bb0228f477c0900c880fd78c8759b95c7636dbd7842707f49e132378aa2acdc" +dependencies = [ + "heck 0.4.1", + "proc-macro-crate 2.0.2", + "proc-macro-error", + "proc-macro2", + "quote", + "syn 2.0.117", +] + +[[package]] +name = "glib-sys" +version = "0.18.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "063ce2eb6a8d0ea93d2bf8ba1957e78dbab6be1c2220dd3daca57d5a9d869898" +dependencies = [ + "libc", + "system-deps", +] + +[[package]] +name = "glob" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0cc23270f6e1808e30a928bdc84dea0b9b4136a8bc82338574f23baf47bbd280" + +[[package]] +name = "gobject-sys" +version = "0.18.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0850127b514d1c4a4654ead6dedadb18198999985908e6ffe4436f53c785ce44" +dependencies = [ + "glib-sys", + "libc", + "system-deps", +] + +[[package]] +name = "gtk" +version = "0.18.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fd56fb197bfc42bd5d2751f4f017d44ff59fbb58140c6b49f9b3b2bdab08506a" +dependencies = [ + "atk", + "cairo-rs", + "field-offset", + "futures-channel", + "gdk", + "gdk-pixbuf", + "gio", + "glib", + "gtk-sys", + "gtk3-macros", + "libc", + "pango", + "pkg-config", +] + +[[package]] +name = "gtk-sys" +version = "0.18.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8f29a1c21c59553eb7dd40e918be54dccd60c52b049b75119d5d96ce6b624414" +dependencies = [ + "atk-sys", + "cairo-sys-rs", + "gdk-pixbuf-sys", + "gdk-sys", + "gio-sys", + "glib-sys", + "gobject-sys", + "libc", + "pango-sys", + "system-deps", +] + +[[package]] +name = "gtk3-macros" +version = "0.18.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "52ff3c5b21f14f0736fed6dcfc0bfb4225ebf5725f3c0209edeec181e4d73e9d" +dependencies = [ + "proc-macro-crate 1.3.1", + "proc-macro-error", + "proc-macro2", + "quote", + "syn 2.0.117", +] + +[[package]] +name = "hashbrown" +version = "0.12.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" + +[[package]] +name = "hashbrown" +version = "0.15.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9229cfe53dfd69f0609a49f65461bd93001ea1ef889cd5529dd176593f5338a1" +dependencies = [ + "foldhash 0.1.5", +] + +[[package]] +name = "hashbrown" +version = "0.16.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "841d1cc9bed7f9236f321df977030373f4a4163ae1a7dbfe1a51a2c1a51d9100" + +[[package]] +name = "heck" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8" + +[[package]] +name = "heck" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea" + +[[package]] +name = "hex" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70" + +[[package]] +name = "html5ever" +version = "0.29.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3b7410cae13cbc75623c98ac4cbfd1f0bedddf3227afc24f370cf0f50a44a11c" +dependencies = [ + "log", + "mac", + "markup5ever 0.14.1", + "match_token", +] + +[[package]] +name = "html5ever" +version = "0.38.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1054432bae2f14e0061e33d23402fbaa67a921d319d56adc6bcf887ddad1cbc2" +dependencies = [ + "log", + "markup5ever 0.38.0", +] + +[[package]] +name = "http" +version = "1.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e3ba2a386d7f85a81f119ad7498ebe444d2e22c2af0b86b069416ace48b3311a" +dependencies = [ + "bytes", + "itoa", +] + +[[package]] +name = "http-body" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1efedce1fb8e6913f23e0c92de8e62cd5b772a67e7b3946df930a62566c93184" +dependencies = [ + "bytes", + "http", +] + +[[package]] +name = "http-body-util" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b021d93e26becf5dc7e1b75b1bed1fd93124b374ceb73f43d4d4eafec896a64a" +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.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6299f016b246a94207e63da54dbe807655bf9e00044f73ded42c3ac5305fbcca" +dependencies = [ + "atomic-waker", + "bytes", + "futures-channel", + "futures-core", + "http", + "http-body", + "httparse", + "itoa", + "pin-project-lite", + "smallvec", + "tokio", + "want", +] + +[[package]] +name = "hyper-util" +version = "0.1.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "96547c2556ec9d12fb1578c4eaf448b04993e7fb79cbaad930a656880a6bdfa0" +dependencies = [ + "base64 0.22.1", + "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 0.62.2", +] + +[[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 = "ico" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3e795dff5605e0f04bff85ca41b51a96b83e80b281e96231bcaaf1ac35103371" +dependencies = [ + "byteorder", + "png", +] + +[[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 = "id-arena" +version = "2.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3d3067d79b975e8844ca9eb072e16b31c3c1c36928edf9c6789548c524d0d954" + +[[package]] +name = "ident_case" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b9e0384b61958566e926dc50660321d12159025e767c18e043daf26b70104c39" + +[[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.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3acae9609540aa318d1bc588455225fb2085b9ed0c4f6bd0d9d5bcd86f1a0344" +dependencies = [ + "icu_normalizer", + "icu_properties", +] + +[[package]] +name = "indexmap" +version = "1.9.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bd070e393353796e801d209ad339e89596eb4c8d430d18ede6a1cced8fafbd99" +dependencies = [ + "autocfg", + "hashbrown 0.12.3", + "serde", +] + +[[package]] +name = "indexmap" +version = "2.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "45a8a2b9cb3e0b0c1803dbb0758ffac5de2f425b23c28f518faabd9d805342ff" +dependencies = [ + "equivalent", + "hashbrown 0.16.1", + "serde", + "serde_core", +] + +[[package]] +name = "infer" +version = "0.19.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a588916bfdfd92e71cacef98a63d9b1f0d74d6599980d11894290e7ddefffcf7" +dependencies = [ + "cfb", +] + +[[package]] +name = "ipnet" +version = "2.12.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d98f6fed1fde3f8c21bc40a1abb88dd75e67924f9cffc3ef95607bad8017f8e2" + +[[package]] +name = "iri-string" +version = "0.7.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "25e659a4bb38e810ebc252e53b5814ff908a8c58c2a9ce2fae1bbec24cbf4e20" +dependencies = [ + "memchr", + "serde", +] + +[[package]] +name = "is-docker" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "928bae27f42bc99b60d9ac7334e3a21d10ad8f1835a4e12ec3ec0464765ed1b3" +dependencies = [ + "once_cell", +] + +[[package]] +name = "is-wsl" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "173609498df190136aa7dea1a91db051746d339e18476eed5ca40521f02d7aa5" +dependencies = [ + "is-docker", + "once_cell", +] + +[[package]] +name = "itoa" +version = "1.0.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8f42a60cbdf9a97f5d2305f08a87dc4e09308d1276d28c869c684d7777685682" + +[[package]] +name = "javascriptcore-rs" +version = "1.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ca5671e9ffce8ffba57afc24070e906da7fc4b1ba66f2cabebf61bf2ea257fcc" +dependencies = [ + "bitflags 1.3.2", + "glib", + "javascriptcore-rs-sys", +] + +[[package]] +name = "javascriptcore-rs-sys" +version = "1.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "af1be78d14ffa4b75b66df31840478fef72b51f8c2465d4ca7c194da9f7a5124" +dependencies = [ + "glib-sys", + "gobject-sys", + "libc", + "system-deps", +] + +[[package]] +name = "jni" +version = "0.21.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1a87aa2bb7d2af34197c04845522473242e1aa17c12f4935d5856491a7fb8c97" +dependencies = [ + "cesu8", + "cfg-if", + "combine", + "jni-sys 0.3.1", + "log", + "thiserror 1.0.69", + "walkdir", + "windows-sys 0.45.0", +] + +[[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.117", +] + +[[package]] +name = "js-sys" +version = "0.3.94" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2e04e2ef80ce82e13552136fabeef8a5ed1f985a96805761cbb9a2c34e7664d9" +dependencies = [ + "cfg-if", + "futures-util", + "once_cell", + "wasm-bindgen", +] + +[[package]] +name = "json-patch" +version = "3.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "863726d7afb6bc2590eeff7135d923545e5e964f004c2ccf8716c25e70a86f08" +dependencies = [ + "jsonptr", + "serde", + "serde_json", + "thiserror 1.0.69", +] + +[[package]] +name = "jsonptr" +version = "0.6.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5dea2b27dd239b2556ed7a25ba842fe47fd602e7fc7433c2a8d6106d4d9edd70" +dependencies = [ + "serde", + "serde_json", +] + +[[package]] +name = "keyboard-types" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b750dcadc39a09dbadd74e118f6dd6598df77fa01df0cfcdc52c28dece74528a" +dependencies = [ + "bitflags 2.11.0", + "serde", + "unicode-segmentation", +] + +[[package]] +name = "kopdeltav" +version = "0.1.0" +dependencies = [ + "serde", +] + +[[package]] +name = "kspdeltavformods" +version = "0.1.0" +dependencies = [ + "kopdeltav", + "serde", + "serde_json", + "tauri", + "tauri-build", + "tauri-plugin-dialog", + "tauri-plugin-shell", +] + +[[package]] +name = "kuchikiki" +version = "0.8.8-speedreader" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "02cb977175687f33fa4afa0c95c112b987ea1443e5a51c8f8ff27dc618270cc2" +dependencies = [ + "cssparser 0.29.6", + "html5ever 0.29.1", + "indexmap 2.13.1", + "selectors 0.24.0", +] + +[[package]] +name = "leb128fmt" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "09edd9e8b54e49e587e4f6295a7d29c3ea94d469cb40ab8ca70b288248a81db2" + +[[package]] +name = "libappindicator" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "03589b9607c868cc7ae54c0b2a22c8dc03dd41692d48f2d7df73615c6a95dc0a" +dependencies = [ + "glib", + "gtk", + "gtk-sys", + "libappindicator-sys", + "log", +] + +[[package]] +name = "libappindicator-sys" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6e9ec52138abedcc58dc17a7c6c0c00a2bdb4f3427c7f63fa97fd0d859155caf" +dependencies = [ + "gtk-sys", + "libloading", + "once_cell", +] + +[[package]] +name = "libc" +version = "0.2.184" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "48f5d2a454e16a5ea0f4ced81bd44e4cfc7bd3a507b61887c99fd3538b28e4af" + +[[package]] +name = "libloading" +version = "0.7.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b67380fd3b2fbe7527a606e18729d21c6f3951633d0500574c4dc22d2d638b9f" +dependencies = [ + "cfg-if", + "winapi", +] + +[[package]] +name = "libredox" +version = "0.1.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7ddbf48fd451246b1f8c2610bd3b4ac0cc6e149d89832867093ab69a17194f08" +dependencies = [ + "libc", +] + +[[package]] +name = "litemap" +version = "0.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "92daf443525c4cce67b150400bc2316076100ce0b3686209eb8cf3c31612e6f0" + +[[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.29" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5e5032e24019045c762d3c0f28f5b6b8bbf38563a65908389bf7978758920897" + +[[package]] +name = "mac" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c41e0c4fef86961ac6d6f8a82609f55f31b05e4fce149ac5710e439df7619ba4" + +[[package]] +name = "markup5ever" +version = "0.14.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c7a7213d12e1864c0f002f52c2923d4556935a43dec5e71355c2760e0f6e7a18" +dependencies = [ + "log", + "phf 0.11.3", + "phf_codegen 0.11.3", + "string_cache 0.8.9", + "string_cache_codegen 0.5.4", + "tendril 0.4.3", +] + +[[package]] +name = "markup5ever" +version = "0.38.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8983d30f2915feeaaab2d6babdd6bc7e9ed1a00b66b5e6d74df19aa9c0e91862" +dependencies = [ + "log", + "tendril 0.5.0", + "web_atoms", +] + +[[package]] +name = "match_token" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "88a9689d8d44bf9964484516275f5cd4c9b59457a6940c1d5d0ecbb94510a36b" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.117", +] + +[[package]] +name = "matches" +version = "0.1.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2532096657941c2fea9c289d370a250971c689d4f143798ff67113ec042024a5" + +[[package]] +name = "memchr" +version = "2.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f8ca58f447f06ed17d5fc4043ce1b10dd205e060fb3ce5b979b8ed8e59ff3f79" + +[[package]] +name = "memoffset" +version = "0.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "488016bfae457b036d996092f6cb448677611ce4449e970ceaf42695203f218a" +dependencies = [ + "autocfg", +] + +[[package]] +name = "mime" +version = "0.3.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6877bb514081ee2a7ff5ef9de3281f14a4dd4bceac4c09388074a6b5df8a139a" + +[[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.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "50b7e5b27aa02a74bac8c3f23f448f8d87ff11f92d3aac1a6ed369ee08cc56c1" +dependencies = [ + "libc", + "wasi 0.11.1+wasi-snapshot-preview1", + "windows-sys 0.61.2", +] + +[[package]] +name = "muda" +version = "0.17.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "01c1738382f66ed56b3b9c8119e794a2e23148ac8ea214eda86622d4cb9d415a" +dependencies = [ + "crossbeam-channel", + "dpi", + "gtk", + "keyboard-types", + "objc2", + "objc2-app-kit", + "objc2-core-foundation", + "objc2-foundation", + "once_cell", + "png", + "serde", + "thiserror 2.0.18", + "windows-sys 0.60.2", +] + +[[package]] +name = "ndk" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c3f42e7bbe13d351b6bead8286a43aac9534b82bd3cc43e47037f012ebfd62d4" +dependencies = [ + "bitflags 2.11.0", + "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 = "nodrop" +version = "0.1.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "72ef4a56884ca558e5ddb05a1d1e7e1bfd9a68d9ed024c21704cc98872dae1bb" + +[[package]] +name = "num-conv" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c6673768db2d862beb9b39a78fdcb1a69439615d5794a1be50caa9bc92c81967" + +[[package]] +name = "num-traits" +version = "0.2.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "071dfc062690e90b734c0b2273ce72ad0ffa95f0c74596bc250dcfd960262841" +dependencies = [ + "autocfg", +] + +[[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 3.5.0", + "proc-macro2", + "quote", + "syn 2.0.117", +] + +[[package]] +name = "objc2" +version = "0.6.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3a12a8ed07aefc768292f076dc3ac8c48f3781c8f2d5851dd3d98950e8c5a89f" +dependencies = [ + "objc2-encode", + "objc2-exception-helper", +] + +[[package]] +name = "objc2-app-kit" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d49e936b501e5c5bf01fda3a9452ff86dc3ea98ad5f283e1455153142d97518c" +dependencies = [ + "bitflags 2.11.0", + "block2", + "objc2", + "objc2-core-foundation", + "objc2-foundation", +] + +[[package]] +name = "objc2-core-foundation" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2a180dd8642fa45cdb7dd721cd4c11b1cadd4929ce112ebd8b9f5803cc79d536" +dependencies = [ + "bitflags 2.11.0", + "dispatch2", + "objc2", +] + +[[package]] +name = "objc2-core-graphics" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e022c9d066895efa1345f8e33e584b9f958da2fd4cd116792e15e07e4720a807" +dependencies = [ + "bitflags 2.11.0", + "dispatch2", + "objc2", + "objc2-core-foundation", + "objc2-io-surface", +] + +[[package]] +name = "objc2-encode" +version = "4.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ef25abbcd74fb2609453eb695bd2f860d389e457f67dc17cafc8b8cbc89d0c33" + +[[package]] +name = "objc2-exception-helper" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c7a1c5fbb72d7735b076bb47b578523aedc40f3c439bea6dfd595c089d79d98a" +dependencies = [ + "cc", +] + +[[package]] +name = "objc2-foundation" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e3e0adef53c21f888deb4fa59fc59f7eb17404926ee8a6f59f5df0fd7f9f3272" +dependencies = [ + "bitflags 2.11.0", + "block2", + "objc2", + "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.11.0", + "objc2", + "objc2-core-foundation", +] + +[[package]] +name = "objc2-quartz-core" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "96c1358452b371bf9f104e21ec536d37a650eb10f7ee379fff67d2e08d537f1f" +dependencies = [ + "bitflags 2.11.0", + "objc2", + "objc2-core-foundation", + "objc2-foundation", +] + +[[package]] +name = "objc2-ui-kit" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d87d638e33c06f577498cbcc50491496a3ed4246998a7fbba7ccb98b1e7eab22" +dependencies = [ + "bitflags 2.11.0", + "objc2", + "objc2-core-foundation", + "objc2-foundation", +] + +[[package]] +name = "objc2-web-kit" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b2e5aaab980c433cf470df9d7af96a7b46a9d892d521a2cbbb2f8a4c16751e7f" +dependencies = [ + "bitflags 2.11.0", + "block2", + "objc2", + "objc2-app-kit", + "objc2-core-foundation", + "objc2-foundation", +] + +[[package]] +name = "once_cell" +version = "1.21.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9f7c3e4beb33f85d45ae3e3a1792185706c8e16d043238c593331cc7cd313b50" + +[[package]] +name = "open" +version = "5.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "43bb73a7fa3799b198970490a51174027ba0d4ec504b03cd08caf513d40024bc" +dependencies = [ + "dunce", + "is-wsl", + "libc", + "pathdiff", +] + +[[package]] +name = "option-ext" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "04744f49eae99ab78e0d5c0b603ab218f515ea8cfe5a456d7629ad883a3b6e7d" + +[[package]] +name = "os_pipe" +version = "1.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7d8fae84b431384b68627d0f9b3b1245fcf9f46f6c0e3dc902e9dce64edd1967" +dependencies = [ + "libc", + "windows-sys 0.61.2", +] + +[[package]] +name = "pango" +version = "0.18.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7ca27ec1eb0457ab26f3036ea52229edbdb74dee1edd29063f5b9b010e7ebee4" +dependencies = [ + "gio", + "glib", + "libc", + "once_cell", + "pango-sys", +] + +[[package]] +name = "pango-sys" +version = "0.18.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "436737e391a843e5933d6d9aa102cb126d501e815b83601365a948a518555dc5" +dependencies = [ + "glib-sys", + "gobject-sys", + "libc", + "system-deps", +] + +[[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", + "smallvec", + "windows-link 0.2.1", +] + +[[package]] +name = "pathdiff" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "df94ce210e5bc13cb6651479fa48d14f601d9858cfe0467f43ae157023b938d3" + +[[package]] +name = "percent-encoding" +version = "2.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9b4f627cb1b25917193a259e49bdad08f671f8d9708acfd5fe0a8c1455d87220" + +[[package]] +name = "phf" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3dfb61232e34fcb633f43d12c58f83c1df82962dcdfa565a4e866ffc17dafe12" +dependencies = [ + "phf_shared 0.8.0", +] + +[[package]] +name = "phf" +version = "0.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fabbf1ead8a5bcbc20f5f8b939ee3f5b0f6f281b6ad3468b84656b658b455259" +dependencies = [ + "phf_macros 0.10.0", + "phf_shared 0.10.0", + "proc-macro-hack", +] + +[[package]] +name = "phf" +version = "0.11.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1fd6780a80ae0c52cc120a26a1a42c1ae51b247a253e4e06113d23d2c2edd078" +dependencies = [ + "phf_macros 0.11.3", + "phf_shared 0.11.3", +] + +[[package]] +name = "phf" +version = "0.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c1562dc717473dbaa4c1f85a36410e03c047b2e7df7f45ee938fbef64ae7fadf" +dependencies = [ + "phf_macros 0.13.1", + "phf_shared 0.13.1", + "serde", +] + +[[package]] +name = "phf_codegen" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cbffee61585b0411840d3ece935cce9cb6321f01c45477d30066498cd5e1a815" +dependencies = [ + "phf_generator 0.8.0", + "phf_shared 0.8.0", +] + +[[package]] +name = "phf_codegen" +version = "0.11.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "aef8048c789fa5e851558d709946d6d79a8ff88c0440c587967f8e94bfb1216a" +dependencies = [ + "phf_generator 0.11.3", + "phf_shared 0.11.3", +] + +[[package]] +name = "phf_codegen" +version = "0.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "49aa7f9d80421bca176ca8dbfebe668cc7a2684708594ec9f3c0db0805d5d6e1" +dependencies = [ + "phf_generator 0.13.1", + "phf_shared 0.13.1", +] + +[[package]] +name = "phf_generator" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "17367f0cc86f2d25802b2c26ee58a7b23faeccf78a396094c13dced0d0182526" +dependencies = [ + "phf_shared 0.8.0", + "rand 0.7.3", +] + +[[package]] +name = "phf_generator" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5d5285893bb5eb82e6aaf5d59ee909a06a16737a8970984dd7746ba9283498d6" +dependencies = [ + "phf_shared 0.10.0", + "rand 0.8.5", +] + +[[package]] +name = "phf_generator" +version = "0.11.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3c80231409c20246a13fddb31776fb942c38553c51e871f8cbd687a4cfb5843d" +dependencies = [ + "phf_shared 0.11.3", + "rand 0.8.5", +] + +[[package]] +name = "phf_generator" +version = "0.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "135ace3a761e564ec88c03a77317a7c6b80bb7f7135ef2544dbe054243b89737" +dependencies = [ + "fastrand", + "phf_shared 0.13.1", +] + +[[package]] +name = "phf_macros" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "58fdf3184dd560f160dd73922bea2d5cd6e8f064bf4b13110abd81b03697b4e0" +dependencies = [ + "phf_generator 0.10.0", + "phf_shared 0.10.0", + "proc-macro-hack", + "proc-macro2", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "phf_macros" +version = "0.11.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f84ac04429c13a7ff43785d75ad27569f2951ce0ffd30a3321230db2fc727216" +dependencies = [ + "phf_generator 0.11.3", + "phf_shared 0.11.3", + "proc-macro2", + "quote", + "syn 2.0.117", +] + +[[package]] +name = "phf_macros" +version = "0.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "812f032b54b1e759ccd5f8b6677695d5268c588701effba24601f6932f8269ef" +dependencies = [ + "phf_generator 0.13.1", + "phf_shared 0.13.1", + "proc-macro2", + "quote", + "syn 2.0.117", +] + +[[package]] +name = "phf_shared" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c00cf8b9eafe68dde5e9eaa2cef8ee84a9336a47d566ec55ca16589633b65af7" +dependencies = [ + "siphasher 0.3.11", +] + +[[package]] +name = "phf_shared" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6796ad771acdc0123d2a88dc428b5e38ef24456743ddb1744ed628f9815c096" +dependencies = [ + "siphasher 0.3.11", +] + +[[package]] +name = "phf_shared" +version = "0.11.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "67eabc2ef2a60eb7faa00097bd1ffdb5bd28e62bf39990626a582201b7a754e5" +dependencies = [ + "siphasher 1.0.2", +] + +[[package]] +name = "phf_shared" +version = "0.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e57fef6bc5981e38c2ce2d63bfa546861309f875b8a75f092d1d54ae2d64f266" +dependencies = [ + "siphasher 1.0.2", +] + +[[package]] +name = "pin-project-lite" +version = "0.2.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a89322df9ebe1c1578d689c92318e070967d1042b512afbe49518723f4e6d5cd" + +[[package]] +name = "pkg-config" +version = "0.3.32" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7edddbd0b52d732b21ad9a5fab5c704c14cd949e5e9a1ec5929a24fded1b904c" + +[[package]] +name = "plist" +version = "1.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "740ebea15c5d1428f910cd1a5f52cebf8d25006245ed8ade92702f4943d91e07" +dependencies = [ + "base64 0.22.1", + "indexmap 2.13.1", + "quick-xml", + "serde", + "time", +] + +[[package]] +name = "png" +version = "0.17.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "82151a2fc869e011c153adc57cf2789ccb8d9906ce52c0b39a6b5697749d7526" +dependencies = [ + "bitflags 1.3.2", + "crc32fast", + "fdeflate", + "flate2", + "miniz_oxide", +] + +[[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 = "precomputed-hash" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "925383efa346730478fb4838dbe9137d2a47675ad789c546d150a6e1dd4ab31c" + +[[package]] +name = "prettyplease" +version = "0.2.37" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "479ca8adacdd7ce8f1fb39ce9ecccbfe93a3f1344b3d0d97f20bc0196208f62b" +dependencies = [ + "proc-macro2", + "syn 2.0.117", +] + +[[package]] +name = "proc-macro-crate" +version = "1.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7f4c021e1093a56626774e81216a4ce732a735e5bad4868a03f3ed65ca0c3919" +dependencies = [ + "once_cell", + "toml_edit 0.19.15", +] + +[[package]] +name = "proc-macro-crate" +version = "2.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b00f26d3400549137f92511a46ac1cd8ce37cb5598a96d382381458b992a5d24" +dependencies = [ + "toml_datetime 0.6.3", + "toml_edit 0.20.2", +] + +[[package]] +name = "proc-macro-crate" +version = "3.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e67ba7e9b2b56446f1d419b1d807906278ffa1a658a8a5d8a39dcb1f5a78614f" +dependencies = [ + "toml_edit 0.25.10+spec-1.1.0", +] + +[[package]] +name = "proc-macro-error" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "da25490ff9892aab3fcf7c36f08cfb902dd3e71ca0f9f9517bea02a73a5ce38c" +dependencies = [ + "proc-macro-error-attr", + "proc-macro2", + "quote", + "syn 1.0.109", + "version_check", +] + +[[package]] +name = "proc-macro-error-attr" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a1be40180e52ecc98ad80b184934baf3d0d29f979574e439af5a55274b35f869" +dependencies = [ + "proc-macro2", + "quote", + "version_check", +] + +[[package]] +name = "proc-macro-hack" +version = "0.5.20+deprecated" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dc375e1527247fe1a97d8b7156678dfe7c1af2fc075c9a4db3690ecd2a148068" + +[[package]] +name = "proc-macro2" +version = "1.0.106" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8fd00f0bb2e90d81d1044c2b32617f68fcb9fa3bb7640c23e9c748e53fb30934" +dependencies = [ + "unicode-ident", +] + +[[package]] +name = "quick-xml" +version = "0.38.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b66c2058c55a409d601666cffe35f04333cf1013010882cec174a7467cd4e21c" +dependencies = [ + "memchr", +] + +[[package]] +name = "quote" +version = "1.0.45" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "41f2619966050689382d2b44f664f4bc593e129785a36d6ee376ddf37259b924" +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.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6a6b1679d49b24bbfe0c803429aa1874472f50d9b363131f0e89fc356b544d03" +dependencies = [ + "getrandom 0.1.16", + "libc", + "rand_chacha 0.2.2", + "rand_core 0.5.1", + "rand_hc", + "rand_pcg", +] + +[[package]] +name = "rand" +version = "0.8.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404" +dependencies = [ + "libc", + "rand_chacha 0.3.1", + "rand_core 0.6.4", +] + +[[package]] +name = "rand_chacha" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f4c8ed856279c9737206bf725bf36935d8666ead7aa69b52be55af369d193402" +dependencies = [ + "ppv-lite86", + "rand_core 0.5.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_core" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "90bde5296fc891b0cef12a6d03ddccc162ce7b2aff54160af9338f8d40df6d19" +dependencies = [ + "getrandom 0.1.16", +] + +[[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_hc" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ca3129af7b92a17112d59ad498c6f81eaf463253766b90396d39ea7a39d6613c" +dependencies = [ + "rand_core 0.5.1", +] + +[[package]] +name = "rand_pcg" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "16abd0c1b639e9eb4d7c50c0b8100b0d0f849be2349829c740fe8e6eb4816429" +dependencies = [ + "rand_core 0.5.1", +] + +[[package]] +name = "raw-window-handle" +version = "0.6.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "20675572f6f24e9e76ef639bc5552774ed45f1c30e2951e1e99c59888861c539" + +[[package]] +name = "redox_syscall" +version = "0.5.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ed2bf2547551a7053d6fdfafda3f938979645c44812fbfcda098faae3f1a362d" +dependencies = [ + "bitflags 2.11.0", +] + +[[package]] +name = "redox_users" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a4e608c6638b9c18977b00b475ac1f28d14e84b27d8d42f70e0bf1e3dec127ac" +dependencies = [ + "getrandom 0.2.17", + "libredox", + "thiserror 2.0.18", +] + +[[package]] +name = "ref-cast" +version = "1.0.25" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f354300ae66f76f1c85c5f84693f0ce81d747e2c3f21a45fef496d89c960bf7d" +dependencies = [ + "ref-cast-impl", +] + +[[package]] +name = "ref-cast-impl" +version = "1.0.25" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b7186006dcb21920990093f30e3dea63b7d6e977bf1256be20c3563a5db070da" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.117", +] + +[[package]] +name = "regex" +version = "1.12.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e10754a14b9137dd7b1e3e5b0493cc9171fdd105e0ab477f51b72e7f3ac0e276" +dependencies = [ + "aho-corasick", + "memchr", + "regex-automata", + "regex-syntax", +] + +[[package]] +name = "regex-automata" +version = "0.4.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6e1dd4122fc1595e8162618945476892eefca7b88c52820e74af6262213cae8f" +dependencies = [ + "aho-corasick", + "memchr", + "regex-syntax", +] + +[[package]] +name = "regex-syntax" +version = "0.8.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dc897dd8d9e8bd1ed8cdad82b5966c3e0ecae09fb1907d58efaa013543185d0a" + +[[package]] +name = "reqwest" +version = "0.13.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ab3f43e3283ab1488b624b44b0e988d0acea0b3214e694730a055cb6b2efa801" +dependencies = [ + "base64 0.22.1", + "bytes", + "futures-core", + "futures-util", + "http", + "http-body", + "http-body-util", + "hyper", + "hyper-util", + "js-sys", + "log", + "percent-encoding", + "pin-project-lite", + "serde", + "serde_json", + "sync_wrapper", + "tokio", + "tokio-util", + "tower", + "tower-http", + "tower-service", + "url", + "wasm-bindgen", + "wasm-bindgen-futures", + "wasm-streams", + "web-sys", +] + +[[package]] +name = "rfd" +version = "0.16.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a15ad77d9e70a92437d8f74c35d99b4e4691128df018833e99f90bcd36152672" +dependencies = [ + "block2", + "dispatch2", + "glib-sys", + "gobject-sys", + "gtk-sys", + "js-sys", + "log", + "objc2", + "objc2-app-kit", + "objc2-core-foundation", + "objc2-foundation", + "raw-window-handle", + "wasm-bindgen", + "wasm-bindgen-futures", + "web-sys", + "windows-sys 0.60.2", +] + +[[package]] +name = "rustc-hash" +version = "2.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "94300abf3f1ae2e2b8ffb7b58043de3d399c73fa6f4b73826402a5c457614dbe" + +[[package]] +name = "rustc_version" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cfcb3a22ef46e85b45de6ee7e79d063319ebb6594faafcf1c225ea92ab6e9b92" +dependencies = [ + "semver", +] + +[[package]] +name = "rustversion" +version = "1.0.22" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b39cdef0fa800fc44525c84ccb54a029961a8215f9619753635a9c0d2538d46d" + +[[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 = "schemars" +version = "0.8.22" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3fbf2ae1b8bc8e02df939598064d22402220cd5bbcca1c76f7d6a310974d5615" +dependencies = [ + "dyn-clone", + "indexmap 1.9.3", + "schemars_derive", + "serde", + "serde_json", + "url", + "uuid", +] + +[[package]] +name = "schemars" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4cd191f9397d57d581cddd31014772520aa448f65ef991055d7f61582c65165f" +dependencies = [ + "dyn-clone", + "ref-cast", + "serde", + "serde_json", +] + +[[package]] +name = "schemars" +version = "1.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a2b42f36aa1cd011945615b92222f6bf73c599a102a300334cd7f8dbeec726cc" +dependencies = [ + "dyn-clone", + "ref-cast", + "serde", + "serde_json", +] + +[[package]] +name = "schemars_derive" +version = "0.8.22" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "32e265784ad618884abaea0600a9adf15393368d840e0222d101a072f3f7534d" +dependencies = [ + "proc-macro2", + "quote", + "serde_derive_internals", + "syn 2.0.117", +] + +[[package]] +name = "scopeguard" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" + +[[package]] +name = "selectors" +version = "0.24.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0c37578180969d00692904465fb7f6b3d50b9a2b952b87c23d0e2e5cb5013416" +dependencies = [ + "bitflags 1.3.2", + "cssparser 0.29.6", + "derive_more 0.99.20", + "fxhash", + "log", + "phf 0.8.0", + "phf_codegen 0.8.0", + "precomputed-hash", + "servo_arc 0.2.0", + "smallvec", +] + +[[package]] +name = "selectors" +version = "0.36.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c5d9c0c92a92d33f08817311cf3f2c29a3538a8240e94a6a3c622ce652d7e00c" +dependencies = [ + "bitflags 2.11.0", + "cssparser 0.36.0", + "derive_more 2.1.1", + "log", + "new_debug_unreachable", + "phf 0.13.1", + "phf_codegen 0.13.1", + "precomputed-hash", + "rustc-hash", + "servo_arc 0.4.3", + "smallvec", +] + +[[package]] +name = "semver" +version = "1.0.27" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d767eb0aabc880b29956c35734170f26ed551a859dbd361d140cdbeca61ab1e2" +dependencies = [ + "serde", + "serde_core", +] + +[[package]] +name = "serde" +version = "1.0.228" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9a8e94ea7f378bd32cbbd37198a4a91436180c5bb472411e48b5ec2e2124ae9e" +dependencies = [ + "serde_core", + "serde_derive", +] + +[[package]] +name = "serde-untagged" +version = "0.1.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f9faf48a4a2d2693be24c6289dbe26552776eb7737074e6722891fadbe6c5058" +dependencies = [ + "erased-serde", + "serde", + "serde_core", + "typeid", +] + +[[package]] +name = "serde_core" +version = "1.0.228" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "41d385c7d4ca58e59fc732af25c3983b67ac852c1a25000afe1175de458b67ad" +dependencies = [ + "serde_derive", +] + +[[package]] +name = "serde_derive" +version = "1.0.228" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d540f220d3187173da220f885ab66608367b6574e925011a9353e4badda91d79" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.117", +] + +[[package]] +name = "serde_derive_internals" +version = "0.29.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "18d26a20a969b9e3fdf2fc2d9f21eda6c40e2de84c9408bb5d3b05d499aae711" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.117", +] + +[[package]] +name = "serde_json" +version = "1.0.149" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "83fc039473c5595ace860d8c4fafa220ff474b3fc6bfdb4293327f1a37e94d86" +dependencies = [ + "itoa", + "memchr", + "serde", + "serde_core", + "zmij", +] + +[[package]] +name = "serde_repr" +version = "0.1.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "175ee3e80ae9982737ca543e96133087cbd9a485eecc3bc4de9c1a37b47ea59c" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.117", +] + +[[package]] +name = "serde_spanned" +version = "0.6.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bf41e0cfaf7226dca15e8197172c295a782857fcb97fad1808a166870dee75a3" +dependencies = [ + "serde", +] + +[[package]] +name = "serde_spanned" +version = "1.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6662b5879511e06e8999a8a235d848113e942c9124f211511b16466ee2995f26" +dependencies = [ + "serde_core", +] + +[[package]] +name = "serde_with" +version = "3.18.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dd5414fad8e6907dbdd5bc441a50ae8d6e26151a03b1de04d89a5576de61d01f" +dependencies = [ + "base64 0.22.1", + "chrono", + "hex", + "indexmap 1.9.3", + "indexmap 2.13.1", + "schemars 0.9.0", + "schemars 1.2.1", + "serde_core", + "serde_json", + "serde_with_macros", + "time", +] + +[[package]] +name = "serde_with_macros" +version = "3.18.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3db8978e608f1fe7357e211969fd9abdcae80bac1ba7a3369bb7eb6b404eb65" +dependencies = [ + "darling", + "proc-macro2", + "quote", + "syn 2.0.117", +] + +[[package]] +name = "serialize-to-javascript" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "04f3666a07a197cdb77cdf306c32be9b7f598d7060d50cfd4d5aa04bfd92f6c5" +dependencies = [ + "serde", + "serde_json", + "serialize-to-javascript-impl", +] + +[[package]] +name = "serialize-to-javascript-impl" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "772ee033c0916d670af7860b6e1ef7d658a4629a6d0b4c8c3e67f09b3765b75d" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.117", +] + +[[package]] +name = "servo_arc" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d52aa42f8fdf0fed91e5ce7f23d8138441002fa31dca008acf47e6fd4721f741" +dependencies = [ + "nodrop", + "stable_deref_trait", +] + +[[package]] +name = "servo_arc" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "170fb83ab34de17dc69aa7c67482b22218ddb85da56546f9bd6b929e32a05930" +dependencies = [ + "stable_deref_trait", +] + +[[package]] +name = "sha2" +version = "0.10.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a7507d819769d01a365ab707794a4084392c824f54a7a6a7862f8c3d0892b283" +dependencies = [ + "cfg-if", + "cpufeatures", + "digest", +] + +[[package]] +name = "shared_child" +version = "1.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e362d9935bc50f019969e2f9ecd66786612daae13e8f277be7bfb66e8bed3f7" +dependencies = [ + "libc", + "sigchld", + "windows-sys 0.60.2", +] + +[[package]] +name = "shlex" +version = "1.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64" + +[[package]] +name = "sigchld" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "47106eded3c154e70176fc83df9737335c94ce22f821c32d17ed1db1f83badb1" +dependencies = [ + "libc", + "os_pipe", + "signal-hook", +] + +[[package]] +name = "signal-hook" +version = "0.3.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d881a16cf4426aa584979d30bd82cb33429027e42122b169753d6ef1085ed6e2" +dependencies = [ + "libc", + "signal-hook-registry", +] + +[[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 = "simd-adler32" +version = "0.3.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "703d5c7ef118737c72f1af64ad2f6f8c5e1921f818cdcb97b8fe6fc69bf66214" + +[[package]] +name = "siphasher" +version = "0.3.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "38b58827f4464d87d377d175e90bf58eb00fd8716ff0a62f80356b5e61555d0d" + +[[package]] +name = "siphasher" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b2aa850e253778c88a04c3d7323b043aeda9d3e30d5971937c1855769763678e" + +[[package]] +name = "slab" +version = "0.4.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0c790de23124f9ab44544d7ac05d60440adc586479ce501c1d6d7da3cd8c9cf5" + +[[package]] +name = "smallvec" +version = "1.15.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "67b1b7a3b5fe4f1376887184045fcf45c69e92af734b7aaddc05fb777b6fbd03" + +[[package]] +name = "socket2" +version = "0.6.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3a766e1110788c36f4fa1c2b71b387a7815aa65f88ce0229841826633d93723e" +dependencies = [ + "libc", + "windows-sys 0.61.2", +] + +[[package]] +name = "softbuffer" +version = "0.4.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "aac18da81ebbf05109ab275b157c22a653bb3c12cf884450179942f81bcbf6c3" +dependencies = [ + "bytemuck", + "js-sys", + "ndk", + "objc2", + "objc2-core-foundation", + "objc2-core-graphics", + "objc2-foundation", + "objc2-quartz-core", + "raw-window-handle", + "redox_syscall", + "tracing", + "wasm-bindgen", + "web-sys", + "windows-sys 0.61.2", +] + +[[package]] +name = "soup3" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "471f924a40f31251afc77450e781cb26d55c0b650842efafc9c6cbd2f7cc4f9f" +dependencies = [ + "futures-channel", + "gio", + "glib", + "libc", + "soup3-sys", +] + +[[package]] +name = "soup3-sys" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7ebe8950a680a12f24f15ebe1bf70db7af98ad242d9db43596ad3108aab86c27" +dependencies = [ + "gio-sys", + "glib-sys", + "gobject-sys", + "libc", + "system-deps", +] + +[[package]] +name = "stable_deref_trait" +version = "1.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6ce2be8dc25455e1f91df71bfa12ad37d7af1092ae736f3a6cd0e37bc7810596" + +[[package]] +name = "string_cache" +version = "0.8.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bf776ba3fa74f83bf4b63c3dcbbf82173db2632ed8452cb2d891d33f459de70f" +dependencies = [ + "new_debug_unreachable", + "parking_lot", + "phf_shared 0.11.3", + "precomputed-hash", + "serde", +] + +[[package]] +name = "string_cache" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a18596f8c785a729f2819c0f6a7eae6ebeebdfffbfe4214ae6b087f690e31901" +dependencies = [ + "new_debug_unreachable", + "parking_lot", + "phf_shared 0.13.1", + "precomputed-hash", +] + +[[package]] +name = "string_cache_codegen" +version = "0.5.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c711928715f1fe0fe509c53b43e993a9a557babc2d0a3567d0a3006f1ac931a0" +dependencies = [ + "phf_generator 0.11.3", + "phf_shared 0.11.3", + "proc-macro2", + "quote", +] + +[[package]] +name = "string_cache_codegen" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "585635e46db231059f76c5849798146164652513eb9e8ab2685939dd90f29b69" +dependencies = [ + "phf_generator 0.13.1", + "phf_shared 0.13.1", + "proc-macro2", + "quote", +] + +[[package]] +name = "strsim" +version = "0.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f" + +[[package]] +name = "swift-rs" +version = "1.0.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4057c98e2e852d51fdcfca832aac7b571f6b351ad159f9eda5db1655f8d0c4d7" +dependencies = [ + "base64 0.21.7", + "serde", + "serde_json", +] + +[[package]] +name = "syn" +version = "1.0.109" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + +[[package]] +name = "syn" +version = "2.0.117" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e665b8803e7b1d2a727f4023456bbbbe74da67099c585258af0ad9c5013b9b99" +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.117", +] + +[[package]] +name = "system-deps" +version = "6.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a3e535eb8dded36d55ec13eddacd30dec501792ff23a0b1682c38601b8cf2349" +dependencies = [ + "cfg-expr", + "heck 0.5.0", + "pkg-config", + "toml 0.8.2", + "version-compare", +] + +[[package]] +name = "tao" +version = "0.34.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9103edf55f2da3c82aea4c7fab7c4241032bfeea0e71fa557d98e00e7ce7cc20" +dependencies = [ + "bitflags 2.11.0", + "block2", + "core-foundation", + "core-graphics", + "crossbeam-channel", + "dispatch2", + "dlopen2", + "dpi", + "gdkwayland-sys", + "gdkx11-sys", + "gtk", + "jni", + "libc", + "log", + "ndk", + "ndk-context", + "ndk-sys", + "objc2", + "objc2-app-kit", + "objc2-foundation", + "once_cell", + "parking_lot", + "raw-window-handle", + "tao-macros", + "unicode-segmentation", + "url", + "windows", + "windows-core 0.61.2", + "windows-version", + "x11-dl", +] + +[[package]] +name = "tao-macros" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f4e16beb8b2ac17db28eab8bca40e62dbfbb34c0fcdc6d9826b11b7b5d047dfd" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.117", +] + +[[package]] +name = "target-lexicon" +version = "0.12.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "61c41af27dd6d1e27b1b16b489db798443478cef1f06a660c96db617ba5de3b1" + +[[package]] +name = "tauri" +version = "2.10.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "da77cc00fb9028caf5b5d4650f75e31f1ef3693459dfca7f7e506d1ecef0ba2d" +dependencies = [ + "anyhow", + "bytes", + "cookie", + "dirs", + "dunce", + "embed_plist", + "getrandom 0.3.4", + "glob", + "gtk", + "heck 0.5.0", + "http", + "jni", + "libc", + "log", + "mime", + "muda", + "objc2", + "objc2-app-kit", + "objc2-foundation", + "objc2-ui-kit", + "objc2-web-kit", + "percent-encoding", + "plist", + "raw-window-handle", + "reqwest", + "serde", + "serde_json", + "serde_repr", + "serialize-to-javascript", + "swift-rs", + "tauri-build", + "tauri-macros", + "tauri-runtime", + "tauri-runtime-wry", + "tauri-utils", + "thiserror 2.0.18", + "tokio", + "tray-icon", + "url", + "webkit2gtk", + "webview2-com", + "window-vibrancy", + "windows", +] + +[[package]] +name = "tauri-build" +version = "2.5.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4bbc990d1dbf57a8e1c7fa2327f2a614d8b757805603c1b9ba5c81bade09fd4d" +dependencies = [ + "anyhow", + "cargo_toml", + "dirs", + "glob", + "heck 0.5.0", + "json-patch", + "schemars 0.8.22", + "semver", + "serde", + "serde_json", + "tauri-utils", + "tauri-winres", + "toml 0.9.12+spec-1.1.0", + "walkdir", +] + +[[package]] +name = "tauri-codegen" +version = "2.5.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d4a24476afd977c5d5d169f72425868613d82747916dd29e0a357c84c4bd6d29" +dependencies = [ + "base64 0.22.1", + "brotli", + "ico", + "json-patch", + "plist", + "png", + "proc-macro2", + "quote", + "semver", + "serde", + "serde_json", + "sha2", + "syn 2.0.117", + "tauri-utils", + "thiserror 2.0.18", + "time", + "url", + "uuid", + "walkdir", +] + +[[package]] +name = "tauri-macros" +version = "2.5.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d39b349a98dadaffebb73f0a40dcd1f23c999211e5a2e744403db384d0c33de7" +dependencies = [ + "heck 0.5.0", + "proc-macro2", + "quote", + "syn 2.0.117", + "tauri-codegen", + "tauri-utils", +] + +[[package]] +name = "tauri-plugin" +version = "2.5.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ddde7d51c907b940fb573006cdda9a642d6a7c8153657e88f8a5c3c9290cd4aa" +dependencies = [ + "anyhow", + "glob", + "plist", + "schemars 0.8.22", + "serde", + "serde_json", + "tauri-utils", + "toml 0.9.12+spec-1.1.0", + "walkdir", +] + +[[package]] +name = "tauri-plugin-dialog" +version = "2.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9204b425d9be8d12aa60c2a83a289cf7d1caae40f57f336ed1155b3a5c0e359b" +dependencies = [ + "log", + "raw-window-handle", + "rfd", + "serde", + "serde_json", + "tauri", + "tauri-plugin", + "tauri-plugin-fs", + "thiserror 2.0.18", + "url", +] + +[[package]] +name = "tauri-plugin-fs" +version = "2.4.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ed390cc669f937afeb8b28032ce837bac8ea023d975a2e207375ec05afaf1804" +dependencies = [ + "anyhow", + "dunce", + "glob", + "percent-encoding", + "schemars 0.8.22", + "serde", + "serde_json", + "serde_repr", + "tauri", + "tauri-plugin", + "tauri-utils", + "thiserror 2.0.18", + "toml 0.9.12+spec-1.1.0", + "url", +] + +[[package]] +name = "tauri-plugin-shell" +version = "2.3.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8457dbf9e2bab1edd8df22bb2c20857a59a9868e79cb3eac5ed639eec4d0c73b" +dependencies = [ + "encoding_rs", + "log", + "open", + "os_pipe", + "regex", + "schemars 0.8.22", + "serde", + "serde_json", + "shared_child", + "tauri", + "tauri-plugin", + "thiserror 2.0.18", + "tokio", +] + +[[package]] +name = "tauri-runtime" +version = "2.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2826d79a3297ed08cd6ea7f412644ef58e32969504bc4fbd8d7dbeabc4445ea2" +dependencies = [ + "cookie", + "dpi", + "gtk", + "http", + "jni", + "objc2", + "objc2-ui-kit", + "objc2-web-kit", + "raw-window-handle", + "serde", + "serde_json", + "tauri-utils", + "thiserror 2.0.18", + "url", + "webkit2gtk", + "webview2-com", + "windows", +] + +[[package]] +name = "tauri-runtime-wry" +version = "2.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e11ea2e6f801d275fdd890d6c9603736012742a1c33b96d0db788c9cdebf7f9e" +dependencies = [ + "gtk", + "http", + "jni", + "log", + "objc2", + "objc2-app-kit", + "once_cell", + "percent-encoding", + "raw-window-handle", + "softbuffer", + "tao", + "tauri-runtime", + "tauri-utils", + "url", + "webkit2gtk", + "webview2-com", + "windows", + "wry", +] + +[[package]] +name = "tauri-utils" +version = "2.8.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "219a1f983a2af3653f75b5747f76733b0da7ff03069c7a41901a5eb3ace4557d" +dependencies = [ + "anyhow", + "brotli", + "cargo_metadata", + "ctor", + "dunce", + "glob", + "html5ever 0.29.1", + "http", + "infer", + "json-patch", + "kuchikiki", + "log", + "memchr", + "phf 0.11.3", + "proc-macro2", + "quote", + "regex", + "schemars 0.8.22", + "semver", + "serde", + "serde-untagged", + "serde_json", + "serde_with", + "swift-rs", + "thiserror 2.0.18", + "toml 0.9.12+spec-1.1.0", + "url", + "urlpattern", + "uuid", + "walkdir", +] + +[[package]] +name = "tauri-winres" +version = "0.3.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1087b111fe2b005e42dbdc1990fc18593234238d47453b0c99b7de1c9ab2c1e0" +dependencies = [ + "dunce", + "embed-resource", + "toml 0.9.12+spec-1.1.0", +] + +[[package]] +name = "tendril" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d24a120c5fc464a3458240ee02c299ebcb9d67b5249c8848b09d639dca8d7bb0" +dependencies = [ + "futf", + "mac", + "utf-8", +] + +[[package]] +name = "tendril" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c4790fc369d5a530f4b544b094e31388b9b3a37c0f4652ade4505945f5660d24" +dependencies = [ + "new_debug_unreachable", + "utf-8", +] + +[[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.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4288b5bcbc7920c07a1149a35cf9590a2aa808e0bc1eafaade0b80947865fbc4" +dependencies = [ + "thiserror-impl 2.0.18", +] + +[[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.117", +] + +[[package]] +name = "thiserror-impl" +version = "2.0.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ebc4ee7f67670e9b64d05fa4253e753e016c6c95ff35b89b7941d6b856dec1d5" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.117", +] + +[[package]] +name = "time" +version = "0.3.47" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "743bd48c283afc0388f9b8827b976905fb217ad9e647fae3a379a9283c4def2c" +dependencies = [ + "deranged", + "itoa", + "num-conv", + "powerfmt", + "serde_core", + "time-core", + "time-macros", +] + +[[package]] +name = "time-core" +version = "0.1.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7694e1cfe791f8d31026952abf09c69ca6f6fa4e1a1229e18988f06a04a12dca" + +[[package]] +name = "time-macros" +version = "0.2.27" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2e70e4c5a0e0a8a4823ad65dfe1a6930e4f4d756dcd9dd7939022b5e8c501215" +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 = "tokio" +version = "1.50.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "27ad5e34374e03cfffefc301becb44e9dc3c17584f414349ebe29ed26661822d" +dependencies = [ + "bytes", + "libc", + "mio", + "pin-project-lite", + "socket2", + "windows-sys 0.61.2", +] + +[[package]] +name = "tokio-util" +version = "0.7.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9ae9cec805b01e8fc3fd2fe289f89149a9b66dd16786abd8b19cfa7b48cb0098" +dependencies = [ + "bytes", + "futures-core", + "futures-sink", + "pin-project-lite", + "tokio", +] + +[[package]] +name = "toml" +version = "0.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "185d8ab0dfbb35cf1399a6344d8484209c088f75f8f68230da55d48d95d43e3d" +dependencies = [ + "serde", + "serde_spanned 0.6.9", + "toml_datetime 0.6.3", + "toml_edit 0.20.2", +] + +[[package]] +name = "toml" +version = "0.9.12+spec-1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cf92845e79fc2e2def6a5d828f0801e29a2f8acc037becc5ab08595c7d5e9863" +dependencies = [ + "indexmap 2.13.1", + "serde_core", + "serde_spanned 1.1.1", + "toml_datetime 0.7.5+spec-1.1.0", + "toml_parser", + "toml_writer", + "winnow 0.7.15", +] + +[[package]] +name = "toml_datetime" +version = "0.6.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7cda73e2f1397b1262d6dfdcef8aafae14d1de7748d66822d3bfeeb6d03e5e4b" +dependencies = [ + "serde", +] + +[[package]] +name = "toml_datetime" +version = "0.7.5+spec-1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "92e1cfed4a3038bc5a127e35a2d360f145e1f4b971b551a2ba5fd7aedf7e1347" +dependencies = [ + "serde_core", +] + +[[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.19.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1b5bb770da30e5cbfde35a2d7b9b8a2c4b8ef89548a7a6aeab5c9a576e3e7421" +dependencies = [ + "indexmap 2.13.1", + "toml_datetime 0.6.3", + "winnow 0.5.40", +] + +[[package]] +name = "toml_edit" +version = "0.20.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "396e4d48bbb2b7554c944bde63101b5ae446cff6ec4a24227428f15eb72ef338" +dependencies = [ + "indexmap 2.13.1", + "serde", + "serde_spanned 0.6.9", + "toml_datetime 0.6.3", + "winnow 0.5.40", +] + +[[package]] +name = "toml_edit" +version = "0.25.10+spec-1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a82418ca169e235e6c399a84e395ab6debeb3bc90edc959bf0f48647c6a32d1b" +dependencies = [ + "indexmap 2.13.1", + "toml_datetime 1.1.1+spec-1.1.0", + "toml_parser", + "winnow 1.0.1", +] + +[[package]] +name = "toml_parser" +version = "1.1.2+spec-1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a2abe9b86193656635d2411dc43050282ca48aa31c2451210f4202550afb7526" +dependencies = [ + "winnow 1.0.1", +] + +[[package]] +name = "toml_writer" +version = "1.1.1+spec-1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "756daf9b1013ebe47a8776667b466417e2d4c5679d441c26230efd9ef78692db" + +[[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.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d4e6559d53cc268e5031cd8429d05415bc4cb4aefc4aa5d6cc35fbf5b924a1f8" +dependencies = [ + "bitflags 2.11.0", + "bytes", + "futures-util", + "http", + "http-body", + "iri-string", + "pin-project-lite", + "tower", + "tower-layer", + "tower-service", +] + +[[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 = [ + "pin-project-lite", + "tracing-core", +] + +[[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 = "tray-icon" +version = "0.21.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a5e85aa143ceb072062fc4d6356c1b520a51d636e7bc8e77ec94be3608e5e80c" +dependencies = [ + "crossbeam-channel", + "dirs", + "libappindicator", + "muda", + "objc2", + "objc2-app-kit", + "objc2-core-foundation", + "objc2-core-graphics", + "objc2-foundation", + "once_cell", + "png", + "serde", + "thiserror 2.0.18", + "windows-sys 0.60.2", +] + +[[package]] +name = "try-lock" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e421abadd41a4225275504ea4d6566923418b7f05506fbc9c0fe86ba7396114b" + +[[package]] +name = "typeid" +version = "1.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bc7d623258602320d5c55d1bc22793b57daff0ec7efc270ea7d55ce1d5f5471c" + +[[package]] +name = "typenum" +version = "1.19.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "562d481066bde0658276a35467c4af00bdc6ee726305698a55b86e61d7ad82bb" + +[[package]] +name = "unic-char-property" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a8c57a407d9b6fa02b4795eb81c5b6652060a15a7903ea981f3d723e6c0be221" +dependencies = [ + "unic-char-range", +] + +[[package]] +name = "unic-char-range" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0398022d5f700414f6b899e10b8348231abf9173fa93144cbc1a43b9793c1fbc" + +[[package]] +name = "unic-common" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "80d7ff825a6a654ee85a63e80f92f054f904f21e7d12da4e22f9834a4aaa35bc" + +[[package]] +name = "unic-ucd-ident" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e230a37c0381caa9219d67cf063aa3a375ffed5bf541a452db16e744bdab6987" +dependencies = [ + "unic-char-property", + "unic-char-range", + "unic-ucd-version", +] + +[[package]] +name = "unic-ucd-version" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "96bd2f2237fe450fcd0a1d2f5f4e91711124f7857ba2e964247776ebeeb7b0c4" +dependencies = [ + "unic-common", +] + +[[package]] +name = "unicode-ident" +version = "1.0.24" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e6e4313cd5fcd3dad5cafa179702e2b244f760991f45397d14d4ebf38247da75" + +[[package]] +name = "unicode-segmentation" +version = "1.13.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9629274872b2bfaf8d66f5f15725007f635594914870f65218920345aa11aa8c" + +[[package]] +name = "unicode-xid" +version = "0.2.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ebc1c04c71510c7f702b52b7c350734c9ff1295c464a03335b00bb84fc54f853" + +[[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 = "urlpattern" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "70acd30e3aa1450bc2eece896ce2ad0d178e9c079493819301573dae3c37ba6d" +dependencies = [ + "regex", + "serde", + "unic-ucd-ident", + "url", +] + +[[package]] +name = "utf-8" +version = "0.7.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "09cc8ee72d2a9becf2f2febe0205bbed8fc6615b7cb429ad062dc7b7ddd036a9" + +[[package]] +name = "utf8_iter" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6c140620e7ffbb22c2dee59cafe6084a59b5ffc27a8859a5f0d494b5d52b6be" + +[[package]] +name = "uuid" +version = "1.23.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5ac8b6f42ead25368cf5b098aeb3dc8a1a2c05a3eee8a9a1a68c640edbfc79d9" +dependencies = [ + "getrandom 0.4.2", + "js-sys", + "serde_core", + "wasm-bindgen", +] + +[[package]] +name = "version-compare" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "03c2856837ef78f57382f06b2b8563a2f512f7185d732608fd9176cb3b8edf0e" + +[[package]] +name = "version_check" +version = "0.9.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b928f33d975fc6ad9f86c8f283853ad26bdd5b10b7f1542aa2fa15e2289105a" + +[[package]] +name = "vswhom" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "be979b7f07507105799e854203b470ff7c78a1639e330a58f183b5fea574608b" +dependencies = [ + "libc", + "vswhom-sys", +] + +[[package]] +name = "vswhom-sys" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fb067e4cbd1ff067d1df46c9194b5de0e98efd2810bbc95c5d5e5f25a3231150" +dependencies = [ + "cc", + "libc", +] + +[[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.9.0+wasi-snapshot-preview1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cccddf32554fecc6acb585f82a32a72e28b48f8c4c1883ddfeeeaa96f7d8e519" + +[[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.2+wasi-0.2.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9517f9239f02c069db75e65f174b3da828fe5f5b945c4dd26bd25d89c03ebcf5" +dependencies = [ + "wit-bindgen", +] + +[[package]] +name = "wasip3" +version = "0.4.0+wasi-0.3.0-rc-2026-01-06" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5428f8bf88ea5ddc08faddef2ac4a67e390b88186c703ce6dbd955e1c145aca5" +dependencies = [ + "wit-bindgen", +] + +[[package]] +name = "wasm-bindgen" +version = "0.2.117" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0551fc1bb415591e3372d0bc4780db7e587d84e2a7e79da121051c5c4b89d0b0" +dependencies = [ + "cfg-if", + "once_cell", + "rustversion", + "wasm-bindgen-macro", + "wasm-bindgen-shared", +] + +[[package]] +name = "wasm-bindgen-futures" +version = "0.4.67" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "03623de6905b7206edd0a75f69f747f134b7f0a2323392d664448bf2d3c5d87e" +dependencies = [ + "js-sys", + "wasm-bindgen", +] + +[[package]] +name = "wasm-bindgen-macro" +version = "0.2.117" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7fbdf9a35adf44786aecd5ff89b4563a90325f9da0923236f6104e603c7e86be" +dependencies = [ + "quote", + "wasm-bindgen-macro-support", +] + +[[package]] +name = "wasm-bindgen-macro-support" +version = "0.2.117" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dca9693ef2bab6d4e6707234500350d8dad079eb508dca05530c85dc3a529ff2" +dependencies = [ + "bumpalo", + "proc-macro2", + "quote", + "syn 2.0.117", + "wasm-bindgen-shared", +] + +[[package]] +name = "wasm-bindgen-shared" +version = "0.2.117" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "39129a682a6d2d841b6c429d0c51e5cb0ed1a03829d8b3d1e69a011e62cb3d3b" +dependencies = [ + "unicode-ident", +] + +[[package]] +name = "wasm-encoder" +version = "0.244.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "990065f2fe63003fe337b932cfb5e3b80e0b4d0f5ff650e6985b1048f62c8319" +dependencies = [ + "leb128fmt", + "wasmparser", +] + +[[package]] +name = "wasm-metadata" +version = "0.244.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bb0e353e6a2fbdc176932bbaab493762eb1255a7900fe0fea1a2f96c296cc909" +dependencies = [ + "anyhow", + "indexmap 2.13.1", + "wasm-encoder", + "wasmparser", +] + +[[package]] +name = "wasm-streams" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9d1ec4f6517c9e11ae630e200b2b65d193279042e28edd4a2cda233e46670bbb" +dependencies = [ + "futures-util", + "js-sys", + "wasm-bindgen", + "wasm-bindgen-futures", + "web-sys", +] + +[[package]] +name = "wasmparser" +version = "0.244.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "47b807c72e1bac69382b3a6fb3dbe8ea4c0ed87ff5629b8685ae6b9a611028fe" +dependencies = [ + "bitflags 2.11.0", + "hashbrown 0.15.5", + "indexmap 2.13.1", + "semver", +] + +[[package]] +name = "web-sys" +version = "0.3.94" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cd70027e39b12f0849461e08ffc50b9cd7688d942c1c8e3c7b22273236b4dd0a" +dependencies = [ + "js-sys", + "wasm-bindgen", +] + +[[package]] +name = "web_atoms" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "57a9779e9f04d2ac1ce317aee707aa2f6b773afba7b931222bff6983843b1576" +dependencies = [ + "phf 0.13.1", + "phf_codegen 0.13.1", + "string_cache 0.9.0", + "string_cache_codegen 0.6.1", +] + +[[package]] +name = "webkit2gtk" +version = "2.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a1027150013530fb2eaf806408df88461ae4815a45c541c8975e61d6f2fc4793" +dependencies = [ + "bitflags 1.3.2", + "cairo-rs", + "gdk", + "gdk-sys", + "gio", + "gio-sys", + "glib", + "glib-sys", + "gobject-sys", + "gtk", + "gtk-sys", + "javascriptcore-rs", + "libc", + "once_cell", + "soup3", + "webkit2gtk-sys", +] + +[[package]] +name = "webkit2gtk-sys" +version = "2.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "916a5f65c2ef0dfe12fff695960a2ec3d4565359fdbb2e9943c974e06c734ea5" +dependencies = [ + "bitflags 1.3.2", + "cairo-sys-rs", + "gdk-sys", + "gio-sys", + "glib-sys", + "gobject-sys", + "gtk-sys", + "javascriptcore-rs-sys", + "libc", + "pkg-config", + "soup3-sys", + "system-deps", +] + +[[package]] +name = "webview2-com" +version = "0.38.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7130243a7a5b33c54a444e54842e6a9e133de08b5ad7b5861cd8ed9a6a5bc96a" +dependencies = [ + "webview2-com-macros", + "webview2-com-sys", + "windows", + "windows-core 0.61.2", + "windows-implement", + "windows-interface", +] + +[[package]] +name = "webview2-com-macros" +version = "0.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "67a921c1b6914c367b2b823cd4cde6f96beec77d30a939c8199bb377cf9b9b54" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.117", +] + +[[package]] +name = "webview2-com-sys" +version = "0.38.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "381336cfffd772377d291702245447a5251a2ffa5bad679c99e61bc48bacbf9c" +dependencies = [ + "thiserror 2.0.18", + "windows", + "windows-core 0.61.2", +] + +[[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 = "window-vibrancy" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d9bec5a31f3f9362f2258fd0e9c9dd61a9ca432e7306cc78c444258f0dce9a9c" +dependencies = [ + "objc2", + "objc2-app-kit", + "objc2-core-foundation", + "objc2-foundation", + "raw-window-handle", + "windows-sys 0.59.0", + "windows-version", +] + +[[package]] +name = "windows" +version = "0.61.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9babd3a767a4c1aef6900409f85f5d53ce2544ccdfaa86dad48c91782c6d6893" +dependencies = [ + "windows-collections", + "windows-core 0.61.2", + "windows-future", + "windows-link 0.1.3", + "windows-numerics", +] + +[[package]] +name = "windows-collections" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3beeceb5e5cfd9eb1d76b381630e82c4241ccd0d27f1a39ed41b2760b255c5e8" +dependencies = [ + "windows-core 0.61.2", +] + +[[package]] +name = "windows-core" +version = "0.61.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c0fdd3ddb90610c7638aa2b3a3ab2904fb9e5cdbecc643ddb3647212781c4ae3" +dependencies = [ + "windows-implement", + "windows-interface", + "windows-link 0.1.3", + "windows-result 0.3.4", + "windows-strings 0.4.2", +] + +[[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 0.2.1", + "windows-result 0.4.1", + "windows-strings 0.5.1", +] + +[[package]] +name = "windows-future" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fc6a41e98427b19fe4b73c550f060b59fa592d7d686537eebf9385621bfbad8e" +dependencies = [ + "windows-core 0.61.2", + "windows-link 0.1.3", + "windows-threading", +] + +[[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.117", +] + +[[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.117", +] + +[[package]] +name = "windows-link" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5e6ad25900d524eaabdbbb96d20b4311e1e7ae1699af4fb28c17ae66c80d798a" + +[[package]] +name = "windows-link" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f0805222e57f7521d6a62e36fa9163bc891acd422f971defe97d64e70d0a4fe5" + +[[package]] +name = "windows-numerics" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9150af68066c4c5c07ddc0ce30421554771e528bde427614c61038bc2c92c2b1" +dependencies = [ + "windows-core 0.61.2", + "windows-link 0.1.3", +] + +[[package]] +name = "windows-result" +version = "0.3.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "56f42bd332cc6c8eac5af113fc0c1fd6a8fd2aa08a0119358686e5160d0586c6" +dependencies = [ + "windows-link 0.1.3", +] + +[[package]] +name = "windows-result" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7781fa89eaf60850ac3d2da7af8e5242a5ea78d1a11c49bf2910bb5a73853eb5" +dependencies = [ + "windows-link 0.2.1", +] + +[[package]] +name = "windows-strings" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "56e6c93f3a0c3b36176cb1327a4958a0353d5d166c2a35cb268ace15e91d3b57" +dependencies = [ + "windows-link 0.1.3", +] + +[[package]] +name = "windows-strings" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7837d08f69c77cf6b07689544538e017c1bfcf57e34b4c0ff58e6c2cd3b37091" +dependencies = [ + "windows-link 0.2.1", +] + +[[package]] +name = "windows-sys" +version = "0.45.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "75283be5efb2831d37ea142365f009c02ec203cd29a3ebecbc093d52315b66d0" +dependencies = [ + "windows-targets 0.42.2", +] + +[[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 0.2.1", +] + +[[package]] +name = "windows-targets" +version = "0.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e5180c00cd44c9b1c88adb3693291f1cd93605ded80c250a75d472756b4d071" +dependencies = [ + "windows_aarch64_gnullvm 0.42.2", + "windows_aarch64_msvc 0.42.2", + "windows_i686_gnu 0.42.2", + "windows_i686_msvc 0.42.2", + "windows_x86_64_gnu 0.42.2", + "windows_x86_64_gnullvm 0.42.2", + "windows_x86_64_msvc 0.42.2", +] + +[[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 0.2.1", + "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-threading" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b66463ad2e0ea3bbf808b7f1d371311c80e115c0b71d60efc142cafbcfb057a6" +dependencies = [ + "windows-link 0.1.3", +] + +[[package]] +name = "windows-version" +version = "0.1.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e4060a1da109b9d0326b7262c8e12c84df67cc0dbc9e33cf49e01ccc2eb63631" +dependencies = [ + "windows-link 0.2.1", +] + +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "597a5118570b68bc08d8d59125332c54f1ba9d9adeedeef5b99b02ba2b0698f8" + +[[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.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e08e8864a60f06ef0d0ff4ba04124db8b0fb3be5776a5cd47641e942e58c4d43" + +[[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.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c61d927d8da41da96a81f029489353e68739737d3beca43145c8afec9a31a84f" + +[[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.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "44d840b6ec649f480a41c8d80f9c65108b92d89345dd94027bfe06ac444d1060" + +[[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.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8de912b8b8feb55c064867cf047dda097f92d51efad5b491dfb98f6bbb70cb36" + +[[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.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "26d41b46a36d453748aedef1486d5c7a85db22e56aff34643984ea85514e94a3" + +[[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.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9aec5da331524158c6d1a4ac0ab1541149c0b9505fde06423b02f5ef0106b9f0" + +[[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 = "winnow" +version = "0.5.40" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f593a95398737aeed53e489c785df13f3618e41dbcd6718c6addbf1395aa6876" +dependencies = [ + "memchr", +] + +[[package]] +name = "winnow" +version = "0.7.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "df79d97927682d2fd8adb29682d1140b343be4ac0f08fd68b7765d9c059d3945" + +[[package]] +name = "winnow" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "09dac053f1cd375980747450bfc7250c264eaae0583872e845c0c7cd578872b5" +dependencies = [ + "memchr", +] + +[[package]] +name = "winreg" +version = "0.55.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cb5a765337c50e9ec252c2069be9bf91c7df47afb103b642ba3a53bf8101be97" +dependencies = [ + "cfg-if", + "windows-sys 0.59.0", +] + +[[package]] +name = "wit-bindgen" +version = "0.51.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d7249219f66ced02969388cf2bb044a09756a083d0fab1e566056b04d9fbcaa5" +dependencies = [ + "wit-bindgen-rust-macro", +] + +[[package]] +name = "wit-bindgen-core" +version = "0.51.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ea61de684c3ea68cb082b7a88508a8b27fcc8b797d738bfc99a82facf1d752dc" +dependencies = [ + "anyhow", + "heck 0.5.0", + "wit-parser", +] + +[[package]] +name = "wit-bindgen-rust" +version = "0.51.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b7c566e0f4b284dd6561c786d9cb0142da491f46a9fbed79ea69cdad5db17f21" +dependencies = [ + "anyhow", + "heck 0.5.0", + "indexmap 2.13.1", + "prettyplease", + "syn 2.0.117", + "wasm-metadata", + "wit-bindgen-core", + "wit-component", +] + +[[package]] +name = "wit-bindgen-rust-macro" +version = "0.51.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0c0f9bfd77e6a48eccf51359e3ae77140a7f50b1e2ebfe62422d8afdaffab17a" +dependencies = [ + "anyhow", + "prettyplease", + "proc-macro2", + "quote", + "syn 2.0.117", + "wit-bindgen-core", + "wit-bindgen-rust", +] + +[[package]] +name = "wit-component" +version = "0.244.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9d66ea20e9553b30172b5e831994e35fbde2d165325bec84fc43dbf6f4eb9cb2" +dependencies = [ + "anyhow", + "bitflags 2.11.0", + "indexmap 2.13.1", + "log", + "serde", + "serde_derive", + "serde_json", + "wasm-encoder", + "wasm-metadata", + "wasmparser", + "wit-parser", +] + +[[package]] +name = "wit-parser" +version = "0.244.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ecc8ac4bc1dc3381b7f59c34f00b67e18f910c2c0f50015669dde7def656a736" +dependencies = [ + "anyhow", + "id-arena", + "indexmap 2.13.1", + "log", + "semver", + "serde", + "serde_derive", + "serde_json", + "unicode-xid", + "wasmparser", +] + +[[package]] +name = "writeable" +version = "0.6.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1ffae5123b2d3fc086436f8834ae3ab053a283cfac8fe0a0b8eaae044768a4c4" + +[[package]] +name = "wry" +version = "0.54.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e5a8135d8676225e5744de000d4dff5a082501bf7db6a1c1495034f8c314edbc" +dependencies = [ + "base64 0.22.1", + "block2", + "cookie", + "crossbeam-channel", + "dirs", + "dom_query", + "dpi", + "dunce", + "gdkx11", + "gtk", + "http", + "javascriptcore-rs", + "jni", + "libc", + "ndk", + "objc2", + "objc2-app-kit", + "objc2-core-foundation", + "objc2-foundation", + "objc2-ui-kit", + "objc2-web-kit", + "once_cell", + "percent-encoding", + "raw-window-handle", + "sha2", + "soup3", + "tao-macros", + "thiserror 2.0.18", + "url", + "webkit2gtk", + "webkit2gtk-sys", + "webview2-com", + "windows", + "windows-core 0.61.2", + "windows-version", + "x11-dl", +] + +[[package]] +name = "x11" +version = "2.21.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "502da5464ccd04011667b11c435cb992822c2c0dbde1770c988480d312a0db2e" +dependencies = [ + "libc", + "pkg-config", +] + +[[package]] +name = "x11-dl" +version = "2.21.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "38735924fedd5314a6e548792904ed8c6de6636285cb9fec04d5b1db85c1516f" +dependencies = [ + "libc", + "once_cell", + "pkg-config", +] + +[[package]] +name = "yoke" +version = "0.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "abe8c5fda708d9ca3df187cae8bfb9ceda00dd96231bed36e445a1a48e66f9ca" +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.117", + "synstructure", +] + +[[package]] +name = "zerocopy" +version = "0.8.48" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eed437bf9d6692032087e337407a86f04cd8d6a16a37199ed57949d415bd68e9" +dependencies = [ + "zerocopy-derive", +] + +[[package]] +name = "zerocopy-derive" +version = "0.8.48" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "70e3cd084b1788766f53af483dd21f93881ff30d7320490ec3ef7526d203bad4" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.117", +] + +[[package]] +name = "zerofrom" +version = "0.1.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "69faa1f2a1ea75661980b013019ed6687ed0e83d069bc1114e2cc74c6c04c4df" +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.117", + "synstructure", +] + +[[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.117", +] + +[[package]] +name = "zmij" +version = "1.0.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b8848ee67ecc8aedbaf3e4122217aff892639231befc6a1b58d29fff4c2cabaa" diff --git a/src-tauri/Cargo.toml b/src-tauri/Cargo.toml index 7f381be..1433353 100644 --- a/src-tauri/Cargo.toml +++ b/src-tauri/Cargo.toml @@ -1,3 +1,6 @@ +[workspace] +members = ["crates/kopdeltav"] + [package] name = "kspdeltavformods" version = "0.1.0" @@ -7,6 +10,7 @@ edition = "2021" tauri-build = { version = "2", features = [] } [dependencies] +kopdeltav = { path = "crates/kopdeltav" } tauri = { version = "2", features = [] } tauri-plugin-shell = "2" tauri-plugin-dialog = "2" diff --git a/src-tauri/crates/kopdeltav/Cargo.toml b/src-tauri/crates/kopdeltav/Cargo.toml new file mode 100644 index 0000000..7f14a8f --- /dev/null +++ b/src-tauri/crates/kopdeltav/Cargo.toml @@ -0,0 +1,7 @@ +[package] +name = "kopdeltav" +version = "0.1.0" +edition = "2021" + +[dependencies] +serde = { version = "1", features = ["derive"] } diff --git a/src-tauri/crates/kopdeltav/src/lib.rs b/src-tauri/crates/kopdeltav/src/lib.rs new file mode 100644 index 0000000..c446ac8 --- /dev/null +++ b/src-tauri/crates/kopdeltav/src/lib.rs @@ -0,0 +1 @@ +pub mod models; diff --git a/src-tauri/crates/kopdeltav/src/models.rs b/src-tauri/crates/kopdeltav/src/models.rs new file mode 100644 index 0000000..ae7b93d --- /dev/null +++ b/src-tauri/crates/kopdeltav/src/models.rs @@ -0,0 +1,404 @@ +//! Core domain models for KSP celestial body physics. +//! +//! Provides data structures for celestial bodies, atmospheres, orbital elements, +//! and animation curve interpolation (Cubic Hermite Spline) compatible with +//! KSP's AnimationCurve format. + +use serde::Serialize; + +// --------------------------------------------------------------------------- +// Constants +// --------------------------------------------------------------------------- + +/// Standard gravitational acceleration at sea level [m/s^2]. +pub const G0: f64 = 9.80665; + +/// Universal gas constant [J/(mol*K)]. +pub const R_GAS: f64 = 8.314_462_618; + +// --------------------------------------------------------------------------- +// Functions +// --------------------------------------------------------------------------- + +/// Compute the standard gravitational parameter (mu) for a celestial body. +/// +/// mu = gee_asl * G0 * radius^2 +/// +/// # Arguments +/// * `gee_asl` - Surface gravity in multiples of g0. +/// * `radius` - Equatorial radius [m]. +/// +/// # Returns +/// Gravitational parameter mu [m^3/s^2]. +pub fn compute_mu(gee_asl: f64, radius: f64) -> f64 { + gee_asl * G0 * radius * radius +} + +// --------------------------------------------------------------------------- +// Structs +// --------------------------------------------------------------------------- + +/// A single keyframe in a KSP AnimationCurve. +/// +/// KSPのAnimationCurveキーフレーム。 +#[derive(Debug, Clone, Serialize)] +pub struct CurveKey { + /// Curve position (x-axis value, e.g. altitude). + pub position: f64, + /// Curve value at this position (y-axis value). + pub value: f64, + /// Incoming tangent (slope on the left side of the key). + pub in_tangent: f64, + /// Outgoing tangent (slope on the right side of the key). + pub out_tangent: f64, +} + +/// Atmospheric model for a celestial body. +/// +/// 天体の大気モデル。 +#[derive(Debug, Clone, Serialize)] +pub struct Atmosphere { + /// Height of the atmosphere above the surface [m]. + pub atmosphere_depth: f64, + /// Pressure curve keyframes (altitude -> pressure in kPa). + pub pressure_curve: Vec, + /// Temperature curve keyframes (altitude -> temperature in K). + pub temperature_curve: Vec, + /// Molar mass of the atmosphere [kg/mol]. + pub molar_mass: f64, + /// Adiabatic index (ratio of specific heats, Cp/Cv). + pub adiabatic_index: f64, + /// Sea-level pressure [kPa]. + pub pressure_at_sea_level: f64, + /// Sea-level temperature [K]. + pub temperature_at_sea_level: f64, +} + +/// Keplerian orbital elements for a celestial body. +/// +/// 天体のケプラー軌道要素。 +#[derive(Debug, Clone, Serialize)] +pub struct OrbitalElements { + /// Semi-major axis [m]. + pub semi_major_axis: f64, + /// Orbital eccentricity (0 = circular, <1 = elliptical). + pub eccentricity: f64, + /// Orbital inclination [degrees]. + pub inclination: f64, + /// Argument of periapsis [degrees]. + pub argument_of_periapsis: f64, + /// Longitude of ascending node [degrees]. + pub longitude_of_ascending_node: f64, + /// Mean anomaly at epoch [radians]. + pub mean_anomaly_at_epoch: f64, + /// Reference epoch [s]. + pub epoch: f64, +} + +/// A celestial body in the KSP system with physical and orbital properties. +/// +/// KSPの天体(物理・軌道パラメータ付き)。 +/// +/// Not `Serialize` because parent/children references form a graph +/// that is resolved externally by name. +#[derive(Debug, Clone)] +pub struct CelestialBody { + /// Internal name (e.g. "Kerbin"). + pub name: String, + /// Equatorial radius [m]. + pub radius: f64, + /// Surface gravity in multiples of g0. + pub gee_asl: f64, + /// Whether the body has an ocean. + pub has_ocean: bool, + /// Atmospheric model, if present. + pub atmosphere: Option, + /// Orbital elements, if the body orbits another body. + pub orbit: Option, + /// Sidereal rotational period [s]. + pub rotational_period: f64, + /// Display name (may differ from internal name). + pub display_name: String, + /// Sphere of influence radius [m]. + pub soi: f64, + /// Whether this is the home world (e.g. Kerbin). + pub is_home_world: bool, + /// Name of the parent body this body orbits. + pub reference_body_name: String, + /// Standard gravitational parameter mu [m^3/s^2] (auto-computed). + pub mu: f64, + /// Parent body name for tree construction. + pub parent_name: Option, + /// Child body names for tree construction. + pub children_names: Vec, +} + +impl CelestialBody { + /// Create a new celestial body with auto-computed mu. + /// + /// 天体を生成し、muを自動計算する。 + /// + /// # Arguments + /// * `name` - Internal name. + /// * `radius` - Equatorial radius [m]. + /// * `gee_asl` - Surface gravity in multiples of g0. + /// * `has_ocean` - Whether the body has an ocean. + /// * `atmosphere` - Atmospheric model, if any. + /// * `orbit` - Orbital elements, if any. + /// * `rotational_period` - Sidereal rotational period [s]. + /// * `display_name` - Display name for UI. + #[allow(clippy::too_many_arguments)] + pub fn new( + name: String, + radius: f64, + gee_asl: f64, + has_ocean: bool, + atmosphere: Option, + orbit: Option, + rotational_period: f64, + display_name: String, + ) -> Self { + let mu = compute_mu(gee_asl, radius); + Self { + name, + radius, + gee_asl, + has_ocean, + atmosphere, + orbit, + rotational_period, + display_name, + soi: 0.0, + is_home_world: false, + reference_body_name: String::new(), + mu, + parent_name: None, + children_names: Vec::new(), + } + } + + /// Returns true if the body has an atmosphere. + /// + /// 大気を持つかどうかを返す。 + pub fn has_atmosphere(&self) -> bool { + self.atmosphere.is_some() + } +} + +// --------------------------------------------------------------------------- +// Hermite interpolation +// --------------------------------------------------------------------------- + +/// Evaluate a Cubic Hermite Spline at position `x`, compatible with KSP AnimationCurve. +/// +/// KSP AnimationCurve互換のCubic Hermite Spline補間。 +/// +/// Values outside the curve range are clamped to the nearest endpoint value. +/// +/// # Arguments +/// * `keys` - Sorted keyframes defining the curve. +/// * `x` - Position to evaluate at. +/// +/// # Returns +/// Interpolated value, or an error if `keys` is empty. +/// +/// # Errors +/// Returns `Err` if the keys slice is empty. +pub fn hermite_interp(keys: &[CurveKey], x: f64) -> Result { + if keys.is_empty() { + return Err("Cannot interpolate with empty keys list".to_string()); + } + if keys.len() == 1 { + return Ok(keys[0].value); + } + if x <= keys[0].position { + return Ok(keys[0].value); + } + if x >= keys[keys.len() - 1].position { + return Ok(keys[keys.len() - 1].value); + } + + // Find the segment containing x + let mut i = 0; + for (j, key) in keys.iter().enumerate().skip(1) { + if key.position >= x { + i = j - 1; + break; + } + } + + let k0 = &keys[i]; + let k1 = &keys[i + 1]; + let dx = k1.position - k0.position; + let t = (x - k0.position) / dx; + + let t2 = t * t; + let t3 = t2 * t; + let h00 = 2.0 * t3 - 3.0 * t2 + 1.0; + let h10 = t3 - 2.0 * t2 + t; + let h01 = -2.0 * t3 + 3.0 * t2; + let h11 = t3 - t2; + + Ok(h00 * k0.value + h10 * dx * k0.out_tangent + h01 * k1.value + h11 * dx * k1.in_tangent) +} + +// --------------------------------------------------------------------------- +// Tests +// --------------------------------------------------------------------------- + +#[cfg(test)] +mod tests { + use super::*; + + // Constants + #[test] + fn test_g0_constant() { + assert!((G0 - 9.80665).abs() < 1e-10); + } + + // compute_mu + #[test] + fn test_compute_mu_sanctar() { + let mu = compute_mu(1.1, 670_000.0); + let expected = 4.8424e12; + assert!((mu - expected).abs() / expected < 0.001); + } + + #[test] + fn test_compute_mu_kerbin() { + let mu = compute_mu(1.0, 600_000.0); + let expected = 3.5316e12; + assert!((mu - expected).abs() / expected < 0.001); + } + + // CurveKey + #[test] + fn test_curve_key_creation() { + let key = CurveKey { + position: 0.0, + value: 110.444, + in_tangent: 0.0, + out_tangent: -0.01793, + }; + assert!((key.value - 110.444).abs() < 1e-6); + } + + // Hermite interpolation + #[test] + fn test_hermite_interp_at_key_position() { + let keys = vec![ + CurveKey { + position: 0.0, + value: 110.444, + in_tangent: 0.0, + out_tangent: -0.01793, + }, + CurveKey { + position: 3547.0, + value: 62.1074, + in_tangent: -0.01093, + out_tangent: -0.01093, + }, + ]; + let result = hermite_interp(&keys, 0.0).unwrap(); + assert!((result - 110.444).abs() < 1e-6); + } + + #[test] + fn test_hermite_interp_midpoint() { + let keys = vec![ + CurveKey { + position: 0.0, + value: 110.444, + in_tangent: 0.0, + out_tangent: -0.01793, + }, + CurveKey { + position: 3547.0, + value: 62.1074, + in_tangent: -0.01093, + out_tangent: -0.01093, + }, + ]; + let result = hermite_interp(&keys, 1773.5).unwrap(); + assert!(result > 62.0 && result < 111.0); + } + + #[test] + fn test_hermite_interp_clamps_below() { + let keys = vec![ + CurveKey { + position: 0.0, + value: 110.444, + in_tangent: 0.0, + out_tangent: -0.01793, + }, + CurveKey { + position: 3547.0, + value: 62.1074, + in_tangent: -0.01093, + out_tangent: -0.01093, + }, + ]; + let result = hermite_interp(&keys, -100.0).unwrap(); + assert!((result - 110.444).abs() < 1e-6); + } + + #[test] + fn test_hermite_interp_clamps_above() { + let keys = vec![ + CurveKey { + position: 0.0, + value: 110.444, + in_tangent: 0.0, + out_tangent: -0.01793, + }, + CurveKey { + position: 3547.0, + value: 62.1074, + in_tangent: -0.01093, + out_tangent: -0.01093, + }, + ]; + let result = hermite_interp(&keys, 5000.0).unwrap(); + assert!((result - 62.1074).abs() < 1e-6); + } + + #[test] + fn test_hermite_interp_empty_keys() { + let keys: Vec = vec![]; + assert!(hermite_interp(&keys, 0.0).is_err()); + } + + // CelestialBody + #[test] + fn test_celestial_body_mu() { + let body = CelestialBody::new( + "Kerbin".to_string(), + 670_000.0, + 1.1, + true, + None, + None, + 90291.8, + "Sanctar".to_string(), + ); + let expected = 4.8424e12; + assert!((body.mu - expected).abs() / expected < 0.001); + } + + #[test] + fn test_celestial_body_has_atmosphere() { + let body_no_atmo = CelestialBody::new( + "Moon".to_string(), + 200_000.0, + 0.166, + false, + None, + None, + 0.0, + "Moon".to_string(), + ); + assert!(!body_no_atmo.has_atmosphere()); + } +} From 45c5d1c0580d386d0e7a373da23e57618a14eec3 Mon Sep 17 00:00:00 2001 From: Yumeno Yuuka Date: Fri, 3 Apr 2026 09:32:51 +0900 Subject: [PATCH 2/8] feat(rust): implement Kopernicus ConfigNode parser Port the Python kopdeltav/parser.py to Rust with 1:1 logic parity. Two-layer design: low-level ConfigNode tree parser and high-level CelestialBody extractor. Handles comments, MM modifiers, delete directives, curve keys with tangent defaults, inline brace formats, unclosed brace recovery, and #LOC_ display name fallback. --- src-tauri/crates/kopdeltav/src/lib.rs | 1 + src-tauri/crates/kopdeltav/src/parser.rs | 856 +++++++++++++++++++++++ 2 files changed, 857 insertions(+) create mode 100644 src-tauri/crates/kopdeltav/src/parser.rs diff --git a/src-tauri/crates/kopdeltav/src/lib.rs b/src-tauri/crates/kopdeltav/src/lib.rs index c446ac8..3031dbb 100644 --- a/src-tauri/crates/kopdeltav/src/lib.rs +++ b/src-tauri/crates/kopdeltav/src/lib.rs @@ -1 +1,2 @@ pub mod models; +pub mod parser; diff --git a/src-tauri/crates/kopdeltav/src/parser.rs b/src-tauri/crates/kopdeltav/src/parser.rs new file mode 100644 index 0000000..029f316 --- /dev/null +++ b/src-tauri/crates/kopdeltav/src/parser.rs @@ -0,0 +1,856 @@ +//! Kopernicus ConfigNode parser for KSP `.cfg` files. +//! +//! Two-layer design: +//! 1. **Low-level**: `ConfigNode` tree parsed from raw text. +//! 2. **High-level**: `parse_bodies` extracts `CelestialBody` instances from the tree. +//! +//! KSP ConfigNodeパーサー(2層構成)。 + +use crate::models::{Atmosphere, CelestialBody, CurveKey, OrbitalElements}; + +// --------------------------------------------------------------------------- +// Constants +// --------------------------------------------------------------------------- + +/// Characters used as ModuleManager modifier prefixes on node names. +const MODIFIER_CHARS: &[char] = &['@', '!', '+', '-', '%']; + +// --------------------------------------------------------------------------- +// ConfigNode +// --------------------------------------------------------------------------- + +/// A node in the KSP ConfigNode tree. +/// +/// KSP ConfigNodeツリーのノード。 +#[derive(Debug, Clone)] +pub struct ConfigNode { + /// Node name (modifiers stripped). + pub name: String, + /// Key-value pairs declared directly in this node. + pub values: Vec<(String, String)>, + /// Child nodes. + pub children: Vec, +} + +impl ConfigNode { + /// Create a new empty ConfigNode with the given name. + fn new(name: impl Into) -> Self { + Self { + name: name.into(), + values: Vec::new(), + children: Vec::new(), + } + } + + /// Get the first value for a given key, or `None` if not found. + /// + /// 指定キーの最初の値を返す。 + pub fn get_value(&self, key: &str) -> Option<&str> { + self.values + .iter() + .find(|(k, _)| k == key) + .map(|(_, v)| v.as_str()) + } + + /// Get all values for a given key. + /// + /// 指定キーの全値を返す。 + pub fn get_values(&self, key: &str) -> Vec<&str> { + self.values + .iter() + .filter(|(k, _)| k == key) + .map(|(_, v)| v.as_str()) + .collect() + } + + /// Get the first child node with the given name, or `None`. + /// + /// 指定名の最初の子ノードを返す。 + pub fn get_child(&self, name: &str) -> Option<&ConfigNode> { + self.children.iter().find(|c| c.name == name) + } +} + +// --------------------------------------------------------------------------- +// Low-level parser +// --------------------------------------------------------------------------- + +/// Strip `//` comments from a line and trim whitespace. +fn strip_comments(line: &str) -> &str { + match line.find("//") { + Some(idx) => line[..idx].trim(), + None => line.trim(), + } +} + +/// Remove ModuleManager modifier prefixes, colon annotations, and bracket +/// expressions from a raw node name. +fn clean_node_name(raw: &str) -> String { + let mut s = raw.trim(); + + // Strip leading modifier chars + while let Some(first) = s.chars().next() { + if MODIFIER_CHARS.contains(&first) { + s = &s[first.len_utf8()..]; + } else { + break; + } + } + + // Strip :AFTER[...] etc. + if let Some(colon_idx) = s.find(':') { + s = &s[..colon_idx]; + } + + // Strip [Name] bracket expressions + if let Some(bracket_idx) = s.find('[') { + s = &s[..bracket_idx]; + } + + s.trim().to_string() +} + +/// Returns true if the line is a delete directive like `!Body[Kerbin]{}`. +fn is_delete_directive(line: &str) -> bool { + if !line.starts_with('!') { + return false; + } + // Pattern: !Word[...]{ optional whitespace } + // Match: starts with !, has word chars, brackets, then { } with optional whitespace + let rest = &line[1..]; + let Some(bracket_start) = rest.find('[') else { + return false; + }; + // Must have word chars before bracket + if bracket_start == 0 + || !rest[..bracket_start] + .chars() + .all(|c| c.is_alphanumeric() || c == '_') + { + return false; + } + let Some(bracket_end) = rest.find(']') else { + return false; + }; + if bracket_end <= bracket_start { + return false; + } + let after_bracket = rest[bracket_end + 1..].trim(); + // Must end with {} + if after_bracket == "{}" { + return true; + } + // Or { } with whitespace + if after_bracket.starts_with('{') && after_bracket.ends_with('}') { + let inner = &after_bracket[1..after_bracket.len() - 1]; + return inner.trim().is_empty(); + } + false +} + +/// Close the top node on the stack, attaching it to its parent or to top-level. +fn close_node(stack: &mut Vec, top_level: &mut Vec) { + if let Some(closed) = stack.pop() { + if let Some(parent) = stack.last_mut() { + parent.children.push(closed); + } else { + top_level.push(closed); + } + } +} + +/// Process a single logical line fragment (after comment stripping). +/// +/// This is factored out so that content remaining after an opening `{` +/// on the same physical line can be recursively processed. +fn process_fragment( + line: &str, + stack: &mut Vec, + top_level: &mut Vec, + pending_name: &mut Option, +) { + let line = line.trim(); + if line.is_empty() { + return; + } + + // Inline delete directive + if is_delete_directive(line) { + return; + } + + // Closing brace + if line == "}" { + if stack.is_empty() { + eprintln!("parser warning: unmatched closing brace, ignoring"); + return; + } + close_node(stack, top_level); + return; + } + + // Opening brace alone + if line == "{" { + let name = pending_name.take().unwrap_or_default(); + stack.push(ConfigNode::new(name)); + return; + } + + // Line contains `{` + if line.contains('{') { + let brace_idx = line.find('{').unwrap(); + let before = line[..brace_idx].trim(); + let node_name = if before.is_empty() { + pending_name.take().unwrap_or_default() + } else { + *pending_name = None; + clean_node_name(before) + }; + let node = ConfigNode::new(node_name); + let after = line[brace_idx + 1..].trim(); + if after.starts_with('}') { + // Empty inline node like `Node {}` + if let Some(parent) = stack.last_mut() { + parent.children.push(node); + } else { + top_level.push(node); + } + return; + } + stack.push(node); + // Process remaining content after `{` on the same line + if !after.is_empty() { + process_fragment(after, stack, top_level, pending_name); + } + return; + } + + // Check for trailing `}` on a key=value line or bare line + if line.contains('=') { + if pending_name.is_some() { + eprintln!("parser warning: discarding pending name before key=value line"); + *pending_name = None; + } + + // Check if line ends with `}` (inline close after key=value) + let (kv_part, has_close) = if let Some(stripped) = line.strip_suffix('}') { + (stripped, true) + } else { + (line, false) + }; + + let eq_idx = kv_part.find('=').unwrap(); + let key = kv_part[..eq_idx].trim().to_string(); + let value = kv_part[eq_idx + 1..].trim().to_string(); + if let Some(current) = stack.last_mut() { + current.values.push((key, value)); + } + + if has_close { + close_node(stack, top_level); + } + return; + } + + // Check if a bare token ends with `}` (edge case) + if let Some(stripped) = line.strip_suffix('}') { + let before = stripped.trim(); + if !before.is_empty() { + if pending_name.is_some() { + eprintln!("parser warning: discarding previous pending name"); + } + *pending_name = Some(clean_node_name(before)); + } + close_node(stack, top_level); + return; + } + + // Bare identifier (potential node name for next `{`) + if pending_name.is_some() { + eprintln!("parser warning: discarding previous pending name"); + } + *pending_name = Some(clean_node_name(line)); +} + +/// Parse raw KSP ConfigNode text into a list of top-level nodes. +/// +/// Handles comments, modifiers, delete directives, nested braces, +/// and auto-closes unclosed nodes at EOF with a warning. +/// +/// KSP ConfigNodeテキストをパースしてノードツリーを返す。 +pub fn parse_config_text(source: &str) -> Vec { + let mut top_level: Vec = Vec::new(); + let mut stack: Vec = Vec::new(); + let mut pending_name: Option = None; + + for raw_line in source.lines() { + let line = strip_comments(raw_line); + if line.is_empty() { + continue; + } + process_fragment(line, &mut stack, &mut top_level, &mut pending_name); + } + + // Auto-close unclosed nodes + if !stack.is_empty() { + eprintln!( + "parser warning: {} unclosed node(s) at EOF, auto-closing", + stack.len() + ); + while !stack.is_empty() { + close_node(&mut stack, &mut top_level); + } + } + + top_level +} + +// --------------------------------------------------------------------------- +// Helper parsers +// --------------------------------------------------------------------------- + +/// Parse a float from a string, returning `default` on `None` or parse failure. +fn parse_float(value: Option<&str>, default: f64) -> f64 { + match value { + Some(s) => s.trim().parse::().unwrap_or(default), + None => default, + } +} + +/// Parse a boolean from a string ("true" / "True" / "TRUE"), returning `default` +/// on `None` or unrecognized input. +fn parse_bool(value: Option<&str>, default: bool) -> bool { + match value { + Some(s) => s.trim().eq_ignore_ascii_case("true"), + None => default, + } +} + +/// Parse a single curve key line: `position value [inTangent [outTangent]]`. +/// +/// outTangent defaults to inTangent when omitted; both default to 0. +fn parse_curve_key(raw_value: &str) -> Option { + let parts: Vec<&str> = raw_value.split_whitespace().collect(); + if parts.len() < 2 { + return None; + } + let position = parts[0].parse::().ok()?; + let value = parts[1].parse::().ok()?; + let in_tangent = if parts.len() >= 3 { + parts[2].parse::().unwrap_or(0.0) + } else { + 0.0 + }; + let out_tangent = if parts.len() >= 4 { + parts[3].parse::().unwrap_or(in_tangent) + } else { + in_tangent + }; + Some(CurveKey { + position, + value, + in_tangent, + out_tangent, + }) +} + +/// Extract sorted curve keys from a node's `key` values. +fn extract_curve_keys(node: &ConfigNode) -> Vec { + let mut keys: Vec = node + .get_values("key") + .iter() + .filter_map(|raw| parse_curve_key(raw)) + .collect(); + keys.sort_by(|a, b| { + a.position + .partial_cmp(&b.position) + .unwrap_or(std::cmp::Ordering::Equal) + }); + keys +} + +// --------------------------------------------------------------------------- +// Body extraction +// --------------------------------------------------------------------------- + +/// Extract an `Atmosphere` from a body node, if present and enabled. +fn extract_atmosphere(body_node: &ConfigNode) -> Option { + let atmo_node = body_node.get_child("Atmosphere")?; + let enabled = parse_bool(atmo_node.get_value("enabled"), false); + if !enabled { + return None; + } + + let altitude = parse_float(atmo_node.get_value("altitude"), 0.0); + let adiabatic_index = parse_float(atmo_node.get_value("adiabaticIndex"), 1.4); + let molar_mass = parse_float(atmo_node.get_value("atmosphereMolarMass"), 0.02897); + let temperature_sea_level = parse_float(atmo_node.get_value("temperatureSeaLevel"), 0.0); + let pressure_sea_level = parse_float(atmo_node.get_value("staticPressureASL"), 0.0); + + let temperature_curve = atmo_node + .get_child("temperatureCurve") + .map(extract_curve_keys) + .unwrap_or_default(); + let pressure_curve = atmo_node + .get_child("pressureCurve") + .map(extract_curve_keys) + .unwrap_or_default(); + + Some(Atmosphere { + atmosphere_depth: altitude, + pressure_curve, + temperature_curve, + molar_mass, + adiabatic_index, + pressure_at_sea_level: pressure_sea_level, + temperature_at_sea_level: temperature_sea_level, + }) +} + +/// Extract `OrbitalElements` from a body node, if present. +fn extract_orbit(body_node: &ConfigNode) -> Option { + let orbit_node = body_node.get_child("Orbit")?; + Some(OrbitalElements { + semi_major_axis: parse_float(orbit_node.get_value("semiMajorAxis"), 0.0), + eccentricity: parse_float(orbit_node.get_value("eccentricity"), 0.0), + inclination: parse_float(orbit_node.get_value("inclination"), 0.0), + argument_of_periapsis: parse_float(orbit_node.get_value("argumentOfPeriapsis"), 0.0), + longitude_of_ascending_node: parse_float( + orbit_node.get_value("longitudeOfAscendingNode"), + 0.0, + ), + mean_anomaly_at_epoch: parse_float(orbit_node.get_value("meanAnomalyAtEpoch"), 0.0), + epoch: parse_float(orbit_node.get_value("epoch"), 0.0), + }) +} + +/// Check if an Ocean child node exists and has `ocean = True`. +fn extract_has_ocean(body_node: &ConfigNode) -> bool { + match body_node.get_child("Ocean") { + Some(ocean_node) => parse_bool(ocean_node.get_value("ocean"), false), + None => false, + } +} + +/// Resolve display name: prefer Properties/displayName unless it starts with +/// `#LOC_`, in which case fall back to source_filename then body name. +fn resolve_display_name( + properties: Option<&ConfigNode>, + body_name: &str, + source_filename: &str, +) -> String { + let fallback = || -> String { + if source_filename.is_empty() { + body_name.to_string() + } else { + source_filename.to_string() + } + }; + + let Some(props) = properties else { + return fallback(); + }; + + match props.get_value("displayName") { + Some(dn) if !dn.starts_with("#LOC_") => dn.to_string(), + _ => fallback(), + } +} + +/// Extract a single `CelestialBody` from a Body ConfigNode. +fn extract_body(body_node: &ConfigNode, source_filename: &str) -> Option { + let name = body_node.get_value("name")?; + let properties = body_node.get_child("Properties"); + + let radius = parse_float(properties.and_then(|p| p.get_value("radius")), 600_000.0); + let gee_asl = parse_float(properties.and_then(|p| p.get_value("geeASL")), 1.0); + let rotational_period = + parse_float(properties.and_then(|p| p.get_value("rotationPeriod")), 0.0); + let display_name = resolve_display_name(properties, name, source_filename); + let is_home_world = parse_bool(properties.and_then(|p| p.get_value("isHomeWorld")), false); + + let reference_body_name = body_node + .get_child("Orbit") + .and_then(|o| o.get_value("referenceBody")) + .map(|s| s.trim().to_string()) + .unwrap_or_default(); + + let atmosphere = extract_atmosphere(body_node); + let orbit = extract_orbit(body_node); + let has_ocean = extract_has_ocean(body_node); + + let mut body = CelestialBody::new( + name.to_string(), + radius, + gee_asl, + has_ocean, + atmosphere, + orbit, + rotational_period, + display_name, + ); + body.is_home_world = is_home_world; + body.reference_body_name = reference_body_name; + + Some(body) +} + +/// Recursively walk nodes looking for `Body` children and extract them. +fn walk_bodies(nodes: &[ConfigNode], source_filename: &str, bodies: &mut Vec) { + for node in nodes { + if node.name == "Body" { + if let Some(body) = extract_body(node, source_filename) { + bodies.push(body); + } + } else { + walk_bodies(&node.children, source_filename, bodies); + } + } +} + +/// Parse KSP ConfigNode source text and extract all `CelestialBody` instances. +/// +/// This is the main entry point for the parser. +/// +/// メインエントリーポイント。天体を抽出して返す。 +pub fn parse_bodies(source: &str) -> Vec { + parse_bodies_with_filename(source, "") +} + +/// Parse bodies with a source filename used as display name fallback. +/// +/// ファイル名付きでパースする。 +pub fn parse_bodies_with_filename(source: &str, filename: &str) -> Vec { + let top_nodes = parse_config_text(source); + let mut bodies = Vec::new(); + walk_bodies(&top_nodes, filename, &mut bodies); + bodies +} + +// --------------------------------------------------------------------------- +// Tests +// --------------------------------------------------------------------------- + +#[cfg(test)] +mod tests { + use super::*; + + // ----------------------------------------------------------------------- + // ConfigNode low-level tests + // ----------------------------------------------------------------------- + + #[test] + fn test_empty_input() { + assert!(parse_config_text("").is_empty()); + } + + #[test] + fn test_simple_key_value() { + let nodes = parse_config_text("Node\n{\n name = Kerbin\n radius = 600000\n}"); + assert_eq!(nodes.len(), 1); + assert_eq!(nodes[0].name, "Node"); + assert_eq!(nodes[0].get_value("name"), Some("Kerbin")); + assert_eq!(nodes[0].get_value("radius"), Some("600000")); + } + + #[test] + fn test_nested_nodes() { + let nodes = parse_config_text( + "Outer\n{\n key = val\n Inner\n {\n key = val2\n }\n}", + ); + assert_eq!(nodes.len(), 1); + assert_eq!(nodes[0].children.len(), 1); + assert_eq!(nodes[0].children[0].name, "Inner"); + } + + #[test] + fn test_comment_removal() { + let nodes = parse_config_text("Node\n{\n key = val // comment\n}"); + assert_eq!(nodes[0].get_value("key"), Some("val")); + } + + #[test] + fn test_modifier_stripping() { + for prefix in ["@", "!", "+", "-", "%"] { + let source = format!("{}Node\n{{\n key = val\n}}", prefix); + let nodes = parse_config_text(&source); + assert_eq!(nodes[0].name, "Node", "failed for prefix {}", prefix); + } + } + + #[test] + fn test_delete_directive_skipped() { + let nodes = parse_config_text("!Body[Kerbin]{}\nNode\n{\n key = val\n}"); + assert!(nodes.iter().any(|n| n.name == "Node")); + // The delete directive should not produce a node + assert!(!nodes.iter().any(|n| n.name == "Body")); + } + + #[test] + fn test_unclosed_brace_no_crash() { + let result = parse_config_text("Node\n{\n key = val\n"); + assert!(!result.is_empty()); + assert_eq!(result[0].get_value("key"), Some("val")); + } + + #[test] + fn test_values_with_spaces() { + let nodes = parse_config_text("Node\n{\n name = North Pole\n}"); + assert_eq!(nodes[0].get_value("name"), Some("North Pole")); + } + + #[test] + fn test_inline_node_opening() { + // Node name on the same line as the opening brace + let nodes = parse_config_text("Properties {\n radius = 100000\n}"); + assert_eq!(nodes.len(), 1); + assert_eq!(nodes[0].name, "Properties"); + assert_eq!(nodes[0].get_value("radius"), Some("100000")); + } + + #[test] + fn test_mm_annotation_stripped() { + let nodes = parse_config_text("@Kopernicus:AFTER[Kopernicus]\n{\n key = val\n}"); + assert_eq!(nodes[0].name, "Kopernicus"); + } + + #[test] + fn test_get_values_multiple() { + let nodes = + parse_config_text("Curve\n{\n key = 0 100\n key = 1 200\n key = 2 300\n}"); + let vals = nodes[0].get_values("key"); + assert_eq!(vals.len(), 3); + } + + #[test] + fn test_get_child_not_found() { + let nodes = parse_config_text("Node\n{\n key = val\n}"); + assert!(nodes[0].get_child("Missing").is_none()); + } + + // ----------------------------------------------------------------------- + // Curve key parsing + // ----------------------------------------------------------------------- + + #[test] + fn test_curve_key_full() { + let ck = parse_curve_key("0 101.325 -0.005 -0.01").unwrap(); + assert!((ck.position - 0.0).abs() < 1e-6); + assert!((ck.value - 101.325).abs() < 1e-6); + assert!((ck.in_tangent - (-0.005)).abs() < 1e-6); + assert!((ck.out_tangent - (-0.01)).abs() < 1e-6); + } + + #[test] + fn test_curve_key_out_tangent_defaults_to_in() { + let ck = parse_curve_key("0 101.325 -0.005").unwrap(); + assert!((ck.out_tangent - (-0.005)).abs() < 1e-6); + } + + #[test] + fn test_curve_key_tangents_default_to_zero() { + let ck = parse_curve_key("0 101.325").unwrap(); + assert!((ck.in_tangent - 0.0).abs() < 1e-6); + assert!((ck.out_tangent - 0.0).abs() < 1e-6); + } + + #[test] + fn test_curve_key_too_few_parts() { + assert!(parse_curve_key("0").is_none()); + assert!(parse_curve_key("").is_none()); + } + + // ----------------------------------------------------------------------- + // Body extraction tests + // ----------------------------------------------------------------------- + + #[test] + fn test_parse_simple_body() { + let cfg = r#" + @Kopernicus:AFTER[Kopernicus] + { + Body + { + name = Kerbin + Properties + { + radius = 600000 + geeASL = 1.0 + rotationPeriod = 21549.425 + isHomeWorld = True + } + } + } + "#; + let bodies = parse_bodies(cfg); + assert_eq!(bodies.len(), 1); + assert_eq!(bodies[0].name, "Kerbin"); + assert!((bodies[0].radius - 600_000.0).abs() < 1.0); + assert!((bodies[0].gee_asl - 1.0).abs() < 0.001); + assert!(bodies[0].is_home_world); + } + + #[test] + fn test_parse_sanctar_cfg() { + let cfg = std::fs::read_to_string("../../../sample_configs/Sanctar.cfg").unwrap(); + let bodies = parse_bodies(&cfg); + assert!(!bodies.is_empty()); + let body = &bodies[0]; + + // Basic properties + assert!((body.radius - 670_000.0).abs() < 1.0); + assert!((body.gee_asl - 1.1).abs() < 0.001); + + // Atmosphere + assert!(body.atmosphere.is_some()); + let atmo = body.atmosphere.as_ref().unwrap(); + assert!((atmo.atmosphere_depth - 72_000.0).abs() < 1.0); + assert_eq!(atmo.pressure_curve.len(), 26); + assert_eq!(atmo.temperature_curve.len(), 26); + assert!((atmo.pressure_at_sea_level - 110.444).abs() / 110.444 < 0.001); + assert!((atmo.temperature_at_sea_level - 281.0).abs() < 0.1); + assert!((atmo.molar_mass - 0.02897).abs() < 0.0001); + assert!((atmo.adiabatic_index - 1.4).abs() < 0.001); + + // Orbit + assert!(body.orbit.is_some()); + let orbit = body.orbit.as_ref().unwrap(); + assert!((orbit.semi_major_axis - 13_116_000_574.0).abs() / 13_116_000_574.0 < 0.001); + assert!((orbit.eccentricity - 0.0254528).abs() < 0.001); + assert!((orbit.inclination - 1.38).abs() < 0.01); + + // Other + assert!(body.is_home_world); + assert_eq!(body.reference_body_name, "Sun"); + assert!(body.has_ocean); + } + + #[test] + fn test_curve_key_out_tangent_defaults_to_in_body() { + let cfg = r#" + Body + { + name = Test + Properties { radius = 100000 } + Atmosphere + { + enabled = True + altitude = 50000 + adiabaticIndex = 1.4 + atmosphereMolarMass = 0.029 + temperatureSeaLevel = 288 + staticPressureASL = 101.325 + pressureCurve + { + key = 0 101.325 -0.005 + } + temperatureCurve + { + key = 0 288 0 0 + } + } + } + "#; + let bodies = parse_bodies(cfg); + let atmo = bodies[0].atmosphere.as_ref().unwrap(); + assert!((atmo.pressure_curve[0].out_tangent - (-0.005)).abs() < 1e-6); + } + + #[test] + fn test_atmosphere_disabled_is_none() { + let cfg = "Body\n{\n name = Test\n Properties\n {\n radius = 100000\n geeASL = 1.0\n }\n Atmosphere\n {\n enabled = False\n altitude = 70000\n }\n}"; + let bodies = parse_bodies(cfg); + assert!(bodies[0].atmosphere.is_none()); + } + + #[test] + fn test_no_orbit_is_none() { + let cfg = "Body\n{\n name = Test\n Properties\n {\n radius = 100000\n geeASL = 1.0\n }\n}"; + let bodies = parse_bodies(cfg); + assert!(bodies[0].orbit.is_none()); + } + + #[test] + fn test_reference_body_from_orbit() { + let cfg = "Body\n{\n name = Test\n Properties\n {\n radius = 100000\n geeASL = 1.0\n }\n Orbit\n {\n semiMajorAxis = 1000000\n referenceBody = Sun\n }\n}"; + let bodies = parse_bodies(cfg); + assert_eq!(bodies[0].reference_body_name, "Sun"); + } + + #[test] + fn test_multiple_bodies() { + let cfg = "Body\n{\n name = A\n Properties { radius = 100000\n geeASL = 1.0 }\n}\nBody\n{\n name = B\n Properties { radius = 200000\n geeASL = 0.8 }\n}"; + let bodies = parse_bodies(cfg); + assert_eq!(bodies.len(), 2); + } + + #[test] + fn test_display_name_loc_fallback() { + let cfg = r#" + Body + { + name = Kerbin + Properties + { + displayName = #LOC_Kerbin + radius = 600000 + } + } + "#; + // Without filename, falls back to body name + let bodies = parse_bodies(cfg); + assert_eq!(bodies[0].display_name, "Kerbin"); + + // With filename, falls back to filename + let bodies = parse_bodies_with_filename(cfg, "MyPlanet"); + assert_eq!(bodies[0].display_name, "MyPlanet"); + } + + #[test] + fn test_display_name_real_value() { + let cfg = r#" + Body + { + name = Kerbin + Properties + { + displayName = Earth + radius = 600000 + } + } + "#; + let bodies = parse_bodies(cfg); + assert_eq!(bodies[0].display_name, "Earth"); + } + + #[test] + fn test_no_properties_defaults() { + let cfg = "Body\n{\n name = Test\n}"; + let bodies = parse_bodies(cfg); + assert_eq!(bodies.len(), 1); + assert!((bodies[0].radius - 600_000.0).abs() < 1.0); + assert!((bodies[0].gee_asl - 1.0).abs() < 0.001); + } + + #[test] + fn test_body_without_name_skipped() { + let cfg = "Body\n{\n Properties { radius = 100000 }\n}"; + let bodies = parse_bodies(cfg); + assert!(bodies.is_empty()); + } + + #[test] + fn test_unmatched_closing_brace() { + // Should not crash + let nodes = parse_config_text("}\nNode\n{\n key = val\n}"); + assert_eq!(nodes.len(), 1); + assert_eq!(nodes[0].name, "Node"); + } + + #[test] + fn test_delete_directive_with_spaces() { + let nodes = parse_config_text("!Body[Kerbin]{ }\nNode\n{\n key = val\n}"); + assert!(nodes.iter().any(|n| n.name == "Node")); + assert!(!nodes.iter().any(|n| n.name == "Body")); + } +} From 995178339ef8476aa2fff8997cd97a4802e5e370 Mon Sep 17 00:00:00 2001 From: Yumeno Yuuka Date: Fri, 3 Apr 2026 09:39:27 +0900 Subject: [PATCH 3/8] feat(rust): implement delta-V calculation engine Port all calculator functions from Python kopdeltav/calculator.py to Rust: - Orbital mechanics: low_orbit_altitude, circular/escape velocity - Atmospheric density via hermite-interpolated curves (kPa->Pa conversion) - Launch delta-V with empirical gravity/drag/jet estimation - Hohmann transfer (inward + outward) via vis-viva equation - Tsiolkovsky rocket equation for mass ratio - Geostationary orbit altitude and transfer delta-V - Escape/landing delta-V helpers - Multi-step route planner (compute_route) All 17 tests pass including reference value regression tests: - Sanctar escape velocity: 3802 m/s - Kerbin escape velocity: 3431 m/s - Sanctar surface density: 1.4096 kg/m3 - Sanctar launch rocket: ~3110 m/s, with jets: ~1982 m/s --- src-tauri/crates/kopdeltav/src/calculator.rs | 1107 ++++++++++++++++++ src-tauri/crates/kopdeltav/src/lib.rs | 1 + 2 files changed, 1108 insertions(+) create mode 100644 src-tauri/crates/kopdeltav/src/calculator.rs diff --git a/src-tauri/crates/kopdeltav/src/calculator.rs b/src-tauri/crates/kopdeltav/src/calculator.rs new file mode 100644 index 0000000..745095e --- /dev/null +++ b/src-tauri/crates/kopdeltav/src/calculator.rs @@ -0,0 +1,1107 @@ +//! Delta-V calculation engine for KSP celestial bodies. +//! +//! 天体のΔV計算エンジン。低軌道投入、ホーマン遷移、ツィオルコフスキー方程式を提供する。 +//! +//! Provides empirical launch-to-orbit estimation, Hohmann transfer computation, +//! Tsiolkovsky rocket equation, geostationary orbit calculation, escape/landing +//! ΔV helpers, and a multi-step route planner. + +use serde::Serialize; +use std::f64::consts::PI; + +use crate::models::{hermite_interp, CelestialBody, G0, R_GAS}; + +// --------------------------------------------------------------------------- +// Constants +// --------------------------------------------------------------------------- + +/// Fraction of orbital velocity attributed to gravity loss, scaled by surface gravity. +/// Calibrated against KSP flight data; accuracy ~10%. +const GRAVITY_LOSS_COEFF: f64 = 0.15; + +/// Fraction of orbital velocity attributed to atmospheric drag loss, +/// scaled by surface density relative to Earth. +const DRAG_LOSS_COEFF: f64 = 0.05; + +/// Fraction of orbital velocity saved by air-breathing (jet) engines in the lower atmosphere. +/// Capped when density ratio >= 1.0. +const JET_SAVINGS_COEFF: f64 = 0.44; + +/// Earth sea-level atmospheric density [kg/m^3], used as reference for empirical scaling. +const EARTH_RHO_SEA_LEVEL: f64 = 1.225; + +// --------------------------------------------------------------------------- +// Enums +// --------------------------------------------------------------------------- + +/// Type of a delta-V route segment, used for display coloring. +/// +/// ΔVルートセグメントの種別。表示時の色分けに使用。 +#[derive(Debug, Clone, Serialize)] +pub enum SegmentType { + /// Launch from surface to low orbit. + Launch, + /// Escape from a celestial body's gravity well. + Escape, + /// Interplanetary/interlunar Hohmann transfer. + Transfer, + /// Orbit insertion (capture burn) at destination. + Capture, + /// Landing on a celestial body. + Landing, + /// Escape from the entire star system (third cosmic velocity). + SystemEscape, + /// Transfer from a planet's orbit to a moon's orbit. + MoonTransfer, + /// Landing on a moon. + MoonLanding, +} + +// --------------------------------------------------------------------------- +// Result structs +// --------------------------------------------------------------------------- + +/// Results of a launch-to-orbit delta-V calculation. +/// +/// 低軌道投入ΔV計算の結果。 +#[derive(Debug, Clone, Serialize)] +pub struct LaunchResult { + /// Circular velocity at target orbit [m/s]. + pub orbital_velocity: f64, + /// Estimated gravity loss [m/s]. + pub gravity_loss: f64, + /// Estimated atmospheric drag loss [m/s]. + pub drag_loss: f64, + /// Theoretical minimum (= orbital velocity) [m/s]. + pub total_ideal: f64, + /// Practical rocket delta-V with losses [m/s]. + pub total_rocket: f64, + /// Delta-V saved if using jet engines in lower atmosphere [m/s]. + pub jet_savings: f64, + /// total_rocket - jet_savings [m/s]. + pub total_with_jets: f64, +} + +/// Results of a Hohmann transfer calculation. +/// +/// ホーマン遷移計算の結果。 +#[derive(Debug, Clone, Serialize)] +pub struct HohmannResult { + /// Delta-V for departure burn [m/s]. + pub departure_dv: f64, + /// Delta-V for arrival/capture burn [m/s]. + pub arrival_dv: f64, + /// Total delta-V (departure + arrival) [m/s]. + pub total_dv: f64, + /// Transfer time (half-period of the transfer ellipse) [s]. + pub transfer_time: f64, + /// True if the transfer is to an inner (lower) orbit. + pub inward: bool, +} + +/// Results of the Tsiolkovsky rocket equation. +/// +/// ツィオルコフスキーの式の計算結果。 +#[derive(Debug, Clone, Serialize)] +pub struct TsiolkovskyResult { + /// Wet mass / dry mass ratio. + pub mass_ratio: f64, + /// Fraction of total mass that is fuel (1 - 1/mass_ratio). + pub fuel_fraction: f64, + /// Dry (empty) mass [kg]. + pub dry_mass: f64, + /// Fuel mass [kg]. + pub fuel_mass: f64, +} + +/// A single step in a delta-V route. +/// +/// ΔVルートの1ステップ。 +#[derive(Debug, Clone, Serialize)] +pub struct DvStep { + /// Human-readable description of this maneuver. + pub label: String, + /// Delta-V for this step [m/s]. + pub dv: f64, + /// Running total delta-V from mission start [m/s]. + pub cumulative: f64, + /// Type of maneuver for display purposes. + pub segment_type: SegmentType, + /// Optional supplementary information (e.g. aerobrake alternative). + pub note: String, +} + +// --------------------------------------------------------------------------- +// Orbital mechanics +// --------------------------------------------------------------------------- + +/// Estimate a reasonable low orbit altitude for the body. +/// +/// 天体の妥当な低軌道高度を推定する。 +/// +/// For bodies with atmosphere, returns approximately 10% above the atmosphere +/// depth to ensure a stable orbit well outside the atmosphere. For airless +/// bodies, returns 5% of the body radius (minimum 10 000 m). +/// +/// # Arguments +/// * `body` - Target celestial body. +/// +/// # Returns +/// Estimated low orbit altitude above surface [m]. +pub fn low_orbit_altitude(body: &CelestialBody) -> f64 { + if let Some(ref atmo) = body.atmosphere { + atmo.atmosphere_depth * 1.1 + } else { + f64::max(body.radius * 0.05, 10_000.0) + } +} + +/// Circular orbital velocity at given altitude above surface. +/// +/// 指定高度での円軌道速度を計算する。 +/// +/// Uses `v_circular = sqrt(mu / r)` where `r = radius + altitude`. +/// +/// # Arguments +/// * `body` - Target celestial body. +/// * `altitude` - Altitude above surface [m]. +/// +/// # Returns +/// Orbital velocity [m/s]. +/// +/// # Panics +/// Panics if altitude is negative. +pub fn circular_velocity(body: &CelestialBody, altitude: f64) -> f64 { + assert!(altitude >= 0.0, "Altitude must be non-negative: {altitude}"); + let r = body.radius + altitude; + (body.mu / r).sqrt() +} + +/// Escape velocity at given altitude above surface. +/// +/// 指定高度での脱出速度を計算する。 +/// +/// Uses `v_escape = sqrt(2 * mu / r) = sqrt(2) * v_circular` at the same altitude. +/// +/// # Arguments +/// * `body` - Target celestial body. +/// * `altitude` - Altitude above surface [m]. +/// +/// # Returns +/// Escape velocity [m/s]. +/// +/// # Panics +/// Panics if altitude is negative. +pub fn escape_velocity(body: &CelestialBody, altitude: f64) -> f64 { + assert!(altitude >= 0.0, "Altitude must be non-negative: {altitude}"); + let r = body.radius + altitude; + (2.0 * body.mu / r).sqrt() +} + +// --------------------------------------------------------------------------- +// Atmospheric density +// --------------------------------------------------------------------------- + +/// Calculate atmospheric density at altitude using hermite-interpolated curves. +/// +/// 高度ごとの大気密度をエルミート補間カーブで計算する。 +/// +/// Applies the ideal gas law `rho = P * M / (R_gas * T)` where pressure and +/// temperature are obtained from the body's atmosphere curves via cubic +/// Hermite spline interpolation. When curves are empty, falls back to +/// sea-level scalar values (meaningful only at altitude 0). +/// +/// **Important**: Pressure in the curves is in kPa; it must be converted to +/// Pa (x1000) before applying the ideal gas law. +/// +/// # Arguments +/// * `body` - Target celestial body. +/// * `altitude` - Altitude above surface [m]. +/// +/// # Returns +/// Atmospheric density [kg/m^3], or `None` if the body has no atmosphere. +/// Returns `0.0` for altitudes at or above the atmosphere depth. +pub fn density_at_altitude(body: &CelestialBody, altitude: f64) -> Option { + let atmo = body.atmosphere.as_ref()?; + + if altitude >= atmo.atmosphere_depth { + return Some(0.0); + } + + // Pressure [kPa] from curve, falling back to sea-level scalar. + let pressure_kpa = if !atmo.pressure_curve.is_empty() { + hermite_interp(&atmo.pressure_curve, altitude).unwrap_or(0.0) + } else if altitude == 0.0 { + atmo.pressure_at_sea_level + } else { + 0.0 + }; + + // Temperature [K] from curve, falling back to sea-level scalar. + let temperature_k = if !atmo.temperature_curve.is_empty() { + hermite_interp(&atmo.temperature_curve, altitude).unwrap_or(0.0) + } else if altitude == 0.0 { + atmo.temperature_at_sea_level + } else { + 0.0 + }; + + if temperature_k <= 0.0 || pressure_kpa <= 0.0 { + return Some(0.0); + } + + // kPa -> Pa conversion, then ideal gas law: rho = P * M / (R * T). + let pressure_pa = pressure_kpa * 1000.0; + Some(pressure_pa * atmo.molar_mass / (R_GAS * temperature_k)) +} + +/// Calculate sea-level atmospheric density using the ideal gas law. +/// +/// 海面大気密度を理想気体の式で計算する。大気なしの場合は None。 +/// +/// Delegates to [`density_at_altitude`] at altitude 0, which evaluates +/// the pressure and temperature curves at sea level. +/// +/// # Arguments +/// * `body` - Target celestial body. +/// +/// # Returns +/// Sea-level atmospheric density [kg/m^3], or `None` if no atmosphere. +pub fn surface_density(body: &CelestialBody) -> Option { + density_at_altitude(body, 0.0) +} + +// --------------------------------------------------------------------------- +// Launch delta-V +// --------------------------------------------------------------------------- + +/// Calculate launch-to-orbit delta-V for a body. +/// +/// 天体の低軌道投入ΔVを計算する。 +/// +/// This is an **empirical** model. All loss and savings values are rough +/// approximations calibrated against KSP flight data. Estimated accuracy +/// is +/-10% for `total_rocket` and +/-15% for `jet_savings`. Actual values +/// depend heavily on vehicle design, thrust-to-weight ratio, and ascent profile. +/// +/// Assumptions: +/// - **Gravity loss** ~ 15% of orbital velocity, scaled linearly by `gee_asl`. +/// - **Drag loss** ~ 5% of orbital velocity, scaled by `rho/rho_earth`. +/// - **Jet savings** ~ 44% of orbital velocity, capped at density ratio 1.0. +/// +/// # Arguments +/// * `body` - Target celestial body. +/// * `target_altitude` - Target circular orbit altitude above surface [m]. +/// +/// # Returns +/// [`LaunchResult`] with computed delta-V values. +/// +/// # Panics +/// Panics if `target_altitude` is negative. +pub fn calculate_launch(body: &CelestialBody, target_altitude: f64) -> LaunchResult { + assert!( + target_altitude >= 0.0, + "Target altitude must be non-negative: {target_altitude}" + ); + + let v_orbital = circular_velocity(body, target_altitude); + + // Gravity loss: scales with surface gravity. + let gravity_loss = v_orbital * GRAVITY_LOSS_COEFF * body.gee_asl; + + // Drag loss: scales with atmospheric density relative to Earth. + let rho = surface_density(body); + let drag_loss = match rho { + Some(r) if r > 0.0 => v_orbital * DRAG_LOSS_COEFF * (r / EARTH_RHO_SEA_LEVEL), + _ => 0.0, + }; + + let total_ideal = v_orbital; + let total_rocket = v_orbital + gravity_loss + drag_loss; + + // Jet savings: only possible with atmosphere; capped at density ratio 1.0. + let jet_savings = match rho { + Some(r) if r > 0.0 => { + let density_factor = (r / EARTH_RHO_SEA_LEVEL).min(1.0); + v_orbital * JET_SAVINGS_COEFF * density_factor + } + _ => 0.0, + }; + + let total_with_jets = total_rocket - jet_savings; + + LaunchResult { + orbital_velocity: v_orbital, + gravity_loss, + drag_loss, + total_ideal, + total_rocket, + jet_savings, + total_with_jets, + } +} + +// --------------------------------------------------------------------------- +// Hohmann transfer +// --------------------------------------------------------------------------- + +/// Calculate Hohmann transfer from parking orbit to target orbit. +/// +/// パーキング軌道からターゲット軌道へのホーマン遷移ΔVを計算する。 +/// +/// Supports both outward (target > parking) and inward (target < parking) +/// transfers. For inward transfers the vis-viva computation uses the +/// swapped radii internally and the returned departure/arrival delta-Vs are +/// swapped so that `departure_dv` is the burn at the parking orbit and +/// `arrival_dv` is the burn at the target orbit. +/// +/// Standard Hohmann transfer equations (outward case): +/// ```text +/// a_transfer = (r1 + r2) / 2 +/// v_transfer_peri = sqrt(mu * (2/r1 - 1/a_transfer)) +/// departure_dv = v_transfer_peri - v_circular(r1) +/// v_transfer_apo = sqrt(mu * (2/r2 - 1/a_transfer)) +/// arrival_dv = v_circular(r2) - v_transfer_apo +/// transfer_time = pi * sqrt(a_transfer^3 / mu) +/// ``` +/// +/// # Arguments +/// * `body` - Central body being orbited. +/// * `parking_altitude` - Altitude of circular parking orbit above surface [m]. +/// * `target_sma` - Semi-major axis of target orbit [m] (from body center). +/// +/// # Returns +/// [`HohmannResult`] with delta-V and transfer time values. +/// +/// # Panics +/// Panics if `parking_altitude` is negative or the parking orbit radius +/// and `target_sma` are identical (zero-ΔV transfer). +pub fn calculate_hohmann( + body: &CelestialBody, + parking_altitude: f64, + target_sma: f64, +) -> HohmannResult { + assert!( + parking_altitude >= 0.0, + "Parking altitude must be non-negative: {parking_altitude}" + ); + + let r_parking = body.radius + parking_altitude; + let r_target = target_sma; + + assert!( + (r_parking - r_target).abs() / r_parking.max(r_target) > 1e-12, + "Parking orbit radius ({r_parking} m) and target SMA ({r_target} m) \ + are identical; Hohmann transfer is undefined" + ); + + let inward = r_target < r_parking; + + // For vis-viva, r_inner is the periapsis and r_outer is the apoapsis. + let r_inner = r_parking.min(r_target); + let r_outer = r_parking.max(r_target); + + let mu = body.mu; + let a_transfer = (r_inner + r_outer) / 2.0; + + // Burn at periapsis of the transfer ellipse. + let v_inner_circular = (mu / r_inner).sqrt(); + let v_transfer_peri = (mu * (2.0 / r_inner - 1.0 / a_transfer)).sqrt(); + let dv_peri = v_transfer_peri - v_inner_circular; + + // Burn at apoapsis of the transfer ellipse. + let v_outer_circular = (mu / r_outer).sqrt(); + let v_transfer_apo = (mu * (2.0 / r_outer - 1.0 / a_transfer)).sqrt(); + let dv_apo = v_outer_circular - v_transfer_apo; + + // Transfer time: half the period of the transfer ellipse. + let transfer_time = PI * (a_transfer.powi(3) / mu).sqrt(); + + let (departure_dv, arrival_dv) = if inward { + // Inward: departure is at the outer (parking) orbit, arrival at inner. + (dv_apo, dv_peri) + } else { + // Outward: departure is at the inner (parking) orbit, arrival at outer. + (dv_peri, dv_apo) + }; + + HohmannResult { + departure_dv, + arrival_dv, + total_dv: departure_dv + arrival_dv, + transfer_time, + inward, + } +} + +// --------------------------------------------------------------------------- +// Tsiolkovsky rocket equation +// --------------------------------------------------------------------------- + +/// Apply the Tsiolkovsky rocket equation. +/// +/// ツィオルコフスキーの式を適用して質量比を計算する。 +/// +/// ```text +/// dv = Isp * g0 * ln(m_wet / m_dry) +/// mass_ratio = exp(dv / (Isp * g0)) +/// ``` +/// +/// # Arguments +/// * `delta_v` - Required delta-V [m/s]. +/// * `isp` - Specific impulse [s]. +/// * `wet_mass` - Total (wet) mass [kg]. +/// +/// # Returns +/// [`TsiolkovskyResult`] with mass ratio and fuel breakdown. +/// +/// # Panics +/// Panics if `delta_v` is negative, `isp` is non-positive, or +/// `wet_mass` is non-positive. +pub fn calculate_tsiolkovsky(delta_v: f64, isp: f64, wet_mass: f64) -> TsiolkovskyResult { + assert!(delta_v >= 0.0, "delta_v must be non-negative: {delta_v}"); + assert!(isp > 0.0, "Isp must be positive: {isp}"); + assert!(wet_mass > 0.0, "wet_mass must be positive: {wet_mass}"); + + let ve = isp * G0; // effective exhaust velocity [m/s] + let mass_ratio = (delta_v / ve).exp(); + let fuel_fraction = 1.0 - 1.0 / mass_ratio; + let dry_mass = wet_mass / mass_ratio; + let fuel_mass = wet_mass - dry_mass; + + TsiolkovskyResult { + mass_ratio, + fuel_fraction, + dry_mass, + fuel_mass, + } +} + +// --------------------------------------------------------------------------- +// Geostationary orbit +// --------------------------------------------------------------------------- + +/// Calculate the altitude of a geostationary orbit. +/// +/// 静止軌道の高度を計算する。 +/// +/// Uses the formula: +/// ```text +/// r_geo = (mu * T^2 / (4 * pi^2))^(1/3) +/// altitude = r_geo - radius +/// ``` +/// +/// where `T` is the sidereal rotation period of the body. +/// +/// # Arguments +/// * `body` - Target celestial body. +/// +/// # Returns +/// Geostationary orbit altitude above surface [m]. +/// +/// # Panics +/// Panics if `body.rotational_period` is non-positive. +pub fn geostationary_altitude(body: &CelestialBody) -> f64 { + assert!( + body.rotational_period > 0.0, + "Rotational period must be positive for a geostationary orbit: {}", + body.rotational_period + ); + let t = body.rotational_period; + let r_geo = (body.mu * t * t / (4.0 * PI * PI)).powf(1.0 / 3.0); + r_geo - body.radius +} + +/// Calculate the delta-V for a Hohmann transfer from low orbit to geostationary orbit. +/// +/// 低軌道から静止軌道へのホーマン遷移ΔVを計算する。 +/// +/// # Arguments +/// * `body` - Target celestial body. +/// +/// # Returns +/// [`HohmannResult`] for the low orbit -> geostationary transfer. +/// +/// # Panics +/// Panics if `body.rotational_period` is non-positive, or if the +/// geostationary orbit is below the low orbit (extremely fast rotators). +pub fn geostationary_dv(body: &CelestialBody) -> HohmannResult { + let lo_alt = low_orbit_altitude(body); + let geo_alt = geostationary_altitude(body); + let geo_sma = body.radius + geo_alt; + calculate_hohmann(body, lo_alt, geo_sma) +} + +// --------------------------------------------------------------------------- +// Escape delta-V from low orbit +// --------------------------------------------------------------------------- + +/// Calculate the delta-V needed to escape from low orbit. +/// +/// 低軌道から脱出するのに必要なΔVを計算する。 +/// +/// Computes `v_escape(lo_alt) - v_circular(lo_alt)`, which is the +/// impulsive burn required to reach escape velocity from a circular +/// parking orbit at the standard low orbit altitude. +/// +/// # Arguments +/// * `body` - Target celestial body. +/// +/// # Returns +/// Escape delta-V from low orbit [m/s]. Always positive. +pub fn escape_dv_from_low_orbit(body: &CelestialBody) -> f64 { + let lo_alt = low_orbit_altitude(body); + let v_esc = escape_velocity(body, lo_alt); + let v_circ = circular_velocity(body, lo_alt); + v_esc - v_circ +} + +// --------------------------------------------------------------------------- +// Landing delta-V +// --------------------------------------------------------------------------- + +/// Estimate the delta-V required to land on a body. +/// +/// 天体への着陸に必要なΔVを推定する。 +/// +/// The powered landing delta-V is approximated as the circular orbital velocity +/// at the low orbit altitude -- representing the speed that must be cancelled +/// to descend from orbit to the surface. +/// +/// For bodies **with** atmosphere, aerobraking can absorb most of the +/// orbital energy; the aerobrake contribution is returned as `Some(0.0)`. +/// +/// For bodies **without** atmosphere, there is no aerobraking option, so +/// the second element is `None`. +/// +/// # Arguments +/// * `body` - Target celestial body. +/// +/// # Returns +/// A tuple `(powered_dv, aerobrake_dv)` where: +/// - `powered_dv`: delta-V for a fully powered landing [m/s]. Always > 0. +/// - `aerobrake_dv`: `Some(0.0)` if the body has atmosphere; `None` if no atmosphere. +pub fn landing_dv(body: &CelestialBody) -> (f64, Option) { + let lo_alt = low_orbit_altitude(body); + let powered_dv = circular_velocity(body, lo_alt); + let aerobrake_dv = if body.atmosphere.is_some() { + Some(0.0) + } else { + None + }; + (powered_dv, aerobrake_dv) +} + +// --------------------------------------------------------------------------- +// Delta-V route planner +// --------------------------------------------------------------------------- + +/// Compute a delta-V route from the home world to an optional destination. +/// +/// ホームワールドから目的地までのΔVルートを計算する。 +/// +/// Three modes depending on the arguments: +/// +/// **Third cosmic velocity** (`destination = None`): +/// 1. Launch to low orbit. +/// 2. Escape home world. +/// 3. Escape star system. +/// +/// **Planet flyby / capture** (`destination = Some(planet)`, `moon = None`): +/// 1. Launch to low orbit. +/// 2. Escape home world. +/// 3. Hohmann transfer in parent body's frame. +/// 4. Destination orbit insertion (capture burn). +/// 5. Landing on destination. +/// +/// **Moon mission** (`destination = Some(planet)`, `moon = Some(satellite)`): +/// Steps 1-4 as above. +/// 5. Hohmann transfer from destination low orbit to moon SMA. +/// 6. Landing on moon. +/// +/// # Arguments +/// * `home` - Home world celestial body (must have orbit and parent). +/// * `parent` - Parent star/body that home orbits. +/// * `destination` - Target planet (must orbit the same parent as home). Pass `None` for third cosmic velocity. +/// * `moon` - Target moon orbiting destination. Ignored when destination is `None`. +/// +/// # Returns +/// Ordered list of [`DvStep`] objects representing each maneuver. +/// +/// # Panics +/// Panics if home has no orbit data, or if destination/moon have no orbit data when provided. +pub fn compute_route( + home: &CelestialBody, + parent: &CelestialBody, + destination: Option<&CelestialBody>, + moon: Option<&CelestialBody>, +) -> Vec { + let home_orbit = home + .orbit + .as_ref() + .expect("Home world has no orbital elements; cannot compute interplanetary route."); + + let mut steps: Vec = Vec::new(); + let mut cumulative = 0.0; + + let add_step = |steps: &mut Vec, + cumulative: &mut f64, + label: String, + dv: f64, + seg_type: SegmentType, + note: String| { + *cumulative += dv; + steps.push(DvStep { + label, + dv, + cumulative: *cumulative, + segment_type: seg_type, + note, + }); + }; + + // Step 1: Launch to low orbit. + let lo_alt = low_orbit_altitude(home); + let launch = calculate_launch(home, lo_alt); + add_step( + &mut steps, + &mut cumulative, + "Launch to low orbit".to_string(), + launch.total_rocket, + SegmentType::Launch, + String::new(), + ); + + // Step 2: Escape home world. + let esc_home = escape_dv_from_low_orbit(home); + add_step( + &mut steps, + &mut cumulative, + format!("Escape {}", home.name), + esc_home, + SegmentType::Escape, + String::new(), + ); + + let destination = match destination { + Some(d) => d, + None => { + // Third cosmic velocity: escape the parent star system from home orbit. + let home_sma = home_orbit.semi_major_axis; + let home_orbit_alt = home_sma - parent.radius; + let v_esc_star = escape_velocity(parent, home_orbit_alt); + let v_circ_star = circular_velocity(parent, home_orbit_alt); + let esc_star = v_esc_star - v_circ_star; + add_step( + &mut steps, + &mut cumulative, + format!("Escape {} system", parent.name), + esc_star, + SegmentType::SystemEscape, + String::new(), + ); + return steps; + } + }; + + let dest_orbit = destination + .orbit + .as_ref() + .expect("Destination has no orbital elements."); + + // Step 3: Hohmann transfer in parent's frame. + let home_sma = home_orbit.semi_major_axis; + let home_orbit_alt = home_sma - parent.radius; + let dest_sma = dest_orbit.semi_major_axis; + let hohmann = calculate_hohmann(parent, home_orbit_alt, dest_sma); + add_step( + &mut steps, + &mut cumulative, + format!("Transfer to {}", destination.name), + hohmann.departure_dv, + SegmentType::Transfer, + String::new(), + ); + + // Step 4: Capture at destination. + let esc_dest = escape_dv_from_low_orbit(destination); + add_step( + &mut steps, + &mut cumulative, + format!("Capture at {}", destination.name), + esc_dest, + SegmentType::Capture, + String::new(), + ); + + match moon { + None => { + // Step 5: Land on destination. + let (powered_dv, aerobrake_dv) = landing_dv(destination); + let note = match aerobrake_dv { + Some(v) => format!("aerobrake option: {v} m/s"), + None => String::new(), + }; + add_step( + &mut steps, + &mut cumulative, + format!("Land on {}", destination.name), + powered_dv, + SegmentType::Landing, + note, + ); + } + Some(moon_body) => { + let moon_orbit = moon_body + .orbit + .as_ref() + .expect("Moon has no orbital elements."); + + // Step 5: Transfer from destination low orbit to moon SMA. + let dest_lo_alt = low_orbit_altitude(destination); + let moon_sma = moon_orbit.semi_major_axis; + let moon_hohmann = calculate_hohmann(destination, dest_lo_alt, moon_sma); + add_step( + &mut steps, + &mut cumulative, + format!("Transfer to {}", moon_body.name), + moon_hohmann.departure_dv, + SegmentType::MoonTransfer, + String::new(), + ); + + // Step 6: Land on moon. + let (powered_dv_moon, aerobrake_dv_moon) = landing_dv(moon_body); + let note_moon = match aerobrake_dv_moon { + Some(v) => format!("aerobrake option: {v} m/s"), + None => String::new(), + }; + add_step( + &mut steps, + &mut cumulative, + format!("Land on {}", moon_body.name), + powered_dv_moon, + SegmentType::MoonLanding, + note_moon, + ); + } + } + + steps +} + +// --------------------------------------------------------------------------- +// Tests +// --------------------------------------------------------------------------- + +#[cfg(test)] +mod tests { + use super::*; + use crate::models::*; + + fn make_sanctar() -> CelestialBody { + let mut body = CelestialBody::new( + "Kerbin".to_string(), + 670_000.0, + 1.1, + true, + Some(Atmosphere { + atmosphere_depth: 72_000.0, + pressure_curve: vec![ + CurveKey { + position: 0.0, + value: 110.444, + in_tangent: 0.0, + out_tangent: -0.01793, + }, + CurveKey { + position: 3547.0, + value: 62.1074, + in_tangent: -0.01093, + out_tangent: -0.01093, + }, + ], + temperature_curve: vec![ + CurveKey { + position: 0.0, + value: 281.0, + in_tangent: 0.0, + out_tangent: -0.00536, + }, + CurveKey { + position: 72000.0, + value: 187.0, + in_tangent: 0.0, + out_tangent: 0.0, + }, + ], + molar_mass: 0.02897, + adiabatic_index: 1.4, + pressure_at_sea_level: 110.444, + temperature_at_sea_level: 281.0, + }), + None, + 90291.8, + "Sanctar".to_string(), + ); + body.is_home_world = true; + body + } + + fn make_kerbin() -> CelestialBody { + let mut body = CelestialBody::new( + "Kerbin".to_string(), + 600_000.0, + 1.0, + true, + Some(Atmosphere { + atmosphere_depth: 70_000.0, + pressure_curve: vec![ + CurveKey { + position: 0.0, + value: 101.325, + in_tangent: 0.0, + out_tangent: -0.015, + }, + CurveKey { + position: 70000.0, + value: 0.0, + in_tangent: -0.001, + out_tangent: 0.0, + }, + ], + temperature_curve: vec![ + CurveKey { + position: 0.0, + value: 288.0, + in_tangent: 0.0, + out_tangent: -0.006, + }, + CurveKey { + position: 70000.0, + value: 200.0, + in_tangent: 0.0, + out_tangent: 0.0, + }, + ], + molar_mass: 0.02897, + adiabatic_index: 1.4, + pressure_at_sea_level: 101.325, + temperature_at_sea_level: 288.0, + }), + None, + 21549.425, + "Kerbin".to_string(), + ); + body.is_home_world = true; + body + } + + fn make_airless() -> CelestialBody { + CelestialBody::new( + "Mun".to_string(), + 200_000.0, + 0.166, + false, + None, + None, + 0.0, + "Mun".to_string(), + ) + } + + #[test] + fn test_escape_velocity_sanctar() { + let body = make_sanctar(); + let v = escape_velocity(&body, 0.0); + assert!( + (v - 3802.0).abs() / 3802.0 < 0.001, + "Expected ~3802, got {v}" + ); + } + + #[test] + fn test_escape_velocity_kerbin() { + let body = make_kerbin(); + let v = escape_velocity(&body, 0.0); + assert!( + (v - 3431.0).abs() / 3431.0 < 0.002, + "Expected ~3431, got {v}" + ); + } + + #[test] + fn test_circular_velocity_sanctar_low_orbit() { + let body = make_sanctar(); + let alt = low_orbit_altitude(&body); + let v = circular_velocity(&body, alt); + assert!( + (v - 2541.1).abs() / 2541.1 < 0.01, + "Expected ~2541.1, got {v}" + ); + } + + #[test] + fn test_low_orbit_altitude_with_atmosphere() { + let body = make_sanctar(); + let alt = low_orbit_altitude(&body); + assert!( + (alt - 79200.0).abs() < 100.0, + "Expected ~79200 (72000 * 1.1), got {alt}" + ); + } + + #[test] + fn test_low_orbit_altitude_airless() { + let body = make_airless(); + let alt = low_orbit_altitude(&body); + assert!( + (alt - 10_000.0).abs() < 1.0, + "Expected ~10000 (max(200000*0.05=10000, 10000)), got {alt}" + ); + } + + #[test] + fn test_surface_density_sanctar() { + let body = make_sanctar(); + let rho = surface_density(&body).unwrap(); + assert!( + (rho - 1.4096).abs() / 1.4096 < 0.05, + "Expected ~1.4096, got {rho}" + ); + } + + #[test] + fn test_surface_density_airless() { + let body = make_airless(); + assert!(surface_density(&body).is_none()); + } + + #[test] + fn test_calculate_launch_sanctar() { + let body = make_sanctar(); + let alt = low_orbit_altitude(&body); + let result = calculate_launch(&body, alt); + assert!( + (result.total_rocket - 3110.0).abs() / 3110.0 < 0.02, + "Expected total_rocket ~3110, got {}", + result.total_rocket + ); + assert!( + (result.total_with_jets - 1982.0).abs() / 1982.0 < 0.02, + "Expected total_with_jets ~1982, got {}", + result.total_with_jets + ); + } + + #[test] + fn test_calculate_hohmann_outward() { + let body = make_sanctar(); + let result = calculate_hohmann(&body, 80_000.0, 13_116_000_574.0); + assert!(result.departure_dv > 0.0); + assert!(result.arrival_dv > 0.0); + assert!(!result.inward); + } + + #[test] + fn test_calculate_hohmann_inward() { + let body = make_sanctar(); + let result = calculate_hohmann(&body, 80_000.0, 100_000.0); + assert!(result.inward); + } + + #[test] + fn test_calculate_tsiolkovsky() { + let result = calculate_tsiolkovsky(3100.0, 310.0, 50_000.0); + assert!(result.mass_ratio > 1.0); + assert!(result.fuel_fraction > 0.0 && result.fuel_fraction < 1.0); + assert!( + (result.dry_mass + result.fuel_mass - 50_000.0).abs() < 1.0, + "dry + fuel should equal wet mass: {} + {} = {}", + result.dry_mass, + result.fuel_mass, + result.dry_mass + result.fuel_mass + ); + } + + #[test] + fn test_geostationary_altitude() { + let body = make_sanctar(); + let alt = geostationary_altitude(&body); + assert!( + alt > 0.0, + "Geostationary altitude should be positive, got {alt}" + ); + } + + #[test] + fn test_landing_dv_with_atmosphere() { + let body = make_sanctar(); + let (powered, aerobrake) = landing_dv(&body); + assert!(powered > 0.0); + assert_eq!(aerobrake, Some(0.0)); + } + + #[test] + fn test_landing_dv_airless() { + let body = make_airless(); + let (powered, aerobrake) = landing_dv(&body); + assert!(powered > 0.0); + assert!(aerobrake.is_none()); + } + + #[test] + fn test_escape_dv_from_low_orbit() { + let body = make_sanctar(); + let dv = escape_dv_from_low_orbit(&body); + assert!(dv > 0.0, "Escape dv should be positive, got {dv}"); + // Escape dv should be less than escape velocity (since we start from orbit) + let v_esc = escape_velocity(&body, 0.0); + assert!( + dv < v_esc, + "Escape dv from orbit ({dv}) should be < surface escape ({v_esc})" + ); + } + + #[test] + fn test_density_at_altitude_above_atmosphere() { + let body = make_sanctar(); + let rho = density_at_altitude(&body, 100_000.0).unwrap(); + assert!( + (rho - 0.0).abs() < 1e-10, + "Density above atmosphere should be 0, got {rho}" + ); + } + + #[test] + fn test_compute_route_third_cosmic() { + let mut home = make_sanctar(); + home.orbit = Some(OrbitalElements { + semi_major_axis: 13_116_000_574.0, + eccentricity: 0.0, + inclination: 0.0, + argument_of_periapsis: 0.0, + longitude_of_ascending_node: 0.0, + mean_anomaly_at_epoch: 0.0, + epoch: 0.0, + }); + + let parent = CelestialBody::new( + "Star".to_string(), + 261_600_000.0, + 1.0, + false, + None, + None, + 0.0, + "Star".to_string(), + ); + + let steps = compute_route(&home, &parent, None, None); + assert_eq!(steps.len(), 3, "Third cosmic velocity should have 3 steps"); + assert!(steps[0].dv > 0.0); + assert!(steps[1].dv > 0.0); + assert!(steps[2].dv > 0.0); + assert!(steps[2].cumulative > steps[1].cumulative); + } +} diff --git a/src-tauri/crates/kopdeltav/src/lib.rs b/src-tauri/crates/kopdeltav/src/lib.rs index 3031dbb..822af36 100644 --- a/src-tauri/crates/kopdeltav/src/lib.rs +++ b/src-tauri/crates/kopdeltav/src/lib.rs @@ -1,2 +1,3 @@ +pub mod calculator; pub mod models; pub mod parser; From 7ea60092209bcf380babb73e8e0ad69b48f5ebe2 Mon Sep 17 00:00:00 2001 From: Yumeno Yuuka Date: Fri, 3 Apr 2026 09:46:01 +0900 Subject: [PATCH 4/8] feat(rust): implement CelestialSystem tree and i18n translations Add system.rs with build_tree, is_barycenter, sort_by_transfer_dv, and scan_configs. Add i18n.rs with full ja/en/id translation tables and get_text/get_all_keys API with language fallback. --- src-tauri/crates/kopdeltav/src/i18n.rs | 493 +++++++++++++++++ src-tauri/crates/kopdeltav/src/lib.rs | 2 + src-tauri/crates/kopdeltav/src/system.rs | 654 +++++++++++++++++++++++ 3 files changed, 1149 insertions(+) create mode 100644 src-tauri/crates/kopdeltav/src/i18n.rs create mode 100644 src-tauri/crates/kopdeltav/src/system.rs diff --git a/src-tauri/crates/kopdeltav/src/i18n.rs b/src-tauri/crates/kopdeltav/src/i18n.rs new file mode 100644 index 0000000..387418b --- /dev/null +++ b/src-tauri/crates/kopdeltav/src/i18n.rs @@ -0,0 +1,493 @@ +//! Multilingual translation system for CLI and backend output. +//! +//! Provides translation lookup by dot-notation keys with fallback to English +//! and then to the key itself. Supports Japanese, English, and Indonesian. +//! +//! 多言語翻訳モジュール。 + +use std::collections::HashMap; + +// --------------------------------------------------------------------------- +// Constants +// --------------------------------------------------------------------------- + +/// Supported language codes. +pub const SUPPORTED_LANGUAGES: &[&str] = &["ja", "en", "id"]; + +/// Default UI language. +pub const DEFAULT_LANGUAGE: &str = "ja"; + +// --------------------------------------------------------------------------- +// Translation data +// --------------------------------------------------------------------------- + +/// Build the complete translation table for a given language. +/// +/// 指定言語の翻訳テーブルを構築する。 +fn build_translations(lang: &str) -> HashMap<&'static str, &'static str> { + match lang { + "ja" => build_ja(), + "en" => build_en(), + "id" => build_id(), + _ => HashMap::new(), + } +} + +fn build_ja() -> HashMap<&'static str, &'static str> { + let mut m = HashMap::new(); + // nav + m.insert("nav.title", "KSPDeltaVForMods"); + m.insert("nav.bodies", "天体一覧"); + // body + m.insert("body.name", "天体名"); + m.insert("body.radius", "半径"); + m.insert("body.radius_short", "半径"); + m.insert("body.mass", "質量"); + m.insert("body.gravity", "表面重力"); + m.insert("body.atmosphere", "大気"); + m.insert("body.has_atmosphere", "大気あり"); + m.insert("body.no_atmosphere", "大気なし"); + m.insert("body.has_ocean", "海洋あり"); + m.insert("body.no_ocean", "海洋なし"); + // launch + m.insert("launch.title", "低軌道投入\u{0394}V"); + m.insert("launch.orbital_velocity", "軌道速度"); + m.insert("launch.gravity_loss", "重力損失"); + m.insert("launch.drag_loss", "大気抵抗損失"); + m.insert("launch.total_ideal", "理論最小\u{0394}V"); + m.insert("launch.total_rocket", "ロケット\u{0394}V\u{ff08}実用値\u{ff09}"); + m.insert("launch.jet_savings", "ジェット節約分"); + m.insert("launch.total_with_jets", "ジェット併用\u{0394}V"); + m.insert("launch.target_altitude", "目標高度"); + m.insert("launch.geostationary", "静止軌道遷移"); + m.insert("launch.geostationary_altitude", "静止軌道高度"); + // hohmann + m.insert("hohmann.title", "ホーマン遷移"); + m.insert("hohmann.departure_dv", "出発\u{0394}V"); + m.insert("hohmann.arrival_dv", "到着\u{0394}V"); + m.insert("hohmann.total_dv", "合計\u{0394}V"); + m.insert("hohmann.transfer_time", "遷移時間"); + // tsiolkovsky + m.insert("tsiolkovsky.title", "ツィオルコフスキーの公式"); + m.insert("tsiolkovsky.mass_ratio", "質量比"); + m.insert("tsiolkovsky.fuel_fraction", "燃料割合"); + m.insert("tsiolkovsky.dry_mass", "乾燥質量"); + m.insert("tsiolkovsky.fuel_mass", "燃料質量"); + m.insert("tsiolkovsky.delta_v", "\u{0394}V"); + m.insert("tsiolkovsky.isp", "比推力"); + m.insert("tsiolkovsky.wet_mass", "湿潤質量"); + // atmosphere + m.insert("atmosphere.title", "大気プロファイル"); + m.insert("atmosphere.depth", "大気高度上限"); + m.insert("atmosphere.sea_level_pressure", "海面気圧"); + m.insert("atmosphere.sea_level_temperature", "海面温度"); + m.insert("atmosphere.sea_level_density", "海面大気密度"); + m.insert("atmosphere.molar_mass", "モル質量"); + m.insert("atmosphere.adiabatic_index", "断熱指数"); + // common + m.insert("common.calculate", "計算"); + m.insert("common.reset", "リセット"); + m.insert("common.error", "エラー"); + m.insert("common.warning", "警告"); + m.insert("common.unit_m", "m"); + m.insert("common.unit_ms", "m/s"); + m.insert("common.unit_s", "秒"); + m.insert("common.unit_kg", "kg"); + m.insert("common.unit_kgm3", "kg/m\u{b3}"); + m.insert("common.unit_kpa", "kPa"); + m.insert("common.unit_k", "K"); + // route + m.insert("route.launch", "低軌道投入"); + m.insert("route.escape", "母星脱出"); + m.insert("route.transfer", "惑星間遷移"); + m.insert("route.orbit_insertion", "軌道投入"); + m.insert("route.landing", "着陸"); + m.insert("route.moon_transfer", "衛星遷移"); + m.insert("route.moon_landing", "衛星着陸"); + m.insert("route.system_escape", "恒星系脱出"); + m.insert("route.third_cosmic", "第三宇宙速度"); + m.insert("route.powered_landing", "パワード着陸"); + m.insert("route.aerobrake_landing", "エアロブレーキ着陸"); + m.insert("route.cumulative", "累積\u{0394}V"); + m.insert("route.step", "ステップ"); + m.insert("route.dv", "\u{0394}V"); + m.insert("route.total", "合計"); + // system + m.insert("system.home_world", "母星"); + m.insert("system.star", "恒星"); + m.insert("system.planets", "惑星一覧"); + m.insert("system.moons", "衛星一覧"); + m.insert("system.select_destination", "遷移先を選択"); + m.insert("system.select_moon", "衛星を選択"); + m.insert("system.press_enter_escape", "Enterで恒星系脱出"); + m.insert("system.press_enter_land", "Enterで着陸"); + m.insert("system.no_bodies", "天体が見つかりません"); + m.insert("system.scanning", "GameDataをスキャン中..."); + // error + m.insert("error.file_not_found", "ファイルが見つかりません"); + m.insert("error.parse_error", "設定ファイルの解析に失敗しました"); + m.insert("error.no_bodies", "天体が見つかりません"); + m.insert("error.invalid_altitude", "高度は非負でなければなりません"); + m +} + +fn build_en() -> HashMap<&'static str, &'static str> { + let mut m = HashMap::new(); + // nav + m.insert("nav.title", "KSPDeltaVForMods"); + m.insert("nav.bodies", "Celestial Bodies"); + // body + m.insert("body.name", "Body Name"); + m.insert("body.radius", "Radius"); + m.insert("body.radius_short", "R"); + m.insert("body.mass", "Mass"); + m.insert("body.gravity", "Surface Gravity"); + m.insert("body.atmosphere", "Atmosphere"); + m.insert("body.has_atmosphere", "Has Atmosphere"); + m.insert("body.no_atmosphere", "No Atmosphere"); + m.insert("body.has_ocean", "Has Ocean"); + m.insert("body.no_ocean", "No Ocean"); + // launch + m.insert("launch.title", "Launch to Low Orbit \u{0394}V"); + m.insert("launch.orbital_velocity", "Orbital Velocity"); + m.insert("launch.gravity_loss", "Gravity Loss"); + m.insert("launch.drag_loss", "Drag Loss"); + m.insert("launch.total_ideal", "Theoretical Minimum \u{0394}V"); + m.insert("launch.total_rocket", "Rocket \u{0394}V (Practical)"); + m.insert("launch.jet_savings", "Jet Engine Savings"); + m.insert("launch.total_with_jets", "\u{0394}V with Jets"); + m.insert("launch.target_altitude", "Target Altitude"); + m.insert("launch.geostationary", "Geostationary Transfer"); + m.insert("launch.geostationary_altitude", "Geostationary Altitude"); + // hohmann + m.insert("hohmann.title", "Hohmann Transfer"); + m.insert("hohmann.departure_dv", "Departure \u{0394}V"); + m.insert("hohmann.arrival_dv", "Arrival \u{0394}V"); + m.insert("hohmann.total_dv", "Total \u{0394}V"); + m.insert("hohmann.transfer_time", "Transfer Time"); + // tsiolkovsky + m.insert("tsiolkovsky.title", "Tsiolkovsky Rocket Equation"); + m.insert("tsiolkovsky.mass_ratio", "Mass Ratio"); + m.insert("tsiolkovsky.fuel_fraction", "Fuel Fraction"); + m.insert("tsiolkovsky.dry_mass", "Dry Mass"); + m.insert("tsiolkovsky.fuel_mass", "Fuel Mass"); + m.insert("tsiolkovsky.delta_v", "\u{0394}V"); + m.insert("tsiolkovsky.isp", "Specific Impulse"); + m.insert("tsiolkovsky.wet_mass", "Wet Mass"); + // atmosphere + m.insert("atmosphere.title", "Atmosphere Profile"); + m.insert("atmosphere.depth", "Atmosphere Ceiling"); + m.insert("atmosphere.sea_level_pressure", "Sea Level Pressure"); + m.insert("atmosphere.sea_level_temperature", "Sea Level Temperature"); + m.insert("atmosphere.sea_level_density", "Sea Level Density"); + m.insert("atmosphere.molar_mass", "Molar Mass"); + m.insert("atmosphere.adiabatic_index", "Adiabatic Index"); + // common + m.insert("common.calculate", "Calculate"); + m.insert("common.reset", "Reset"); + m.insert("common.error", "Error"); + m.insert("common.warning", "Warning"); + m.insert("common.unit_m", "m"); + m.insert("common.unit_ms", "m/s"); + m.insert("common.unit_s", "s"); + m.insert("common.unit_kg", "kg"); + m.insert("common.unit_kgm3", "kg/m\u{b3}"); + m.insert("common.unit_kpa", "kPa"); + m.insert("common.unit_k", "K"); + // route + m.insert("route.launch", "Launch to Low Orbit"); + m.insert("route.escape", "Escape Home World"); + m.insert("route.transfer", "Interplanetary Transfer"); + m.insert("route.orbit_insertion", "Orbit Insertion"); + m.insert("route.landing", "Landing"); + m.insert("route.moon_transfer", "Moon Transfer"); + m.insert("route.moon_landing", "Moon Landing"); + m.insert("route.system_escape", "Star System Escape"); + m.insert("route.third_cosmic", "Third Cosmic Velocity"); + m.insert("route.powered_landing", "Powered Landing"); + m.insert("route.aerobrake_landing", "Aerobrake Landing"); + m.insert("route.cumulative", "Cumulative \u{0394}V"); + m.insert("route.step", "Step"); + m.insert("route.dv", "\u{0394}V"); + m.insert("route.total", "Total"); + // system + m.insert("system.home_world", "Home World"); + m.insert("system.star", "Star"); + m.insert("system.planets", "Planets"); + m.insert("system.moons", "Moons"); + m.insert("system.select_destination", "Select destination"); + m.insert("system.select_moon", "Select moon"); + m.insert("system.press_enter_escape", "Press Enter for system escape"); + m.insert("system.press_enter_land", "Press Enter to land"); + m.insert("system.no_bodies", "No celestial bodies found"); + m.insert("system.scanning", "Scanning GameData..."); + // error + m.insert("error.file_not_found", "File not found"); + m.insert("error.parse_error", "Failed to parse configuration file"); + m.insert("error.no_bodies", "No celestial bodies found"); + m.insert("error.invalid_altitude", "Altitude must be non-negative"); + m +} + +fn build_id() -> HashMap<&'static str, &'static str> { + let mut m = HashMap::new(); + // nav + m.insert("nav.title", "KSPDeltaVForMods"); + m.insert("nav.bodies", "Daftar Benda Langit"); + // body + m.insert("body.name", "Nama Benda Langit"); + m.insert("body.radius", "Radius"); + m.insert("body.radius_short", "R"); + m.insert("body.mass", "Massa"); + m.insert("body.gravity", "Gravitasi Permukaan"); + m.insert("body.atmosphere", "Atmosfer"); + m.insert("body.has_atmosphere", "Memiliki Atmosfer"); + m.insert("body.no_atmosphere", "Tanpa Atmosfer"); + m.insert("body.has_ocean", "Memiliki Lautan"); + m.insert("body.no_ocean", "Tanpa Lautan"); + // launch + m.insert("launch.title", "\u{0394}V Peluncuran ke Orbit Rendah"); + m.insert("launch.orbital_velocity", "Kecepatan Orbit"); + m.insert("launch.gravity_loss", "Kehilangan Gravitasi"); + m.insert("launch.drag_loss", "Kehilangan Hambatan Udara"); + m.insert("launch.total_ideal", "\u{0394}V Minimum Teoritis"); + m.insert("launch.total_rocket", "\u{0394}V Roket (Praktis)"); + m.insert("launch.jet_savings", "Penghematan Mesin Jet"); + m.insert("launch.total_with_jets", "\u{0394}V dengan Jet"); + m.insert("launch.target_altitude", "Ketinggian Target"); + m.insert("launch.geostationary", "Transfer Geostasioner"); + m.insert("launch.geostationary_altitude", "Ketinggian Geostasioner"); + // hohmann + m.insert("hohmann.title", "Transfer Hohmann"); + m.insert("hohmann.departure_dv", "\u{0394}V Keberangkatan"); + m.insert("hohmann.arrival_dv", "\u{0394}V Kedatangan"); + m.insert("hohmann.total_dv", "\u{0394}V Total"); + m.insert("hohmann.transfer_time", "Waktu Transfer"); + // tsiolkovsky + m.insert("tsiolkovsky.title", "Persamaan Roket Tsiolkovsky"); + m.insert("tsiolkovsky.mass_ratio", "Rasio Massa"); + m.insert("tsiolkovsky.fuel_fraction", "Fraksi Bahan Bakar"); + m.insert("tsiolkovsky.dry_mass", "Massa Kering"); + m.insert("tsiolkovsky.fuel_mass", "Massa Bahan Bakar"); + m.insert("tsiolkovsky.delta_v", "\u{0394}V"); + m.insert("tsiolkovsky.isp", "Impuls Spesifik"); + m.insert("tsiolkovsky.wet_mass", "Massa Basah"); + // atmosphere + m.insert("atmosphere.title", "Profil Atmosfer"); + m.insert("atmosphere.depth", "Batas Ketinggian Atmosfer"); + m.insert("atmosphere.sea_level_pressure", "Tekanan Permukaan Laut"); + m.insert("atmosphere.sea_level_temperature", "Suhu Permukaan Laut"); + m.insert("atmosphere.sea_level_density", "Kepadatan Permukaan Laut"); + m.insert("atmosphere.molar_mass", "Massa Molar"); + m.insert("atmosphere.adiabatic_index", "Indeks Adiabatik"); + // common + m.insert("common.calculate", "Hitung"); + m.insert("common.reset", "Atur Ulang"); + m.insert("common.error", "Kesalahan"); + m.insert("common.warning", "Peringatan"); + m.insert("common.unit_m", "m"); + m.insert("common.unit_ms", "m/s"); + m.insert("common.unit_s", "s"); + m.insert("common.unit_kg", "kg"); + m.insert("common.unit_kgm3", "kg/m\u{b3}"); + m.insert("common.unit_kpa", "kPa"); + m.insert("common.unit_k", "K"); + // route + m.insert("route.launch", "Peluncuran ke Orbit Rendah"); + m.insert("route.escape", "Lepas dari Planet Asal"); + m.insert("route.transfer", "Transfer Antarplanet"); + m.insert("route.orbit_insertion", "Penyisipan Orbit"); + m.insert("route.landing", "Pendaratan"); + m.insert("route.moon_transfer", "Transfer Bulan"); + m.insert("route.moon_landing", "Pendaratan Bulan"); + m.insert("route.system_escape", "Lepas dari Sistem Bintang"); + m.insert("route.third_cosmic", "Kecepatan Kosmis Ketiga"); + m.insert("route.powered_landing", "Pendaratan Berdaya"); + m.insert("route.aerobrake_landing", "Pendaratan Aerobrake"); + m.insert("route.cumulative", "\u{0394}V Kumulatif"); + m.insert("route.step", "Langkah"); + m.insert("route.dv", "\u{0394}V"); + m.insert("route.total", "Total"); + // system + m.insert("system.home_world", "Planet Asal"); + m.insert("system.star", "Bintang"); + m.insert("system.planets", "Planet"); + m.insert("system.moons", "Bulan"); + m.insert("system.select_destination", "Pilih tujuan"); + m.insert("system.select_moon", "Pilih bulan"); + m.insert( + "system.press_enter_escape", + "Tekan Enter untuk lepas dari sistem", + ); + m.insert("system.press_enter_land", "Tekan Enter untuk mendarat"); + m.insert("system.no_bodies", "Tidak ada benda langit ditemukan"); + m.insert("system.scanning", "Memindai GameData..."); + // error + m.insert("error.file_not_found", "Berkas tidak ditemukan"); + m.insert("error.parse_error", "Gagal mengurai berkas konfigurasi"); + m.insert("error.no_bodies", "Tidak ada benda langit ditemukan"); + m.insert("error.invalid_altitude", "Ketinggian harus non-negatif"); + m +} + +// --------------------------------------------------------------------------- +// Public API +// --------------------------------------------------------------------------- + +/// Get translated text by dot-notation key. +/// +/// 翻訳文字列を取得する。要求言語にキーがなければ英語にフォールバックし、 +/// 英語にもなければキー文字列をそのまま返す。 +/// +/// # Arguments +/// * `key` - Dot-notation key (e.g. "launch.title", "common.calculate"). +/// * `lang` - Language code ("ja", "en", or "id"). Falls back to English +/// if the key is missing in the requested language. +/// +/// # Returns +/// Translated string. Returns the key itself if not found in any language. +pub fn get_text(key: &str, lang: &str) -> String { + let effective_lang = if SUPPORTED_LANGUAGES.contains(&lang) { + lang + } else { + DEFAULT_LANGUAGE + }; + + // Key must be "category.name" format + if !key.contains('.') { + return key.to_string(); + } + + // Try requested language first + let translations = build_translations(effective_lang); + if let Some(value) = translations.get(key) { + return (*value).to_string(); + } + + // Fall back to English + if effective_lang != "en" { + let en_translations = build_translations("en"); + if let Some(value) = en_translations.get(key) { + return (*value).to_string(); + } + } + + // Key not found anywhere: return the key itself + key.to_string() +} + +/// Get all translation keys flattened to dot-notation for a language. +/// +/// 全翻訳キーをフラット化して返す。 +/// +/// # Arguments +/// * `lang` - Language code ("ja", "en", or "id"). Falls back to DEFAULT_LANGUAGE +/// if not supported. +/// +/// # Returns +/// HashMap mapping dot-notation keys to translated strings. +pub fn get_all_keys(lang: &str) -> HashMap { + let effective_lang = if SUPPORTED_LANGUAGES.contains(&lang) { + lang + } else { + DEFAULT_LANGUAGE + }; + + build_translations(effective_lang) + .into_iter() + .map(|(k, v)| (k.to_string(), v.to_string())) + .collect() +} + +// --------------------------------------------------------------------------- +// Tests +// --------------------------------------------------------------------------- + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn test_get_text_japanese() { + assert_eq!(get_text("nav.title", "ja"), "KSPDeltaVForMods"); + } + + #[test] + fn test_get_text_english() { + assert_eq!(get_text("nav.bodies", "en"), "Celestial Bodies"); + } + + #[test] + fn test_get_text_indonesian() { + assert_eq!(get_text("nav.bodies", "id"), "Daftar Benda Langit"); + } + + #[test] + fn test_get_text_fallback_to_default_then_english() { + // Unsupported lang falls back to DEFAULT_LANGUAGE ("ja") first + // "nav.title" is "KSPDeltaVForMods" in all languages + assert_eq!(get_text("nav.title", "xx"), "KSPDeltaVForMods"); + } + + #[test] + fn test_get_text_unknown_key_returns_key() { + assert_eq!(get_text("unknown.key", "en"), "unknown.key"); + } + + #[test] + fn test_get_all_keys_has_entries() { + let keys = get_all_keys("en"); + assert!(keys.contains_key("nav.title")); + assert!(keys.contains_key("launch.title")); + } + + #[test] + fn test_get_all_keys_unsupported_lang_uses_default() { + let keys = get_all_keys("xx"); + // Should fall back to Japanese (DEFAULT_LANGUAGE) + assert_eq!(keys.get("nav.bodies").unwrap(), "天体一覧"); + } + + #[test] + fn test_get_text_no_dot_returns_key() { + assert_eq!(get_text("nodotkey", "en"), "nodotkey"); + } + + #[test] + fn test_all_three_languages_have_same_keys() { + let ja_keys: Vec = get_all_keys("ja").keys().cloned().collect(); + let en_keys = get_all_keys("en"); + let id_keys = get_all_keys("id"); + for key in &ja_keys { + assert!( + en_keys.contains_key(key), + "English missing key: {}", + key + ); + assert!( + id_keys.contains_key(key), + "Indonesian missing key: {}", + key + ); + } + } + + #[test] + fn test_japanese_specific_values() { + assert_eq!(get_text("common.calculate", "ja"), "計算"); + assert_eq!(get_text("common.reset", "ja"), "リセット"); + assert_eq!(get_text("hohmann.title", "ja"), "ホーマン遷移"); + } + + #[test] + fn test_english_specific_values() { + assert_eq!(get_text("common.calculate", "en"), "Calculate"); + assert_eq!(get_text("hohmann.title", "en"), "Hohmann Transfer"); + } + + #[test] + fn test_indonesian_specific_values() { + assert_eq!(get_text("common.calculate", "id"), "Hitung"); + assert_eq!(get_text("hohmann.title", "id"), "Transfer Hohmann"); + } +} diff --git a/src-tauri/crates/kopdeltav/src/lib.rs b/src-tauri/crates/kopdeltav/src/lib.rs index 822af36..a238ed8 100644 --- a/src-tauri/crates/kopdeltav/src/lib.rs +++ b/src-tauri/crates/kopdeltav/src/lib.rs @@ -1,3 +1,5 @@ pub mod calculator; +pub mod i18n; pub mod models; pub mod parser; +pub mod system; diff --git a/src-tauri/crates/kopdeltav/src/system.rs b/src-tauri/crates/kopdeltav/src/system.rs new file mode 100644 index 0000000..1226c12 --- /dev/null +++ b/src-tauri/crates/kopdeltav/src/system.rs @@ -0,0 +1,654 @@ +//! Celestial system tree construction and GameData config scanning. +//! +//! Builds parent/children relationships from a flat list of parsed bodies, +//! identifies root star and home world, computes SOI, and provides +//! transfer-DV sorting and GameData directory scanning. +//! +//! 天体ツリーの構築と GameData/ の .cfg ファイルスキャンを提供する。 + +use std::collections::HashMap; +use std::path::Path; + +use crate::calculator::calculate_hohmann; +use crate::models::CelestialBody; +use crate::parser::parse_bodies_with_filename; + +// --------------------------------------------------------------------------- +// CelestialSystem +// --------------------------------------------------------------------------- + +/// A fully linked tree of celestial bodies parsed from Kopernicus configs. +/// +/// Kopernicus 設定からパースされた天体の完全なツリー構造。 +pub struct CelestialSystem { + /// Internal name of the root star (top of the hierarchy). + pub root_name: String, + /// Flat name -> body lookup for O(1) access. + pub bodies: HashMap, + /// Internal name of the home world body. + pub home_world_name: String, +} + +// --------------------------------------------------------------------------- +// Barycenter detection +// --------------------------------------------------------------------------- + +/// Heuristic: detect if a body is likely a system barycenter. +/// +/// 天体がバリセンタ(重心)かどうかをヒューリスティクスで判定する。 +/// +/// A body is treated as a barycenter when it has children and its +/// radius is smaller than the smallest child's radius. +/// +/// # Arguments +/// * `body` - The body to check. +/// * `bodies` - All bodies in the system, for child lookup. +/// +/// # Returns +/// `true` if the body is likely a barycenter. +pub fn is_barycenter(body: &CelestialBody, bodies: &HashMap) -> bool { + if body.children_names.is_empty() { + return false; + } + let min_child_radius = body + .children_names + .iter() + .filter_map(|name| bodies.get(name)) + .map(|c| c.radius) + .fold(f64::INFINITY, f64::min); + + if min_child_radius == f64::INFINITY { + // No children resolved in the map + return false; + } + body.radius < min_child_radius +} + +// --------------------------------------------------------------------------- +// Body completeness scoring (deduplication) +// --------------------------------------------------------------------------- + +/// Score how complete a body's data is, for deduplication priority. +/// +/// 天体データの完全度をスコア化する(重複排除の優先度判定用)。 +fn body_completeness(body: &CelestialBody) -> i32 { + let mut score = 0; + if body.is_home_world { + score += 100; + } + if body.orbit.is_some() { + score += 10; + } + if !body.reference_body_name.is_empty() { + score += 5; + } + if body.atmosphere.is_some() { + score += 3; + } + if body.radius > 0.0 { + score += 1; + } + score +} + +// --------------------------------------------------------------------------- +// Tree construction +// --------------------------------------------------------------------------- + +/// Build a parent/children tree from a flat list of bodies. +/// +/// フラットな天体リストから親子関係ツリーを構築する。 +/// +/// Steps: +/// 1. Deduplicate by name (prefer more complete: is_home_world > has orbit > has reference_body_name). +/// 2. Link parent_name / children_names using reference_body_name. +/// 3. Find root (no orbit, no reference_body_name, has children). +/// 4. Find home world (is_home_world=true; fallback: Kerbin-like > has ocean > has atmosphere). +/// 5. Compute SOI where soi == 0: `soi = a * (mu_body / mu_parent)^0.4`. +/// +/// # Arguments +/// * `bodies` - Flat list of `CelestialBody` objects (e.g. from `parse_bodies`). +/// +/// # Returns +/// A fully linked `CelestialSystem`, or an error if the list is empty or no root found. +/// +/// # Errors +/// Returns `Err` if `bodies` is empty. +pub fn build_tree(bodies: Vec) -> Result { + if bodies.is_empty() { + return Err("Cannot build tree from an empty body list".to_string()); + } + + // Step 1: deduplicate by name, preferring the most complete version. + let mut index: HashMap = HashMap::new(); + for body in bodies { + let name = body.name.clone(); + if let Some(existing) = index.get(&name) { + if body_completeness(&body) > body_completeness(existing) { + index.insert(name, body); + } + } else { + index.insert(name, body); + } + } + + // Reset parent/children to avoid stale links. + for body in index.values_mut() { + body.parent_name = None; + body.children_names.clear(); + } + + // Step 2: link parent/children using reference_body_name. + // Collect linkage info first to satisfy borrow checker. + let links: Vec<(String, String)> = index + .values() + .filter(|b| !b.reference_body_name.is_empty()) + .map(|b| (b.name.clone(), b.reference_body_name.clone())) + .collect(); + + for (child_name, parent_name) in &links { + if !index.contains_key(parent_name) { + eprintln!( + "system warning: body '{}' references unknown referenceBody '{}'", + child_name, parent_name + ); + continue; + } + // Set parent_name on child + if let Some(child) = index.get_mut(child_name) { + child.parent_name = Some(parent_name.clone()); + } + // Add child to parent's children_names + if let Some(parent) = index.get_mut(parent_name) { + if !parent.children_names.contains(child_name) { + parent.children_names.push(child_name.clone()); + } + } + } + + // Step 3: find root. + // Primary: body with no orbit AND no reference_body_name AND has children. + let mut root_name: Option = None; + + let candidates: Vec = index + .values() + .filter(|b| b.orbit.is_none() && b.reference_body_name.is_empty()) + .map(|b| b.name.clone()) + .collect(); + + if !candidates.is_empty() { + let with_children: Vec<&String> = candidates + .iter() + .filter(|name| { + index + .get(name.as_str()) + .is_some_and(|b| !b.children_names.is_empty()) + }) + .collect(); + root_name = Some(if !with_children.is_empty() { + with_children[0].clone() + } else { + candidates[0].clone() + }); + } + + // Fallback: body with no parent link after tree construction, that has children. + if root_name.is_none() { + let orphans: Vec = index + .values() + .filter(|b| b.parent_name.is_none() && !b.children_names.is_empty()) + .map(|b| b.name.clone()) + .collect(); + if !orphans.is_empty() { + root_name = Some(orphans[0].clone()); + } + } + + // Last resort: first body in the map + let root_name = root_name.unwrap_or_else(|| { + let first = index.keys().next().expect("index is non-empty"); + eprintln!( + "system warning: cannot determine root; defaulting to '{}'", + first + ); + first.clone() + }); + + // Step 4: home world. + let mut home_world_name: Option = None; + for body in index.values() { + if body.is_home_world { + home_world_name = Some(body.name.clone()); + break; + } + } + + if home_world_name.is_none() { + // Fallback: pick the best candidate using a heuristic score. + let best = index + .values() + .max_by_key(|b| { + let mut score: i32 = 0; + if b.name.trim().eq_ignore_ascii_case("kerbin") { + score += 100; + } + if b.has_ocean { + score += 50; + } + if b.atmosphere.is_some() { + score += 30; + } + if b.rotational_period > 0.0 { + score += 10; + } + if b.orbit.is_some() { + score += 5; + } + if b.parent_name.is_some() { + score += 2; + } + score + }) + .expect("index is non-empty"); + + home_world_name = Some(best.name.clone()); + eprintln!( + "system warning: no body declares isHomeWorld=true; falling back to '{}' as home world", + best.name + ); + + // Mark it as home world + if let Some(body) = index.get_mut(&home_world_name.clone().unwrap()) { + body.is_home_world = true; + } + } + + let home_world_name = home_world_name.expect("home world resolved above"); + + // Step 5: compute SOI where soi == 0. + // Collect (name, soi) pairs to assign, to satisfy borrow checker. + let soi_updates: Vec<(String, f64)> = index + .values() + .filter_map(|body| { + if body.soi != 0.0 || body.parent_name.is_none() || body.orbit.is_none() { + return None; + } + let parent_name = body.parent_name.as_ref()?; + let parent = index.get(parent_name)?; + let a = body.orbit.as_ref()?.semi_major_axis; + let mu_body = body.mu; + let mu_parent = parent.mu; + if mu_parent > 0.0 && a > 0.0 { + let soi = a * (mu_body / mu_parent).powf(0.4); + Some((body.name.clone(), soi)) + } else { + None + } + }) + .collect(); + + for (name, soi) in soi_updates { + if let Some(body) = index.get_mut(&name) { + body.soi = soi; + } + } + + Ok(CelestialSystem { + root_name, + bodies: index, + home_world_name, + }) +} + +// --------------------------------------------------------------------------- +// Transfer DV sorting +// --------------------------------------------------------------------------- + +/// Sort sibling bodies by Hohmann transfer DV from origin, ascending. +/// +/// origin からのホーマン遷移 DV 昇順でターゲット天体をソートする。 +/// +/// The origin must orbit a parent body. Siblings of origin (other children of the +/// same parent) are sorted by their Hohmann transfer DV. +/// +/// # Arguments +/// * `origin_name` - Name of the departure body. +/// * `bodies` - All bodies in the system. +/// +/// # Returns +/// List of `(target_name, total_dv)` tuples sorted ascending by total_dv. +/// Bodies that cannot be evaluated are omitted. +pub fn sort_by_transfer_dv( + origin_name: &str, + bodies: &HashMap, +) -> Vec<(String, f64)> { + let origin = match bodies.get(origin_name) { + Some(b) => b, + None => return Vec::new(), + }; + + let origin_orbit = match &origin.orbit { + Some(o) => o, + None => return Vec::new(), + }; + + let parent_name = match &origin.parent_name { + Some(n) => n.clone(), + None => return Vec::new(), + }; + + let parent = match bodies.get(&parent_name) { + Some(p) => p, + None => return Vec::new(), + }; + + // Collect siblings (other children of the same parent) + let siblings: Vec = parent + .children_names + .iter() + .filter(|n| n.as_str() != origin_name) + .cloned() + .collect(); + + let origin_sma = origin_orbit.semi_major_axis; + + let mut results: Vec<(String, f64)> = Vec::new(); + for sibling_name in &siblings { + let sibling = match bodies.get(sibling_name) { + Some(s) => s, + None => continue, + }; + let target_sma = match &sibling.orbit { + Some(o) => o.semi_major_axis, + None => continue, + }; + + let parking_altitude = origin_sma - parent.radius; + if parking_altitude < 0.0 { + continue; + } + + let hohmann = calculate_hohmann(parent, parking_altitude, target_sma); + results.push((sibling_name.clone(), hohmann.total_dv)); + } + + results.sort_by(|a, b| a.1.partial_cmp(&b.1).unwrap_or(std::cmp::Ordering::Equal)); + results +} + +// --------------------------------------------------------------------------- +// GameData config scanner +// --------------------------------------------------------------------------- + +/// Recursively scan a GameData directory for Kopernicus `.cfg` files and build a tree. +/// +/// GameData/ ディレクトリを再帰スキャンし、Kopernicus 設定から天体ツリーを構築する。 +/// +/// All `.cfg` files are read. Directories whose lowercase names appear in +/// `exclude_dirs` are skipped entirely (default: `["kopernicus"]`). +/// +/// # Arguments +/// * `gamedata_path` - Path to the `GameData/` directory. +/// * `exclude_dirs` - Directory names (lowercase) to skip during scan. +/// +/// # Returns +/// A `CelestialSystem` built from all bodies found, or an error. +/// +/// # Errors +/// Returns `Err` if the path is not a directory, no bodies are found, or tree construction fails. +pub fn scan_configs( + gamedata_path: &str, + exclude_dirs: &[String], +) -> Result { + let path = Path::new(gamedata_path); + if !path.is_dir() { + return Err(format!( + "gamedata_path is not an existing directory: {}", + gamedata_path + )); + } + + let cfg_files = iter_cfgs(path, exclude_dirs); + let mut all_bodies: Vec = Vec::new(); + + for cfg_path in &cfg_files { + let source = match std::fs::read_to_string(cfg_path) { + Ok(s) => s, + Err(e) => { + eprintln!("system warning: cannot read '{}': {}", cfg_path.display(), e); + continue; + } + }; + + let filename = cfg_path + .file_stem() + .and_then(|s| s.to_str()) + .unwrap_or(""); + let bodies = parse_bodies_with_filename(&source, filename); + if bodies.is_empty() { + continue; + } + + all_bodies.extend(bodies); + } + + if all_bodies.is_empty() { + return Err(format!( + "No celestial bodies found under '{}'", + gamedata_path + )); + } + + build_tree(all_bodies) +} + +/// Recursively collect .cfg files under a directory, skipping excluded dirs. +/// +/// ディレクトリ以下の .cfg ファイルを再帰的に収集する。 +fn iter_cfgs(directory: &Path, exclude_dirs: &[String]) -> Vec { + let mut results = Vec::new(); + + let entries = match std::fs::read_dir(directory) { + Ok(e) => e, + Err(e) => { + eprintln!( + "system warning: cannot list directory '{}': {}", + directory.display(), + e + ); + return results; + } + }; + + let mut sorted_entries: Vec = entries + .filter_map(|e| e.ok()) + .map(|e| e.path()) + .collect(); + sorted_entries.sort(); + + for entry in &sorted_entries { + if entry.is_dir() { + let dir_name = entry + .file_name() + .and_then(|s| s.to_str()) + .unwrap_or("") + .to_lowercase(); + if exclude_dirs.iter().any(|ex| ex.to_lowercase() == dir_name) { + continue; + } + results.extend(iter_cfgs(entry, exclude_dirs)); + } else if entry.is_file() { + let ext = entry + .extension() + .and_then(|s| s.to_str()) + .unwrap_or("") + .to_lowercase(); + if ext == "cfg" { + results.push(entry.clone()); + } + } + } + + results +} + +// --------------------------------------------------------------------------- +// Tests +// --------------------------------------------------------------------------- + +#[cfg(test)] +mod tests { + use super::*; + use crate::models::*; + + fn make_star() -> CelestialBody { + CelestialBody::new( + "Sun".to_string(), + 261_600_000.0, + 1.75, + false, + None, + None, + 0.0, + "Sun".to_string(), + ) + } + + fn make_planet(name: &str, ref_body: &str) -> CelestialBody { + let mut body = CelestialBody::new( + name.to_string(), + 600_000.0, + 1.0, + true, + None, + Some(OrbitalElements { + semi_major_axis: 13_599_840_256.0, + eccentricity: 0.0, + inclination: 0.0, + argument_of_periapsis: 0.0, + longitude_of_ascending_node: 0.0, + mean_anomaly_at_epoch: 0.0, + epoch: 0.0, + }), + 21549.0, + name.to_string(), + ); + body.reference_body_name = ref_body.to_string(); + body + } + + #[test] + fn test_build_tree_basic() { + let star = make_star(); + let mut planet = make_planet("Kerbin", "Sun"); + planet.is_home_world = true; + let system = build_tree(vec![star, planet]).unwrap(); + assert_eq!(system.root_name, "Sun"); + assert_eq!(system.home_world_name, "Kerbin"); + let kerbin = &system.bodies["Kerbin"]; + assert_eq!(kerbin.parent_name, Some("Sun".to_string())); + let sun = &system.bodies["Sun"]; + assert!(sun.children_names.contains(&"Kerbin".to_string())); + } + + #[test] + fn test_build_tree_empty_fails() { + assert!(build_tree(vec![]).is_err()); + } + + #[test] + fn test_build_tree_soi_computation() { + let star = make_star(); + let mut planet = make_planet("Kerbin", "Sun"); + planet.is_home_world = true; + let system = build_tree(vec![star, planet]).unwrap(); + let kerbin = &system.bodies["Kerbin"]; + assert!(kerbin.soi > 0.0); + } + + #[test] + fn test_build_tree_dedup() { + let star = make_star(); + let p1 = make_planet("Kerbin", "Sun"); + let mut p2 = make_planet("Kerbin", "Sun"); + p2.is_home_world = true; + let system = build_tree(vec![star, p1, p2]).unwrap(); + // p2 should win (is_home_world = true) + assert_eq!(system.home_world_name, "Kerbin"); + } + + #[test] + fn test_is_barycenter() { + let mut parent = make_star(); + parent.radius = 100.0; // tiny + parent.name = "Tiny".to_string(); + parent.children_names = vec!["Big".to_string()]; + let mut child = make_planet("Big", "Tiny"); + child.radius = 600_000.0; + let mut bodies = HashMap::new(); + bodies.insert("Tiny".to_string(), parent); + bodies.insert("Big".to_string(), child); + assert!(is_barycenter(&bodies["Tiny"], &bodies)); + assert!(!is_barycenter(&bodies["Big"], &bodies)); + } + + #[test] + fn test_home_world_fallback() { + // No body has is_home_world = true; the one with ocean/atmosphere should win. + let star = make_star(); + let mut planet = make_planet("Kerbin", "Sun"); + // Don't set is_home_world; the heuristic should still pick Kerbin by name. + planet.is_home_world = false; + let system = build_tree(vec![star, planet]).unwrap(); + assert_eq!(system.home_world_name, "Kerbin"); + assert!(system.bodies["Kerbin"].is_home_world); + } + + #[test] + fn test_sort_by_transfer_dv_basic() { + let mut star = make_star(); + star.children_names = vec!["Inner".to_string(), "Outer".to_string()]; + + let mut inner = make_planet("Inner", "Sun"); + inner.is_home_world = true; + inner.orbit = Some(OrbitalElements { + semi_major_axis: 10_000_000_000.0, + eccentricity: 0.0, + inclination: 0.0, + argument_of_periapsis: 0.0, + longitude_of_ascending_node: 0.0, + mean_anomaly_at_epoch: 0.0, + epoch: 0.0, + }); + inner.parent_name = Some("Sun".to_string()); + + let mut outer = make_planet("Outer", "Sun"); + outer.orbit = Some(OrbitalElements { + semi_major_axis: 20_000_000_000.0, + eccentricity: 0.0, + inclination: 0.0, + argument_of_periapsis: 0.0, + longitude_of_ascending_node: 0.0, + mean_anomaly_at_epoch: 0.0, + epoch: 0.0, + }); + outer.parent_name = Some("Sun".to_string()); + + let mut bodies = HashMap::new(); + bodies.insert("Sun".to_string(), star); + bodies.insert("Inner".to_string(), inner); + bodies.insert("Outer".to_string(), outer); + + let result = sort_by_transfer_dv("Inner", &bodies); + assert_eq!(result.len(), 1); + assert_eq!(result[0].0, "Outer"); + assert!(result[0].1 > 0.0); + } + + #[test] + fn test_sort_by_transfer_dv_no_orbit() { + let bodies: HashMap = HashMap::new(); + let result = sort_by_transfer_dv("Missing", &bodies); + assert!(result.is_empty()); + } +} From 6b0bcf9c68a71336218d80d68e420133e6970659 Mon Sep 17 00:00:00 2001 From: Yumeno Yuuka Date: Fri, 3 Apr 2026 09:52:17 +0900 Subject: [PATCH 5/8] feat(tauri): implement native commands, remove Python subprocess Replace the Python subprocess spawning architecture with native Rust Tauri commands that directly call the kopdeltav crate. Add state.rs for shared AppState (bodies + system tree) and commands.rs with 13 IPC handlers covering health, config upload, GameData scan, body listing/detail, launch/hohmann/tsiolkovsky calculations, system tree, destinations, route planning, atmosphere profiles, and moon queries. Remove tauri-plugin-shell dependency and Python resource bundling from tauri.conf.json. --- src-tauri/Cargo.lock | 130 ------- src-tauri/Cargo.toml | 1 - src-tauri/src/commands.rs | 693 ++++++++++++++++++++++++++++++++++++++ src-tauri/src/main.rs | 61 ++-- src-tauri/src/state.rs | 32 ++ src-tauri/tauri.conf.json | 12 +- 6 files changed, 747 insertions(+), 182 deletions(-) create mode 100644 src-tauri/src/commands.rs create mode 100644 src-tauri/src/state.rs diff --git a/src-tauri/Cargo.lock b/src-tauri/Cargo.lock index 5226587..8d1b63d 100644 --- a/src-tauri/Cargo.lock +++ b/src-tauri/Cargo.lock @@ -697,15 +697,6 @@ version = "1.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4ef6b89e5b37196644d8796de5268852ff179b44e96276cf4290264843743bb7" -[[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 = "equivalent" version = "1.0.2" @@ -723,16 +714,6 @@ dependencies = [ "typeid", ] -[[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 = "fastrand" version = "2.3.0" @@ -1562,25 +1543,6 @@ dependencies = [ "serde", ] -[[package]] -name = "is-docker" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "928bae27f42bc99b60d9ac7334e3a21d10ad8f1835a4e12ec3ec0464765ed1b3" -dependencies = [ - "once_cell", -] - -[[package]] -name = "is-wsl" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "173609498df190136aa7dea1a91db051746d339e18476eed5ca40521f02d7aa5" -dependencies = [ - "is-docker", - "once_cell", -] - [[package]] name = "itoa" version = "1.0.18" @@ -1716,7 +1678,6 @@ dependencies = [ "tauri", "tauri-build", "tauri-plugin-dialog", - "tauri-plugin-shell", ] [[package]] @@ -2126,34 +2087,12 @@ version = "1.21.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9f7c3e4beb33f85d45ae3e3a1792185706c8e16d043238c593331cc7cd313b50" -[[package]] -name = "open" -version = "5.3.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "43bb73a7fa3799b198970490a51174027ba0d4ec504b03cd08caf513d40024bc" -dependencies = [ - "dunce", - "is-wsl", - "libc", - "pathdiff", -] - [[package]] name = "option-ext" version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "04744f49eae99ab78e0d5c0b603ab218f515ea8cfe5a456d7629ad883a3b6e7d" -[[package]] -name = "os_pipe" -version = "1.2.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7d8fae84b431384b68627d0f9b3b1245fcf9f46f6c0e3dc902e9dce64edd1967" -dependencies = [ - "libc", - "windows-sys 0.61.2", -] - [[package]] name = "pango" version = "0.18.3" @@ -2202,12 +2141,6 @@ dependencies = [ "windows-link 0.2.1", ] -[[package]] -name = "pathdiff" -version = "0.2.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "df94ce210e5bc13cb6651479fa48d14f601d9858cfe0467f43ae157023b938d3" - [[package]] name = "percent-encoding" version = "2.3.2" @@ -3103,54 +3036,12 @@ dependencies = [ "digest", ] -[[package]] -name = "shared_child" -version = "1.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e362d9935bc50f019969e2f9ecd66786612daae13e8f277be7bfb66e8bed3f7" -dependencies = [ - "libc", - "sigchld", - "windows-sys 0.60.2", -] - [[package]] name = "shlex" version = "1.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64" -[[package]] -name = "sigchld" -version = "0.2.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "47106eded3c154e70176fc83df9737335c94ce22f821c32d17ed1db1f83badb1" -dependencies = [ - "libc", - "os_pipe", - "signal-hook", -] - -[[package]] -name = "signal-hook" -version = "0.3.18" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d881a16cf4426aa584979d30bd82cb33429027e42122b169753d6ef1085ed6e2" -dependencies = [ - "libc", - "signal-hook-registry", -] - -[[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 = "simd-adler32" version = "0.3.9" @@ -3592,27 +3483,6 @@ dependencies = [ "url", ] -[[package]] -name = "tauri-plugin-shell" -version = "2.3.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8457dbf9e2bab1edd8df22bb2c20857a59a9868e79cb3eac5ed639eec4d0c73b" -dependencies = [ - "encoding_rs", - "log", - "open", - "os_pipe", - "regex", - "schemars 0.8.22", - "serde", - "serde_json", - "shared_child", - "tauri", - "tauri-plugin", - "thiserror 2.0.18", - "tokio", -] - [[package]] name = "tauri-runtime" version = "2.10.1" diff --git a/src-tauri/Cargo.toml b/src-tauri/Cargo.toml index 1433353..7ff0c0c 100644 --- a/src-tauri/Cargo.toml +++ b/src-tauri/Cargo.toml @@ -12,7 +12,6 @@ tauri-build = { version = "2", features = [] } [dependencies] kopdeltav = { path = "crates/kopdeltav" } tauri = { version = "2", features = [] } -tauri-plugin-shell = "2" tauri-plugin-dialog = "2" serde = { version = "1", features = ["derive"] } serde_json = "1" diff --git a/src-tauri/src/commands.rs b/src-tauri/src/commands.rs new file mode 100644 index 0000000..4b686d6 --- /dev/null +++ b/src-tauri/src/commands.rs @@ -0,0 +1,693 @@ +//! Tauri command handlers that bridge the frontend to the kopdeltav crate. +//! +//! Each command locks the shared `ManagedState`, delegates to kopdeltav functions, +//! and returns `Result` for Tauri IPC compatibility. +//! +//! Tauri コマンドハンドラ。フロントエンドと kopdeltav クレートの橋渡し。 + +use serde::Serialize; +use std::collections::HashMap; + +use kopdeltav::calculator::{ + calculate_hohmann, calculate_launch, calculate_tsiolkovsky, circular_velocity, compute_route, + density_at_altitude, escape_dv_from_low_orbit, geostationary_altitude, geostationary_dv, + landing_dv, low_orbit_altitude, surface_density, +}; +use kopdeltav::models::{hermite_interp, CelestialBody}; +use kopdeltav::parser::parse_bodies; +use kopdeltav::system::{build_tree, scan_configs, sort_by_transfer_dv}; + +use crate::state::ManagedState; + +// --------------------------------------------------------------------------- +// Response types +// --------------------------------------------------------------------------- + +/// Summary representation of a celestial body for list views. +#[derive(Serialize)] +pub struct BodySummary { + pub name: String, + pub display_name: String, + pub radius: f64, + pub gee_asl: f64, + pub has_atmosphere: bool, + pub has_ocean: bool, +} + +/// Orbital elements response matching TypeScript interfaces. +#[derive(Serialize)] +pub struct OrbitResponse { + pub semi_major_axis: f64, + pub eccentricity: f64, + pub inclination: f64, + pub argument_of_periapsis: f64, + pub longitude_of_ascending_node: f64, + pub mean_anomaly_at_epoch: f64, + pub epoch: f64, +} + +/// Atmosphere summary response. +#[derive(Serialize)] +pub struct AtmosphereResponse { + pub atmosphere_depth: f64, + pub pressure_at_sea_level: f64, + pub temperature_at_sea_level: f64, + pub molar_mass: f64, + pub adiabatic_index: f64, + pub sea_level_density: Option, +} + +/// Detailed celestial body response. +#[derive(Serialize)] +pub struct BodyDetail { + pub name: String, + pub display_name: String, + pub radius: f64, + pub gee_asl: f64, + pub mu: f64, + pub has_ocean: bool, + pub rotational_period: f64, + pub soi: f64, + pub atmosphere: Option, + pub orbit: Option, +} + +/// Launch-to-orbit calculation response. +#[derive(Serialize)] +pub struct LaunchResponse { + pub orbital_velocity: f64, + pub gravity_loss: f64, + pub drag_loss: f64, + pub total_ideal: f64, + pub total_rocket: f64, + pub jet_savings: f64, + pub total_with_jets: f64, +} + +/// Hohmann transfer calculation response. +#[derive(Serialize)] +pub struct HohmannResponse { + pub departure_dv: f64, + pub arrival_dv: f64, + pub total_dv: f64, + pub transfer_time: f64, + pub inward: bool, +} + +/// Tsiolkovsky equation response. +#[derive(Serialize)] +pub struct TsiolkovskyResponse { + pub mass_ratio: f64, + pub fuel_fraction: f64, + pub dry_mass: f64, + pub fuel_mass: f64, +} + +/// Config upload/scan result. +#[derive(Serialize)] +pub struct UploadResponse { + pub bodies_added: Vec, + pub count: usize, +} + +/// A node in the celestial body tree for hierarchical display. +#[derive(Serialize)] +pub struct BodyTreeNode { + pub name: String, + pub display_name: String, + pub children: Vec, +} + +/// Full celestial system response. +#[derive(Serialize)] +pub struct SystemResponse { + pub root: BodySummary, + pub home_world: BodyDetail, + pub body_count: usize, + pub tree: Vec, +} + +/// A destination body with its transfer delta-V. +#[derive(Serialize)] +pub struct DestinationEntry { + pub body: BodySummary, + pub transfer_dv: f64, +} + +/// A single step in a delta-V route. +#[derive(Serialize)] +pub struct DvStepResponse { + pub label: String, + pub dv: f64, + pub cumulative: f64, + pub note: String, +} + +/// Full route response. +#[derive(Serialize)] +pub struct RouteResponse { + pub steps: Vec, + pub total_powered: f64, + pub total_aerobrake: Option, +} + +/// Atmosphere profile sampled at regular altitude intervals. +#[derive(Serialize)] +pub struct AtmoProfileResponse { + pub altitude: Vec, + pub pressure: Vec, + pub temperature: Vec, + pub density: Vec, +} + +// --------------------------------------------------------------------------- +// Conversion helpers +// --------------------------------------------------------------------------- + +/// Convert a `CelestialBody` to a `BodySummary`. +fn body_to_summary(body: &CelestialBody) -> BodySummary { + BodySummary { + name: body.name.clone(), + display_name: body.display_name.clone(), + radius: body.radius, + gee_asl: body.gee_asl, + has_atmosphere: body.has_atmosphere(), + has_ocean: body.has_ocean, + } +} + +/// Convert a `CelestialBody` to a `BodyDetail`. +fn body_to_detail(body: &CelestialBody) -> BodyDetail { + let atmosphere = body.atmosphere.as_ref().map(|atmo| { + let sea_level_density = surface_density(body); + AtmosphereResponse { + atmosphere_depth: atmo.atmosphere_depth, + pressure_at_sea_level: atmo.pressure_at_sea_level, + temperature_at_sea_level: atmo.temperature_at_sea_level, + molar_mass: atmo.molar_mass, + adiabatic_index: atmo.adiabatic_index, + sea_level_density, + } + }); + + let orbit = body.orbit.as_ref().map(|o| OrbitResponse { + semi_major_axis: o.semi_major_axis, + eccentricity: o.eccentricity, + inclination: o.inclination, + argument_of_periapsis: o.argument_of_periapsis, + longitude_of_ascending_node: o.longitude_of_ascending_node, + mean_anomaly_at_epoch: o.mean_anomaly_at_epoch, + epoch: o.epoch, + }); + + BodyDetail { + name: body.name.clone(), + display_name: body.display_name.clone(), + radius: body.radius, + gee_asl: body.gee_asl, + mu: body.mu, + has_ocean: body.has_ocean, + rotational_period: body.rotational_period, + soi: body.soi, + atmosphere, + orbit, + } +} + +/// Build a tree node recursively from the body map. +fn build_tree_node(name: &str, bodies: &HashMap) -> Option { + let body = bodies.get(name)?; + let children = body + .children_names + .iter() + .filter_map(|child_name| build_tree_node(child_name, bodies)) + .collect(); + Some(BodyTreeNode { + name: body.name.clone(), + display_name: body.display_name.clone(), + children, + }) +} + +/// Try to rebuild the system tree from current bodies and store it in state. +/// Returns the list of body names added. +fn rebuild_system( + bodies: &HashMap, +) -> Option { + if bodies.is_empty() { + return None; + } + let body_list: Vec = bodies.values().cloned().collect(); + build_tree(body_list).ok() +} + +// --------------------------------------------------------------------------- +// Commands +// --------------------------------------------------------------------------- + +/// Health check endpoint. +#[tauri::command] +pub fn health() -> serde_json::Value { + serde_json::json!({"status": "ok"}) +} + +/// Upload and parse a Kopernicus config string, adding bodies to state. +#[tauri::command] +pub fn upload_config( + file_content: String, + state: tauri::State<'_, ManagedState>, +) -> Result { + let mut app = state.lock().map_err(|e| e.to_string())?; + let parsed = parse_bodies(&file_content); + if parsed.is_empty() { + return Err("No celestial bodies found in config".to_string()); + } + + let mut added: Vec = Vec::new(); + for body in parsed { + added.push(body.name.clone()); + app.bodies.insert(body.name.clone(), body); + } + + // Try rebuilding the system tree + app.system = rebuild_system(&app.bodies); + + let count = added.len(); + Ok(UploadResponse { + bodies_added: added, + count, + }) +} + +/// Scan a GameData directory for Kopernicus configs and replace state entirely. +#[tauri::command] +pub fn scan_gamedata( + path: String, + exclude: Vec, + state: tauri::State<'_, ManagedState>, +) -> Result { + let system = scan_configs(&path, &exclude)?; + + let added: Vec = system.bodies.keys().cloned().collect(); + let count = added.len(); + + let mut app = state.lock().map_err(|e| e.to_string())?; + app.bodies = system.bodies.clone(); + app.system = Some(system); + + Ok(UploadResponse { + bodies_added: added, + count, + }) +} + +/// List all loaded celestial bodies as summaries. +#[tauri::command] +pub fn list_bodies( + _lang: Option, + state: tauri::State<'_, ManagedState>, +) -> Result, String> { + let app = state.lock().map_err(|e| e.to_string())?; + let mut summaries: Vec = app.bodies.values().map(body_to_summary).collect(); + summaries.sort_by(|a, b| a.name.cmp(&b.name)); + Ok(summaries) +} + +/// Get detailed information for a specific celestial body. +#[tauri::command] +pub fn get_body( + name: String, + _lang: Option, + state: tauri::State<'_, ManagedState>, +) -> Result { + let app = state.lock().map_err(|e| e.to_string())?; + let body = app + .bodies + .get(&name) + .ok_or_else(|| format!("Body not found: {}", name))?; + Ok(body_to_detail(body)) +} + +/// Calculate launch-to-orbit delta-V for a body. +#[tauri::command] +pub fn calc_launch( + body_name: String, + target_altitude: f64, + state: tauri::State<'_, ManagedState>, +) -> Result { + let app = state.lock().map_err(|e| e.to_string())?; + let body = app + .bodies + .get(&body_name) + .ok_or_else(|| format!("Body not found: {}", body_name))?; + + if target_altitude < 0.0 { + return Err("Target altitude must be non-negative".to_string()); + } + + let result = calculate_launch(body, target_altitude); + Ok(LaunchResponse { + orbital_velocity: result.orbital_velocity, + gravity_loss: result.gravity_loss, + drag_loss: result.drag_loss, + total_ideal: result.total_ideal, + total_rocket: result.total_rocket, + jet_savings: result.jet_savings, + total_with_jets: result.total_with_jets, + }) +} + +/// Calculate Hohmann transfer delta-V. +#[tauri::command] +pub fn calc_hohmann( + body_name: String, + parking_alt: f64, + target_sma: f64, + state: tauri::State<'_, ManagedState>, +) -> Result { + let app = state.lock().map_err(|e| e.to_string())?; + let body = app + .bodies + .get(&body_name) + .ok_or_else(|| format!("Body not found: {}", body_name))?; + + if parking_alt < 0.0 { + return Err("Parking altitude must be non-negative".to_string()); + } + + let r_parking = body.radius + parking_alt; + if (r_parking - target_sma).abs() / r_parking.max(target_sma) < 1e-12 { + return Err("Parking orbit and target SMA are identical".to_string()); + } + + let result = calculate_hohmann(body, parking_alt, target_sma); + Ok(HohmannResponse { + departure_dv: result.departure_dv, + arrival_dv: result.arrival_dv, + total_dv: result.total_dv, + transfer_time: result.transfer_time, + inward: result.inward, + }) +} + +/// Apply the Tsiolkovsky rocket equation. +#[tauri::command] +pub fn calc_tsiolkovsky( + delta_v: f64, + isp: f64, + wet_mass: f64, +) -> Result { + if delta_v < 0.0 { + return Err("delta_v must be non-negative".to_string()); + } + if isp <= 0.0 { + return Err("Isp must be positive".to_string()); + } + if wet_mass <= 0.0 { + return Err("Wet mass must be positive".to_string()); + } + + let result = calculate_tsiolkovsky(delta_v, isp, wet_mass); + Ok(TsiolkovskyResponse { + mass_ratio: result.mass_ratio, + fuel_fraction: result.fuel_fraction, + dry_mass: result.dry_mass, + fuel_mass: result.fuel_mass, + }) +} + +/// Get the full celestial system tree. +#[tauri::command] +pub fn get_system( + state: tauri::State<'_, ManagedState>, +) -> Result { + let app = state.lock().map_err(|e| e.to_string())?; + let system = app + .system + .as_ref() + .ok_or_else(|| "No system loaded. Upload a config or scan GameData first.".to_string())?; + + let root_body = system + .bodies + .get(&system.root_name) + .ok_or_else(|| format!("Root body '{}' not found in system", system.root_name))?; + + let home_body = system + .bodies + .get(&system.home_world_name) + .ok_or_else(|| { + format!( + "Home world '{}' not found in system", + system.home_world_name + ) + })?; + + let tree = root_body + .children_names + .iter() + .filter_map(|child_name| build_tree_node(child_name, &system.bodies)) + .collect(); + + Ok(SystemResponse { + root: body_to_summary(root_body), + home_world: body_to_detail(home_body), + body_count: system.bodies.len(), + tree, + }) +} + +/// Get sibling bodies sorted by transfer delta-V from the home world. +#[tauri::command] +pub fn get_destinations( + state: tauri::State<'_, ManagedState>, +) -> Result, String> { + let app = state.lock().map_err(|e| e.to_string())?; + let system = app + .system + .as_ref() + .ok_or_else(|| "No system loaded".to_string())?; + + let sorted = sort_by_transfer_dv(&system.home_world_name, &system.bodies); + + let entries = sorted + .into_iter() + .filter_map(|(name, dv)| { + let body = system.bodies.get(&name)?; + Some(DestinationEntry { + body: body_to_summary(body), + transfer_dv: dv, + }) + }) + .collect(); + + Ok(entries) +} + +/// Compute a delta-V route from home to an optional destination and moon. +#[tauri::command] +pub fn calc_route( + destination: Option, + moon: Option, + state: tauri::State<'_, ManagedState>, +) -> Result { + let app = state.lock().map_err(|e| e.to_string())?; + let system = app + .system + .as_ref() + .ok_or_else(|| "No system loaded".to_string())?; + + let home = system + .bodies + .get(&system.home_world_name) + .ok_or_else(|| "Home world not found in system".to_string())?; + + let parent_name = home + .parent_name + .as_ref() + .ok_or_else(|| "Home world has no parent body".to_string())?; + + let parent = system + .bodies + .get(parent_name) + .ok_or_else(|| format!("Parent body '{}' not found", parent_name))?; + + let dest_body = match &destination { + Some(name) => Some( + system + .bodies + .get(name) + .ok_or_else(|| format!("Destination body '{}' not found", name))?, + ), + None => None, + }; + + let moon_body = match &moon { + Some(name) => Some( + system + .bodies + .get(name) + .ok_or_else(|| format!("Moon '{}' not found", name))?, + ), + None => None, + }; + + let steps = compute_route(home, parent, dest_body, moon_body); + + let total_powered = steps.last().map(|s| s.cumulative).unwrap_or(0.0); + + // Check if any step has an aerobrake note + let has_aerobrake = steps.iter().any(|s| s.note.contains("aerobrake")); + let total_aerobrake = if has_aerobrake { + // Aerobrake landing replaces the last powered landing step + let last_landing_dv = steps + .iter() + .rev() + .find(|s| s.note.contains("aerobrake")) + .map(|s| s.dv) + .unwrap_or(0.0); + Some(total_powered - last_landing_dv) + } else { + None + }; + + let step_responses = steps + .into_iter() + .map(|s| DvStepResponse { + label: s.label, + dv: s.dv, + cumulative: s.cumulative, + note: s.note, + }) + .collect(); + + Ok(RouteResponse { + steps: step_responses, + total_powered, + total_aerobrake, + }) +} + +/// Get an atmosphere profile sampled at regular altitude intervals. +#[tauri::command] +pub fn get_atmo_profile( + name: String, + steps: Option, + state: tauri::State<'_, ManagedState>, +) -> Result { + let app = state.lock().map_err(|e| e.to_string())?; + let body = app + .bodies + .get(&name) + .ok_or_else(|| format!("Body not found: {}", name))?; + + let atmo = body + .atmosphere + .as_ref() + .ok_or_else(|| format!("Body '{}' has no atmosphere", name))?; + + let n_steps = steps.unwrap_or(100) as usize; + if n_steps == 0 { + return Err("Steps must be positive".to_string()); + } + + let depth = atmo.atmosphere_depth; + let step_size = depth / n_steps as f64; + + let mut altitudes = Vec::with_capacity(n_steps + 1); + let mut pressures = Vec::with_capacity(n_steps + 1); + let mut temperatures = Vec::with_capacity(n_steps + 1); + let mut densities = Vec::with_capacity(n_steps + 1); + + for i in 0..=n_steps { + let alt = step_size * i as f64; + altitudes.push(alt); + + let pressure = if !atmo.pressure_curve.is_empty() { + hermite_interp(&atmo.pressure_curve, alt).unwrap_or(0.0) + } else if alt == 0.0 { + atmo.pressure_at_sea_level + } else { + 0.0 + }; + pressures.push(pressure); + + let temperature = if !atmo.temperature_curve.is_empty() { + hermite_interp(&atmo.temperature_curve, alt).unwrap_or(0.0) + } else if alt == 0.0 { + atmo.temperature_at_sea_level + } else { + 0.0 + }; + temperatures.push(temperature); + + let density = density_at_altitude(body, alt).unwrap_or(0.0); + densities.push(density); + } + + Ok(AtmoProfileResponse { + altitude: altitudes, + pressure: pressures, + temperature: temperatures, + density: densities, + }) +} + +/// Get moons of a body sorted by transfer delta-V. +#[tauri::command] +pub fn get_body_moons( + name: String, + state: tauri::State<'_, ManagedState>, +) -> Result, String> { + let app = state.lock().map_err(|e| e.to_string())?; + let system = app + .system + .as_ref() + .ok_or_else(|| "No system loaded".to_string())?; + + let body = system + .bodies + .get(&name) + .ok_or_else(|| format!("Body not found: {}", name))?; + + if body.children_names.is_empty() { + return Ok(Vec::new()); + } + + // Use sort_by_transfer_dv from the home world perspective if + // this body is a planet. For moons, we look at children of this body + // and compute transfers from the body's low orbit. + let lo_alt = low_orbit_altitude(body); + + let mut entries: Vec = Vec::new(); + for child_name in &body.children_names { + let child = match system.bodies.get(child_name) { + Some(c) => c, + None => continue, + }; + let child_orbit = match &child.orbit { + Some(o) => o, + None => continue, + }; + let target_sma = child_orbit.semi_major_axis; + let r_parking = body.radius + lo_alt; + + // Skip if radii are too close (would panic in calculate_hohmann) + if (r_parking - target_sma).abs() / r_parking.max(target_sma) < 1e-12 { + continue; + } + + let hohmann = calculate_hohmann(body, lo_alt, target_sma); + entries.push(DestinationEntry { + body: body_to_summary(child), + transfer_dv: hohmann.total_dv, + }); + } + + entries.sort_by(|a, b| { + a.transfer_dv + .partial_cmp(&b.transfer_dv) + .unwrap_or(std::cmp::Ordering::Equal) + }); + + Ok(entries) +} diff --git a/src-tauri/src/main.rs b/src-tauri/src/main.rs index 0875a1a..1b48778 100644 --- a/src-tauri/src/main.rs +++ b/src-tauri/src/main.rs @@ -1,50 +1,29 @@ #![cfg_attr(not(debug_assertions), windows_subsystem = "windows")] -use tauri::Manager; -use tauri_plugin_shell::ShellExt; +use std::sync::Mutex; + +mod commands; +mod state; fn main() { tauri::Builder::default() - .plugin(tauri_plugin_shell::init()) .plugin(tauri_plugin_dialog::init()) - .setup(|app| { - let shell = app.shell(); - - // In dev mode, api.py is at the project root (../../api.py from src-tauri/) - // In production, resources are bundled next to the exe - let resource_dir = app - .path() - .resource_dir() - .expect("Failed to resolve resource directory"); - - let api_path = resource_dir.join("api.py"); - - let (mut rx, _child) = shell - .command("python") - .args([api_path.to_string_lossy().to_string()]) - .current_dir(&resource_dir) - .spawn() - .expect("Failed to spawn Python API server"); - - tauri::async_runtime::spawn(async move { - while let Some(event) = rx.recv().await { - match event { - tauri_plugin_shell::process::CommandEvent::Stdout(line) => { - println!("[python:stdout] {}", String::from_utf8_lossy(&line)); - } - tauri_plugin_shell::process::CommandEvent::Stderr(line) => { - eprintln!("[python:stderr] {}", String::from_utf8_lossy(&line)); - } - tauri_plugin_shell::process::CommandEvent::Terminated(status) => { - eprintln!("[python] Process terminated: {:?}", status); - } - _ => {} - } - } - }); - - Ok(()) - }) + .manage(Mutex::new(state::AppState::new())) + .invoke_handler(tauri::generate_handler![ + commands::health, + commands::upload_config, + commands::scan_gamedata, + commands::list_bodies, + commands::get_body, + commands::calc_launch, + commands::calc_hohmann, + commands::calc_tsiolkovsky, + commands::get_system, + commands::get_destinations, + commands::calc_route, + commands::get_atmo_profile, + commands::get_body_moons, + ]) .run(tauri::generate_context!()) .expect("error while running tauri application"); } diff --git a/src-tauri/src/state.rs b/src-tauri/src/state.rs new file mode 100644 index 0000000..33003c2 --- /dev/null +++ b/src-tauri/src/state.rs @@ -0,0 +1,32 @@ +//! Application state shared across Tauri commands. +//! +//! Tauri コマンド間で共有するアプリケーション状態。 + +use std::collections::HashMap; +use std::sync::Mutex; + +use kopdeltav::models::CelestialBody; +use kopdeltav::system::CelestialSystem; + +/// Central application state holding parsed celestial bodies and the built system tree. +/// +/// パース済み天体とシステムツリーを保持する中央アプリケーション状態。 +pub struct AppState { + /// All loaded celestial bodies indexed by internal name. + pub bodies: HashMap, + /// The fully linked celestial system tree, built after loading bodies. + pub system: Option, +} + +impl AppState { + /// Create a new empty state with no bodies loaded. + pub fn new() -> Self { + Self { + bodies: HashMap::new(), + system: None, + } + } +} + +/// Thread-safe wrapper around `AppState` for Tauri managed state. +pub type ManagedState = Mutex; diff --git a/src-tauri/tauri.conf.json b/src-tauri/tauri.conf.json index 1e6d476..f9fca1c 100644 --- a/src-tauri/tauri.conf.json +++ b/src-tauri/tauri.conf.json @@ -20,16 +20,8 @@ } ], "security": { - "csp": "default-src 'self'; connect-src 'self' http://localhost:8000; style-src 'self' 'unsafe-inline' https://fonts.googleapis.com; font-src 'self' https://fonts.gstatic.com; img-src 'self' data:" + "csp": "default-src 'self'; style-src 'self' 'unsafe-inline' https://fonts.googleapis.com; font-src 'self' https://fonts.gstatic.com; img-src 'self' data:" } }, - "bundle": { - "resources": { - "../api.py": ".", - "../kopdeltav": "kopdeltav", - "../run.py": ".", - "../pyproject.toml": ".", - "../sample_configs": "sample_configs" - } - } + "bundle": {} } From c1305d3d855f0819ce17861ced67f51e49c47c4f Mon Sep 17 00:00:00 2001 From: Yumeno Yuuka Date: Fri, 3 Apr 2026 09:56:24 +0900 Subject: [PATCH 6/8] feat(frontend): replace fetch API with Tauri invoke commands Migrate all HTTP fetch-based API calls in useApi.ts to Tauri invoke() from @tauri-apps/api/core, update ConfigUpload.vue to read file as text before passing to invoke, and remove the vite dev server proxy config. --- .../src/components/upload/ConfigUpload.vue | 3 +- frontend/src/composables/useApi.ts | 100 ++++++++---------- frontend/vite.config.ts | 7 -- 3 files changed, 44 insertions(+), 66 deletions(-) diff --git a/frontend/src/components/upload/ConfigUpload.vue b/frontend/src/components/upload/ConfigUpload.vue index da0e751..905ce93 100644 --- a/frontend/src/components/upload/ConfigUpload.vue +++ b/frontend/src/components/upload/ConfigUpload.vue @@ -30,7 +30,8 @@ async function onFileSelect(event: FileUploadSelectEvent): Promise { uploading.value = true try { - const uploadResult = await api.uploadConfig(file) + const fileContent = await file.text() + const uploadResult = await api.uploadConfig(fileContent) await afterSuccess(uploadResult.count) } catch (err) { toast.add({ diff --git a/frontend/src/composables/useApi.ts b/frontend/src/composables/useApi.ts index 348e5fd..0924ba9 100644 --- a/frontend/src/composables/useApi.ts +++ b/frontend/src/composables/useApi.ts @@ -1,91 +1,75 @@ +import { invoke } from '@tauri-apps/api/core' import { useToast } from 'primevue/usetoast' import type { AtmoProfileResponse, BodyDetail, BodySummary, + DestinationEntry, HealthResponse, - HohmannRequest, HohmannResponse, - LaunchRequest, LaunchResponse, - RouteRequest, RouteResponse, ScanRequest, SystemResponse, - TsiolkovskyRequest, TsiolkovskyResponse, UploadResponse, - DestinationEntry, } from '@/types/api' -const BASE_URL = import.meta.env.DEV ? '/api' : 'http://localhost:8000' - -async function request( - path: string, - options: RequestInit = {}, - lang?: string, -): Promise { - const url = new URL(`${BASE_URL}${path}`, window.location.origin) - if (lang) { - url.searchParams.set('lang', lang) - } - const response = await fetch(url.toString(), { - headers: { 'Content-Type': 'application/json', ...options.headers }, - ...options, - }) - if (!response.ok) { - const body = await response.json().catch(() => ({ detail: response.statusText })) - throw new Error(body.detail ?? `HTTP ${response.status}`) - } - return response.json() as Promise -} - export function useApi(lang?: string) { const toast = useToast() function handleError(err: unknown): void { const message = err instanceof Error ? err.message : String(err) - toast.add({ severity: 'error', summary: 'API Error', detail: message, life: 5000 }) + toast.add({ severity: 'error', summary: 'Error', detail: message, life: 5000 }) } return { - health: () => request('/health'), - listBodies: () => request('/bodies', {}, lang), - getBody: (name: string) => request(`/bodies/${encodeURIComponent(name)}`, {}, lang), + health: () => invoke('health'), + listBodies: () => invoke('list_bodies', { lang }), + getBody: (name: string) => invoke('get_body', { name, lang }), getBodyMoons: (name: string) => - request(`/bodies/${encodeURIComponent(name)}/moons`), + invoke('get_body_moons', { name }), - uploadConfig: async (file: File) => { - const formData = new FormData() - formData.append('file', file) - const url = `${BASE_URL}/upload-config${lang ? `?lang=${lang}` : ''}` - const response = await fetch(url, { method: 'POST', body: formData }) - if (!response.ok) { - const body = await response.json().catch(() => ({ detail: response.statusText })) - throw new Error(body.detail ?? `HTTP ${response.status}`) - } - return response.json() as Promise - }, + uploadConfig: (fileContent: string) => + invoke('upload_config', { fileContent }), scan: (req: ScanRequest) => - request('/scan', { method: 'POST', body: JSON.stringify(req) }), + invoke('scan_gamedata', { + path: req.gamedata_path, + exclude: req.exclude_dirs, + }), + + calcLaunch: (req: { body_name: string; target_altitude: number }) => + invoke('calc_launch', { + bodyName: req.body_name, + targetAltitude: req.target_altitude, + }), + + calcHohmann: (req: { body_name: string; parking_altitude: number; target_sma: number }) => + invoke('calc_hohmann', { + bodyName: req.body_name, + parkingAlt: req.parking_altitude, + targetSma: req.target_sma, + }), + + calcTsiolkovsky: (req: { delta_v: number; isp: number; wet_mass: number }) => + invoke('calc_tsiolkovsky', { + deltaV: req.delta_v, + isp: req.isp, + wetMass: req.wet_mass, + }), - calcLaunch: (req: LaunchRequest) => - request('/calc/launch', { method: 'POST', body: JSON.stringify(req) }, lang), - calcHohmann: (req: HohmannRequest) => - request('/calc/hohmann', { method: 'POST', body: JSON.stringify(req) }, lang), - calcTsiolkovsky: (req: TsiolkovskyRequest) => - request('/calc/tsiolkovsky', { method: 'POST', body: JSON.stringify(req) }, lang), + getSystem: () => invoke('get_system'), + getDestinations: () => invoke('get_destinations'), - getSystem: () => request('/system'), - getDestinations: () => request('/system/destinations'), - calcRoute: (req: RouteRequest) => - request('/calc/route', { method: 'POST', body: JSON.stringify(req) }), + calcRoute: (req: { destination: string | null; moon: string | null }) => + invoke('calc_route', { + destination: req.destination, + moon: req.moon, + }), - getAtmoProfile: (name: string, steps?: number) => { - const params = steps ? `?steps=${steps}` : '' - return request(`/atmo-profile/${encodeURIComponent(name)}${params}`, {}, lang) - }, + getAtmoProfile: (name: string, steps?: number) => + invoke('get_atmo_profile', { name, steps }), handleError, } diff --git a/frontend/vite.config.ts b/frontend/vite.config.ts index 0e77346..a8e91e2 100644 --- a/frontend/vite.config.ts +++ b/frontend/vite.config.ts @@ -11,12 +11,5 @@ export default defineConfig({ }, server: { port: 5173, - proxy: { - '/api': { - target: 'http://localhost:8000', - changeOrigin: true, - rewrite: (path) => path.replace(/^\/api/, ''), - }, - }, }, }) From 2a9626a9115471d4d1cd0b7b5488ded7dbb4a937 Mon Sep 17 00:00:00 2001 From: Yumeno Yuuka Date: Fri, 3 Apr 2026 09:57:24 +0900 Subject: [PATCH 7/8] ci: add Rust tests to CI, update release description --- .github/workflows/ci.yml | 13 +++++++++++++ .github/workflows/release.yml | 2 +- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 01b0768..a0c82f1 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -34,6 +34,19 @@ jobs: - name: Tests run: pytest tests/ -v + rust: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: dtolnay/rust-toolchain@stable + - uses: swatinem/rust-cache@v2 + with: + workspaces: src-tauri -> target + - name: Run tests + run: cargo test -p kopdeltav --manifest-path src-tauri/Cargo.toml + - name: Clippy + run: cargo clippy -p kopdeltav --manifest-path src-tauri/Cargo.toml -- -D warnings + frontend: runs-on: ubuntu-latest defaults: diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 2782fec..5e008ff 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -57,5 +57,5 @@ jobs: with: draft: true name: "KSPDeltaVForMods ${{ github.ref_name }}" - body: "Windows desktop build. Requires Python 3.10+ on PATH." + body: "Windows desktop build. No external dependencies required." files: src-tauri/target/release/bundle/nsis/*.exe From a9e62e84c0d1f14faa68d1bba7f3a0b49e654e2b Mon Sep 17 00:00:00 2001 From: Yumeno Yuuka Date: Fri, 3 Apr 2026 10:10:17 +0900 Subject: [PATCH 8/8] fix: remove waitForBackend and Python copy step from merge conflict resolution --- .github/workflows/release.yml | 9 ------- frontend/src/main.ts | 47 ++++++++++------------------------- 2 files changed, 13 insertions(+), 43 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 7fe5b6e..5e008ff 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -42,15 +42,6 @@ jobs: - name: Install Tauri CLI run: cargo install tauri-cli --version "^2" - - name: Copy Python backend into Tauri resources - run: | - mkdir -p src-tauri/resources/kopdeltav - cp api.py src-tauri/resources/ - cp launcher.py src-tauri/resources/ - cp kopdeltav/*.py src-tauri/resources/kopdeltav/ - cp requirements.txt src-tauri/resources/ - shell: bash - - name: Build Tauri app run: cargo tauri build --bundles nsis working-directory: src-tauri diff --git a/frontend/src/main.ts b/frontend/src/main.ts index 8bc615c..750cde5 100644 --- a/frontend/src/main.ts +++ b/frontend/src/main.ts @@ -7,42 +7,21 @@ import 'primeicons/primeicons.css' import App from './App.vue' import router from './router' import i18n from './i18n' -import { waitForBackend } from './composables/useApi' import './assets/styles/main.css' -async function bootstrap(): Promise { - // In production (Tauri), wait for the Python backend to start - if (!import.meta.env.DEV) { - const ready = await waitForBackend() - if (!ready) { - const el = document.getElementById('app') - if (el) { - el.textContent = - 'Failed to connect to Python backend. Ensure Python 3.10+ is installed and on PATH.' - el.style.color = '#ef4444' - el.style.padding = '2rem' - el.style.fontFamily = 'sans-serif' - } - return - } - } +const app = createApp(App) - const app = createApp(App) - - app.use(createPinia()) - app.use(router) - app.use(i18n) - app.use(PrimeVue, { - theme: { - preset: Aura, - options: { - darkModeSelector: '.app-dark', - }, +app.use(createPinia()) +app.use(router) +app.use(i18n) +app.use(PrimeVue, { + theme: { + preset: Aura, + options: { + darkModeSelector: '.app-dark', }, - }) - app.use(ToastService) - - app.mount('#app') -} + }, +}) +app.use(ToastService) -bootstrap() +app.mount('#app')