]> git.taranathan.com Git - tarans-amazing-word-game.git/commitdiff
i should've started commiting sooner main
authormoo <moogoesmeow123@gmail.com>
Tue, 20 Oct 2026 22:57:03 +0000 (15:57 -0700)
committermoo <moogoesmeow123@gmail.com>
Tue, 20 Oct 2026 22:57:03 +0000 (15:57 -0700)
38 files changed:
.gitignore [new file with mode: 0644]
generator/.gitignore [new file with mode: 0644]
generator/Cargo.lock [new file with mode: 0644]
generator/Cargo.toml [new file with mode: 0644]
generator/src/main.rs [new file with mode: 0644]
gleam/client/.gitignore [new file with mode: 0644]
gleam/client/README.md [new file with mode: 0644]
gleam/client/gleam.toml [new file with mode: 0644]
gleam/client/manifest.toml [new file with mode: 0644]
gleam/client/src/client.gleam [new file with mode: 0644]
gleam/client/static/cat.png [new file with mode: 0644]
gleam/client/test/client_test.gleam [new file with mode: 0644]
gleam/css_to_lustre/.gitignore [new file with mode: 0644]
gleam/css_to_lustre/README.md [new file with mode: 0644]
gleam/css_to_lustre/gleam.toml [new file with mode: 0644]
gleam/css_to_lustre/manifest.toml [new file with mode: 0644]
gleam/css_to_lustre/src/css_to_lustre.gleam [new file with mode: 0644]
gleam/css_to_lustre/test/css_to_lustre_test.gleam [new file with mode: 0644]
gleam/server/.gitignore [new file with mode: 0644]
gleam/server/README.md [new file with mode: 0644]
gleam/server/gleam.toml [new file with mode: 0644]
gleam/server/manifest.toml [new file with mode: 0644]
gleam/server/src/loader.gleam [new file with mode: 0644]
gleam/server/src/server.gleam [new file with mode: 0644]
gleam/server/static/cat.png [new file with mode: 0644]
gleam/server/static/client.js [new file with mode: 0644]
gleam/server/static/favicon.ico [new file with mode: 0644]
gleam/server/test/server_test.gleam [new file with mode: 0644]
gleam/shared/.gitignore [new file with mode: 0644]
gleam/shared/README.md [new file with mode: 0644]
gleam/shared/gleam.toml [new file with mode: 0644]
gleam/shared/manifest.toml [new file with mode: 0644]
gleam/shared/src/shared.gleam [new file with mode: 0644]
gleam/shared/test/shared_test.gleam [new file with mode: 0644]
puzzler/.gitignore [new file with mode: 0644]
puzzler/Cargo.lock [new file with mode: 0644]
puzzler/Cargo.toml [new file with mode: 0644]
puzzler/src/main.rs [new file with mode: 0644]

diff --git a/.gitignore b/.gitignore
new file mode 100644 (file)
index 0000000..9173981
--- /dev/null
@@ -0,0 +1,7 @@
+**/*.target
+**/*/build
+data
+/puzzler/word_patterns.bin
+/puzzler/output.json
+/generator/word_patterns.bin
+/gleam/server/data.json
diff --git a/generator/.gitignore b/generator/.gitignore
new file mode 100644 (file)
index 0000000..ea8c4bf
--- /dev/null
@@ -0,0 +1 @@
+/target
diff --git a/generator/Cargo.lock b/generator/Cargo.lock
new file mode 100644 (file)
index 0000000..9efddd2
--- /dev/null
@@ -0,0 +1,1867 @@
+# This file is automatically @generated by Cargo.
+# It is not intended for manual editing.
+version = 4
+
+[[package]]
+name = "addr2line"
+version = "0.25.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "1b5d307320b3181d6d7954e663bd7c774a838b8220fe0593c86d9fb09f498b4b"
+dependencies = [
+ "gimli",
+]
+
+[[package]]
+name = "adler2"
+version = "2.0.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "320119579fcad9c21884f5c4861d16174d0e06250625266f50fe6898340abefa"
+
+[[package]]
+name = "atomic-waker"
+version = "1.1.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "1505bd5d3d116872e7271a6d4e16d81d0c8570876c8de68093a09ac269d8aac0"
+
+[[package]]
+name = "autocfg"
+version = "1.5.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "f2032f911046de80f0a198e0901378627c33f59ea0ac00e363d481118bd70a53"
+
+[[package]]
+name = "aws-lc-rs"
+version = "1.18.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "ce2b2dcc879c3bae0d371e77c99f2238400ef24ec001394befa67b6e543add9e"
+dependencies = [
+ "aws-lc-sys",
+ "zeroize",
+]
+
+[[package]]
+name = "aws-lc-sys"
+version = "0.44.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "f09fae7be8bb3174e05c6afdb34199e6dc0c7c04ba9fa237b1967adfbde27483"
+dependencies = [
+ "cc",
+ "cmake",
+ "dunce",
+ "fs_extra",
+ "pkg-config",
+]
+
+[[package]]
+name = "backtrace"
+version = "0.3.76"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "bb531853791a215d7c62a30daf0dde835f381ab5de4589cfe7c649d2cbe92bd6"
+dependencies = [
+ "addr2line",
+ "cfg-if",
+ "libc",
+ "miniz_oxide",
+ "object",
+ "rustc-demangle",
+ "windows-link",
+]
+
+[[package]]
+name = "base64"
+version = "0.22.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "72b3254f16251a8381aa12e40e3c4d2f0199f8c6508fbecb9d91f575e0fbb8c6"
+
+[[package]]
+name = "bincode"
+version = "2.0.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "36eaf5d7b090263e8150820482d5d93cd964a81e4019913c972f4edcc6edb740"
+dependencies = [
+ "bincode_derive",
+ "serde",
+ "unty",
+]
+
+[[package]]
+name = "bincode_derive"
+version = "2.0.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "bf95709a440f45e986983918d0e8a1f30a9b1df04918fc828670606804ac3c09"
+dependencies = [
+ "virtue",
+]
+
+[[package]]
+name = "bitflags"
+version = "2.13.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "b588b76d00fde79687d7646a9b5bdf3cc0f655e0bbd080335a95d7e96f3587da"
+
+[[package]]
+name = "bumpalo"
+version = "3.20.3"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "72f5acc6cb2ba439de613abc23857ec3d78374d8ed5ac84e9d11336e87da8649"
+
+[[package]]
+name = "bytes"
+version = "1.12.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "fc652a48c352aef3ea3aed32080501cf3ef6ed5da78602a020c991775b0aff04"
+
+[[package]]
+name = "cc"
+version = "1.4.4"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "0ad534f4357a5264cce5019c989cf66a4f0dc4e0d1b1d15f8aacec0ff7360273"
+dependencies = [
+ "find-msvc-tools",
+ "jobserver",
+ "libc",
+ "shlex",
+]
+
+[[package]]
+name = "cfg-if"
+version = "1.0.4"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "9330f8b2ff13f34540b44e946ef35111825727b38d33286ef986142615121801"
+
+[[package]]
+name = "cfg_aliases"
+version = "0.2.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "f079e83a288787bcd14a6aea84cee5c87a67c5a3e660c30f557a3d24761b3527"
+
+[[package]]
+name = "chacha20"
+version = "0.10.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "d524456ba66e72eb8b115ff89e01e497f8e6d11d78b70b1aa13c0fbd97540a81"
+dependencies = [
+ "cfg-if",
+ "cpufeatures",
+ "rand_core",
+]
+
+[[package]]
+name = "cmake"
+version = "0.1.58"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "c0f78a02292a74a88ac736019ab962ece0bc380e3f977bf72e376c5d78ff0678"
+dependencies = [
+ "cc",
+]
+
+[[package]]
+name = "color-eyre"
+version = "0.6.5"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "e5920befb47832a6d61ee3a3a846565cfa39b331331e68a3b1d1116630f2f26d"
+dependencies = [
+ "backtrace",
+ "color-spantrace",
+ "eyre",
+ "indenter",
+ "once_cell",
+ "owo-colors",
+ "tracing-error",
+]
+
+[[package]]
+name = "color-spantrace"
+version = "0.3.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "b8b88ea9df13354b55bc7234ebcce36e6ef896aca2e42a15de9e10edce01b427"
+dependencies = [
+ "once_cell",
+ "owo-colors",
+ "tracing-core",
+ "tracing-error",
+]
+
+[[package]]
+name = "combine"
+version = "4.6.8"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "cfc320937d09e6de266b31b9afb480f197d7a861be86be7cb2ea7e5d1bfffc5e"
+dependencies = [
+ "bytes",
+ "memchr",
+]
+
+[[package]]
+name = "core-foundation"
+version = "0.9.4"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "91e195e091a93c46f7102ec7818a2aa394e1e1771c3ab4825963fa03e45afb8f"
+dependencies = [
+ "core-foundation-sys",
+ "libc",
+]
+
+[[package]]
+name = "core-foundation"
+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 = "cpufeatures"
+version = "0.3.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "8b2a41393f66f16b0823bb79094d54ac5fbd34ab292ddafb9a0456ac9f87d201"
+dependencies = [
+ "libc",
+]
+
+[[package]]
+name = "displaydoc"
+version = "0.2.7"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "c6232dd377dcc64799954cbd3a9bb882e9cdc1308ccd87b1c098f1fb2eaf82a8"
+dependencies = [
+ "proc-macro2",
+ "quote",
+ "syn 3.0.4",
+]
+
+[[package]]
+name = "dunce"
+version = "1.0.5"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "92773504d58c093f6de2459af4af33faa518c13451eb8f2b5698ed3d36e7c813"
+
+[[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 = "eyre"
+version = "0.6.14"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "c08309dbcc659c5549a24ddb9b27027640641b282ef5768267c7e675558986a3"
+dependencies = [
+ "autocfg",
+ "indenter",
+ "once_cell",
+]
+
+[[package]]
+name = "find-msvc-tools"
+version = "0.1.11"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "d45db016d36b838f563236e9193d0ee6ce38f3f68b6c94e914b4929c96bbb890"
+
+[[package]]
+name = "fnv"
+version = "1.0.7"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1"
+
+[[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 = "fs_extra"
+version = "1.3.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "42703706b716c37f96a77aea830392ad231f44c9e9a67872fa5548707e11b11c"
+
+[[package]]
+name = "futures-channel"
+version = "0.3.34"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "b1f9e3d69d39e4862ffed03ed071a76f9a13ba1d9109d355b0f0aa6b15e393c4"
+dependencies = [
+ "futures-core",
+]
+
+[[package]]
+name = "futures-core"
+version = "0.3.34"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "92d699e522242e69e3003b94ecc1f960f3a5e015aa7c5d7486e65ad01dd94f5e"
+
+[[package]]
+name = "futures-sink"
+version = "0.3.34"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "1944426bf7d03f1d14f708785e4b33efd750b36d48a157b836b3efc15ede8e1d"
+
+[[package]]
+name = "futures-task"
+version = "0.3.34"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "cd417de3d1d015fc3bfd2b1ea46dfc7bab72ef86f1cc7cc9c78e728b34a6d1fd"
+
+[[package]]
+name = "futures-util"
+version = "0.3.34"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "0d50a92467f8ba5dd6e3ee5d4bd04d73ab2e4e1c44474a0674821dfce14b79bc"
+dependencies = [
+ "futures-core",
+ "futures-task",
+ "pin-project-lite",
+ "slab",
+]
+
+[[package]]
+name = "generator"
+version = "0.1.0"
+dependencies = [
+ "bincode",
+ "color-eyre",
+ "reqwest",
+ "serde",
+ "serde_json",
+ "thiserror",
+ "walkdir",
+]
+
+[[package]]
+name = "getrandom"
+version = "0.2.17"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "ff2abc00be7fca6ebc474524697ae276ad847ad0a6b3faa4bcb027e9a4614ad0"
+dependencies = [
+ "cfg-if",
+ "js-sys",
+ "libc",
+ "wasi",
+ "wasm-bindgen",
+]
+
+[[package]]
+name = "getrandom"
+version = "0.4.3"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "300e883d756b2e4ec94e02791f39b04b522276138852cfc41d9fb7e904106099"
+dependencies = [
+ "cfg-if",
+ "js-sys",
+ "libc",
+ "r-efi",
+ "rand_core",
+ "wasm-bindgen",
+]
+
+[[package]]
+name = "gimli"
+version = "0.32.3"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "e629b9b98ef3dd8afe6ca2bd0f89306cec16d43d907889945bc5d6687f2f13c7"
+
+[[package]]
+name = "h2"
+version = "0.4.19"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "ef8e5e5a340588f4452631496976cf8636d4a7ecf600239fdc27615d2530bc16"
+dependencies = [
+ "atomic-waker",
+ "bytes",
+ "fnv",
+ "futures-core",
+ "futures-sink",
+ "http",
+ "indexmap",
+ "slab",
+ "tokio",
+ "tokio-util",
+ "tracing",
+]
+
+[[package]]
+name = "hashbrown"
+version = "0.17.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "ed5909b6e89a2db4456e54cd5f673791d7eca6732202bbf2a9cc504fe2f9b84a"
+
+[[package]]
+name = "http"
+version = "1.5.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "918d3568bebf352712bc2ef3d46a8bcf1a75b373be6539de198e9105cbbf9ce0"
+dependencies = [
+ "bytes",
+ "itoa",
+]
+
+[[package]]
+name = "http-body"
+version = "1.1.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "ca2a8f2913ee65f60facd6a5905613afaa448497a0230cc41ce022d93290bc2c"
+dependencies = [
+ "bytes",
+ "http",
+]
+
+[[package]]
+name = "http-body-util"
+version = "0.1.5"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "23169fe34a5fbcdd3f3862e78fb9b6fccd5f02a6dc6f732547005d45631ce71c"
+dependencies = [
+ "bytes",
+ "futures-core",
+ "http",
+ "http-body",
+ "pin-project-lite",
+]
+
+[[package]]
+name = "httparse"
+version = "1.10.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "6dbf3de79e51f3d586ab4cb9d5c3e2c14aa28ed23d180cf89b4df0454a69cc87"
+
+[[package]]
+name = "hyper"
+version = "1.11.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "d22053281f852e11534f5198498373cbb59295120a20771d90f7ed1897490a72"
+dependencies = [
+ "atomic-waker",
+ "bytes",
+ "futures-channel",
+ "futures-core",
+ "h2",
+ "http",
+ "http-body",
+ "httparse",
+ "itoa",
+ "pin-project-lite",
+ "smallvec",
+ "tokio",
+ "want",
+]
+
+[[package]]
+name = "hyper-rustls"
+version = "0.27.9"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "33ca68d021ef39cf6463ab54c1d0f5daf03377b70561305bb89a8f83aab66e0f"
+dependencies = [
+ "http",
+ "hyper",
+ "hyper-util",
+ "rustls",
+ "tokio",
+ "tokio-rustls",
+ "tower-service",
+]
+
+[[package]]
+name = "hyper-util"
+version = "0.1.20"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "96547c2556ec9d12fb1578c4eaf448b04993e7fb79cbaad930a656880a6bdfa0"
+dependencies = [
+ "base64",
+ "bytes",
+ "futures-channel",
+ "futures-util",
+ "http",
+ "http-body",
+ "hyper",
+ "ipnet",
+ "libc",
+ "percent-encoding",
+ "pin-project-lite",
+ "socket2",
+ "system-configuration",
+ "tokio",
+ "tower-service",
+ "tracing",
+ "windows-registry",
+]
+
+[[package]]
+name = "icu_collections"
+version = "2.3.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "fa68d21081c4a05d5a901a1c62add574c77048b6a1c67be3b50ce0b60d4ca513"
+dependencies = [
+ "displaydoc",
+ "potential_utf",
+ "utf8_iter",
+ "yoke",
+ "zerofrom",
+ "zerovec",
+]
+
+[[package]]
+name = "icu_locale_core"
+version = "2.3.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "d56e28588da92eee5c3201a6eff33fabdd49b62269c8938d4ff050ce4d900deb"
+dependencies = [
+ "displaydoc",
+ "litemap",
+ "tinystr",
+ "writeable",
+ "zerovec",
+]
+
+[[package]]
+name = "icu_normalizer"
+version = "2.3.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "12f9cf5f235641ed274641dd81c3f28d870e276763d0797aeeab72317b1c646f"
+dependencies = [
+ "icu_collections",
+ "icu_normalizer_data",
+ "icu_properties",
+ "icu_provider",
+ "smallvec",
+ "zerovec",
+]
+
+[[package]]
+name = "icu_normalizer_data"
+version = "2.3.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "1563da1ed3e0b3bf3d74c9b85917ac9c56464d2f57242270c09c9e752f8021a0"
+
+[[package]]
+name = "icu_properties"
+version = "2.3.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "7e7ca276ad3145661a65914e6daf131ca5120cd3dcee8f8f3214b8875184a148"
+dependencies = [
+ "displaydoc",
+ "icu_collections",
+ "icu_locale_core",
+ "icu_properties_data",
+ "icu_provider",
+ "zerotrie",
+ "zerovec",
+]
+
+[[package]]
+name = "icu_properties_data"
+version = "2.3.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "e590f038c1464a96894fd6d10127e90a8be4509f56ff7ecef851b15cee0b7caa"
+
+[[package]]
+name = "icu_provider"
+version = "2.3.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "d27bbb9d3abbefac45d55f647c9de1d44aafcd1186eb91879afef17c396c3e73"
+dependencies = [
+ "displaydoc",
+ "icu_locale_core",
+ "writeable",
+ "yoke",
+ "zerofrom",
+ "zerotrie",
+ "zerovec",
+]
+
+[[package]]
+name = "idna"
+version = "1.1.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "3b0875f23caa03898994f6ddc501886a45c7d3d62d04d2d90788d47be1b1e4de"
+dependencies = [
+ "idna_adapter",
+ "smallvec",
+ "utf8_iter",
+]
+
+[[package]]
+name = "idna_adapter"
+version = "1.2.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "cb68373c0d6620ef8105e855e7745e18b0d00d3bdb07fb532e434244cdb9a714"
+dependencies = [
+ "icu_normalizer",
+ "icu_properties",
+]
+
+[[package]]
+name = "indenter"
+version = "0.3.4"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "964de6e86d545b246d84badc0fef527924ace5134f30641c203ef52ba83f58d5"
+
+[[package]]
+name = "indexmap"
+version = "2.14.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "d466e9454f08e4a911e14806c24e16fba1b4c121d1ea474396f396069cf949d9"
+dependencies = [
+ "equivalent",
+ "hashbrown",
+]
+
+[[package]]
+name = "ipnet"
+version = "2.12.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "6a756c3fac73139e83f14c2d742155dd2b78d3ee56597b419a0579b7bdd6dd78"
+
+[[package]]
+name = "itoa"
+version = "1.0.18"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "8f42a60cbdf9a97f5d2305f08a87dc4e09308d1276d28c869c684d7777685682"
+
+[[package]]
+name = "jni"
+version = "0.22.4"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "5efd9a482cf3a427f00d6b35f14332adc7902ce91efb778580e180ff90fa3498"
+dependencies = [
+ "cfg-if",
+ "combine",
+ "jni-macros",
+ "jni-sys",
+ "log",
+ "simd_cesu8",
+ "thiserror",
+ "walkdir",
+ "windows-link",
+]
+
+[[package]]
+name = "jni-macros"
+version = "0.22.4"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "a00109accc170f0bdb141fed3e393c565b6f5e072365c3bd58f5b062591560a3"
+dependencies = [
+ "proc-macro2",
+ "quote",
+ "rustc_version",
+ "simd_cesu8",
+ "syn 2.0.119",
+]
+
+[[package]]
+name = "jni-sys"
+version = "0.4.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "c6377a88cb3910bee9b0fa88d4f42e1d2da8e79915598f65fb0c7ee14c878af2"
+dependencies = [
+ "jni-sys-macros",
+]
+
+[[package]]
+name = "jni-sys-macros"
+version = "0.4.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "38c0b942f458fe50cdac086d2f946512305e5631e720728f2a61aabcd47a6264"
+dependencies = [
+ "quote",
+ "syn 2.0.119",
+]
+
+[[package]]
+name = "jobserver"
+version = "0.1.35"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "1c00acbd29eabad4a2392fa0e921c874934dbbf4194312ad20f04a0ed67a3cb3"
+dependencies = [
+ "getrandom 0.4.3",
+ "libc",
+]
+
+[[package]]
+name = "js-sys"
+version = "0.3.104"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "0e0c1080212aad755ea003d18543e8768dd432c48819efd73a7bf1e39b7a5a3a"
+dependencies = [
+ "cfg-if",
+ "futures-util",
+ "wasm-bindgen",
+]
+
+[[package]]
+name = "lazy_static"
+version = "1.5.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe"
+
+[[package]]
+name = "libc"
+version = "0.2.189"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "3eaf3ede3fee6db1a4c2ee091bf8a8b4dccdc6d17f656fb07896ee72867612f2"
+
+[[package]]
+name = "litemap"
+version = "0.8.3"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "47d9d19d1d6efa0109d2f65ff4c85cddd50bd572e5a00127ab10987290bcefae"
+
+[[package]]
+name = "log"
+version = "0.4.34"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "f9f8bd3e56ce4dfc153cf470fffbfa98c7620958b312ca5c3a4b8d5181fd13c6"
+
+[[package]]
+name = "lru-slab"
+version = "0.1.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "112b39cec0b298b6c1999fee3e31427f74f676e4cb9879ed1a121b43661a4154"
+
+[[package]]
+name = "memchr"
+version = "2.8.3"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "cf8baf1c55e62ffcace7a9f06f4bd9cd3f0c4beb022d3b367256b91b87513d98"
+
+[[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",
+]
+
+[[package]]
+name = "mio"
+version = "1.2.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "30d65c71f1ce40ab09135ce117d742b9f8a19ff91a41a8b57ed50bc2de59c427"
+dependencies = [
+ "libc",
+ "wasi",
+ "windows-sys 0.61.2",
+]
+
+[[package]]
+name = "object"
+version = "0.37.3"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "ff76201f031d8863c38aa7f905eca4f53abbfa15f609db4277d44cd8938f33fe"
+dependencies = [
+ "memchr",
+]
+
+[[package]]
+name = "once_cell"
+version = "1.21.4"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "9f7c3e4beb33f85d45ae3e3a1792185706c8e16d043238c593331cc7cd313b50"
+
+[[package]]
+name = "openssl-probe"
+version = "0.2.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "7c87def4c32ab89d880effc9e097653c8da5d6ef28e6b539d313baaacfbafcbe"
+
+[[package]]
+name = "owo-colors"
+version = "4.3.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "d211803b9b6b570f68772237e415a029d5a50c65d382910b879fb19d3271f94d"
+
+[[package]]
+name = "percent-encoding"
+version = "2.3.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "9b4f627cb1b25917193a259e49bdad08f671f8d9708acfd5fe0a8c1455d87220"
+
+[[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.34"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "f6b464fbc74e149a392436b17d523f769e057cb6877f6a5c4618bc6f11800548"
+
+[[package]]
+name = "potential_utf"
+version = "0.1.6"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "d83eb9bc6d8e5cf568e7a1101d60ee05e81ed50ea106026f3d18deeb046d7661"
+dependencies = [
+ "zerovec",
+]
+
+[[package]]
+name = "proc-macro2"
+version = "1.0.107"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "985e7ec9bb745e6ce6535b544d84d6cd6f7ad8bd711c398938ae983b91a766d9"
+dependencies = [
+ "unicode-ident",
+]
+
+[[package]]
+name = "quinn"
+version = "0.11.11"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "0c1a41e437b6bbd489372cd4971de128e85c855f56c57f283d20ff016cf7c0a8"
+dependencies = [
+ "bytes",
+ "cfg_aliases",
+ "pin-project-lite",
+ "quinn-proto",
+ "quinn-udp",
+ "rustc-hash",
+ "rustls",
+ "socket2",
+ "thiserror",
+ "tokio",
+ "tracing",
+ "web-time",
+]
+
+[[package]]
+name = "quinn-proto"
+version = "0.11.17"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "04759210543be93709136e28212294a659ef5001836ff4eab4d663e4529bba83"
+dependencies = [
+ "aws-lc-rs",
+ "bytes",
+ "getrandom 0.4.3",
+ "lru-slab",
+ "rand",
+ "rand_pcg",
+ "ring",
+ "rustc-hash",
+ "rustls",
+ "rustls-pki-types",
+ "slab",
+ "thiserror",
+ "tinyvec",
+ "tracing",
+ "web-time",
+]
+
+[[package]]
+name = "quinn-udp"
+version = "0.5.15"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "35a133f956daabe89a61a685c2649f13d82d5aa4bd5d12d1277e1072a21c0694"
+dependencies = [
+ "cfg_aliases",
+ "libc",
+ "once_cell",
+ "socket2",
+ "tracing",
+ "windows-sys 0.61.2",
+]
+
+[[package]]
+name = "quote"
+version = "1.0.47"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "1fbf4db142a473a8d80c26bbf18454ed458bf8d26c8219c331daecfdbd079001"
+dependencies = [
+ "proc-macro2",
+]
+
+[[package]]
+name = "r-efi"
+version = "6.0.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "f8dcc9c7d52a811697d2151c701e0d08956f92b0e24136cf4cf27b57a6a0d9bf"
+
+[[package]]
+name = "rand"
+version = "0.10.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "c7f5fa3a058cd35567ef9bfa5e75732bee0f9e4c55fa90477bef2dfcdbc4be80"
+dependencies = [
+ "chacha20",
+ "getrandom 0.4.3",
+ "rand_core",
+]
+
+[[package]]
+name = "rand_core"
+version = "0.10.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "63b8176103e19a2643978565ca18b50549f6101881c443590420e4dc998a3c69"
+
+[[package]]
+name = "rand_pcg"
+version = "0.10.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "caa0f4137e1c0a72f4c651489402276c8e8e1cf081f3b0ba156d2cbeef09e86a"
+dependencies = [
+ "rand_core",
+]
+
+[[package]]
+name = "reqwest"
+version = "0.13.4"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "219c5811de6525e5416c7d5d53bb656d3afdbc6c5af816e0802bcfa42dbdc1c3"
+dependencies = [
+ "base64",
+ "bytes",
+ "encoding_rs",
+ "futures-core",
+ "h2",
+ "http",
+ "http-body",
+ "http-body-util",
+ "hyper",
+ "hyper-rustls",
+ "hyper-util",
+ "js-sys",
+ "log",
+ "mime",
+ "percent-encoding",
+ "pin-project-lite",
+ "quinn",
+ "rustls",
+ "rustls-pki-types",
+ "rustls-platform-verifier",
+ "sync_wrapper",
+ "tokio",
+ "tokio-rustls",
+ "tower",
+ "tower-http",
+ "tower-service",
+ "url",
+ "wasm-bindgen",
+ "wasm-bindgen-futures",
+ "web-sys",
+]
+
+[[package]]
+name = "ring"
+version = "0.17.14"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "a4689e6c2294d81e88dc6261c768b63bc4fcdb852be6d1352498b114f61383b7"
+dependencies = [
+ "cc",
+ "cfg-if",
+ "getrandom 0.2.17",
+ "libc",
+ "untrusted",
+ "windows-sys 0.52.0",
+]
+
+[[package]]
+name = "rustc-demangle"
+version = "0.1.28"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "b74b56ffa8bb2830709a538c2cbcae9aa062db0d2a42563bfb09bdaae44020eb"
+
+[[package]]
+name = "rustc-hash"
+version = "2.1.3"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "6b1e7f9a428571be2dc5bc0505c13fb6bf936822b894ec87abf8a08a4e51742d"
+
+[[package]]
+name = "rustc_version"
+version = "0.4.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "cfcb3a22ef46e85b45de6ee7e79d063319ebb6594faafcf1c225ea92ab6e9b92"
+dependencies = [
+ "semver",
+]
+
+[[package]]
+name = "rustls"
+version = "0.23.43"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "0283386ce02abc0151e1761d08802dfe86c173b0b494af5cbc086574e453da06"
+dependencies = [
+ "aws-lc-rs",
+ "once_cell",
+ "rustls-pki-types",
+ "rustls-webpki",
+ "subtle",
+ "zeroize",
+]
+
+[[package]]
+name = "rustls-native-certs"
+version = "0.8.4"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "dab5152771c58876a2146916e53e35057e1a4dfa2b9df0f0305b07f611fdea4d"
+dependencies = [
+ "openssl-probe",
+ "rustls-pki-types",
+ "schannel",
+ "security-framework",
+]
+
+[[package]]
+name = "rustls-pki-types"
+version = "1.15.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "2f4925028c7eb5d1fcdaf196971378ed9d2c1c4efc7dc5d011256f76c99c0a96"
+dependencies = [
+ "web-time",
+ "zeroize",
+]
+
+[[package]]
+name = "rustls-platform-verifier"
+version = "0.7.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "26d1e2536ce4f35f4846aa13bff16bd0ff40157cdb14cc056c7b14ba41233ba0"
+dependencies = [
+ "core-foundation 0.10.1",
+ "core-foundation-sys",
+ "jni",
+ "log",
+ "once_cell",
+ "rustls",
+ "rustls-native-certs",
+ "rustls-platform-verifier-android",
+ "rustls-webpki",
+ "security-framework",
+ "security-framework-sys",
+ "webpki-root-certs",
+ "windows-sys 0.61.2",
+]
+
+[[package]]
+name = "rustls-platform-verifier-android"
+version = "0.1.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "f87165f0995f63a9fbeea62b64d10b4d9d8e78ec6d7d51fb2125fda7bb36788f"
+
+[[package]]
+name = "rustls-webpki"
+version = "0.103.15"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "f3c3cf1d8b1e7d4927e2d154c3fcb02979afb9939629c62cd9048d4f07b60ac2"
+dependencies = [
+ "aws-lc-rs",
+ "ring",
+ "rustls-pki-types",
+ "untrusted",
+]
+
+[[package]]
+name = "rustversion"
+version = "1.0.23"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "cf54715a573b99ac80df0bc206da022bcd442c974952c7b9720069370852e21f"
+
+[[package]]
+name = "same-file"
+version = "1.0.6"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "93fc1dc3aaa9bfed95e02e6eadabb4baf7e3078b0bd1b4d7b6b0b68378900502"
+dependencies = [
+ "winapi-util",
+]
+
+[[package]]
+name = "schannel"
+version = "0.1.29"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "91c1b7e4904c873ef0710c1f407dde2e6287de2bebc1bbbf7d430bb7cbffd939"
+dependencies = [
+ "windows-sys 0.61.2",
+]
+
+[[package]]
+name = "security-framework"
+version = "3.7.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "b7f4bc775c73d9a02cde8bf7b2ec4c9d12743edf609006c7facc23998404cd1d"
+dependencies = [
+ "bitflags",
+ "core-foundation 0.10.1",
+ "core-foundation-sys",
+ "libc",
+ "security-framework-sys",
+]
+
+[[package]]
+name = "security-framework-sys"
+version = "2.17.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "6ce2691df843ecc5d231c0b14ece2acc3efb62c0a398c7e1d875f3983ce020e3"
+dependencies = [
+ "core-foundation-sys",
+ "libc",
+]
+
+[[package]]
+name = "semver"
+version = "1.0.28"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "8a7852d02fc848982e0c167ef163aaff9cd91dc640ba85e263cb1ce46fae51cd"
+
+[[package]]
+name = "serde"
+version = "1.0.229"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "4148590afebada386688f18773da617792bf2ef03ffc1e4cbd2b1d45b023e0ba"
+dependencies = [
+ "serde_core",
+ "serde_derive",
+]
+
+[[package]]
+name = "serde_core"
+version = "1.0.229"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "67dca2c9c51e58a4791a4b1ed58308b39c64224d349a935ab5039aa360942a48"
+dependencies = [
+ "serde_derive",
+]
+
+[[package]]
+name = "serde_derive"
+version = "1.0.229"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "e7a5d71263a5a7d47b41f6b3f06ba276f10cc18b0931f1799f710578e2309348"
+dependencies = [
+ "proc-macro2",
+ "quote",
+ "syn 3.0.4",
+]
+
+[[package]]
+name = "serde_json"
+version = "1.0.151"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "c841b55ecdae098c80dcae9cf767f6f8a0c2cdb3416bbef72181df4d0fe73f14"
+dependencies = [
+ "itoa",
+ "memchr",
+ "serde",
+ "serde_core",
+ "zmij",
+]
+
+[[package]]
+name = "sharded-slab"
+version = "0.1.7"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "f40ca3c46823713e0d4209592e8d6e826aa57e928f09752619fc696c499637f6"
+dependencies = [
+ "lazy_static",
+]
+
+[[package]]
+name = "shlex"
+version = "2.0.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "f8fadd59c855ef2080decdef8ff161eb6661b86933c9d82e5ba29dc602a55aba"
+
+[[package]]
+name = "simd_cesu8"
+version = "1.2.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "11031e251abf8611c80f460e19dbdeb54a66db918e49c65a7065b46ac7aec520"
+dependencies = [
+ "rustc_version",
+ "simdutf8",
+]
+
+[[package]]
+name = "simdutf8"
+version = "0.1.5"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "e3a9fe34e3e7a50316060351f37187a3f546bce95496156754b601a5fa71b76e"
+
+[[package]]
+name = "slab"
+version = "0.4.12"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "0c790de23124f9ab44544d7ac05d60440adc586479ce501c1d6d7da3cd8c9cf5"
+
+[[package]]
+name = "smallvec"
+version = "1.15.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "8ed6a63f02c8539c91a8685a86f4099661ba3da017932f6ebbea6de3f0fa7c90"
+
+[[package]]
+name = "socket2"
+version = "0.6.5"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "c3d1e2c7f27f8d4cb10542a02c49005dbd6e93095799d6f3be745fae9f8fedd4"
+dependencies = [
+ "libc",
+ "windows-sys 0.61.2",
+]
+
+[[package]]
+name = "stable_deref_trait"
+version = "1.2.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "6ce2be8dc25455e1f91df71bfa12ad37d7af1092ae736f3a6cd0e37bc7810596"
+
+[[package]]
+name = "subtle"
+version = "2.6.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "13c2bddecc57b384dee18652358fb23172facb8a2c51ccc10d74c157bdea3292"
+
+[[package]]
+name = "syn"
+version = "2.0.119"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "872831b642d1a07999a962a351ed35b955ea2cfc8f3862091e2a240a84f17297"
+dependencies = [
+ "proc-macro2",
+ "quote",
+ "unicode-ident",
+]
+
+[[package]]
+name = "syn"
+version = "3.0.4"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "e6275cddf4610d1775e6d1fe9469b2e77d0f39fd98fb7450901b821e0c53649f"
+dependencies = [
+ "proc-macro2",
+ "quote",
+ "unicode-ident",
+]
+
+[[package]]
+name = "sync_wrapper"
+version = "1.0.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "0bf256ce5efdfa370213c1dabab5935a12e49f2c58d15e9eac2870d3b4f27263"
+dependencies = [
+ "futures-core",
+]
+
+[[package]]
+name = "synstructure"
+version = "0.13.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "728a70f3dbaf5bab7f0c4b1ac8d7ae5ea60a4b5549c8a5914361c99147a709d2"
+dependencies = [
+ "proc-macro2",
+ "quote",
+ "syn 2.0.119",
+]
+
+[[package]]
+name = "system-configuration"
+version = "0.7.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "a13f3d0daba03132c0aa9767f98351b3488edc2c100cda2d2ec2b04f3d8d3c8b"
+dependencies = [
+ "bitflags",
+ "core-foundation 0.9.4",
+ "system-configuration-sys",
+]
+
+[[package]]
+name = "system-configuration-sys"
+version = "0.6.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "8e1d1b10ced5ca923a1fcb8d03e96b8d3268065d724548c0211415ff6ac6bac4"
+dependencies = [
+ "core-foundation-sys",
+ "libc",
+]
+
+[[package]]
+name = "thiserror"
+version = "2.0.20"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "ec86235f5fcc2a73650310756d2ac5b138a5780bbbdfae3eeccec992c435ba4f"
+dependencies = [
+ "thiserror-impl",
+]
+
+[[package]]
+name = "thiserror-impl"
+version = "2.0.20"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "bc04cd3e1236dd4a98afca4569f2deb3f120e5422a4023be2cb683f8486292af"
+dependencies = [
+ "proc-macro2",
+ "quote",
+ "syn 3.0.4",
+]
+
+[[package]]
+name = "thread_local"
+version = "1.1.10"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "1ad99c4c6d32803332c548b1af0540b357b3f5fc0be8f6c6bfe8b2e6ae784070"
+dependencies = [
+ "cfg-if",
+]
+
+[[package]]
+name = "tinystr"
+version = "0.8.4"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "b1e27c91459209c2986af3dcf603a5a74a4368754ce37414f59acc971167f643"
+dependencies = [
+ "displaydoc",
+ "zerovec",
+]
+
+[[package]]
+name = "tinyvec"
+version = "1.12.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "bb4ebadaa0af04fab11ae01eb5f9fdb5f9c5b875506e210e71c07873528baa7f"
+dependencies = [
+ "tinyvec_macros",
+]
+
+[[package]]
+name = "tinyvec_macros"
+version = "0.1.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20"
+
+[[package]]
+name = "tokio"
+version = "1.53.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "202caea871b69668250d242070849eb495be178ed697a3e98aebce5bc81a0bed"
+dependencies = [
+ "bytes",
+ "libc",
+ "mio",
+ "pin-project-lite",
+ "socket2",
+ "windows-sys 0.61.2",
+]
+
+[[package]]
+name = "tokio-rustls"
+version = "0.26.4"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "1729aa945f29d91ba541258c8df89027d5792d85a8841fb65e8bf0f4ede4ef61"
+dependencies = [
+ "rustls",
+ "tokio",
+]
+
+[[package]]
+name = "tokio-util"
+version = "0.7.19"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "494815d09bf52b5548659851081238f0ca39ff638363907596da739561c62c52"
+dependencies = [
+ "bytes",
+ "futures-core",
+ "futures-sink",
+ "libc",
+ "pin-project-lite",
+ "tokio",
+]
+
+[[package]]
+name = "tower"
+version = "0.5.3"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "ebe5ef63511595f1344e2d5cfa636d973292adc0eec1f0ad45fae9f0851ab1d4"
+dependencies = [
+ "futures-core",
+ "futures-util",
+ "pin-project-lite",
+ "sync_wrapper",
+ "tokio",
+ "tower-layer",
+ "tower-service",
+]
+
+[[package]]
+name = "tower-http"
+version = "0.6.11"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "4cfcf7e2740e6fc6d4d688b4ef00650406bb94adf4731e43c096c3a19fe40840"
+dependencies = [
+ "bitflags",
+ "bytes",
+ "futures-util",
+ "http",
+ "http-body",
+ "pin-project-lite",
+ "tower",
+ "tower-layer",
+ "tower-service",
+ "url",
+]
+
+[[package]]
+name = "tower-layer"
+version = "0.3.3"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "121c2a6cda46980bb0fcd1647ffaf6cd3fc79a013de288782836f6df9c48780e"
+
+[[package]]
+name = "tower-service"
+version = "0.3.3"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "8df9b6e13f2d32c91b9bd719c00d1958837bc7dec474d94952798cc8e69eeec3"
+
+[[package]]
+name = "tracing"
+version = "0.1.44"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "63e71662fa4b2a2c3a26f570f037eb95bb1f85397f3cd8076caed2f026a6d100"
+dependencies = [
+ "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",
+ "valuable",
+]
+
+[[package]]
+name = "tracing-error"
+version = "0.2.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "8b1581020d7a273442f5b45074a6a57d5757ad0a47dac0e9f0bd57b81936f3db"
+dependencies = [
+ "tracing",
+ "tracing-subscriber",
+]
+
+[[package]]
+name = "tracing-subscriber"
+version = "0.3.23"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "cb7f578e5945fb242538965c2d0b04418d38ec25c79d160cd279bf0731c8d319"
+dependencies = [
+ "sharded-slab",
+ "thread_local",
+ "tracing-core",
+]
+
+[[package]]
+name = "try-lock"
+version = "0.2.5"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "e421abadd41a4225275504ea4d6566923418b7f05506fbc9c0fe86ba7396114b"
+
+[[package]]
+name = "unicode-ident"
+version = "1.0.24"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "e6e4313cd5fcd3dad5cafa179702e2b244f760991f45397d14d4ebf38247da75"
+
+[[package]]
+name = "untrusted"
+version = "0.9.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "8ecb6da28b8a351d773b68d5825ac39017e680750f980f3a1a85cd8dd28a47c1"
+
+[[package]]
+name = "unty"
+version = "0.0.4"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "6d49784317cd0d1ee7ec5c716dd598ec5b4483ea832a2dced265471cc0f690ae"
+
+[[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",
+]
+
+[[package]]
+name = "utf8_iter"
+version = "1.0.4"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "b6c140620e7ffbb22c2dee59cafe6084a59b5ffc27a8859a5f0d494b5d52b6be"
+
+[[package]]
+name = "valuable"
+version = "0.1.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "ba73ea9cf16a25df0c8caa16c51acb937d5712a8429db78a3ee29d5dcacd3a65"
+
+[[package]]
+name = "virtue"
+version = "0.0.18"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "051eb1abcf10076295e815102942cc58f9d5e3b4560e46e53c21e8ff6f3af7b1"
+
+[[package]]
+name = "walkdir"
+version = "2.5.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "29790946404f91d9c5d06f9874efddea1dc06c5efe94541a7d6863108e3a5e4b"
+dependencies = [
+ "same-file",
+ "winapi-util",
+]
+
+[[package]]
+name = "want"
+version = "0.3.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "bfa7760aed19e106de2c7c0b581b509f2f25d3dacaf737cb82ac61bc6d760b0e"
+dependencies = [
+ "try-lock",
+]
+
+[[package]]
+name = "wasi"
+version = "0.11.1+wasi-snapshot-preview1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "ccf3ec651a847eb01de73ccad15eb7d99f80485de043efb2f370cd654f4ea44b"
+
+[[package]]
+name = "wasm-bindgen"
+version = "0.2.127"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "1b70935747edd64d89de3efa29d73789b806c15798f8e7dca4d8ac356b50ce70"
+dependencies = [
+ "cfg-if",
+ "once_cell",
+ "rustversion",
+ "wasm-bindgen-macro",
+ "wasm-bindgen-shared",
+]
+
+[[package]]
+name = "wasm-bindgen-futures"
+version = "0.4.77"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "6b7777d5cc23d0e91404e53ce2d5e8ec7acae3026b16233dba62cd3246457950"
+dependencies = [
+ "js-sys",
+ "wasm-bindgen",
+]
+
+[[package]]
+name = "wasm-bindgen-macro"
+version = "0.2.127"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "77775f8f3f7217702089053b94958f8f54061a3f663417df76e19cbdcca29bc1"
+dependencies = [
+ "quote",
+ "wasm-bindgen-macro-support",
+]
+
+[[package]]
+name = "wasm-bindgen-macro-support"
+version = "0.2.127"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "e11d33f857dc2fb11b8bc75aee111aa9cbeb12cd9f25efd3d4c2a3dd4e235284"
+dependencies = [
+ "bumpalo",
+ "proc-macro2",
+ "quote",
+ "syn 2.0.119",
+ "wasm-bindgen-shared",
+]
+
+[[package]]
+name = "wasm-bindgen-shared"
+version = "0.2.127"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "7ef64dbcc55df09c7e5a46182d181c2cfa3e925f3da937ea764728b4bbb9dcbf"
+dependencies = [
+ "unicode-ident",
+]
+
+[[package]]
+name = "web-sys"
+version = "0.3.104"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "c435338968042f4f59a557f690a253676d47ce13ceb55d70100e7facf6620a30"
+dependencies = [
+ "js-sys",
+ "wasm-bindgen",
+]
+
+[[package]]
+name = "web-time"
+version = "1.1.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "5a6580f308b1fad9207618087a65c04e7a10bc77e02c8e84e9b00dd4b12fa0bb"
+dependencies = [
+ "js-sys",
+ "wasm-bindgen",
+]
+
+[[package]]
+name = "webpki-root-certs"
+version = "1.0.9"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "b96554aa2acc8ccdb7e1c9a58a7a68dd5d13bccc69cd124cb09406db612a1c9b"
+dependencies = [
+ "rustls-pki-types",
+]
+
+[[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 = "windows-link"
+version = "0.2.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "f0805222e57f7521d6a62e36fa9163bc891acd422f971defe97d64e70d0a4fe5"
+
+[[package]]
+name = "windows-registry"
+version = "0.6.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "02752bf7fbdcce7f2a27a742f798510f3e5ad88dbe84871e5168e2120c3d5720"
+dependencies = [
+ "windows-link",
+ "windows-result",
+ "windows-strings",
+]
+
+[[package]]
+name = "windows-result"
+version = "0.4.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "7781fa89eaf60850ac3d2da7af8e5242a5ea78d1a11c49bf2910bb5a73853eb5"
+dependencies = [
+ "windows-link",
+]
+
+[[package]]
+name = "windows-strings"
+version = "0.5.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "7837d08f69c77cf6b07689544538e017c1bfcf57e34b4c0ff58e6c2cd3b37091"
+dependencies = [
+ "windows-link",
+]
+
+[[package]]
+name = "windows-sys"
+version = "0.52.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d"
+dependencies = [
+ "windows-targets",
+]
+
+[[package]]
+name = "windows-sys"
+version = "0.61.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "ae137229bcbd6cdf0f7b80a31df61766145077ddf49416a728b02cb3921ff3fc"
+dependencies = [
+ "windows-link",
+]
+
+[[package]]
+name = "windows-targets"
+version = "0.52.6"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "9b724f72796e036ab90c1021d4780d4d3d648aca59e491e6b98e725b84e99973"
+dependencies = [
+ "windows_aarch64_gnullvm",
+ "windows_aarch64_msvc",
+ "windows_i686_gnu",
+ "windows_i686_gnullvm",
+ "windows_i686_msvc",
+ "windows_x86_64_gnu",
+ "windows_x86_64_gnullvm",
+ "windows_x86_64_msvc",
+]
+
+[[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_msvc"
+version = "0.52.6"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469"
+
+[[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_gnullvm"
+version = "0.52.6"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66"
+
+[[package]]
+name = "windows_i686_msvc"
+version = "0.52.6"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66"
+
+[[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_gnullvm"
+version = "0.52.6"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d"
+
+[[package]]
+name = "windows_x86_64_msvc"
+version = "0.52.6"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec"
+
+[[package]]
+name = "writeable"
+version = "0.6.4"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "3ad82d2a33cdc9674dc7465672f271e096168fcdbe0f799d9e6db8c5892679dc"
+
+[[package]]
+name = "yoke"
+version = "0.8.3"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "709fe23a0424b6a435d82152b1bd3fdfb0833487d5fa90d05d42762a9891fef5"
+dependencies = [
+ "stable_deref_trait",
+ "yoke-derive",
+ "zerofrom",
+]
+
+[[package]]
+name = "yoke-derive"
+version = "0.8.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "de844c262c8848816172cef550288e7dc6c7b7814b4ee56b3e1553f275f1858e"
+dependencies = [
+ "proc-macro2",
+ "quote",
+ "syn 2.0.119",
+ "synstructure",
+]
+
+[[package]]
+name = "zerofrom"
+version = "0.1.8"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "0ec05a11813ea801ff6d75110ad09cd0824ddba17dfe17128ea0d5f68e6c5272"
+dependencies = [
+ "zerofrom-derive",
+]
+
+[[package]]
+name = "zerofrom-derive"
+version = "0.1.7"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "11532158c46691caf0f2593ea8358fed6bbf68a0315e80aae9bd41fbade684a1"
+dependencies = [
+ "proc-macro2",
+ "quote",
+ "syn 2.0.119",
+ "synstructure",
+]
+
+[[package]]
+name = "zeroize"
+version = "1.9.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "e13c156562582aa81c60cb29407084cdb54c4164760106ab78e6c5b0858cf64e"
+
+[[package]]
+name = "zerotrie"
+version = "0.2.5"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "4ea269c3bd32f0a32c321907a2ae912ba6f4649bb0fc764a15627e99a7095a3f"
+dependencies = [
+ "displaydoc",
+ "yoke",
+ "zerofrom",
+]
+
+[[package]]
+name = "zerovec"
+version = "0.11.8"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "bb0464e17806c1d976d5cba29399c7f08e516e279e2ba493f63123b5fca67dd8"
+dependencies = [
+ "yoke",
+ "zerofrom",
+ "zerovec-derive",
+]
+
+[[package]]
+name = "zerovec-derive"
+version = "0.11.6"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "34df6fc39dbd26ddc9c10e6a2984476e13acce22e64e4487636ef494369225da"
+dependencies = [
+ "proc-macro2",
+ "quote",
+ "syn 3.0.4",
+]
+
+[[package]]
+name = "zmij"
+version = "1.0.23"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "29666d0abbfad1e3dc4dcf6144730dd3a3ab225bbbdac83319345b1b44ccfc1b"
diff --git a/generator/Cargo.toml b/generator/Cargo.toml
new file mode 100644 (file)
index 0000000..abba69f
--- /dev/null
@@ -0,0 +1,13 @@
+[package]
+name = "generator"
+version = "0.1.0"
+edition = "2024"
+
+[dependencies]
+bincode = { version = "2", features = ["serde"] }
+color-eyre = "0.6.5"
+reqwest = "0.13.4"
+serde = { version = "1.0.229", features = ["derive"] }
+serde_json = "1.0.151"
+thiserror = "2.0.20"
+walkdir = "2.5.0"
diff --git a/generator/src/main.rs b/generator/src/main.rs
new file mode 100644 (file)
index 0000000..5d91e1f
--- /dev/null
@@ -0,0 +1,529 @@
+use std::{
+    collections::{BTreeMap, HashMap, HashSet},
+    env,
+    fs::{self, File},
+    io::{BufWriter, Write},
+    path::{Path, PathBuf},
+};
+
+use color_eyre::{Result, eyre::eyre};
+use serde::{Deserialize, Serialize};
+use walkdir::WalkDir;
+
+const DEFAULT_MAX_ORDER: usize = 3;
+// Keep enough contexts for the puzzler's support threshold. A small top-k
+// lets a larger corpus replace useful contexts with new, low-frequency ones.
+const DEFAULT_TOP_K: usize = 500;
+
+#[derive(Debug, Deserialize, Serialize)]
+struct WordPatterns {
+    /// For each word, the most common paired phrases immediately before and after it.
+    patterns: BTreeMap<String, Vec<Pattern>>,
+}
+
+#[derive(Debug, Deserialize, Serialize)]
+struct Pattern {
+    previous: String,
+    following: String,
+    count: u64,
+}
+
+fn main() -> Result<()> {
+    color_eyre::install()?;
+
+    let args: Vec<String> = env::args().collect();
+    let input = args
+        .get(1)
+        .map(PathBuf::from)
+        .unwrap_or_else(|| PathBuf::from("gutenberg"));
+    let output = args
+        .get(2)
+        .map(PathBuf::from)
+        .unwrap_or_else(|| PathBuf::from("word_patterns.bin"));
+    let max_order = args
+        .get(3)
+        .map(|value| value.parse::<usize>())
+        .transpose()?
+        .unwrap_or(DEFAULT_MAX_ORDER);
+    let top_k = args
+        .get(4)
+        .map(|value| value.parse::<usize>())
+        .transpose()?
+        .unwrap_or(DEFAULT_TOP_K);
+
+    if max_order < 2 {
+        return Err(eyre!("max order must be at least two"));
+    }
+    if max_order > 3 {
+        return Err(eyre!("max order must not be greater than three"));
+    }
+    if top_k == 0 {
+        return Err(eyre!("top k must be greater than zero"));
+    }
+
+    dbg!("starting");
+    let paths = input_paths(&input)?;
+    dbg!("done w paths");
+    let patterns = build_patterns_from_paths(&paths, max_order, top_k)?;
+    dbg!("built patterns");
+
+    let file = File::create(&output)?;
+    let mut writer = BufWriter::with_capacity(1024 * 1024, file);
+    bincode::serde::encode_into_std_write(&patterns, &mut writer, bincode::config::standard())?;
+    writer.flush()?;
+    dbg!("wrote file");
+    println!("Wrote {} texts to {}", paths.len(), output.display());
+    Ok(())
+}
+
+fn input_paths(input: &Path) -> Result<Vec<PathBuf>> {
+    if input.is_file() {
+        return Ok(vec![input.to_owned()]);
+    }
+    if !input.is_dir() {
+        return Err(eyre!("input path does not exist: {}", input.display()));
+    }
+
+    let mut paths = WalkDir::new(input)
+        .into_iter()
+        .filter_map(|entry| entry.ok())
+        .filter(|entry| {
+            entry.file_type().is_file()
+                && entry
+                    .path()
+                    .extension()
+                    .is_some_and(|extension| extension.eq_ignore_ascii_case("txt"))
+        })
+        .map(|entry| entry.into_path())
+        .collect::<Vec<_>>();
+    paths.sort();
+
+    Ok(paths)
+}
+
+#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
+struct NgramKey {
+    words: [u32; 3],
+    length: u8,
+}
+
+#[derive(Clone, Copy, Debug, Eq, Hash, PartialEq)]
+struct PatternKey {
+    previous: NgramKey,
+    following: NgramKey,
+}
+
+struct TopCounts<K> {
+    entries: Vec<(K, u64)>,
+    limit: usize,
+}
+
+impl<K: Copy + Eq> TopCounts<K> {
+    fn new(limit: usize) -> Self {
+        Self {
+            entries: Vec::with_capacity(limit),
+            limit,
+        }
+    }
+
+    fn add(&mut self, key: K) {
+        if let Some((_, count)) = self.entries.iter_mut().find(|(entry, _)| *entry == key) {
+            *count += 1;
+            return;
+        }
+        if self.entries.len() < self.limit {
+            self.entries.push((key, 1));
+            return;
+        }
+
+        if let Some((index, (_, minimum))) = self
+            .entries
+            .iter()
+            .enumerate()
+            .min_by_key(|(_, (_, count))| *count)
+        {
+            self.entries[index] = (key, minimum.saturating_add(1));
+        }
+    }
+}
+
+#[cfg(test)]
+fn build_patterns(texts: &[String], max_order: usize) -> WordPatterns {
+    build_patterns_from_texts(texts, max_order, DEFAULT_TOP_K)
+}
+
+#[cfg(test)]
+fn build_patterns_from_texts(texts: &[String], max_order: usize, top_k: usize) -> WordPatterns {
+    let mut vocabulary = HashMap::<String, u32>::new();
+    let mut words_by_id = Vec::new();
+    let mut pattern_counts = HashMap::<u32, TopCounts<PatternKey>>::new();
+
+    for text in texts {
+        process_text_top(
+            clean_gutenberg_boilerplate(text),
+            max_order,
+            top_k,
+            &mut vocabulary,
+            &mut words_by_id,
+            &mut pattern_counts,
+        );
+    }
+
+    let candidates = candidate_patterns(pattern_counts);
+    let mut exact_counts = HashMap::new();
+    for text in texts {
+        process_text_exact(
+            clean_gutenberg_boilerplate(text),
+            max_order,
+            &mut vocabulary,
+            &mut words_by_id,
+            &candidates,
+            &mut exact_counts,
+        );
+    }
+    finish_patterns(exact_counts, &words_by_id)
+}
+
+fn build_patterns_from_paths(
+    paths: &[PathBuf],
+    max_order: usize,
+    top_k: usize,
+) -> Result<WordPatterns> {
+    let mut vocabulary = HashMap::<String, u32>::new();
+    let mut words_by_id = Vec::new();
+    let mut pattern_counts = HashMap::<u32, TopCounts<PatternKey>>::new();
+
+    let total = paths.len();
+    let mut count = 0;
+
+    for path in paths {
+        let text = fs::read_to_string(path)?;
+        println!("file {} of {}", count, total);
+        count += 1;
+
+        process_text_top(
+            clean_gutenberg_boilerplate(&text),
+            max_order,
+            top_k,
+            &mut vocabulary,
+            &mut words_by_id,
+            &mut pattern_counts,
+        );
+    }
+
+    let candidates = candidate_patterns(pattern_counts);
+    let mut exact_counts = HashMap::new();
+    for path in paths {
+        let text = fs::read_to_string(path)?;
+        process_text_exact(
+            clean_gutenberg_boilerplate(&text),
+            max_order,
+            &mut vocabulary,
+            &mut words_by_id,
+            &candidates,
+            &mut exact_counts,
+        );
+    }
+
+    dbg!("finishing patterns");
+    Ok(finish_patterns(exact_counts, &words_by_id))
+}
+
+fn process_text_top(
+    text: &str,
+    max_order: usize,
+    top_k: usize,
+    vocabulary: &mut HashMap<String, u32>,
+    words_by_id: &mut Vec<String>,
+    patterns: &mut HashMap<u32, TopCounts<PatternKey>>,
+) {
+    for (id, pattern) in text_patterns(text, max_order, vocabulary, words_by_id) {
+        patterns
+            .entry(id)
+            .or_insert_with(|| TopCounts::new(top_k))
+            .add(pattern);
+    }
+}
+
+fn text_patterns(
+    text: &str,
+    max_order: usize,
+    vocabulary: &mut HashMap<String, u32>,
+    words_by_id: &mut Vec<String>,
+) -> Vec<(u32, PatternKey)> {
+    let mut words_with_sentence = Vec::<(u32, usize)>::new();
+    let mut current = String::new();
+    let mut sentence_id: usize = 0;
+
+    for ch in text.chars() {
+        if ch.is_ascii_alphabetic() || ch == '\'' {
+            current.push(ch.to_ascii_lowercase());
+            continue;
+        }
+
+        if !current.is_empty() {
+            let id = vocabulary.get(&current).copied().unwrap_or_else(|| {
+                let id = words_by_id.len() as u32;
+                vocabulary.insert(current.clone(), id);
+                words_by_id.push(current.clone());
+                id
+            });
+            words_with_sentence.push((id, sentence_id));
+            current.clear();
+        }
+        if ch == '.' || ch == '!' || ch == '?' {
+            sentence_id = sentence_id.saturating_add(1);
+        }
+    }
+
+    if !current.is_empty() {
+        let id = vocabulary.get(&current).copied().unwrap_or_else(|| {
+            let id = words_by_id.len() as u32;
+            vocabulary.insert(current.clone(), id);
+            words_by_id.push(current.clone());
+            id
+        });
+        words_with_sentence.push((id, sentence_id));
+    }
+
+    let mut patterns = Vec::new();
+    for index in 0..words_with_sentence.len() {
+        let (id, sent) = words_with_sentence[index];
+        for previous_order in 2..=max_order.min(index) {
+            // ensure previous tokens are in same sentence
+            let mut ok = true;
+            for k in 1..=previous_order {
+                if words_with_sentence[index - k].1 != sent {
+                    ok = false;
+                    break;
+                }
+            }
+            if !ok {
+                continue;
+            }
+            for following_order in 2..=max_order.min(words_with_sentence.len() - index - 1) {
+                // ensure following tokens are in same sentence
+                let mut ok2 = true;
+                for k in 1..=following_order {
+                    if words_with_sentence[index + k].1 != sent {
+                        ok2 = false;
+                        break;
+                    }
+                }
+                if !ok2 {
+                    continue;
+                }
+
+                let mut previous = NgramKey {
+                    words: [0; 3],
+                    length: previous_order as u8,
+                };
+                for k in 0..previous_order {
+                    previous.words[k] = words_with_sentence[index - previous_order + k].0;
+                }
+                let mut following = NgramKey {
+                    words: [0; 3],
+                    length: following_order as u8,
+                };
+                for k in 0..following_order {
+                    following.words[k] = words_with_sentence[index + 1 + k].0;
+                }
+
+                patterns.push((
+                    id,
+                    PatternKey {
+                        previous,
+                        following,
+                    },
+                ));
+            }
+        }
+    }
+    patterns
+}
+
+fn process_text_exact(
+    text: &str,
+    max_order: usize,
+    vocabulary: &mut HashMap<String, u32>,
+    words_by_id: &mut Vec<String>,
+    candidates: &HashMap<u32, HashSet<PatternKey>>,
+    patterns: &mut HashMap<u32, HashMap<PatternKey, u64>>,
+) {
+    for (id, pattern) in text_patterns(text, max_order, vocabulary, words_by_id) {
+        if candidates
+            .get(&id)
+            .is_some_and(|items| items.contains(&pattern))
+        {
+            patterns
+                .entry(id)
+                .or_default()
+                .entry(pattern)
+                .and_modify(|count| *count += 1)
+                .or_insert(1);
+        }
+    }
+}
+
+fn candidate_patterns(
+    counts: HashMap<u32, TopCounts<PatternKey>>,
+) -> HashMap<u32, HashSet<PatternKey>> {
+    counts
+        .into_iter()
+        .map(|(word, counts)| {
+            (
+                word,
+                counts
+                    .entries
+                    .into_iter()
+                    .map(|(pattern, _)| pattern)
+                    .collect(),
+            )
+        })
+        .collect()
+}
+
+fn finish_patterns(
+    pattern_counts: HashMap<u32, HashMap<PatternKey, u64>>,
+    words_by_id: &[String],
+) -> WordPatterns {
+    let patterns = pattern_counts
+        .into_iter()
+        .map(|(word, counts)| {
+            let mut counts: Vec<(PatternKey, u64)> = counts.into_iter().collect();
+            counts.sort_by(|(left, left_count), (right, right_count)| {
+                right_count.cmp(left_count).then_with(|| {
+                    (left.previous, left.following).cmp(&(right.previous, right.following))
+                })
+            });
+            // let total: u64 = counts.iter().map(|(_, count)| count).sum();
+            let patterns = counts
+                .into_iter()
+                .map(|(pattern, count)| Pattern {
+                    previous: context_string(pattern.previous, words_by_id),
+                    following: context_string(pattern.following, words_by_id),
+                    count,
+                })
+                .collect();
+            (words_by_id[word as usize].clone(), patterns)
+        })
+        .collect();
+    WordPatterns { patterns }
+}
+
+fn context_string(context: NgramKey, words: &[String]) -> String {
+    context.words[..context.length as usize]
+        .iter()
+        .map(|id| words[*id as usize].as_str())
+        .collect::<Vec<_>>()
+        .join(" ")
+}
+
+#[cfg(test)]
+fn remove_gutenberg_boilerplate(text: String) -> String {
+    clean_gutenberg_boilerplate(&text).to_owned()
+}
+
+fn clean_gutenberg_boilerplate(text: &str) -> &str {
+    let start_markers = [
+        "*** START OF THE PROJECT GUTENBERG EBOOK",
+        "*** START OF THIS PROJECT GUTENBERG EBOOK",
+    ];
+    let end_markers = [
+        "*** END OF THE PROJECT GUTENBERG EBOOK",
+        "*** END OF THIS PROJECT GUTENBERG EBOOK",
+    ];
+
+    let start = start_markers
+        .iter()
+        .filter_map(|marker| text.find(marker))
+        .filter_map(|position| {
+            text[position..]
+                .find('\n')
+                .map(|line_end| position + line_end + 1)
+        })
+        .max()
+        .unwrap_or(0);
+    let end = end_markers
+        .iter()
+        .filter_map(|marker| text.find(marker))
+        .min()
+        .unwrap_or(text.len());
+
+    if start <= end { &text[start..end] } else { "" }
+}
+
+#[cfg(test)]
+mod tests {
+    use super::*;
+
+    #[test]
+    fn removes_gutenberg_header_and_footer() {
+        let text = "header\n*** START OF THE PROJECT GUTENBERG EBOOK Demo\nA book.\n*** END OF THE PROJECT GUTENBERG EBOOK Demo\nfooter".to_owned();
+
+        assert_eq!(remove_gutenberg_boilerplate(text), "A book.\n");
+    }
+
+    #[test]
+    fn records_preceding_patterns_for_each_word() {
+        let patterns = build_patterns(
+            &["red blue green\nred blue green\nred blue yellow".to_owned()],
+            3,
+        );
+        let transitions = &patterns.patterns["green"];
+
+        let red_blue = transitions
+            .iter()
+            .find(|item| item.previous == "red blue")
+            .expect("two-word pattern");
+        assert_eq!(red_blue.count, 2);
+        assert_eq!(red_blue.following, "red blue");
+        assert!(
+            transitions
+                .iter()
+                .any(|item| item.previous == "green red blue")
+        );
+    }
+
+    #[test]
+    fn does_not_pair_contexts_across_sentence_boundaries() {
+        let patterns = build_patterns(&["fat lazy sweet. ran away quickly.".to_owned()], 2);
+
+        assert!(!patterns.patterns.contains_key("sweet"));
+    }
+
+    #[test]
+    fn records_two_and_three_word_patterns() {
+        let patterns = build_patterns_from_texts(
+            &["one two three four five six seven eight".to_owned()],
+            3,
+            20,
+        );
+
+        let values = patterns.patterns["four"]
+            .iter()
+            .map(|pattern| (pattern.previous.as_str(), pattern.following.as_str()))
+            .collect::<Vec<_>>();
+        assert_eq!(
+            values,
+            vec![
+                ("one two three", "five six"),
+                ("one two three", "five six seven"),
+                ("two three", "five six"),
+                ("two three", "five six seven"),
+            ]
+        );
+    }
+
+    #[test]
+    fn keeps_only_the_requested_number_of_patterns() {
+        let patterns = build_patterns_from_texts(
+            &["one two three four five six seven eight".to_owned()],
+            3,
+            1,
+        );
+
+        assert_eq!(patterns.patterns["five"].len(), 1);
+        assert_eq!(patterns.patterns["five"][0].previous, "two three four");
+    }
+}
diff --git a/gleam/client/.gitignore b/gleam/client/.gitignore
new file mode 100644 (file)
index 0000000..ca614a3
--- /dev/null
@@ -0,0 +1,8 @@
+*.beam
+*.ez
+/build
+erl_crash.dump
+
+#Added automatically by Lustre Dev Tools
+/.lustre
+/dist
diff --git a/gleam/client/README.md b/gleam/client/README.md
new file mode 100644 (file)
index 0000000..a871ddc
--- /dev/null
@@ -0,0 +1,24 @@
+# client
+
+[![Package Version](https://img.shields.io/hexpm/v/client)](https://hex.pm/packages/client)
+[![Hex Docs](https://img.shields.io/badge/hex-docs-ffaff3)](https://client.hexdocs.pm/)
+
+```sh
+gleam add client@1
+```
+```gleam
+import client
+
+pub fn main() -> Nil {
+  // TODO: An example of the project in use
+}
+```
+
+Further documentation can be found at <https://client.hexdocs.pm/>.
+
+## Development
+
+```sh
+gleam run   # Run the project
+gleam test  # Run the tests
+```
diff --git a/gleam/client/gleam.toml b/gleam/client/gleam.toml
new file mode 100644 (file)
index 0000000..5f562d7
--- /dev/null
@@ -0,0 +1,30 @@
+name = "client"
+version = "1.0.0"
+target = "javascript"
+
+# Fill out these fields if you intend to generate HTML documentation or publish
+# your project to the Hex package manager.
+#
+# description = ""
+# licences = ["Apache-2.0"]
+# repository = { type = "github", user = "", repo = "" }
+# links = [{ title = "Website", href = "" }]
+#
+# For a full reference of all the available options, you can have a look at
+# https://gleam.run/writing-gleam/gleam-toml/.
+
+[dependencies]
+gleam_stdlib = ">= 1.0.0 and < 2.0.0"
+lustre = ">= 5.7.1 and < 6.0.0"
+rsvp = ">= 2.0.0 and < 3.0.0"
+gleam_json = ">= 3.1.0 and < 4.0.0"
+gleam_http = ">= 4.3.0 and < 5.0.0"
+plinth = ">= 0.11.0 and < 1.0.0"
+shared = { path = "../shared" }
+gleam_erlang = ">= 1.3.0 and < 2.0.0"
+mist = ">= 6.0.3 and < 7.0.0"
+simplifile = ">= 2.7.0 and < 3.0.0"
+
+[dev_dependencies]
+gleeunit = ">= 1.0.0 and < 2.0.0"
+lustre_dev_tools = ">= 2.3.6 and < 3.0.0"
diff --git a/gleam/client/manifest.toml b/gleam/client/manifest.toml
new file mode 100644 (file)
index 0000000..b9b14b0
--- /dev/null
@@ -0,0 +1,65 @@
+# Do not manually edit this file, it is managed by Gleam.
+#
+# This file locks the dependency versions used, to make your build
+# deterministic and to prevent unexpected versions from being included
+# in your application.
+#
+# You should check this file into your source control repository.
+
+packages = [
+  { name = "argv", version = "1.1.0", build_tools = ["gleam"], requirements = [], otp_app = "argv", source = "hex", outer_checksum = "3277D100448BDB4A29B6D58C0F36F631CBC349E8BDD09766C6309DF202831140" },
+  { name = "booklet", version = "1.1.0", build_tools = ["gleam"], requirements = [], otp_app = "booklet", source = "hex", outer_checksum = "08E0FDB78DC4D8A5D3C80295B021505C7D2A2E7B6C6D5EAB7286C36F4A53C851" },
+  { name = "directories", version = "1.2.0", build_tools = ["gleam"], requirements = ["envoy", "gleam_stdlib", "platform", "simplifile"], otp_app = "directories", source = "hex", outer_checksum = "D13090CFCDF6759B87217E8DDD73A75903A700148A82C1D33799F333E249BF9E" },
+  { name = "envoy", version = "1.2.0", build_tools = ["gleam"], requirements = ["gleam_stdlib"], otp_app = "envoy", source = "hex", outer_checksum = "9C6FBB6BFA02A52798BEEC5977A738CAD6E4A057F4B67FD0C8061AD2502C191A" },
+  { name = "exception", version = "2.1.1", build_tools = ["gleam"], requirements = ["gleam_stdlib"], otp_app = "exception", source = "hex", outer_checksum = "6BDEA95248093599391C3B5DF1835C5C6A86C353C2F99CE539B450E3432FE117" },
+  { name = "filepath", version = "1.1.2", build_tools = ["gleam"], requirements = ["gleam_stdlib"], otp_app = "filepath", source = "hex", outer_checksum = "B06A9AF0BF10E51401D64B98E4B627F1D2E48C154967DA7AF4D0914780A6D40A" },
+  { name = "gleam_community_ansi", version = "1.5.0", build_tools = ["gleam"], requirements = ["gleam_community_colour", "gleam_regexp", "gleam_stdlib"], otp_app = "gleam_community_ansi", source = "hex", outer_checksum = "B5AA433AF84313E23FDF90CCFF752B9380FE9FFCE02B2949D49B7AACCC77B16D" },
+  { name = "gleam_community_colour", version = "2.0.4", build_tools = ["gleam"], requirements = ["gleam_json", "gleam_stdlib"], otp_app = "gleam_community_colour", source = "hex", outer_checksum = "6DB4665555D7D2B27F0EA32EF47E8BEBC4303821765F9C73D483F38EE24894F0" },
+  { name = "gleam_crypto", version = "1.6.0", build_tools = ["gleam"], requirements = ["gleam_stdlib"], otp_app = "gleam_crypto", source = "hex", outer_checksum = "2DE9E4EF53CF6FEE049D4F765731F7178F7A11AEFAE00EEE63BF7536B354AD3F" },
+  { name = "gleam_erlang", version = "1.3.0", build_tools = ["gleam"], requirements = ["gleam_stdlib"], otp_app = "gleam_erlang", source = "hex", outer_checksum = "1124AD3AA21143E5AF0FC5CF3D9529F6DB8CA03E43A55711B60B6B7B3874375C" },
+  { name = "gleam_fetch", version = "1.4.0", build_tools = ["gleam"], requirements = ["gleam_http", "gleam_javascript", "gleam_stdlib"], otp_app = "gleam_fetch", source = "hex", outer_checksum = "284CE88E37436699545F9F65D413E1DFB6C1EA3FE3824B6EA2018D0ECF088FFC" },
+  { name = "gleam_http", version = "4.3.0", build_tools = ["gleam"], requirements = ["gleam_stdlib"], otp_app = "gleam_http", source = "hex", outer_checksum = "82EA6A717C842456188C190AFB372665EA56CE13D8559BF3B1DD9E40F619EE0C" },
+  { name = "gleam_httpc", version = "5.0.0", build_tools = ["gleam"], requirements = ["gleam_erlang", "gleam_http", "gleam_stdlib"], otp_app = "gleam_httpc", source = "hex", outer_checksum = "C545172618D07811494E97AAA4A0FB34DA6F6D0061FDC8041C2F8E3BE2B2E48F" },
+  { name = "gleam_javascript", version = "1.0.1", build_tools = ["gleam"], requirements = ["gleam_stdlib"], otp_app = "gleam_javascript", source = "hex", outer_checksum = "D542C4B4F40E942F5D3372D524419FA521A7BB92D621AF696CC286E89D882D55" },
+  { name = "gleam_json", version = "3.1.0", build_tools = ["gleam"], requirements = ["gleam_stdlib"], otp_app = "gleam_json", source = "hex", outer_checksum = "44FDAA8847BE8FC48CA7A1C089706BD54BADCC4C45B237A992EDDF9F2CDB2836" },
+  { name = "gleam_otp", version = "1.3.0", build_tools = ["gleam"], requirements = ["gleam_erlang", "gleam_stdlib"], otp_app = "gleam_otp", source = "hex", outer_checksum = "DE4CA6850842F0266EE95317A25DD6A0A0F20CDFAB7C0ADC2E63251D7C3C72EC" },
+  { name = "gleam_regexp", version = "1.1.1", build_tools = ["gleam"], requirements = ["gleam_stdlib"], otp_app = "gleam_regexp", source = "hex", outer_checksum = "9C215C6CA84A5B35BB934A9B61A9A306EC743153BE2B0425A0D032E477B062A9" },
+  { name = "gleam_stdlib", version = "1.0.5", build_tools = ["gleam"], requirements = [], otp_app = "gleam_stdlib", source = "hex", outer_checksum = "CEE5B6C076A85B45F60C585F4316C63EC8B7127C119D5738C3958A9C4D50404E" },
+  { name = "gleam_time", version = "1.10.0", build_tools = ["gleam"], requirements = ["gleam_stdlib"], otp_app = "gleam_time", source = "hex", outer_checksum = "56539216E4C4B1748714652AB38F0BD16B9101F61DB62769FDC7CD42A8E5E833" },
+  { name = "gleeunit", version = "1.11.0", build_tools = ["gleam"], requirements = ["gleam_stdlib"], otp_app = "gleeunit", source = "hex", outer_checksum = "EC31ABA74256AEA531EDF8169931D775BBB384FED0A8A1BDC4DD9354E3E21826" },
+  { name = "glint", version = "1.3.0", build_tools = ["gleam"], requirements = ["gleam_community_ansi", "gleam_community_colour", "gleam_stdlib", "snag"], otp_app = "glint", source = "hex", outer_checksum = "26CCA9BC3ACB56CD9D754ACF598F49B4C281C4FDD81AE61FA21C8E92E9C8218E" },
+  { name = "glisten", version = "9.0.1", build_tools = ["gleam"], requirements = ["gleam_erlang", "gleam_otp", "gleam_stdlib", "logging"], otp_app = "glisten", source = "hex", outer_checksum = "7795AA50830656F3A0316A6B26595F893C83272DA901B3405E31339CAA31A10B" },
+  { name = "gramps", version = "6.0.1", build_tools = ["gleam"], requirements = ["gleam_crypto", "gleam_erlang", "gleam_http", "gleam_stdlib"], otp_app = "gramps", source = "hex", outer_checksum = "D55636072DEE173F6586A5679D3C02EC7A0DE3F8646B78C351B72908FF223DF7" },
+  { name = "group_registry", version = "1.0.0", build_tools = ["gleam"], requirements = ["gleam_erlang", "gleam_otp", "gleam_stdlib"], otp_app = "group_registry", source = "hex", outer_checksum = "BC798A53D6F2406DB94E27CB45C57052CB56B32ACF7CC16EA20F6BAEC7E36B90" },
+  { name = "houdini", version = "1.2.1", build_tools = ["gleam"], requirements = [], otp_app = "houdini", source = "hex", outer_checksum = "6F8AC2F12974567FB744BEA66AC93CEB76AAEA19AD28564623F76CDA9BC26A85" },
+  { name = "hpack_erl", version = "0.3.0", build_tools = ["rebar3"], requirements = [], otp_app = "hpack", source = "hex", outer_checksum = "D6137D7079169D8C485C6962DFE261AF5B9EF60FBC557344511C1E65E3D95FB0" },
+  { name = "justin", version = "1.1.0", build_tools = ["gleam"], requirements = ["gleam_stdlib"], otp_app = "justin", source = "hex", outer_checksum = "8B1C62269E8607D0A0ED698B7903984CE0BF7B6B3C0DEA3C6C8302B39402837B" },
+  { name = "logging", version = "1.5.0", build_tools = ["gleam"], requirements = ["gleam_stdlib"], otp_app = "logging", source = "hex", outer_checksum = "BC5F18CE5DD9686100229FE5409BDC3DD5C46D5A7DF2F804AD2D8F0DD6C5060E" },
+  { name = "lustre", version = "5.7.1", build_tools = ["gleam"], requirements = ["exception", "gleam_erlang", "gleam_json", "gleam_otp", "gleam_stdlib", "houdini"], otp_app = "lustre", source = "hex", outer_checksum = "663A2D1A3458914CA537A42AC07E601DD3FD85415EBDAF4717F2DFF6E86F90F9" },
+  { name = "lustre_dev_tools", version = "2.3.6", build_tools = ["gleam"], requirements = ["argv", "booklet", "filepath", "gleam_community_ansi", "gleam_crypto", "gleam_erlang", "gleam_http", "gleam_httpc", "gleam_json", "gleam_otp", "gleam_regexp", "gleam_stdlib", "glint", "group_registry", "justin", "lustre", "mist", "polly", "simplifile", "tom", "wisp"], otp_app = "lustre_dev_tools", source = "hex", outer_checksum = "7A650A107C7E767D902A8CB608460B927DE0CDD47D5BA04DED71F9F622FE6AD9" },
+  { name = "marceau", version = "1.3.0", build_tools = ["gleam"], requirements = [], otp_app = "marceau", source = "hex", outer_checksum = "2D1C27504BEF45005F5DFB18591F8610FB4BFA91744878210BDC464412EC44E9" },
+  { name = "mist", version = "6.0.3", build_tools = ["gleam"], requirements = ["exception", "gleam_erlang", "gleam_http", "gleam_otp", "gleam_stdlib", "glisten", "gramps", "hpack_erl", "logging"], otp_app = "mist", source = "hex", outer_checksum = "1B07F321D5FA0CB162D81496F2DE96AEB6EF8980F4F38230A4CC3F849497E020" },
+  { name = "platform", version = "1.0.0", build_tools = ["gleam"], requirements = [], otp_app = "platform", source = "hex", outer_checksum = "8339420A95AD89AAC0F82F4C3DB8DD401041742D6C3F46132A8739F6AEB75391" },
+  { name = "plinth", version = "0.11.0", build_tools = ["gleam"], requirements = ["gleam_javascript", "gleam_json", "gleam_stdlib"], otp_app = "plinth", source = "hex", outer_checksum = "D30FDE8FC11EB76538AB498ACFF5399D0AE27993C74D63BE05AFE8CE80C4C839" },
+  { name = "polly", version = "3.1.0", build_tools = ["gleam"], requirements = ["filepath", "gleam_erlang", "gleam_otp", "gleam_stdlib", "simplifile"], otp_app = "polly", source = "hex", outer_checksum = "51FB565D81FF6212FDF3306D44419601F2A7C4EDD1F00FC9DA5C376A00AED4FE" },
+  { name = "rsvp", version = "2.0.0", build_tools = ["gleam"], requirements = ["gleam_erlang", "gleam_fetch", "gleam_http", "gleam_httpc", "gleam_javascript", "gleam_json", "gleam_stdlib", "lustre"], otp_app = "rsvp", source = "hex", outer_checksum = "A38F2DB9657E84A584278DB50FD903693FF370C22C191753B773546FEB2465F0" },
+  { name = "shared", version = "1.0.0", build_tools = ["gleam"], requirements = ["gleam_json", "gleam_stdlib"], source = "local", path = "../shared" },
+  { name = "simplifile", version = "2.7.0", build_tools = ["gleam"], requirements = ["filepath", "gleam_stdlib"], otp_app = "simplifile", source = "hex", outer_checksum = "A2727627B063E87351934C7F7F008F2D1FDB16F6DE0B8C79F9E46459CFC9C164" },
+  { name = "snag", version = "1.2.0", build_tools = ["gleam"], requirements = ["gleam_stdlib"], otp_app = "snag", source = "hex", outer_checksum = "274F41D6C3ECF99F7686FDCE54183333E41D2C1CA5A3A673F9A8B2C7A4401077" },
+  { name = "tom", version = "2.1.0", build_tools = ["gleam"], requirements = ["gleam_stdlib", "gleam_time"], otp_app = "tom", source = "hex", outer_checksum = "DCF04CB7AB35D58CFC598C66EA2E1816D160759802C89B2BA6238780D59BC256" },
+  { name = "wisp", version = "2.2.2", build_tools = ["gleam"], requirements = ["directories", "exception", "filepath", "gleam_crypto", "gleam_erlang", "gleam_http", "gleam_json", "gleam_stdlib", "houdini", "logging", "marceau", "mist", "simplifile"], otp_app = "wisp", source = "hex", outer_checksum = "5FF5F1E288C3437252ABB93D8F9CF42FF652CE7AD54480CFE736038DC09C4F22" },
+]
+
+[requirements]
+gleam_erlang = { version = ">= 1.3.0 and < 2.0.0" }
+gleam_http = { version = ">= 4.3.0 and < 5.0.0" }
+gleam_json = { version = ">= 3.1.0 and < 4.0.0" }
+gleam_stdlib = { version = ">= 1.0.0 and < 2.0.0" }
+gleeunit = { version = ">= 1.0.0 and < 2.0.0" }
+lustre = { version = ">= 5.7.1 and < 6.0.0" }
+lustre_dev_tools = { version = ">= 2.3.6 and < 3.0.0" }
+mist = { version = ">= 6.0.3 and < 7.0.0" }
+plinth = { version = ">= 0.11.0 and < 1.0.0" }
+rsvp = { version = ">= 2.0.0 and < 3.0.0" }
+shared = { path = "../shared" }
+simplifile = { version = ">= 2.7.0 and < 3.0.0" }
diff --git a/gleam/client/src/client.gleam b/gleam/client/src/client.gleam
new file mode 100644 (file)
index 0000000..415dd08
--- /dev/null
@@ -0,0 +1,463 @@
+import gleam/dict
+import gleam/dynamic/decode
+import gleam/int
+import gleam/json
+import gleam/list
+import gleam/option.{type Option, None, Some}
+import gleam/result
+import gleam/string
+import lustre
+import lustre/attribute.{class, id, styles}
+import lustre/effect.{type Effect}
+import lustre/element.{type Element}
+import lustre/element/html.{a, div, input, text}
+import lustre/event.{on_click}
+import plinth/browser/document
+import plinth/browser/element as pelement
+import plinth/browser/web_storage
+import plinth/javascript/date
+import shared.{type Candidate, type Puzzle, Candidate}
+
+pub fn main() {
+  let flags =
+    document.query_selector("#model")
+    |> result.map(pelement.inner_text)
+    |> result.unwrap("")
+    |> json.parse(shared.puzzle_decoder())
+    |> option.from_result
+
+  let app = lustre.application(init, update, view)
+  let assert Ok(_) = lustre.start(app, "#app", flags)
+
+  Nil
+}
+
+const page_bg = "#2b2b2b"
+
+const card_bg = "#555"
+
+const border_color = "rgba(255, 255, 255, 0.15)"
+
+fn card_styles() -> List(#(String, String)) {
+  [
+    #("width", "min(420px, 90vw)"),
+    #("box-sizing", "border-box"),
+    #("background-color", card_bg),
+    #("color", "#fff"),
+    #("padding", "24px"),
+    #("box-shadow", "0 10px 60px rgba(0, 0, 0, 0.4)"),
+  ]
+}
+
+fn prompt_styles() -> List(#(String, String)) {
+  [
+    #("width", "40%"),
+    #("box-sizing", "border-box"),
+    #("background-color", card_bg),
+    #("color", "#fff"),
+    #("padding", "24px"),
+    #("box-shadow", "0 10px 60px rgba(0, 0, 0, 0.4)"),
+  ]
+}
+
+// VIEW
+
+const default =
+  shared.Puzzle(
+    previous: "Sorry, no",
+    next: "today :(",
+    candidates: [Candidate(word: "puzzle", count: 1)],
+    order: 2,
+  )
+
+fn view(model: Model) -> Element(Message) {
+  let puzzle = case model.puzzle {
+    Some(puz) -> puz
+    None -> default
+  }
+
+  div(
+    [
+      styles([
+        #("min-height", "100vh"),
+        #("box-sizing", "border-box"),
+        #("display", "flex"),
+        #("flex-direction", "column"),
+        #("align-items", "center"),
+        #("gap", "24px"),
+        #("padding", "48px 20px"),
+        #("background-color", page_bg),
+        #("font-family", "system-ui, -apple-system, sans-serif"),
+      ]),
+    ],
+    [
+      div([styles(prompt_styles())], [clue_prompt(model, puzzle)]),
+      case model.already_played_popup_open {
+        True ->
+          case model.already_played {
+            Some(i) -> already_played_popup(i)
+            None -> element.none()
+          }
+        False -> element.none()
+      },
+      case model.popup_open {
+        True ->
+          case model.won {
+            True -> win_popup(model.score)
+            False -> lose_popup(model.score)
+          }
+        False -> element.none()
+      },
+    ],
+  )
+}
+
+fn get_date() -> Int {
+  let time = date.now() |> date.get_time()
+  time / ms_per_day
+}
+
+fn clue_prompt(model: Model, puzzle: Puzzle) -> Element(Message) {
+  div([styles([#("display", "flex"), #("flex-direction", "column")])], [
+    case model.game_over {
+      True -> past_clue(puzzle, list.first(model.guesses) |> result.unwrap(""))
+      False -> active_clue(puzzle, model)
+    },
+  ])
+}
+
+fn row_styles() -> List(#(String, String)) {
+  [
+    #("display", "flex"),
+    #("flex-wrap", "wrap"),
+    #("align-items", "center"),
+    #("justify-content", "center"),
+    #("gap", "6px"),
+    #("padding", "10px 0"),
+    #("border-bottom", "1px solid " <> border_color),
+    #("text-align", "center"),
+  ]
+}
+
+fn past_clue(puzzle: Puzzle, guess_word: String) -> Element(Message) {
+  div([styles(row_styles())], [
+    a([styles([#("opacity", "0.7")])], [text(puzzle.previous)]),
+    a([styles([#("font-weight", "bold")])], [text(guess_word)]),
+    a([styles([#("opacity", "0.7")])], [text(puzzle.next)]),
+  ])
+}
+
+fn active_clue(puzzle: Puzzle, model: Model) -> Element(Message) {
+  div([styles(row_styles())], [
+    a([styles([#("opacity", "0.7")])], [text(puzzle.previous)]),
+    input([
+      event.on_input(UpdateInput),
+      attribute.value(model.current_guess),
+      event.on_keydown(KeyDown),
+      id("active"),
+      attribute.autofocus(True),
+      styles([
+        #("background-color", "#333"),
+        #("color", "#fff"),
+        #("border", "1px solid " <> border_color),
+        #("padding", "6px 10px"),
+        #("font-size", "16px"),
+        #("text-align", "center"),
+        #("width", "140px"),
+        #("outline", "none"),
+      ]),
+    ]),
+    a([styles([#("opacity", "0.7")])], [
+      text(puzzle.next),
+    ]),
+  ])
+}
+
+fn popup_wrapper(content: List(Element(Message))) -> Element(Message) {
+  html.div(
+    [
+      class("popup"),
+      styles([
+        #("position", "fixed"),
+        #("inset", "0"),
+        #("display", "flex"),
+        #("align-items", "center"),
+        #("justify-content", "center"),
+        #("z-index", "1000"),
+        #("padding", "20px"),
+        #("box-sizing", "border-box"),
+      ]),
+    ],
+    [
+      html.div(
+        [
+          id("myPopup"),
+          class("popuptext"),
+          styles(
+            list.append(card_styles(), [
+              #("position", "relative"),
+              #("text-align", "center"),
+            ]),
+          ),
+        ],
+        content,
+      ),
+    ],
+  )
+}
+
+fn close_button(on message: Message) -> Element(Message) {
+  html.button(
+    [
+      class("popup-close"),
+      on_click(message),
+      styles([
+        #("position", "absolute"),
+        #("top", "8px"),
+        #("right", "10px"),
+        #("width", "32px"),
+        #("height", "32px"),
+        #("border", "none"),
+        #("background", "transparent"),
+        #("color", "#fff"),
+        #("font-size", "24px"),
+        #("line-height", "1"),
+        #("cursor", "pointer"),
+        #("padding", "0"),
+      ]),
+    ],
+    [html.text("×")],
+  )
+}
+
+fn popup_title(label: String) -> Element(Message) {
+  html.div(
+    [
+      styles([
+        #("font-size", "24px"),
+        #("font-weight", "bold"),
+        #("margin-bottom", "16px"),
+      ]),
+    ],
+    [html.text(label)],
+  )
+}
+
+fn popup_image() -> Element(Message) {
+  html.img([
+    attribute.src("/static/cat.png"),
+    styles([
+      #("display", "block"),
+      #("width", "100%"),
+      #("max-width", "300px"),
+      #("height", "auto"),
+      #("margin", "0 auto"),
+    ]),
+  ])
+}
+
+fn lose_popup(score: Int) -> Element(Message) {
+  popup_wrapper([
+    close_button(on: ClosePopup),
+    popup_title("Score: " <> int.to_string(score) <> "%"),
+    popup_image(),
+  ])
+}
+
+fn win_popup(score: Int) -> Element(Message) {
+  popup_wrapper([
+    close_button(on: ClosePopup),
+    popup_title("Score: " <> int.to_string(score) <> "%"),
+    popup_image(),
+  ])
+}
+
+fn already_played_popup(score: Int) -> Element(Message) {
+  popup_wrapper([
+    close_button(on: ClosePlayedPopup),
+    popup_title("U already played. Score: " <> int.to_string(score)),
+    popup_image(),
+  ])
+}
+
+// UPDATE
+
+fn update(model: Model, message: Message) -> #(Model, Effect(Message)) {
+  case message {
+    Nothing -> {
+      #(model, effect.none())
+    }
+    ClosePopup -> {
+      #(Model(..model, popup_open: False), effect.none())
+    }
+    ClosePlayedPopup -> {
+      #(Model(..model, already_played_popup_open: False), effect.none())
+    }
+    UpdateInput(input) -> {
+      #(Model(..model, current_guess: input), effect.none())
+    }
+    KeyDown(key) -> {
+      case key {
+        "Enter" -> #(
+          {
+            let puzzle = option.unwrap(model.puzzle, default)
+            let score = score_for_guess(puzzle.candidates, model.current_guess)
+            add_score_and_update(model.history, score)
+            Model(
+              ..model,
+              guesses: list.append(model.guesses, [model.current_guess]),
+              current_guess: "",
+              popup_open: True,
+              won: score > 0,
+              score: score,
+              game_over: True,
+            )
+          },
+          effect.none(),
+        )
+        _ -> #(model, effect.none())
+      }
+    }
+  }
+}
+
+fn init(puzzle: Option(Puzzle)) -> #(Model, Effect(b)) {
+  let history =
+    web_storage.local()
+    |> result.map(web_storage.get_item(_, "history"))
+    |> result.flatten
+    |> option.from_result
+    |> option.flatten
+    |> option.map(json.parse(_, history_decoder()))
+    |> option.map(option.from_result)
+    |> option.flatten
+    |> option.unwrap(History(dict.new(), username: Some("goober")))
+
+  let past = case dict.get(history.scores, get_date()) {
+    Ok(i) -> Some(i)
+    Error(_) -> None
+  }
+
+  echo puzzle
+
+  #(
+    Model(
+      puzzle:,
+      popup_open: False,
+      guesses: [],
+      current_guess: "",
+      won: False,
+      score: 0,
+      game_over: False,
+      history: history,
+      already_played: past,
+      already_played_popup_open: option.is_some(past),
+    ),
+    effect.none(),
+  )
+}
+
+pub type Message {
+  Nothing
+  ClosePopup
+  ClosePlayedPopup
+  UpdateInput(String)
+  KeyDown(String)
+}
+
+// MODEL
+type Model {
+  Model(
+    puzzle: Option(Puzzle),
+    popup_open: Bool,
+    won: Bool,
+    score: Int,
+    guesses: List(String),
+    current_guess: String,
+    game_over: Bool,
+    history: History,
+    already_played: Option(Int),
+    already_played_popup_open: Bool,
+  )
+}
+
+fn score_for_guess(candidates: List(Candidate), guess: String) -> Int {
+  let normalized_guess = guess |> string.trim |> string.lowercase
+  let max_score =
+    candidates
+    |> list.max(fn(a, b) { int.compare(a.count, b.count) })
+    |> result.map(fn(a) { a.count })
+    |> result.unwrap(0)
+
+  case find_candidate(candidates, normalized_guess), max_score {
+    Some(candidate), total if total > 0 -> {
+      let score = candidate.count * 100 / total
+      case score {
+        0 -> 1
+        score -> score
+      }
+    }
+    _, _ -> 0
+  }
+}
+
+fn find_candidate(
+  candidates: List(Candidate),
+  guess: String,
+) -> Option(Candidate) {
+  case candidates {
+    [] -> None
+    [candidate, ..rest] ->
+      case string.lowercase(candidate.word) == guess {
+        True -> Some(candidate)
+        False -> find_candidate(rest, guess)
+      }
+  }
+}
+
+// Start date is epoch, indexes by one each day, score of 7 is a loss, any pos int is how many guesses
+type History {
+  History(scores: dict.Dict(Int, Int), username: Option(String))
+}
+
+fn history_to_json(history: History) -> json.Json {
+  let History(scores:, username:) = history
+  json.object([
+    #("scores", json.dict(scores, int.to_string, json.int)),
+    #("username", case username {
+      None -> json.null()
+      Some(value) -> json.string(value)
+    }),
+  ])
+}
+
+fn history_decoder() -> decode.Decoder(History) {
+  use scores <- decode.field("scores", decode.dict(decode.string, decode.int))
+  let dates =
+    scores |> dict.keys |> list.map(int.parse) |> list.map(result.unwrap(_, 0))
+  let scores = dict.from_list(list.zip(dates, dict.values(scores)))
+  use username <- decode.field("username", decode.optional(decode.string))
+  decode.success(History(scores:, username:))
+}
+
+const ms_per_day: Int = 86_400_000
+
+fn add_score_and_update(history: History, score: Int) -> Nil {
+  let time = date.now() |> date.get_time()
+  let date_since_epoch = time / ms_per_day
+  let new_history =
+    History(
+      scores: dict.insert(history.scores, date_since_epoch, score),
+      username: history.username,
+    )
+
+  let _ =
+    web_storage.local()
+    |> result.map(web_storage.set_item(
+      _,
+      "history",
+      json.to_string(history_to_json(new_history)),
+    ))
+
+  Nil
+}
diff --git a/gleam/client/static/cat.png b/gleam/client/static/cat.png
new file mode 100644 (file)
index 0000000..6c4c3ab
Binary files /dev/null and b/gleam/client/static/cat.png differ
diff --git a/gleam/client/test/client_test.gleam b/gleam/client/test/client_test.gleam
new file mode 100644 (file)
index 0000000..fba3c88
--- /dev/null
@@ -0,0 +1,13 @@
+import gleeunit
+
+pub fn main() -> Nil {
+  gleeunit.main()
+}
+
+// gleeunit test functions end in `_test`
+pub fn hello_world_test() {
+  let name = "Joe"
+  let greeting = "Hello, " <> name <> "!"
+
+  assert greeting == "Hello, Joe!"
+}
diff --git a/gleam/css_to_lustre/.gitignore b/gleam/css_to_lustre/.gitignore
new file mode 100644 (file)
index 0000000..599be4e
--- /dev/null
@@ -0,0 +1,4 @@
+*.beam
+*.ez
+/build
+erl_crash.dump
diff --git a/gleam/css_to_lustre/README.md b/gleam/css_to_lustre/README.md
new file mode 100644 (file)
index 0000000..7db8101
--- /dev/null
@@ -0,0 +1,24 @@
+# css_to_lustre
+
+[![Package Version](https://img.shields.io/hexpm/v/css_to_lustre)](https://hex.pm/packages/css_to_lustre)
+[![Hex Docs](https://img.shields.io/badge/hex-docs-ffaff3)](https://css-to-lustre.hexdocs.pm/)
+
+```sh
+gleam add css_to_lustre@1
+```
+```gleam
+import css_to_lustre
+
+pub fn main() -> Nil {
+  // TODO: An example of the project in use
+}
+```
+
+Further documentation can be found at <https://css-to-lustre.hexdocs.pm/>.
+
+## Development
+
+```sh
+gleam run   # Run the project
+gleam test  # Run the tests
+```
diff --git a/gleam/css_to_lustre/gleam.toml b/gleam/css_to_lustre/gleam.toml
new file mode 100644 (file)
index 0000000..9d4a62f
--- /dev/null
@@ -0,0 +1,20 @@
+name = "css_to_lustre"
+version = "1.0.0"
+
+# Fill out these fields if you intend to generate HTML documentation or publish
+# your project to the Hex package manager.
+#
+# description = ""
+# licences = ["Apache-2.0"]
+# repository = { type = "github", user = "", repo = "" }
+# links = [{ title = "Website", href = "" }]
+#
+# For a full reference of all the available options, you can have a look at
+# https://gleam.run/writing-gleam/gleam-toml/.
+
+[dependencies]
+gleam_stdlib = ">= 1.0.0 and < 2.0.0"
+in = ">= 1.1.0 and < 2.0.0"
+
+[dev_dependencies]
+gleeunit = ">= 1.0.0 and < 2.0.0"
diff --git a/gleam/css_to_lustre/manifest.toml b/gleam/css_to_lustre/manifest.toml
new file mode 100644 (file)
index 0000000..a0b9502
--- /dev/null
@@ -0,0 +1,18 @@
+# Do not manually edit this file, it is managed by Gleam.
+#
+# This file locks the dependency versions used, to make your build
+# deterministic and to prevent unexpected versions from being included
+# in your application.
+#
+# You should check this file into your source control repository.
+
+packages = [
+  { name = "gleam_stdlib", version = "1.0.5", build_tools = ["gleam"], requirements = [], otp_app = "gleam_stdlib", source = "hex", outer_checksum = "CEE5B6C076A85B45F60C585F4316C63EC8B7127C119D5738C3958A9C4D50404E" },
+  { name = "gleeunit", version = "1.11.0", build_tools = ["gleam"], requirements = ["gleam_stdlib"], otp_app = "gleeunit", source = "hex", outer_checksum = "EC31ABA74256AEA531EDF8169931D775BBB384FED0A8A1BDC4DD9354E3E21826" },
+  { name = "in", version = "1.1.0", build_tools = ["gleam"], requirements = ["gleam_stdlib"], otp_app = "in", source = "hex", outer_checksum = "5339494529936AF83EAA0B8368195DCA9505382836CDED4CD6B0F5F9FA93C2B8" },
+]
+
+[requirements]
+gleam_stdlib = { version = ">= 1.0.0 and < 2.0.0" }
+gleeunit = { version = ">= 1.0.0 and < 2.0.0" }
+in = { version = ">= 1.1.0 and < 2.0.0" }
diff --git a/gleam/css_to_lustre/src/css_to_lustre.gleam b/gleam/css_to_lustre/src/css_to_lustre.gleam
new file mode 100644 (file)
index 0000000..6dccda7
--- /dev/null
@@ -0,0 +1,41 @@
+import gleam/list
+import gleam/option.{type Option, None, Some}
+import gleam/string
+import in
+
+pub fn main() -> Nil {
+  let lines = lines() |> list.map(string.drop_end(_, 1))
+  echo lines
+
+  let pairs = lines |> list.map(line_to_css_pair) |> option.values
+
+  let fmt = echo pairs |> list.map(lustre_format) |> string.concat
+
+  Nil
+}
+
+fn lustre_format(pair: #(String, String)) -> String {
+  "#(" <> pair.0 <> "," <> pair.1 <> "),"
+}
+
+fn line_to_css_pair(line: String) -> Option(#(String, String)) {
+  use #(key, value) <- option.map(
+    line |> string.trim |> string.split_once(":") |> option.from_result,
+  )
+
+  let key = string.trim(key)
+  let value = value |> string.trim |> string.remove_suffix(";")
+
+  #(key, value)
+}
+
+fn lines() -> List(String) {
+  read_lines([])
+}
+
+fn read_lines(acc: List(String)) -> List(String) {
+  case in.read_line() {
+    Ok(line) -> read_lines([line, ..acc])
+    Error(_) -> list.reverse(acc)
+  }
+}
diff --git a/gleam/css_to_lustre/test/css_to_lustre_test.gleam b/gleam/css_to_lustre/test/css_to_lustre_test.gleam
new file mode 100644 (file)
index 0000000..fba3c88
--- /dev/null
@@ -0,0 +1,13 @@
+import gleeunit
+
+pub fn main() -> Nil {
+  gleeunit.main()
+}
+
+// gleeunit test functions end in `_test`
+pub fn hello_world_test() {
+  let name = "Joe"
+  let greeting = "Hello, " <> name <> "!"
+
+  assert greeting == "Hello, Joe!"
+}
diff --git a/gleam/server/.gitignore b/gleam/server/.gitignore
new file mode 100644 (file)
index 0000000..599be4e
--- /dev/null
@@ -0,0 +1,4 @@
+*.beam
+*.ez
+/build
+erl_crash.dump
diff --git a/gleam/server/README.md b/gleam/server/README.md
new file mode 100644 (file)
index 0000000..87ebef7
--- /dev/null
@@ -0,0 +1,24 @@
+# server
+
+[![Package Version](https://img.shields.io/hexpm/v/server)](https://hex.pm/packages/server)
+[![Hex Docs](https://img.shields.io/badge/hex-docs-ffaff3)](https://server.hexdocs.pm/)
+
+```sh
+gleam add server@1
+```
+```gleam
+import server
+
+pub fn main() -> Nil {
+  // TODO: An example of the project in use
+}
+```
+
+Further documentation can be found at <https://server.hexdocs.pm/>.
+
+## Development
+
+```sh
+gleam run   # Run the project
+gleam test  # Run the tests
+```
diff --git a/gleam/server/gleam.toml b/gleam/server/gleam.toml
new file mode 100644 (file)
index 0000000..e6544eb
--- /dev/null
@@ -0,0 +1,30 @@
+name = "server"
+version = "1.0.0"
+
+# Fill out these fields if you intend to generate HTML documentation or publish
+# your project to the Hex package manager.
+#
+# description = ""
+# licences = ["Apache-2.0"]
+# repository = { type = "github", user = "", repo = "" }
+# links = [{ title = "Website", href = "" }]
+#
+# For a full reference of all the available options, you can have a look at
+# https://gleam.run/writing-gleam/gleam-toml/.
+
+[dependencies]
+gleam_stdlib = ">= 1.0.0 and < 2.0.0"
+gleam_erlang = ">= 1.3.0 and < 2.0.0"
+gleam_http = ">= 4.4.0 and < 5.0.0"
+lustre = ">= 5.7.1 and < 6.0.0"
+mist = ">= 6.0.3 and < 7.0.0"
+simplifile = ">= 2.7.0 and < 3.0.0"
+shared = { path = "../shared" }
+gleam_json = ">= 3.1.0 and < 4.0.0"
+birl = ">= 2.0.0 and < 3.0.0"
+wisp = ">= 2.2.2 and < 3.0.0"
+prng = ">= 6.0.0 and < 7.0.0"
+
+[dev_dependencies]
+gleeunit = ">= 1.0.0 and < 2.0.0"
+gsh = ">= 1.1.9 and < 2.0.0"
diff --git a/gleam/server/manifest.toml b/gleam/server/manifest.toml
new file mode 100644 (file)
index 0000000..b8ed8d7
--- /dev/null
@@ -0,0 +1,67 @@
+# Do not manually edit this file, it is managed by Gleam.
+#
+# This file locks the dependency versions used, to make your build
+# deterministic and to prevent unexpected versions from being included
+# in your application.
+#
+# You should check this file into your source control repository.
+
+packages = [
+  { name = "birl", version = "2.0.0", build_tools = ["gleam"], requirements = ["gleam_regexp", "gleam_stdlib", "gleam_time", "ranger"], otp_app = "birl", source = "hex", outer_checksum = "51F9D18050231ED8A324A5A87C07F2582E22C1CA8BBDEC213623A7B39AF060F1" },
+  { name = "contour", version = "1.2.1", build_tools = ["gleam"], requirements = ["gleam_community_ansi", "gleam_stdlib", "glexer", "houdini"], otp_app = "contour", source = "hex", outer_checksum = "C7895472BBAAC5D15DBDBAF6DD1847F6981F2F6132F726BAD30434A6E3BAAB95" },
+  { name = "directories", version = "1.2.0", build_tools = ["gleam"], requirements = ["envoy", "gleam_stdlib", "platform", "simplifile"], otp_app = "directories", source = "hex", outer_checksum = "D13090CFCDF6759B87217E8DDD73A75903A700148A82C1D33799F333E249BF9E" },
+  { name = "envoy", version = "1.2.0", build_tools = ["gleam"], requirements = ["gleam_stdlib"], otp_app = "envoy", source = "hex", outer_checksum = "9C6FBB6BFA02A52798BEEC5977A738CAD6E4A057F4B67FD0C8061AD2502C191A" },
+  { name = "etch", version = "1.4.0", build_tools = ["gleam"], requirements = ["gleam_stdlib"], otp_app = "etch", source = "hex", outer_checksum = "A4B4458EE1E7D22753538C03F0D64C930309863365D2D26570E2D2C6B7CFC5EA" },
+  { name = "etch_erlang", version = "1.1.0", build_tools = ["gleam"], requirements = ["etch", "gleam_erlang", "gleam_stdlib"], otp_app = "etch_erlang", source = "hex", outer_checksum = "CDD5BCBF680A97AF979EF1FD18F4E39E64DA2D7938422DEF938A69F26B38BF32" },
+  { name = "exception", version = "2.1.1", build_tools = ["gleam"], requirements = ["gleam_stdlib"], otp_app = "exception", source = "hex", outer_checksum = "6BDEA95248093599391C3B5DF1835C5C6A86C353C2F99CE539B450E3432FE117" },
+  { name = "filepath", version = "1.1.2", build_tools = ["gleam"], requirements = ["gleam_stdlib"], otp_app = "filepath", source = "hex", outer_checksum = "B06A9AF0BF10E51401D64B98E4B627F1D2E48C154967DA7AF4D0914780A6D40A" },
+  { name = "format", version = "1.0.0", build_tools = ["gleam"], requirements = ["gleam_stdlib"], otp_app = "format", source = "hex", outer_checksum = "7654EE35E01394BF558F364542F163941A66CBA1512AA7D53F2A794BBD90BD9D" },
+  { name = "glance", version = "7.0.0", build_tools = ["gleam"], requirements = ["gleam_stdlib", "glexer"], otp_app = "glance", source = "hex", outer_checksum = "EA52986965408D43003A1760E41457493EB96098DE193E6AD8646930EC190CB9" },
+  { name = "gleam_community_ansi", version = "1.5.0", build_tools = ["gleam"], requirements = ["gleam_community_colour", "gleam_regexp", "gleam_stdlib"], otp_app = "gleam_community_ansi", source = "hex", outer_checksum = "B5AA433AF84313E23FDF90CCFF752B9380FE9FFCE02B2949D49B7AACCC77B16D" },
+  { name = "gleam_community_colour", version = "2.0.4", build_tools = ["gleam"], requirements = ["gleam_json", "gleam_stdlib"], otp_app = "gleam_community_colour", source = "hex", outer_checksum = "6DB4665555D7D2B27F0EA32EF47E8BEBC4303821765F9C73D483F38EE24894F0" },
+  { name = "gleam_crypto", version = "1.6.0", build_tools = ["gleam"], requirements = ["gleam_stdlib"], otp_app = "gleam_crypto", source = "hex", outer_checksum = "2DE9E4EF53CF6FEE049D4F765731F7178F7A11AEFAE00EEE63BF7536B354AD3F" },
+  { name = "gleam_erlang", version = "1.3.0", build_tools = ["gleam"], requirements = ["gleam_stdlib"], otp_app = "gleam_erlang", source = "hex", outer_checksum = "1124AD3AA21143E5AF0FC5CF3D9529F6DB8CA03E43A55711B60B6B7B3874375C" },
+  { name = "gleam_http", version = "4.4.0", build_tools = ["gleam"], requirements = ["gleam_stdlib"], otp_app = "gleam_http", source = "hex", outer_checksum = "F065CE9941A7756ABBAEAE7F9F32A96CAD29DA3311A381DB2D926EA8E8C156DC" },
+  { name = "gleam_json", version = "3.1.0", build_tools = ["gleam"], requirements = ["gleam_stdlib"], otp_app = "gleam_json", source = "hex", outer_checksum = "44FDAA8847BE8FC48CA7A1C089706BD54BADCC4C45B237A992EDDF9F2CDB2836" },
+  { name = "gleam_otp", version = "1.3.0", build_tools = ["gleam"], requirements = ["gleam_erlang", "gleam_stdlib"], otp_app = "gleam_otp", source = "hex", outer_checksum = "DE4CA6850842F0266EE95317A25DD6A0A0F20CDFAB7C0ADC2E63251D7C3C72EC" },
+  { name = "gleam_regexp", version = "1.1.1", build_tools = ["gleam"], requirements = ["gleam_stdlib"], otp_app = "gleam_regexp", source = "hex", outer_checksum = "9C215C6CA84A5B35BB934A9B61A9A306EC743153BE2B0425A0D032E477B062A9" },
+  { name = "gleam_stdlib", version = "1.0.5", build_tools = ["gleam"], requirements = [], otp_app = "gleam_stdlib", source = "hex", outer_checksum = "CEE5B6C076A85B45F60C585F4316C63EC8B7127C119D5738C3958A9C4D50404E" },
+  { name = "gleam_time", version = "1.10.0", build_tools = ["gleam"], requirements = ["gleam_stdlib"], otp_app = "gleam_time", source = "hex", outer_checksum = "56539216E4C4B1748714652AB38F0BD16B9101F61DB62769FDC7CD42A8E5E833" },
+  { name = "gleam_yielder", version = "1.1.0", build_tools = ["gleam"], requirements = ["gleam_stdlib"], otp_app = "gleam_yielder", source = "hex", outer_checksum = "8E4E4ECFA7982859F430C57F549200C7749823C106759F4A19A78AEA6687717A" },
+  { name = "gleeunit", version = "1.11.0", build_tools = ["gleam"], requirements = ["gleam_stdlib"], otp_app = "gleeunit", source = "hex", outer_checksum = "EC31ABA74256AEA531EDF8169931D775BBB384FED0A8A1BDC4DD9354E3E21826" },
+  { name = "glexer", version = "2.5.0", build_tools = ["gleam"], requirements = ["gleam_stdlib", "splitter"], otp_app = "glexer", source = "hex", outer_checksum = "D423CF63B8D4F9654EF53D0AF4904B249EB0679BD41C63440170AC508C9CC65E" },
+  { name = "glisten", version = "9.0.1", build_tools = ["gleam"], requirements = ["gleam_erlang", "gleam_otp", "gleam_stdlib", "logging"], otp_app = "glisten", source = "hex", outer_checksum = "7795AA50830656F3A0316A6B26595F893C83272DA901B3405E31339CAA31A10B" },
+  { name = "gramps", version = "6.0.1", build_tools = ["gleam"], requirements = ["gleam_crypto", "gleam_erlang", "gleam_http", "gleam_stdlib"], otp_app = "gramps", source = "hex", outer_checksum = "D55636072DEE173F6586A5679D3C02EC7A0DE3F8646B78C351B72908FF223DF7" },
+  { name = "gsh", version = "1.1.9", build_tools = ["gleam"], requirements = ["contour", "etch", "etch_erlang", "format", "glance", "gleam_erlang", "gleam_json", "gleam_stdlib", "glexer", "in", "shellout", "simplifile", "tom"], otp_app = "gsh", source = "hex", outer_checksum = "8342B1CBA3430EA727D7D82D8AF11DAB85E79B446D8BE0B5A5A45E240F9C5AB1" },
+  { name = "houdini", version = "1.2.1", build_tools = ["gleam"], requirements = [], otp_app = "houdini", source = "hex", outer_checksum = "6F8AC2F12974567FB744BEA66AC93CEB76AAEA19AD28564623F76CDA9BC26A85" },
+  { name = "hpack_erl", version = "0.3.0", build_tools = ["rebar3"], requirements = [], otp_app = "hpack", source = "hex", outer_checksum = "D6137D7079169D8C485C6962DFE261AF5B9EF60FBC557344511C1E65E3D95FB0" },
+  { name = "in", version = "1.1.0", build_tools = ["gleam"], requirements = ["gleam_stdlib"], otp_app = "in", source = "hex", outer_checksum = "5339494529936AF83EAA0B8368195DCA9505382836CDED4CD6B0F5F9FA93C2B8" },
+  { name = "logging", version = "1.5.0", build_tools = ["gleam"], requirements = ["gleam_stdlib"], otp_app = "logging", source = "hex", outer_checksum = "BC5F18CE5DD9686100229FE5409BDC3DD5C46D5A7DF2F804AD2D8F0DD6C5060E" },
+  { name = "lustre", version = "5.7.1", build_tools = ["gleam"], requirements = ["exception", "gleam_erlang", "gleam_json", "gleam_otp", "gleam_stdlib", "houdini"], otp_app = "lustre", source = "hex", outer_checksum = "663A2D1A3458914CA537A42AC07E601DD3FD85415EBDAF4717F2DFF6E86F90F9" },
+  { name = "marceau", version = "1.3.0", build_tools = ["gleam"], requirements = [], otp_app = "marceau", source = "hex", outer_checksum = "2D1C27504BEF45005F5DFB18591F8610FB4BFA91744878210BDC464412EC44E9" },
+  { name = "mist", version = "6.0.3", build_tools = ["gleam"], requirements = ["exception", "gleam_erlang", "gleam_http", "gleam_otp", "gleam_stdlib", "glisten", "gramps", "hpack_erl", "logging"], otp_app = "mist", source = "hex", outer_checksum = "1B07F321D5FA0CB162D81496F2DE96AEB6EF8980F4F38230A4CC3F849497E020" },
+  { name = "platform", version = "1.0.0", build_tools = ["gleam"], requirements = [], otp_app = "platform", source = "hex", outer_checksum = "8339420A95AD89AAC0F82F4C3DB8DD401041742D6C3F46132A8739F6AEB75391" },
+  { name = "prng", version = "6.0.0", build_tools = ["gleam"], requirements = ["gleam_stdlib"], otp_app = "prng", source = "hex", outer_checksum = "7FE3879E13150248BD370469205ED07B9404DD90670FEBB8CD0E7643707C420E" },
+  { name = "ranger", version = "1.4.0", build_tools = ["gleam"], requirements = ["gleam_stdlib", "gleam_yielder"], otp_app = "ranger", source = "hex", outer_checksum = "C8988E8F8CDBD3E7F4D8F2E663EF76490390899C2B2885A6432E942495B3E854" },
+  { name = "shared", version = "1.0.0", build_tools = ["gleam"], requirements = ["gleam_json", "gleam_stdlib", "simplifile"], source = "local", path = "../shared" },
+  { name = "shellout", version = "1.8.0", build_tools = ["gleam"], requirements = ["gleam_stdlib"], otp_app = "shellout", source = "hex", outer_checksum = "C416356D45151F298108C9DB9CD1EDE0313F620B5EDBB5766CD7237659D87841" },
+  { name = "simplifile", version = "2.7.0", build_tools = ["gleam"], requirements = ["filepath", "gleam_stdlib"], otp_app = "simplifile", source = "hex", outer_checksum = "A2727627B063E87351934C7F7F008F2D1FDB16F6DE0B8C79F9E46459CFC9C164" },
+  { name = "splitter", version = "1.3.0", build_tools = ["gleam"], requirements = ["gleam_stdlib"], otp_app = "splitter", source = "hex", outer_checksum = "8F1485306E0D59168A39E12ED8844F9F616EC59C3C63AFCFDAE04DBD68690CBC" },
+  { name = "tom", version = "2.1.0", build_tools = ["gleam"], requirements = ["gleam_stdlib", "gleam_time"], otp_app = "tom", source = "hex", outer_checksum = "DCF04CB7AB35D58CFC598C66EA2E1816D160759802C89B2BA6238780D59BC256" },
+  { name = "wisp", version = "2.2.2", build_tools = ["gleam"], requirements = ["directories", "exception", "filepath", "gleam_crypto", "gleam_erlang", "gleam_http", "gleam_json", "gleam_stdlib", "houdini", "logging", "marceau", "mist", "simplifile"], otp_app = "wisp", source = "hex", outer_checksum = "5FF5F1E288C3437252ABB93D8F9CF42FF652CE7AD54480CFE736038DC09C4F22" },
+]
+
+[requirements]
+birl = { version = ">= 2.0.0 and < 3.0.0" }
+gleam_erlang = { version = ">= 1.3.0 and < 2.0.0" }
+gleam_http = { version = ">= 4.4.0 and < 5.0.0" }
+gleam_json = { version = ">= 3.1.0 and < 4.0.0" }
+gleam_stdlib = { version = ">= 1.0.0 and < 2.0.0" }
+gleeunit = { version = ">= 1.0.0 and < 2.0.0" }
+gsh = { version = ">= 1.1.9 and < 2.0.0" }
+lustre = { version = ">= 5.7.1 and < 6.0.0" }
+mist = { version = ">= 6.0.3 and < 7.0.0" }
+prng = { version = ">= 6.0.0 and < 7.0.0" }
+shared = { path = "../shared" }
+simplifile = { version = ">= 2.7.0 and < 3.0.0" }
+wisp = { version = ">= 2.2.2 and < 3.0.0" }
diff --git a/gleam/server/src/loader.gleam b/gleam/server/src/loader.gleam
new file mode 100644 (file)
index 0000000..8edaefb
--- /dev/null
@@ -0,0 +1,9 @@
+import gleam/dynamic/decode
+import gleam/json
+import gleam/result
+import shared
+import simplifile
+
+pub fn load(text: String) -> Result(List(shared.Puzzle), json.DecodeError) {
+  json.parse(text, decode.list(shared.puzzle_decoder()))
+}
diff --git a/gleam/server/src/server.gleam b/gleam/server/src/server.gleam
new file mode 100644 (file)
index 0000000..df95d17
--- /dev/null
@@ -0,0 +1,120 @@
+import birl
+import gleam/dict.{type Dict}
+import gleam/erlang/process
+import gleam/float
+import gleam/http
+import gleam/int
+import gleam/io
+import gleam/json
+import gleam/list
+import gleam/option.{type Option, None, Some}
+import loader
+import lustre/attribute
+import lustre/element
+import lustre/element/html
+import mist
+import prng/random
+import shared.{type Puzzle}
+import simplifile
+import wisp.{type Request, type Response}
+import wisp/wisp_mist
+
+pub fn main() -> Nil {
+  let file = "./data.json"
+
+  let assert Ok(text) = simplifile.read(file)
+
+  let assert Ok(puzzles) = loader.load(text)
+
+  let puzzles_dict =
+    puzzles
+    // |> shuffle_const_seed
+    |> list.shuffle
+    |> list.index_map(fn(puzzle, i) { #(i, puzzle) })
+    |> dict.from_list
+
+  wisp.configure_logger()
+
+  let secret_key_base = wisp.random_string(64)
+
+  let assert Ok(_) =
+    handle_request(puzzles_dict, _)
+    |> wisp_mist.handler(secret_key_base)
+    |> mist.new
+    |> mist.port(3000)
+    |> mist.start
+
+  process.sleep_forever()
+
+  Nil
+}
+
+fn shuffle_const_seed(list: List(a)) -> List(a) {
+  let #(a, _) = random.shuffle(list) |> random.step(random.new_seed(69_420))
+  a
+}
+
+//days, oct 12 2026
+// get by date +%s and convert to days
+const start_date: Int = 20_738
+
+fn handle_request(puzzles: Dict(Int, Puzzle), request: Request) -> Response {
+  use req <- app_middleware(request, "./static")
+  let date = birl.to_unix(birl.now()) / 86_400 - start_date
+
+  let puzzle = puzzles |> dict.get(date) |> option.from_result
+  echo puzzle
+
+  case req.method, wisp.path_segments(req) {
+    // Everything else gets our HTML with hydration data
+    http.Get, [] -> serve_index(puzzle)
+    http.Get, ["index.html"] -> serve_index(puzzle)
+
+    // Fallback for other methods/paths
+    _, _ -> wisp.not_found()
+  }
+}
+
+fn app_middleware(
+  req: Request,
+  static_directory: String,
+  next: fn(Request) -> Response,
+) -> Response {
+  let req = wisp.method_override(req)
+  use <- wisp.log_request(req)
+  use <- wisp.rescue_crashes
+  use req <- wisp.handle_head(req)
+  use <- wisp.serve_static(req, under: "/static", from: static_directory)
+  use <- wisp.serve_static(
+    req,
+    under: "/favicon.ico",
+    from: static_directory <> "/favicon.ico",
+  )
+
+  next(req)
+}
+
+fn serve_index(puzzle: Option(Puzzle)) -> Response {
+  let html =
+    html.html([], [
+      html.head([], [
+        html.title([], "tawg"),
+        html.script(
+          [attribute.type_("module"), attribute.src("/static/client.js")],
+          "",
+        ),
+      ]),
+      html.script(
+        [attribute.type_("application/json"), attribute.id("model")],
+        case puzzle {
+          Some(pooz) -> json.to_string(shared.puzzle_to_json(pooz))
+          None -> ""
+        },
+      ),
+      html.body([], [html.div([attribute.id("app")], [])]),
+    ])
+
+  html
+  |> element.to_document_string
+  |> wisp.html_response(200)
+}
diff --git a/gleam/server/static/cat.png b/gleam/server/static/cat.png
new file mode 100644 (file)
index 0000000..6c4c3ab
Binary files /dev/null and b/gleam/server/static/cat.png differ
diff --git a/gleam/server/static/client.js b/gleam/server/static/client.js
new file mode 100644 (file)
index 0000000..cec124b
--- /dev/null
@@ -0,0 +1,6466 @@
+// build/dev/javascript/prelude.mjs
+class CustomType {
+  withFields(fields) {
+    let properties = Object.keys(this).map((label) => (label in fields) ? fields[label] : this[label]);
+    return new this.constructor(...properties);
+  }
+}
+
+class List {
+  static fromArray(array, tail) {
+    return toList(array, tail);
+  }
+  [Symbol.iterator]() {
+    return new ListIterator(this);
+  }
+  toArray() {
+    return [...this];
+  }
+  atLeastLength(desired) {
+    let current = this;
+    while (desired-- > 0 && current)
+      current = current.tail;
+    return current !== undefined;
+  }
+  hasLength(desired) {
+    let current = this;
+    while (desired-- > 0 && current)
+      current = current.tail;
+    return desired === -1 && current instanceof Empty;
+  }
+  countLength() {
+    let current = this;
+    let length = 0;
+    while (current) {
+      current = current.tail;
+      length++;
+    }
+    return length - 1;
+  }
+}
+function prepend(element, tail) {
+  return new NonEmpty(element, tail);
+}
+function toList(elements, tail) {
+  let t = tail || List$Empty$const;
+  for (let i = elements.length - 1;i >= 0; --i) {
+    t = new NonEmpty(elements[i], t);
+  }
+  return t;
+}
+
+class ListIterator {
+  #current;
+  constructor(current) {
+    this.#current = current;
+  }
+  next() {
+    if (this.#current instanceof Empty) {
+      return { done: true };
+    } else {
+      let { head, tail } = this.#current;
+      this.#current = tail;
+      return { value: head, done: false };
+    }
+  }
+}
+
+class Empty extends List {
+}
+var List$Empty$const = new Empty;
+var List$Empty = () => List$Empty$const;
+var List$isEmpty = (value) => value instanceof Empty;
+
+class NonEmpty extends List {
+  constructor(head, tail) {
+    super();
+    this.head = head;
+    this.tail = tail;
+  }
+}
+var List$NonEmpty = (head, tail) => new NonEmpty(head, tail);
+var List$isNonEmpty = (value) => value instanceof NonEmpty;
+var List$NonEmpty$first = (value) => value.head;
+var List$NonEmpty$rest = (value) => value.tail;
+
+class BitArray {
+  bitSize;
+  byteSize;
+  bitOffset;
+  rawBuffer;
+  constructor(buffer, bitSize, bitOffset) {
+    if (!(buffer instanceof Uint8Array)) {
+      throw globalThis.Error("BitArray can only be constructed from a Uint8Array");
+    }
+    this.bitSize = bitSize ?? buffer.length * 8;
+    this.byteSize = Math.trunc((this.bitSize + 7) / 8);
+    this.bitOffset = bitOffset ?? 0;
+    if (this.bitSize < 0) {
+      throw globalThis.Error(`BitArray bit size is invalid: ${this.bitSize}`);
+    }
+    if (this.bitOffset < 0 || this.bitOffset > 7) {
+      throw globalThis.Error(`BitArray bit offset is invalid: ${this.bitOffset}`);
+    }
+    if (buffer.length !== Math.trunc((this.bitOffset + this.bitSize + 7) / 8)) {
+      throw globalThis.Error("BitArray buffer length is invalid");
+    }
+    this.rawBuffer = buffer;
+  }
+  byteAt(index) {
+    if (index < 0 || index >= this.byteSize) {
+      return;
+    }
+    return bitArrayByteAt(this.rawBuffer, this.bitOffset, index);
+  }
+  equals(other) {
+    if (this.bitSize !== other.bitSize) {
+      return false;
+    }
+    const wholeByteCount = Math.trunc(this.bitSize / 8);
+    if (this.bitOffset === 0 && other.bitOffset === 0) {
+      for (let i = 0;i < wholeByteCount; i++) {
+        if (this.rawBuffer[i] !== other.rawBuffer[i]) {
+          return false;
+        }
+      }
+      const trailingBitsCount = this.bitSize % 8;
+      if (trailingBitsCount) {
+        const unusedLowBitCount = 8 - trailingBitsCount;
+        if (this.rawBuffer[wholeByteCount] >> unusedLowBitCount !== other.rawBuffer[wholeByteCount] >> unusedLowBitCount) {
+          return false;
+        }
+      }
+    } else {
+      for (let i = 0;i < wholeByteCount; i++) {
+        const a = bitArrayByteAt(this.rawBuffer, this.bitOffset, i);
+        const b = bitArrayByteAt(other.rawBuffer, other.bitOffset, i);
+        if (a !== b) {
+          return false;
+        }
+      }
+      const trailingBitsCount = this.bitSize % 8;
+      if (trailingBitsCount) {
+        const a = bitArrayByteAt(this.rawBuffer, this.bitOffset, wholeByteCount);
+        const b = bitArrayByteAt(other.rawBuffer, other.bitOffset, wholeByteCount);
+        const unusedLowBitCount = 8 - trailingBitsCount;
+        if (a >> unusedLowBitCount !== b >> unusedLowBitCount) {
+          return false;
+        }
+      }
+    }
+    return true;
+  }
+  get buffer() {
+    if (this.bitOffset !== 0 || this.bitSize % 8 !== 0) {
+      throw new globalThis.Error("BitArray.buffer does not support unaligned bit arrays");
+    }
+    return this.rawBuffer;
+  }
+  get length() {
+    if (this.bitOffset !== 0 || this.bitSize % 8 !== 0) {
+      throw new globalThis.Error("BitArray.length does not support unaligned bit arrays");
+    }
+    return this.rawBuffer.length;
+  }
+}
+function bitArrayByteAt(buffer, bitOffset, index) {
+  if (bitOffset === 0) {
+    return buffer[index] ?? 0;
+  } else {
+    const a = buffer[index] << bitOffset & 255;
+    const b = buffer[index + 1] >> 8 - bitOffset;
+    return a | b;
+  }
+}
+
+class UtfCodepoint {
+  constructor(value) {
+    this.value = value;
+  }
+}
+class Result extends CustomType {
+  static isResult(data) {
+    return data instanceof Result;
+  }
+}
+
+class Ok extends Result {
+  constructor(value) {
+    super();
+    this[0] = value;
+  }
+  isOk() {
+    return true;
+  }
+}
+var Result$Ok = (value) => new Ok(value);
+var Result$isOk = (value) => value instanceof Ok;
+var Result$Ok$0 = (value) => value[0];
+
+class Error2 extends Result {
+  constructor(detail) {
+    super();
+    this[0] = detail;
+  }
+  isOk() {
+    return false;
+  }
+}
+var Result$Error = (detail) => new Error2(detail);
+var Result$isError = (value) => value instanceof Error2;
+function isEqual(x, y) {
+  let values = [x, y];
+  while (values.length) {
+    let a = values.pop();
+    let b = values.pop();
+    if (a === b)
+      continue;
+    if (!isObject(a) || !isObject(b))
+      return false;
+    let unequal = !structurallyCompatibleObjects(a, b) || unequalDates(a, b) || unequalBuffers(a, b) || unequalArrays(a, b) || unequalMaps(a, b) || unequalSets(a, b) || unequalRegExps(a, b);
+    if (unequal)
+      return false;
+    const proto = Object.getPrototypeOf(a);
+    if (proto !== null && typeof proto.equals === "function") {
+      try {
+        if (a.equals(b))
+          continue;
+        else
+          return false;
+      } catch {}
+    }
+    let [keys, get] = getters(a);
+    const ka = keys(a);
+    const kb = keys(b);
+    if (ka.length !== kb.length)
+      return false;
+    for (let k of ka) {
+      values.push(get(a, k), get(b, k));
+    }
+  }
+  return true;
+}
+function getters(object) {
+  if (object instanceof Map) {
+    return [(x) => x.keys(), (x, y) => x.get(y)];
+  } else {
+    let extra = object instanceof globalThis.Error ? ["message"] : [];
+    return [(x) => [...extra, ...Object.keys(x)], (x, y) => x[y]];
+  }
+}
+function unequalDates(a, b) {
+  return a instanceof Date && (a > b || a < b);
+}
+function unequalBuffers(a, b) {
+  return !(a instanceof BitArray) && a.buffer instanceof ArrayBuffer && a.BYTES_PER_ELEMENT && !(a.byteLength === b.byteLength && a.every((n, i) => n === b[i]));
+}
+function unequalArrays(a, b) {
+  return Array.isArray(a) && a.length !== b.length;
+}
+function unequalMaps(a, b) {
+  return a instanceof Map && a.size !== b.size;
+}
+function unequalSets(a, b) {
+  return a instanceof Set && (a.size != b.size || [...a].some((e) => !b.has(e)));
+}
+function unequalRegExps(a, b) {
+  return a instanceof RegExp && (a.source !== b.source || a.flags !== b.flags);
+}
+function isObject(a) {
+  return typeof a === "object" && a !== null;
+}
+function structurallyCompatibleObjects(a, b) {
+  if (typeof a !== "object" && typeof b !== "object" && (!a || !b))
+    return false;
+  let nonstructural = [Promise, WeakSet, WeakMap, Function];
+  if (nonstructural.some((c) => a instanceof c))
+    return false;
+  return a.constructor === b.constructor;
+}
+function divideInt(a, b) {
+  return Math.trunc(divideFloat(a, b));
+}
+function divideFloat(a, b) {
+  if (b === 0) {
+    return 0;
+  } else {
+    return a / b;
+  }
+}
+function makeError(variant, file, module, line, fn, message, extra) {
+  let error = new globalThis.Error(message);
+  error.gleam_error = variant;
+  error.file = file;
+  error.module = module;
+  error.line = line;
+  error.function = fn;
+  error.fn = fn;
+  for (let k in extra)
+    error[k] = extra[k];
+  return error;
+}
+// build/dev/javascript/gleam_stdlib/gleam/order.mjs
+class Lt extends CustomType {
+}
+var Order$Lt$const = new Lt;
+var Order$Lt = () => Order$Lt$const;
+class Eq extends CustomType {
+}
+var Order$Eq$const = new Eq;
+var Order$Eq = () => Order$Eq$const;
+class Gt extends CustomType {
+}
+var Order$Gt$const = new Gt;
+var Order$Gt = () => Order$Gt$const;
+
+// build/dev/javascript/gleam_stdlib/gleam/option.mjs
+class Some extends CustomType {
+  constructor($0) {
+    super();
+    this[0] = $0;
+  }
+}
+var Option$Some = ($0) => new Some($0);
+var Option$isSome = (value) => value instanceof Some;
+var Option$Some$0 = (value) => value[0];
+
+class None extends CustomType {
+}
+var Option$None$const = new None;
+var Option$None = () => Option$None$const;
+function is_some(option) {
+  return !(option instanceof None);
+}
+function from_result(result) {
+  if (result instanceof Ok) {
+    let a = result[0];
+    return new Some(a);
+  } else {
+    return Option$None$const;
+  }
+}
+function unwrap(option, default$) {
+  if (option instanceof Some) {
+    let x = option[0];
+    return x;
+  } else {
+    return default$;
+  }
+}
+function map(option, fun) {
+  if (option instanceof Some) {
+    let x = option[0];
+    return new Some(fun(x));
+  } else {
+    return option;
+  }
+}
+function flatten(option) {
+  if (option instanceof Some) {
+    let x = option[0];
+    return x;
+  } else {
+    return option;
+  }
+}
+
+// build/dev/javascript/gleam_stdlib/dict.mjs
+var referenceMap = /* @__PURE__ */ new WeakMap;
+var tempDataView = /* @__PURE__ */ new DataView(/* @__PURE__ */ new ArrayBuffer(8));
+var referenceUID = 0;
+function hashByReference(o) {
+  const known = referenceMap.get(o);
+  if (known !== undefined) {
+    return known;
+  }
+  const hash = referenceUID++;
+  if (referenceUID === 2147483647) {
+    referenceUID = 0;
+  }
+  referenceMap.set(o, hash);
+  return hash;
+}
+function hashMerge(a, b) {
+  return a ^ b + 2654435769 + (a << 6) + (a >> 2) | 0;
+}
+function hashString(s) {
+  let hash = 0;
+  const len = s.length;
+  for (let i = 0;i < len; i++) {
+    hash = Math.imul(31, hash) + s.charCodeAt(i) | 0;
+  }
+  return hash;
+}
+function hashNumber(n) {
+  tempDataView.setFloat64(0, n);
+  const i = tempDataView.getInt32(0);
+  const j = tempDataView.getInt32(4);
+  return Math.imul(73244475, i >> 16 ^ i) ^ j;
+}
+function hashBigInt(n) {
+  return hashString(n.toString());
+}
+function hashObject(o) {
+  const proto = Object.getPrototypeOf(o);
+  if (proto !== null && typeof proto.hashCode === "function") {
+    try {
+      const code = o.hashCode(o);
+      if (typeof code === "number") {
+        return code;
+      }
+    } catch {}
+  }
+  if (o instanceof Promise || o instanceof WeakSet || o instanceof WeakMap) {
+    return hashByReference(o);
+  }
+  if (o instanceof Date) {
+    return hashNumber(o.getTime());
+  }
+  let h = 0;
+  if (o instanceof ArrayBuffer) {
+    o = new Uint8Array(o);
+  }
+  if (Array.isArray(o) || o instanceof Uint8Array) {
+    for (let i = 0;i < o.length; i++) {
+      h = Math.imul(31, h) + getHash(o[i]) | 0;
+    }
+  } else if (o instanceof Set) {
+    o.forEach((v) => {
+      h = h + getHash(v) | 0;
+    });
+  } else if (o instanceof Map) {
+    o.forEach((v, k) => {
+      h = h + hashMerge(getHash(v), getHash(k)) | 0;
+    });
+  } else {
+    const keys = Object.keys(o);
+    for (let i = 0;i < keys.length; i++) {
+      const k = keys[i];
+      const v = o[k];
+      h = h + hashMerge(getHash(v), hashString(k)) | 0;
+    }
+  }
+  return h;
+}
+function getHash(u) {
+  if (u === null)
+    return 1108378658;
+  if (u === undefined)
+    return 1108378659;
+  if (u === true)
+    return 1108378657;
+  if (u === false)
+    return 1108378656;
+  switch (typeof u) {
+    case "number":
+      return hashNumber(u);
+    case "string":
+      return hashString(u);
+    case "bigint":
+      return hashBigInt(u);
+    case "object":
+      return hashObject(u);
+    case "symbol":
+      return hashByReference(u);
+    case "function":
+      return hashByReference(u);
+    default:
+      return 0;
+  }
+}
+
+class Dict {
+  constructor(size, root) {
+    this.size = size;
+    this.root = root;
+  }
+}
+var bits = 5;
+var mask = (1 << bits) - 1;
+var noElementMarker = Symbol();
+
+class Node {
+  constructor(generation, datamap, nodemap, data) {
+    this.datamap = datamap;
+    this.nodemap = nodemap;
+    this.data = data;
+    this.generation = generation;
+  }
+  equals(other) {
+    if (this === other)
+      return true;
+    if (!(other instanceof Node))
+      return false;
+    if (this.datamap !== other.datamap || this.nodemap !== other.nodemap) {
+      return false;
+    }
+    const leftData = this.data;
+    const rightData = other.data;
+    if (leftData.length !== rightData.length)
+      return false;
+    if (this.datamap === 0 && this.nodemap === 0) {
+      return this.#equalsOverflowEntries(rightData);
+    }
+    const edgesStart = leftData.length - popcount(this.nodemap);
+    for (let i = 0;i < edgesStart; i += 2) {
+      if (!isEqual(leftData[i], rightData[i]) || !isEqual(leftData[i + 1], rightData[i + 1])) {
+        return false;
+      }
+    }
+    for (let i = edgesStart;i < leftData.length; ++i) {
+      if (!leftData[i].equals(rightData[i]))
+        return false;
+    }
+    return true;
+  }
+  #equalsOverflowEntries(otherData) {
+    const data = this.data;
+    entries:
+      for (let i = 0;i < data.length; i += 2) {
+        for (let j = 0;j < otherData.length; j += 2) {
+          if (isEqual(data[i], otherData[j])) {
+            if (!isEqual(data[i + 1], otherData[j + 1]))
+              return false;
+            continue entries;
+          }
+        }
+        return false;
+      }
+    return true;
+  }
+  hashCode() {
+    const data = this.data;
+    const edgesStart = data.length - popcount(this.nodemap);
+    let hash = 0;
+    for (let i = 0;i < edgesStart; i += 2) {
+      hash = hash + hashMerge(getHash(data[i + 1]), getHash(data[i])) | 0;
+    }
+    for (let i = edgesStart;i < data.length; ++i) {
+      hash = hash + data[i].hashCode() | 0;
+    }
+    return hash;
+  }
+}
+var emptyNode = /* @__PURE__ */ newNode(0);
+var emptyDict = /* @__PURE__ */ new Dict(0, emptyNode);
+var errorNil = /* @__PURE__ */ Result$Error(undefined);
+function newNode(generation) {
+  return new Node(generation, 0, 0, []);
+}
+function copyNode(node, generation) {
+  if (node.generation === generation) {
+    return node;
+  }
+  const newData = node.data.slice(0);
+  return new Node(generation, node.datamap, node.nodemap, newData);
+}
+function copyAndSet(node, generation, idx, val) {
+  if (node.data[idx] === val) {
+    return node;
+  }
+  node = copyNode(node, generation);
+  node.data[idx] = val;
+  return node;
+}
+function copyAndInsertPair(node, generation, bit, idx, key, val) {
+  const data = node.data;
+  const length = data.length;
+  const newData = new Array(length + 2);
+  let readIndex = 0;
+  let writeIndex = 0;
+  while (readIndex < idx)
+    newData[writeIndex++] = data[readIndex++];
+  newData[writeIndex++] = key;
+  newData[writeIndex++] = val;
+  while (readIndex < length)
+    newData[writeIndex++] = data[readIndex++];
+  return new Node(generation, node.datamap | bit, node.nodemap, newData);
+}
+function copyAndRemovePair(node, generation, bit, idx) {
+  node = copyNode(node, generation);
+  const data = node.data;
+  const length = data.length;
+  for (let w = idx, r = idx + 2;r < length; ++r, ++w) {
+    data[w] = data[r];
+  }
+  data.pop();
+  data.pop();
+  node.datamap ^= bit;
+  return node;
+}
+function make() {
+  return emptyDict;
+}
+function from(iterable) {
+  let transient = toTransient(emptyDict);
+  for (const [key, value] of iterable) {
+    transient = destructiveTransientInsert(key, value, transient);
+  }
+  return fromTransient(transient);
+}
+function get(dict, key) {
+  const result = lookup(dict.root, key, getHash(key));
+  return result !== noElementMarker ? Result$Ok(result) : errorNil;
+}
+function lookup(node, key, hash) {
+  for (let shift = 0;shift < 32; shift += bits) {
+    const data = node.data;
+    const bit = hashbit(hash, shift);
+    if (node.nodemap & bit) {
+      node = data[data.length - 1 - index(node.nodemap, bit)];
+    } else if (node.datamap & bit) {
+      const dataidx = Math.imul(index(node.datamap, bit), 2);
+      return isEqual(key, data[dataidx]) ? data[dataidx + 1] : noElementMarker;
+    } else {
+      return noElementMarker;
+    }
+  }
+  const overflow = node.data;
+  for (let i = 0;i < overflow.length; i += 2) {
+    if (isEqual(key, overflow[i])) {
+      return overflow[i + 1];
+    }
+  }
+  return noElementMarker;
+}
+function toTransient(dict) {
+  return {
+    generation: nextGeneration(dict),
+    root: dict.root,
+    size: dict.size,
+    dict
+  };
+}
+function fromTransient(transient) {
+  if (transient.root === transient.dict.root) {
+    return transient.dict;
+  }
+  return new Dict(transient.size, transient.root);
+}
+function nextGeneration(dict) {
+  const root = dict.root;
+  if (root.generation < Number.MAX_SAFE_INTEGER) {
+    return root.generation + 1;
+  }
+  const queue = [root];
+  while (queue.length) {
+    const node = queue.pop();
+    node.generation = 0;
+    const nodeStart = node.data.length - popcount(node.nodemap);
+    for (let i = nodeStart;i < node.data.length; ++i) {
+      queue.push(node.data[i]);
+    }
+  }
+  return 1;
+}
+var globalTransient = /* @__PURE__ */ toTransient(emptyDict);
+function insert(dict, key, value) {
+  globalTransient.generation = nextGeneration(dict);
+  globalTransient.size = dict.size;
+  const hash = getHash(key);
+  const root = insertIntoNode(globalTransient, dict.root, key, value, hash, 0);
+  if (root === dict.root) {
+    return dict;
+  }
+  return new Dict(globalTransient.size, root);
+}
+function destructiveTransientInsert(key, value, transient) {
+  const hash = getHash(key);
+  transient.root = insertIntoNode(transient, transient.root, key, value, hash, 0);
+  return transient;
+}
+function insertIntoNode(transient, node, key, value, hash, shift) {
+  const data = node.data;
+  const generation = transient.generation;
+  if (shift > 32) {
+    for (let i = 0;i < data.length; i += 2) {
+      if (isEqual(key, data[i])) {
+        return copyAndSet(node, generation, i + 1, value);
+      }
+    }
+    transient.size += 1;
+    return copyAndInsertPair(node, generation, 0, data.length, key, value);
+  }
+  const bit = hashbit(hash, shift);
+  if (node.nodemap & bit) {
+    const nodeidx2 = data.length - 1 - index(node.nodemap, bit);
+    let child2 = data[nodeidx2];
+    child2 = insertIntoNode(transient, child2, key, value, hash, shift + bits);
+    return copyAndSet(node, generation, nodeidx2, child2);
+  }
+  const dataidx = Math.imul(index(node.datamap, bit), 2);
+  if ((node.datamap & bit) === 0) {
+    transient.size += 1;
+    return copyAndInsertPair(node, generation, bit, dataidx, key, value);
+  }
+  if (isEqual(key, data[dataidx])) {
+    return copyAndSet(node, generation, dataidx + 1, value);
+  }
+  const childShift = shift + bits;
+  let child = emptyNode;
+  child = insertIntoNode(transient, child, key, value, hash, childShift);
+  const key2 = data[dataidx];
+  const value2 = data[dataidx + 1];
+  const hash2 = getHash(key2);
+  child = insertIntoNode(transient, child, key2, value2, hash2, childShift);
+  transient.size -= 1;
+  const length = data.length;
+  const nodeidx = length - 1 - index(node.nodemap, bit);
+  const newData = new Array(length - 1);
+  let readIndex = 0;
+  let writeIndex = 0;
+  while (readIndex < dataidx)
+    newData[writeIndex++] = data[readIndex++];
+  readIndex += 2;
+  while (readIndex <= nodeidx)
+    newData[writeIndex++] = data[readIndex++];
+  newData[writeIndex++] = child;
+  while (readIndex < length)
+    newData[writeIndex++] = data[readIndex++];
+  return new Node(generation, node.datamap ^ bit, node.nodemap | bit, newData);
+}
+function destructiveTransientDelete(key, transient) {
+  const hash = getHash(key);
+  transient.root = deleteFromNode(transient, transient.root, key, hash, 0);
+  return transient;
+}
+function deleteFromNode(transient, node, key, hash, shift) {
+  const data = node.data;
+  const generation = transient.generation;
+  if (shift > 32) {
+    for (let i = 0;i < data.length; i += 2) {
+      if (isEqual(key, data[i])) {
+        transient.size -= 1;
+        return copyAndRemovePair(node, generation, 0, i);
+      }
+    }
+    return node;
+  }
+  const bit = hashbit(hash, shift);
+  const dataidx = Math.imul(index(node.datamap, bit), 2);
+  if ((node.nodemap & bit) !== 0) {
+    const nodeidx = data.length - 1 - index(node.nodemap, bit);
+    let child = data[nodeidx];
+    child = deleteFromNode(transient, child, key, hash, shift + bits);
+    if (child.nodemap !== 0 || child.data.length > 2) {
+      return copyAndSet(node, generation, nodeidx, child);
+    }
+    const length = data.length;
+    const newData = new Array(length + 1);
+    let readIndex = 0;
+    let writeIndex = 0;
+    while (readIndex < dataidx)
+      newData[writeIndex++] = data[readIndex++];
+    newData[writeIndex++] = child.data[0];
+    newData[writeIndex++] = child.data[1];
+    while (readIndex < nodeidx)
+      newData[writeIndex++] = data[readIndex++];
+    readIndex++;
+    while (readIndex < length)
+      newData[writeIndex++] = data[readIndex++];
+    return new Node(generation, node.datamap | bit, node.nodemap ^ bit, newData);
+  }
+  if ((node.datamap & bit) === 0 || !isEqual(key, data[dataidx])) {
+    return node;
+  }
+  transient.size -= 1;
+  return copyAndRemovePair(node, generation, bit, dataidx);
+}
+function fold(dict, state, fun) {
+  const queue = [dict.root];
+  while (queue.length) {
+    const node = queue.pop();
+    const data = node.data;
+    const edgesStart = data.length - popcount(node.nodemap);
+    for (let i = 0;i < edgesStart; i += 2) {
+      state = fun(state, data[i], data[i + 1]);
+    }
+    for (let i = edgesStart;i < data.length; ++i) {
+      queue.push(data[i]);
+    }
+  }
+  return state;
+}
+function popcount(n) {
+  n -= n >>> 1 & 1431655765;
+  n = (n & 858993459) + (n >>> 2 & 858993459);
+  return Math.imul(n + (n >>> 4) & 252645135, 16843009) >>> 24;
+}
+function index(bitmap, bit) {
+  return popcount(bitmap & bit - 1);
+}
+function hashbit(hash, shift) {
+  return 1 << (hash >>> shift & mask);
+}
+
+// build/dev/javascript/gleam_stdlib/gleam/dict.mjs
+function from_list_loop(loop$transient, loop$list) {
+  while (true) {
+    let transient = loop$transient;
+    let list = loop$list;
+    if (list instanceof Empty) {
+      return fromTransient(transient);
+    } else {
+      let rest = list.tail;
+      let key = list.head[0];
+      let value = list.head[1];
+      loop$transient = destructiveTransientInsert(key, value, transient);
+      loop$list = rest;
+    }
+  }
+}
+function from_list(list) {
+  return from_list_loop(toTransient(make()), list);
+}
+function keys(dict) {
+  return fold(dict, List$Empty$const, (acc, key, _) => {
+    return prepend(key, acc);
+  });
+}
+function values(dict) {
+  return fold(dict, List$Empty$const, (acc, _, value) => {
+    return prepend(value, acc);
+  });
+}
+function delete$(dict, key) {
+  let _pipe = toTransient(dict);
+  let _pipe$1 = ((_capture) => {
+    return destructiveTransientDelete(key, _capture);
+  })(_pipe);
+  return fromTransient(_pipe$1);
+}
+
+// build/dev/javascript/gleam_stdlib/gleam/list.mjs
+class Ascending extends CustomType {
+}
+var Sorting$Ascending$const = new Ascending;
+
+class Descending extends CustomType {
+}
+var Sorting$Descending$const = new Descending;
+function reverse_and_prepend(loop$prefix, loop$suffix) {
+  while (true) {
+    let prefix = loop$prefix;
+    let suffix = loop$suffix;
+    if (prefix instanceof Empty) {
+      return suffix;
+    } else {
+      let first$1 = prefix.head;
+      let rest$1 = prefix.tail;
+      loop$prefix = rest$1;
+      loop$suffix = prepend(first$1, suffix);
+    }
+  }
+}
+function reverse(list) {
+  return reverse_and_prepend(list, List$Empty$const);
+}
+function first(list) {
+  if (list instanceof Empty) {
+    return new Error2(undefined);
+  } else {
+    let first$1 = list.head;
+    return new Ok(first$1);
+  }
+}
+function map_loop(loop$list, loop$fun, loop$acc) {
+  while (true) {
+    let list = loop$list;
+    let fun = loop$fun;
+    let acc = loop$acc;
+    if (list instanceof Empty) {
+      return reverse(acc);
+    } else {
+      let first$1 = list.head;
+      let rest$1 = list.tail;
+      loop$list = rest$1;
+      loop$fun = fun;
+      loop$acc = prepend(fun(first$1), acc);
+    }
+  }
+}
+function map3(list, fun) {
+  return map_loop(list, fun, List$Empty$const);
+}
+function append_loop(loop$first, loop$second) {
+  while (true) {
+    let first2 = loop$first;
+    let second = loop$second;
+    if (first2 instanceof Empty) {
+      return second;
+    } else {
+      let first$1 = first2.head;
+      let rest$1 = first2.tail;
+      loop$first = rest$1;
+      loop$second = prepend(first$1, second);
+    }
+  }
+}
+function append(first2, second) {
+  return append_loop(reverse(first2), second);
+}
+function prepend2(list, item) {
+  return prepend(item, list);
+}
+function fold2(loop$list, loop$initial, loop$fun) {
+  while (true) {
+    let list = loop$list;
+    let initial = loop$initial;
+    let fun = loop$fun;
+    if (list instanceof Empty) {
+      return initial;
+    } else {
+      let first$1 = list.head;
+      let rest$1 = list.tail;
+      loop$list = rest$1;
+      loop$initial = fun(initial, first$1);
+      loop$fun = fun;
+    }
+  }
+}
+function zip_loop(loop$one, loop$other, loop$acc) {
+  while (true) {
+    let one = loop$one;
+    let other = loop$other;
+    let acc = loop$acc;
+    if (one instanceof Empty) {
+      return reverse(acc);
+    } else if (other instanceof Empty) {
+      return reverse(acc);
+    } else {
+      let first_one = one.head;
+      let rest_one = one.tail;
+      let first_other = other.head;
+      let rest_other = other.tail;
+      loop$one = rest_one;
+      loop$other = rest_other;
+      loop$acc = prepend([first_one, first_other], acc);
+    }
+  }
+}
+function zip(list, other) {
+  return zip_loop(list, other, List$Empty$const);
+}
+function merge_descendings(loop$list1, loop$list2, loop$compare, loop$acc) {
+  while (true) {
+    let list1 = loop$list1;
+    let list2 = loop$list2;
+    let compare2 = loop$compare;
+    let acc = loop$acc;
+    if (list1 instanceof Empty) {
+      let list = list2;
+      return reverse_and_prepend(list, acc);
+    } else if (list2 instanceof Empty) {
+      let list = list1;
+      return reverse_and_prepend(list, acc);
+    } else {
+      let first1 = list1.head;
+      let rest1 = list1.tail;
+      let first2 = list2.head;
+      let rest2 = list2.tail;
+      let $ = compare2(first1, first2);
+      if ($ instanceof Lt) {
+        loop$list1 = list1;
+        loop$list2 = rest2;
+        loop$compare = compare2;
+        loop$acc = prepend(first2, acc);
+      } else if ($ instanceof Eq) {
+        loop$list1 = rest1;
+        loop$list2 = list2;
+        loop$compare = compare2;
+        loop$acc = prepend(first1, acc);
+      } else {
+        loop$list1 = rest1;
+        loop$list2 = list2;
+        loop$compare = compare2;
+        loop$acc = prepend(first1, acc);
+      }
+    }
+  }
+}
+function merge_descending_pairs(loop$sequences, loop$compare, loop$acc) {
+  while (true) {
+    let sequences = loop$sequences;
+    let compare2 = loop$compare;
+    let acc = loop$acc;
+    if (sequences instanceof Empty) {
+      return reverse(acc);
+    } else {
+      let $ = sequences.tail;
+      if ($ instanceof Empty) {
+        let sequence = sequences.head;
+        return reverse(prepend(reverse(sequence), acc));
+      } else {
+        let descending1 = sequences.head;
+        let descending2 = $.head;
+        let rest$1 = $.tail;
+        let ascending = merge_descendings(descending1, descending2, compare2, List$Empty$const);
+        loop$sequences = rest$1;
+        loop$compare = compare2;
+        loop$acc = prepend(ascending, acc);
+      }
+    }
+  }
+}
+function merge_ascendings(loop$list1, loop$list2, loop$compare, loop$acc) {
+  while (true) {
+    let list1 = loop$list1;
+    let list2 = loop$list2;
+    let compare2 = loop$compare;
+    let acc = loop$acc;
+    if (list1 instanceof Empty) {
+      let list = list2;
+      return reverse_and_prepend(list, acc);
+    } else if (list2 instanceof Empty) {
+      let list = list1;
+      return reverse_and_prepend(list, acc);
+    } else {
+      let first1 = list1.head;
+      let rest1 = list1.tail;
+      let first2 = list2.head;
+      let rest2 = list2.tail;
+      let $ = compare2(first1, first2);
+      if ($ instanceof Lt) {
+        loop$list1 = rest1;
+        loop$list2 = list2;
+        loop$compare = compare2;
+        loop$acc = prepend(first1, acc);
+      } else if ($ instanceof Eq) {
+        loop$list1 = list1;
+        loop$list2 = rest2;
+        loop$compare = compare2;
+        loop$acc = prepend(first2, acc);
+      } else {
+        loop$list1 = list1;
+        loop$list2 = rest2;
+        loop$compare = compare2;
+        loop$acc = prepend(first2, acc);
+      }
+    }
+  }
+}
+function merge_ascending_pairs(loop$sequences, loop$compare, loop$acc) {
+  while (true) {
+    let sequences = loop$sequences;
+    let compare2 = loop$compare;
+    let acc = loop$acc;
+    if (sequences instanceof Empty) {
+      return reverse(acc);
+    } else {
+      let $ = sequences.tail;
+      if ($ instanceof Empty) {
+        let sequence = sequences.head;
+        return reverse(prepend(reverse(sequence), acc));
+      } else {
+        let ascending1 = sequences.head;
+        let ascending2 = $.head;
+        let rest$1 = $.tail;
+        let descending = merge_ascendings(ascending1, ascending2, compare2, List$Empty$const);
+        loop$sequences = rest$1;
+        loop$compare = compare2;
+        loop$acc = prepend(descending, acc);
+      }
+    }
+  }
+}
+function merge_all(loop$sequences, loop$direction, loop$compare) {
+  while (true) {
+    let sequences = loop$sequences;
+    let direction = loop$direction;
+    let compare2 = loop$compare;
+    if (sequences instanceof Empty) {
+      return sequences;
+    } else if (direction instanceof Ascending) {
+      if (sequences.tail instanceof Empty) {
+        let sequence = sequences.head;
+        return sequence;
+      } else {
+        let sequences$1 = merge_ascending_pairs(sequences, compare2, List$Empty$const);
+        loop$sequences = sequences$1;
+        loop$direction = Sorting$Descending$const;
+        loop$compare = compare2;
+      }
+    } else if (sequences.tail instanceof Empty) {
+      let sequence = sequences.head;
+      return reverse(sequence);
+    } else {
+      let sequences$1 = merge_descending_pairs(sequences, compare2, List$Empty$const);
+      loop$sequences = sequences$1;
+      loop$direction = Sorting$Ascending$const;
+      loop$compare = compare2;
+    }
+  }
+}
+function sequences(loop$list, loop$compare, loop$growing, loop$direction, loop$prev, loop$acc) {
+  while (true) {
+    let list = loop$list;
+    let compare2 = loop$compare;
+    let growing = loop$growing;
+    let direction = loop$direction;
+    let prev = loop$prev;
+    let acc = loop$acc;
+    let growing$1 = prepend(prev, growing);
+    if (list instanceof Empty) {
+      if (direction instanceof Ascending) {
+        return prepend(reverse(growing$1), acc);
+      } else {
+        return prepend(growing$1, acc);
+      }
+    } else {
+      let new$1 = list.head;
+      let rest$1 = list.tail;
+      let $ = compare2(prev, new$1);
+      if (direction instanceof Ascending) {
+        if ($ instanceof Lt) {
+          loop$list = rest$1;
+          loop$compare = compare2;
+          loop$growing = growing$1;
+          loop$direction = direction;
+          loop$prev = new$1;
+          loop$acc = acc;
+        } else if ($ instanceof Eq) {
+          loop$list = rest$1;
+          loop$compare = compare2;
+          loop$growing = growing$1;
+          loop$direction = direction;
+          loop$prev = new$1;
+          loop$acc = acc;
+        } else {
+          let _block;
+          if (direction instanceof Ascending) {
+            _block = prepend(reverse(growing$1), acc);
+          } else {
+            _block = prepend(growing$1, acc);
+          }
+          let acc$1 = _block;
+          if (rest$1 instanceof Empty) {
+            return prepend(prepend(new$1, List$Empty$const), acc$1);
+          } else {
+            let next = rest$1.head;
+            let rest$2 = rest$1.tail;
+            let _block$1;
+            let $1 = compare2(new$1, next);
+            if ($1 instanceof Lt) {
+              _block$1 = Sorting$Ascending$const;
+            } else if ($1 instanceof Eq) {
+              _block$1 = Sorting$Ascending$const;
+            } else {
+              _block$1 = Sorting$Descending$const;
+            }
+            let direction$1 = _block$1;
+            loop$list = rest$2;
+            loop$compare = compare2;
+            loop$growing = prepend(new$1, List$Empty$const);
+            loop$direction = direction$1;
+            loop$prev = next;
+            loop$acc = acc$1;
+          }
+        }
+      } else if ($ instanceof Lt) {
+        let _block;
+        if (direction instanceof Ascending) {
+          _block = prepend(reverse(growing$1), acc);
+        } else {
+          _block = prepend(growing$1, acc);
+        }
+        let acc$1 = _block;
+        if (rest$1 instanceof Empty) {
+          return prepend(prepend(new$1, List$Empty$const), acc$1);
+        } else {
+          let next = rest$1.head;
+          let rest$2 = rest$1.tail;
+          let _block$1;
+          let $1 = compare2(new$1, next);
+          if ($1 instanceof Lt) {
+            _block$1 = Sorting$Ascending$const;
+          } else if ($1 instanceof Eq) {
+            _block$1 = Sorting$Ascending$const;
+          } else {
+            _block$1 = Sorting$Descending$const;
+          }
+          let direction$1 = _block$1;
+          loop$list = rest$2;
+          loop$compare = compare2;
+          loop$growing = prepend(new$1, List$Empty$const);
+          loop$direction = direction$1;
+          loop$prev = next;
+          loop$acc = acc$1;
+        }
+      } else if ($ instanceof Eq) {
+        let _block;
+        if (direction instanceof Ascending) {
+          _block = prepend(reverse(growing$1), acc);
+        } else {
+          _block = prepend(growing$1, acc);
+        }
+        let acc$1 = _block;
+        if (rest$1 instanceof Empty) {
+          return prepend(prepend(new$1, List$Empty$const), acc$1);
+        } else {
+          let next = rest$1.head;
+          let rest$2 = rest$1.tail;
+          let _block$1;
+          let $1 = compare2(new$1, next);
+          if ($1 instanceof Lt) {
+            _block$1 = Sorting$Ascending$const;
+          } else if ($1 instanceof Eq) {
+            _block$1 = Sorting$Ascending$const;
+          } else {
+            _block$1 = Sorting$Descending$const;
+          }
+          let direction$1 = _block$1;
+          loop$list = rest$2;
+          loop$compare = compare2;
+          loop$growing = prepend(new$1, List$Empty$const);
+          loop$direction = direction$1;
+          loop$prev = next;
+          loop$acc = acc$1;
+        }
+      } else {
+        loop$list = rest$1;
+        loop$compare = compare2;
+        loop$growing = growing$1;
+        loop$direction = direction;
+        loop$prev = new$1;
+        loop$acc = acc;
+      }
+    }
+  }
+}
+function sort(list, compare2) {
+  if (list instanceof Empty) {
+    return list;
+  } else {
+    let $ = list.tail;
+    if ($ instanceof Empty) {
+      return list;
+    } else {
+      let x = list.head;
+      let y = $.head;
+      let rest$1 = $.tail;
+      let _block;
+      let $1 = compare2(x, y);
+      if ($1 instanceof Lt) {
+        _block = Sorting$Ascending$const;
+      } else if ($1 instanceof Eq) {
+        _block = Sorting$Ascending$const;
+      } else {
+        _block = Sorting$Descending$const;
+      }
+      let direction = _block;
+      let sequences$1 = sequences(rest$1, compare2, prepend(x, List$Empty$const), direction, y, List$Empty$const);
+      return merge_all(sequences$1, Sorting$Ascending$const, compare2);
+    }
+  }
+}
+function each(loop$list, loop$f) {
+  while (true) {
+    let list = loop$list;
+    let f = loop$f;
+    if (list instanceof Empty) {
+      return;
+    } else {
+      let first$1 = list.head;
+      let rest$1 = list.tail;
+      f(first$1);
+      loop$list = rest$1;
+      loop$f = f;
+    }
+  }
+}
+function max_loop(loop$list, loop$compare, loop$max) {
+  while (true) {
+    let list = loop$list;
+    let compare2 = loop$compare;
+    let max = loop$max;
+    if (list instanceof Empty) {
+      return max;
+    } else {
+      let first$1 = list.head;
+      let rest$1 = list.tail;
+      let $ = compare2(first$1, max);
+      if ($ instanceof Lt) {
+        loop$list = rest$1;
+        loop$compare = compare2;
+        loop$max = max;
+      } else if ($ instanceof Eq) {
+        loop$list = rest$1;
+        loop$compare = compare2;
+        loop$max = max;
+      } else {
+        loop$list = rest$1;
+        loop$compare = compare2;
+        loop$max = first$1;
+      }
+    }
+  }
+}
+function max(list, compare2) {
+  if (list instanceof Empty) {
+    return new Error2(undefined);
+  } else {
+    let first$1 = list.head;
+    let rest$1 = list.tail;
+    return new Ok(max_loop(rest$1, compare2, first$1));
+  }
+}
+
+// build/dev/javascript/gleam_stdlib/gleam/dynamic/decode.mjs
+class DecodeError extends CustomType {
+  constructor(expected, found, path) {
+    super();
+    this.expected = expected;
+    this.found = found;
+    this.path = path;
+  }
+}
+var DecodeError$DecodeError = (expected, found, path) => new DecodeError(expected, found, path);
+class Decoder extends CustomType {
+  constructor(function$) {
+    super();
+    this.function = function$;
+  }
+}
+var float2 = /* @__PURE__ */ new Decoder(decode_float);
+var int2 = /* @__PURE__ */ new Decoder(decode_int);
+var string2 = /* @__PURE__ */ new Decoder(decode_string);
+function run(data, decoder) {
+  let $ = decoder.function(data);
+  let maybe_invalid_data = $[0];
+  let errors = $[1];
+  if (errors instanceof Empty) {
+    return new Ok(maybe_invalid_data);
+  } else {
+    return new Error2(errors);
+  }
+}
+function run_dynamic_function(data, name, f) {
+  let $ = f(data);
+  if ($ instanceof Ok) {
+    let data$1 = $[0];
+    return [data$1, List$Empty$const];
+  } else {
+    let placeholder = $[0];
+    return [
+      placeholder,
+      prepend(new DecodeError(name, classify_dynamic(data), List$Empty$const), List$Empty$const)
+    ];
+  }
+}
+function decode_float(data) {
+  return run_dynamic_function(data, "Float", float);
+}
+function map4(decoder, transformer) {
+  return new Decoder((d) => {
+    let $ = decoder.function(d);
+    let data = $[0];
+    let errors = $[1];
+    return [transformer(data), errors];
+  });
+}
+function decode_int(data) {
+  return run_dynamic_function(data, "Int", int);
+}
+function decode_string(data) {
+  return run_dynamic_function(data, "String", string);
+}
+function run_decoders(loop$data, loop$failure, loop$decoders) {
+  while (true) {
+    let data = loop$data;
+    let failure = loop$failure;
+    let decoders = loop$decoders;
+    if (decoders instanceof Empty) {
+      return failure;
+    } else {
+      let decoder = decoders.head;
+      let decoders$1 = decoders.tail;
+      let $ = decoder.function(data);
+      let layer = $;
+      let errors = $[1];
+      if (errors instanceof Empty) {
+        return layer;
+      } else {
+        loop$data = data;
+        loop$failure = failure;
+        loop$decoders = decoders$1;
+      }
+    }
+  }
+}
+function one_of(first2, alternatives) {
+  return new Decoder((dynamic_data) => {
+    let $ = first2.function(dynamic_data);
+    let layer = $;
+    let errors = $[1];
+    if (errors instanceof Empty) {
+      return layer;
+    } else {
+      return run_decoders(dynamic_data, layer, alternatives);
+    }
+  });
+}
+function path_segment_to_string(key) {
+  let decoder = one_of(string2, prepend((() => {
+    let _pipe = int2;
+    return map4(_pipe, to_string);
+  })(), prepend((() => {
+    let _pipe = float2;
+    return map4(_pipe, float_to_string);
+  })(), List$Empty$const)));
+  let $ = run(key, decoder);
+  if ($ instanceof Ok) {
+    let key$1 = $[0];
+    return key$1;
+  } else {
+    return "<" + classify_dynamic(key) + ">";
+  }
+}
+function push_path(layer, path) {
+  let path$1 = map3(path, (key) => {
+    let _pipe = key;
+    let _pipe$1 = identity(_pipe);
+    return path_segment_to_string(_pipe$1);
+  });
+  let errors = map3(layer[1], (error) => {
+    return new DecodeError(error.expected, error.found, append(path$1, error.path));
+  });
+  return [layer[0], errors];
+}
+function list2(inner) {
+  return new Decoder((data) => {
+    return list(data, inner.function, (p, k) => {
+      return push_path(p, prepend(k, List$Empty$const));
+    }, 0, List$Empty$const);
+  });
+}
+function index3(loop$path, loop$position, loop$inner, loop$data, loop$handle_miss) {
+  while (true) {
+    let path = loop$path;
+    let position = loop$position;
+    let inner = loop$inner;
+    let data = loop$data;
+    let handle_miss = loop$handle_miss;
+    if (path instanceof Empty) {
+      let _pipe = data;
+      let _pipe$1 = inner(_pipe);
+      return push_path(_pipe$1, reverse(position));
+    } else {
+      let key = path.head;
+      let path$1 = path.tail;
+      let $ = index2(data, key);
+      if ($ instanceof Ok) {
+        let $1 = $[0];
+        if ($1 instanceof Some) {
+          let data$1 = $1[0];
+          loop$path = path$1;
+          loop$position = prepend(key, position);
+          loop$inner = inner;
+          loop$data = data$1;
+          loop$handle_miss = handle_miss;
+        } else {
+          return handle_miss(data, prepend(key, position));
+        }
+      } else {
+        let kind = $[0];
+        let $1 = inner(data);
+        let default$ = $1[0];
+        let _pipe = [
+          default$,
+          prepend(new DecodeError(kind, classify_dynamic(data), List$Empty$const), List$Empty$const)
+        ];
+        return push_path(_pipe, reverse(position));
+      }
+    }
+  }
+}
+function subfield(field_path, field_decoder, next) {
+  return new Decoder((data) => {
+    let $ = index3(field_path, List$Empty$const, field_decoder.function, data, (data2, position) => {
+      let $12 = field_decoder.function(data2);
+      let default$ = $12[0];
+      let _pipe = [
+        default$,
+        prepend(new DecodeError("Field", "Nothing", List$Empty$const), List$Empty$const)
+      ];
+      return push_path(_pipe, reverse(position));
+    });
+    let out = $[0];
+    let errors1 = $[1];
+    let $1 = next(out).function(data);
+    let out$1 = $1[0];
+    let errors2 = $1[1];
+    return [out$1, append(errors1, errors2)];
+  });
+}
+function success(data) {
+  return new Decoder((_) => {
+    return [data, List$Empty$const];
+  });
+}
+function decode_error(expected, found) {
+  return prepend(new DecodeError(expected, classify_dynamic(found), List$Empty$const), List$Empty$const);
+}
+function field(field_name, field_decoder, next) {
+  return subfield(prepend(field_name, List$Empty$const), field_decoder, next);
+}
+function fold_dict(acc, key, value, key_decoder, value_decoder) {
+  let $ = key_decoder(key);
+  let $1 = $[1];
+  if ($1 instanceof Empty) {
+    let key_decoded = $[0];
+    let $2 = value_decoder(value);
+    let $3 = $2[1];
+    if ($3 instanceof Empty) {
+      let value$1 = $2[0];
+      let dict$1 = insert(acc[0], key_decoded, value$1);
+      return [dict$1, acc[1]];
+    } else {
+      let errors = $3;
+      let key_identifier = path_segment_to_string(key);
+      return push_path([make(), errors], prepend(key_identifier, List$Empty$const));
+    }
+  } else {
+    let errors = $1;
+    return push_path([make(), errors], prepend("keys", List$Empty$const));
+  }
+}
+function dict2(key, value) {
+  return new Decoder((data) => {
+    let $ = dict(data);
+    if ($ instanceof Ok) {
+      let dict$1 = $[0];
+      return fold(dict$1, [make(), List$Empty$const], (a, k, v) => {
+        let $1 = a[1];
+        if ($1 instanceof Empty) {
+          return fold_dict(a, k, v, key.function, value.function);
+        } else {
+          return a;
+        }
+      });
+    } else {
+      return [make(), decode_error("Dict", data)];
+    }
+  });
+}
+function optional(inner) {
+  return new Decoder((data) => {
+    let $ = is_null(data);
+    if ($) {
+      return [Option$None$const, List$Empty$const];
+    } else {
+      let $1 = inner.function(data);
+      let data$1 = $1[0];
+      let errors = $1[1];
+      return [new Some(data$1), errors];
+    }
+  });
+}
+
+// build/dev/javascript/gleam_stdlib/gleam_stdlib.mjs
+var Nil = undefined;
+function identity(x) {
+  return x;
+}
+function parse_int(value) {
+  if (/^[-+]?(\d+)$/.test(value)) {
+    return Result$Ok(parseInt(value));
+  } else {
+    return Result$Error(Nil);
+  }
+}
+function to_string(term) {
+  return term.toString();
+}
+function graphemes(string3) {
+  const iterator = graphemes_iterator(string3);
+  if (iterator) {
+    return arrayToList(Array.from(iterator).map((item) => item.segment));
+  } else {
+    return arrayToList(string3.match(/./gsu));
+  }
+}
+var segmenter = undefined;
+function graphemes_iterator(string3) {
+  if (globalThis.Intl && Intl.Segmenter) {
+    segmenter ||= new Intl.Segmenter;
+    return segmenter.segment(string3)[Symbol.iterator]();
+  }
+}
+function lowercase(string3) {
+  return string3.toLowerCase();
+}
+function split(xs, pattern) {
+  return arrayToList(xs.split(pattern));
+}
+function starts_with(haystack, needle) {
+  return haystack.startsWith(needle);
+}
+var unicode_whitespaces = [
+  " ",
+  "\t",
+  `
+`,
+  "\v",
+  "\f",
+  "\r",
+  "\85",
+  "\u2028",
+  "\u2029"
+].join("");
+var trim_start_regex = /* @__PURE__ */ new RegExp(`^[${unicode_whitespaces}]*`);
+var trim_end_regex = /* @__PURE__ */ new RegExp(`[${unicode_whitespaces}]*$`);
+function trim_start(string3) {
+  return string3.replace(trim_start_regex, "");
+}
+function trim_end(string3) {
+  return string3.replace(trim_end_regex, "");
+}
+function classify_dynamic(data) {
+  if (typeof data === "string") {
+    return "String";
+  } else if (typeof data === "boolean") {
+    return "Bool";
+  } else if (isResult(data)) {
+    return "Result";
+  } else if (isList(data)) {
+    return "List";
+  } else if (data instanceof BitArray) {
+    return "BitArray";
+  } else if (data instanceof Dict) {
+    return "Dict";
+  } else if (Number.isInteger(data)) {
+    return "Int";
+  } else if (Array.isArray(data)) {
+    return `Array`;
+  } else if (typeof data === "number") {
+    return "Float";
+  } else if (data === null) {
+    return "Nil";
+  } else if (data === undefined) {
+    return "Nil";
+  } else {
+    const type = typeof data;
+    return type.charAt(0).toUpperCase() + type.slice(1);
+  }
+}
+var MIN_I32 = -(2 ** 31);
+var MAX_I32 = 2 ** 31 - 1;
+var U32 = 2 ** 32;
+var MAX_SAFE = Number.MAX_SAFE_INTEGER;
+var MIN_SAFE = Number.MIN_SAFE_INTEGER;
+function float_to_string(float3) {
+  const string3 = float3.toString().replace("+", "");
+  if (string3.indexOf(".") >= 0) {
+    return string3;
+  } else {
+    const index4 = string3.indexOf("e");
+    if (index4 >= 0) {
+      return string3.slice(0, index4) + ".0" + string3.slice(index4);
+    } else {
+      return string3 + ".0";
+    }
+  }
+}
+
+class Inspector {
+  #references = new Set;
+  inspect(v) {
+    const t = typeof v;
+    if (v === true)
+      return "True";
+    if (v === false)
+      return "False";
+    if (v === null)
+      return "//js(null)";
+    if (v === undefined)
+      return "Nil";
+    if (t === "string")
+      return this.#string(v);
+    if (t === "bigint" || Number.isInteger(v))
+      return v.toString();
+    if (t === "number")
+      return float_to_string(v);
+    if (v instanceof UtfCodepoint)
+      return this.#utfCodepoint(v);
+    if (v instanceof BitArray)
+      return this.#bit_array(v);
+    if (v instanceof RegExp)
+      return `//js(${v})`;
+    if (v instanceof Date)
+      return `//js(Date("${v.toISOString()}"))`;
+    if (v instanceof globalThis.Error)
+      return `//js(${v.toString()})`;
+    if (v instanceof Function) {
+      const args = [];
+      for (const i of Array(v.length).keys())
+        args.push(String.fromCharCode(i + 97));
+      return `//fn(${args.join(", ")}) { ... }`;
+    }
+    if (this.#references.size === this.#references.add(v).size) {
+      return "//js(circular reference)";
+    }
+    let printed;
+    if (Array.isArray(v)) {
+      printed = `#(${v.map((v2) => this.inspect(v2)).join(", ")})`;
+    } else if (isList(v)) {
+      printed = this.#list(v);
+    } else if (v instanceof CustomType) {
+      printed = this.#customType(v);
+    } else if (v instanceof Dict) {
+      printed = this.#dict(v);
+    } else if (v instanceof Set) {
+      return `//js(Set(${[...v].map((v2) => this.inspect(v2)).join(", ")}))`;
+    } else {
+      printed = this.#object(v);
+    }
+    this.#references.delete(v);
+    return printed;
+  }
+  #object(v) {
+    const name = Object.getPrototypeOf(v)?.constructor?.name || "Object";
+    const props = [];
+    for (const k of Object.keys(v)) {
+      props.push(`${this.inspect(k)}: ${this.inspect(v[k])}`);
+    }
+    const body = props.length ? " " + props.join(", ") + " " : "";
+    const head = name === "Object" ? "" : name + " ";
+    return `//js(${head}{${body}})`;
+  }
+  #dict(map5) {
+    let body = "dict.from_list([";
+    let first2 = true;
+    body = fold(map5, body, (body2, key, value) => {
+      if (!first2)
+        body2 = body2 + ", ";
+      first2 = false;
+      return body2 + "#(" + this.inspect(key) + ", " + this.inspect(value) + ")";
+    });
+    return body + "])";
+  }
+  #customType(record) {
+    const props = Object.keys(record).map((label) => {
+      const value = this.inspect(record[label]);
+      return isNaN(parseInt(label)) ? `${label}: ${value}` : value;
+    }).join(", ");
+    return props ? `${record.constructor.name}(${props})` : record.constructor.name;
+  }
+  #list(list3) {
+    if (List$isEmpty(list3)) {
+      return "[]";
+    }
+    let char_out = 'charlist.from_string("';
+    let list_out = "[";
+    let current = list3;
+    while (List$isNonEmpty(current)) {
+      let element = current.head;
+      current = current.tail;
+      if (list_out !== "[") {
+        list_out += ", ";
+      }
+      list_out += this.inspect(element);
+      if (char_out) {
+        if (Number.isInteger(element) && element >= 32 && element <= 126) {
+          char_out += String.fromCharCode(element);
+        } else {
+          char_out = null;
+        }
+      }
+    }
+    if (char_out) {
+      return char_out + '")';
+    } else {
+      return list_out + "]";
+    }
+  }
+  #string(str) {
+    let new_str = '"';
+    for (let i = 0;i < str.length; i++) {
+      const char = str[i];
+      switch (char) {
+        case `
+`:
+          new_str += "\\n";
+          break;
+        case "\r":
+          new_str += "\\r";
+          break;
+        case "\t":
+          new_str += "\\t";
+          break;
+        case "\f":
+          new_str += "\\f";
+          break;
+        case "\\":
+          new_str += "\\\\";
+          break;
+        case '"':
+          new_str += "\\\"";
+          break;
+        default:
+          if (char < " " || char > "~" && char < " ") {
+            new_str += "\\u{" + char.charCodeAt(0).toString(16).toUpperCase().padStart(4, "0") + "}";
+          } else {
+            new_str += char;
+          }
+      }
+    }
+    new_str += '"';
+    return new_str;
+  }
+  #utfCodepoint(codepoint) {
+    return `//utfcodepoint(${String.fromCodePoint(codepoint.value)})`;
+  }
+  #bit_array(bits2) {
+    if (bits2.bitSize === 0) {
+      return "<<>>";
+    }
+    let acc = "<<";
+    for (let i = 0;i < bits2.byteSize - 1; i++) {
+      acc += bits2.byteAt(i).toString();
+      acc += ", ";
+    }
+    if (bits2.byteSize * 8 === bits2.bitSize) {
+      acc += bits2.byteAt(bits2.byteSize - 1).toString();
+    } else {
+      const trailingBitsCount = bits2.bitSize % 8;
+      acc += bits2.byteAt(bits2.byteSize - 1) >> 8 - trailingBitsCount;
+      acc += `:size(${trailingBitsCount})`;
+    }
+    acc += ">>";
+    return acc;
+  }
+}
+function index2(data, key) {
+  if (data instanceof Dict) {
+    const result = get(data, key);
+    return Result$Ok(result.isOk() ? new Some(result[0]) : new None);
+  }
+  if (data instanceof WeakMap || data instanceof Map) {
+    const token = {};
+    const entry = data.get(key, token);
+    if (entry === token)
+      return Result$Ok(new None);
+    return Result$Ok(new Some(entry));
+  }
+  const key_is_int = Number.isInteger(key);
+  if (key_is_int && key >= 0 && key < 8 && isList(data)) {
+    let i = 0;
+    for (const value of data) {
+      if (i === key)
+        return Result$Ok(new Some(value));
+      i++;
+    }
+    return Result$Error("Indexable");
+  }
+  if (key_is_int && Array.isArray(data) || data && typeof data === "object" || data && Object.getPrototypeOf(data) === Object.prototype) {
+    if (key in data)
+      return Result$Ok(new Some(data[key]));
+    return Result$Ok(new None);
+  }
+  return Result$Error(key_is_int ? "Indexable" : "Dict");
+}
+function list(data, decode, pushPath, index4, emptyList) {
+  if (!(isList(data) || Array.isArray(data))) {
+    const error = DecodeError$DecodeError("List", classify_dynamic(data), emptyList);
+    return [emptyList, arrayToList([error])];
+  }
+  const decoded = [];
+  for (const element of data) {
+    const layer = decode(element);
+    const [out, errors] = layer;
+    if (List$isNonEmpty(errors)) {
+      const [_, errors2] = pushPath(layer, index4.toString());
+      return [emptyList, errors2];
+    }
+    decoded.push(out);
+    index4++;
+  }
+  return [arrayToList(decoded), emptyList];
+}
+function dict(data) {
+  if (data instanceof Dict) {
+    return Result$Ok(data);
+  }
+  if (data instanceof Map || data instanceof WeakMap) {
+    return Result$Ok(from(data));
+  }
+  if (data == null) {
+    return Result$Error("Dict");
+  }
+  if (typeof data !== "object") {
+    return Result$Error("Dict");
+  }
+  const proto = Object.getPrototypeOf(data);
+  if (proto === Object.prototype || proto === null) {
+    return Result$Ok(from(Object.entries(data)));
+  }
+  return Result$Error("Dict");
+}
+function float(data) {
+  if (typeof data === "number")
+    return Result$Ok(data);
+  return Result$Error(0);
+}
+function int(data) {
+  if (Number.isInteger(data))
+    return Result$Ok(data);
+  return Result$Error(0);
+}
+function string(data) {
+  if (typeof data === "string")
+    return Result$Ok(data);
+  return Result$Error("");
+}
+function is_null(data) {
+  return data === null || data === undefined;
+}
+function arrayToList(array) {
+  let list3 = List$Empty();
+  let i = array.length;
+  while (i--) {
+    list3 = List$NonEmpty(array[i], list3);
+  }
+  return list3;
+}
+function isList(data) {
+  return List$isEmpty(data) || List$isNonEmpty(data);
+}
+function isResult(data) {
+  return Result$isOk(data) || Result$isError(data);
+}
+
+// build/dev/javascript/gleam_stdlib/gleam/int.mjs
+function compare2(a, b) {
+  let $ = a === b;
+  if ($) {
+    return Order$Eq$const;
+  } else {
+    let $1 = a < b;
+    if ($1) {
+      return Order$Lt$const;
+    } else {
+      return Order$Gt$const;
+    }
+  }
+}
+
+// build/dev/javascript/gleam_stdlib/gleam/string_tree.mjs
+class All extends CustomType {
+}
+var Direction$All$const = new All;
+
+// build/dev/javascript/gleam_stdlib/gleam/string.mjs
+class Leading extends CustomType {
+}
+var Direction$Leading$const = new Leading;
+
+class Trailing extends CustomType {
+}
+var Direction$Trailing$const = new Trailing;
+function split2(x, substring) {
+  if (substring === "") {
+    return graphemes(x);
+  } else {
+    let _pipe = x;
+    let _pipe$1 = identity(_pipe);
+    let _pipe$2 = split(_pipe$1, substring);
+    return map3(_pipe$2, identity);
+  }
+}
+function concat_loop(loop$strings, loop$accumulator) {
+  while (true) {
+    let strings = loop$strings;
+    let accumulator = loop$accumulator;
+    if (strings instanceof Empty) {
+      return accumulator;
+    } else {
+      let string3 = strings.head;
+      let strings$1 = strings.tail;
+      loop$strings = strings$1;
+      loop$accumulator = accumulator + string3;
+    }
+  }
+}
+function concat2(strings) {
+  return concat_loop(strings, "");
+}
+function trim(string3) {
+  let _pipe = string3;
+  let _pipe$1 = trim_start(_pipe);
+  return trim_end(_pipe$1);
+}
+
+// build/dev/javascript/gleam_stdlib/gleam/result.mjs
+function map5(result, fun) {
+  if (result instanceof Ok) {
+    let x = result[0];
+    return new Ok(fun(x));
+  } else {
+    return result;
+  }
+}
+function map_error(result, fun) {
+  if (result instanceof Ok) {
+    return result;
+  } else {
+    let error = result[0];
+    return new Error2(fun(error));
+  }
+}
+function flatten2(result) {
+  if (result instanceof Ok) {
+    let x = result[0];
+    return x;
+  } else {
+    return result;
+  }
+}
+function try$(result, fun) {
+  if (result instanceof Ok) {
+    let x = result[0];
+    return fun(x);
+  } else {
+    return result;
+  }
+}
+function unwrap2(result, default$) {
+  if (result instanceof Ok) {
+    let v = result[0];
+    return v;
+  } else {
+    return default$;
+  }
+}
+// build/dev/javascript/gleam_json/gleam_json_ffi.mjs
+function json_to_string(json) {
+  return JSON.stringify(json);
+}
+function object(entries) {
+  return Object.fromEntries(entries);
+}
+function identity2(x) {
+  return x;
+}
+function do_null() {
+  return null;
+}
+function decode(string3) {
+  try {
+    const result = JSON.parse(string3);
+    return Result$Ok(result);
+  } catch (err) {
+    return Result$Error(getJsonDecodeError(err, string3));
+  }
+}
+function getJsonDecodeError(stdErr, json) {
+  if (isUnexpectedEndOfInput(stdErr))
+    return DecodeError$UnexpectedEndOfInput();
+  return toUnexpectedByteError(stdErr, json);
+}
+function isUnexpectedEndOfInput(err) {
+  const unexpectedEndOfInputRegex = /((unexpected (end|eof))|(end of data)|(unterminated string)|(json( parse error|\.parse)\: expected '(\:|\}|\])'))/i;
+  return unexpectedEndOfInputRegex.test(err.message);
+}
+function toUnexpectedByteError(err, json) {
+  let converters = [
+    v8UnexpectedByteError,
+    oldV8UnexpectedByteError,
+    jsCoreUnexpectedByteError,
+    spidermonkeyUnexpectedByteError
+  ];
+  for (let converter of converters) {
+    let result = converter(err, json);
+    if (result)
+      return result;
+  }
+  return DecodeError$UnexpectedByte("");
+}
+function v8UnexpectedByteError(err) {
+  const regex = /unexpected token '(.)', ".+" is not valid JSON/i;
+  const match = regex.exec(err.message);
+  if (!match)
+    return null;
+  const byte = toHex(match[1]);
+  return DecodeError$UnexpectedByte(byte);
+}
+function oldV8UnexpectedByteError(err) {
+  const regex = /unexpected token (.) in JSON at position (\d+)/i;
+  const match = regex.exec(err.message);
+  if (!match)
+    return null;
+  const byte = toHex(match[1]);
+  return DecodeError$UnexpectedByte(byte);
+}
+function spidermonkeyUnexpectedByteError(err, json) {
+  const regex = /(unexpected character|expected .*) at line (\d+) column (\d+)/i;
+  const match = regex.exec(err.message);
+  if (!match)
+    return null;
+  const line = Number(match[2]);
+  const column = Number(match[3]);
+  const position = getPositionFromMultiline(line, column, json);
+  const byte = toHex(json[position]);
+  return DecodeError$UnexpectedByte(byte);
+}
+function jsCoreUnexpectedByteError(err) {
+  const regex = /unexpected (identifier|token) "(.)"/i;
+  const match = regex.exec(err.message);
+  if (!match)
+    return null;
+  const byte = toHex(match[2]);
+  return DecodeError$UnexpectedByte(byte);
+}
+function toHex(char) {
+  return "0x" + char.charCodeAt(0).toString(16).toUpperCase();
+}
+function getPositionFromMultiline(line, column, string3) {
+  if (line === 1)
+    return column - 1;
+  let currentLn = 1;
+  let position = 0;
+  string3.split("").find((char, idx) => {
+    if (char === `
+`)
+      currentLn += 1;
+    if (currentLn === line) {
+      position = idx + column;
+      return true;
+    }
+    return false;
+  });
+  return position;
+}
+
+// build/dev/javascript/gleam_json/gleam/json.mjs
+class UnexpectedEndOfInput extends CustomType {
+}
+var DecodeError$UnexpectedEndOfInput$const = new UnexpectedEndOfInput;
+var DecodeError$UnexpectedEndOfInput = () => DecodeError$UnexpectedEndOfInput$const;
+class UnexpectedByte extends CustomType {
+  constructor($0) {
+    super();
+    this[0] = $0;
+  }
+}
+var DecodeError$UnexpectedByte = ($0) => new UnexpectedByte($0);
+class UnableToDecode extends CustomType {
+  constructor($0) {
+    super();
+    this[0] = $0;
+  }
+}
+function do_parse(json, decoder) {
+  return try$(decode(json), (dynamic_value) => {
+    let _pipe = run(dynamic_value, decoder);
+    return map_error(_pipe, (var0) => {
+      return new UnableToDecode(var0);
+    });
+  });
+}
+function parse(json, decoder) {
+  return do_parse(json, decoder);
+}
+function to_string2(json) {
+  return json_to_string(json);
+}
+function string3(input) {
+  return identity2(input);
+}
+function bool(input) {
+  return identity2(input);
+}
+function int3(input) {
+  return identity2(input);
+}
+function null$() {
+  return do_null();
+}
+function object2(entries) {
+  return object(entries);
+}
+function dict3(dict4, keys2, values2) {
+  return object2(fold(dict4, List$Empty$const, (acc, k, v) => {
+    return prepend([keys2(k), values2(v)], acc);
+  }));
+}
+// build/dev/javascript/gleam_erlang/gleam/erlang/process.mjs
+class Normal extends CustomType {
+}
+var ExitReason$Normal$const = new Normal;
+class Killed extends CustomType {
+}
+var ExitReason$Killed$const = new Killed;
+class Anything extends CustomType {
+}
+var AnythingSelectorTag$Anything$const = new Anything;
+
+class Process extends CustomType {
+}
+var ProcessMonitorFlag$Process$const = new Process;
+class TimerNotFound extends CustomType {
+}
+var Cancelled$TimerNotFound$const = new TimerNotFound;
+class Kill extends CustomType {
+}
+var KillFlag$Kill$const = new Kill;
+// build/dev/javascript/gleam_otp/gleam/otp/system.mjs
+class Running extends CustomType {
+}
+var Mode$Running$const = new Running;
+class Suspended extends CustomType {
+}
+var Mode$Suspended$const = new Suspended;
+class NoDebug extends CustomType {
+}
+var DebugOption$NoDebug$const = new NoDebug;
+
+// build/dev/javascript/gleam_otp/gleam/otp/actor.mjs
+class InitTimeout extends CustomType {
+}
+var StartError$InitTimeout$const = new InitTimeout;
+
+// build/dev/javascript/gleam_otp/gleam/otp/supervision.mjs
+class Permanent extends CustomType {
+}
+var Restart$Permanent$const = new Permanent;
+class Transient extends CustomType {
+}
+var Restart$Transient$const = new Transient;
+class Temporary extends CustomType {
+}
+var Restart$Temporary$const = new Temporary;
+class Supervisor extends CustomType {
+}
+var ChildType$Supervisor$const = new Supervisor;
+
+// build/dev/javascript/gleam_otp/gleam/otp/factory_supervisor.mjs
+class SimpleOneForOne extends CustomType {
+}
+var Strategy$SimpleOneForOne$const = new SimpleOneForOne;
+
+// build/dev/javascript/gleam_stdlib/gleam/bool.mjs
+function guard(requirement, consequence, alternative) {
+  if (requirement) {
+    return consequence;
+  } else {
+    return alternative();
+  }
+}
+
+// build/dev/javascript/gleam_stdlib/gleam/function.mjs
+function identity3(x) {
+  return x;
+}
+// build/dev/javascript/houdini/houdini.ffi.mjs
+function escape(string4) {
+  return string4.replaceAll(/[><&"']/g, (replaced) => {
+    switch (replaced) {
+      case ">":
+        return "&gt;";
+      case "<":
+        return "&lt;";
+      case "'":
+        return "&#39;";
+      case "&":
+        return "&amp;";
+      case '"':
+        return "&quot;";
+      default:
+        return replaced;
+    }
+  });
+}
+
+// build/dev/javascript/lustre/lustre/internals/constants.mjs
+var empty_list = List$Empty$const;
+var error_nil = /* @__PURE__ */ new Error2(undefined);
+function singleton_list(item) {
+  return prepend(item, empty_list);
+}
+
+// build/dev/javascript/lustre/lustre/vdom/vattr.ffi.mjs
+var GT = /* @__PURE__ */ Order$Gt();
+var LT = /* @__PURE__ */ Order$Lt();
+var EQ = /* @__PURE__ */ Order$Eq();
+function compare3(a, b) {
+  if (a.name === b.name) {
+    return EQ;
+  } else if (a.name < b.name) {
+    return LT;
+  } else {
+    return GT;
+  }
+}
+
+// build/dev/javascript/lustre/lustre/vdom/vattr.mjs
+class Attribute extends CustomType {
+  constructor(kind, name, value) {
+    super();
+    this.kind = kind;
+    this.name = name;
+    this.value = value;
+  }
+}
+class Property extends CustomType {
+  constructor(kind, name, value) {
+    super();
+    this.kind = kind;
+    this.name = name;
+    this.value = value;
+  }
+}
+class Event2 extends CustomType {
+  constructor(kind, name, handler, include, prevent_default, stop_propagation, debounce, throttle) {
+    super();
+    this.kind = kind;
+    this.name = name;
+    this.handler = handler;
+    this.include = include;
+    this.prevent_default = prevent_default;
+    this.stop_propagation = stop_propagation;
+    this.debounce = debounce;
+    this.throttle = throttle;
+  }
+}
+class Handler extends CustomType {
+  constructor(prevent_default, stop_propagation, message) {
+    super();
+    this.prevent_default = prevent_default;
+    this.stop_propagation = stop_propagation;
+    this.message = message;
+  }
+}
+class Never extends CustomType {
+  constructor(kind) {
+    super();
+    this.kind = kind;
+  }
+}
+var attribute_kind = 0;
+var property_kind = 1;
+var event_kind = 2;
+var never_kind = 0;
+var never = /* @__PURE__ */ new Never(never_kind);
+var always_kind = 2;
+function attribute(name, value) {
+  return new Attribute(attribute_kind, name, value);
+}
+function property(name, value) {
+  return new Property(property_kind, name, value);
+}
+function event(name, handler, include, prevent_default, stop_propagation, debounce, throttle) {
+  return new Event2(event_kind, name, handler, include, prevent_default, stop_propagation, debounce, throttle);
+}
+function merge(loop$attributes, loop$merged) {
+  while (true) {
+    let attributes = loop$attributes;
+    let merged = loop$merged;
+    if (attributes instanceof Empty) {
+      return merged;
+    } else {
+      let $ = attributes.head;
+      if ($ instanceof Attribute) {
+        let $1 = $.name;
+        if ($1 === "") {
+          let rest = attributes.tail;
+          loop$attributes = rest;
+          loop$merged = merged;
+        } else if ($1 === "class") {
+          let $2 = $.value;
+          if ($2 === "") {
+            let rest = attributes.tail;
+            loop$attributes = rest;
+            loop$merged = merged;
+          } else {
+            let $3 = attributes.tail;
+            if ($3 instanceof Empty) {
+              let attribute$1 = $;
+              let rest = $3;
+              loop$attributes = rest;
+              loop$merged = prepend(attribute$1, merged);
+            } else {
+              let $4 = $3.head;
+              if ($4 instanceof Attribute && $4.name === "class") {
+                let kind = $.kind;
+                let class1 = $2;
+                let rest = $3.tail;
+                let class2 = $4.value;
+                let value = class1 + " " + class2;
+                let attribute$1 = new Attribute(kind, "class", value);
+                loop$attributes = prepend(attribute$1, rest);
+                loop$merged = merged;
+              } else {
+                let attribute$1 = $;
+                let rest = $3;
+                loop$attributes = rest;
+                loop$merged = prepend(attribute$1, merged);
+              }
+            }
+          }
+        } else if ($1 === "style") {
+          let $2 = $.value;
+          if ($2 === "") {
+            let rest = attributes.tail;
+            loop$attributes = rest;
+            loop$merged = merged;
+          } else {
+            let $3 = attributes.tail;
+            if ($3 instanceof Empty) {
+              let attribute$1 = $;
+              let rest = $3;
+              loop$attributes = rest;
+              loop$merged = prepend(attribute$1, merged);
+            } else {
+              let $4 = $3.head;
+              if ($4 instanceof Attribute && $4.name === "style") {
+                let kind = $.kind;
+                let style1 = $2;
+                let rest = $3.tail;
+                let style2 = $4.value;
+                let value = style1 + ";" + style2;
+                let attribute$1 = new Attribute(kind, "style", value);
+                loop$attributes = prepend(attribute$1, rest);
+                loop$merged = merged;
+              } else {
+                let attribute$1 = $;
+                let rest = $3;
+                loop$attributes = rest;
+                loop$merged = prepend(attribute$1, merged);
+              }
+            }
+          }
+        } else {
+          let attribute$1 = $;
+          let rest = attributes.tail;
+          loop$attributes = rest;
+          loop$merged = prepend(attribute$1, merged);
+        }
+      } else {
+        let attribute$1 = $;
+        let rest = attributes.tail;
+        loop$attributes = rest;
+        loop$merged = prepend(attribute$1, merged);
+      }
+    }
+  }
+}
+function prepare(attributes) {
+  if (attributes instanceof Empty) {
+    return attributes;
+  } else if (attributes.tail instanceof Empty) {
+    return attributes;
+  } else {
+    let _pipe = attributes;
+    let _pipe$1 = sort(_pipe, (a, b) => {
+      return compare3(b, a);
+    });
+    return merge(_pipe$1, empty_list);
+  }
+}
+
+// build/dev/javascript/lustre/lustre/attribute.mjs
+function attribute2(name, value) {
+  return attribute(name, value);
+}
+function property2(name, value) {
+  return property(name, value);
+}
+function boolean_attribute(name, value) {
+  if (value) {
+    return attribute2(name, "");
+  } else {
+    return property2(name, bool(false));
+  }
+}
+function class$(name) {
+  return attribute2("class", name);
+}
+function autofocus(should_autofocus) {
+  return boolean_attribute("autofocus", should_autofocus);
+}
+function id(value) {
+  return attribute2("id", value);
+}
+function do_styles(loop$properties, loop$styles) {
+  while (true) {
+    let properties = loop$properties;
+    let styles = loop$styles;
+    if (properties instanceof Empty) {
+      return styles;
+    } else {
+      let $ = properties.head[0];
+      if ($ === "") {
+        let rest = properties.tail;
+        loop$properties = rest;
+        loop$styles = styles;
+      } else {
+        let $1 = properties.head[1];
+        if ($1 === "") {
+          let rest = properties.tail;
+          loop$properties = rest;
+          loop$styles = styles;
+        } else {
+          let rest = properties.tail;
+          let name$1 = $;
+          let value$1 = $1;
+          loop$properties = rest;
+          loop$styles = styles + name$1 + ":" + value$1 + ";";
+        }
+      }
+    }
+  }
+}
+function styles(properties) {
+  return attribute2("style", do_styles(properties, ""));
+}
+function src(url) {
+  return attribute2("src", url);
+}
+function value(control_value) {
+  return attribute2("value", control_value);
+}
+
+// build/dev/javascript/lustre/lustre/effect.mjs
+class Effect extends CustomType {
+  constructor(synchronous, before_paint, after_paint) {
+    super();
+    this.synchronous = synchronous;
+    this.before_paint = before_paint;
+    this.after_paint = after_paint;
+  }
+}
+
+class Actions extends CustomType {
+  constructor(dispatch, emit, select, root, provide, subscribe, unsubscribe) {
+    super();
+    this.dispatch = dispatch;
+    this.emit = emit;
+    this.select = select;
+    this.root = root;
+    this.provide = provide;
+    this.subscribe = subscribe;
+    this.unsubscribe = unsubscribe;
+  }
+}
+var empty = /* @__PURE__ */ new Effect(empty_list, empty_list, empty_list);
+function none() {
+  return empty;
+}
+function batch(effects) {
+  return fold2(effects, empty, (acc, eff) => {
+    return new Effect(fold2(eff.synchronous, acc.synchronous, prepend2), fold2(eff.before_paint, acc.before_paint, prepend2), fold2(eff.after_paint, acc.after_paint, prepend2));
+  });
+}
+function perform(effect, dispatch, emit, select, root, provide, subscribe, unsubscribe) {
+  let actions = new Actions(dispatch, emit, select, root, provide, subscribe, unsubscribe);
+  return each(effect.synchronous, (run2) => {
+    return run2(actions);
+  });
+}
+
+// build/dev/javascript/lustre/lustre/internals/mutable_map.ffi.mjs
+function empty2() {
+  return null;
+}
+function get2(map6, key) {
+  return map6?.get(key);
+}
+function get_or_compute(map6, key, compute) {
+  return map6?.get(key) ?? compute();
+}
+function has_key(map6, key) {
+  return map6 && map6.has(key);
+}
+function insert2(map6, key, value2) {
+  map6 ??= new Map;
+  map6.set(key, value2);
+  return map6;
+}
+function remove(map6, key) {
+  map6?.delete(key);
+  return map6;
+}
+
+// build/dev/javascript/lustre/lustre/internals/ref.ffi.mjs
+function sameValueZero(x, y) {
+  if (typeof x === "number" && typeof y === "number") {
+    return x === y || x !== x && y !== y;
+  }
+  return x === y;
+}
+
+// build/dev/javascript/lustre/lustre/internals/ref.mjs
+function equal_lists(loop$xs, loop$ys) {
+  while (true) {
+    let xs = loop$xs;
+    let ys = loop$ys;
+    if (xs instanceof Empty) {
+      if (ys instanceof Empty) {
+        return true;
+      } else {
+        return false;
+      }
+    } else if (ys instanceof Empty) {
+      return false;
+    } else {
+      let x = xs.head;
+      let xs$1 = xs.tail;
+      let y = ys.head;
+      let ys$1 = ys.tail;
+      let $ = sameValueZero(x, y);
+      if ($) {
+        loop$xs = xs$1;
+        loop$ys = ys$1;
+      } else {
+        return $;
+      }
+    }
+  }
+}
+
+// build/dev/javascript/lustre/lustre/vdom/vnode.mjs
+class Fragment extends CustomType {
+  constructor(kind, key, children, keyed_children) {
+    super();
+    this.kind = kind;
+    this.key = key;
+    this.children = children;
+    this.keyed_children = keyed_children;
+  }
+}
+class Element2 extends CustomType {
+  constructor(kind, key, namespace, tag, attributes, children, keyed_children, self_closing, void$) {
+    super();
+    this.kind = kind;
+    this.key = key;
+    this.namespace = namespace;
+    this.tag = tag;
+    this.attributes = attributes;
+    this.children = children;
+    this.keyed_children = keyed_children;
+    this.self_closing = self_closing;
+    this.void = void$;
+  }
+}
+class Text extends CustomType {
+  constructor(kind, key, content) {
+    super();
+    this.kind = kind;
+    this.key = key;
+    this.content = content;
+  }
+}
+class UnsafeInnerHtml extends CustomType {
+  constructor(kind, key, namespace, tag, attributes, inner_html) {
+    super();
+    this.kind = kind;
+    this.key = key;
+    this.namespace = namespace;
+    this.tag = tag;
+    this.attributes = attributes;
+    this.inner_html = inner_html;
+  }
+}
+class Map2 extends CustomType {
+  constructor(kind, key, mapper, child) {
+    super();
+    this.kind = kind;
+    this.key = key;
+    this.mapper = mapper;
+    this.child = child;
+  }
+}
+class Memo extends CustomType {
+  constructor(kind, key, dependencies, view) {
+    super();
+    this.kind = kind;
+    this.key = key;
+    this.dependencies = dependencies;
+    this.view = view;
+  }
+}
+var fragment_kind = 0;
+var element_kind = 1;
+var text_kind = 2;
+var unsafe_inner_html_kind = 3;
+var map_kind = 4;
+var memo_kind = 5;
+function fragment(key, children, keyed_children) {
+  return new Fragment(fragment_kind, key, children, keyed_children);
+}
+function element(key, namespace, tag, attributes, children, keyed_children, self_closing, void$) {
+  return new Element2(element_kind, key, namespace, tag, prepare(attributes), children, keyed_children, self_closing, void$);
+}
+function is_void_html_element(tag, namespace) {
+  if (namespace === "") {
+    if (tag === "area") {
+      return true;
+    } else if (tag === "base") {
+      return true;
+    } else if (tag === "br") {
+      return true;
+    } else if (tag === "col") {
+      return true;
+    } else if (tag === "embed") {
+      return true;
+    } else if (tag === "hr") {
+      return true;
+    } else if (tag === "img") {
+      return true;
+    } else if (tag === "input") {
+      return true;
+    } else if (tag === "link") {
+      return true;
+    } else if (tag === "meta") {
+      return true;
+    } else if (tag === "param") {
+      return true;
+    } else if (tag === "source") {
+      return true;
+    } else if (tag === "track") {
+      return true;
+    } else if (tag === "wbr") {
+      return true;
+    } else {
+      return false;
+    }
+  } else {
+    return false;
+  }
+}
+function text(key, content) {
+  return new Text(text_kind, key, content);
+}
+function map6(element2, mapper) {
+  if (element2 instanceof Map2) {
+    let child_mapper = element2.mapper;
+    return new Map2(map_kind, element2.key, (handler) => {
+      return identity3(mapper)(child_mapper(handler));
+    }, identity3(element2.child));
+  } else {
+    return new Map2(map_kind, element2.key, identity3(mapper), identity3(element2));
+  }
+}
+function memo(key, dependencies, view) {
+  return new Memo(memo_kind, key, dependencies, view);
+}
+function to_keyed(key, node) {
+  if (node instanceof Fragment) {
+    return new Fragment(node.kind, key, node.children, node.keyed_children);
+  } else if (node instanceof Element2) {
+    return new Element2(node.kind, key, node.namespace, node.tag, node.attributes, node.children, node.keyed_children, node.self_closing, node.void);
+  } else if (node instanceof Text) {
+    return new Text(node.kind, key, node.content);
+  } else if (node instanceof UnsafeInnerHtml) {
+    return new UnsafeInnerHtml(node.kind, key, node.namespace, node.tag, node.attributes, node.inner_html);
+  } else if (node instanceof Map2) {
+    let child = node.child;
+    return new Map2(node.kind, key, node.mapper, to_keyed(key, child));
+  } else {
+    let view = node.view;
+    return new Memo(node.kind, key, node.dependencies, () => {
+      return to_keyed(key, view());
+    });
+  }
+}
+
+// build/dev/javascript/lustre/lustre/element.mjs
+class Html extends CustomType {
+}
+var DocumentType$Html$const = new Html;
+
+class HeadOnly extends CustomType {
+}
+var DocumentType$HeadOnly$const = new HeadOnly;
+
+class BodyOnly extends CustomType {
+}
+var DocumentType$BodyOnly$const = new BodyOnly;
+
+class HeadAndBody extends CustomType {
+}
+var DocumentType$HeadAndBody$const = new HeadAndBody;
+
+class Other extends CustomType {
+}
+var DocumentType$Other$const = new Other;
+function element2(tag, attributes, children) {
+  return element("", "", tag, attributes, children, empty2(), false, is_void_html_element(tag, ""));
+}
+function text2(content) {
+  return text("", content);
+}
+function none2() {
+  return text("", "");
+}
+function memo2(dependencies, view) {
+  return memo("", dependencies, view);
+}
+function ref(value2) {
+  return identity3(value2);
+}
+function map7(element3, f) {
+  return map6(element3, f);
+}
+
+// build/dev/javascript/lustre/lustre/element/html.mjs
+function text3(content) {
+  return text2(content);
+}
+function div(attrs, children) {
+  return element2("div", attrs, children);
+}
+function a(attrs, children) {
+  return element2("a", attrs, children);
+}
+function img(attrs) {
+  return element2("img", attrs, empty_list);
+}
+function button(attrs, children) {
+  return element2("button", attrs, children);
+}
+function input(attrs) {
+  return element2("input", attrs, empty_list);
+}
+
+// build/dev/javascript/lustre/lustre/vdom/patch.mjs
+class Patch extends CustomType {
+  constructor(index4, path, removed, changes, children) {
+    super();
+    this.index = index4;
+    this.path = path;
+    this.removed = removed;
+    this.changes = changes;
+    this.children = children;
+  }
+}
+class ReplaceText extends CustomType {
+  constructor(kind, content) {
+    super();
+    this.kind = kind;
+    this.content = content;
+  }
+}
+class ReplaceInnerHtml extends CustomType {
+  constructor(kind, inner_html) {
+    super();
+    this.kind = kind;
+    this.inner_html = inner_html;
+  }
+}
+class Update extends CustomType {
+  constructor(kind, added, removed) {
+    super();
+    this.kind = kind;
+    this.added = added;
+    this.removed = removed;
+  }
+}
+class Move extends CustomType {
+  constructor(kind, key, before) {
+    super();
+    this.kind = kind;
+    this.key = key;
+    this.before = before;
+  }
+}
+class Replace extends CustomType {
+  constructor(kind, index4, with$) {
+    super();
+    this.kind = kind;
+    this.index = index4;
+    this.with = with$;
+  }
+}
+class Remove extends CustomType {
+  constructor(kind, index4) {
+    super();
+    this.kind = kind;
+    this.index = index4;
+  }
+}
+class Insert extends CustomType {
+  constructor(kind, children, before) {
+    super();
+    this.kind = kind;
+    this.children = children;
+    this.before = before;
+  }
+}
+var replace_text_kind = 0;
+var replace_inner_html_kind = 1;
+var update_kind = 2;
+var move_kind = 3;
+var remove_kind = 4;
+var replace_kind = 5;
+var insert_kind = 6;
+function new$3(index4, removed, changes, children) {
+  return new Patch(index4, empty_list, removed, changes, children);
+}
+function replace_text(content) {
+  return new ReplaceText(replace_text_kind, content);
+}
+function replace_inner_html(inner_html) {
+  return new ReplaceInnerHtml(replace_inner_html_kind, inner_html);
+}
+function update(added, removed) {
+  return new Update(update_kind, added, removed);
+}
+function move(key, before) {
+  return new Move(move_kind, key, before);
+}
+function remove2(index4) {
+  return new Remove(remove_kind, index4);
+}
+function replace2(index4, with$) {
+  return new Replace(replace_kind, index4, with$);
+}
+function insert3(children, before) {
+  return new Insert(insert_kind, children, before);
+}
+function add_parent(child, index4) {
+  return new Patch(index4, prepend(child.index, child.path), child.removed, child.changes, child.children);
+}
+
+// build/dev/javascript/lustre/lustre/runtime/transport.mjs
+class Mount extends CustomType {
+  constructor(kind, open_shadow_root, will_adopt_styles, observed_attributes, observed_properties, requested_contexts, provided_contexts, vdom, memos) {
+    super();
+    this.kind = kind;
+    this.open_shadow_root = open_shadow_root;
+    this.will_adopt_styles = will_adopt_styles;
+    this.observed_attributes = observed_attributes;
+    this.observed_properties = observed_properties;
+    this.requested_contexts = requested_contexts;
+    this.provided_contexts = provided_contexts;
+    this.vdom = vdom;
+    this.memos = memos;
+  }
+}
+class Reconcile extends CustomType {
+  constructor(kind, patch, memos) {
+    super();
+    this.kind = kind;
+    this.patch = patch;
+    this.memos = memos;
+  }
+}
+class Emit extends CustomType {
+  constructor(kind, name, data) {
+    super();
+    this.kind = kind;
+    this.name = name;
+    this.data = data;
+  }
+}
+class Provide extends CustomType {
+  constructor(kind, key, value2) {
+    super();
+    this.kind = kind;
+    this.key = key;
+    this.value = value2;
+  }
+}
+class Subscribe extends CustomType {
+  constructor(kind, key) {
+    super();
+    this.kind = kind;
+    this.key = key;
+  }
+}
+class Unsubscribe extends CustomType {
+  constructor(kind, key) {
+    super();
+    this.kind = kind;
+    this.key = key;
+  }
+}
+class Batch extends CustomType {
+  constructor(kind, messages) {
+    super();
+    this.kind = kind;
+    this.messages = messages;
+  }
+}
+var ServerMessage$isBatch = (value2) => value2 instanceof Batch;
+class AttributeChanged extends CustomType {
+  constructor(kind, name, value2) {
+    super();
+    this.kind = kind;
+    this.name = name;
+    this.value = value2;
+  }
+}
+var ServerMessage$isAttributeChanged = (value2) => value2 instanceof AttributeChanged;
+class PropertyChanged extends CustomType {
+  constructor(kind, name, value2) {
+    super();
+    this.kind = kind;
+    this.name = name;
+    this.value = value2;
+  }
+}
+var ServerMessage$isPropertyChanged = (value2) => value2 instanceof PropertyChanged;
+class EventFired extends CustomType {
+  constructor(kind, path, name, event2) {
+    super();
+    this.kind = kind;
+    this.path = path;
+    this.name = name;
+    this.event = event2;
+  }
+}
+var ServerMessage$isEventFired = (value2) => value2 instanceof EventFired;
+class ContextProvided extends CustomType {
+  constructor(kind, key, value2) {
+    super();
+    this.kind = kind;
+    this.key = key;
+    this.value = value2;
+  }
+}
+var ServerMessage$isContextProvided = (value2) => value2 instanceof ContextProvided;
+var mount_kind = 0;
+var reconcile_kind = 1;
+var emit_kind = 2;
+var provide_kind = 3;
+var subscribe_kind = 4;
+var unsubscribe_kind = 5;
+function mount(open_shadow_root, will_adopt_styles, observed_attributes, observed_properties, requested_contexts, provided_contexts, vdom, memos) {
+  return new Mount(mount_kind, open_shadow_root, will_adopt_styles, observed_attributes, observed_properties, requested_contexts, provided_contexts, vdom, memos);
+}
+function reconcile(patch, memos) {
+  return new Reconcile(reconcile_kind, patch, memos);
+}
+function emit(name, data) {
+  return new Emit(emit_kind, name, data);
+}
+function provide(key, value2) {
+  return new Provide(provide_kind, key, value2);
+}
+function subscribe(key) {
+  return new Subscribe(subscribe_kind, key);
+}
+function unsubscribe(key) {
+  return new Unsubscribe(unsubscribe_kind, key);
+}
+
+// build/dev/javascript/lustre/lustre/vdom/path.mjs
+class Root extends CustomType {
+}
+var Path$Root$const = new Root;
+
+class Key extends CustomType {
+  constructor(key, parent) {
+    super();
+    this.key = key;
+    this.parent = parent;
+  }
+}
+
+class Index extends CustomType {
+  constructor(index4, parent) {
+    super();
+    this.index = index4;
+    this.parent = parent;
+  }
+}
+
+class Subtree extends CustomType {
+  constructor(parent) {
+    super();
+    this.parent = parent;
+  }
+}
+var separator_subtree = "\r";
+var separator_element = "\t";
+var separator_event = `
+`;
+var root = Path$Root$const;
+function finish_to_string(acc) {
+  if (acc instanceof Empty) {
+    return "";
+  } else {
+    let segments = acc.tail;
+    return concat2(segments);
+  }
+}
+function do_to_string(loop$full, loop$path, loop$acc) {
+  while (true) {
+    let full = loop$full;
+    let path = loop$path;
+    let acc = loop$acc;
+    if (path instanceof Root) {
+      return finish_to_string(acc);
+    } else if (path instanceof Key) {
+      let key = path.key;
+      let parent = path.parent;
+      loop$full = full;
+      loop$path = parent;
+      loop$acc = prepend(separator_element, prepend(key, acc));
+    } else if (path instanceof Index) {
+      let index4 = path.index;
+      let parent = path.parent;
+      let acc$1 = prepend(separator_element, prepend(to_string(index4), acc));
+      loop$full = full;
+      loop$path = parent;
+      loop$acc = acc$1;
+    } else if (!full) {
+      return finish_to_string(acc);
+    } else {
+      let parent = path.parent;
+      if (acc instanceof Empty) {
+        loop$full = full;
+        loop$path = parent;
+        loop$acc = acc;
+      } else {
+        let acc$1 = acc.tail;
+        loop$full = full;
+        loop$path = parent;
+        loop$acc = prepend(separator_subtree, acc$1);
+      }
+    }
+  }
+}
+function to_string4(path) {
+  return do_to_string(true, path, empty_list);
+}
+function do_matches(loop$path, loop$candidates) {
+  while (true) {
+    let path = loop$path;
+    let candidates = loop$candidates;
+    if (candidates instanceof Empty) {
+      return false;
+    } else {
+      let candidate = candidates.head;
+      let rest = candidates.tail;
+      let $ = starts_with(path, candidate);
+      if ($) {
+        return $;
+      } else {
+        loop$path = path;
+        loop$candidates = rest;
+      }
+    }
+  }
+}
+function matches(path, candidates) {
+  if (candidates instanceof Empty) {
+    return false;
+  } else {
+    return do_matches(to_string4(path), candidates);
+  }
+}
+function split_subtree_path(path) {
+  return split2(path, separator_subtree);
+}
+function add2(parent, index4, key) {
+  if (key === "") {
+    return new Index(index4, parent);
+  } else {
+    return new Key(key, parent);
+  }
+}
+function subtree(path) {
+  return new Subtree(path);
+}
+function event2(path, event3) {
+  return do_to_string(false, path, prepend(separator_event, prepend(event3, empty_list)));
+}
+function child(path) {
+  return do_to_string(false, path, empty_list);
+}
+
+// build/dev/javascript/lustre/lustre/vdom/cache.mjs
+class Cache extends CustomType {
+  constructor(events, vdoms, old_vdoms, dispatched_paths, next_dispatched_paths) {
+    super();
+    this.events = events;
+    this.vdoms = vdoms;
+    this.old_vdoms = old_vdoms;
+    this.dispatched_paths = dispatched_paths;
+    this.next_dispatched_paths = next_dispatched_paths;
+  }
+}
+
+class Events extends CustomType {
+  constructor(handlers, children) {
+    super();
+    this.handlers = handlers;
+    this.children = children;
+  }
+}
+
+class Child extends CustomType {
+  constructor(mapper, events) {
+    super();
+    this.mapper = mapper;
+    this.events = events;
+  }
+}
+
+class AddedChildren extends CustomType {
+  constructor(handlers, children, vdoms) {
+    super();
+    this.handlers = handlers;
+    this.children = children;
+    this.vdoms = vdoms;
+  }
+}
+
+class DecodedEvent extends CustomType {
+  constructor(path, handler) {
+    super();
+    this.path = path;
+    this.handler = handler;
+  }
+}
+
+class DispatchedEvent extends CustomType {
+  constructor(path) {
+    super();
+    this.path = path;
+  }
+}
+function compose_mapper(mapper, child_mapper) {
+  return (message) => {
+    return mapper(child_mapper(message));
+  };
+}
+function new_events() {
+  return new Events(empty2(), empty2());
+}
+function new$4() {
+  return new Cache(new_events(), empty2(), empty2(), empty_list, empty_list);
+}
+function do_add_event(handlers, path, name, handler) {
+  return insert2(handlers, event2(path, name), handler);
+}
+function add_attributes(handlers, path, attributes) {
+  return fold2(attributes, handlers, (events, attribute3) => {
+    if (attribute3 instanceof Event2) {
+      let name = attribute3.name;
+      let handler = attribute3.handler;
+      return do_add_event(events, path, name, handler);
+    } else {
+      return events;
+    }
+  });
+}
+function do_add_children(loop$handlers, loop$children, loop$vdoms, loop$parent, loop$child_index, loop$nodes) {
+  while (true) {
+    let handlers = loop$handlers;
+    let children = loop$children;
+    let vdoms = loop$vdoms;
+    let parent = loop$parent;
+    let child_index = loop$child_index;
+    let nodes = loop$nodes;
+    let next = child_index + 1;
+    if (nodes instanceof Empty) {
+      return new AddedChildren(handlers, children, vdoms);
+    } else {
+      let $ = nodes.head;
+      if ($ instanceof Fragment) {
+        let rest = nodes.tail;
+        let key = $.key;
+        let nodes$1 = $.children;
+        let path = add2(parent, child_index, key);
+        let $1 = do_add_children(handlers, children, vdoms, path, 0, nodes$1);
+        let handlers$1 = $1.handlers;
+        let children$1 = $1.children;
+        let vdoms$1 = $1.vdoms;
+        loop$handlers = handlers$1;
+        loop$children = children$1;
+        loop$vdoms = vdoms$1;
+        loop$parent = parent;
+        loop$child_index = next;
+        loop$nodes = rest;
+      } else if ($ instanceof Element2) {
+        let rest = nodes.tail;
+        let key = $.key;
+        let attributes = $.attributes;
+        let nodes$1 = $.children;
+        let path = add2(parent, child_index, key);
+        let handlers$1 = add_attributes(handlers, path, attributes);
+        let $1 = do_add_children(handlers$1, children, vdoms, path, 0, nodes$1);
+        let handlers$2 = $1.handlers;
+        let children$1 = $1.children;
+        let vdoms$1 = $1.vdoms;
+        loop$handlers = handlers$2;
+        loop$children = children$1;
+        loop$vdoms = vdoms$1;
+        loop$parent = parent;
+        loop$child_index = next;
+        loop$nodes = rest;
+      } else if ($ instanceof Text) {
+        let rest = nodes.tail;
+        loop$handlers = handlers;
+        loop$children = children;
+        loop$vdoms = vdoms;
+        loop$parent = parent;
+        loop$child_index = next;
+        loop$nodes = rest;
+      } else if ($ instanceof UnsafeInnerHtml) {
+        let rest = nodes.tail;
+        let key = $.key;
+        let attributes = $.attributes;
+        let path = add2(parent, child_index, key);
+        let handlers$1 = add_attributes(handlers, path, attributes);
+        loop$handlers = handlers$1;
+        loop$children = children;
+        loop$vdoms = vdoms;
+        loop$parent = parent;
+        loop$child_index = next;
+        loop$nodes = rest;
+      } else if ($ instanceof Map2) {
+        let rest = nodes.tail;
+        let key = $.key;
+        let mapper = $.mapper;
+        let child2 = $.child;
+        let path = add2(parent, child_index, key);
+        let added = do_add_children(empty2(), empty2(), vdoms, subtree(path), 0, singleton_list(child2));
+        let vdoms$1 = added.vdoms;
+        let child_events = new Events(added.handlers, added.children);
+        let child$1 = new Child(mapper, child_events);
+        let children$1 = insert2(children, child(path), child$1);
+        loop$handlers = handlers;
+        loop$children = children$1;
+        loop$vdoms = vdoms$1;
+        loop$parent = parent;
+        loop$child_index = next;
+        loop$nodes = rest;
+      } else {
+        let rest = nodes.tail;
+        let view = $.view;
+        let child_node = view();
+        let vdoms$1 = insert2(vdoms, view, child_node);
+        let next$1 = child_index;
+        let rest$1 = prepend(child_node, rest);
+        loop$handlers = handlers;
+        loop$children = children;
+        loop$vdoms = vdoms$1;
+        loop$parent = parent;
+        loop$child_index = next$1;
+        loop$nodes = rest$1;
+      }
+    }
+  }
+}
+function add_children(cache, events, path, child_index, nodes) {
+  let vdoms = cache.vdoms;
+  let handlers = events.handlers;
+  let children = events.children;
+  let $ = do_add_children(handlers, children, vdoms, path, child_index, nodes);
+  let handlers$1 = $.handlers;
+  let children$1 = $.children;
+  let vdoms$1 = $.vdoms;
+  return [
+    new Cache(cache.events, vdoms$1, cache.old_vdoms, cache.dispatched_paths, cache.next_dispatched_paths),
+    new Events(handlers$1, children$1)
+  ];
+}
+function add_child(cache, events, parent, index4, child2) {
+  let children = singleton_list(child2);
+  return add_children(cache, events, parent, index4, children);
+}
+function from_node(root2) {
+  let cache = new$4();
+  let $ = add_child(cache, cache.events, root, 0, root2);
+  let cache$1 = $[0];
+  let events$1 = $[1];
+  return new Cache(events$1, cache$1.vdoms, cache$1.old_vdoms, cache$1.dispatched_paths, cache$1.next_dispatched_paths);
+}
+function tick(cache) {
+  return new Cache(cache.events, empty2(), cache.vdoms, cache.next_dispatched_paths, empty_list);
+}
+function events(cache) {
+  return cache.events;
+}
+function update_events(cache, events2) {
+  return new Cache(events2, cache.vdoms, cache.old_vdoms, cache.dispatched_paths, cache.next_dispatched_paths);
+}
+function memos(cache) {
+  return cache.vdoms;
+}
+function get_old_memo(cache, old, new$5) {
+  return get_or_compute(cache.old_vdoms, old, new$5);
+}
+function keep_memo(cache, old, new$5) {
+  let node = get_or_compute(cache.old_vdoms, old, new$5);
+  let vdoms = insert2(cache.vdoms, new$5, node);
+  return new Cache(cache.events, vdoms, cache.old_vdoms, cache.dispatched_paths, cache.next_dispatched_paths);
+}
+function add_memo(cache, new$5, node) {
+  let vdoms = insert2(cache.vdoms, new$5, node);
+  return new Cache(cache.events, vdoms, cache.old_vdoms, cache.dispatched_paths, cache.next_dispatched_paths);
+}
+function get_subtree(events2, path, old_mapper) {
+  let child2 = get_or_compute(events2.children, path, () => {
+    return new Child(old_mapper, new_events());
+  });
+  return child2.events;
+}
+function update_subtree(parent, path, mapper, events2) {
+  let new_child = new Child(mapper, events2);
+  let children = insert2(parent.children, path, new_child);
+  return new Events(parent.handlers, children);
+}
+function add_event(events2, path, name, handler) {
+  let handlers = do_add_event(events2.handlers, path, name, handler);
+  return new Events(handlers, events2.children);
+}
+function do_remove_event(handlers, path, name) {
+  return remove(handlers, event2(path, name));
+}
+function remove_event(events2, path, name) {
+  let handlers = do_remove_event(events2.handlers, path, name);
+  return new Events(handlers, events2.children);
+}
+function remove_attributes(handlers, path, attributes) {
+  return fold2(attributes, handlers, (events2, attribute3) => {
+    if (attribute3 instanceof Event2) {
+      let name = attribute3.name;
+      return do_remove_event(events2, path, name);
+    } else {
+      return events2;
+    }
+  });
+}
+function do_remove_children(loop$handlers, loop$children, loop$vdoms, loop$parent, loop$index, loop$nodes) {
+  while (true) {
+    let handlers = loop$handlers;
+    let children = loop$children;
+    let vdoms = loop$vdoms;
+    let parent = loop$parent;
+    let index4 = loop$index;
+    let nodes = loop$nodes;
+    let next = index4 + 1;
+    if (nodes instanceof Empty) {
+      return new Events(handlers, children);
+    } else {
+      let $ = nodes.head;
+      if ($ instanceof Fragment) {
+        let rest = nodes.tail;
+        let key = $.key;
+        let nodes$1 = $.children;
+        let path = add2(parent, index4, key);
+        let $1 = do_remove_children(handlers, children, vdoms, path, 0, nodes$1);
+        let handlers$1 = $1.handlers;
+        let children$1 = $1.children;
+        loop$handlers = handlers$1;
+        loop$children = children$1;
+        loop$vdoms = vdoms;
+        loop$parent = parent;
+        loop$index = next;
+        loop$nodes = rest;
+      } else if ($ instanceof Element2) {
+        let rest = nodes.tail;
+        let key = $.key;
+        let attributes = $.attributes;
+        let nodes$1 = $.children;
+        let path = add2(parent, index4, key);
+        let handlers$1 = remove_attributes(handlers, path, attributes);
+        let $1 = do_remove_children(handlers$1, children, vdoms, path, 0, nodes$1);
+        let handlers$2 = $1.handlers;
+        let children$1 = $1.children;
+        loop$handlers = handlers$2;
+        loop$children = children$1;
+        loop$vdoms = vdoms;
+        loop$parent = parent;
+        loop$index = next;
+        loop$nodes = rest;
+      } else if ($ instanceof Text) {
+        let rest = nodes.tail;
+        loop$handlers = handlers;
+        loop$children = children;
+        loop$vdoms = vdoms;
+        loop$parent = parent;
+        loop$index = next;
+        loop$nodes = rest;
+      } else if ($ instanceof UnsafeInnerHtml) {
+        let rest = nodes.tail;
+        let key = $.key;
+        let attributes = $.attributes;
+        let path = add2(parent, index4, key);
+        let handlers$1 = remove_attributes(handlers, path, attributes);
+        loop$handlers = handlers$1;
+        loop$children = children;
+        loop$vdoms = vdoms;
+        loop$parent = parent;
+        loop$index = next;
+        loop$nodes = rest;
+      } else if ($ instanceof Map2) {
+        let rest = nodes.tail;
+        let key = $.key;
+        let path = add2(parent, index4, key);
+        let children$1 = remove(children, child(path));
+        loop$handlers = handlers;
+        loop$children = children$1;
+        loop$vdoms = vdoms;
+        loop$parent = parent;
+        loop$index = next;
+        loop$nodes = rest;
+      } else {
+        let rest = nodes.tail;
+        let view = $.view;
+        let $1 = has_key(vdoms, view);
+        if ($1) {
+          let child2 = get2(vdoms, view);
+          let nodes$1 = prepend(child2, rest);
+          loop$handlers = handlers;
+          loop$children = children;
+          loop$vdoms = vdoms;
+          loop$parent = parent;
+          loop$index = index4;
+          loop$nodes = nodes$1;
+        } else {
+          loop$handlers = handlers;
+          loop$children = children;
+          loop$vdoms = vdoms;
+          loop$parent = parent;
+          loop$index = next;
+          loop$nodes = rest;
+        }
+      }
+    }
+  }
+}
+function remove_child(cache, events2, parent, child_index, child2) {
+  return do_remove_children(events2.handlers, events2.children, cache.old_vdoms, parent, child_index, singleton_list(child2));
+}
+function replace_child(cache, events2, parent, child_index, prev, next) {
+  let events$1 = remove_child(cache, events2, parent, child_index, prev);
+  return add_child(cache, events$1, parent, child_index, next);
+}
+function get_handler(loop$events, loop$path, loop$mapper) {
+  while (true) {
+    let events2 = loop$events;
+    let path = loop$path;
+    let mapper = loop$mapper;
+    if (path instanceof Empty) {
+      return error_nil;
+    } else {
+      let $ = path.tail;
+      if ($ instanceof Empty) {
+        let key = path.head;
+        let $1 = has_key(events2.handlers, key);
+        if ($1) {
+          let handler = get2(events2.handlers, key);
+          return new Ok(map4(handler, (handler2) => {
+            return new Handler(handler2.prevent_default, handler2.stop_propagation, identity3(mapper)(handler2.message));
+          }));
+        } else {
+          return error_nil;
+        }
+      } else {
+        let key = path.head;
+        let path$1 = $;
+        let $1 = has_key(events2.children, key);
+        if ($1) {
+          let child2 = get2(events2.children, key);
+          let mapper$1 = compose_mapper(mapper, child2.mapper);
+          loop$events = child2.events;
+          loop$path = path$1;
+          loop$mapper = mapper$1;
+        } else {
+          return error_nil;
+        }
+      }
+    }
+  }
+}
+function decode2(cache, path, name, event3) {
+  let parts = split_subtree_path(path + separator_event + name);
+  let $ = get_handler(cache.events, parts, identity3);
+  if ($ instanceof Ok) {
+    let handler = $[0];
+    let $1 = run(event3, handler);
+    if ($1 instanceof Ok) {
+      let handler$1 = $1[0];
+      return new DecodedEvent(path, handler$1);
+    } else {
+      return new DispatchedEvent(path);
+    }
+  } else {
+    return new DispatchedEvent(path);
+  }
+}
+function dispatch(cache, event3) {
+  let next_dispatched_paths = prepend(event3.path, cache.next_dispatched_paths);
+  let cache$1 = new Cache(cache.events, cache.vdoms, cache.old_vdoms, cache.dispatched_paths, next_dispatched_paths);
+  if (event3 instanceof DecodedEvent) {
+    let handler = event3.handler;
+    return [cache$1, new Ok(handler)];
+  } else {
+    return [cache$1, error_nil];
+  }
+}
+function handle(cache, path, name, event3) {
+  let _pipe = decode2(cache, path, name, event3);
+  return ((_capture) => {
+    return dispatch(cache, _capture);
+  })(_pipe);
+}
+function has_dispatched_events(cache, path) {
+  return matches(path, cache.dispatched_paths);
+}
+
+// build/dev/javascript/lustre/lustre/runtime/server/runtime.mjs
+class ClientDispatchedMessage extends CustomType {
+  constructor(message) {
+    super();
+    this.message = message;
+  }
+}
+var Message$isClientDispatchedMessage = (value2) => value2 instanceof ClientDispatchedMessage;
+class ClientRegisteredCallback extends CustomType {
+  constructor(callback) {
+    super();
+    this.callback = callback;
+  }
+}
+var Message$isClientRegisteredCallback = (value2) => value2 instanceof ClientRegisteredCallback;
+class ClientDeregisteredCallback extends CustomType {
+  constructor(callback) {
+    super();
+    this.callback = callback;
+  }
+}
+var Message$isClientDeregisteredCallback = (value2) => value2 instanceof ClientDeregisteredCallback;
+class EffectDispatchedMessage extends CustomType {
+  constructor(message) {
+    super();
+    this.message = message;
+  }
+}
+var Message$EffectDispatchedMessage = (message) => new EffectDispatchedMessage(message);
+var Message$isEffectDispatchedMessage = (value2) => value2 instanceof EffectDispatchedMessage;
+class EffectEmitEvent extends CustomType {
+  constructor(name, data) {
+    super();
+    this.name = name;
+    this.data = data;
+  }
+}
+var Message$EffectEmitEvent = (name, data) => new EffectEmitEvent(name, data);
+var Message$isEffectEmitEvent = (value2) => value2 instanceof EffectEmitEvent;
+class EffectProvidedValue extends CustomType {
+  constructor(key, value2) {
+    super();
+    this.key = key;
+    this.value = value2;
+  }
+}
+var Message$EffectProvidedValue = (key, value2) => new EffectProvidedValue(key, value2);
+var Message$isEffectProvidedValue = (value2) => value2 instanceof EffectProvidedValue;
+class EffectRequestedContextSubscription extends CustomType {
+  constructor(key, decoder) {
+    super();
+    this.key = key;
+    this.decoder = decoder;
+  }
+}
+var Message$EffectRequestedContextSubscription = (key, decoder) => new EffectRequestedContextSubscription(key, decoder);
+var Message$isEffectRequestedContextSubscription = (value2) => value2 instanceof EffectRequestedContextSubscription;
+class EffectRemovedContextSubscription extends CustomType {
+  constructor(key) {
+    super();
+    this.key = key;
+  }
+}
+var Message$EffectRemovedContextSubscription = (key) => new EffectRemovedContextSubscription(key);
+var Message$isEffectRemovedContextSubscription = (value2) => value2 instanceof EffectRemovedContextSubscription;
+class SystemRequestedShutdown extends CustomType {
+}
+var Message$SystemRequestedShutdown$const = new SystemRequestedShutdown;
+var Message$isSystemRequestedShutdown = (value2) => value2 instanceof SystemRequestedShutdown;
+
+// build/dev/javascript/lustre/lustre/runtime/app.mjs
+class App extends CustomType {
+  constructor(name, init, update2, view, config) {
+    super();
+    this.name = name;
+    this.init = init;
+    this.update = update2;
+    this.view = view;
+    this.config = config;
+  }
+}
+class Config2 extends CustomType {
+  constructor(open_shadow_root, adopt_styles, delegates_focus, attributes, properties, contexts, is_form_associated, on_form_autofill, on_form_reset, on_form_restore, on_form_disabled, on_connect, on_adopt, on_disconnect) {
+    super();
+    this.open_shadow_root = open_shadow_root;
+    this.adopt_styles = adopt_styles;
+    this.delegates_focus = delegates_focus;
+    this.attributes = attributes;
+    this.properties = properties;
+    this.contexts = contexts;
+    this.is_form_associated = is_form_associated;
+    this.on_form_autofill = on_form_autofill;
+    this.on_form_reset = on_form_reset;
+    this.on_form_restore = on_form_restore;
+    this.on_form_disabled = on_form_disabled;
+    this.on_connect = on_connect;
+    this.on_adopt = on_adopt;
+    this.on_disconnect = on_disconnect;
+  }
+}
+var default_config = /* @__PURE__ */ new Config2(true, true, false, empty_list, empty_list, empty_list, false, Option$None$const, Option$None$const, Option$None$const, Option$None$const, Option$None$const, Option$None$const, Option$None$const);
+
+// build/dev/javascript/lustre/lustre/internals/equals.ffi.mjs
+var isEqual2 = (a2, b) => {
+  if (a2 === b) {
+    return true;
+  }
+  if (a2 == null || b == null) {
+    return false;
+  }
+  const type = typeof a2;
+  if (type !== typeof b) {
+    return false;
+  }
+  if (type !== "object") {
+    return false;
+  }
+  const ctor = a2.constructor;
+  if (ctor !== b.constructor) {
+    return false;
+  }
+  if (Array.isArray(a2)) {
+    return areArraysEqual(a2, b);
+  }
+  return areObjectsEqual(a2, b);
+};
+var areArraysEqual = (a2, b) => {
+  let index4 = a2.length;
+  if (index4 !== b.length) {
+    return false;
+  }
+  while (index4--) {
+    if (!isEqual2(a2[index4], b[index4])) {
+      return false;
+    }
+  }
+  return true;
+};
+var areObjectsEqual = (a2, b) => {
+  const properties = Object.keys(a2);
+  let index4 = properties.length;
+  if (Object.keys(b).length !== index4) {
+    return false;
+  }
+  while (index4--) {
+    const property3 = properties[index4];
+    if (!Object.hasOwn(b, property3)) {
+      return false;
+    }
+    if (!isEqual2(a2[property3], b[property3])) {
+      return false;
+    }
+  }
+  return true;
+};
+
+// build/dev/javascript/lustre/lustre/vdom/diff.mjs
+class Diff extends CustomType {
+  constructor(patch, cache) {
+    super();
+    this.patch = patch;
+    this.cache = cache;
+  }
+}
+class PartialDiff extends CustomType {
+  constructor(patch, cache, events2) {
+    super();
+    this.patch = patch;
+    this.cache = cache;
+    this.events = events2;
+  }
+}
+
+class AttributeChange extends CustomType {
+  constructor(added, removed, events2) {
+    super();
+    this.added = added;
+    this.removed = removed;
+    this.events = events2;
+  }
+}
+function diff_attributes(loop$controlled, loop$path, loop$events, loop$old, loop$new, loop$added, loop$removed) {
+  while (true) {
+    let controlled = loop$controlled;
+    let path = loop$path;
+    let events2 = loop$events;
+    let old = loop$old;
+    let new$5 = loop$new;
+    let added = loop$added;
+    let removed = loop$removed;
+    if (old instanceof Empty) {
+      if (new$5 instanceof Empty) {
+        return new AttributeChange(added, removed, events2);
+      } else {
+        let $ = new$5.head;
+        if ($ instanceof Event2) {
+          let next = $;
+          let new$1 = new$5.tail;
+          let name = $.name;
+          let handler = $.handler;
+          let events$1 = add_event(events2, path, name, handler);
+          let added$1 = prepend(next, added);
+          loop$controlled = controlled;
+          loop$path = path;
+          loop$events = events$1;
+          loop$old = old;
+          loop$new = new$1;
+          loop$added = added$1;
+          loop$removed = removed;
+        } else {
+          let next = $;
+          let new$1 = new$5.tail;
+          let added$1 = prepend(next, added);
+          loop$controlled = controlled;
+          loop$path = path;
+          loop$events = events2;
+          loop$old = old;
+          loop$new = new$1;
+          loop$added = added$1;
+          loop$removed = removed;
+        }
+      }
+    } else if (new$5 instanceof Empty) {
+      let $ = old.head;
+      if ($ instanceof Event2) {
+        let prev = $;
+        let old$1 = old.tail;
+        let name = $.name;
+        let events$1 = remove_event(events2, path, name);
+        let removed$1 = prepend(prev, removed);
+        loop$controlled = controlled;
+        loop$path = path;
+        loop$events = events$1;
+        loop$old = old$1;
+        loop$new = new$5;
+        loop$added = added;
+        loop$removed = removed$1;
+      } else {
+        let prev = $;
+        let old$1 = old.tail;
+        let removed$1 = prepend(prev, removed);
+        loop$controlled = controlled;
+        loop$path = path;
+        loop$events = events2;
+        loop$old = old$1;
+        loop$new = new$5;
+        loop$added = added;
+        loop$removed = removed$1;
+      }
+    } else {
+      let prev = old.head;
+      let remaining_old = old.tail;
+      let next = new$5.head;
+      let remaining_new = new$5.tail;
+      let $ = compare3(prev, next);
+      if ($ instanceof Lt) {
+        if (prev instanceof Event2) {
+          let name = prev.name;
+          loop$controlled = controlled;
+          loop$path = path;
+          loop$events = remove_event(events2, path, name);
+          loop$old = remaining_old;
+          loop$new = new$5;
+          loop$added = added;
+          loop$removed = prepend(prev, removed);
+        } else {
+          loop$controlled = controlled;
+          loop$path = path;
+          loop$events = events2;
+          loop$old = remaining_old;
+          loop$new = new$5;
+          loop$added = added;
+          loop$removed = prepend(prev, removed);
+        }
+      } else if ($ instanceof Eq) {
+        if (prev instanceof Attribute) {
+          if (next instanceof Attribute) {
+            let _block;
+            let $1 = next.name;
+            if ($1 === "value") {
+              _block = controlled || prev.value !== next.value;
+            } else if ($1 === "checked") {
+              _block = controlled || prev.value !== next.value;
+            } else if ($1 === "selected") {
+              _block = controlled || prev.value !== next.value;
+            } else {
+              _block = prev.value !== next.value;
+            }
+            let has_changes = _block;
+            let _block$1;
+            if (has_changes) {
+              _block$1 = prepend(next, added);
+            } else {
+              _block$1 = added;
+            }
+            let added$1 = _block$1;
+            loop$controlled = controlled;
+            loop$path = path;
+            loop$events = events2;
+            loop$old = remaining_old;
+            loop$new = remaining_new;
+            loop$added = added$1;
+            loop$removed = removed;
+          } else if (next instanceof Event2) {
+            let name = next.name;
+            let handler = next.handler;
+            loop$controlled = controlled;
+            loop$path = path;
+            loop$events = add_event(events2, path, name, handler);
+            loop$old = remaining_old;
+            loop$new = remaining_new;
+            loop$added = prepend(next, added);
+            loop$removed = prepend(prev, removed);
+          } else {
+            loop$controlled = controlled;
+            loop$path = path;
+            loop$events = events2;
+            loop$old = remaining_old;
+            loop$new = remaining_new;
+            loop$added = prepend(next, added);
+            loop$removed = prepend(prev, removed);
+          }
+        } else if (prev instanceof Property) {
+          if (next instanceof Property) {
+            let _block;
+            let $1 = next.name;
+            if ($1 === "scrollLeft") {
+              _block = true;
+            } else if ($1 === "scrollRight") {
+              _block = true;
+            } else if ($1 === "value") {
+              _block = controlled || !isEqual2(prev.value, next.value);
+            } else if ($1 === "checked") {
+              _block = controlled || !isEqual2(prev.value, next.value);
+            } else if ($1 === "selected") {
+              _block = controlled || !isEqual2(prev.value, next.value);
+            } else {
+              _block = !isEqual2(prev.value, next.value);
+            }
+            let has_changes = _block;
+            let _block$1;
+            if (has_changes) {
+              _block$1 = prepend(next, added);
+            } else {
+              _block$1 = added;
+            }
+            let added$1 = _block$1;
+            loop$controlled = controlled;
+            loop$path = path;
+            loop$events = events2;
+            loop$old = remaining_old;
+            loop$new = remaining_new;
+            loop$added = added$1;
+            loop$removed = removed;
+          } else if (next instanceof Event2) {
+            let name = next.name;
+            let handler = next.handler;
+            loop$controlled = controlled;
+            loop$path = path;
+            loop$events = add_event(events2, path, name, handler);
+            loop$old = remaining_old;
+            loop$new = remaining_new;
+            loop$added = prepend(next, added);
+            loop$removed = prepend(prev, removed);
+          } else {
+            loop$controlled = controlled;
+            loop$path = path;
+            loop$events = events2;
+            loop$old = remaining_old;
+            loop$new = remaining_new;
+            loop$added = prepend(next, added);
+            loop$removed = prepend(prev, removed);
+          }
+        } else if (next instanceof Event2) {
+          let name = next.name;
+          let handler = next.handler;
+          let has_changes = prev.prevent_default.kind !== next.prevent_default.kind || prev.stop_propagation.kind !== next.stop_propagation.kind || prev.debounce !== next.debounce || prev.throttle !== next.throttle;
+          let _block;
+          if (has_changes) {
+            _block = prepend(next, added);
+          } else {
+            _block = added;
+          }
+          let added$1 = _block;
+          loop$controlled = controlled;
+          loop$path = path;
+          loop$events = add_event(events2, path, name, handler);
+          loop$old = remaining_old;
+          loop$new = remaining_new;
+          loop$added = added$1;
+          loop$removed = removed;
+        } else {
+          let name = prev.name;
+          loop$controlled = controlled;
+          loop$path = path;
+          loop$events = remove_event(events2, path, name);
+          loop$old = remaining_old;
+          loop$new = remaining_new;
+          loop$added = prepend(next, added);
+          loop$removed = prepend(prev, removed);
+        }
+      } else if (next instanceof Event2) {
+        let name = next.name;
+        let handler = next.handler;
+        loop$controlled = controlled;
+        loop$path = path;
+        loop$events = add_event(events2, path, name, handler);
+        loop$old = old;
+        loop$new = remaining_new;
+        loop$added = prepend(next, added);
+        loop$removed = removed;
+      } else {
+        loop$controlled = controlled;
+        loop$path = path;
+        loop$events = events2;
+        loop$old = old;
+        loop$new = remaining_new;
+        loop$added = prepend(next, added);
+        loop$removed = removed;
+      }
+    }
+  }
+}
+function is_controlled(cache, namespace, tag, path) {
+  if (tag === "input" && namespace === "") {
+    return has_dispatched_events(cache, path);
+  } else if (tag === "select" && namespace === "") {
+    return has_dispatched_events(cache, path);
+  } else if (tag === "textarea" && namespace === "") {
+    return has_dispatched_events(cache, path);
+  } else {
+    return false;
+  }
+}
+function do_diff(loop$old, loop$old_keyed, loop$new, loop$new_keyed, loop$moved, loop$moved_offset, loop$removed, loop$node_index, loop$patch_index, loop$changes, loop$children, loop$path, loop$cache, loop$events) {
+  while (true) {
+    let old = loop$old;
+    let old_keyed = loop$old_keyed;
+    let new$5 = loop$new;
+    let new_keyed = loop$new_keyed;
+    let moved = loop$moved;
+    let moved_offset = loop$moved_offset;
+    let removed = loop$removed;
+    let node_index = loop$node_index;
+    let patch_index = loop$patch_index;
+    let changes = loop$changes;
+    let children = loop$children;
+    let path = loop$path;
+    let cache = loop$cache;
+    let events2 = loop$events;
+    if (old instanceof Empty) {
+      if (new$5 instanceof Empty) {
+        let _block;
+        let $ = is_browser();
+        if (changes instanceof Empty) {
+          if (children instanceof Empty) {
+            _block = new$3(patch_index, removed, changes, children);
+          } else if (!$ && children.tail instanceof Empty && removed === 0) {
+            let child2 = children.head;
+            _block = add_parent(child2, patch_index);
+          } else {
+            _block = new$3(patch_index, removed, changes, children);
+          }
+        } else {
+          _block = new$3(patch_index, removed, changes, children);
+        }
+        let patch = _block;
+        return new PartialDiff(patch, cache, events2);
+      } else {
+        let $ = add_children(cache, events2, path, node_index, new$5);
+        let cache$1 = $[0];
+        let events$1 = $[1];
+        let insert4 = insert3(new$5, node_index - moved_offset);
+        let changes$1 = prepend(insert4, changes);
+        let patch = new$3(patch_index, removed, changes$1, children);
+        return new PartialDiff(patch, cache$1, events$1);
+      }
+    } else if (new$5 instanceof Empty) {
+      let prev = old.head;
+      let old$1 = old.tail;
+      let $ = prev.key === "" || !has_key(moved, prev.key);
+      if ($) {
+        let events$1 = remove_child(cache, events2, path, node_index, prev);
+        loop$old = old$1;
+        loop$old_keyed = old_keyed;
+        loop$new = new$5;
+        loop$new_keyed = new_keyed;
+        loop$moved = moved;
+        loop$moved_offset = moved_offset;
+        loop$removed = removed + 1;
+        loop$node_index = node_index;
+        loop$patch_index = patch_index;
+        loop$changes = changes;
+        loop$children = children;
+        loop$path = path;
+        loop$cache = cache;
+        loop$events = events$1;
+      } else {
+        loop$old = old$1;
+        loop$old_keyed = old_keyed;
+        loop$new = new$5;
+        loop$new_keyed = new_keyed;
+        loop$moved = moved;
+        loop$moved_offset = moved_offset;
+        loop$removed = removed;
+        loop$node_index = node_index;
+        loop$patch_index = patch_index;
+        loop$changes = changes;
+        loop$children = children;
+        loop$path = path;
+        loop$cache = cache;
+        loop$events = events2;
+      }
+    } else {
+      let prev = old.head;
+      let next = new$5.head;
+      if (prev.key !== next.key) {
+        let old_remaining = old.tail;
+        let new_remaining = new$5.tail;
+        let next_did_exist = has_key(old_keyed, next.key);
+        let prev_does_exist = has_key(new_keyed, prev.key);
+        if (prev_does_exist) {
+          if (next_did_exist) {
+            let $ = has_key(moved, prev.key);
+            if ($) {
+              loop$old = old_remaining;
+              loop$old_keyed = old_keyed;
+              loop$new = new$5;
+              loop$new_keyed = new_keyed;
+              loop$moved = moved;
+              loop$moved_offset = moved_offset - 1;
+              loop$removed = removed;
+              loop$node_index = node_index;
+              loop$patch_index = patch_index;
+              loop$changes = changes;
+              loop$children = children;
+              loop$path = path;
+              loop$cache = cache;
+              loop$events = events2;
+            } else {
+              let match = get2(old_keyed, next.key);
+              let before = node_index - moved_offset;
+              let changes$1 = prepend(move(next.key, before), changes);
+              let moved$1 = insert2(moved, next.key, undefined);
+              loop$old = prepend(match, old);
+              loop$old_keyed = old_keyed;
+              loop$new = new$5;
+              loop$new_keyed = new_keyed;
+              loop$moved = moved$1;
+              loop$moved_offset = moved_offset + 1;
+              loop$removed = removed;
+              loop$node_index = node_index;
+              loop$patch_index = patch_index;
+              loop$changes = changes$1;
+              loop$children = children;
+              loop$path = path;
+              loop$cache = cache;
+              loop$events = events2;
+            }
+          } else {
+            let before = node_index - moved_offset;
+            let $ = add_child(cache, events2, path, node_index, next);
+            let cache$1 = $[0];
+            let events$1 = $[1];
+            let insert4 = insert3(singleton_list(next), before);
+            let changes$1 = prepend(insert4, changes);
+            loop$old = old;
+            loop$old_keyed = old_keyed;
+            loop$new = new_remaining;
+            loop$new_keyed = new_keyed;
+            loop$moved = moved;
+            loop$moved_offset = moved_offset + 1;
+            loop$removed = removed;
+            loop$node_index = node_index + 1;
+            loop$patch_index = patch_index;
+            loop$changes = changes$1;
+            loop$children = children;
+            loop$path = path;
+            loop$cache = cache$1;
+            loop$events = events$1;
+          }
+        } else if (next_did_exist) {
+          let index4 = node_index - moved_offset;
+          let changes$1 = prepend(remove2(index4), changes);
+          let events$1 = remove_child(cache, events2, path, node_index, prev);
+          loop$old = old_remaining;
+          loop$old_keyed = old_keyed;
+          loop$new = new$5;
+          loop$new_keyed = new_keyed;
+          loop$moved = moved;
+          loop$moved_offset = moved_offset - 1;
+          loop$removed = removed;
+          loop$node_index = node_index;
+          loop$patch_index = patch_index;
+          loop$changes = changes$1;
+          loop$children = children;
+          loop$path = path;
+          loop$cache = cache;
+          loop$events = events$1;
+        } else {
+          let change = replace2(node_index - moved_offset, next);
+          let $ = replace_child(cache, events2, path, node_index, prev, next);
+          let cache$1 = $[0];
+          let events$1 = $[1];
+          loop$old = old_remaining;
+          loop$old_keyed = old_keyed;
+          loop$new = new_remaining;
+          loop$new_keyed = new_keyed;
+          loop$moved = moved;
+          loop$moved_offset = moved_offset;
+          loop$removed = removed;
+          loop$node_index = node_index + 1;
+          loop$patch_index = patch_index;
+          loop$changes = prepend(change, changes);
+          loop$children = children;
+          loop$path = path;
+          loop$cache = cache$1;
+          loop$events = events$1;
+        }
+      } else {
+        let $ = old.head;
+        if ($ instanceof Fragment) {
+          let $1 = new$5.head;
+          if ($1 instanceof Fragment) {
+            let prev$1 = $;
+            let old$1 = old.tail;
+            let next$1 = $1;
+            let new$1 = new$5.tail;
+            let $2 = do_diff(prev$1.children, prev$1.keyed_children, next$1.children, next$1.keyed_children, empty2(), 0, 0, 0, node_index, empty_list, empty_list, add2(path, node_index, next$1.key), cache, events2);
+            let patch = $2.patch;
+            let cache$1 = $2.cache;
+            let events$1 = $2.events;
+            let _block;
+            if (patch.changes instanceof Empty && patch.children instanceof Empty && patch.removed === 0) {
+              _block = children;
+            } else {
+              _block = prepend(patch, children);
+            }
+            let children$1 = _block;
+            loop$old = old$1;
+            loop$old_keyed = old_keyed;
+            loop$new = new$1;
+            loop$new_keyed = new_keyed;
+            loop$moved = moved;
+            loop$moved_offset = moved_offset;
+            loop$removed = removed;
+            loop$node_index = node_index + 1;
+            loop$patch_index = patch_index;
+            loop$changes = changes;
+            loop$children = children$1;
+            loop$path = path;
+            loop$cache = cache$1;
+            loop$events = events$1;
+          } else {
+            let prev$1 = $;
+            let old_remaining$1 = old.tail;
+            let next$1 = $1;
+            let new_remaining$1 = new$5.tail;
+            let change = replace2(node_index - moved_offset, next$1);
+            let $2 = replace_child(cache, events2, path, node_index, prev$1, next$1);
+            let cache$1 = $2[0];
+            let events$1 = $2[1];
+            loop$old = old_remaining$1;
+            loop$old_keyed = old_keyed;
+            loop$new = new_remaining$1;
+            loop$new_keyed = new_keyed;
+            loop$moved = moved;
+            loop$moved_offset = moved_offset;
+            loop$removed = removed;
+            loop$node_index = node_index + 1;
+            loop$patch_index = patch_index;
+            loop$changes = prepend(change, changes);
+            loop$children = children;
+            loop$path = path;
+            loop$cache = cache$1;
+            loop$events = events$1;
+          }
+        } else if ($ instanceof Element2) {
+          let $1 = new$5.head;
+          if ($1 instanceof Element2) {
+            let prev$1 = $;
+            let next$1 = $1;
+            if (prev$1.namespace === next$1.namespace && prev$1.tag === next$1.tag) {
+              let old$1 = old.tail;
+              let new$1 = new$5.tail;
+              let child_path = add2(path, node_index, next$1.key);
+              let controlled = is_controlled(cache, next$1.namespace, next$1.tag, child_path);
+              let $2 = diff_attributes(controlled, child_path, events2, prev$1.attributes, next$1.attributes, empty_list, empty_list);
+              let added_attrs = $2.added;
+              let removed_attrs = $2.removed;
+              let events$1 = $2.events;
+              let _block;
+              if (added_attrs instanceof Empty && removed_attrs instanceof Empty) {
+                _block = empty_list;
+              } else {
+                _block = singleton_list(update(added_attrs, removed_attrs));
+              }
+              let initial_child_changes = _block;
+              let $3 = do_diff(prev$1.children, prev$1.keyed_children, next$1.children, next$1.keyed_children, empty2(), 0, 0, 0, node_index, initial_child_changes, empty_list, child_path, cache, events$1);
+              let patch = $3.patch;
+              let cache$1 = $3.cache;
+              let events$2 = $3.events;
+              let _block$1;
+              if (patch.changes instanceof Empty && patch.children instanceof Empty && patch.removed === 0) {
+                _block$1 = children;
+              } else {
+                _block$1 = prepend(patch, children);
+              }
+              let children$1 = _block$1;
+              loop$old = old$1;
+              loop$old_keyed = old_keyed;
+              loop$new = new$1;
+              loop$new_keyed = new_keyed;
+              loop$moved = moved;
+              loop$moved_offset = moved_offset;
+              loop$removed = removed;
+              loop$node_index = node_index + 1;
+              loop$patch_index = patch_index;
+              loop$changes = changes;
+              loop$children = children$1;
+              loop$path = path;
+              loop$cache = cache$1;
+              loop$events = events$2;
+            } else {
+              let prev$2 = $;
+              let old_remaining$1 = old.tail;
+              let next$2 = $1;
+              let new_remaining$1 = new$5.tail;
+              let change = replace2(node_index - moved_offset, next$2);
+              let $4 = replace_child(cache, events2, path, node_index, prev$2, next$2);
+              let cache$2 = $4[0];
+              let events$3 = $4[1];
+              loop$old = old_remaining$1;
+              loop$old_keyed = old_keyed;
+              loop$new = new_remaining$1;
+              loop$new_keyed = new_keyed;
+              loop$moved = moved;
+              loop$moved_offset = moved_offset;
+              loop$removed = removed;
+              loop$node_index = node_index + 1;
+              loop$patch_index = patch_index;
+              loop$changes = prepend(change, changes);
+              loop$children = children;
+              loop$path = path;
+              loop$cache = cache$2;
+              loop$events = events$3;
+            }
+          } else {
+            let prev$1 = $;
+            let old_remaining$1 = old.tail;
+            let next$1 = $1;
+            let new_remaining$1 = new$5.tail;
+            let change = replace2(node_index - moved_offset, next$1);
+            let $2 = replace_child(cache, events2, path, node_index, prev$1, next$1);
+            let cache$1 = $2[0];
+            let events$1 = $2[1];
+            loop$old = old_remaining$1;
+            loop$old_keyed = old_keyed;
+            loop$new = new_remaining$1;
+            loop$new_keyed = new_keyed;
+            loop$moved = moved;
+            loop$moved_offset = moved_offset;
+            loop$removed = removed;
+            loop$node_index = node_index + 1;
+            loop$patch_index = patch_index;
+            loop$changes = prepend(change, changes);
+            loop$children = children;
+            loop$path = path;
+            loop$cache = cache$1;
+            loop$events = events$1;
+          }
+        } else if ($ instanceof Text) {
+          let $1 = new$5.head;
+          if ($1 instanceof Text) {
+            let prev$1 = $;
+            let next$1 = $1;
+            if (prev$1.content === next$1.content) {
+              let old$1 = old.tail;
+              let new$1 = new$5.tail;
+              loop$old = old$1;
+              loop$old_keyed = old_keyed;
+              loop$new = new$1;
+              loop$new_keyed = new_keyed;
+              loop$moved = moved;
+              loop$moved_offset = moved_offset;
+              loop$removed = removed;
+              loop$node_index = node_index + 1;
+              loop$patch_index = patch_index;
+              loop$changes = changes;
+              loop$children = children;
+              loop$path = path;
+              loop$cache = cache;
+              loop$events = events2;
+            } else {
+              let old$2 = old.tail;
+              let next$2 = $1;
+              let new$22 = new$5.tail;
+              let child2 = new$3(node_index, 0, singleton_list(replace_text(next$2.content)), empty_list);
+              loop$old = old$2;
+              loop$old_keyed = old_keyed;
+              loop$new = new$22;
+              loop$new_keyed = new_keyed;
+              loop$moved = moved;
+              loop$moved_offset = moved_offset;
+              loop$removed = removed;
+              loop$node_index = node_index + 1;
+              loop$patch_index = patch_index;
+              loop$changes = changes;
+              loop$children = prepend(child2, children);
+              loop$path = path;
+              loop$cache = cache;
+              loop$events = events2;
+            }
+          } else {
+            let prev$1 = $;
+            let old_remaining$1 = old.tail;
+            let next$1 = $1;
+            let new_remaining$1 = new$5.tail;
+            let change = replace2(node_index - moved_offset, next$1);
+            let $2 = replace_child(cache, events2, path, node_index, prev$1, next$1);
+            let cache$1 = $2[0];
+            let events$1 = $2[1];
+            loop$old = old_remaining$1;
+            loop$old_keyed = old_keyed;
+            loop$new = new_remaining$1;
+            loop$new_keyed = new_keyed;
+            loop$moved = moved;
+            loop$moved_offset = moved_offset;
+            loop$removed = removed;
+            loop$node_index = node_index + 1;
+            loop$patch_index = patch_index;
+            loop$changes = prepend(change, changes);
+            loop$children = children;
+            loop$path = path;
+            loop$cache = cache$1;
+            loop$events = events$1;
+          }
+        } else if ($ instanceof UnsafeInnerHtml) {
+          let $1 = new$5.head;
+          if ($1 instanceof UnsafeInnerHtml) {
+            let prev$1 = $;
+            let old$1 = old.tail;
+            let next$1 = $1;
+            let new$1 = new$5.tail;
+            let child_path = add2(path, node_index, next$1.key);
+            let $2 = diff_attributes(false, child_path, events2, prev$1.attributes, next$1.attributes, empty_list, empty_list);
+            let added_attrs = $2.added;
+            let removed_attrs = $2.removed;
+            let events$1 = $2.events;
+            let _block;
+            if (added_attrs instanceof Empty && removed_attrs instanceof Empty) {
+              _block = empty_list;
+            } else {
+              _block = singleton_list(update(added_attrs, removed_attrs));
+            }
+            let child_changes = _block;
+            let _block$1;
+            let $3 = prev$1.inner_html === next$1.inner_html;
+            if ($3) {
+              _block$1 = child_changes;
+            } else {
+              _block$1 = prepend(replace_inner_html(next$1.inner_html), child_changes);
+            }
+            let child_changes$1 = _block$1;
+            let _block$2;
+            if (child_changes$1 instanceof Empty) {
+              _block$2 = children;
+            } else {
+              _block$2 = prepend(new$3(node_index, 0, child_changes$1, empty_list), children);
+            }
+            let children$1 = _block$2;
+            loop$old = old$1;
+            loop$old_keyed = old_keyed;
+            loop$new = new$1;
+            loop$new_keyed = new_keyed;
+            loop$moved = moved;
+            loop$moved_offset = moved_offset;
+            loop$removed = removed;
+            loop$node_index = node_index + 1;
+            loop$patch_index = patch_index;
+            loop$changes = changes;
+            loop$children = children$1;
+            loop$path = path;
+            loop$cache = cache;
+            loop$events = events$1;
+          } else {
+            let prev$1 = $;
+            let old_remaining$1 = old.tail;
+            let next$1 = $1;
+            let new_remaining$1 = new$5.tail;
+            let change = replace2(node_index - moved_offset, next$1);
+            let $2 = replace_child(cache, events2, path, node_index, prev$1, next$1);
+            let cache$1 = $2[0];
+            let events$1 = $2[1];
+            loop$old = old_remaining$1;
+            loop$old_keyed = old_keyed;
+            loop$new = new_remaining$1;
+            loop$new_keyed = new_keyed;
+            loop$moved = moved;
+            loop$moved_offset = moved_offset;
+            loop$removed = removed;
+            loop$node_index = node_index + 1;
+            loop$patch_index = patch_index;
+            loop$changes = prepend(change, changes);
+            loop$children = children;
+            loop$path = path;
+            loop$cache = cache$1;
+            loop$events = events$1;
+          }
+        } else if ($ instanceof Map2) {
+          let $1 = new$5.head;
+          if ($1 instanceof Map2) {
+            let prev$1 = $;
+            let old$1 = old.tail;
+            let next$1 = $1;
+            let new$1 = new$5.tail;
+            let child_path = add2(path, node_index, next$1.key);
+            let child_key = child(child_path);
+            let $2 = do_diff(singleton_list(prev$1.child), empty2(), singleton_list(next$1.child), empty2(), empty2(), 0, 0, 0, node_index, empty_list, empty_list, subtree(child_path), cache, get_subtree(events2, child_key, prev$1.mapper));
+            let patch = $2.patch;
+            let cache$1 = $2.cache;
+            let child_events = $2.events;
+            let events$1 = update_subtree(events2, child_key, next$1.mapper, child_events);
+            let _block;
+            if (patch.changes instanceof Empty && patch.children instanceof Empty && patch.removed === 0) {
+              _block = children;
+            } else {
+              _block = prepend(patch, children);
+            }
+            let children$1 = _block;
+            loop$old = old$1;
+            loop$old_keyed = old_keyed;
+            loop$new = new$1;
+            loop$new_keyed = new_keyed;
+            loop$moved = moved;
+            loop$moved_offset = moved_offset;
+            loop$removed = removed;
+            loop$node_index = node_index + 1;
+            loop$patch_index = patch_index;
+            loop$changes = changes;
+            loop$children = children$1;
+            loop$path = path;
+            loop$cache = cache$1;
+            loop$events = events$1;
+          } else {
+            let prev$1 = $;
+            let old_remaining$1 = old.tail;
+            let next$1 = $1;
+            let new_remaining$1 = new$5.tail;
+            let change = replace2(node_index - moved_offset, next$1);
+            let $2 = replace_child(cache, events2, path, node_index, prev$1, next$1);
+            let cache$1 = $2[0];
+            let events$1 = $2[1];
+            loop$old = old_remaining$1;
+            loop$old_keyed = old_keyed;
+            loop$new = new_remaining$1;
+            loop$new_keyed = new_keyed;
+            loop$moved = moved;
+            loop$moved_offset = moved_offset;
+            loop$removed = removed;
+            loop$node_index = node_index + 1;
+            loop$patch_index = patch_index;
+            loop$changes = prepend(change, changes);
+            loop$children = children;
+            loop$path = path;
+            loop$cache = cache$1;
+            loop$events = events$1;
+          }
+        } else {
+          let $1 = new$5.head;
+          if ($1 instanceof Memo) {
+            let prev$1 = $;
+            let old$1 = old.tail;
+            let next$1 = $1;
+            let new$1 = new$5.tail;
+            let $2 = equal_lists(prev$1.dependencies, next$1.dependencies);
+            if ($2) {
+              let cache$1 = keep_memo(cache, prev$1.view, next$1.view);
+              loop$old = old$1;
+              loop$old_keyed = old_keyed;
+              loop$new = new$1;
+              loop$new_keyed = new_keyed;
+              loop$moved = moved;
+              loop$moved_offset = moved_offset;
+              loop$removed = removed;
+              loop$node_index = node_index + 1;
+              loop$patch_index = patch_index;
+              loop$changes = changes;
+              loop$children = children;
+              loop$path = path;
+              loop$cache = cache$1;
+              loop$events = events2;
+            } else {
+              let prev_node = get_old_memo(cache, prev$1.view, prev$1.view);
+              let next_node = next$1.view();
+              let cache$1 = add_memo(cache, next$1.view, next_node);
+              loop$old = prepend(prev_node, old$1);
+              loop$old_keyed = old_keyed;
+              loop$new = prepend(next_node, new$1);
+              loop$new_keyed = new_keyed;
+              loop$moved = moved;
+              loop$moved_offset = moved_offset;
+              loop$removed = removed;
+              loop$node_index = node_index;
+              loop$patch_index = patch_index;
+              loop$changes = changes;
+              loop$children = children;
+              loop$path = path;
+              loop$cache = cache$1;
+              loop$events = events2;
+            }
+          } else {
+            let prev$1 = $;
+            let old_remaining$1 = old.tail;
+            let next$1 = $1;
+            let new_remaining$1 = new$5.tail;
+            let change = replace2(node_index - moved_offset, next$1);
+            let $2 = replace_child(cache, events2, path, node_index, prev$1, next$1);
+            let cache$1 = $2[0];
+            let events$1 = $2[1];
+            loop$old = old_remaining$1;
+            loop$old_keyed = old_keyed;
+            loop$new = new_remaining$1;
+            loop$new_keyed = new_keyed;
+            loop$moved = moved;
+            loop$moved_offset = moved_offset;
+            loop$removed = removed;
+            loop$node_index = node_index + 1;
+            loop$patch_index = patch_index;
+            loop$changes = prepend(change, changes);
+            loop$children = children;
+            loop$path = path;
+            loop$cache = cache$1;
+            loop$events = events$1;
+          }
+        }
+      }
+    }
+  }
+}
+function diff(cache, old, new$5) {
+  let cache$1 = tick(cache);
+  let $ = do_diff(singleton_list(old), empty2(), singleton_list(new$5), empty2(), empty2(), 0, 0, 0, 0, empty_list, empty_list, root, cache$1, events(cache$1));
+  let patch = $.patch;
+  let cache$2 = $.cache;
+  let events2 = $.events;
+  return new Diff(patch, update_events(cache$2, events2));
+}
+
+// build/dev/javascript/lustre/lustre/internals/list.ffi.mjs
+var toList2 = (arr) => arr.reduceRight((xs, x) => List$NonEmpty(x, xs), empty_list);
+var iterate = (list4, callback) => {
+  if (Array.isArray(list4)) {
+    for (let i = 0;i < list4.length; i++) {
+      callback(list4[i]);
+    }
+  } else if (list4) {
+    for (list4;List$NonEmpty$rest(list4); list4 = List$NonEmpty$rest(list4)) {
+      callback(List$NonEmpty$first(list4));
+    }
+  }
+};
+var append4 = (a2, b) => {
+  if (!List$NonEmpty$rest(a2)) {
+    return b;
+  } else if (!List$NonEmpty$rest(b)) {
+    return a2;
+  } else {
+    return append(a2, b);
+  }
+};
+
+// build/dev/javascript/lustre/lustre/internals/constants.ffi.mjs
+var NAMESPACE_HTML = "http://www.w3.org/1999/xhtml";
+var ELEMENT_NODE = 1;
+var TEXT_NODE = 3;
+var COMMENT_NODE = 8;
+var SUPPORTS_MOVE_BEFORE = !!globalThis.HTMLElement?.prototype?.moveBefore;
+
+// build/dev/javascript/lustre/lustre/vdom/reconciler.ffi.mjs
+var setTimeout = globalThis.setTimeout;
+var clearTimeout = globalThis.clearTimeout;
+var createElementNS = (ns, name) => globalThis.document.createElementNS(ns, name);
+var createTextNode = (data) => globalThis.document.createTextNode(data);
+var createComment = (data) => globalThis.document.createComment(data);
+var createDocumentFragment = () => globalThis.document.createDocumentFragment();
+var insertBefore = (parent, node, reference) => parent.insertBefore(node, reference);
+var moveBefore = SUPPORTS_MOVE_BEFORE ? (parent, node, reference) => parent.moveBefore(node, reference) : insertBefore;
+var removeChild = (parent, child2) => parent.removeChild(child2);
+var getAttribute = (node, name) => node.getAttribute(name);
+var setAttribute = (node, name, value2) => node.setAttribute(name, value2);
+var removeAttribute = (node, name) => node.removeAttribute(name);
+var addEventListener = (node, name, handler, options) => node.addEventListener(name, handler, options);
+var removeEventListener = (node, name, handler) => node.removeEventListener(name, handler);
+var setInnerHtml = (node, innerHtml) => node.innerHTML = innerHtml;
+var setData = (node, data) => node.data = data;
+var meta = Symbol("lustre");
+
+class MetadataNode {
+  constructor(kind, parent, node, key) {
+    this.kind = kind;
+    this.key = key;
+    this.parent = parent;
+    this.children = [];
+    this.node = node;
+    this.endNode = null;
+    this.handlers = new Map;
+    this.throttles = new Map;
+    this.debouncers = new Map;
+  }
+  get isVirtual() {
+    return this.kind === fragment_kind || this.kind === map_kind;
+  }
+  get parentNode() {
+    return this.isVirtual ? this.node.parentNode : this.node;
+  }
+}
+var insertMetadataChild = (kind, parent, node, index4, key) => {
+  const child2 = new MetadataNode(kind, parent, node, key);
+  node[meta] = child2;
+  parent?.children.splice(index4, 0, child2);
+  return child2;
+};
+var getPath = (node) => {
+  let path = "";
+  for (let current = node[meta];current.parent; current = current.parent) {
+    const separator = current.parent && current.parent.kind === map_kind ? separator_subtree : separator_element;
+    if (current.key) {
+      path = `${separator}${current.key}${path}`;
+    } else {
+      const index4 = current.parent.children.indexOf(current);
+      path = `${separator}${index4}${path}`;
+    }
+  }
+  return path.slice(1);
+};
+
+class Reconciler {
+  #root = null;
+  #decodeEvent;
+  #dispatch;
+  #debug = false;
+  constructor(root2, decodeEvent, dispatch2, { debug = false } = {}) {
+    this.#root = root2;
+    this.#decodeEvent = decodeEvent;
+    this.#dispatch = dispatch2;
+    this.#debug = debug;
+  }
+  mount(vdom) {
+    insertMetadataChild(element_kind, null, this.#root, 0, null);
+    this.#insertChild(this.#root, null, this.#root[meta], 0, vdom);
+  }
+  push(patch, memos2 = null) {
+    this.#memos = memos2;
+    this.#stack.push({ node: this.#root[meta], patch });
+    this.#reconcile();
+  }
+  #memos;
+  #stack = [];
+  #reconcile() {
+    const stack = this.#stack;
+    while (stack.length) {
+      let { node, patch } = stack.pop();
+      const { path, changes, removed, children: childPatches } = patch;
+      iterate(path, (index4) => {
+        node = node.children[index4];
+      });
+      const { children: childNodes } = node;
+      iterate(changes, (change) => this.#patch(node, change));
+      if (removed) {
+        this.#removeChildren(node, childNodes.length - removed, removed);
+      }
+      iterate(childPatches, (childPatch) => {
+        const child2 = childNodes[childPatch.index | 0];
+        this.#stack.push({ node: child2, patch: childPatch });
+      });
+    }
+  }
+  #patch(node, change) {
+    switch (change.kind) {
+      case replace_text_kind:
+        this.#replaceText(node, change);
+        break;
+      case replace_inner_html_kind:
+        this.#replaceInnerHtml(node, change);
+        break;
+      case update_kind:
+        this.#update(node, change);
+        break;
+      case move_kind:
+        this.#move(node, change);
+        break;
+      case remove_kind:
+        this.#remove(node, change);
+        break;
+      case replace_kind:
+        this.#replace(node, change);
+        break;
+      case insert_kind:
+        this.#insert(node, change);
+        break;
+    }
+  }
+  #insert(parent, { children, before }) {
+    const fragment2 = createDocumentFragment();
+    const beforeEl = this.#getReference(parent, before);
+    this.#insertChildren(fragment2, null, parent, before | 0, children);
+    insertBefore(parent.parentNode, fragment2, beforeEl);
+  }
+  #replace(parent, { index: index4, with: child2 }) {
+    this.#removeChildren(parent, index4 | 0, 1);
+    const beforeEl = this.#getReference(parent, index4);
+    this.#insertChild(parent.parentNode, beforeEl, parent, index4 | 0, child2);
+  }
+  #getReference(node, index4) {
+    index4 = index4 | 0;
+    const { children } = node;
+    const childCount = children.length;
+    if (index4 < childCount)
+      return children[index4].node;
+    if (node.endNode)
+      return node.endNode;
+    if (!node.isVirtual)
+      return null;
+    while (node.isVirtual && node.children.length) {
+      if (node.endNode)
+        return node.endNode.nextSibling;
+      node = node.children[node.children.length - 1];
+    }
+    return node.node.nextSibling;
+  }
+  #move(parent, { key, before }) {
+    before = before | 0;
+    const { children, parentNode } = parent;
+    const beforeEl = children[before].node;
+    let prev = children[before];
+    for (let i = before + 1;i < children.length; ++i) {
+      const next = children[i];
+      children[i] = prev;
+      prev = next;
+      if (next.key === key) {
+        children[before] = next;
+        break;
+      }
+    }
+    this.#moveChild(parentNode, prev, beforeEl);
+  }
+  #moveChildren(domParent, children, beforeEl) {
+    for (let i = 0;i < children.length; ++i) {
+      this.#moveChild(domParent, children[i], beforeEl);
+    }
+  }
+  #moveChild(domParent, child2, beforeEl) {
+    moveBefore(domParent, child2.node, beforeEl);
+    if (child2.isVirtual) {
+      this.#moveChildren(domParent, child2.children, beforeEl);
+    }
+    if (child2.endNode) {
+      moveBefore(domParent, child2.endNode, beforeEl);
+    }
+  }
+  #remove(parent, { index: index4 }) {
+    this.#removeChildren(parent, index4, 1);
+  }
+  #removeChildren(parent, index4, count) {
+    const { children, parentNode } = parent;
+    const deleted = children.splice(index4, count);
+    for (let i = 0;i < deleted.length; ++i) {
+      const child2 = deleted[i];
+      const { node, endNode, isVirtual, children: nestedChildren } = child2;
+      removeChild(parentNode, node);
+      if (endNode) {
+        removeChild(parentNode, endNode);
+      }
+      this.#removeDebouncers(child2);
+      if (isVirtual) {
+        deleted.push(...nestedChildren);
+      }
+    }
+  }
+  #removeDebouncers(node) {
+    const { debouncers, children } = node;
+    for (const { timeout } of debouncers.values()) {
+      if (timeout) {
+        clearTimeout(timeout);
+      }
+    }
+    debouncers.clear();
+    iterate(children, (child2) => this.#removeDebouncers(child2));
+  }
+  #update({ node, handlers, throttles, debouncers }, { added, removed }) {
+    iterate(removed, ({ name }) => {
+      if (handlers.delete(name)) {
+        removeEventListener(node, name, handleEvent);
+        this.#updateDebounceThrottle(throttles, name, 0);
+        this.#updateDebounceThrottle(debouncers, name, 0);
+      } else {
+        removeAttribute(node, name);
+        SYNCED_ATTRIBUTES[name]?.removed?.(node, name);
+      }
+    });
+    iterate(added, (attribute3) => this.#createAttribute(node, attribute3));
+  }
+  #replaceText({ node }, { content }) {
+    setData(node, content ?? "");
+  }
+  #replaceInnerHtml({ node }, { inner_html }) {
+    setInnerHtml(node, inner_html ?? "");
+  }
+  #insertChildren(domParent, beforeEl, metaParent, index4, children) {
+    iterate(children, (child2) => this.#insertChild(domParent, beforeEl, metaParent, index4++, child2));
+  }
+  #insertChild(domParent, beforeEl, metaParent, index4, vnode) {
+    switch (vnode.kind) {
+      case element_kind: {
+        const node = this.#createElement(metaParent, index4, vnode);
+        this.#insertChildren(node, null, node[meta], 0, vnode.children);
+        insertBefore(domParent, node, beforeEl);
+        break;
+      }
+      case text_kind: {
+        const node = this.#createTextNode(metaParent, index4, vnode);
+        insertBefore(domParent, node, beforeEl);
+        break;
+      }
+      case fragment_kind: {
+        const marker = "lustre:fragment";
+        const head = this.#createHead(marker, metaParent, index4, vnode);
+        insertBefore(domParent, head, beforeEl);
+        this.#insertChildren(domParent, beforeEl, head[meta], 0, vnode.children);
+        if (this.#debug) {
+          head[meta].endNode = createComment(` /${marker} `);
+          insertBefore(domParent, head[meta].endNode, beforeEl);
+        }
+        break;
+      }
+      case unsafe_inner_html_kind: {
+        const node = this.#createElement(metaParent, index4, vnode);
+        this.#replaceInnerHtml({ node }, vnode);
+        insertBefore(domParent, node, beforeEl);
+        break;
+      }
+      case map_kind: {
+        const head = this.#createHead("lustre:map", metaParent, index4, vnode);
+        insertBefore(domParent, head, beforeEl);
+        this.#insertChild(domParent, beforeEl, head[meta], 0, vnode.child);
+        break;
+      }
+      case memo_kind: {
+        const child2 = this.#memos?.get(vnode.view) ?? vnode.view();
+        this.#insertChild(domParent, beforeEl, metaParent, index4, child2);
+        break;
+      }
+    }
+  }
+  #createElement(parent, index4, { kind, key, tag, namespace, attributes }) {
+    const node = createElementNS(namespace || NAMESPACE_HTML, tag);
+    insertMetadataChild(kind, parent, node, index4, key);
+    if (this.#debug && key) {
+      setAttribute(node, "data-lustre-key", key);
+    }
+    iterate(attributes, (attribute3) => this.#createAttribute(node, attribute3));
+    return node;
+  }
+  #createTextNode(parent, index4, { kind, key, content }) {
+    const node = createTextNode(content ?? "");
+    insertMetadataChild(kind, parent, node, index4, key);
+    return node;
+  }
+  #createHead(marker, parent, index4, { kind, key }) {
+    const node = this.#debug ? createComment(markerComment(marker, key)) : createTextNode("");
+    insertMetadataChild(kind, parent, node, index4, key);
+    return node;
+  }
+  #createAttribute(node, attribute3) {
+    const { debouncers, handlers, throttles } = node[meta];
+    const {
+      kind,
+      name,
+      value: value2,
+      prevent_default: prevent,
+      debounce: debounceDelay,
+      throttle: throttleDelay
+    } = attribute3;
+    switch (kind) {
+      case attribute_kind: {
+        const valueOrDefault = value2 ?? "";
+        if (name === "virtual:defaultValue") {
+          node.defaultValue = valueOrDefault;
+          return;
+        } else if (name === "virtual:defaultChecked") {
+          node.defaultChecked = true;
+          return;
+        } else if (name === "virtual:defaultSelected") {
+          node.defaultSelected = true;
+          return;
+        }
+        if (valueOrDefault !== getAttribute(node, name)) {
+          setAttribute(node, name, valueOrDefault);
+        }
+        SYNCED_ATTRIBUTES[name]?.added?.(node, valueOrDefault);
+        break;
+      }
+      case property_kind:
+        node[name] = value2;
+        break;
+      case event_kind: {
+        if (handlers.has(name)) {
+          removeEventListener(node, name, handleEvent);
+        }
+        const passive = prevent.kind === never_kind;
+        addEventListener(node, name, handleEvent, { passive });
+        this.#updateDebounceThrottle(throttles, name, throttleDelay);
+        this.#updateDebounceThrottle(debouncers, name, debounceDelay);
+        handlers.set(name, (event3) => this.#handleEvent(attribute3, event3));
+        break;
+      }
+    }
+  }
+  #updateDebounceThrottle(map8, name, delay) {
+    const debounceOrThrottle = map8.get(name);
+    if (delay > 0) {
+      if (debounceOrThrottle) {
+        debounceOrThrottle.delay = delay;
+      } else {
+        map8.set(name, { delay });
+      }
+    } else if (debounceOrThrottle) {
+      const { timeout } = debounceOrThrottle;
+      if (timeout) {
+        clearTimeout(timeout);
+      }
+      map8.delete(name);
+    }
+  }
+  #handleEvent(attribute3, event3) {
+    const { currentTarget, type } = event3;
+    const { debouncers, throttles } = currentTarget[meta];
+    const path = getPath(currentTarget);
+    const {
+      prevent_default: prevent,
+      stop_propagation: stop,
+      include
+    } = attribute3;
+    if (prevent.kind === always_kind)
+      event3.preventDefault();
+    if (stop.kind === always_kind)
+      event3.stopPropagation();
+    if (type === "submit") {
+      event3.detail ??= {};
+      event3.detail.formData = [
+        ...new FormData(event3.target, event3.submitter).entries()
+      ];
+    }
+    const data = this.#decodeEvent(event3, path, type, include);
+    const throttle = throttles.get(type);
+    if (throttle) {
+      const now = Date.now();
+      const last = throttle.last || 0;
+      if (now > last + throttle.delay) {
+        throttle.last = now;
+        throttle.lastEvent = event3;
+        this.#dispatch(event3, data);
+      }
+    }
+    const debounce = debouncers.get(type);
+    if (debounce) {
+      clearTimeout(debounce.timeout);
+      debounce.timeout = setTimeout(() => {
+        if (event3 === throttles.get(type)?.lastEvent)
+          return;
+        this.#dispatch(event3, data);
+      }, debounce.delay);
+    }
+    if (!throttle && !debounce) {
+      this.#dispatch(event3, data);
+    }
+  }
+}
+var markerComment = (marker, key) => {
+  if (key) {
+    return ` ${marker} key="${escape(key)}" `;
+  } else {
+    return ` ${marker} `;
+  }
+};
+var handleEvent = (event3) => {
+  const { currentTarget, type } = event3;
+  const handler = currentTarget[meta].handlers.get(type);
+  handler(event3);
+};
+var syncedBooleanAttribute = (name) => {
+  return {
+    added(node) {
+      node[name] = true;
+    },
+    removed(node) {
+      node[name] = false;
+    }
+  };
+};
+var syncedAttribute = (name) => {
+  return {
+    added(node, value2) {
+      node[name] = value2;
+    }
+  };
+};
+var SYNCED_ATTRIBUTES = {
+  checked: syncedBooleanAttribute("checked"),
+  selected: syncedBooleanAttribute("selected"),
+  value: syncedAttribute("value"),
+  autofocus: {
+    added(node) {
+      queueMicrotask(() => {
+        node.focus?.();
+      });
+    }
+  },
+  autoplay: {
+    added(node) {
+      try {
+        node.play?.();
+      } catch (e) {
+        console.error(e);
+      }
+    }
+  }
+};
+
+// build/dev/javascript/lustre/lustre/element/keyed.mjs
+function do_extract_keyed_children(loop$key_children_pairs, loop$keyed_children, loop$children) {
+  while (true) {
+    let key_children_pairs = loop$key_children_pairs;
+    let keyed_children = loop$keyed_children;
+    let children = loop$children;
+    if (key_children_pairs instanceof Empty) {
+      return [keyed_children, reverse(children)];
+    } else {
+      let rest = key_children_pairs.tail;
+      let key = key_children_pairs.head[0];
+      let element$1 = key_children_pairs.head[1];
+      let keyed_element = to_keyed(key, element$1);
+      let _block;
+      if (key === "") {
+        _block = keyed_children;
+      } else {
+        _block = insert2(keyed_children, key, keyed_element);
+      }
+      let keyed_children$1 = _block;
+      let children$1 = prepend(keyed_element, children);
+      loop$key_children_pairs = rest;
+      loop$keyed_children = keyed_children$1;
+      loop$children = children$1;
+    }
+  }
+}
+function extract_keyed_children(children) {
+  return do_extract_keyed_children(children, empty2(), empty_list);
+}
+function element3(tag, attributes, children) {
+  let $ = extract_keyed_children(children);
+  let keyed_children = $[0];
+  let children$1 = $[1];
+  return element("", "", tag, attributes, children$1, keyed_children, false, is_void_html_element(tag, ""));
+}
+function namespaced2(namespace, tag, attributes, children) {
+  let $ = extract_keyed_children(children);
+  let keyed_children = $[0];
+  let children$1 = $[1];
+  return element("", namespace, tag, attributes, children$1, keyed_children, false, is_void_html_element(tag, namespace));
+}
+function fragment2(children) {
+  let $ = extract_keyed_children(children);
+  let keyed_children = $[0];
+  let children$1 = $[1];
+  return fragment("", children$1, keyed_children);
+}
+
+// build/dev/javascript/lustre/lustre/vdom/virtualise.ffi.mjs
+var virtualise = (root2) => {
+  const rootMeta = insertMetadataChild(element_kind, null, root2, 0, null);
+  const { children } = virtualiseChildren(rootMeta, root2, root2.firstChild);
+  if (children.length > 1) {
+    const rootNodeMeta = insertMetadataChild(element_kind, null, root2, 0, null);
+    rootMeta.kind = fragment_kind;
+    rootMeta.node = globalThis.document.createTextNode("");
+    rootMeta.parent = rootNodeMeta;
+    rootNodeMeta.children.push(rootMeta);
+    root2.insertBefore(rootMeta.node, root2.firstChild);
+    return fragment2(toList3(children));
+  }
+  if (children.length === 1) {
+    return children[0][1];
+  }
+  const placeholder = globalThis.document.createTextNode("");
+  insertMetadataChild(text_kind, rootMeta, placeholder, 0, null);
+  root2.insertBefore(placeholder, root2.firstChild);
+  return none2();
+};
+var virtualiseChild = (meta2, domParent, child2, index4) => {
+  if (child2.nodeType === COMMENT_NODE) {
+    const data = child2.data.trim();
+    if (data.startsWith("lustre:fragment")) {
+      return virtualiseFragment(meta2, domParent, child2, index4);
+    }
+    if (data.startsWith("lustre:map")) {
+      return virtualiseMap(meta2, domParent, child2, index4);
+    }
+    if (data.startsWith("lustre:memo")) {
+      return virtualiseMemo(meta2, domParent, child2, index4);
+    }
+    return null;
+  }
+  if (child2.nodeType === ELEMENT_NODE) {
+    return virtualiseElement(meta2, child2, index4);
+  }
+  if (child2.nodeType === TEXT_NODE) {
+    return virtualiseText(meta2, child2, index4);
+  }
+  return null;
+};
+var virtualiseElement = (metaParent, node, index4) => {
+  const key = node.getAttribute("data-lustre-key") ?? "";
+  if (key) {
+    node.removeAttribute("data-lustre-key");
+  }
+  const meta2 = insertMetadataChild(element_kind, metaParent, node, index4, key);
+  const tag = node.localName;
+  const namespace = node.namespaceURI;
+  const isHtmlElement = !namespace || namespace === NAMESPACE_HTML;
+  if (isHtmlElement && INPUT_ELEMENTS.includes(tag)) {
+    virtualiseInputEvents(tag, node);
+  }
+  const attributes = virtualiseAttributes(node);
+  const { children } = virtualiseChildren(meta2, node, node.firstChild);
+  const vnode = isHtmlElement ? element3(tag, attributes, toList3(children)) : namespaced2(namespace, tag, attributes, toList3(children));
+  return childResult(key, vnode, node.nextSibling);
+};
+var virtualiseChildren = (meta2, domParent, childNode) => {
+  const children = [];
+  while (childNode && (childNode.nodeType !== COMMENT_NODE || childNode.data.trim() !== "/lustre:fragment")) {
+    const child2 = virtualiseChild(meta2, domParent, childNode, children.length);
+    if (child2) {
+      children.push([child2.key, child2.vnode]);
+      childNode = child2.next;
+    } else {
+      childNode = childNode.nextSibling;
+    }
+  }
+  return { children, end: childNode };
+};
+var virtualiseText = (meta2, node, index4) => {
+  insertMetadataChild(text_kind, meta2, node, index4, null);
+  return childResult("", text2(node.data), node.nextSibling);
+};
+var virtualiseFragment = (metaParent, domParent, node, index4) => {
+  const key = parseKey(node.data);
+  const meta2 = insertMetadataChild(fragment_kind, metaParent, node, index4, key);
+  const { children, end } = virtualiseChildren(meta2, domParent, node.nextSibling);
+  meta2.endNode = end;
+  const vnode = fragment2(toList3(children));
+  return childResult(key, vnode, end?.nextSibling);
+};
+var virtualiseMap = (metaParent, domParent, node, index4) => {
+  const key = parseKey(node.data);
+  const meta2 = insertMetadataChild(map_kind, metaParent, node, index4, key);
+  const child2 = virtualiseNextChild(meta2, domParent, node, 0);
+  if (!child2)
+    return null;
+  const vnode = map7(child2.vnode, (x) => x);
+  return childResult(key, vnode, child2.next);
+};
+var virtualiseMemo = (meta2, domParent, node, index4) => {
+  const key = parseKey(node.data);
+  const child2 = virtualiseNextChild(meta2, domParent, node, index4);
+  if (!child2)
+    return null;
+  domParent.removeChild(node);
+  const vnode = memo2(toList3([ref({})]), () => child2.vnode);
+  return childResult(key, vnode, child2.next);
+};
+var virtualiseNextChild = (meta2, domParent, node, index4) => {
+  while (true) {
+    node = node.nextSibling;
+    if (!node)
+      return null;
+    const child2 = virtualiseChild(meta2, domParent, node, index4);
+    if (child2)
+      return child2;
+  }
+};
+var childResult = (key, vnode, next) => {
+  return { key, vnode, next };
+};
+var virtualiseAttributes = (node) => {
+  const attributes = [];
+  for (let i = 0;i < node.attributes.length; i++) {
+    const attr = node.attributes[i];
+    if (attr.name !== "xmlns") {
+      attributes.push(attribute2(attr.localName, attr.value));
+    }
+  }
+  return toList3(attributes);
+};
+var INPUT_ELEMENTS = ["input", "select", "textarea"];
+var virtualiseInputEvents = (tag, node) => {
+  const value2 = node.value;
+  const checked = node.checked;
+  if (tag === "input" && node.type === "checkbox" && !checked)
+    return;
+  if (tag === "input" && node.type === "radio" && !checked)
+    return;
+  if (node.type !== "checkbox" && node.type !== "radio" && !value2)
+    return;
+  queueMicrotask(() => {
+    node.value = value2;
+    node.checked = checked;
+    node.dispatchEvent(new Event("input", { bubbles: true }));
+    node.dispatchEvent(new Event("change", { bubbles: true }));
+    if (globalThis.document.activeElement !== node) {
+      node.dispatchEvent(new Event("blur", { bubbles: true }));
+    }
+  });
+};
+var parseKey = (data) => {
+  const keyMatch = data.match(/key="([^"]*)"/);
+  if (!keyMatch)
+    return "";
+  return unescapeKey(keyMatch[1]);
+};
+var unescapeKey = (key) => {
+  return key.replace(/&lt;/g, "<").replace(/&gt;/g, ">").replace(/&quot;/g, '"').replace(/&amp;/g, "&").replace(/&#39;/g, "'");
+};
+var toList3 = (arr) => arr.reduceRight((xs, x) => List$NonEmpty(x, xs), empty_list);
+
+// build/dev/javascript/lustre/lustre/runtime/client/runtime.ffi.mjs
+var is_browser = () => !!globalThis.document;
+class Runtime {
+  constructor(root2, [model, effects], view, update2, options) {
+    this.root = root2;
+    this.#model = model;
+    this.#view = view;
+    this.#update = update2;
+    this.root.addEventListener("context-request", (event3) => {
+      if (!(event3.context && event3.callback))
+        return;
+      if (!this.#contexts.has(event3.context))
+        return;
+      event3.stopImmediatePropagation();
+      const context = this.#contexts.get(event3.context);
+      if (event3.subscribe) {
+        const unsubscribe2 = () => {
+          context.subscribers = context.subscribers.filter((subscriber) => subscriber !== event3.callback);
+        };
+        context.subscribers.push([event3.callback, unsubscribe2]);
+        event3.callback(context.value, unsubscribe2);
+      } else {
+        event3.callback(context.value);
+      }
+    });
+    const decodeEvent = (event3, path, name) => decode2(this.#cache, path, name, event3);
+    const dispatch2 = (event3, data) => {
+      const [cache, result] = dispatch(this.#cache, data);
+      this.#cache = cache;
+      if (Result$isOk(result)) {
+        const handler = Result$Ok$0(result);
+        if (handler.stop_propagation)
+          event3.stopPropagation();
+        if (handler.prevent_default)
+          event3.preventDefault();
+        this.dispatch(handler.message, false);
+      }
+    };
+    this.#reconciler = new Reconciler(this.root, decodeEvent, dispatch2, options);
+    this.#vdom = virtualise(this.root);
+    this.#cache = new$4();
+    this.#handleEffects(effects);
+    this.#render();
+  }
+  root = null;
+  dispatch(message, shouldFlush = false) {
+    if (this.#shouldQueue) {
+      this.#queue.push(message);
+    } else {
+      const [model, effects] = this.#update(this.#model, message);
+      this.#model = model;
+      this.#scheduleRender(shouldFlush);
+      this.#handleEffects(effects);
+    }
+  }
+  emit(event3, data) {
+    const target = this.root.host ?? this.root;
+    target.dispatchEvent(new LustreEvent(event3, data));
+  }
+  provide(key, value2) {
+    if (!this.#contexts.has(key)) {
+      this.#contexts.set(key, { value: value2, subscribers: [] });
+    } else {
+      const context = this.#contexts.get(key);
+      if (isEqual2(context.value, value2)) {
+        return;
+      }
+      context.value = value2;
+      for (let i = context.subscribers.length - 1;i >= 0; i--) {
+        const [subscriber, unsubscribe2] = context.subscribers[i];
+        if (!subscriber) {
+          context.subscribers.splice(i, 1);
+          continue;
+        }
+        subscriber(value2, unsubscribe2);
+      }
+    }
+  }
+  subscribe(key, decoder) {
+    if (!key)
+      return;
+    this.#contextSubscriptions.get(key)?.();
+    const target = this.root.host ?? this.root;
+    target.dispatchEvent(new ContextRequestEvent(key, (value2, unsubscribe2) => {
+      const previousUnsubscribe = this.#contextSubscriptions.get(key);
+      if (previousUnsubscribe !== unsubscribe2) {
+        previousUnsubscribe?.();
+      }
+      const decoded = run(value2, decoder);
+      this.#contextSubscriptions.set(key, unsubscribe2);
+      if (Result$isOk(decoded)) {
+        this.dispatch(Result$Ok$0(decoded), true);
+      }
+    }, true));
+  }
+  unsubscribe(key) {
+    const unsubscribe2 = this.#contextSubscriptions.get(key);
+    if (unsubscribe2) {
+      unsubscribe2();
+      this.#contextSubscriptions.delete(key);
+    }
+  }
+  unsubscribeAll() {
+    for (const [_, unsubscribe2] of this.#contextSubscriptions) {
+      unsubscribe2?.();
+    }
+    this.#contextSubscriptions.clear();
+  }
+  #model;
+  #view;
+  #update;
+  #vdom;
+  #cache;
+  #reconciler;
+  #contexts = new Map;
+  #contextSubscriptions = new Map;
+  #shouldQueue = false;
+  #queue = [];
+  #beforePaint = empty_list;
+  #afterPaint = empty_list;
+  #renderTimer = null;
+  #actions = {
+    dispatch: (message) => this.dispatch(message),
+    emit: (event3, data) => this.emit(event3, data),
+    select: () => {},
+    root: () => this.root,
+    provide: (key, value2) => this.provide(key, value2),
+    subscribe: (key, decoder) => this.subscribe(key, decoder),
+    unsubscribe: (key) => this.unsubscribe(key)
+  };
+  #scheduleRender(shouldFlush = false) {
+    if (this.#renderTimer)
+      return;
+    if (shouldFlush) {
+      this.#renderTimer = "sync";
+      queueMicrotask(() => this.#render());
+    } else {
+      this.#renderTimer = window.requestAnimationFrame(() => this.#render());
+    }
+  }
+  #handleEffects(effects) {
+    this.#shouldQueue = true;
+    let updateCalledDuringEffects = false;
+    while (true) {
+      iterate(effects.synchronous, (effect) => effect(this.#actions));
+      this.#beforePaint = append4(this.#beforePaint, effects.before_paint);
+      this.#afterPaint = append4(this.#afterPaint, effects.after_paint);
+      if (!this.#queue.length)
+        break;
+      const message = this.#queue.shift();
+      [this.#model, effects] = this.#update(this.#model, message);
+      updateCalledDuringEffects = true;
+    }
+    this.#shouldQueue = false;
+    return updateCalledDuringEffects;
+  }
+  #handleAsyncEffects(effects) {
+    if (this.#handleEffects(effects)) {
+      this.#scheduleRender(true);
+    }
+  }
+  #render() {
+    this.#renderTimer = null;
+    const next = this.#view(this.#model);
+    const { patch, cache } = diff(this.#cache, this.#vdom, next);
+    this.#cache = cache;
+    this.#vdom = next;
+    this.#reconciler.push(patch, memos(cache));
+    if (List$isNonEmpty(this.#beforePaint)) {
+      const effects = makeEffect(this.#beforePaint);
+      this.#beforePaint = empty_list;
+      queueMicrotask(() => this.#handleAsyncEffects(effects));
+    }
+    if (List$isNonEmpty(this.#afterPaint)) {
+      const effects = makeEffect(this.#afterPaint);
+      this.#afterPaint = empty_list;
+      window.requestAnimationFrame(() => this.#handleAsyncEffects(effects));
+    }
+  }
+}
+function makeEffect(synchronous) {
+  return {
+    synchronous,
+    after_paint: empty_list,
+    before_paint: empty_list
+  };
+}
+var copiedStyleSheets = new WeakMap;
+class ContextRequestEvent extends Event {
+  constructor(context, callback, subscribe2) {
+    super("context-request", { bubbles: true, composed: true });
+    this.context = context;
+    this.callback = callback;
+    this.subscribe = subscribe2;
+  }
+}
+
+class LustreEvent extends CustomEvent {
+  isLustreEvent = true;
+  constructor(name, detail) {
+    super(name, { detail, bubbles: true, composed: true });
+  }
+}
+
+// build/dev/javascript/lustre/lustre/runtime/client/spa.ffi.mjs
+class Spa {
+  #runtime;
+  constructor(root2, [init, effects], update2, view) {
+    this.#runtime = new Runtime(root2, [init, effects], view, update2);
+  }
+  send(message) {
+    if (Message$isEffectDispatchedMessage(message)) {
+      this.dispatch(message.message, false);
+    } else if (Message$isEffectEmitEvent(message)) {
+      this.emit(message.name, message.data);
+    } else if (Message$isSystemRequestedShutdown(message)) {}
+  }
+  dispatch(message) {
+    this.#runtime.dispatch(message);
+  }
+  emit(event3, data) {
+    this.#runtime.emit(event3, data);
+  }
+}
+var start = ({ init, update: update2, view }, selector, flags) => {
+  if (!is_browser())
+    return Result$Error(Error$NotABrowser());
+  const root2 = selector instanceof HTMLElement ? selector : globalThis.document.querySelector(selector);
+  if (!root2)
+    return Result$Error(Error$ElementNotFound(selector));
+  return Result$Ok(new Spa(root2, init(flags), update2, view));
+};
+
+// build/dev/javascript/lustre/lustre/runtime/server/runtime.ffi.mjs
+class Runtime2 {
+  #model;
+  #update;
+  #view;
+  #config;
+  #vdom;
+  #cache;
+  #providers = make();
+  #callbacks = /* @__PURE__ */ new Set;
+  constructor(_, init, update2, view, config, start_arguments) {
+    const [model, effects] = init(start_arguments);
+    this.#model = model;
+    this.#update = update2;
+    this.#view = view;
+    this.#config = config;
+    this.#vdom = this.#view(this.#model);
+    this.#cache = from_node(this.#vdom);
+    this.#handle_effect(effects);
+  }
+  send(message) {
+    if (Message$isClientDispatchedMessage(message)) {
+      const { message: message2 } = message2;
+      const next = this.#handle_client_message(message2);
+      const diff2 = diff(this.#cache, this.#vdom, next);
+      this.#vdom = next;
+      this.#cache = diff2.cache;
+      this.broadcast(reconcile(diff2.patch, memos(diff2.cache)));
+    } else if (Message$isClientRegisteredCallback(message)) {
+      const { callback } = message;
+      this.#callbacks.add(callback);
+      callback(mount(this.#config.open_shadow_root, this.#config.adopt_styles, keys(this.#config.attributes), keys(this.#config.properties), keys(this.#config.contexts), this.#providers, this.#vdom, memos(this.#cache)));
+      if (Option$isSome(this.#config.on_connect)) {
+        this.#dispatch(Option$Some$0(this.#config.on_connect));
+      }
+    } else if (Message$isClientDeregisteredCallback(message)) {
+      const { callback } = message;
+      this.#callbacks.delete(callback);
+      if (Option$isSome(this.#config.on_disconnect)) {
+        this.#dispatch(Option$Some$0(this.#config.on_disconnect));
+      }
+    } else if (Message$isEffectDispatchedMessage(message)) {
+      const { message: message2 } = message2;
+      const [model, effect] = this.#update(this.#model, message2);
+      const next = this.#view(model);
+      const diff2 = diff(this.#cache, this.#vdom, next);
+      this.#handle_effect(effect);
+      this.#model = model;
+      this.#vdom = next;
+      this.#cache = diff2.cache;
+      this.broadcast(reconcile(diff2.patch, memos(diff2.cache)));
+    } else if (Message$isEffectEmitEvent(message)) {
+      const { name, data } = message;
+      this.broadcast(emit(name, data));
+    } else if (Message$isEffectProvidedValue(message)) {
+      const { key, value: value2 } = message;
+      const existing = get(this.#providers, key);
+      if (Result$isOk(existing) && isEqual2(Result$Ok$0(existing), value2)) {
+        return;
+      }
+      this.#providers = insert(this.#providers, key, value2);
+      this.broadcast(provide(key, value2));
+    } else if (Message$isEffectRequestedContextSubscription(message)) {
+      const { key, decoder } = message;
+      this.broadcast(subscribe(key));
+      this.#config.contexts = insert(this.#config.contexts, key, decoder);
+    } else if (Message$isEffectRemovedContextSubscription(message)) {
+      const { key } = message;
+      this.broadcast(unsubscribe(key));
+      this.#config.contexts = delete$(this.#config.contexts, key);
+    } else if (Message$isSystemRequestedShutdown(message)) {
+      this.#model = null;
+      this.#update = null;
+      this.#view = null;
+      this.#config = null;
+      this.#vdom = null;
+      this.#cache = null;
+      this.#providers = null;
+      this.#callbacks.clear();
+    }
+  }
+  broadcast(message) {
+    for (const callback of this.#callbacks) {
+      callback(message);
+    }
+  }
+  #handle_client_message(message) {
+    if (ServerMessage$isBatch(message)) {
+      const { messages } = message;
+      let model = this.#model;
+      let effect = none();
+      for (let list4 = messages;List$NonEmpty$rest(list4); list4 = List$NonEmpty$rest(list4)) {
+        const result = this.#handle_client_message(List$NonEmpty$first(list4));
+        if (Result$isOk(result)) {
+          model = Result$Ok$0(result)[0];
+          effect = batch(toList2([effect, Result$Ok$0(result)[1]]));
+          break;
+        }
+      }
+      this.#handle_effect(effect);
+      this.#model = model;
+      return this.#view(model);
+    } else if (ServerMessage$isAttributeChanged(message)) {
+      const { name, value: value2 } = message;
+      const result = this.#handle_attribute_change(name, value2);
+      if (!Result$isOk(result)) {
+        return this.#vdom;
+      }
+      return this.#dispatch(Result$Ok$0(result));
+    } else if (ServerMessage$isPropertyChanged(message)) {
+      const { name, value: value2 } = message;
+      const result = this.#handle_properties_change(name, value2);
+      if (!Result$isOk(result)) {
+        return this.#vdom;
+      }
+      return this.#dispatch(Result$Ok$0(result));
+    } else if (ServerMessage$isEventFired(message)) {
+      const { path, name, event: event3 } = message2;
+      const [cache, result] = handle(this.#cache, path, name, event3);
+      this.#cache = cache;
+      if (!Result$isOk(result)) {
+        return this.#vdom;
+      }
+      const { message: message2 } = Result$Ok$0(result);
+      return this.#dispatch(message2);
+    } else if (ServerMessage$isContextProvided(message)) {
+      const { key, value: value2 } = message;
+      let result = get(this.#config.contexts, key);
+      if (!Result$isOk(result)) {
+        return this.#vdom;
+      }
+      result = run(value2, Result$Ok$0(result));
+      if (!Result$isOk(result)) {
+        return this.#vdom;
+      }
+      return this.#dispatch(Result$Ok$0(result));
+    }
+  }
+  #dispatch(message) {
+    const [model, effects] = this.#update(this.#model, message);
+    this.#handle_effect(effects);
+    this.#model = model;
+    return this.#view(this.#model);
+  }
+  #handle_attribute_change(name, value2) {
+    const result = get(this.#config.attributes, name);
+    if (!Result$isOk(result)) {
+      return result;
+    }
+    return Result$Ok$0(result)(value2);
+  }
+  #handle_properties_change(name, value2) {
+    const result = get(this.#config.properties, name);
+    if (!Result$isOk(result)) {
+      return result;
+    }
+    return Result$Ok$0(result)(value2);
+  }
+  #handle_effect(effect) {
+    const dispatch2 = (message) => this.send(Message$EffectDispatchedMessage(message));
+    const emit2 = (name, data) => this.send(Message$EffectEmitEvent(name, data));
+    const select = () => {
+      return;
+    };
+    const internals = () => {
+      return;
+    };
+    const provide2 = (key, value2) => this.send(Message$EffectProvidedValue(key, value2));
+    const subscribe2 = (key, decoder) => this.send(Message$EffectRequestedContextSubscription(key, decoder));
+    const unsubscribe2 = (key) => this.send(Message$EffectRemovedContextSubscription(key));
+    globalThis.queueMicrotask(() => {
+      perform(effect, dispatch2, emit2, select, internals, provide2, subscribe2, unsubscribe2);
+    });
+  }
+}
+
+// build/dev/javascript/lustre/lustre.mjs
+class ElementNotFound extends CustomType {
+  constructor(selector) {
+    super();
+    this.selector = selector;
+  }
+}
+var Error$ElementNotFound = (selector) => new ElementNotFound(selector);
+class NotABrowser extends CustomType {
+}
+var Error$NotABrowser$const = new NotABrowser;
+var Error$NotABrowser = () => Error$NotABrowser$const;
+function application(init, update2, view) {
+  return new App(Option$None$const, init, update2, view, default_config);
+}
+function start4(app, selector, arguments$) {
+  return guard(!is_browser(), new Error2(Error$NotABrowser$const), () => {
+    return start(app, selector, arguments$);
+  });
+}
+
+// build/dev/javascript/lustre/lustre/event.mjs
+function on(name, handler) {
+  return event(name, map4(handler, (message) => {
+    return new Handler(false, false, message);
+  }), empty_list, never, never, 0, 0);
+}
+function on_click(message) {
+  return on("click", success(message));
+}
+function on_keydown(message) {
+  return on("keydown", field("key", string2, (key) => {
+    let _pipe = key;
+    let _pipe$1 = message(_pipe);
+    return success(_pipe$1);
+  }));
+}
+function on_input(message) {
+  return on("input", subfield(prepend("target", prepend("value", List$Empty$const)), string2, (value2) => {
+    return success(message(value2));
+  }));
+}
+// build/dev/javascript/plinth/document_ffi.mjs
+function querySelector(query) {
+  let found = document.querySelector(query);
+  if (!found) {
+    return Result$Error();
+  }
+  return Result$Ok(found);
+}
+
+// build/dev/javascript/plinth/element_ffi.mjs
+function innerText(element4) {
+  return element4.innerText;
+}
+
+// build/dev/javascript/plinth/plinth/browser/element.mjs
+class BeforeBegin extends CustomType {
+}
+var Position$BeforeBegin$const = new BeforeBegin;
+class AfterBegin extends CustomType {
+}
+var Position$AfterBegin$const = new AfterBegin;
+class BeforeEnd extends CustomType {
+}
+var Position$BeforeEnd$const = new BeforeEnd;
+class AfterEnd extends CustomType {
+}
+var Position$AfterEnd$const = new AfterEnd;
+
+// build/dev/javascript/plinth/storage_ffi.mjs
+function localStorage() {
+  try {
+    const storage = globalThis.localStorage;
+    if (globalThis.Storage && storage instanceof globalThis.Storage) {
+      return Result$Ok(storage);
+    } else {
+      return Result$Error("localStorage is not available");
+    }
+  } catch (error) {
+    return Result$Error(`${error}`);
+  }
+}
+function getItem(storage, keyName) {
+  try {
+    const value3 = storage.getItem(keyName);
+    const option = value3 === null ? Option$None() : Option$Some(value3);
+    return Result$Ok(option);
+  } catch (error) {
+    return Result$Error(`${error}`);
+  }
+}
+function setItem(storage, keyName, keyValue) {
+  try {
+    storage.setItem(keyName, keyValue);
+    return Result$Ok(null);
+  } catch (error) {
+    return Result$Error(`${error}`);
+  }
+}
+
+// build/dev/javascript/plinth/date_ffi.mjs
+function now() {
+  return new Date;
+}
+function getTime(d) {
+  return Math.floor(d.getTime());
+}
+// build/dev/javascript/shared/shared.mjs
+class Puzzle extends CustomType {
+  constructor(previous, next, candidates, order) {
+    super();
+    this.previous = previous;
+    this.next = next;
+    this.candidates = candidates;
+    this.order = order;
+  }
+}
+class Candidate extends CustomType {
+  constructor(word, count) {
+    super();
+    this.word = word;
+    this.count = count;
+  }
+}
+function candidate_decoder() {
+  return field("word", string2, (word) => {
+    return field("count", int2, (count) => {
+      return success(new Candidate(word, count));
+    });
+  });
+}
+function puzzle_decoder() {
+  return field("previous", string2, (previous) => {
+    return field("next", string2, (next) => {
+      return field("candidates", list2(candidate_decoder()), (candidates) => {
+        return field("order", int2, (order) => {
+          return success(new Puzzle(previous, next, candidates, order));
+        });
+      });
+    });
+  });
+}
+// build/dev/javascript/client/client.mjs
+var FILEPATH = "src/client.gleam";
+
+class Nothing extends CustomType {
+}
+var Message$Nothing$const = new Nothing;
+class ClosePopup extends CustomType {
+}
+var Message$ClosePopup$const = new ClosePopup;
+class ClosePlayedPopup extends CustomType {
+}
+var Message$ClosePlayedPopup$const = new ClosePlayedPopup;
+class UpdateInput extends CustomType {
+  constructor($0) {
+    super();
+    this[0] = $0;
+  }
+}
+class KeyDown extends CustomType {
+  constructor($0) {
+    super();
+    this[0] = $0;
+  }
+}
+class Model extends CustomType {
+  constructor(puzzle, popup_open, won, score, guesses, current_guess, game_over, history, already_played, already_played_popup_open) {
+    super();
+    this.puzzle = puzzle;
+    this.popup_open = popup_open;
+    this.won = won;
+    this.score = score;
+    this.guesses = guesses;
+    this.current_guess = current_guess;
+    this.game_over = game_over;
+    this.history = history;
+    this.already_played = already_played;
+    this.already_played_popup_open = already_played_popup_open;
+  }
+}
+
+class History extends CustomType {
+  constructor(scores, username) {
+    super();
+    this.scores = scores;
+    this.username = username;
+  }
+}
+var card_bg = "#555";
+var border_color = "rgba(255, 255, 255, 0.15)";
+var page_bg = "#2b2b2b";
+var default$ = /* @__PURE__ */ new Puzzle("Sorry, no", "today :(", /* @__PURE__ */ prepend(/* @__PURE__ */ new Candidate("puzzle", 1), List$Empty$const), 2);
+var ms_per_day = 86400000;
+function popup_image() {
+  return img(prepend(src("/static/cat.png"), prepend(styles(prepend(["display", "block"], prepend(["width", "100%"], prepend(["max-width", "300px"], prepend(["height", "auto"], prepend(["margin", "0 auto"], List$Empty$const)))))), List$Empty$const)));
+}
+function popup_title(label) {
+  return div(prepend(styles(prepend(["font-size", "24px"], prepend(["font-weight", "bold"], prepend(["margin-bottom", "16px"], List$Empty$const)))), List$Empty$const), prepend(text3(label), List$Empty$const));
+}
+function close_button(message) {
+  return button(prepend(class$("popup-close"), prepend(on_click(message), prepend(styles(toList([
+    ["position", "absolute"],
+    ["top", "8px"],
+    ["right", "10px"],
+    ["width", "32px"],
+    ["height", "32px"],
+    ["border", "none"],
+    ["background", "transparent"],
+    ["color", "#fff"],
+    ["font-size", "24px"],
+    ["line-height", "1"],
+    ["cursor", "pointer"],
+    ["padding", "0"]
+  ])), List$Empty$const))), prepend(text3("×"), List$Empty$const));
+}
+function card_styles() {
+  return prepend(["width", "min(420px, 90vw)"], prepend(["box-sizing", "border-box"], prepend(["background-color", card_bg], prepend(["color", "#fff"], prepend(["padding", "24px"], prepend(["box-shadow", "0 10px 60px rgba(0, 0, 0, 0.4)"], List$Empty$const))))));
+}
+function popup_wrapper(content) {
+  return div(prepend(class$("popup"), prepend(styles(prepend(["position", "fixed"], prepend(["inset", "0"], prepend(["display", "flex"], prepend(["align-items", "center"], prepend(["justify-content", "center"], prepend(["z-index", "1000"], prepend(["padding", "20px"], prepend(["box-sizing", "border-box"], List$Empty$const))))))))), List$Empty$const)), prepend(div(prepend(id("myPopup"), prepend(class$("popuptext"), prepend(styles(append(card_styles(), prepend(["position", "relative"], prepend(["text-align", "center"], List$Empty$const)))), List$Empty$const))), content), List$Empty$const));
+}
+function lose_popup(score) {
+  return popup_wrapper(prepend(close_button(Message$ClosePopup$const), prepend(popup_title("Score: " + to_string(score) + "%"), prepend(popup_image(), List$Empty$const))));
+}
+function win_popup(score) {
+  return popup_wrapper(prepend(close_button(Message$ClosePopup$const), prepend(popup_title("Score: " + to_string(score) + "%"), prepend(popup_image(), List$Empty$const))));
+}
+function already_played_popup(score) {
+  return popup_wrapper(prepend(close_button(Message$ClosePlayedPopup$const), prepend(popup_title("U already played. Score: " + to_string(score)), prepend(popup_image(), List$Empty$const))));
+}
+function row_styles() {
+  return prepend(["display", "flex"], prepend(["flex-wrap", "wrap"], prepend(["align-items", "center"], prepend(["justify-content", "center"], prepend(["gap", "6px"], prepend(["padding", "10px 0"], prepend(["border-bottom", "1px solid " + border_color], prepend(["text-align", "center"], List$Empty$const))))))));
+}
+function active_clue(puzzle, model) {
+  return div(prepend(styles(row_styles()), List$Empty$const), prepend(a(prepend(styles(prepend(["opacity", "0.7"], List$Empty$const)), List$Empty$const), prepend(text3(puzzle.previous), List$Empty$const)), prepend(input(prepend(on_input((var0) => {
+    return new UpdateInput(var0);
+  }), prepend(value(model.current_guess), prepend(on_keydown((var0) => {
+    return new KeyDown(var0);
+  }), prepend(id("active"), prepend(autofocus(true), prepend(styles(prepend(["background-color", "#333"], prepend(["color", "#fff"], prepend(["border", "1px solid " + border_color], prepend(["padding", "6px 10px"], prepend(["font-size", "16px"], prepend(["text-align", "center"], prepend(["width", "140px"], prepend(["outline", "none"], List$Empty$const))))))))), List$Empty$const))))))), prepend(a(prepend(styles(prepend(["opacity", "0.7"], List$Empty$const)), List$Empty$const), prepend(text3(puzzle.next), List$Empty$const)), List$Empty$const))));
+}
+function past_clue(puzzle, guess_word) {
+  return div(prepend(styles(row_styles()), List$Empty$const), prepend(a(prepend(styles(prepend(["opacity", "0.7"], List$Empty$const)), List$Empty$const), prepend(text3(puzzle.previous), List$Empty$const)), prepend(a(prepend(styles(prepend(["font-weight", "bold"], List$Empty$const)), List$Empty$const), prepend(text3(guess_word), List$Empty$const)), prepend(a(prepend(styles(prepend(["opacity", "0.7"], List$Empty$const)), List$Empty$const), prepend(text3(puzzle.next), List$Empty$const)), List$Empty$const))));
+}
+function clue_prompt(model, puzzle) {
+  return div(prepend(styles(prepend(["display", "flex"], prepend(["flex-direction", "column"], List$Empty$const))), List$Empty$const), prepend((() => {
+    let $ = model.game_over;
+    if ($) {
+      return past_clue(puzzle, (() => {
+        let _pipe = first(model.guesses);
+        return unwrap2(_pipe, "");
+      })());
+    } else {
+      return active_clue(puzzle, model);
+    }
+  })(), List$Empty$const));
+}
+function prompt_styles() {
+  return prepend(["width", "40%"], prepend(["box-sizing", "border-box"], prepend(["background-color", card_bg], prepend(["color", "#fff"], prepend(["padding", "24px"], prepend(["box-shadow", "0 10px 60px rgba(0, 0, 0, 0.4)"], List$Empty$const))))));
+}
+function view(model) {
+  let _block;
+  let $ = model.puzzle;
+  if ($ instanceof Some) {
+    let puz = $[0];
+    _block = puz;
+  } else {
+    _block = default$;
+  }
+  let puzzle = _block;
+  return div(prepend(styles(prepend(["min-height", "100vh"], prepend(["box-sizing", "border-box"], prepend(["display", "flex"], prepend(["flex-direction", "column"], prepend(["align-items", "center"], prepend(["gap", "24px"], prepend(["padding", "48px 20px"], prepend(["background-color", page_bg], prepend([
+    "font-family",
+    "system-ui, -apple-system, sans-serif"
+  ], List$Empty$const)))))))))), List$Empty$const), prepend(div(prepend(styles(prompt_styles()), List$Empty$const), prepend(clue_prompt(model, puzzle), List$Empty$const)), prepend((() => {
+    let $1 = model.already_played_popup_open;
+    if ($1) {
+      let $2 = model.already_played;
+      if ($2 instanceof Some) {
+        let i = $2[0];
+        return already_played_popup(i);
+      } else {
+        return none2();
+      }
+    } else {
+      return none2();
+    }
+  })(), prepend((() => {
+    let $1 = model.popup_open;
+    if ($1) {
+      let $2 = model.won;
+      if ($2) {
+        return win_popup(model.score);
+      } else {
+        return lose_popup(model.score);
+      }
+    } else {
+      return none2();
+    }
+  })(), List$Empty$const))));
+}
+function history_to_json(history) {
+  let scores = history.scores;
+  let username = history.username;
+  return object2(prepend(["scores", dict3(scores, to_string, int3)], prepend([
+    "username",
+    (() => {
+      if (username instanceof Some) {
+        let value3 = username[0];
+        return string3(value3);
+      } else {
+        return null$();
+      }
+    })()
+  ], List$Empty$const)));
+}
+function add_score_and_update(history, score) {
+  let _block;
+  let _pipe = now();
+  _block = getTime(_pipe);
+  let time = _block;
+  let date_since_epoch = divideInt(time, ms_per_day);
+  let new_history = new History(insert(history.scores, date_since_epoch, score), history.username);
+  let _block$1;
+  let _pipe$1 = localStorage();
+  _block$1 = map5(_pipe$1, (_capture) => {
+    return setItem(_capture, "history", to_string2(history_to_json(new_history)));
+  });
+  let $ = _block$1;
+  return;
+}
+function find_candidate(loop$candidates, loop$guess) {
+  while (true) {
+    let candidates = loop$candidates;
+    let guess = loop$guess;
+    if (candidates instanceof Empty) {
+      return Option$None$const;
+    } else {
+      let candidate = candidates.head;
+      let rest = candidates.tail;
+      let $ = lowercase(candidate.word) === guess;
+      if ($) {
+        return new Some(candidate);
+      } else {
+        loop$candidates = rest;
+        loop$guess = guess;
+      }
+    }
+  }
+}
+function score_for_guess(candidates, guess) {
+  let _block;
+  let _pipe = guess;
+  let _pipe$1 = trim(_pipe);
+  _block = lowercase(_pipe$1);
+  let normalized_guess = _block;
+  let _block$1;
+  let _pipe$2 = candidates;
+  let _pipe$3 = max(_pipe$2, (a2, b) => {
+    return compare2(a2.count, b.count);
+  });
+  let _pipe$4 = map5(_pipe$3, (a2) => {
+    return a2.count;
+  });
+  _block$1 = unwrap2(_pipe$4, 0);
+  let max_score = _block$1;
+  let $ = find_candidate(candidates, normalized_guess);
+  if ($ instanceof Some) {
+    let total = max_score;
+    if (total > 0) {
+      let candidate = $[0];
+      let score = divideInt(candidate.count * 100, total);
+      if (score === 0) {
+        return 1;
+      } else {
+        return score;
+      }
+    } else {
+      return 0;
+    }
+  } else {
+    return 0;
+  }
+}
+function update2(model, message) {
+  if (message instanceof Nothing) {
+    return [model, none()];
+  } else if (message instanceof ClosePopup) {
+    return [
+      new Model(model.puzzle, false, model.won, model.score, model.guesses, model.current_guess, model.game_over, model.history, model.already_played, model.already_played_popup_open),
+      none()
+    ];
+  } else if (message instanceof ClosePlayedPopup) {
+    return [
+      new Model(model.puzzle, model.popup_open, model.won, model.score, model.guesses, model.current_guess, model.game_over, model.history, model.already_played, false),
+      none()
+    ];
+  } else if (message instanceof UpdateInput) {
+    let input$1 = message[0];
+    return [
+      new Model(model.puzzle, model.popup_open, model.won, model.score, model.guesses, input$1, model.game_over, model.history, model.already_played, model.already_played_popup_open),
+      none()
+    ];
+  } else {
+    let key3 = message[0];
+    if (key3 === "Enter") {
+      return [
+        (() => {
+          let puzzle = unwrap(model.puzzle, default$);
+          let score = score_for_guess(puzzle.candidates, model.current_guess);
+          add_score_and_update(model.history, score);
+          return new Model(model.puzzle, true, score > 0, score, append(model.guesses, prepend(model.current_guess, List$Empty$const)), "", true, model.history, model.already_played, model.already_played_popup_open);
+        })(),
+        none()
+      ];
+    } else {
+      return [model, none()];
+    }
+  }
+}
+function get_date() {
+  let _block;
+  let _pipe = now();
+  _block = getTime(_pipe);
+  let time = _block;
+  return divideInt(time, ms_per_day);
+}
+function history_decoder() {
+  return field("scores", dict2(string2, int2), (scores) => {
+    let _block;
+    let _pipe = scores;
+    let _pipe$1 = keys(_pipe);
+    let _pipe$2 = map3(_pipe$1, parse_int);
+    _block = map3(_pipe$2, (_capture) => {
+      return unwrap2(_capture, 0);
+    });
+    let dates = _block;
+    let scores$1 = from_list(zip(dates, values(scores)));
+    return field("username", optional(string2), (username) => {
+      return success(new History(scores$1, username));
+    });
+  });
+}
+function init(puzzle) {
+  let _block;
+  let _pipe = localStorage();
+  let _pipe$1 = map5(_pipe, (_capture) => {
+    return getItem(_capture, "history");
+  });
+  let _pipe$2 = flatten2(_pipe$1);
+  let _pipe$3 = from_result(_pipe$2);
+  let _pipe$4 = flatten(_pipe$3);
+  let _pipe$5 = map(_pipe$4, (_capture) => {
+    return parse(_capture, history_decoder());
+  });
+  let _pipe$6 = map(_pipe$5, from_result);
+  let _pipe$7 = flatten(_pipe$6);
+  _block = unwrap(_pipe$7, new History(make(), new Some("goober")));
+  let history = _block;
+  let _block$1;
+  let $ = get(history.scores, get_date());
+  if ($ instanceof Ok) {
+    let i = $[0];
+    _block$1 = new Some(i);
+  } else {
+    _block$1 = Option$None$const;
+  }
+  let past = _block$1;
+  echo(puzzle, undefined, "src/client.gleam", 341);
+  return [
+    new Model(puzzle, false, false, 0, List$Empty$const, "", false, history, past, is_some(past)),
+    none()
+  ];
+}
+function main() {
+  let _block;
+  let _pipe = querySelector("#model");
+  let _pipe$1 = map5(_pipe, innerText);
+  let _pipe$2 = unwrap2(_pipe$1, "");
+  let _pipe$3 = parse(_pipe$2, puzzle_decoder());
+  _block = from_result(_pipe$3);
+  let flags = _block;
+  let app = application(init, update2, view);
+  let $ = start4(app, "#app", flags);
+  if (!($ instanceof Ok)) {
+    throw makeError("let_assert", FILEPATH, "client", 30, "main", "Pattern match failed, no pattern matched the value.", { value: $, start: 843, end: 894, pattern_start: 854, pattern_end: 859 });
+  }
+  return;
+}
+function echo(value3, message, file, line) {
+  const grey = "\x1B[90m";
+  const reset_color = "\x1B[39m";
+  const file_line = `${file}:${line}`;
+  const inspector = new Echo$Inspector;
+  const string_value = inspector.inspect(value3);
+  const string_message = message === undefined ? "" : " " + message;
+  if (globalThis.process?.stderr?.write) {
+    const string5 = `${grey}${file_line}${reset_color}${string_message}
+${string_value}
+`;
+    globalThis.process.stderr.write(string5);
+  } else if (globalThis.Deno) {
+    const string5 = `${grey}${file_line}${reset_color}${string_message}
+${string_value}
+`;
+    globalThis.Deno.stderr.writeSync(new TextEncoder().encode(string5));
+  } else {
+    const string5 = `${file_line}${string_message}
+${string_value}`;
+    globalThis.console.log(string5);
+  }
+  return value3;
+}
+
+class Echo$Inspector {
+  #references = new globalThis.Set;
+  #isDict(value3) {
+    try {
+      const empty_dict = make();
+      const dict_class = empty_dict.constructor;
+      return value3 instanceof dict_class;
+    } catch {
+      return false;
+    }
+  }
+  #float(float3) {
+    const string5 = float3.toString().replace("+", "");
+    if (string5.indexOf(".") >= 0) {
+      return string5;
+    } else {
+      const index5 = string5.indexOf("e");
+      if (index5 >= 0) {
+        return string5.slice(0, index5) + ".0" + string5.slice(index5);
+      } else if (globalThis.Number.isInteger(float3)) {
+        return string5 + ".0";
+      } else {
+        return "//js(" + string5 + ")";
+      }
+    }
+  }
+  inspect(v) {
+    const t = typeof v;
+    if (v === true)
+      return "True";
+    if (v === false)
+      return "False";
+    if (v === null)
+      return "//js(null)";
+    if (v === undefined)
+      return "Nil";
+    if (t === "string")
+      return this.#string(v);
+    if (t === "bigint" || globalThis.Number.isSafeInteger(v))
+      return v.toString();
+    if (t === "number")
+      return this.#float(v);
+    if (v instanceof UtfCodepoint)
+      return this.#utfCodepoint(v);
+    if (v instanceof BitArray)
+      return this.#bit_array(v);
+    if (v instanceof globalThis.RegExp)
+      return `//js(${v})`;
+    if (v instanceof globalThis.Date)
+      return `//js(Date("${v.toISOString()}"))`;
+    if (v instanceof globalThis.Error)
+      return `//js(${v.toString()})`;
+    if (v instanceof globalThis.Function) {
+      const args = [];
+      for (const i of globalThis.Array(v.length).keys())
+        args.push(globalThis.String.fromCharCode(i + 97));
+      return `//fn(${args.join(", ")}) { ... }`;
+    }
+    if (this.#references.size === this.#references.add(v).size) {
+      return "//js(circular reference)";
+    }
+    let printed;
+    if (globalThis.Array.isArray(v)) {
+      printed = `#(${v.map((v2) => this.inspect(v2)).join(", ")})`;
+    } else if (v instanceof List) {
+      printed = this.#list(v);
+    } else if (v instanceof CustomType) {
+      printed = this.#customType(v);
+    } else if (this.#isDict(v)) {
+      printed = this.#dict(v);
+    } else if (v instanceof Set) {
+      return `//js(Set(${[...v].map((v2) => this.inspect(v2)).join(", ")}))`;
+    } else {
+      printed = this.#object(v);
+    }
+    this.#references.delete(v);
+    return printed;
+  }
+  #object(v) {
+    const name = globalThis.Object.getPrototypeOf(v)?.constructor?.name || "Object";
+    const props = [];
+    for (const k of globalThis.Object.keys(v)) {
+      props.push(`${this.inspect(k)}: ${this.inspect(v[k])}`);
+    }
+    const body2 = props.length ? " " + props.join(", ") + " " : "";
+    const head = name === "Object" ? "" : name + " ";
+    return `//js(${head}{${body2}})`;
+  }
+  #dict(map9) {
+    let body2 = "dict.from_list([";
+    let first2 = true;
+    let key_value_pairs = fold(map9, [], (pairs, key3, value3) => {
+      pairs.push([key3, value3]);
+      return pairs;
+    });
+    key_value_pairs.sort();
+    key_value_pairs.forEach(([key3, value3]) => {
+      if (!first2)
+        body2 = body2 + ", ";
+      body2 = body2 + "#(" + this.inspect(key3) + ", " + this.inspect(value3) + ")";
+      first2 = false;
+    });
+    return body2 + "])";
+  }
+  #customType(record) {
+    const props = globalThis.Object.keys(record).map((label) => {
+      const value3 = this.inspect(record[label]);
+      return isNaN(parseInt(label)) ? `${label}: ${value3}` : value3;
+    }).join(", ");
+    return props ? `${record.constructor.name}(${props})` : record.constructor.name;
+  }
+  #list(list4) {
+    if (list4 instanceof Empty) {
+      return "[]";
+    }
+    let char_out = 'charlist.from_string("';
+    let list_out = "[";
+    let current = list4;
+    while (current instanceof NonEmpty) {
+      let element4 = current.head;
+      current = current.tail;
+      if (list_out !== "[") {
+        list_out += ", ";
+      }
+      list_out += this.inspect(element4);
+      if (char_out) {
+        if (globalThis.Number.isInteger(element4) && element4 >= 32 && element4 <= 126) {
+          char_out += globalThis.String.fromCharCode(element4);
+        } else {
+          char_out = null;
+        }
+      }
+    }
+    if (char_out) {
+      return char_out + '")';
+    } else {
+      return list_out + "]";
+    }
+  }
+  #string(str) {
+    let new_str = '"';
+    for (let i = 0;i < str.length; i++) {
+      const char = str[i];
+      switch (char) {
+        case `
+`:
+          new_str += "\\n";
+          break;
+        case "\r":
+          new_str += "\\r";
+          break;
+        case "\t":
+          new_str += "\\t";
+          break;
+        case "\f":
+          new_str += "\\f";
+          break;
+        case "\\":
+          new_str += "\\\\";
+          break;
+        case '"':
+          new_str += "\\\"";
+          break;
+        default:
+          if (char < " " || char > "~" && char < " ") {
+            new_str += "\\u{" + char.charCodeAt(0).toString(16).toUpperCase().padStart(4, "0") + "}";
+          } else {
+            new_str += char;
+          }
+      }
+    }
+    new_str += '"';
+    return new_str;
+  }
+  #utfCodepoint(codepoint2) {
+    return `//utfcodepoint(${globalThis.String.fromCodePoint(codepoint2.value)})`;
+  }
+  #bit_array(bits2) {
+    if (bits2.bitSize === 0) {
+      return "<<>>";
+    }
+    let acc = "<<";
+    for (let i = 0;i < bits2.byteSize - 1; i++) {
+      acc += bits2.byteAt(i).toString();
+      acc += ", ";
+    }
+    if (bits2.byteSize * 8 === bits2.bitSize) {
+      acc += bits2.byteAt(bits2.byteSize - 1).toString();
+    } else {
+      const trailingBitsCount = bits2.bitSize % 8;
+      acc += bits2.byteAt(bits2.byteSize - 1) >> 8 - trailingBitsCount;
+      acc += `:size(${trailingBitsCount})`;
+    }
+    acc += ">>";
+    return acc;
+  }
+}
+
+// .lustre/build/client.mjs
+main();
diff --git a/gleam/server/static/favicon.ico b/gleam/server/static/favicon.ico
new file mode 100644 (file)
index 0000000..d46ff65
Binary files /dev/null and b/gleam/server/static/favicon.ico differ
diff --git a/gleam/server/test/server_test.gleam b/gleam/server/test/server_test.gleam
new file mode 100644 (file)
index 0000000..fba3c88
--- /dev/null
@@ -0,0 +1,13 @@
+import gleeunit
+
+pub fn main() -> Nil {
+  gleeunit.main()
+}
+
+// gleeunit test functions end in `_test`
+pub fn hello_world_test() {
+  let name = "Joe"
+  let greeting = "Hello, " <> name <> "!"
+
+  assert greeting == "Hello, Joe!"
+}
diff --git a/gleam/shared/.gitignore b/gleam/shared/.gitignore
new file mode 100644 (file)
index 0000000..599be4e
--- /dev/null
@@ -0,0 +1,4 @@
+*.beam
+*.ez
+/build
+erl_crash.dump
diff --git a/gleam/shared/README.md b/gleam/shared/README.md
new file mode 100644 (file)
index 0000000..dd2354b
--- /dev/null
@@ -0,0 +1,24 @@
+# shared
+
+[![Package Version](https://img.shields.io/hexpm/v/shared)](https://hex.pm/packages/shared)
+[![Hex Docs](https://img.shields.io/badge/hex-docs-ffaff3)](https://shared.hexdocs.pm/)
+
+```sh
+gleam add shared@1
+```
+```gleam
+import shared
+
+pub fn main() -> Nil {
+  // TODO: An example of the project in use
+}
+```
+
+Further documentation can be found at <https://shared.hexdocs.pm/>.
+
+## Development
+
+```sh
+gleam run   # Run the project
+gleam test  # Run the tests
+```
diff --git a/gleam/shared/gleam.toml b/gleam/shared/gleam.toml
new file mode 100644 (file)
index 0000000..149e633
--- /dev/null
@@ -0,0 +1,21 @@
+name = "shared"
+version = "1.0.0"
+
+# Fill out these fields if you intend to generate HTML documentation or publish
+# your project to the Hex package manager.
+#
+# description = ""
+# licences = ["Apache-2.0"]
+# repository = { type = "github", user = "", repo = "" }
+# links = [{ title = "Website", href = "" }]
+#
+# For a full reference of all the available options, you can have a look at
+# https://gleam.run/writing-gleam/gleam-toml/.
+
+[dependencies]
+gleam_stdlib = ">= 1.0.0 and < 2.0.0"
+gleam_json = ">= 3.1.0 and < 4.0.0"
+simplifile = ">= 2.7.0 and < 3.0.0"
+
+[dev_dependencies]
+gleeunit = ">= 1.0.0 and < 2.0.0"
diff --git a/gleam/shared/manifest.toml b/gleam/shared/manifest.toml
new file mode 100644 (file)
index 0000000..34ff7c6
--- /dev/null
@@ -0,0 +1,21 @@
+# Do not manually edit this file, it is managed by Gleam.
+#
+# This file locks the dependency versions used, to make your build
+# deterministic and to prevent unexpected versions from being included
+# in your application.
+#
+# You should check this file into your source control repository.
+
+packages = [
+  { name = "filepath", version = "1.1.2", build_tools = ["gleam"], requirements = ["gleam_stdlib"], otp_app = "filepath", source = "hex", outer_checksum = "B06A9AF0BF10E51401D64B98E4B627F1D2E48C154967DA7AF4D0914780A6D40A" },
+  { name = "gleam_json", version = "3.1.0", build_tools = ["gleam"], requirements = ["gleam_stdlib"], otp_app = "gleam_json", source = "hex", outer_checksum = "44FDAA8847BE8FC48CA7A1C089706BD54BADCC4C45B237A992EDDF9F2CDB2836" },
+  { name = "gleam_stdlib", version = "1.0.5", build_tools = ["gleam"], requirements = [], otp_app = "gleam_stdlib", source = "hex", outer_checksum = "CEE5B6C076A85B45F60C585F4316C63EC8B7127C119D5738C3958A9C4D50404E" },
+  { name = "gleeunit", version = "1.11.0", build_tools = ["gleam"], requirements = ["gleam_stdlib"], otp_app = "gleeunit", source = "hex", outer_checksum = "EC31ABA74256AEA531EDF8169931D775BBB384FED0A8A1BDC4DD9354E3E21826" },
+  { name = "simplifile", version = "2.7.0", build_tools = ["gleam"], requirements = ["filepath", "gleam_stdlib"], otp_app = "simplifile", source = "hex", outer_checksum = "A2727627B063E87351934C7F7F008F2D1FDB16F6DE0B8C79F9E46459CFC9C164" },
+]
+
+[requirements]
+gleam_json = { version = ">= 3.1.0 and < 4.0.0" }
+gleam_stdlib = { version = ">= 1.0.0 and < 2.0.0" }
+gleeunit = { version = ">= 1.0.0 and < 2.0.0" }
+simplifile = { version = ">= 2.7.0 and < 3.0.0" }
diff --git a/gleam/shared/src/shared.gleam b/gleam/shared/src/shared.gleam
new file mode 100644 (file)
index 0000000..9f7c74d
--- /dev/null
@@ -0,0 +1,53 @@
+import gleam/dynamic/decode
+import gleam/io
+import gleam/json
+
+pub fn main() -> Nil {
+  io.println("Hello from shared!")
+  panic as "why am i here"
+}
+
+pub type Puzzle {
+  Puzzle(
+    previous: String,
+    next: String,
+    candidates: List(Candidate),
+    order: Int,
+  )
+}
+
+pub fn puzzle_to_json(puzzle: Puzzle) -> json.Json {
+  let Puzzle(previous:, next:, candidates:, order:) = puzzle
+  json.object([
+    #("previous", json.string(previous)),
+    #("next", json.string(next)),
+    #("candidates", json.array(candidates, candidate_to_json)),
+    #("order", json.int(order)),
+  ])
+}
+
+pub fn puzzle_decoder() -> decode.Decoder(Puzzle) {
+  use previous <- decode.field("previous", decode.string)
+  use next <- decode.field("next", decode.string)
+  use candidates <- decode.field("candidates", decode.list(candidate_decoder()))
+  use order <- decode.field("order", decode.int)
+  decode.success(Puzzle(previous:, next:, candidates:, order:))
+}
+
+pub type Candidate {
+  Candidate(word: String, count: Int)
+}
+
+fn candidate_to_json(candidate: Candidate) -> json.Json {
+  let Candidate(word:, count:) = candidate
+  json.object([
+    #("word", json.string(word)),
+    #("count", json.int(count)),
+  ])
+}
+
+fn candidate_decoder() -> decode.Decoder(Candidate) {
+  use word <- decode.field("word", decode.string)
+  use count <- decode.field("count", decode.int)
+  decode.success(Candidate(word:, count:))
+}
diff --git a/gleam/shared/test/shared_test.gleam b/gleam/shared/test/shared_test.gleam
new file mode 100644 (file)
index 0000000..fba3c88
--- /dev/null
@@ -0,0 +1,13 @@
+import gleeunit
+
+pub fn main() -> Nil {
+  gleeunit.main()
+}
+
+// gleeunit test functions end in `_test`
+pub fn hello_world_test() {
+  let name = "Joe"
+  let greeting = "Hello, " <> name <> "!"
+
+  assert greeting == "Hello, Joe!"
+}
diff --git a/puzzler/.gitignore b/puzzler/.gitignore
new file mode 100644 (file)
index 0000000..ea8c4bf
--- /dev/null
@@ -0,0 +1 @@
+/target
diff --git a/puzzler/Cargo.lock b/puzzler/Cargo.lock
new file mode 100644 (file)
index 0000000..5fd7421
--- /dev/null
@@ -0,0 +1,1868 @@
+# This file is automatically @generated by Cargo.
+# It is not intended for manual editing.
+version = 4
+
+[[package]]
+name = "addr2line"
+version = "0.25.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "1b5d307320b3181d6d7954e663bd7c774a838b8220fe0593c86d9fb09f498b4b"
+dependencies = [
+ "gimli",
+]
+
+[[package]]
+name = "adler2"
+version = "2.0.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "320119579fcad9c21884f5c4861d16174d0e06250625266f50fe6898340abefa"
+
+[[package]]
+name = "atomic-waker"
+version = "1.1.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "1505bd5d3d116872e7271a6d4e16d81d0c8570876c8de68093a09ac269d8aac0"
+
+[[package]]
+name = "autocfg"
+version = "1.5.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "f2032f911046de80f0a198e0901378627c33f59ea0ac00e363d481118bd70a53"
+
+[[package]]
+name = "aws-lc-rs"
+version = "1.18.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "ce2b2dcc879c3bae0d371e77c99f2238400ef24ec001394befa67b6e543add9e"
+dependencies = [
+ "aws-lc-sys",
+ "zeroize",
+]
+
+[[package]]
+name = "aws-lc-sys"
+version = "0.44.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "f09fae7be8bb3174e05c6afdb34199e6dc0c7c04ba9fa237b1967adfbde27483"
+dependencies = [
+ "cc",
+ "cmake",
+ "dunce",
+ "fs_extra",
+ "pkg-config",
+]
+
+[[package]]
+name = "backtrace"
+version = "0.3.76"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "bb531853791a215d7c62a30daf0dde835f381ab5de4589cfe7c649d2cbe92bd6"
+dependencies = [
+ "addr2line",
+ "cfg-if",
+ "libc",
+ "miniz_oxide",
+ "object",
+ "rustc-demangle",
+ "windows-link",
+]
+
+[[package]]
+name = "base64"
+version = "0.22.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "72b3254f16251a8381aa12e40e3c4d2f0199f8c6508fbecb9d91f575e0fbb8c6"
+
+[[package]]
+name = "bincode"
+version = "2.0.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "36eaf5d7b090263e8150820482d5d93cd964a81e4019913c972f4edcc6edb740"
+dependencies = [
+ "bincode_derive",
+ "serde",
+ "unty",
+]
+
+[[package]]
+name = "bincode_derive"
+version = "2.0.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "bf95709a440f45e986983918d0e8a1f30a9b1df04918fc828670606804ac3c09"
+dependencies = [
+ "virtue",
+]
+
+[[package]]
+name = "bitflags"
+version = "2.13.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "b588b76d00fde79687d7646a9b5bdf3cc0f655e0bbd080335a95d7e96f3587da"
+
+[[package]]
+name = "bumpalo"
+version = "3.20.3"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "72f5acc6cb2ba439de613abc23857ec3d78374d8ed5ac84e9d11336e87da8649"
+
+[[package]]
+name = "bytes"
+version = "1.12.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "fc652a48c352aef3ea3aed32080501cf3ef6ed5da78602a020c991775b0aff04"
+
+[[package]]
+name = "cc"
+version = "1.4.4"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "0ad534f4357a5264cce5019c989cf66a4f0dc4e0d1b1d15f8aacec0ff7360273"
+dependencies = [
+ "find-msvc-tools",
+ "jobserver",
+ "libc",
+ "shlex",
+]
+
+[[package]]
+name = "cfg-if"
+version = "1.0.4"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "9330f8b2ff13f34540b44e946ef35111825727b38d33286ef986142615121801"
+
+[[package]]
+name = "cfg_aliases"
+version = "0.2.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "f079e83a288787bcd14a6aea84cee5c87a67c5a3e660c30f557a3d24761b3527"
+
+[[package]]
+name = "chacha20"
+version = "0.10.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "65c35e4b699c7e15ccbe7ee35c005e4fc0a278d22238a2857e6ce2dadeda1b06"
+dependencies = [
+ "cfg-if",
+ "cpufeatures",
+ "rand_core",
+]
+
+[[package]]
+name = "cmake"
+version = "0.1.58"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "c0f78a02292a74a88ac736019ab962ece0bc380e3f977bf72e376c5d78ff0678"
+dependencies = [
+ "cc",
+]
+
+[[package]]
+name = "color-eyre"
+version = "0.6.5"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "e5920befb47832a6d61ee3a3a846565cfa39b331331e68a3b1d1116630f2f26d"
+dependencies = [
+ "backtrace",
+ "color-spantrace",
+ "eyre",
+ "indenter",
+ "once_cell",
+ "owo-colors",
+ "tracing-error",
+]
+
+[[package]]
+name = "color-spantrace"
+version = "0.3.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "b8b88ea9df13354b55bc7234ebcce36e6ef896aca2e42a15de9e10edce01b427"
+dependencies = [
+ "once_cell",
+ "owo-colors",
+ "tracing-core",
+ "tracing-error",
+]
+
+[[package]]
+name = "combine"
+version = "4.6.8"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "cfc320937d09e6de266b31b9afb480f197d7a861be86be7cb2ea7e5d1bfffc5e"
+dependencies = [
+ "bytes",
+ "memchr",
+]
+
+[[package]]
+name = "core-foundation"
+version = "0.9.4"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "91e195e091a93c46f7102ec7818a2aa394e1e1771c3ab4825963fa03e45afb8f"
+dependencies = [
+ "core-foundation-sys",
+ "libc",
+]
+
+[[package]]
+name = "core-foundation"
+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 = "cpufeatures"
+version = "0.3.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "5ca28b0ae3115b884660db4118d803791fd6756b6e88f39c0f3f7859060d7566"
+dependencies = [
+ "libc",
+]
+
+[[package]]
+name = "displaydoc"
+version = "0.2.7"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "c6232dd377dcc64799954cbd3a9bb882e9cdc1308ccd87b1c098f1fb2eaf82a8"
+dependencies = [
+ "proc-macro2",
+ "quote",
+ "syn 3.0.4",
+]
+
+[[package]]
+name = "dunce"
+version = "1.0.5"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "92773504d58c093f6de2459af4af33faa518c13451eb8f2b5698ed3d36e7c813"
+
+[[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 = "eyre"
+version = "0.6.14"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "c08309dbcc659c5549a24ddb9b27027640641b282ef5768267c7e675558986a3"
+dependencies = [
+ "autocfg",
+ "indenter",
+ "once_cell",
+]
+
+[[package]]
+name = "find-msvc-tools"
+version = "0.1.11"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "d45db016d36b838f563236e9193d0ee6ce38f3f68b6c94e914b4929c96bbb890"
+
+[[package]]
+name = "fnv"
+version = "1.0.7"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1"
+
+[[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 = "fs_extra"
+version = "1.3.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "42703706b716c37f96a77aea830392ad231f44c9e9a67872fa5548707e11b11c"
+
+[[package]]
+name = "futures-channel"
+version = "0.3.34"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "b1f9e3d69d39e4862ffed03ed071a76f9a13ba1d9109d355b0f0aa6b15e393c4"
+dependencies = [
+ "futures-core",
+]
+
+[[package]]
+name = "futures-core"
+version = "0.3.34"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "92d699e522242e69e3003b94ecc1f960f3a5e015aa7c5d7486e65ad01dd94f5e"
+
+[[package]]
+name = "futures-sink"
+version = "0.3.34"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "1944426bf7d03f1d14f708785e4b33efd750b36d48a157b836b3efc15ede8e1d"
+
+[[package]]
+name = "futures-task"
+version = "0.3.34"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "cd417de3d1d015fc3bfd2b1ea46dfc7bab72ef86f1cc7cc9c78e728b34a6d1fd"
+
+[[package]]
+name = "futures-util"
+version = "0.3.34"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "0d50a92467f8ba5dd6e3ee5d4bd04d73ab2e4e1c44474a0674821dfce14b79bc"
+dependencies = [
+ "futures-core",
+ "futures-task",
+ "pin-project-lite",
+ "slab",
+]
+
+[[package]]
+name = "getrandom"
+version = "0.2.17"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "ff2abc00be7fca6ebc474524697ae276ad847ad0a6b3faa4bcb027e9a4614ad0"
+dependencies = [
+ "cfg-if",
+ "js-sys",
+ "libc",
+ "wasi",
+ "wasm-bindgen",
+]
+
+[[package]]
+name = "getrandom"
+version = "0.4.3"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "300e883d756b2e4ec94e02791f39b04b522276138852cfc41d9fb7e904106099"
+dependencies = [
+ "cfg-if",
+ "js-sys",
+ "libc",
+ "r-efi",
+ "rand_core",
+ "wasm-bindgen",
+]
+
+[[package]]
+name = "gimli"
+version = "0.32.3"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "e629b9b98ef3dd8afe6ca2bd0f89306cec16d43d907889945bc5d6687f2f13c7"
+
+[[package]]
+name = "h2"
+version = "0.4.19"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "ef8e5e5a340588f4452631496976cf8636d4a7ecf600239fdc27615d2530bc16"
+dependencies = [
+ "atomic-waker",
+ "bytes",
+ "fnv",
+ "futures-core",
+ "futures-sink",
+ "http",
+ "indexmap",
+ "slab",
+ "tokio",
+ "tokio-util",
+ "tracing",
+]
+
+[[package]]
+name = "hashbrown"
+version = "0.17.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "ed5909b6e89a2db4456e54cd5f673791d7eca6732202bbf2a9cc504fe2f9b84a"
+
+[[package]]
+name = "http"
+version = "1.5.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "918d3568bebf352712bc2ef3d46a8bcf1a75b373be6539de198e9105cbbf9ce0"
+dependencies = [
+ "bytes",
+ "itoa",
+]
+
+[[package]]
+name = "http-body"
+version = "1.1.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "ca2a8f2913ee65f60facd6a5905613afaa448497a0230cc41ce022d93290bc2c"
+dependencies = [
+ "bytes",
+ "http",
+]
+
+[[package]]
+name = "http-body-util"
+version = "0.1.5"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "23169fe34a5fbcdd3f3862e78fb9b6fccd5f02a6dc6f732547005d45631ce71c"
+dependencies = [
+ "bytes",
+ "futures-core",
+ "http",
+ "http-body",
+ "pin-project-lite",
+]
+
+[[package]]
+name = "httparse"
+version = "1.10.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "6dbf3de79e51f3d586ab4cb9d5c3e2c14aa28ed23d180cf89b4df0454a69cc87"
+
+[[package]]
+name = "hyper"
+version = "1.11.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "27b501faa50e7a26c3d3560ca625132f4078a17771f4810baf70475ae48cbe43"
+dependencies = [
+ "atomic-waker",
+ "bytes",
+ "futures-channel",
+ "futures-core",
+ "h2",
+ "http",
+ "http-body",
+ "httparse",
+ "itoa",
+ "pin-project-lite",
+ "smallvec",
+ "tokio",
+ "want",
+]
+
+[[package]]
+name = "hyper-rustls"
+version = "0.27.9"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "33ca68d021ef39cf6463ab54c1d0f5daf03377b70561305bb89a8f83aab66e0f"
+dependencies = [
+ "http",
+ "hyper",
+ "hyper-util",
+ "rustls",
+ "tokio",
+ "tokio-rustls",
+ "tower-service",
+]
+
+[[package]]
+name = "hyper-util"
+version = "0.1.20"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "96547c2556ec9d12fb1578c4eaf448b04993e7fb79cbaad930a656880a6bdfa0"
+dependencies = [
+ "base64",
+ "bytes",
+ "futures-channel",
+ "futures-util",
+ "http",
+ "http-body",
+ "hyper",
+ "ipnet",
+ "libc",
+ "percent-encoding",
+ "pin-project-lite",
+ "socket2",
+ "system-configuration",
+ "tokio",
+ "tower-service",
+ "tracing",
+ "windows-registry",
+]
+
+[[package]]
+name = "icu_collections"
+version = "2.3.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "fa68d21081c4a05d5a901a1c62add574c77048b6a1c67be3b50ce0b60d4ca513"
+dependencies = [
+ "displaydoc",
+ "potential_utf",
+ "utf8_iter",
+ "yoke",
+ "zerofrom",
+ "zerovec",
+]
+
+[[package]]
+name = "icu_locale_core"
+version = "2.3.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "d56e28588da92eee5c3201a6eff33fabdd49b62269c8938d4ff050ce4d900deb"
+dependencies = [
+ "displaydoc",
+ "litemap",
+ "tinystr",
+ "writeable",
+ "zerovec",
+]
+
+[[package]]
+name = "icu_normalizer"
+version = "2.3.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "12f9cf5f235641ed274641dd81c3f28d870e276763d0797aeeab72317b1c646f"
+dependencies = [
+ "icu_collections",
+ "icu_normalizer_data",
+ "icu_properties",
+ "icu_provider",
+ "smallvec",
+ "zerovec",
+]
+
+[[package]]
+name = "icu_normalizer_data"
+version = "2.3.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "1563da1ed3e0b3bf3d74c9b85917ac9c56464d2f57242270c09c9e752f8021a0"
+
+[[package]]
+name = "icu_properties"
+version = "2.3.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "7e7ca276ad3145661a65914e6daf131ca5120cd3dcee8f8f3214b8875184a148"
+dependencies = [
+ "displaydoc",
+ "icu_collections",
+ "icu_locale_core",
+ "icu_properties_data",
+ "icu_provider",
+ "zerotrie",
+ "zerovec",
+]
+
+[[package]]
+name = "icu_properties_data"
+version = "2.3.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "e590f038c1464a96894fd6d10127e90a8be4509f56ff7ecef851b15cee0b7caa"
+
+[[package]]
+name = "icu_provider"
+version = "2.3.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "d27bbb9d3abbefac45d55f647c9de1d44aafcd1186eb91879afef17c396c3e73"
+dependencies = [
+ "displaydoc",
+ "icu_locale_core",
+ "writeable",
+ "yoke",
+ "zerofrom",
+ "zerotrie",
+ "zerovec",
+]
+
+[[package]]
+name = "idna"
+version = "1.1.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "3b0875f23caa03898994f6ddc501886a45c7d3d62d04d2d90788d47be1b1e4de"
+dependencies = [
+ "idna_adapter",
+ "smallvec",
+ "utf8_iter",
+]
+
+[[package]]
+name = "idna_adapter"
+version = "1.2.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "cb68373c0d6620ef8105e855e7745e18b0d00d3bdb07fb532e434244cdb9a714"
+dependencies = [
+ "icu_normalizer",
+ "icu_properties",
+]
+
+[[package]]
+name = "indenter"
+version = "0.3.4"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "964de6e86d545b246d84badc0fef527924ace5134f30641c203ef52ba83f58d5"
+
+[[package]]
+name = "indexmap"
+version = "2.14.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "07aa2048142242915a31d35844fb311e0e53fcca590c3a0a40dcf1b841fa09eb"
+dependencies = [
+ "equivalent",
+ "hashbrown",
+]
+
+[[package]]
+name = "ipnet"
+version = "2.12.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "6a756c3fac73139e83f14c2d742155dd2b78d3ee56597b419a0579b7bdd6dd78"
+
+[[package]]
+name = "itoa"
+version = "1.0.18"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "8f42a60cbdf9a97f5d2305f08a87dc4e09308d1276d28c869c684d7777685682"
+
+[[package]]
+name = "jni"
+version = "0.22.4"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "5efd9a482cf3a427f00d6b35f14332adc7902ce91efb778580e180ff90fa3498"
+dependencies = [
+ "cfg-if",
+ "combine",
+ "jni-macros",
+ "jni-sys",
+ "log",
+ "simd_cesu8",
+ "thiserror",
+ "walkdir",
+ "windows-link",
+]
+
+[[package]]
+name = "jni-macros"
+version = "0.22.4"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "a00109accc170f0bdb141fed3e393c565b6f5e072365c3bd58f5b062591560a3"
+dependencies = [
+ "proc-macro2",
+ "quote",
+ "rustc_version",
+ "simd_cesu8",
+ "syn 2.0.119",
+]
+
+[[package]]
+name = "jni-sys"
+version = "0.4.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "c6377a88cb3910bee9b0fa88d4f42e1d2da8e79915598f65fb0c7ee14c878af2"
+dependencies = [
+ "jni-sys-macros",
+]
+
+[[package]]
+name = "jni-sys-macros"
+version = "0.4.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "38c0b942f458fe50cdac086d2f946512305e5631e720728f2a61aabcd47a6264"
+dependencies = [
+ "quote",
+ "syn 2.0.119",
+]
+
+[[package]]
+name = "jobserver"
+version = "0.1.35"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "1c00acbd29eabad4a2392fa0e921c874934dbbf4194312ad20f04a0ed67a3cb3"
+dependencies = [
+ "getrandom 0.4.3",
+ "libc",
+]
+
+[[package]]
+name = "js-sys"
+version = "0.3.104"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "0e0c1080212aad755ea003d18543e8768dd432c48819efd73a7bf1e39b7a5a3a"
+dependencies = [
+ "cfg-if",
+ "futures-util",
+ "wasm-bindgen",
+]
+
+[[package]]
+name = "lazy_static"
+version = "1.5.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe"
+
+[[package]]
+name = "libc"
+version = "0.2.189"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "3eaf3ede3fee6db1a4c2ee091bf8a8b4dccdc6d17f656fb07896ee72867612f2"
+
+[[package]]
+name = "litemap"
+version = "0.8.3"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "47d9d19d1d6efa0109d2f65ff4c85cddd50bd572e5a00127ab10987290bcefae"
+
+[[package]]
+name = "log"
+version = "0.4.34"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "f9f8bd3e56ce4dfc153cf470fffbfa98c7620958b312ca5c3a4b8d5181fd13c6"
+
+[[package]]
+name = "lru-slab"
+version = "0.1.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "112b39cec0b298b6c1999fee3e31427f74f676e4cb9879ed1a121b43661a4154"
+
+[[package]]
+name = "memchr"
+version = "2.8.3"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "cf8baf1c55e62ffcace7a9f06f4bd9cd3f0c4beb022d3b367256b91b87513d98"
+
+[[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",
+]
+
+[[package]]
+name = "mio"
+version = "1.2.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "30d65c71f1ce40ab09135ce117d742b9f8a19ff91a41a8b57ed50bc2de59c427"
+dependencies = [
+ "libc",
+ "wasi",
+ "windows-sys 0.61.2",
+]
+
+[[package]]
+name = "object"
+version = "0.37.3"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "ff76201f031d8863c38aa7f905eca4f53abbfa15f609db4277d44cd8938f33fe"
+dependencies = [
+ "memchr",
+]
+
+[[package]]
+name = "once_cell"
+version = "1.21.4"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "9f7c3e4beb33f85d45ae3e3a1792185706c8e16d043238c593331cc7cd313b50"
+
+[[package]]
+name = "openssl-probe"
+version = "0.2.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "7c87def4c32ab89d880effc9e097653c8da5d6ef28e6b539d313baaacfbafcbe"
+
+[[package]]
+name = "owo-colors"
+version = "4.4.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "13c45bb4a6ae1280ec0803b1ef9d3455eb50f01efbbe1447ab020f1d54fba9d8"
+
+[[package]]
+name = "percent-encoding"
+version = "2.3.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "9b4f627cb1b25917193a259e49bdad08f671f8d9708acfd5fe0a8c1455d87220"
+
+[[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.34"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "f6b464fbc74e149a392436b17d523f769e057cb6877f6a5c4618bc6f11800548"
+
+[[package]]
+name = "potential_utf"
+version = "0.1.6"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "d83eb9bc6d8e5cf568e7a1101d60ee05e81ed50ea106026f3d18deeb046d7661"
+dependencies = [
+ "zerovec",
+]
+
+[[package]]
+name = "proc-macro2"
+version = "1.0.107"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "985e7ec9bb745e6ce6535b544d84d6cd6f7ad8bd711c398938ae983b91a766d9"
+dependencies = [
+ "unicode-ident",
+]
+
+[[package]]
+name = "puzzler"
+version = "0.1.0"
+dependencies = [
+ "bincode",
+ "color-eyre",
+ "rand",
+ "reqwest",
+ "serde",
+ "serde_json",
+ "thiserror",
+ "walkdir",
+]
+
+[[package]]
+name = "quinn"
+version = "0.11.11"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "0c1a41e437b6bbd489372cd4971de128e85c855f56c57f283d20ff016cf7c0a8"
+dependencies = [
+ "bytes",
+ "cfg_aliases",
+ "pin-project-lite",
+ "quinn-proto",
+ "quinn-udp",
+ "rustc-hash",
+ "rustls",
+ "socket2",
+ "thiserror",
+ "tokio",
+ "tracing",
+ "web-time",
+]
+
+[[package]]
+name = "quinn-proto"
+version = "0.11.17"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "04759210543be93709136e28212294a659ef5001836ff4eab4d663e4529bba83"
+dependencies = [
+ "aws-lc-rs",
+ "bytes",
+ "getrandom 0.4.3",
+ "lru-slab",
+ "rand",
+ "rand_pcg",
+ "ring",
+ "rustc-hash",
+ "rustls",
+ "rustls-pki-types",
+ "slab",
+ "thiserror",
+ "tinyvec",
+ "tracing",
+ "web-time",
+]
+
+[[package]]
+name = "quinn-udp"
+version = "0.5.15"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "35a133f956daabe89a61a685c2649f13d82d5aa4bd5d12d1277e1072a21c0694"
+dependencies = [
+ "cfg_aliases",
+ "libc",
+ "once_cell",
+ "socket2",
+ "tracing",
+ "windows-sys 0.61.2",
+]
+
+[[package]]
+name = "quote"
+version = "1.0.47"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "1fbf4db142a473a8d80c26bbf18454ed458bf8d26c8219c331daecfdbd079001"
+dependencies = [
+ "proc-macro2",
+]
+
+[[package]]
+name = "r-efi"
+version = "6.0.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "f8dcc9c7d52a811697d2151c701e0d08956f92b0e24136cf4cf27b57a6a0d9bf"
+
+[[package]]
+name = "rand"
+version = "0.10.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "c7f5fa3a058cd35567ef9bfa5e75732bee0f9e4c55fa90477bef2dfcdbc4be80"
+dependencies = [
+ "chacha20",
+ "getrandom 0.4.3",
+ "rand_core",
+]
+
+[[package]]
+name = "rand_core"
+version = "0.10.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "63b8176103e19a2643978565ca18b50549f6101881c443590420e4dc998a3c69"
+
+[[package]]
+name = "rand_pcg"
+version = "0.10.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "caa0f4137e1c0a72f4c651489402276c8e8e1cf081f3b0ba156d2cbeef09e86a"
+dependencies = [
+ "rand_core",
+]
+
+[[package]]
+name = "reqwest"
+version = "0.13.4"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "219c5811de6525e5416c7d5d53bb656d3afdbc6c5af816e0802bcfa42dbdc1c3"
+dependencies = [
+ "base64",
+ "bytes",
+ "encoding_rs",
+ "futures-core",
+ "h2",
+ "http",
+ "http-body",
+ "http-body-util",
+ "hyper",
+ "hyper-rustls",
+ "hyper-util",
+ "js-sys",
+ "log",
+ "mime",
+ "percent-encoding",
+ "pin-project-lite",
+ "quinn",
+ "rustls",
+ "rustls-pki-types",
+ "rustls-platform-verifier",
+ "sync_wrapper",
+ "tokio",
+ "tokio-rustls",
+ "tower",
+ "tower-http",
+ "tower-service",
+ "url",
+ "wasm-bindgen",
+ "wasm-bindgen-futures",
+ "web-sys",
+]
+
+[[package]]
+name = "ring"
+version = "0.17.14"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "a4689e6c2294d81e88dc6261c768b63bc4fcdb852be6d1352498b114f61383b7"
+dependencies = [
+ "cc",
+ "cfg-if",
+ "getrandom 0.2.17",
+ "libc",
+ "untrusted",
+ "windows-sys 0.52.0",
+]
+
+[[package]]
+name = "rustc-demangle"
+version = "0.1.28"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "b74b56ffa8bb2830709a538c2cbcae9aa062db0d2a42563bfb09bdaae44020eb"
+
+[[package]]
+name = "rustc-hash"
+version = "2.1.3"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "6b1e7f9a428571be2dc5bc0505c13fb6bf936822b894ec87abf8a08a4e51742d"
+
+[[package]]
+name = "rustc_version"
+version = "0.4.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "cfcb3a22ef46e85b45de6ee7e79d063319ebb6594faafcf1c225ea92ab6e9b92"
+dependencies = [
+ "semver",
+]
+
+[[package]]
+name = "rustls"
+version = "0.23.43"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "0283386ce02abc0151e1761d08802dfe86c173b0b494af5cbc086574e453da06"
+dependencies = [
+ "aws-lc-rs",
+ "once_cell",
+ "rustls-pki-types",
+ "rustls-webpki",
+ "subtle",
+ "zeroize",
+]
+
+[[package]]
+name = "rustls-native-certs"
+version = "0.8.4"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "dab5152771c58876a2146916e53e35057e1a4dfa2b9df0f0305b07f611fdea4d"
+dependencies = [
+ "openssl-probe",
+ "rustls-pki-types",
+ "schannel",
+ "security-framework",
+]
+
+[[package]]
+name = "rustls-pki-types"
+version = "1.15.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "2f4925028c7eb5d1fcdaf196971378ed9d2c1c4efc7dc5d011256f76c99c0a96"
+dependencies = [
+ "web-time",
+ "zeroize",
+]
+
+[[package]]
+name = "rustls-platform-verifier"
+version = "0.7.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "26d1e2536ce4f35f4846aa13bff16bd0ff40157cdb14cc056c7b14ba41233ba0"
+dependencies = [
+ "core-foundation 0.10.1",
+ "core-foundation-sys",
+ "jni",
+ "log",
+ "once_cell",
+ "rustls",
+ "rustls-native-certs",
+ "rustls-platform-verifier-android",
+ "rustls-webpki",
+ "security-framework",
+ "security-framework-sys",
+ "webpki-root-certs",
+ "windows-sys 0.61.2",
+]
+
+[[package]]
+name = "rustls-platform-verifier-android"
+version = "0.1.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "f87165f0995f63a9fbeea62b64d10b4d9d8e78ec6d7d51fb2125fda7bb36788f"
+
+[[package]]
+name = "rustls-webpki"
+version = "0.103.15"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "f3c3cf1d8b1e7d4927e2d154c3fcb02979afb9939629c62cd9048d4f07b60ac2"
+dependencies = [
+ "aws-lc-rs",
+ "ring",
+ "rustls-pki-types",
+ "untrusted",
+]
+
+[[package]]
+name = "rustversion"
+version = "1.0.23"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "cf54715a573b99ac80df0bc206da022bcd442c974952c7b9720069370852e21f"
+
+[[package]]
+name = "same-file"
+version = "1.0.6"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "93fc1dc3aaa9bfed95e02e6eadabb4baf7e3078b0bd1b4d7b6b0b68378900502"
+dependencies = [
+ "winapi-util",
+]
+
+[[package]]
+name = "schannel"
+version = "0.1.29"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "91c1b7e4904c873ef0710c1f407dde2e6287de2bebc1bbbf7d430bb7cbffd939"
+dependencies = [
+ "windows-sys 0.61.2",
+]
+
+[[package]]
+name = "security-framework"
+version = "3.7.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "b7f4bc775c73d9a02cde8bf7b2ec4c9d12743edf609006c7facc23998404cd1d"
+dependencies = [
+ "bitflags",
+ "core-foundation 0.10.1",
+ "core-foundation-sys",
+ "libc",
+ "security-framework-sys",
+]
+
+[[package]]
+name = "security-framework-sys"
+version = "2.17.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "6ce2691df843ecc5d231c0b14ece2acc3efb62c0a398c7e1d875f3983ce020e3"
+dependencies = [
+ "core-foundation-sys",
+ "libc",
+]
+
+[[package]]
+name = "semver"
+version = "1.0.28"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "8a7852d02fc848982e0c167ef163aaff9cd91dc640ba85e263cb1ce46fae51cd"
+
+[[package]]
+name = "serde"
+version = "1.0.229"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "4148590afebada386688f18773da617792bf2ef03ffc1e4cbd2b1d45b023e0ba"
+dependencies = [
+ "serde_core",
+ "serde_derive",
+]
+
+[[package]]
+name = "serde_core"
+version = "1.0.229"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "67dca2c9c51e58a4791a4b1ed58308b39c64224d349a935ab5039aa360942a48"
+dependencies = [
+ "serde_derive",
+]
+
+[[package]]
+name = "serde_derive"
+version = "1.0.229"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "e7a5d71263a5a7d47b41f6b3f06ba276f10cc18b0931f1799f710578e2309348"
+dependencies = [
+ "proc-macro2",
+ "quote",
+ "syn 3.0.4",
+]
+
+[[package]]
+name = "serde_json"
+version = "1.0.151"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "c841b55ecdae098c80dcae9cf767f6f8a0c2cdb3416bbef72181df4d0fe73f14"
+dependencies = [
+ "itoa",
+ "memchr",
+ "serde",
+ "serde_core",
+ "zmij",
+]
+
+[[package]]
+name = "sharded-slab"
+version = "0.1.7"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "f40ca3c46823713e0d4209592e8d6e826aa57e928f09752619fc696c499637f6"
+dependencies = [
+ "lazy_static",
+]
+
+[[package]]
+name = "shlex"
+version = "2.0.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "f8fadd59c855ef2080decdef8ff161eb6661b86933c9d82e5ba29dc602a55aba"
+
+[[package]]
+name = "simd_cesu8"
+version = "1.2.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "11031e251abf8611c80f460e19dbdeb54a66db918e49c65a7065b46ac7aec520"
+dependencies = [
+ "rustc_version",
+ "simdutf8",
+]
+
+[[package]]
+name = "simdutf8"
+version = "0.1.5"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "e3a9fe34e3e7a50316060351f37187a3f546bce95496156754b601a5fa71b76e"
+
+[[package]]
+name = "slab"
+version = "0.4.12"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "0c790de23124f9ab44544d7ac05d60440adc586479ce501c1d6d7da3cd8c9cf5"
+
+[[package]]
+name = "smallvec"
+version = "1.15.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "8ed6a63f02c8539c91a8685a86f4099661ba3da017932f6ebbea6de3f0fa7c90"
+
+[[package]]
+name = "socket2"
+version = "0.6.5"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "c3d1e2c7f27f8d4cb10542a02c49005dbd6e93095799d6f3be745fae9f8fedd4"
+dependencies = [
+ "libc",
+ "windows-sys 0.61.2",
+]
+
+[[package]]
+name = "stable_deref_trait"
+version = "1.2.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "6ce2be8dc25455e1f91df71bfa12ad37d7af1092ae736f3a6cd0e37bc7810596"
+
+[[package]]
+name = "subtle"
+version = "2.6.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "13c2bddecc57b384dee18652358fb23172facb8a2c51ccc10d74c157bdea3292"
+
+[[package]]
+name = "syn"
+version = "2.0.119"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "872831b642d1a07999a962a351ed35b955ea2cfc8f3862091e2a240a84f17297"
+dependencies = [
+ "proc-macro2",
+ "quote",
+ "unicode-ident",
+]
+
+[[package]]
+name = "syn"
+version = "3.0.4"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "e6275cddf4610d1775e6d1fe9469b2e77d0f39fd98fb7450901b821e0c53649f"
+dependencies = [
+ "proc-macro2",
+ "quote",
+ "unicode-ident",
+]
+
+[[package]]
+name = "sync_wrapper"
+version = "1.0.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "0bf256ce5efdfa370213c1dabab5935a12e49f2c58d15e9eac2870d3b4f27263"
+dependencies = [
+ "futures-core",
+]
+
+[[package]]
+name = "synstructure"
+version = "0.13.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "728a70f3dbaf5bab7f0c4b1ac8d7ae5ea60a4b5549c8a5914361c99147a709d2"
+dependencies = [
+ "proc-macro2",
+ "quote",
+ "syn 2.0.119",
+]
+
+[[package]]
+name = "system-configuration"
+version = "0.7.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "a13f3d0daba03132c0aa9767f98351b3488edc2c100cda2d2ec2b04f3d8d3c8b"
+dependencies = [
+ "bitflags",
+ "core-foundation 0.9.4",
+ "system-configuration-sys",
+]
+
+[[package]]
+name = "system-configuration-sys"
+version = "0.6.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "8e1d1b10ced5ca923a1fcb8d03e96b8d3268065d724548c0211415ff6ac6bac4"
+dependencies = [
+ "core-foundation-sys",
+ "libc",
+]
+
+[[package]]
+name = "thiserror"
+version = "2.0.20"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "ec86235f5fcc2a73650310756d2ac5b138a5780bbbdfae3eeccec992c435ba4f"
+dependencies = [
+ "thiserror-impl",
+]
+
+[[package]]
+name = "thiserror-impl"
+version = "2.0.20"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "bc04cd3e1236dd4a98afca4569f2deb3f120e5422a4023be2cb683f8486292af"
+dependencies = [
+ "proc-macro2",
+ "quote",
+ "syn 3.0.4",
+]
+
+[[package]]
+name = "thread_local"
+version = "1.1.10"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "1ad99c4c6d32803332c548b1af0540b357b3f5fc0be8f6c6bfe8b2e6ae784070"
+dependencies = [
+ "cfg-if",
+]
+
+[[package]]
+name = "tinystr"
+version = "0.8.4"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "b1e27c91459209c2986af3dcf603a5a74a4368754ce37414f59acc971167f643"
+dependencies = [
+ "displaydoc",
+ "zerovec",
+]
+
+[[package]]
+name = "tinyvec"
+version = "1.12.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "bb4ebadaa0af04fab11ae01eb5f9fdb5f9c5b875506e210e71c07873528baa7f"
+dependencies = [
+ "tinyvec_macros",
+]
+
+[[package]]
+name = "tinyvec_macros"
+version = "0.1.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20"
+
+[[package]]
+name = "tokio"
+version = "1.53.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "202caea871b69668250d242070849eb495be178ed697a3e98aebce5bc81a0bed"
+dependencies = [
+ "bytes",
+ "libc",
+ "mio",
+ "pin-project-lite",
+ "socket2",
+ "windows-sys 0.61.2",
+]
+
+[[package]]
+name = "tokio-rustls"
+version = "0.26.4"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "1729aa945f29d91ba541258c8df89027d5792d85a8841fb65e8bf0f4ede4ef61"
+dependencies = [
+ "rustls",
+ "tokio",
+]
+
+[[package]]
+name = "tokio-util"
+version = "0.7.19"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "494815d09bf52b5548659851081238f0ca39ff638363907596da739561c62c52"
+dependencies = [
+ "bytes",
+ "futures-core",
+ "futures-sink",
+ "libc",
+ "pin-project-lite",
+ "tokio",
+]
+
+[[package]]
+name = "tower"
+version = "0.5.3"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "ebe5ef63511595f1344e2d5cfa636d973292adc0eec1f0ad45fae9f0851ab1d4"
+dependencies = [
+ "futures-core",
+ "futures-util",
+ "pin-project-lite",
+ "sync_wrapper",
+ "tokio",
+ "tower-layer",
+ "tower-service",
+]
+
+[[package]]
+name = "tower-http"
+version = "0.6.11"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "4cfcf7e2740e6fc6d4d688b4ef00650406bb94adf4731e43c096c3a19fe40840"
+dependencies = [
+ "bitflags",
+ "bytes",
+ "futures-util",
+ "http",
+ "http-body",
+ "pin-project-lite",
+ "tower",
+ "tower-layer",
+ "tower-service",
+ "url",
+]
+
+[[package]]
+name = "tower-layer"
+version = "0.3.3"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "121c2a6cda46980bb0fcd1647ffaf6cd3fc79a013de288782836f6df9c48780e"
+
+[[package]]
+name = "tower-service"
+version = "0.3.3"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "8df9b6e13f2d32c91b9bd719c00d1958837bc7dec474d94952798cc8e69eeec3"
+
+[[package]]
+name = "tracing"
+version = "0.1.44"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "63e71662fa4b2a2c3a26f570f037eb95bb1f85397f3cd8076caed2f026a6d100"
+dependencies = [
+ "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",
+ "valuable",
+]
+
+[[package]]
+name = "tracing-error"
+version = "0.2.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "8b1581020d7a273442f5b45074a6a57d5757ad0a47dac0e9f0bd57b81936f3db"
+dependencies = [
+ "tracing",
+ "tracing-subscriber",
+]
+
+[[package]]
+name = "tracing-subscriber"
+version = "0.3.23"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "cb7f578e5945fb242538965c2d0b04418d38ec25c79d160cd279bf0731c8d319"
+dependencies = [
+ "sharded-slab",
+ "thread_local",
+ "tracing-core",
+]
+
+[[package]]
+name = "try-lock"
+version = "0.2.5"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "e421abadd41a4225275504ea4d6566923418b7f05506fbc9c0fe86ba7396114b"
+
+[[package]]
+name = "unicode-ident"
+version = "1.0.24"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "e6e4313cd5fcd3dad5cafa179702e2b244f760991f45397d14d4ebf38247da75"
+
+[[package]]
+name = "untrusted"
+version = "0.9.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "8ecb6da28b8a351d773b68d5825ac39017e680750f980f3a1a85cd8dd28a47c1"
+
+[[package]]
+name = "unty"
+version = "0.0.4"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "6d49784317cd0d1ee7ec5c716dd598ec5b4483ea832a2dced265471cc0f690ae"
+
+[[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",
+]
+
+[[package]]
+name = "utf8_iter"
+version = "1.0.4"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "b6c140620e7ffbb22c2dee59cafe6084a59b5ffc27a8859a5f0d494b5d52b6be"
+
+[[package]]
+name = "valuable"
+version = "0.1.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "ba73ea9cf16a25df0c8caa16c51acb937d5712a8429db78a3ee29d5dcacd3a65"
+
+[[package]]
+name = "virtue"
+version = "0.0.18"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "051eb1abcf10076295e815102942cc58f9d5e3b4560e46e53c21e8ff6f3af7b1"
+
+[[package]]
+name = "walkdir"
+version = "2.5.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "29790946404f91d9c5d06f9874efddea1dc06c5efe94541a7d6863108e3a5e4b"
+dependencies = [
+ "same-file",
+ "winapi-util",
+]
+
+[[package]]
+name = "want"
+version = "0.3.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "bfa7760aed19e106de2c7c0b581b509f2f25d3dacaf737cb82ac61bc6d760b0e"
+dependencies = [
+ "try-lock",
+]
+
+[[package]]
+name = "wasi"
+version = "0.11.1+wasi-snapshot-preview1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "ccf3ec651a847eb01de73ccad15eb7d99f80485de043efb2f370cd654f4ea44b"
+
+[[package]]
+name = "wasm-bindgen"
+version = "0.2.127"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "1b70935747edd64d89de3efa29d73789b806c15798f8e7dca4d8ac356b50ce70"
+dependencies = [
+ "cfg-if",
+ "once_cell",
+ "rustversion",
+ "wasm-bindgen-macro",
+ "wasm-bindgen-shared",
+]
+
+[[package]]
+name = "wasm-bindgen-futures"
+version = "0.4.77"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "6b7777d5cc23d0e91404e53ce2d5e8ec7acae3026b16233dba62cd3246457950"
+dependencies = [
+ "js-sys",
+ "wasm-bindgen",
+]
+
+[[package]]
+name = "wasm-bindgen-macro"
+version = "0.2.127"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "77775f8f3f7217702089053b94958f8f54061a3f663417df76e19cbdcca29bc1"
+dependencies = [
+ "quote",
+ "wasm-bindgen-macro-support",
+]
+
+[[package]]
+name = "wasm-bindgen-macro-support"
+version = "0.2.127"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "e11d33f857dc2fb11b8bc75aee111aa9cbeb12cd9f25efd3d4c2a3dd4e235284"
+dependencies = [
+ "bumpalo",
+ "proc-macro2",
+ "quote",
+ "syn 2.0.119",
+ "wasm-bindgen-shared",
+]
+
+[[package]]
+name = "wasm-bindgen-shared"
+version = "0.2.127"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "7ef64dbcc55df09c7e5a46182d181c2cfa3e925f3da937ea764728b4bbb9dcbf"
+dependencies = [
+ "unicode-ident",
+]
+
+[[package]]
+name = "web-sys"
+version = "0.3.104"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "c435338968042f4f59a557f690a253676d47ce13ceb55d70100e7facf6620a30"
+dependencies = [
+ "js-sys",
+ "wasm-bindgen",
+]
+
+[[package]]
+name = "web-time"
+version = "1.1.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "5a6580f308b1fad9207618087a65c04e7a10bc77e02c8e84e9b00dd4b12fa0bb"
+dependencies = [
+ "js-sys",
+ "wasm-bindgen",
+]
+
+[[package]]
+name = "webpki-root-certs"
+version = "1.0.9"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "b96554aa2acc8ccdb7e1c9a58a7a68dd5d13bccc69cd124cb09406db612a1c9b"
+dependencies = [
+ "rustls-pki-types",
+]
+
+[[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 = "windows-link"
+version = "0.2.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "f0805222e57f7521d6a62e36fa9163bc891acd422f971defe97d64e70d0a4fe5"
+
+[[package]]
+name = "windows-registry"
+version = "0.6.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "02752bf7fbdcce7f2a27a742f798510f3e5ad88dbe84871e5168e2120c3d5720"
+dependencies = [
+ "windows-link",
+ "windows-result",
+ "windows-strings",
+]
+
+[[package]]
+name = "windows-result"
+version = "0.4.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "7781fa89eaf60850ac3d2da7af8e5242a5ea78d1a11c49bf2910bb5a73853eb5"
+dependencies = [
+ "windows-link",
+]
+
+[[package]]
+name = "windows-strings"
+version = "0.5.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "7837d08f69c77cf6b07689544538e017c1bfcf57e34b4c0ff58e6c2cd3b37091"
+dependencies = [
+ "windows-link",
+]
+
+[[package]]
+name = "windows-sys"
+version = "0.52.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d"
+dependencies = [
+ "windows-targets",
+]
+
+[[package]]
+name = "windows-sys"
+version = "0.61.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "ae137229bcbd6cdf0f7b80a31df61766145077ddf49416a728b02cb3921ff3fc"
+dependencies = [
+ "windows-link",
+]
+
+[[package]]
+name = "windows-targets"
+version = "0.52.6"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "9b724f72796e036ab90c1021d4780d4d3d648aca59e491e6b98e725b84e99973"
+dependencies = [
+ "windows_aarch64_gnullvm",
+ "windows_aarch64_msvc",
+ "windows_i686_gnu",
+ "windows_i686_gnullvm",
+ "windows_i686_msvc",
+ "windows_x86_64_gnu",
+ "windows_x86_64_gnullvm",
+ "windows_x86_64_msvc",
+]
+
+[[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_msvc"
+version = "0.52.6"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469"
+
+[[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_gnullvm"
+version = "0.52.6"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66"
+
+[[package]]
+name = "windows_i686_msvc"
+version = "0.52.6"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66"
+
+[[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_gnullvm"
+version = "0.52.6"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d"
+
+[[package]]
+name = "windows_x86_64_msvc"
+version = "0.52.6"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec"
+
+[[package]]
+name = "writeable"
+version = "0.6.4"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "3ad82d2a33cdc9674dc7465672f271e096168fcdbe0f799d9e6db8c5892679dc"
+
+[[package]]
+name = "yoke"
+version = "0.8.3"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "709fe23a0424b6a435d82152b1bd3fdfb0833487d5fa90d05d42762a9891fef5"
+dependencies = [
+ "stable_deref_trait",
+ "yoke-derive",
+ "zerofrom",
+]
+
+[[package]]
+name = "yoke-derive"
+version = "0.8.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "de844c262c8848816172cef550288e7dc6c7b7814b4ee56b3e1553f275f1858e"
+dependencies = [
+ "proc-macro2",
+ "quote",
+ "syn 2.0.119",
+ "synstructure",
+]
+
+[[package]]
+name = "zerofrom"
+version = "0.1.8"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "0ec05a11813ea801ff6d75110ad09cd0824ddba17dfe17128ea0d5f68e6c5272"
+dependencies = [
+ "zerofrom-derive",
+]
+
+[[package]]
+name = "zerofrom-derive"
+version = "0.1.7"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "11532158c46691caf0f2593ea8358fed6bbf68a0315e80aae9bd41fbade684a1"
+dependencies = [
+ "proc-macro2",
+ "quote",
+ "syn 2.0.119",
+ "synstructure",
+]
+
+[[package]]
+name = "zeroize"
+version = "1.9.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "e13c156562582aa81c60cb29407084cdb54c4164760106ab78e6c5b0858cf64e"
+
+[[package]]
+name = "zerotrie"
+version = "0.2.5"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "4ea269c3bd32f0a32c321907a2ae912ba6f4649bb0fc764a15627e99a7095a3f"
+dependencies = [
+ "displaydoc",
+ "yoke",
+ "zerofrom",
+]
+
+[[package]]
+name = "zerovec"
+version = "0.11.8"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "bb0464e17806c1d976d5cba29399c7f08e516e279e2ba493f63123b5fca67dd8"
+dependencies = [
+ "yoke",
+ "zerofrom",
+ "zerovec-derive",
+]
+
+[[package]]
+name = "zerovec-derive"
+version = "0.11.6"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "34df6fc39dbd26ddc9c10e6a2984476e13acce22e64e4487636ef494369225da"
+dependencies = [
+ "proc-macro2",
+ "quote",
+ "syn 3.0.4",
+]
+
+[[package]]
+name = "zmij"
+version = "1.0.23"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "29666d0abbfad1e3dc4dcf6144730dd3a3ab225bbbdac83319345b1b44ccfc1b"
diff --git a/puzzler/Cargo.toml b/puzzler/Cargo.toml
new file mode 100644 (file)
index 0000000..c06f659
--- /dev/null
@@ -0,0 +1,14 @@
+[package]
+name = "puzzler"
+version = "0.1.0"
+edition = "2024"
+
+[dependencies]
+bincode = { version = "2", features = ["serde"] }
+color-eyre = "0.6.5"
+reqwest = "0.13.4"
+rand = "0.10"
+serde = { version = "1.0.229", features = ["derive"] }
+serde_json = "1.0.151"
+thiserror = "2.0.20"
+walkdir = "2.5.0"
diff --git a/puzzler/src/main.rs b/puzzler/src/main.rs
new file mode 100644 (file)
index 0000000..57b155f
--- /dev/null
@@ -0,0 +1,265 @@
+use std::{
+    collections::{BTreeMap, HashMap},
+    env,
+    fs::{self, File},
+    io::{BufWriter, Write},
+    path::{Path, PathBuf},
+};
+
+use color_eyre::{Result, eyre::eyre};
+use rand::RngExt;
+use serde::{Deserialize, Serialize};
+
+const DEFAULT_PATTERNS: &str = "word_patterns.bin";
+const DEFAULT_ORDER: usize = 2;
+const MIN_TOTAL_SUPPORT: u64 = 350;
+
+#[derive(Debug, Deserialize, Serialize)]
+struct WordPatterns {
+    patterns: BTreeMap<String, Vec<Pattern>>,
+}
+
+#[derive(Debug, Deserialize, Serialize)]
+struct Pattern {
+    previous: String,
+    following: String,
+    count: u64,
+}
+
+#[derive(Debug, Eq, PartialEq, Serialize)]
+struct Puzzle {
+    previous: String,
+    next: String,
+    candidates: Vec<Candidate>,
+    order: usize,
+}
+
+#[derive(Debug, Serialize, PartialEq, Eq)]
+struct Candidate {
+    word: String,
+    count: u64,
+}
+
+fn main() -> Result<()> {
+    let args: Vec<String> = env::args().collect();
+    let patterns_path = args
+        .get(1)
+        .map(PathBuf::from)
+        .unwrap_or_else(|| PathBuf::from(DEFAULT_PATTERNS));
+    let order = args
+        .get(2)
+        .map(|value| value.parse::<usize>())
+        .transpose()?
+        .unwrap_or(DEFAULT_ORDER);
+
+    let min = args
+        .get(3)
+        .map(|value| value.parse::<usize>())
+        .transpose()?
+        .unwrap_or(MIN_TOTAL_SUPPORT as usize);
+
+    if !(2..=3).contains(&order) {
+        return Err(eyre!("order must be between two and three"));
+    }
+
+    let patterns = load_patterns(&patterns_path)?;
+    let puzzles = create_random_puzzle(&patterns, order, min)?;
+
+    println!("{} ___ {}", puzzles[0].previous, puzzles[0].next);
+    for candidate in &puzzles[0].candidates {
+        println!("  {} ({})", candidate.word, candidate.count);
+    }
+
+    let mut rng = rand::rng();
+    let num: usize = rng.random_range(0..puzzles.len());
+    println!(
+        "Random puzzle: {} ___ {}",
+        puzzles[num].previous, puzzles[num].next
+    );
+
+    let json = serde_json::to_string(&puzzles).expect("json serialization err");
+
+    // println!("{}", &json);
+
+    let file = File::create("output.json").unwrap();
+    let mut writer = BufWriter::with_capacity(1024 * 1024, file);
+    // file.write(&json.into_bytes())?;
+    writer.write_all(&json.into_bytes())?;
+    writer.flush()?;
+
+    dbg!(&puzzles.len());
+    Ok(())
+}
+
+fn load_patterns(path: &Path) -> Result<WordPatterns> {
+    let data = fs::read(path)?;
+    if path
+        .extension()
+        .is_some_and(|extension| extension.eq_ignore_ascii_case("json"))
+    {
+        return Ok(serde_json::from_slice(&data)?);
+    }
+
+    let (patterns, _) =
+        bincode::serde::decode_from_slice::<WordPatterns, _>(&data, bincode::config::standard())?;
+    Ok(patterns)
+}
+
+fn create_random_puzzle(patterns: &WordPatterns, order: usize, min: usize) -> Result<Vec<Puzzle>> {
+    let candidates = patterns
+        .patterns
+        .iter()
+        .filter_map(|(word, entries)| {
+            let support = entries
+                .iter()
+                .filter(|pattern| {
+                    pattern.previous.split_whitespace().count() == order
+                        && pattern.following.split_whitespace().count() == order
+                })
+                .map(|pattern| pattern.count)
+                .sum::<u64>();
+            (support > 0).then_some((word, support))
+        })
+        .collect::<Vec<_>>();
+
+    let filtered = candidates
+        .iter()
+        .copied()
+        .filter(|(_, support)| *support >= min as u64)
+        .collect::<Vec<_>>();
+    let candidate_pool = if filtered.is_empty() {
+        candidates
+    } else {
+        filtered
+    };
+
+    let candidates = candidate_pool
+        .into_iter()
+        .map(|(word, _)| word)
+        .collect::<Vec<_>>();
+
+    if candidates.is_empty() {
+        return Err(eyre!(
+            "the patterns contain no words with paired contexts of order {order}"
+        ));
+    }
+
+    let mut contexts = HashMap::<(String, String), Vec<Candidate>>::new();
+    for (word, entries) in &patterns.patterns {
+        for pattern in entries.iter().filter(|pattern| {
+            pattern.previous.split_whitespace().count() == order
+                && pattern.following.split_whitespace().count() == order
+        }) {
+            contexts
+                .entry((pattern.previous.clone(), pattern.following.clone()))
+                .or_default()
+                .push(Candidate {
+                    word: word.clone(),
+                    count: pattern.count,
+                });
+        }
+    }
+
+    let mut puzzles = contexts
+        .into_iter()
+        .map(|((previous, next), mut candidates)| {
+            candidates.sort_by(|left, right| right.count.cmp(&left.count));
+            Puzzle {
+                previous,
+                next,
+                candidates,
+                order,
+            }
+        })
+        .filter(|puzzle| {
+            puzzle
+                .candidates
+                .iter()
+                .map(|candidate| candidate.count)
+                .sum::<u64>()
+                >= min as u64
+        })
+        .collect::<Vec<_>>();
+    puzzles.sort_by(|left, right| {
+        let left_total = left
+            .candidates
+            .iter()
+            .map(|candidate| candidate.count)
+            .sum::<u64>();
+        let right_total = right
+            .candidates
+            .iter()
+            .map(|candidate| candidate.count)
+            .sum::<u64>();
+        right_total.cmp(&left_total)
+    });
+    if puzzles.is_empty() {
+        return Err(eyre!(
+            "the patterns contain no contexts with enough support"
+        ));
+    }
+    Ok(puzzles)
+}
+
+#[cfg(test)]
+mod tests {
+    use super::*;
+
+    fn patterns() -> WordPatterns {
+        WordPatterns {
+            patterns: BTreeMap::from([(
+                "green".to_owned(),
+                vec![
+                    Pattern {
+                        previous: "red blue".to_owned(),
+                        following: "yellow green".to_owned(),
+                        count: 5001,
+                    },
+                    Pattern {
+                        previous: "blue".to_owned(),
+                        following: "green".to_owned(),
+                        count: 1,
+                    },
+                ],
+            )]),
+        }
+    }
+
+    #[test]
+    fn creates_a_puzzle_for_the_requested_order() {
+        let puzzle = create_random_puzzle(&patterns(), 2, 40).unwrap();
+
+        assert_eq!(puzzle[0].previous, "red blue");
+        assert_eq!(puzzle[0].next, "yellow green");
+    }
+
+    #[test]
+    fn rejects_an_order_without_candidates() {
+        let error = create_random_puzzle(&patterns(), 3, 40).unwrap_err();
+
+        assert!(error.to_string().contains("no words"));
+    }
+
+    #[test]
+    fn loads_the_current_word_pattern_binary_layout() {
+        let path = std::env::temp_dir().join("puzzler-word-patterns.bin");
+        let patterns = WordPatterns {
+            patterns: BTreeMap::from([(
+                "green".to_owned(),
+                vec![Pattern {
+                    previous: "red blue".to_owned(),
+                    following: "yellow green".to_owned(),
+                    count: 3,
+                }],
+            )]),
+        };
+
+        let bytes = bincode::serde::encode_to_vec(&patterns, bincode::config::standard()).unwrap();
+        std::fs::write(&path, &bytes).unwrap();
+
+        let loaded = load_patterns(&path).unwrap();
+        assert_eq!(loaded.patterns["green"][0].previous, "red blue");
+
+        std::fs::remove_file(path).unwrap();
+    }
+}