From 912a2d0b15b873923698126ac8112d1aa4bdbb1a Mon Sep 17 00:00:00 2001 From: Johannes Hofmann Date: Tue, 27 Oct 2026 10:08:22 +0100 Subject: wasm: experimental browser spike Proves the gipfel core can run in the browser via WASM. Enabled by the earlier GSL removal: the core is now pure Rust. gipfel-core gains byte-oriented entry points (no filesystem) alongside the existing path-based ones: - hill::load_from_bytes, Panorama::load_data_from_bytes - metadata: load_image_from_bytes, read_jpeg_comment_from_bytes, write_jpeg_comment_to_bytes, save_image_to_bytes (EXIF via Cursor) New crate gipfel-wasm (experimental, not shipped with the app): - wasm-bindgen surface: version() + fit_demo(db_bytes, jpg_bytes) which runs the whole pipeline in memory: parse hill DB, read gipfel JPEG comment / EXIF, synthesize 5 observations from visible hills, perturb, refit (pure-Rust LM), report JSON with reprojection error - demo/index.html: file pickers + result pane (wasm-pack --target web) - build.sh: adds the wasm target, builds with wasm-pack, prints serve cmd - native test runs the same pipeline against gipfel.dat + test.jpg and asserts sub-pixel reprojection error (passes here) To try on a machine with rustup: cd crates/gipfel-wasm && ./build.sh --- .gitignore | 1 + 1 file changed, 1 insertion(+) (limited to '.gitignore') diff --git a/.gitignore b/.gitignore index b478aa0..07849dd 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ /target tests/harness/build/ +crates/gipfel-wasm/pkg/ *.tmp gipfel-app-bin.tar.gz -- cgit v1.2.3 From 2ac8e530b8fb9ca4fa073e1e25a4230a83d99c5d Mon Sep 17 00:00:00 2001 From: Johannes Hofmann Date: Tue, 27 Oct 2026 10:48:03 +0100 Subject: web: W1 scaffold — Yew app with image display, pan and zoom MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit First milestone of wasm-plan.md: - new crate gipfel-web: Yew 0.21 (csr), canvas 2D viewport - file input + drag-and-drop; browser-native decode via createImageBitmap (faster than image-crate decode in wasm, GPU-backed blitting) - pan (pointer drag with capture, touch-ready) and cursor-anchored wheel zoom, DPR-aware canvas sizing, fit-to-window - dark sidebar shell: open/fit buttons, status line - Trunk.toml + www/ (index.html, style.css); README with dev setup Verified: cargo check clean (native and wasm32-unknown-unknown), release wasm builds (5.3 MB pre-wasm-opt), all 38 native tests pass. Runtime behavior to be confirmed with trunk serve on a desktop browser. --- .gitignore | 1 + Cargo.lock | 645 ++++++++++++++++++++++++++++++++++- Cargo.toml | 2 +- crates/gipfel-web/Cargo.toml | 37 ++ crates/gipfel-web/README.md | 46 +++ crates/gipfel-web/Trunk.toml | 2 + crates/gipfel-web/src/app.rs | 193 +++++++++++ crates/gipfel-web/src/bridge.rs | 45 +++ crates/gipfel-web/src/canvas_view.rs | 148 ++++++++ crates/gipfel-web/src/main.rs | 7 + crates/gipfel-web/www/index.html | 11 + crates/gipfel-web/www/style.css | 77 +++++ 12 files changed, 1201 insertions(+), 13 deletions(-) create mode 100644 crates/gipfel-web/Cargo.toml create mode 100644 crates/gipfel-web/README.md create mode 100644 crates/gipfel-web/Trunk.toml create mode 100644 crates/gipfel-web/src/app.rs create mode 100644 crates/gipfel-web/src/bridge.rs create mode 100644 crates/gipfel-web/src/canvas_view.rs create mode 100644 crates/gipfel-web/src/main.rs create mode 100644 crates/gipfel-web/www/index.html create mode 100644 crates/gipfel-web/www/style.css (limited to '.gitignore') diff --git a/.gitignore b/.gitignore index 07849dd..fbccf5e 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,6 @@ /target tests/harness/build/ crates/gipfel-wasm/pkg/ +crates/gipfel-web/dist/ *.tmp gipfel-app-bin.tar.gz diff --git a/Cargo.lock b/Cargo.lock index 02fdc71..a01b90b 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -172,6 +172,12 @@ dependencies = [ "libc", ] +[[package]] +name = "anymap2" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d301b3b94cb4b2f23d7917810addbbaff90738e0ca2be692bd027e70d7e0330c" + [[package]] name = "apply" version = "0.3.0" @@ -475,6 +481,15 @@ dependencies = [ "serde", ] +[[package]] +name = "bincode" +version = "1.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b1f45e9417d87227c7a56d22e471c6206462cba514c7590c09aff4cf6d1ddcad" +dependencies = [ + "serde", +] + [[package]] name = "bit-set" version = "0.8.0" @@ -551,6 +566,12 @@ dependencies = [ "piper", ] +[[package]] +name = "boolinator" +version = "2.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cfa8873f51c92e232f9bac4065cddef41b714152812bfc5f7672ba16d6ef8cd9" + [[package]] name = "borsh" version = "1.8.1" @@ -791,6 +812,16 @@ version = "3.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "031ad3d167622974ed636505ae4556267ed4aa2aea0464122fa6bc9698a32825" +[[package]] +name = "console_error_panic_hook" +version = "0.1.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a06aeb73f470f66dcdbf7223caeebb85984942f22f1adb2a088cf9668146bbbc" +dependencies = [ + "cfg-if", + "wasm-bindgen", +] + [[package]] name = "const-oid" version = "0.10.2" @@ -1705,8 +1736,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ff2abc00be7fca6ebc474524697ae276ad847ad0a6b3faa4bcb027e9a4614ad0" dependencies = [ "cfg-if", + "js-sys", "libc", "wasi", + "wasm-bindgen", ] [[package]] @@ -1782,6 +1815,18 @@ dependencies = [ "wasm-bindgen", ] +[[package]] +name = "gipfel-web" +version = "0.5.5" +dependencies = [ + "gipfel-core", + "js-sys", + "wasm-bindgen", + "wasm-bindgen-futures", + "web-sys", + "yew", +] + [[package]] name = "gl_generator" version = "0.14.0" @@ -1799,6 +1844,353 @@ version = "0.25.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "151665d9be52f9bb40fc7966565d39666f2d1e69233571b71b87791c7e0528b3" +[[package]] +name = "gloo" +version = "0.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "28999cda5ef6916ffd33fb4a7b87e1de633c47c0dc6d97905fee1cdaa142b94d" +dependencies = [ + "gloo-console 0.2.3", + "gloo-dialogs 0.1.1", + "gloo-events 0.1.2", + "gloo-file 0.2.3", + "gloo-history 0.1.5", + "gloo-net 0.3.1", + "gloo-render 0.1.1", + "gloo-storage 0.2.2", + "gloo-timers 0.2.6", + "gloo-utils 0.1.7", + "gloo-worker 0.2.1", +] + +[[package]] +name = "gloo" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cd35526c28cc55c1db77aed6296de58677dbab863b118483a27845631d870249" +dependencies = [ + "gloo-console 0.3.0", + "gloo-dialogs 0.2.0", + "gloo-events 0.2.0", + "gloo-file 0.3.0", + "gloo-history 0.2.2", + "gloo-net 0.4.0", + "gloo-render 0.2.0", + "gloo-storage 0.3.0", + "gloo-timers 0.3.0", + "gloo-utils 0.2.0", + "gloo-worker 0.4.0", +] + +[[package]] +name = "gloo-console" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "82b7ce3c05debe147233596904981848862b068862e9ec3e34be446077190d3f" +dependencies = [ + "gloo-utils 0.1.7", + "js-sys", + "serde", + "wasm-bindgen", + "web-sys", +] + +[[package]] +name = "gloo-console" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2a17868f56b4a24f677b17c8cb69958385102fa879418052d60b50bc1727e261" +dependencies = [ + "gloo-utils 0.2.0", + "js-sys", + "serde", + "wasm-bindgen", + "web-sys", +] + +[[package]] +name = "gloo-dialogs" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "67062364ac72d27f08445a46cab428188e2e224ec9e37efdba48ae8c289002e6" +dependencies = [ + "wasm-bindgen", + "web-sys", +] + +[[package]] +name = "gloo-dialogs" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bf4748e10122b01435750ff530095b1217cf6546173459448b83913ebe7815df" +dependencies = [ + "wasm-bindgen", + "web-sys", +] + +[[package]] +name = "gloo-events" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "68b107f8abed8105e4182de63845afcc7b69c098b7852a813ea7462a320992fc" +dependencies = [ + "wasm-bindgen", + "web-sys", +] + +[[package]] +name = "gloo-events" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "27c26fb45f7c385ba980f5fa87ac677e363949e065a083722697ef1b2cc91e41" +dependencies = [ + "wasm-bindgen", + "web-sys", +] + +[[package]] +name = "gloo-file" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a8d5564e570a38b43d78bdc063374a0c3098c4f0d64005b12f9bbe87e869b6d7" +dependencies = [ + "gloo-events 0.1.2", + "js-sys", + "wasm-bindgen", + "web-sys", +] + +[[package]] +name = "gloo-file" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "97563d71863fb2824b2e974e754a81d19c4a7ec47b09ced8a0e6656b6d54bd1f" +dependencies = [ + "gloo-events 0.2.0", + "js-sys", + "wasm-bindgen", + "web-sys", +] + +[[package]] +name = "gloo-history" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "85725d90bf0ed47063b3930ef28e863658a7905989e9929a8708aab74a1d5e7f" +dependencies = [ + "gloo-events 0.1.2", + "gloo-utils 0.1.7", + "serde", + "serde-wasm-bindgen 0.5.0", + "serde_urlencoded", + "thiserror 1.0.69", + "wasm-bindgen", + "web-sys", +] + +[[package]] +name = "gloo-history" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "903f432be5ba34427eac5e16048ef65604a82061fe93789f2212afc73d8617d6" +dependencies = [ + "getrandom 0.2.17", + "gloo-events 0.2.0", + "gloo-utils 0.2.0", + "serde", + "serde-wasm-bindgen 0.6.5", + "serde_urlencoded", + "thiserror 1.0.69", + "wasm-bindgen", + "web-sys", +] + +[[package]] +name = "gloo-net" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a66b4e3c7d9ed8d315fd6b97c8b1f74a7c6ecbbc2320e65ae7ed38b7068cc620" +dependencies = [ + "futures-channel", + "futures-core", + "futures-sink", + "gloo-utils 0.1.7", + "http", + "js-sys", + "pin-project", + "serde", + "serde_json", + "thiserror 1.0.69", + "wasm-bindgen", + "wasm-bindgen-futures", + "web-sys", +] + +[[package]] +name = "gloo-net" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8ac9e8288ae2c632fa9f8657ac70bfe38a1530f345282d7ba66a1f70b72b7dc4" +dependencies = [ + "futures-channel", + "futures-core", + "futures-sink", + "gloo-utils 0.2.0", + "http", + "js-sys", + "pin-project", + "serde", + "serde_json", + "thiserror 1.0.69", + "wasm-bindgen", + "wasm-bindgen-futures", + "web-sys", +] + +[[package]] +name = "gloo-render" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2fd9306aef67cfd4449823aadcd14e3958e0800aa2183955a309112a84ec7764" +dependencies = [ + "wasm-bindgen", + "web-sys", +] + +[[package]] +name = "gloo-render" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "56008b6744713a8e8d98ac3dcb7d06543d5662358c9c805b4ce2167ad4649833" +dependencies = [ + "wasm-bindgen", + "web-sys", +] + +[[package]] +name = "gloo-storage" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5d6ab60bf5dbfd6f0ed1f7843da31b41010515c745735c970e821945ca91e480" +dependencies = [ + "gloo-utils 0.1.7", + "js-sys", + "serde", + "serde_json", + "thiserror 1.0.69", + "wasm-bindgen", + "web-sys", +] + +[[package]] +name = "gloo-storage" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fbc8031e8c92758af912f9bc08fbbadd3c6f3cfcbf6b64cdf3d6a81f0139277a" +dependencies = [ + "gloo-utils 0.2.0", + "js-sys", + "serde", + "serde_json", + "thiserror 1.0.69", + "wasm-bindgen", + "web-sys", +] + +[[package]] +name = "gloo-timers" +version = "0.2.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9b995a66bb87bebce9a0f4a95aed01daca4872c050bfcb21653361c03bc35e5c" +dependencies = [ + "js-sys", + "wasm-bindgen", +] + +[[package]] +name = "gloo-timers" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bbb143cf96099802033e0d4f4963b19fd2e0b728bcf076cd9cf7f6634f092994" +dependencies = [ + "js-sys", + "wasm-bindgen", +] + +[[package]] +name = "gloo-utils" +version = "0.1.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "037fcb07216cb3a30f7292bd0176b050b7b9a052ba830ef7d5d65f6dc64ba58e" +dependencies = [ + "js-sys", + "serde", + "serde_json", + "wasm-bindgen", + "web-sys", +] + +[[package]] +name = "gloo-utils" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b5555354113b18c547c1d3a98fbf7fb32a9ff4f6fa112ce823a21641a0ba3aa" +dependencies = [ + "js-sys", + "serde", + "serde_json", + "wasm-bindgen", + "web-sys", +] + +[[package]] +name = "gloo-worker" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "13471584da78061a28306d1359dd0178d8d6fc1c7c80e5e35d27260346e0516a" +dependencies = [ + "anymap2", + "bincode", + "gloo-console 0.2.3", + "gloo-utils 0.1.7", + "js-sys", + "serde", + "wasm-bindgen", + "wasm-bindgen-futures", + "web-sys", +] + +[[package]] +name = "gloo-worker" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "76495d3dd87de51da268fa3a593da118ab43eb7f8809e17eb38d3319b424e400" +dependencies = [ + "bincode", + "futures", + "gloo-utils 0.2.0", + "gloo-worker-macros", + "js-sys", + "pinned", + "serde", + "thiserror 1.0.69", + "wasm-bindgen", + "wasm-bindgen-futures", + "web-sys", +] + +[[package]] +name = "gloo-worker-macros" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "956caa58d4857bc9941749d55e4bd3000032d8212762586fa5705632967140e7" +dependencies = [ + "proc-macro-crate 1.3.1", + "proc-macro2", + "quote", + "syn 2.0.119", +] + [[package]] name = "glow" version = "0.16.0" @@ -1958,6 +2350,17 @@ version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "dfa686283ad6dd069f105e5ab091b04c62850d3e4cf5d67debad1933f55023df" +[[package]] +name = "http" +version = "0.2.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "601cbb57e577e2f5ef5be8e7b83f0f63994f25aa94d673e54a92d5c516d101f1" +dependencies = [ + "bytes", + "fnv", + "itoa", +] + [[package]] name = "hybrid-array" version = "0.4.15" @@ -2409,6 +2812,26 @@ version = "0.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "edcd27d72f2f071c64249075f42e205ff93c9a4c5f6c6da53e79ed9f9832c285" +[[package]] +name = "implicit-clone" +version = "0.4.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f8a9aa791c7b5a71b636b7a68207fdebf171ddfc593d9c8506ec4cbc527b6a84" +dependencies = [ + "implicit-clone-derive", + "indexmap", +] + +[[package]] +name = "implicit-clone-derive" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "699c1b6d335e63d0ba5c1e1c7f647371ce989c3bcbe1f7ed2b85fa56e3bd1a21" +dependencies = [ + "quote", + "syn 2.0.119", +] + [[package]] name = "indexmap" version = "2.14.2" @@ -3098,6 +3521,16 @@ dependencies = [ "libm", ] +[[package]] +name = "num_cpus" +version = "1.17.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "91df4bbde75afed763b708b7eee1e8e7651e02d97f6d5dd763e89367e957b23b" +dependencies = [ + "hermit-abi", + "libc", +] + [[package]] name = "num_enum" version = "0.7.6" @@ -3114,7 +3547,7 @@ version = "0.7.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "680998035259dcfcafe653688bf2aa6d3e2dc05e98be6ab46afb089dc84f1df8" dependencies = [ - "proc-macro-crate", + "proc-macro-crate 3.5.0", "proc-macro2", "quote", "syn 2.0.119", @@ -3567,6 +4000,17 @@ version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "13bee6c73da26345c729282832b60b0363cf3dd9f4bfd81d8551b7a1c889a113" +[[package]] +name = "pinned" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a829027bd95e54cfe13e3e258a1ae7b645960553fb82b75ff852c29688ee595b" +dependencies = [ + "futures", + "rustversion", + "thiserror 1.0.69", +] + [[package]] name = "piper" version = "0.2.5" @@ -3675,13 +4119,57 @@ version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e8cf8e6a8aa66ce33f63993ffc4ea4271eb5b0530a9002db8455ea6050c77bfa" +[[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.119", +] + +[[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 = "3.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e67ba7e9b2b56446f1d419b1d807906278ffa1a658a8a5d8a39dcb1f5a78614f" dependencies = [ - "toml_edit", + "toml_edit 0.25.17+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]] @@ -3734,6 +4222,23 @@ version = "1.0.18" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3d595e54a326bc53c1c197b32d295e14b169e3cfeaa8dc82b529f947fba6bcf5" +[[package]] +name = "prokio" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "03b55e106e5791fa5a13abd13c85d6127312e8e09098059ca2bc9b03ca4cf488" +dependencies = [ + "futures", + "gloo 0.8.1", + "num_cpus", + "once_cell", + "pin-project", + "pinned", + "tokio", + "tokio-stream", + "wasm-bindgen-futures", +] + [[package]] name = "pxfm" version = "0.1.30" @@ -4101,6 +4606,12 @@ dependencies = [ "unicode-script", ] +[[package]] +name = "ryu" +version = "1.0.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9774ba4a74de5f7b1c1451ed6cd5285a32eddb5cccb8cc655a4e50009e06477f" + [[package]] name = "same-file" version = "1.0.6" @@ -4157,6 +4668,28 @@ dependencies = [ "serde_derive", ] +[[package]] +name = "serde-wasm-bindgen" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f3b143e2833c57ab9ad3ea280d21fd34e285a42837aeb0ee301f4f41890fa00e" +dependencies = [ + "js-sys", + "serde", + "wasm-bindgen", +] + +[[package]] +name = "serde-wasm-bindgen" +version = "0.6.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8302e169f0eddcc139c70f139d19d6467353af16f9fce27e8c30158036a1e16b" +dependencies = [ + "js-sys", + "serde", + "wasm-bindgen", +] + [[package]] name = "serde_core" version = "1.0.229" @@ -4203,6 +4736,18 @@ dependencies = [ "syn 3.0.9", ] +[[package]] +name = "serde_urlencoded" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3491c14715ca2294c4d6a88f15e84739788c1d030eed8c110436aafdaa2f3fd" +dependencies = [ + "form_urlencoded", + "itoa", + "ryu", + "serde", +] + [[package]] name = "sha2" version = "0.11.1" @@ -4459,6 +5004,16 @@ dependencies = [ "zeno", ] +[[package]] +name = "syn" +version = "1.0.109" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237" +dependencies = [ + "proc-macro2", + "unicode-ident", +] + [[package]] name = "syn" version = "2.0.119" @@ -4718,6 +5273,12 @@ dependencies = [ "serde", ] +[[package]] +name = "toml_datetime" +version = "0.6.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "22cddaf88f4fbc13c51aebbf5f8eceb5c7c5a9da2ac40a13519eb5b0a0e8f11c" + [[package]] name = "toml_datetime" version = "1.1.2+spec-1.1.0" @@ -4727,6 +5288,17 @@ 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", + "toml_datetime 0.6.11", + "winnow 0.5.40", +] + [[package]] name = "toml_edit" version = "0.25.17+spec-1.1.0" @@ -4734,9 +5306,9 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e3641d5bbb5349a79e1020a242d251efbc546ad8048d133958323ce9c40a9c9c" dependencies = [ "indexmap", - "toml_datetime", + "toml_datetime 1.1.2+spec-1.1.0", "toml_parser", - "winnow", + "winnow 1.0.4", ] [[package]] @@ -4745,7 +5317,7 @@ version = "1.1.5+spec-1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "baa693a8032d7e1cada7d0041e96126df243179ff061456783ac7f12bda4744c" dependencies = [ - "winnow", + "winnow 1.0.4", ] [[package]] @@ -6081,6 +6653,15 @@ dependencies = [ "xkbcommon-dl", ] +[[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 = "1.0.4" @@ -6190,6 +6771,46 @@ version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e01738255b5a16e78bbb83e7fbba0a1e7dd506905cfc53f4622d89015a03fbb5" +[[package]] +name = "yew" +version = "0.21.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5f1a03f255c70c7aa3e9c62e15292f142ede0564123543c1cc0c7a4f31660cac" +dependencies = [ + "console_error_panic_hook", + "futures", + "gloo 0.10.0", + "implicit-clone", + "indexmap", + "js-sys", + "prokio", + "rustversion", + "serde", + "slab", + "thiserror 1.0.69", + "tokio", + "tracing", + "wasm-bindgen", + "wasm-bindgen-futures", + "web-sys", + "yew-macro", +] + +[[package]] +name = "yew-macro" +version = "0.21.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "02fd8ca5166d69e59f796500a2ce432ff751edecbbb308ca59fd3fe4d0343de2" +dependencies = [ + "boolinator", + "once_cell", + "prettyplease", + "proc-macro-error", + "proc-macro2", + "quote", + "syn 2.0.119", +] + [[package]] name = "yoke" version = "0.8.4" @@ -6243,7 +6864,7 @@ dependencies = [ "uds_windows", "uuid", "windows-sys 0.61.2", - "winnow", + "winnow 1.0.4", "zbus_macros", "zbus_names", "zvariant", @@ -6279,7 +6900,7 @@ version = "5.19.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2990635d09ade6df1868f72f8cac69a876a90981e8bd3c40b1be413f8dc88f40" dependencies = [ - "proc-macro-crate", + "proc-macro-crate 3.5.0", "proc-macro2", "quote", "syn 3.0.9", @@ -6295,7 +6916,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "812a12be4ead7a59e18ea8f047d08add0066b73bc62fc1467066a2472ae088dd" dependencies = [ "serde", - "winnow", + "winnow 1.0.4", "zvariant", ] @@ -6306,7 +6927,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d1586c021a01ca0a9216dcd874e546382e156a5cbab5fab6cb5f10087e22682a" dependencies = [ "serde", - "winnow", + "winnow 1.0.4", "zbus_names", "zvariant", ] @@ -6453,7 +7074,7 @@ dependencies = [ "enumflags2", "serde", "url", - "winnow", + "winnow 1.0.4", "zcheapstr", "zvariant_derive", "zvariant_utils", @@ -6465,7 +7086,7 @@ version = "5.15.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ef2672456ba1cb54b5eaec136e63135b3c7495fb938e53b28a62e633496d486d" dependencies = [ - "proc-macro-crate", + "proc-macro-crate 3.5.0", "proc-macro2", "quote", "syn 3.0.9", @@ -6482,5 +7103,5 @@ dependencies = [ "quote", "serde", "syn 3.0.9", - "winnow", + "winnow 1.0.4", ] diff --git a/Cargo.toml b/Cargo.toml index 60a554a..5de748e 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [workspace] resolver = "2" -members = ["crates/gipfel-core", "crates/gipfel-cli", "crates/gipfel-app", "crates/gipfel-wasm"] +members = ["crates/gipfel-core", "crates/gipfel-cli", "crates/gipfel-app", "crates/gipfel-wasm", "crates/gipfel-web"] # Single source of truth for metadata inherited by every crate via # `version.workspace = true` etc. Bump `version` here on release; the diff --git a/crates/gipfel-web/Cargo.toml b/crates/gipfel-web/Cargo.toml new file mode 100644 index 0000000..b53fdaa --- /dev/null +++ b/crates/gipfel-web/Cargo.toml @@ -0,0 +1,37 @@ +[package] +name = "gipfel-web" +version.workspace = true +edition.workspace = true +license.workspace = true +description = "gipfel web — browser front end (WASM)" + +[dependencies] +gipfel-core = { path = "../gipfel-core" } +js-sys = "0.3" +wasm-bindgen = "0.2" +wasm-bindgen-futures = "0.4" +yew = { version = "0.21", features = ["csr"] } + +[dependencies.web-sys] +version = "0.3" +features = [ + "Blob", + "CanvasRenderingContext2d", + "DataTransfer", + "Document", + "DomRect", + "DragEvent", + "Element", + "Event", + "EventTarget", + "File", + "FileList", + "HtmlCanvasElement", + "HtmlElement", + "HtmlInputElement", + "ImageBitmap", + "MouseEvent", + "PointerEvent", + "Window", + "WheelEvent", +] diff --git a/crates/gipfel-web/README.md b/crates/gipfel-web/README.md new file mode 100644 index 0000000..2442e67 --- /dev/null +++ b/crates/gipfel-web/README.md @@ -0,0 +1,46 @@ +# gipfel-web + +Browser front end for gipfel (WASM, Yew + canvas 2D). See +[`/wasm-plan.md`](../../wasm-plan.md) for the overall plan and milestones. + +**Status: W1 (scaffold + image display) done** — open/drag-drop a JPEG, +pan (drag) and zoom (wheel, cursor-anchored). Peak identification, +fitting and saving arrive in W2/W3. + +## Development + +Prerequisites: [rustup](https://rustup.rs) and trunk: + +```sh +cargo install --locked trunk +``` + +Serve with hot reload: + +```sh +cd crates/gipfel-web +trunk serve --port 8090 # then open http://localhost:8090 +``` + +Release build (static output in `dist/`, serveable by any web server): + +```sh +trunk build --release +``` + +## Layout + +| File | Purpose | +|---|---| +| `src/main.rs` | entry point | +| `src/app.rs` | root component: sidebar, file loading, state | +| `src/canvas_view.rs` | viewport canvas: bitmap blit, pan/zoom | +| `src/bridge.rs` | JS glue: image decode, blob read, canvas ctx | +| `www/` | index.html, style.css (trunk assets) | + +## Notes + +- The base image is decoded by the browser (`createImageBitmap`), not + by the `image` crate — faster decode and GPU-backed blitting. +- The crate compiles natively (`cargo check -p gipfel-web`) so it can + be checked in CI without a wasm toolchain; runtime is wasm-only. diff --git a/crates/gipfel-web/Trunk.toml b/crates/gipfel-web/Trunk.toml new file mode 100644 index 0000000..1772684 --- /dev/null +++ b/crates/gipfel-web/Trunk.toml @@ -0,0 +1,2 @@ +[build] +target = "www/index.html" diff --git a/crates/gipfel-web/src/app.rs b/crates/gipfel-web/src/app.rs new file mode 100644 index 0000000..9e8c543 --- /dev/null +++ b/crates/gipfel-web/src/app.rs @@ -0,0 +1,193 @@ +//! Root component: sidebar (open/fit/status) + viewport canvas. +//! File loading: `` and drag-and-drop, decoded by the +//! browser into an ImageBitmap (see `bridge`). + +use std::rc::Rc; +use wasm_bindgen::closure::Closure; +use wasm_bindgen::JsCast; +use wasm_bindgen_futures::spawn_local; +use web_sys::{DragEvent, Event, HtmlCanvasElement, HtmlInputElement, MouseEvent}; +use yew::prelude::*; + +use crate::bridge; +use crate::canvas_view::{CanvasView, ViewCallbacks, ViewState}; + +#[function_component(App)] +pub fn app() -> Html { + let bitmap = use_state(|| None::); + let view = use_state(ViewState::default); + let status = use_state(|| "No image loaded.".to_string()); + let tick = use_state(|| 0u32); + let canvas_ref = use_node_ref(); + let file_ref = use_node_ref(); + + // force a redraw when the window is resized so the canvas backing + // store tracks its CSS size (listener lives as long as the app) + { + let tick = tick.clone(); + use_effect_with((), move |_| { + let closure = Closure::wrap(Box::new(move || tick.set(*tick + 1)) as Box); + let _ = bridge::window() + .add_event_listener_with_callback("resize", closure.as_ref().unchecked_ref()); + // the listener is never removed (app lifetime); leak the closure + std::mem::forget(closure); + }); + } + + // Fit the current bitmap into the canvas, centered. + let fit = { + let bitmap = bitmap.clone(); + let view = view.clone(); + let canvas_ref = canvas_ref.clone(); + Callback::from(move |_: MouseEvent| { + let Some(bmp) = bitmap.as_ref() else { return }; + let (cw, ch) = canvas_ref + .cast::() + .map(|c| (c.client_width() as f64, c.client_height() as f64)) + .unwrap_or((800.0, 600.0)); + let (iw, ih) = (bmp.width() as f64, bmp.height() as f64); + if iw <= 0.0 || ih <= 0.0 || cw <= 0.0 || ch <= 0.0 { + return; + } + let scale = (cw / iw).min(ch / ih); + view.set(ViewState { + scale, + ox: (cw - iw * scale) / 2.0, + oy: (ch - ih * scale) / 2.0, + }); + }) + }; + + // Decode dropped/selected bytes and display them, fitting to view. + let load_bytes = { + let bitmap = bitmap.clone(); + let status = status.clone(); + let fit = fit.clone(); + Callback::from(move |(bytes, name): (Vec, String)| { + let (bitmap, status, fit) = (bitmap.clone(), status.clone(), fit.clone()); + spawn_local(async move { + match bridge::decode_bitmap(&bytes).await { + Ok(bmp) => { + status.set(format!( + "{name} — {}×{} px", + bmp.width(), + bmp.height() + )); + bitmap.set(Some(bmp)); + fit.emit(MouseEvent::new("fit").unwrap()); + } + Err(e) => status.set(format!("Failed to load {name}: {e}")), + } + }); + }) + }; + + let read_file = { + let load_bytes = load_bytes.clone(); + let status = status.clone(); + Rc::new(move |file: web_sys::File| { + let (load_bytes, status) = (load_bytes.clone(), status.clone()); + let name = file.name(); + spawn_local(async move { + match bridge::read_blob(&file).await { + Ok(bytes) => load_bytes.emit((bytes, name)), + Err(e) => status.set(format!("Failed to read {name}: {e}")), + } + }); + }) + }; + + let on_file_change = { + let read_file = read_file.clone(); + Callback::from(move |e: Event| { + let input: HtmlInputElement = e.target_unchecked_into(); + if let Some(file) = input.files().and_then(|fl| fl.item(0)) { + read_file(file); + } + }) + }; + + let on_drop = { + let read_file = read_file.clone(); + let status = status.clone(); + Callback::from(move |e: DragEvent| { + e.prevent_default(); + match e.data_transfer().and_then(|dt| dt.files()).and_then(|fl| fl.item(0)) { + Some(file) => read_file(file), + None => status.set("Dropped item was not a file.".to_string()), + } + }) + }; + let on_dragover = Callback::from(|e: DragEvent| e.prevent_default()); + + let open_picker = { + let file_ref = file_ref.clone(); + Callback::from(move |_: MouseEvent| { + if let Some(input) = file_ref.cast::() { + input.click(); + } + }) + }; + + let callbacks = ViewCallbacks { + pan: { + let view = view.clone(); + Callback::from(move |(dx, dy): (f64, f64)| { + let mut v = (*view).clone(); + v.ox += dx; + v.oy += dy; + view.set(v); + }) + }, + zoom: { + let view = view.clone(); + Callback::from(move |(cx, cy, factor): (f64, f64, f64)| { + let v = &*view; + let ns = (v.scale * factor).clamp(0.02, 64.0); + let k = ns / v.scale; + view.set(ViewState { + scale: ns, + ox: cx - (cx - v.ox) * k, + oy: cy - (cy - v.oy) * k, + }); + }) + }, + }; + + let zoom_pct = (view.scale * 100.0).round(); + + html! { +
+ +
+ +
+
+ } +} diff --git a/crates/gipfel-web/src/bridge.rs b/crates/gipfel-web/src/bridge.rs new file mode 100644 index 0000000..1353279 --- /dev/null +++ b/crates/gipfel-web/src/bridge.rs @@ -0,0 +1,45 @@ +//! Small JS helpers: window access, browser-native image decode, blob +//! reads, canvas context — the hand-written JS boundary of the app. + +use js_sys::Uint8Array; +use wasm_bindgen::JsCast; +use wasm_bindgen_futures::JsFuture; +use web_sys::{Blob, CanvasRenderingContext2d, HtmlCanvasElement, ImageBitmap, Window}; + +pub fn window() -> Window { + web_sys::window().expect("no global window") +} + +/// Decode image bytes into a browser-native (GPU-backed) bitmap. +/// The browser does the JPEG decode and keeps the pixels where canvas +/// blitting is fast — cheaper than any pure-Rust path in wasm. +pub async fn decode_bitmap(bytes: &[u8]) -> Result { + let array = js_sys::Array::new(); + array.push(&Uint8Array::from(bytes).buffer()); + let blob = Blob::new_with_u8_array_sequence(&array).map_err(|_| "blob failed".to_string())?; + let promise = window() + .create_image_bitmap_with_blob(&blob) + .map_err(|_| "createImageBitmap failed".to_string())?; + let value = JsFuture::from(promise) + .await + .map_err(|e| format!("decode failed: {e:?}"))?; + value + .dyn_into::() + .map_err(|_| "decode produced non-bitmap".to_string()) +} + +/// Read a File/Blob fully into memory. +pub async fn read_blob(blob: &Blob) -> Result, String> { + let buf = JsFuture::from(blob.array_buffer()) + .await + .map_err(|e| format!("read failed: {e:?}"))?; + Ok(Uint8Array::new(&buf).to_vec()) +} + +pub fn ctx2d(canvas: &HtmlCanvasElement) -> Option { + canvas + .get_context("2d") + .ok() + .flatten() + .and_then(|c| c.dyn_into::().ok()) +} diff --git a/crates/gipfel-web/src/canvas_view.rs b/crates/gipfel-web/src/canvas_view.rs new file mode 100644 index 0000000..87b89d9 --- /dev/null +++ b/crates/gipfel-web/src/canvas_view.rs @@ -0,0 +1,148 @@ +//! Viewport canvas: browser-native bitmap blitted with a pan/zoom +//! transform. Overlay drawing (markers, labels, compass) is added in W3. + +use web_sys::{HtmlCanvasElement, ImageBitmap, PointerEvent, WheelEvent};use yew::prelude::*; + +use crate::bridge; + +/// Image -> screen transform: `screen = img * scale + (ox, oy)`. +/// Same convention as the desktop viewport widget. +#[derive(Clone, Debug, PartialEq, Default)] +pub struct ViewState { + pub scale: f64, + pub ox: f64, + pub oy: f64, +} + +#[derive(Clone, PartialEq)] +pub struct ViewCallbacks { + pub pan: Callback<(f64, f64)>, + /// (cursor x, cursor y, factor) — zoom anchored at the cursor. + pub zoom: Callback<(f64, f64, f64)>, +} + +#[derive(Properties, PartialEq)] +pub struct Props { + pub bitmap: Option, + pub view: ViewState, + pub callbacks: ViewCallbacks, + pub canvas_ref: NodeRef, + /// bumped on window resize to force a redraw + pub tick: u32, +} + +#[function_component(CanvasView)] +pub fn canvas_view(props: &Props) -> Html { + let dragging = use_mut_ref(|| false); + let last = use_mut_ref(|| (0.0f64, 0.0f64)); + + // redraw on every view/bitmap change and on resize ticks + { + let bitmap = props.bitmap.clone(); + let view = props.view.clone(); + let canvas_ref = props.canvas_ref.clone(); + use_effect_with((bitmap, view, props.tick), move |(bitmap, view, _tick)| { + let Some(canvas) = canvas_ref.cast::() else { + return; + }; + let Some(ctx) = bridge::ctx2d(&canvas) else { + return; + }; + let dpr = bridge::window().device_pixel_ratio(); + let cw = canvas.client_width() as f64; + let ch = canvas.client_height() as f64; + // keep the backing store in sync with the CSS size + let bw = (cw * dpr).max(1.0) as u32; + let bh = (ch * dpr).max(1.0) as u32; + if canvas.width() != bw || canvas.height() != bh { + canvas.set_width(bw); + canvas.set_height(bh); + } + let _ = ctx.set_transform(1.0, 0.0, 0.0, 1.0, 0.0, 0.0); + // web-sys 0.3: set_fill_style takes a JsValue (deprecated alias) + #[allow(deprecated)] + ctx.set_fill_style(&wasm_bindgen::JsValue::from_str("#101014")); + ctx.fill_rect(0.0, 0.0, canvas.width() as f64, canvas.height() as f64); + if let Some(bitmap) = bitmap { + let _ = ctx.set_transform( + dpr * view.scale, + 0.0, + 0.0, + dpr * view.scale, + dpr * view.ox, + dpr * view.oy, + ); + let _ = ctx.draw_image_with_image_bitmap(bitmap, 0.0, 0.0); + } + }); + } + + let on_pointerdown = { + let dragging = dragging.clone(); + let last = last.clone(); + let canvas_ref = props.canvas_ref.clone(); + Callback::from(move |e: PointerEvent| { + e.prevent_default(); + if let Some(c) = canvas_ref.cast::() { + let _ = c.set_pointer_capture(e.pointer_id()); + } + *dragging.borrow_mut() = true; + *last.borrow_mut() = (e.client_x() as f64, e.client_y() as f64); + }) + }; + let on_pointermove = { + let dragging = dragging.clone(); + let last = last.clone(); + let pan = props.callbacks.pan.clone(); + Callback::from(move |e: PointerEvent| { + if !*dragging.borrow() { + return; + } + let cur = (e.client_x() as f64, e.client_y() as f64); + let prev = *last.borrow(); + *last.borrow_mut() = cur; + pan.emit((cur.0 - prev.0, cur.1 - prev.1)); + }) + }; + let on_pointerup = { + let dragging = dragging.clone(); + let canvas_ref = props.canvas_ref.clone(); + Callback::from(move |e: PointerEvent| { + *dragging.borrow_mut() = false; + if let Some(c) = canvas_ref.cast::() { + let _ = c.release_pointer_capture(e.pointer_id()); + } + }) + }; + let on_wheel = { + let zoom = props.callbacks.zoom.clone(); + let canvas_ref = props.canvas_ref.clone(); + Callback::from(move |e: WheelEvent| { + e.prevent_default(); + let cx = e.client_x() as f64 + - canvas_ref + .cast::() + .map(|c| c.get_bounding_client_rect().left()) + .unwrap_or(0.0); + let cy = e.client_y() as f64 + - canvas_ref + .cast::() + .map(|c| c.get_bounding_client_rect().top()) + .unwrap_or(0.0); + let factor = 1.0015f64.powf(-(e.delta_y() as f64)); + zoom.emit((cx, cy, factor)); + }) + }; + + html! { + + } +} diff --git a/crates/gipfel-web/src/main.rs b/crates/gipfel-web/src/main.rs new file mode 100644 index 0000000..6a3e4d4 --- /dev/null +++ b/crates/gipfel-web/src/main.rs @@ -0,0 +1,7 @@ +mod app; +mod bridge; +mod canvas_view; + +fn main() { + yew::Renderer::::new().render(); +} diff --git a/crates/gipfel-web/www/index.html b/crates/gipfel-web/www/index.html new file mode 100644 index 0000000..c601fee --- /dev/null +++ b/crates/gipfel-web/www/index.html @@ -0,0 +1,11 @@ + + + + + + gipfel web + + + + + diff --git a/crates/gipfel-web/www/style.css b/crates/gipfel-web/www/style.css new file mode 100644 index 0000000..5ea080d --- /dev/null +++ b/crates/gipfel-web/www/style.css @@ -0,0 +1,77 @@ +* { + box-sizing: border-box; +} +html, +body { + margin: 0; + height: 100%; + font-family: system-ui, sans-serif; +} +.app { + display: flex; + height: 100vh; + background: #101014; + color: #e8e8ea; +} +.sidebar { + width: 300px; + padding: 16px; + background: #1a1a20; + border-right: 1px solid #2c2c34; + display: flex; + flex-direction: column; + gap: 8px; + overflow-y: auto; +} +.sidebar h1 { + margin: 0; + font-size: 22px; +} +.tag { + margin: 0 0 12px; + color: #8a8a94; + font-size: 12px; + text-transform: uppercase; + letter-spacing: 1px; +} +.sidebar button { + padding: 8px 12px; + background: #3b6fd4; + color: #fff; + border: 0; + border-radius: 6px; + font-size: 14px; + cursor: pointer; +} +.sidebar button:hover { + background: #4a7ee4; +} +.status { + font-size: 13px; + color: #c8c8d0; + word-break: break-word; +} +.hint { + font-size: 12px; + color: #8a8a94; +} +.dim { + opacity: 0.6; +} +.hidden-file { + display: none; +} +.main { + flex: 1; + position: relative; + min-width: 0; +} +canvas.viewport { + position: absolute; + inset: 0; + width: 100%; + height: 100%; + display: block; + touch-action: none; + cursor: grab; +} -- cgit v1.2.3 From beeba1a1da4e7abff0de2cc6420fb5bae580861c Mon Sep 17 00:00:00 2001 From: Johannes Hofmann Date: Tue, 27 Oct 2026 15:13:46 +0100 Subject: web: release build script producing a deployable static site build-release.sh assembles dist/wipfel/ with the loader page, style, wasm bundle and the gzipped hill database. All runtime fetches are relative to the page URL, so the directory works under any path on any static server (verified from a subdirectory). --- .gitignore | 1 + crates/wipfel/build-release.sh | 18 ++++++++++++++++++ crates/wipfel/www/index.html | 15 +++++++++++++++ 3 files changed, 34 insertions(+) create mode 100755 crates/wipfel/build-release.sh create mode 100644 crates/wipfel/www/index.html (limited to '.gitignore') diff --git a/.gitignore b/.gitignore index fbccf5e..33f5351 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,7 @@ /target tests/harness/build/ crates/gipfel-wasm/pkg/ +dist/ crates/gipfel-web/dist/ *.tmp gipfel-app-bin.tar.gz diff --git a/crates/wipfel/build-release.sh b/crates/wipfel/build-release.sh new file mode 100755 index 0000000..0bec70f --- /dev/null +++ b/crates/wipfel/build-release.sh @@ -0,0 +1,18 @@ +#!/bin/sh +# Build wipfel and assemble a deployable static site in dist/wipfel/. +# Everything the app loads (wasm, hill database, stylesheet) is fetched +# relative to the page URL, so the directory can be mounted under any +# path on any static server. +set -e +cd "$(dirname "$0")/../.." +cargo build -p wipfel --target wasm32-unknown-unknown --release +DIST=dist/wipfel +rm -rf "$DIST" +mkdir -p "$DIST" +wasm-bindgen --target web --out-dir "$DIST" target/wasm32-unknown-unknown/release/wipfel.wasm +# the loader page (not the trunk entry point, which is dev-only) +rm -f "$DIST"/wipfel.d.ts "$DIST"/wipfel_bg.wasm.d.ts +cp crates/wipfel/www/index.html crates/wipfel/www/style.css "$DIST/" +gzip -9 -n -c gipfel.dat > "$DIST/gipfel.dat.gz" +echo "site assembled in $DIST ($(du -sh "$DIST" | cut -f1)):" +ls "$DIST" diff --git a/crates/wipfel/www/index.html b/crates/wipfel/www/index.html new file mode 100644 index 0000000..5297a72 --- /dev/null +++ b/crates/wipfel/www/index.html @@ -0,0 +1,15 @@ + + + + + + wipfel — web based gipfel photogrammetry + + + + + + -- cgit v1.2.3 From acd22ac3f2740d075806845805a5b26490ca4c3b Mon Sep 17 00:00:00 2001 From: Johannes Hofmann Date: Tue, 27 Oct 2026 15:46:06 +0100 Subject: web: commit built static site under dist/wipfel/ The flpsed.org site is generated statically; keeping the deployable bundle in the tree lets the site pipeline pick it up directly. Regenerate with crates/wipfel/build-release.sh. --- .gitignore | 2 - crates/wipfel/build-release.sh | 7 +- dist/wipfel/gipfel.dat.gz | Bin 0 -> 346448 bytes dist/wipfel/index.html | 15 + dist/wipfel/style.css | 270 +++++++++++ dist/wipfel/wipfel.js | 1010 ++++++++++++++++++++++++++++++++++++++++ dist/wipfel/wipfel_bg.wasm | Bin 0 -> 507419 bytes 7 files changed, 1300 insertions(+), 4 deletions(-) create mode 100644 dist/wipfel/gipfel.dat.gz create mode 100644 dist/wipfel/index.html create mode 100644 dist/wipfel/style.css create mode 100644 dist/wipfel/wipfel.js create mode 100644 dist/wipfel/wipfel_bg.wasm (limited to '.gitignore') diff --git a/.gitignore b/.gitignore index 33f5351..07849dd 100644 --- a/.gitignore +++ b/.gitignore @@ -1,7 +1,5 @@ /target tests/harness/build/ crates/gipfel-wasm/pkg/ -dist/ -crates/gipfel-web/dist/ *.tmp gipfel-app-bin.tar.gz diff --git a/crates/wipfel/build-release.sh b/crates/wipfel/build-release.sh index 0bec70f..1ee09b7 100755 --- a/crates/wipfel/build-release.sh +++ b/crates/wipfel/build-release.sh @@ -5,11 +5,14 @@ # path on any static server. set -e cd "$(dirname "$0")/../.." -cargo build -p wipfel --target wasm32-unknown-unknown --release +# size-optimized build for the web (the workspace default profile +# targets native binaries); --remove-name-section drops the debug +# symbol names wasm-bindgen adds for devtools +CARGO_PROFILE_RELEASE_OPT_LEVEL=z cargo build -p wipfel --target wasm32-unknown-unknown --release DIST=dist/wipfel rm -rf "$DIST" mkdir -p "$DIST" -wasm-bindgen --target web --out-dir "$DIST" target/wasm32-unknown-unknown/release/wipfel.wasm +wasm-bindgen --remove-name-section --target web --out-dir "$DIST" target/wasm32-unknown-unknown/release/wipfel.wasm # the loader page (not the trunk entry point, which is dev-only) rm -f "$DIST"/wipfel.d.ts "$DIST"/wipfel_bg.wasm.d.ts cp crates/wipfel/www/index.html crates/wipfel/www/style.css "$DIST/" diff --git a/dist/wipfel/gipfel.dat.gz b/dist/wipfel/gipfel.dat.gz new file mode 100644 index 0000000..94742bb Binary files /dev/null and b/dist/wipfel/gipfel.dat.gz differ diff --git a/dist/wipfel/index.html b/dist/wipfel/index.html new file mode 100644 index 0000000..5297a72 --- /dev/null +++ b/dist/wipfel/index.html @@ -0,0 +1,15 @@ + + + + + + wipfel — web based gipfel photogrammetry + + + + + + diff --git a/dist/wipfel/style.css b/dist/wipfel/style.css new file mode 100644 index 0000000..d706a8d --- /dev/null +++ b/dist/wipfel/style.css @@ -0,0 +1,270 @@ +* { + box-sizing: border-box; +} +html, +body { + margin: 0; + height: 100%; + font-family: system-ui, sans-serif; +} +.app { + display: flex; + height: 100vh; + background: #101014; + color: #e8e8ea; +} +.sidebar { + width: 300px; + padding: 16px; + background: #1a1a20; + border-right: 1px solid #2c2c34; + display: flex; + flex-direction: column; + gap: 8px; + overflow-y: auto; + position: relative; +} +.sidebar.collapsed { + display: none; +} +.sidebar .collapse-btn { + position: absolute; + top: 10px; + right: 10px; + width: 28px; + height: 28px; + padding: 0; + background: #2c2c34; + font-size: 12px; + border-radius: 5px; +} +.sidebar .collapse-btn:hover { + background: #3b3b46; +} +.nav-toggle { + position: absolute; + top: 10px; + left: 10px; + z-index: 5; + width: 36px; + height: 36px; + padding: 0; + background: rgba(26, 26, 32, 0.85); + color: #e8e8ea; + border: 1px solid #2c2c34; + border-radius: 6px; + font-size: 16px; + cursor: pointer; +} +.nav-toggle:hover { + background: rgba(59, 111, 212, 0.9); +} +.sidebar h1 { + margin: 0; + font-size: 22px; +} +.tag { + margin: 0 0 12px; + color: #8a8a94; + font-size: 12px; + text-transform: uppercase; + letter-spacing: 1px; +} +.moreinfo { + color: #7fa5e8; + font-size: 12px; + text-decoration: none; + margin-top: -6px; +} +.moreinfo:hover { + text-decoration: underline; +} +.sidebar button { + padding: 8px 12px; + background: #3b6fd4; + color: #fff; + border: 0; + border-radius: 6px; + font-size: 14px; + cursor: pointer; +} +.sidebar button:hover { + background: #4a7ee4; +} +.status { + font-size: 13px; + color: #c8c8d0; + word-break: break-word; +} +.hint { + font-size: 12px; + color: #8a8a94; +} +.row { + display: flex; + gap: 6px; + align-items: center; + font-size: 13px; + cursor: pointer; +} +.fitinfo { + font-size: 12px; + color: #9fd09f; + font-variant-numeric: tabular-nums; +} +.hover { + font-size: 14px; + font-weight: 600; + color: #ffffff; +} +.dim { + opacity: 0.6; +} +.hidden-file { + display: none; +} +/* pin the optional track section to the bottom of the control pane */ +.track-section { + margin-top: auto; +} +.main { + flex: 1; + min-width: 0; + display: flex; + flex-direction: column; +} +.canvaswrap { + flex: 1; + position: relative; + min-height: 0; +} +canvas.viewport { + position: absolute; + inset: 0; + width: 100%; + height: 100%; + display: block; + touch-action: none; + cursor: grab; +} +canvas.compass { + display: block; + width: 100%; + touch-action: none; + cursor: ew-resize; +} +.section { + margin-top: 14px; + font-size: 11px; + text-transform: uppercase; + letter-spacing: 1px; + color: #8a8a94; + border-bottom: 1px solid #2c2c34; + padding-bottom: 3px; +} +.slider { + display: flex; + flex-direction: column; + gap: 2px; + margin-top: 8px; +} +.sliderhead { + display: flex; + justify-content: space-between; + font-size: 12px; + color: #c8c8d0; +} +.slider input[type="range"] { + width: 100%; +} +.numrow { + display: flex; + justify-content: space-between; + align-items: center; + gap: 8px; + font-size: 13px; + margin-top: 6px; +} +.numrow input { + width: 130px; + padding: 4px 6px; + background: #24242c; + color: #e8e8ea; + border: 1px solid #34343e; + border-radius: 4px; +} +.fpbackdrop { + position: absolute; + inset: 0; + z-index: 9; +} +.findpeak { + position: absolute; + z-index: 10; + width: 280px; + background: #1e1e26; + border: 1px solid #3a3a46; + border-radius: 6px; + box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5); + display: flex; + flex-direction: column; +} +.fpsearch { + padding: 8px; + border-bottom: 1px solid #2c2c34; +} +.fpsearch input { + width: 100%; + padding: 5px 8px; + background: #24242c; + border: 1px solid #3a3a46; + border-radius: 4px; + color: #e8e8ea; + font-size: 13px; +} +.fplist { + max-height: 320px; + overflow-y: auto; +} +.fpempty { + padding: 8px 10px; + font-size: 13px; + color: #8a8a94; + margin: 0; +} +.fpfoot { + padding: 6px 8px; + border-top: 1px solid #2c2c34; + text-align: right; +} +.fpcancel { + padding: 4px 12px; + background: #34343e; + color: #e8e8ea; + border: 0; + border-radius: 4px; + font-size: 12px; + cursor: pointer; +} +.fphead { + padding: 6px 10px; + font-size: 11px; + text-transform: uppercase; + letter-spacing: 1px; + color: #8a8a94; + border-bottom: 1px solid #2c2c34; +} +.fpitem { + display: block; + width: 100%; + text-align: left; + padding: 6px 10px; + background: none; + border: 0; + color: #e8e8ea; + font-size: 13px; + cursor: pointer; +} +.fpitem:hover { + background: #2f6fd4; +} diff --git a/dist/wipfel/wipfel.js b/dist/wipfel/wipfel.js new file mode 100644 index 0000000..9119aea --- /dev/null +++ b/dist/wipfel/wipfel.js @@ -0,0 +1,1010 @@ +/* @ts-self-types="./wipfel.d.ts" */ +function __wbg_get_imports() { + const import0 = { + __proto__: null, + __wbg___wbindgen_debug_string_4687d8d8c2017d52: function(arg0, arg1) { + const ret = debugString(arg1); + const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc); + const len1 = WASM_VECTOR_LEN; + getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true); + getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true); + }, + __wbg___wbindgen_is_function_1f9d30630b8b1d3d: function(arg0) { + const ret = typeof(arg0) === 'function'; + return ret; + }, + __wbg___wbindgen_is_undefined_8865fb403f8fe9d8: function(arg0) { + const ret = arg0 === undefined; + return ret; + }, + __wbg___wbindgen_number_get_2e0e7dee9f701a71: function(arg0, arg1) { + const obj = arg1; + const ret = typeof(obj) === 'number' ? obj : undefined; + getDataViewMemory0().setFloat64(arg0 + 8 * 1, isLikeNone(ret) ? 0 : ret, true); + getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true); + }, + __wbg___wbindgen_throw_41e9ee4f547fc59a: function(arg0, arg1) { + throw new Error(getStringFromWasm0(arg0, arg1)); + }, + __wbg__wbg_cb_unref_dcc1a90847f04c41: function(arg0) { + arg0._wbg_cb_unref(); + }, + __wbg_addEventListener_4d0db17c671ea324: function() { return handleError(function (arg0, arg1, arg2, arg3) { + arg0.addEventListener(getStringFromWasm0(arg1, arg2), arg3); + }, arguments); }, + __wbg_addEventListener_8d3235978b9c69a8: function() { return handleError(function (arg0, arg1, arg2, arg3, arg4) { + arg0.addEventListener(getStringFromWasm0(arg1, arg2), arg3, arg4); + }, arguments); }, + __wbg_arc_03f7717b2e38682a: function() { return handleError(function (arg0, arg1, arg2, arg3, arg4, arg5) { + arg0.arc(arg1, arg2, arg3, arg4, arg5); + }, arguments); }, + __wbg_arrayBuffer_0fe6e1300abcf908: function(arg0) { + const ret = arg0.arrayBuffer(); + return ret; + }, + __wbg_arrayBuffer_f07be74819944ea2: function() { return handleError(function (arg0) { + const ret = arg0.arrayBuffer(); + return ret; + }, arguments); }, + __wbg_beginPath_8598d895c13f1c86: function(arg0) { + arg0.beginPath(); + }, + __wbg_body_e549239eaff082e1: function(arg0) { + const ret = arg0.body; + return isLikeNone(ret) ? 0 : addToExternrefTable0(ret); + }, + __wbg_bubbles_90592d3579b278ea: function(arg0) { + const ret = arg0.bubbles; + return ret; + }, + __wbg_buffer_56ec2905a66f58b9: function(arg0) { + const ret = arg0.buffer; + return ret; + }, + __wbg_cache_key_21c521bc3dd66e9b: function(arg0) { + const ret = arg0.__yew_subtree_cache_key; + return isLikeNone(ret) ? Number.MAX_SAFE_INTEGER : (ret) >>> 0; + }, + __wbg_cancelBubble_317b9e84df6f26ee: function(arg0) { + const ret = arg0.cancelBubble; + return ret; + }, + __wbg_checked_dfbd69c1f78ce37d: function(arg0) { + const ret = arg0.checked; + return ret; + }, + __wbg_childNodes_9542af79c583ae90: function(arg0) { + const ret = arg0.childNodes; + return ret; + }, + __wbg_click_d990e70c576b7c54: function(arg0) { + arg0.click(); + }, + __wbg_clientHeight_33dd2a2c8630a1f1: function(arg0) { + const ret = arg0.clientHeight; + return ret; + }, + __wbg_clientWidth_08d5512595aacb73: function(arg0) { + const ret = arg0.clientWidth; + return ret; + }, + __wbg_clientX_5075231ed45e8ef5: function(arg0) { + const ret = arg0.clientX; + return ret; + }, + __wbg_clientY_846c39814ce02ab2: function(arg0) { + const ret = arg0.clientY; + return ret; + }, + __wbg_cloneNode_a3ed8db010540e0d: function() { return handleError(function (arg0) { + const ret = arg0.cloneNode(); + return ret; + }, arguments); }, + __wbg_closePath_355eb6da179dd9c2: function(arg0) { + arg0.closePath(); + }, + __wbg_composedPath_ebbc1f73360cd735: function(arg0) { + const ret = arg0.composedPath(); + return ret; + }, + __wbg_createElementNS_957ec8b66176901e: function() { return handleError(function (arg0, arg1, arg2, arg3, arg4) { + const ret = arg0.createElementNS(arg1 === 0 ? undefined : getStringFromWasm0(arg1, arg2), getStringFromWasm0(arg3, arg4)); + return ret; + }, arguments); }, + __wbg_createElement_74049073a11f9c31: function() { return handleError(function (arg0, arg1, arg2) { + const ret = arg0.createElement(getStringFromWasm0(arg1, arg2)); + return ret; + }, arguments); }, + __wbg_createImageBitmap_1a53b9fe15f242e6: function() { return handleError(function (arg0, arg1) { + const ret = arg0.createImageBitmap(arg1); + return ret; + }, arguments); }, + __wbg_createTextNode_561b59dda21e4ea7: function(arg0, arg1, arg2) { + const ret = arg0.createTextNode(getStringFromWasm0(arg1, arg2)); + return ret; + }, + __wbg_dataTransfer_afa27477f2f9e0e6: function(arg0) { + const ret = arg0.dataTransfer; + return isLikeNone(ret) ? 0 : addToExternrefTable0(ret); + }, + __wbg_deltaY_7abc8fc9878d0002: function(arg0) { + const ret = arg0.deltaY; + return ret; + }, + __wbg_devicePixelRatio_7d39e9af5448d3d4: function(arg0) { + const ret = arg0.devicePixelRatio; + return ret; + }, + __wbg_document_9854e03c05fc8834: function(arg0) { + const ret = arg0.document; + return isLikeNone(ret) ? 0 : addToExternrefTable0(ret); + }, + __wbg_drawImage_8dc81ba1e3ffae74: function() { return handleError(function (arg0, arg1, arg2, arg3) { + arg0.drawImage(arg1, arg2, arg3); + }, arguments); }, + __wbg_error_757e9472f8410341: function(arg0, arg1) { + let deferred0_0; + let deferred0_1; + try { + deferred0_0 = arg0; + deferred0_1 = arg1; + console.error(getStringFromWasm0(arg0, arg1)); + } finally { + wasm.__wbindgen_free(deferred0_0, deferred0_1, 1); + } + }, + __wbg_error_b1df75078f69c897: function(arg0, arg1) { + var v0 = getArrayJsValueFromWasm0(arg0, arg1); + wasm.__wbindgen_free(arg0, arg1 * 4, 4); + console.error(...(v0)); + }, + __wbg_fetch_4178962c570137ca: function(arg0, arg1, arg2) { + const ret = arg0.fetch(getStringFromWasm0(arg1, arg2)); + return ret; + }, + __wbg_files_cb1ce1b82f16c484: function(arg0) { + const ret = arg0.files; + return isLikeNone(ret) ? 0 : addToExternrefTable0(ret); + }, + __wbg_files_fe03006f0ba1a5f0: function(arg0) { + const ret = arg0.files; + return isLikeNone(ret) ? 0 : addToExternrefTable0(ret); + }, + __wbg_fillRect_0ef59adb9acb7d06: function(arg0, arg1, arg2, arg3, arg4) { + arg0.fillRect(arg1, arg2, arg3, arg4); + }, + __wbg_fillText_1bcec8b81ad73bd0: function() { return handleError(function (arg0, arg1, arg2, arg3, arg4) { + arg0.fillText(getStringFromWasm0(arg1, arg2), arg3, arg4); + }, arguments); }, + __wbg_fill_fc5e02a06cc26e92: function(arg0) { + arg0.fill(); + }, + __wbg_focus_f740d61348f422e7: function() { return handleError(function (arg0) { + arg0.focus(); + }, arguments); }, + __wbg_from_296ca31f8d0f1c52: function(arg0) { + const ret = Array.from(arg0); + return ret; + }, + __wbg_getBoundingClientRect_57152b1a20f3de34: function(arg0) { + const ret = arg0.getBoundingClientRect(); + return ret; + }, + __wbg_getContext_635e36719cad2623: function() { return handleError(function (arg0, arg1, arg2) { + const ret = arg0.getContext(getStringFromWasm0(arg1, arg2)); + return isLikeNone(ret) ? 0 : addToExternrefTable0(ret); + }, arguments); }, + __wbg_get_6c896e0571ddae51: function(arg0, arg1) { + const ret = arg0[arg1 >>> 0]; + return ret; + }, + __wbg_height_9dca4d43c3e4b84b: function(arg0) { + const ret = arg0.height; + return ret; + }, + __wbg_height_fc97e1a0c2e7331f: function(arg0) { + const ret = arg0.height; + return ret; + }, + __wbg_host_c1e5897b2ece281c: function(arg0) { + const ret = arg0.host; + return ret; + }, + __wbg_innerWidth_1bc526614080537c: function() { return handleError(function (arg0) { + const ret = arg0.innerWidth; + return ret; + }, arguments); }, + __wbg_insertBefore_f1ba67809033f6b1: function() { return handleError(function (arg0, arg1, arg2) { + const ret = arg0.insertBefore(arg1, arg2); + return ret; + }, arguments); }, + __wbg_instanceof_CanvasRenderingContext2d_769208c72dcbf5e6: function(arg0) { + let result; + try { + result = arg0 instanceof CanvasRenderingContext2D; + } catch (_) { + result = false; + } + const ret = result; + return ret; + }, + __wbg_instanceof_Element_818e11074cdb63b5: function(arg0) { + let result; + try { + result = arg0 instanceof Element; + } catch (_) { + result = false; + } + const ret = result; + return ret; + }, + __wbg_instanceof_ImageBitmap_74bea45ee48d3d7a: function(arg0) { + let result; + try { + result = arg0 instanceof ImageBitmap; + } catch (_) { + result = false; + } + const ret = result; + return ret; + }, + __wbg_instanceof_Response_b8758567269c30b2: function(arg0) { + let result; + try { + result = arg0 instanceof Response; + } catch (_) { + result = false; + } + const ret = result; + return ret; + }, + __wbg_instanceof_ShadowRoot_0ef114d846d9fd90: function(arg0) { + let result; + try { + result = arg0 instanceof ShadowRoot; + } catch (_) { + result = false; + } + const ret = result; + return ret; + }, + __wbg_instanceof_Window_82d71df4eddf88bc: function(arg0) { + let result; + try { + result = arg0 instanceof Window; + } catch (_) { + result = false; + } + const ret = result; + return ret; + }, + __wbg_is_4b278c0bd3caba97: function(arg0, arg1) { + const ret = Object.is(arg0, arg1); + return ret; + }, + __wbg_item_2aa1ff983eca77b6: function(arg0, arg1) { + const ret = arg0.item(arg1 >>> 0); + return isLikeNone(ret) ? 0 : addToExternrefTable0(ret); + }, + __wbg_lastChild_bca1746658aaee75: function(arg0) { + const ret = arg0.lastChild; + return isLikeNone(ret) ? 0 : addToExternrefTable0(ret); + }, + __wbg_left_e0a244490fe2f293: function(arg0) { + const ret = arg0.left; + return ret; + }, + __wbg_length_7f3c00c40364105e: function(arg0) { + const ret = arg0.length; + return ret; + }, + __wbg_length_d4bdea10311bd9cf: function(arg0) { + const ret = arg0.length; + return ret; + }, + __wbg_lineTo_63fac7d60279d95e: function(arg0, arg1, arg2) { + arg0.lineTo(arg1, arg2); + }, + __wbg_listener_id_51707c1ea7d7f75c: function(arg0) { + const ret = arg0.__yew_listener_id; + return isLikeNone(ret) ? Number.MAX_SAFE_INTEGER : (ret) >>> 0; + }, + __wbg_measureText_1035b288be51876c: function() { return handleError(function (arg0, arg1, arg2) { + const ret = arg0.measureText(getStringFromWasm0(arg1, arg2)); + return ret; + }, arguments); }, + __wbg_moveTo_037e3deefec91ae1: function(arg0, arg1, arg2) { + arg0.moveTo(arg1, arg2); + }, + __wbg_name_06fefa2542c6ce51: function(arg0, arg1) { + const ret = arg1.name; + const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc); + const len1 = WASM_VECTOR_LEN; + getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true); + getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true); + }, + __wbg_namespaceURI_67f6d39f1a689250: function(arg0, arg1) { + const ret = arg1.namespaceURI; + var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc); + var len1 = WASM_VECTOR_LEN; + getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true); + getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true); + }, + __wbg_new_1a8d2827bd9e1a2e: function() { return handleError(function (arg0) { + const ret = new ResizeObserver(arg0); + return ret; + }, arguments); }, + __wbg_new_1dbf7428bba60a42: function(arg0) { + const ret = new Uint8Array(arg0); + return ret; + }, + __wbg_new_227d7c05414eb861: function() { + const ret = new Error(); + return ret; + }, + __wbg_new_5502aad30c185fc8: function(arg0, arg1) { + try { + var state0 = {a: arg0, b: arg1}; + var cb0 = (arg0, arg1) => { + const a = state0.a; + state0.a = 0; + try { + return wasm_bindgen_f1f668f83a5f514b___convert__closures_____invoke___js_sys_351dd7d36d5f7033___Function_fn_wasm_bindgen_f1f668f83a5f514b___JsValue_____wasm_bindgen_f1f668f83a5f514b___sys__Undefined___js_sys_351dd7d36d5f7033___Function_fn_wasm_bindgen_f1f668f83a5f514b___JsValue_____wasm_bindgen_f1f668f83a5f514b___sys__Undefined_______true_(a, state0.b, arg0, arg1); + } finally { + state0.a = a; + } + }; + const ret = new Promise(cb0); + return ret; + } finally { + state0.a = 0; + } + }, + __wbg_new_617a8cdb8bb1130e: function() { + const ret = new Object(); + return ret; + }, + __wbg_new_9b0b9983fca2c716: function() { return handleError(function (arg0, arg1) { + const ret = new MouseEvent(getStringFromWasm0(arg0, arg1)); + return ret; + }, arguments); }, + __wbg_new_ee2291f50781bf1d: function() { + const ret = new Array(); + return ret; + }, + __wbg_new_from_slice_9a868026ffa4208a: function(arg0, arg1) { + const ret = new Uint8Array(getArrayU8FromWasm0(arg0, arg1)); + return ret; + }, + __wbg_new_with_u8_array_sequence_f380e3e783ae5617: function() { return handleError(function (arg0) { + const ret = new Blob(arg0); + return ret; + }, arguments); }, + __wbg_nextSibling_e5ecc9bf11c2365d: function(arg0) { + const ret = arg0.nextSibling; + return isLikeNone(ret) ? 0 : addToExternrefTable0(ret); + }, + __wbg_observe_fa02ec4710cff1db: function(arg0, arg1) { + arg0.observe(arg1); + }, + __wbg_ok_125878a7db256ecb: function(arg0) { + const ret = arg0.ok; + return ret; + }, + __wbg_parentElement_108b58de82cab63f: function(arg0) { + const ret = arg0.parentElement; + return isLikeNone(ret) ? 0 : addToExternrefTable0(ret); + }, + __wbg_parentNode_32afd0d7ad7dca98: function(arg0) { + const ret = arg0.parentNode; + return isLikeNone(ret) ? 0 : addToExternrefTable0(ret); + }, + __wbg_pointerId_1b91f6b6c8f92501: function(arg0) { + const ret = arg0.pointerId; + return ret; + }, + __wbg_preventDefault_af59afb0f0a02e20: function(arg0) { + arg0.preventDefault(); + }, + __wbg_prototypesetcall_bc27214492979395: function(arg0, arg1, arg2) { + Uint8Array.prototype.set.call(getArrayU8FromWasm0(arg0, arg1), arg2); + }, + __wbg_push_2baf45db356cf468: function(arg0, arg1) { + const ret = arg0.push(arg1); + return ret; + }, + __wbg_queueMicrotask_9833f9a49df95a49: function(arg0) { + const ret = arg0.queueMicrotask; + return ret; + }, + __wbg_queueMicrotask_a72f977e97f23c5f: function(arg0) { + queueMicrotask(arg0); + }, + __wbg_releasePointerCapture_46ff9901159af8ef: function() { return handleError(function (arg0, arg1) { + arg0.releasePointerCapture(arg1); + }, arguments); }, + __wbg_removeAttribute_2f2700a6f933a6be: function() { return handleError(function (arg0, arg1, arg2) { + arg0.removeAttribute(getStringFromWasm0(arg1, arg2)); + }, arguments); }, + __wbg_removeChild_3745fc2545da50fa: function() { return handleError(function (arg0, arg1) { + const ret = arg0.removeChild(arg1); + return ret; + }, arguments); }, + __wbg_resolve_0076e10020304ede: function(arg0) { + const ret = Promise.resolve(arg0); + return ret; + }, + __wbg_setAttribute_9e7d603908f63705: function() { return handleError(function (arg0, arg1, arg2, arg3, arg4) { + arg0.setAttribute(getStringFromWasm0(arg1, arg2), getStringFromWasm0(arg3, arg4)); + }, arguments); }, + __wbg_setPointerCapture_a53e23b7bccef290: function() { return handleError(function (arg0, arg1) { + arg0.setPointerCapture(arg1); + }, arguments); }, + __wbg_setTimeout_db7bbc18a17e152a: function() { return handleError(function (arg0, arg1, arg2) { + const ret = arg0.setTimeout(arg1, arg2); + return ret; + }, arguments); }, + __wbg_setTransform_fa787a8f0adc1ade: function() { return handleError(function (arg0, arg1, arg2, arg3, arg4, arg5, arg6) { + arg0.setTransform(arg1, arg2, arg3, arg4, arg5, arg6); + }, arguments); }, + __wbg_set_145a351398b48c65: function() { return handleError(function (arg0, arg1, arg2) { + const ret = Reflect.set(arg0, arg1, arg2); + return ret; + }, arguments); }, + __wbg_set_cache_key_274f2145fcb4390c: function(arg0, arg1) { + arg0.__yew_subtree_cache_key = arg1 >>> 0; + }, + __wbg_set_capture_5beff5b8a7562085: function(arg0, arg1) { + arg0.capture = arg1 !== 0; + }, + __wbg_set_checked_2ae6d148d8f3e080: function(arg0, arg1) { + arg0.checked = arg1 !== 0; + }, + __wbg_set_fillStyle_27f88552f4d2ab31: function(arg0, arg1) { + arg0.fillStyle = arg1; + }, + __wbg_set_font_1f60a05a2544a2ff: function(arg0, arg1, arg2) { + arg0.font = getStringFromWasm0(arg1, arg2); + }, + __wbg_set_height_c9789c1c77eaedff: function(arg0, arg1) { + arg0.height = arg1 >>> 0; + }, + __wbg_set_innerHTML_7af59a832a09a074: function(arg0, arg1, arg2) { + arg0.innerHTML = getStringFromWasm0(arg1, arg2); + }, + __wbg_set_lineCap_c9b7bdd3b7f5ce74: function(arg0, arg1, arg2) { + arg0.lineCap = getStringFromWasm0(arg1, arg2); + }, + __wbg_set_lineWidth_cc15473552c60c9c: function(arg0, arg1) { + arg0.lineWidth = arg1; + }, + __wbg_set_listener_id_3046a6d6a2394ad9: function(arg0, arg1) { + arg0.__yew_listener_id = arg1 >>> 0; + }, + __wbg_set_nodeValue_e265de7160527936: function(arg0, arg1, arg2) { + arg0.nodeValue = arg1 === 0 ? undefined : getStringFromWasm0(arg1, arg2); + }, + __wbg_set_passive_31e9f895d2ac0046: function(arg0, arg1) { + arg0.passive = arg1 !== 0; + }, + __wbg_set_strokeStyle_a36f39be93a6cebc: function(arg0, arg1) { + arg0.strokeStyle = arg1; + }, + __wbg_set_subtree_id_fc80ace73ff247a7: function(arg0, arg1) { + arg0.__yew_subtree_id = arg1 >>> 0; + }, + __wbg_set_textAlign_1bda1733d57574ed: function(arg0, arg1, arg2) { + arg0.textAlign = getStringFromWasm0(arg1, arg2); + }, + __wbg_set_value_f5c1ffc19bac3037: function(arg0, arg1, arg2) { + arg0.value = getStringFromWasm0(arg1, arg2); + }, + __wbg_set_value_fbd659f94bfb9181: function(arg0, arg1, arg2) { + arg0.value = getStringFromWasm0(arg1, arg2); + }, + __wbg_set_width_b0e1267db4b196b5: function(arg0, arg1) { + arg0.width = arg1 >>> 0; + }, + __wbg_slice_6da4cdc5d543fcd0: function(arg0, arg1) { + const ret = arg1.slice(); + const ptr1 = passArrayJsValueToWasm0(ret, wasm.__wbindgen_malloc); + const len1 = WASM_VECTOR_LEN; + getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true); + getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true); + }, + __wbg_stack_3b0d974bbf31e44f: function(arg0, arg1) { + const ret = arg1.stack; + const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc); + const len1 = WASM_VECTOR_LEN; + getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true); + getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true); + }, + __wbg_static_accessor_GLOBAL_266715b9d96ba635: function() { + const ret = typeof global === 'undefined' ? null : global; + return isLikeNone(ret) ? 0 : addToExternrefTable0(ret); + }, + __wbg_static_accessor_GLOBAL_THIS_10fb7dc1ae063179: function() { + const ret = typeof globalThis === 'undefined' ? null : globalThis; + return isLikeNone(ret) ? 0 : addToExternrefTable0(ret); + }, + __wbg_static_accessor_SELF_0b583911f537483a: function() { + const ret = typeof self === 'undefined' ? null : self; + return isLikeNone(ret) ? 0 : addToExternrefTable0(ret); + }, + __wbg_static_accessor_WINDOW_d7f903d1508cbdc4: function() { + const ret = typeof window === 'undefined' ? null : window; + return isLikeNone(ret) ? 0 : addToExternrefTable0(ret); + }, + __wbg_status_ce0a98d3c57125f3: function(arg0) { + const ret = arg0.status; + return ret; + }, + __wbg_stroke_385d731098398489: function(arg0) { + arg0.stroke(); + }, + __wbg_subtree_id_6a3200546ad613b1: function(arg0) { + const ret = arg0.__yew_subtree_id; + return isLikeNone(ret) ? Number.MAX_SAFE_INTEGER : (ret) >>> 0; + }, + __wbg_target_38ae9feb025b820c: function(arg0) { + const ret = arg0.target; + return isLikeNone(ret) ? 0 : addToExternrefTable0(ret); + }, + __wbg_then_c949d5a25a4e78f8: function(arg0, arg1, arg2) { + const ret = arg0.then(arg1, arg2); + return ret; + }, + __wbg_then_e71170d78fcf8954: function(arg0, arg1) { + const ret = arg0.then(arg1); + return ret; + }, + __wbg_top_ff4627294d2cdeb8: function(arg0) { + const ret = arg0.top; + return ret; + }, + __wbg_value_05305a761dfa3e0e: function(arg0, arg1) { + const ret = arg1.value; + const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc); + const len1 = WASM_VECTOR_LEN; + getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true); + getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true); + }, + __wbg_value_50394658c248d9c1: function(arg0, arg1) { + const ret = arg1.value; + const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc); + const len1 = WASM_VECTOR_LEN; + getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true); + getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true); + }, + __wbg_width_3d0dce3d9892e35e: function(arg0) { + const ret = arg0.width; + return ret; + }, + __wbg_width_8a9cc26363f10d5f: function(arg0) { + const ret = arg0.width; + return ret; + }, + __wbg_width_e95ad291d52fe17e: function(arg0) { + const ret = arg0.width; + return ret; + }, + __wbindgen_generic_0000000000000001: function(arg0, arg1) { + // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [Externref], shim_idx: 47, ret: Result(Unit), inner_ret: Some(Result(Unit)) }, mutable: true }) -> Externref`. + const ret = makeMutClosure(arg0, arg1, wasm_bindgen_f1f668f83a5f514b___convert__closures_____invoke___wasm_bindgen_f1f668f83a5f514b___JsValue__core_37ee0ce0c4cd57d5___result__Result_____wasm_bindgen_f1f668f83a5f514b___JsError___true_); + return ret; + }, + __wbindgen_generic_0000000000000002: function(arg0, arg1) { + // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("Array"), NamedExternref("ResizeObserver")], shim_idx: 74, ret: Unit, inner_ret: Some(Unit) }, mutable: false }) -> Externref`. + const ret = makeClosure(arg0, arg1, wasm_bindgen_f1f668f83a5f514b___convert__closures_____invoke___js_sys_351dd7d36d5f7033___Array__web_sys_d6718dd818f67bd6___features__gen_ResizeObserver__ResizeObserver______true_); + return ret; + }, + __wbindgen_generic_0000000000000003: function(arg0, arg1) { + // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [Ref(NamedExternref("Event"))], shim_idx: 90, ret: Unit, inner_ret: Some(Unit) }, mutable: false }) -> Externref`. + const ret = makeClosure(arg0, arg1, wasm_bindgen_f1f668f83a5f514b___convert__closures________invoke___web_sys_d6718dd818f67bd6___features__gen_Event__Event______true_); + return ret; + }, + __wbindgen_generic_0000000000000004: function(arg0, arg1) { + // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [], shim_idx: 76, ret: Unit, inner_ret: Some(Unit) }, mutable: false }) -> Externref`. + const ret = makeClosure(arg0, arg1, wasm_bindgen_f1f668f83a5f514b___convert__closures_____invoke_______true_); + return ret; + }, + __wbindgen_generic_0000000000000005: function(arg0, arg1) { + // Cast intrinsic for `Ref(String) -> Externref`. + const ret = getStringFromWasm0(arg0, arg1); + return ret; + }, + __wbindgen_init_externref_table: function() { + const table = wasm.__wbindgen_externrefs; + const offset = table.grow(4); + table.set(0, undefined); + table.set(offset + 0, undefined); + table.set(offset + 1, null); + table.set(offset + 2, true); + table.set(offset + 3, false); + }, + }; + return { + __proto__: null, + "./wipfel_bg.js": import0, + }; +} + +function wasm_bindgen_f1f668f83a5f514b___convert__closures_____invoke_______true_(arg0, arg1) { + wasm.wasm_bindgen_f1f668f83a5f514b___convert__closures_____invoke_______true_(arg0, arg1); +} + +function wasm_bindgen_f1f668f83a5f514b___convert__closures________invoke___web_sys_d6718dd818f67bd6___features__gen_Event__Event______true_(arg0, arg1, arg2) { + wasm.wasm_bindgen_f1f668f83a5f514b___convert__closures________invoke___web_sys_d6718dd818f67bd6___features__gen_Event__Event______true_(arg0, arg1, arg2); +} + +function wasm_bindgen_f1f668f83a5f514b___convert__closures_____invoke___wasm_bindgen_f1f668f83a5f514b___JsValue__core_37ee0ce0c4cd57d5___result__Result_____wasm_bindgen_f1f668f83a5f514b___JsError___true_(arg0, arg1, arg2) { + const ret = wasm.wasm_bindgen_f1f668f83a5f514b___convert__closures_____invoke___wasm_bindgen_f1f668f83a5f514b___JsValue__core_37ee0ce0c4cd57d5___result__Result_____wasm_bindgen_f1f668f83a5f514b___JsError___true_(arg0, arg1, arg2); + if (ret[1]) { + throw takeFromExternrefTable0(ret[0]); + } +} + +function wasm_bindgen_f1f668f83a5f514b___convert__closures_____invoke___js_sys_351dd7d36d5f7033___Function_fn_wasm_bindgen_f1f668f83a5f514b___JsValue_____wasm_bindgen_f1f668f83a5f514b___sys__Undefined___js_sys_351dd7d36d5f7033___Function_fn_wasm_bindgen_f1f668f83a5f514b___JsValue_____wasm_bindgen_f1f668f83a5f514b___sys__Undefined_______true_(arg0, arg1, arg2, arg3) { + wasm.wasm_bindgen_f1f668f83a5f514b___convert__closures_____invoke___js_sys_351dd7d36d5f7033___Function_fn_wasm_bindgen_f1f668f83a5f514b___JsValue_____wasm_bindgen_f1f668f83a5f514b___sys__Undefined___js_sys_351dd7d36d5f7033___Function_fn_wasm_bindgen_f1f668f83a5f514b___JsValue_____wasm_bindgen_f1f668f83a5f514b___sys__Undefined_______true_(arg0, arg1, arg2, arg3); +} + +function wasm_bindgen_f1f668f83a5f514b___convert__closures_____invoke___js_sys_351dd7d36d5f7033___Array__web_sys_d6718dd818f67bd6___features__gen_ResizeObserver__ResizeObserver______true_(arg0, arg1, arg2, arg3) { + wasm.wasm_bindgen_f1f668f83a5f514b___convert__closures_____invoke___js_sys_351dd7d36d5f7033___Array__web_sys_d6718dd818f67bd6___features__gen_ResizeObserver__ResizeObserver______true_(arg0, arg1, arg2, arg3); +} + +function addToExternrefTable0(obj) { + const idx = wasm.__externref_table_alloc(); + wasm.__wbindgen_externrefs.set(idx, obj); + return idx; +} + +const CLOSURE_DTORS = (typeof FinalizationRegistry === 'undefined') + ? { register: () => {}, unregister: () => {} } + : new FinalizationRegistry(state => wasm.__wbindgen_destroy_closure(state.a, state.b)); + +function debugString(val) { + // primitive types + const type = typeof val; + if (type == 'number' || type == 'boolean' || val == null) { + return `${val}`; + } + if (type == 'string') { + return `"${val}"`; + } + if (type == 'symbol') { + const description = val.description; + if (description == null) { + return 'Symbol'; + } else { + return `Symbol(${description})`; + } + } + if (type == 'function') { + const name = val.name; + if (typeof name == 'string' && name.length > 0) { + return `Function(${name})`; + } else { + return 'Function'; + } + } + // objects + if (Array.isArray(val)) { + const length = val.length; + let debug = '['; + if (length > 0) { + debug += debugString(val[0]); + } + for(let i = 1; i < length; i++) { + debug += ', ' + debugString(val[i]); + } + debug += ']'; + return debug; + } + // Test for built-in + const builtInMatches = /\[object ([^\]]+)\]/.exec(toString.call(val)); + let className; + if (builtInMatches && builtInMatches.length > 1) { + className = builtInMatches[1]; + } else { + // Failed to match the standard '[object ClassName]' + return toString.call(val); + } + if (className == 'Object') { + // we're a user defined class or Object + // JSON.stringify avoids problems with cycles, and is generally much + // easier than looping through ownProperties of `val`. + try { + return 'Object(' + JSON.stringify(val) + ')'; + } catch (_) { + return 'Object'; + } + } + // errors + if (val instanceof Error) { + return `${val.name}: ${val.message}\n${val.stack}`; + } + // TODO we could test for more things here, like `Set`s and `Map`s. + return className; +} + +function getArrayJsValueFromWasm0(ptr, len) { + ptr = ptr >>> 0; + const mem = getDataViewMemory0(); + const result = []; + for (let i = ptr; i < ptr + 4 * len; i += 4) { + result.push(wasm.__wbindgen_externrefs.get(mem.getUint32(i, true))); + } + wasm.__externref_drop_slice(ptr, len); + return result; +} + +function getArrayU8FromWasm0(ptr, len) { + ptr = ptr >>> 0; + return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len); +} + +let cachedDataViewMemory0 = null; +function getDataViewMemory0() { + if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || (cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer)) { + cachedDataViewMemory0 = new DataView(wasm.memory.buffer); + } + return cachedDataViewMemory0; +} + +function getStringFromWasm0(ptr, len) { + return decodeText(ptr >>> 0, len); +} + +let cachedUint8ArrayMemory0 = null; +function getUint8ArrayMemory0() { + if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) { + cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer); + } + return cachedUint8ArrayMemory0; +} + +function handleError(f, args) { + try { + return f.apply(this, args); + } catch (e) { + const idx = addToExternrefTable0(e); + wasm.__wbindgen_exn_store(idx); + } +} + +function isLikeNone(x) { + return x === undefined || x === null; +} + +function makeClosure(arg0, arg1, f) { + const state = { a: arg0, b: arg1, cnt: 1 }; + const real = (...args) => { + + // First up with a closure we increment the internal reference + // count. This ensures that the Rust closure environment won't + // be deallocated while we're invoking it. + state.cnt++; + try { + return f(state.a, state.b, ...args); + } finally { + real._wbg_cb_unref(); + } + }; + real._wbg_cb_unref = () => { + if (--state.cnt === 0) { + wasm.__wbindgen_destroy_closure(state.a, state.b); + state.a = 0; + CLOSURE_DTORS.unregister(state); + } + }; + CLOSURE_DTORS.register(real, state, state); + return real; +} + +function makeMutClosure(arg0, arg1, f) { + const state = { a: arg0, b: arg1, cnt: 1 }; + const real = (...args) => { + + // First up with a closure we increment the internal reference + // count. This ensures that the Rust closure environment won't + // be deallocated while we're invoking it. + state.cnt++; + const a = state.a; + state.a = 0; + try { + return f(a, state.b, ...args); + } finally { + state.a = a; + real._wbg_cb_unref(); + } + }; + real._wbg_cb_unref = () => { + if (--state.cnt === 0) { + wasm.__wbindgen_destroy_closure(state.a, state.b); + state.a = 0; + CLOSURE_DTORS.unregister(state); + } + }; + CLOSURE_DTORS.register(real, state, state); + return real; +} + +function passArrayJsValueToWasm0(array, malloc) { + const ptr = malloc(array.length * 4, 4) >>> 0; + for (let i = 0; i < array.length; i++) { + const add = addToExternrefTable0(array[i]); + getDataViewMemory0().setUint32(ptr + 4 * i, add, true); + } + WASM_VECTOR_LEN = array.length; + return ptr; +} + +function passStringToWasm0(arg, malloc, realloc) { + if (realloc === undefined) { + const buf = cachedTextEncoder.encode(arg); + const ptr = malloc(buf.length, 1) >>> 0; + getUint8ArrayMemory0().subarray(ptr, ptr + buf.length).set(buf); + WASM_VECTOR_LEN = buf.length; + return ptr; + } + + let len = arg.length; + let ptr = malloc(len, 1) >>> 0; + + const mem = getUint8ArrayMemory0(); + + let offset = 0; + + for (; offset < len; offset++) { + const code = arg.charCodeAt(offset); + if (code > 0x7F) break; + mem[ptr + offset] = code; + } + if (offset !== len) { + if (offset !== 0) { + arg = arg.slice(offset); + } + ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0; + const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len); + const ret = cachedTextEncoder.encodeInto(arg, view); + + offset += ret.written; + ptr = realloc(ptr, len, offset, 1) >>> 0; + } + + WASM_VECTOR_LEN = offset; + return ptr; +} + +function takeFromExternrefTable0(idx) { + const value = wasm.__wbindgen_externrefs.get(idx); + wasm.__externref_table_dealloc(idx); + return value; +} + +let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true }); +cachedTextDecoder.decode(); +const MAX_SAFARI_DECODE_BYTES = 2146435072; +let numBytesDecoded = 0; +function decodeText(ptr, len) { + numBytesDecoded += len; + if (numBytesDecoded >= MAX_SAFARI_DECODE_BYTES) { + cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true }); + cachedTextDecoder.decode(); + numBytesDecoded = len; + } + return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len)); +} + +const cachedTextEncoder = new TextEncoder(); + +if (!('encodeInto' in cachedTextEncoder)) { + cachedTextEncoder.encodeInto = function (arg, view) { + const buf = cachedTextEncoder.encode(arg); + view.set(buf); + return { + read: arg.length, + written: buf.length + }; + }; +} + +let WASM_VECTOR_LEN = 0; + +let wasmModule, wasmInstance, wasm; +function __wbg_finalize_init(instance, module) { + wasmInstance = instance; + wasm = instance.exports; + wasmModule = module; + cachedDataViewMemory0 = null; + cachedUint8ArrayMemory0 = null; + wasm.__wbindgen_start(); + return wasm; +} + +async function __wbg_load(module, imports) { + if (typeof Response === 'function' && module instanceof Response) { + if (!module.ok) { + throw new Error(`failed to fetch Wasm: ${module.status} ${module.statusText} fetching '${module.url}'`); + } + + if (typeof WebAssembly.instantiateStreaming === 'function') { + try { + return await WebAssembly.instantiateStreaming(module, imports); + } catch (e) { + const validResponse = expectedResponseType(module.type); + + if (validResponse && module.headers.get('Content-Type') !== 'application/wasm') { + console.warn("`WebAssembly.instantiateStreaming` failed because your server does not serve Wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n", e); + + } else { throw e; } + } + } + + const bytes = await module.arrayBuffer(); + return await WebAssembly.instantiate(bytes, imports); + } else { + const instance = await WebAssembly.instantiate(module, imports); + + if (instance instanceof WebAssembly.Instance) { + return { instance, module }; + } else { + return instance; + } + } + + function expectedResponseType(type) { + switch (type) { + case 'basic': case 'cors': case 'default': return true; + } + return false; + } +} + +function initSync(module) { + if (wasm !== undefined) return wasm; + + + if (module !== undefined) { + if (Object.getPrototypeOf(module) === Object.prototype) { + ({module} = module) + } else { + console.warn('using deprecated parameters for `initSync()`; pass a single object instead') + } + } + + const imports = __wbg_get_imports(); + if (!(module instanceof WebAssembly.Module)) { + module = new WebAssembly.Module(module); + } + const instance = new WebAssembly.Instance(module, imports); + return __wbg_finalize_init(instance, module); +} + +async function __wbg_init(module_or_path) { + if (wasm !== undefined) return wasm; + + + if (module_or_path !== undefined) { + if (Object.getPrototypeOf(module_or_path) === Object.prototype) { + ({module_or_path} = module_or_path) + } else { + console.warn('using deprecated parameters for the initialization function; pass a single object instead') + } + } + + if (module_or_path === undefined) { + module_or_path = new URL('wipfel_bg.wasm', import.meta.url); + } + const imports = __wbg_get_imports(); + + if (typeof module_or_path === 'string' || (typeof Request === 'function' && module_or_path instanceof Request) || (typeof URL === 'function' && module_or_path instanceof URL)) { + module_or_path = fetch(module_or_path); + } + + const { instance, module } = await __wbg_load(await module_or_path, imports); + + return __wbg_finalize_init(instance, module); +} + +export { initSync, __wbg_init as default }; diff --git a/dist/wipfel/wipfel_bg.wasm b/dist/wipfel/wipfel_bg.wasm new file mode 100644 index 0000000..a3cc980 Binary files /dev/null and b/dist/wipfel/wipfel_bg.wasm differ -- cgit v1.2.3